Re: [asterisk-users] Queues with unavailable members
C. Chad Wallace cwall...@lodgingcompany.com writes: OK, I decided to write it up in AEL. It's incomplete and untested, but it probably gets the idea across a little better. context agentcalls { _2XX = { Set(AGENT=${EXTEN}); // Assuming agent ID is extension. if (${EPOCH}${DB(AgentPaused/${AGENT})}) { // Let the call through to the cell phone Dial(...); if (cell call was rejected) { // Flag agent as paused for the next 30 seconds. Set(DB(AgentPaused/${AGENT})=$[${EPOCH}+30]); }; } else { // Agent still paused. }; }; }; I was going in the same direction at the end of my first mail, but I hadn't written any code. There is a problem though: The Queue application will keep sending calls to the Local channel, which have to be rejected, over and over. Would it perhaps work to simply Wait(30) if the call is rejected by the phone? If the Queue assumes that the phone is busy for those 30 seconds, I have accomplished my goal. It's worth a shot. /Benny ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- AstriCon 2009 - October 13 - 15 Phoenix, Arizona Register Now: http://www.astricon.net asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Queues with unavailable members
Benny Amorsen benny+use...@amorsen.dk writes: Would it perhaps work to simply Wait(30) if the call is rejected by the phone? If the Queue assumes that the phone is busy for those 30 seconds, I have accomplished my goal. It's worth a shot. This works! Actually I tried out Wait(1000), but that worked fine. After 30 seconds (the timeout in the queue) the Local channel was closed, and a short while later a new call attempt was made. Just as I was hoping. It would still be neat to have a min_dial_interval option, so that Queue never overwhelms the server with failing dial attempts. /Benny ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- AstriCon 2009 - October 13 - 15 Phoenix, Arizona Register Now: http://www.astricon.net asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Queues with unavailable members
At 11:23 AM on 16 Oct 2009, Benny Amorsen wrote: I was going in the same direction at the end of my first mail, but I hadn't written any code. There is a problem though: The Queue application will keep sending calls to the Local channel, which have to be rejected, over and over. Would it perhaps work to simply Wait(30) if the call is rejected by the phone? If the Queue assumes that the phone is busy for those 30 seconds, I have accomplished my goal. It's worth a shot. It would only be trying one agent at a time for each waiting queue member... I don't know how expensive it is to open and close a Local channel and do a DB lookup, but I wouldn't expect it to be a real problem. You are at least avoiding multiple calls out to the cellular network. Also, if there is another agent available, the caller would be connected immediately, and it wouldn't have to make any more attempts. With the Wait() solution, that caller would be waiting for 30 seconds regardless of whether there's anyone else available. Of course, I don't know your business case, so you'll have to decide which of the two problems is worse. -- C. Chad Wallace, B.Sc. The Lodging Company http://www.skihills.com/ OpenPGP Public Key ID: 0x262208A0 signature.asc Description: PGP signature ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- AstriCon 2009 - October 13 - 15 Phoenix, Arizona Register Now: http://www.astricon.net asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Queues with unavailable members
C. Chad Wallace cwall...@lodgingcompany.com writes: It would only be trying one agent at a time for each waiting queue member... Would it? Almost all our queues are on a ringall strategy. I don't know how expensive it is to open and close a Local channel and do a DB lookup, but I wouldn't expect it to be a real problem. You are at least avoiding multiple calls out to the cellular network. Not that expensive, but still a bit of a waste when done every couple of seconds. Especially if multiple agents are unavailable. Also, if there is another agent available, the caller would be connected immediately, and it wouldn't have to make any more attempts. With the Wait() solution, that caller would be waiting for 30 seconds regardless of whether there's anyone else available. This bit is solved by the ringall strategy. Of course, I don't know your business case, so you'll have to decide which of the two problems is worse. I'm fairly happy with the Wait(1000) solution for now. We'll see if testing shows any problems with it. /Benny ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- AstriCon 2009 - October 13 - 15 Phoenix, Arizona Register Now: http://www.astricon.net asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Queues with unavailable members
At 7:35 PM on 16 Oct 2009, Benny Amorsen wrote: C. Chad Wallace cwall...@lodgingcompany.com writes: Also, if there is another agent available, the caller would be connected immediately, and it wouldn't have to make any more attempts. With the Wait() solution, that caller would be waiting for 30 seconds regardless of whether there's anyone else available. This bit is solved by the ringall strategy. Of course, I don't know your business case, so you'll have to decide which of the two problems is worse. I'm fairly happy with the Wait(1000) solution for now. We'll see if testing shows any problems with it. Oh yeah, I hadn't even considered the ringall strategy! With that, your Wait() solution sounds perfect to me. Congrats! -- C. Chad Wallace, B.Sc. The Lodging Company http://www.skihills.com/ OpenPGP Public Key ID: 0x262208A0 signature.asc Description: PGP signature ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- AstriCon 2009 - October 13 - 15 Phoenix, Arizona Register Now: http://www.astricon.net asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Queues with unavailable members
Elliot Otchet elliot.otc...@callingcircles.com writes: Have you tried autopause=yes in your queue configuration? You can then unpause the member by either the dialplan (e.g. having the cell phone user log back in) or using an AMI based program to change the paused state. You can read more about the latter here: http://astbook.asteriskdocs.org/en/2nd_Edition/asterisk-book-html-chunk/asterisk-APP-F-30.html That looks very interesting, thank you! First of all though I need to avoid having them autopause just because they don't answer their phone. It should only happen if the call to their phone fails completely. I guess that could be done by not doing autopause but instead pausing manually in the context that the Local call passes through. That would also solve my second problem, which is that I need to pause it in all queues, not just one queue. The last challenge is to somehow unpause them after a while. In traditional programming that would be something like keeping a list of timeout,queuemember ordered by timeout, and then when every call comes in unpause and remove the ones where timeout expired... I'm not sure that I can make an ordered list in the dialplan though. I may have to resort to AGI, but I still need somewhere to actually store the list. Tricky. /Benny ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- AstriCon 2009 - October 13 - 15 Phoenix, Arizona Register Now: http://www.astricon.net asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Queues with unavailable members
Lenz Emilitri lenz.lo...@gmail.com writes: You could configure them as agents and have them log off automatically after a while they're not responding. Agents have to log in and wait for calls though, don't they? There used to be AgentCallbackLogin, but that has been replaced by dialplan code and chan_local. Otherwise a nice idea though. /Benny ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- AstriCon 2009 - October 13 - 15 Phoenix, Arizona Register Now: http://www.astricon.net asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Queues with unavailable members
That shouldn't be too hard to accomplish. If you've got the addons (and mysql) installed you could store them in a MySQL table (timestamp, device) and have a cron job set to run at X frequency that un-pauses the queue members via AMI. Don't want to go to MySQL? Use system() to 'touch' files named after devices. Then have your cron script go through the files by creation date. Either way gets you there. -Elliot -Original Message- From: Benny Amorsen [mailto:benny+use...@amorsen.dk] Sent: Thursday, October 15, 2009 5:06 AM To: Elliot Otchet Cc: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: Queues with unavailable members Elliot Otchet elliot.otc...@callingcircles.com writes: Have you tried autopause=yes in your queue configuration? You can then unpause the member by either the dialplan (e.g. having the cell phone user log back in) or using an AMI based program to change the paused state. You can read more about the latter here: http://astbook.asteriskdocs.org/en/2nd_Edition/asterisk-book-html-chunk/asterisk-APP-F-30.html That looks very interesting, thank you! First of all though I need to avoid having them autopause just because they don't answer their phone. It should only happen if the call to their phone fails completely. I guess that could be done by not doing autopause but instead pausing manually in the context that the Local call passes through. That would also solve my second problem, which is that I need to pause it in all queues, not just one queue. The last challenge is to somehow unpause them after a while. In traditional programming that would be something like keeping a list of timeout,queuemember ordered by timeout, and then when every call comes in unpause and remove the ones where timeout expired... I'm not sure that I can make an ordered list in the dialplan though. I may have to resort to AGI, but I still need somewhere to actually store the list. Tricky. /Benny This message is intended only for the use of the individual (s) or entity to which it is addressed and may contain information that is privileged, confidential, and/or proprietary to Calling Circles LLC and its affiliates. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution, forwarding or copying of this communication is prohibited without the express permission of the sender. If you have received this communication in error, please notify the sender immediately and delete the original message. ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- AstriCon 2009 - October 13 - 15 Phoenix, Arizona Register Now: http://www.astricon.net asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Queues with unavailable members
Elliot Otchet elliot.otc...@callingcircles.com writes: That shouldn't be too hard to accomplish. If you've got the addons (and mysql) installed you could store them in a MySQL table (timestamp, device) and have a cron job set to run at X frequency that un-pauses the queue members via AMI. Don't want to go to MySQL? Use system() to 'touch' files named after devices. Then have your cron script go through the files by creation date. Either way gets you there. This seems like a very heavyweight solution. Having a cron job running every minute isn't particularly attractive, and making a daemon do the job isn't my cup of tea either. Perhaps the problem could be restated in a different way: After a queue member rejects a call (instead of just not answering), the queue should wait X amount of time before sending the next call. Queues.conf has a million settings, but I can't find one which does this. /Benny ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- AstriCon 2009 - October 13 - 15 Phoenix, Arizona Register Now: http://www.astricon.net asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Queues with unavailable members
At 3:37 PM on 15 Oct 2009, Benny Amorsen wrote: Perhaps the problem could be restated in a different way: After a queue member rejects a call (instead of just not answering), the queue should wait X amount of time before sending the next call. Queues.conf has a million settings, but I can't find one which does this. To pause an agent, store the unpause time per agent in the AstDB. Then when you're deciding whether to give out a call (in the Local channel), look up ${DB(AgentPaused/agentid)} and compare it to the current time. If there is no record or the time has passed, put the call through; otherwise, skip that agent. Sorry, no example code yet... I just wanted to get the idea out there. -- C. Chad Wallace, B.Sc. The Lodging Company http://www.skihills.com/ OpenPGP Public Key ID: 0x262208A0 signature.asc Description: PGP signature ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- AstriCon 2009 - October 13 - 15 Phoenix, Arizona Register Now: http://www.astricon.net asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Queues with unavailable members
At 11:32 AM on 15 Oct 2009, C. Chad Wallace wrote: At 3:37 PM on 15 Oct 2009, Benny Amorsen wrote: Perhaps the problem could be restated in a different way: After a queue member rejects a call (instead of just not answering), the queue should wait X amount of time before sending the next call. Queues.conf has a million settings, but I can't find one which does this. To pause an agent, store the unpause time per agent in the AstDB. Then when you're deciding whether to give out a call (in the Local channel), look up ${DB(AgentPaused/agentid)} and compare it to the current time. If there is no record or the time has passed, put the call through; otherwise, skip that agent. Sorry, no example code yet... I just wanted to get the idea out there. OK, I decided to write it up in AEL. It's incomplete and untested, but it probably gets the idea across a little better. context agentcalls { _2XX = { Set(AGENT=${EXTEN}); // Assuming agent ID is extension. if (${EPOCH}${DB(AgentPaused/${AGENT})}) { // Let the call through to the cell phone Dial(...); if (cell call was rejected) { // Flag agent as paused for the next 30 seconds. Set(DB(AgentPaused/${AGENT})=$[${EPOCH}+30]); }; } else { // Agent still paused. }; }; }; -- C. Chad Wallace, B.Sc. The Lodging Company http://www.skihills.com/ OpenPGP Public Key ID: 0x262208A0 signature.asc Description: PGP signature ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- AstriCon 2009 - October 13 - 15 Phoenix, Arizona Register Now: http://www.astricon.net asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Queues with unavailable members
You could configure them as agents and have them log off automatically after a while they're not responding. l. 2009/10/14 Benny Amorsen benny+use...@amorsen.dkbenny%2buse...@amorsen.dk We have the possibly rather unique setup where we have cell phones posing as SIP devices. The SIP registration for those unfortunately doesn't go away just because the phone is off, since the registration is done by our cell-phone=SIP gateway, and that gateway has no way of knowing whether the phone is on or off. This is usually ok, but it gets problematic if the cell phone is a member of a queue. In that case Queue() keeps sending the call to the phone, and the cell-phone=SIP gateway dutifully makes a call, which is then rejected by the cellular network. A few seconds later, Queue() tries again. This needlessly wastes resources both in Asterisk and in the cellular network. One idea is to run the call through chan_local (we do this anyway because we need to format the caller-ID differently for different phones) and then record if a call is rejected, and for the next 30 seconds just abort if we are asked to send a call to that particular phone. The downside is that we are still running a call through part of the dial plan, but at least it can be done in perhaps 3 lines of code. I would very much like to hear about smarter ways to do it. /Benny ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- AstriCon 2009 - October 13 - 15 Phoenix, Arizona Register Now: http://www.astricon.net asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users -- Loway - home of QueueMetrics - http://queuemetrics.com ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- AstriCon 2009 - October 13 - 15 Phoenix, Arizona Register Now: http://www.astricon.net asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Queues with unavailable members
What is the command to log off the agents ? Thx On Wed, Oct 14, 2009 at 6:45 PM, Lenz Emilitri lenz.lo...@gmail.com wrote: You could configure them as agents and have them log off automatically after a while they're not responding. l. 2009/10/14 Benny Amorsen benny+use...@amorsen.dkbenny%2buse...@amorsen.dk We have the possibly rather unique setup where we have cell phones posing as SIP devices. The SIP registration for those unfortunately doesn't go away just because the phone is off, since the registration is done by our cell-phone=SIP gateway, and that gateway has no way of knowing whether the phone is on or off. This is usually ok, but it gets problematic if the cell phone is a member of a queue. In that case Queue() keeps sending the call to the phone, and the cell-phone=SIP gateway dutifully makes a call, which is then rejected by the cellular network. A few seconds later, Queue() tries again. This needlessly wastes resources both in Asterisk and in the cellular network. One idea is to run the call through chan_local (we do this anyway because we need to format the caller-ID differently for different phones) and then record if a call is rejected, and for the next 30 seconds just abort if we are asked to send a call to that particular phone. The downside is that we are still running a call through part of the dial plan, but at least it can be done in perhaps 3 lines of code. I would very much like to hear about smarter ways to do it. /Benny ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- AstriCon 2009 - October 13 - 15 Phoenix, Arizona Register Now: http://www.astricon.net asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users -- Loway - home of QueueMetrics - http://queuemetrics.com ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- AstriCon 2009 - October 13 - 15 Phoenix, Arizona Register Now: http://www.astricon.net asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- AstriCon 2009 - October 13 - 15 Phoenix, Arizona Register Now: http://www.astricon.net asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Queues with unavailable members
Have you tried autopause=yes in your queue configuration? You can then unpause the member by either the dialplan (e.g. having the cell phone user log back in) or using an AMI based program to change the paused state. You can read more about the latter here: http://astbook.asteriskdocs.org/en/2nd_Edition/asterisk-book-html-chunk/asterisk-APP-F-30.html -Elliot -Original Message- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Benny Amorsen Sent: Wednesday, October 14, 2009 7:58 AM To: asterisk-users@lists.digium.com Subject: [asterisk-users] Queues with unavailable members We have the possibly rather unique setup where we have cell phones posing as SIP devices. The SIP registration for those unfortunately doesn't go away just because the phone is off, since the registration is done by our cell-phone=SIP gateway, and that gateway has no way of knowing whether the phone is on or off. This is usually ok, but it gets problematic if the cell phone is a member of a queue. In that case Queue() keeps sending the call to the phone, and the cell-phone=SIP gateway dutifully makes a call, which is then rejected by the cellular network. A few seconds later, Queue() tries again. This needlessly wastes resources both in Asterisk and in the cellular network. One idea is to run the call through chan_local (we do this anyway because we need to format the caller-ID differently for different phones) and then record if a call is rejected, and for the next 30 seconds just abort if we are asked to send a call to that particular phone. The downside is that we are still running a call through part of the dial plan, but at least it can be done in perhaps 3 lines of code. I would very much like to hear about smarter ways to do it. /Benny ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- AstriCon 2009 - October 13 - 15 Phoenix, Arizona Register Now: http://www.astricon.net asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users This message is intended only for the use of the individual (s) or entity to which it is addressed and may contain information that is privileged, confidential, and/or proprietary to Calling Circles LLC and its affiliates. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution, forwarding or copying of this communication is prohibited without the express permission of the sender. If you have received this communication in error, please notify the sender immediately and delete the original message. ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- AstriCon 2009 - October 13 - 15 Phoenix, Arizona Register Now: http://www.astricon.net asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users