A J Stiles
2016-Nov-24 17:20 UTC
[asterisk-users] Triggering an AGI script when a queued call is answered
Many years ago, I used to have an AGI script that fired on an incoming call, did some database lookups and ended up raising a notification on the screen of the person whose phone was ringing, with the details looked up from the incoming caller ID. All that fell by the wayside when Debian Squeeze introduced KDE4 and the notification system I had created stopped working. And some time after that, we introduced queues instead of everyone having their own direct inbound number ..... Now, some tie-wearer is dribbling on me to bring back the old system. I am confident that I could write something that will work with the new cross- desktop notification model (and in any case, that is a matter for Elsewhere On The Internet). However, I am going to need to hook it into Asterisk somehow. What I think I need is for an event to fire when someone answers a queued call; then I can run an AGI script, or execute a script using the System() command. Within my script, I need the variable ${CALLERID(num)} to look up the caller's details from their number, and the answering extension to decide where to send the notification. Is there a way of specifying in the dialplan or queue configuration that I want to execute a script when an agent answers? So far, all I can think of is joining local channels into the queue instead of the actual phones, so I get to run a bit of dialplan where I can kick off the AGI script and then Dial() the actual extension; but that could get terribly unwieldy if not done extremely carefully. (Of course, the manager in question also insists for me to implement all this without a moment's downtime. Kids, this is what happens when your brain is deprived of oxygen .....) -- AJS Note: Originating address only accepts e-mail from list! If replying off- list, change address to asterisk1list at earthshod dot co dot uk .
Carlos Chavez
2016-Nov-24 18:42 UTC
[asterisk-users] Triggering an AGI script when a queued call is answered
On 11/24/16 11:20 AM, A J Stiles wrote:> Many years ago, I used to have an AGI script that fired on an incoming call, > did some database lookups and ended up raising a notification on the screen of > the person whose phone was ringing, with the details looked up from the > incoming caller ID. > > All that fell by the wayside when Debian Squeeze introduced KDE4 and the > notification system I had created stopped working. And some time after that, > we introduced queues instead of everyone having their own direct inbound > number ..... > > Now, some tie-wearer is dribbling on me to bring back the old system. > > > I am confident that I could write something that will work with the new cross- > desktop notification model (and in any case, that is a matter for Elsewhere On > The Internet). However, I am going to need to hook it into Asterisk somehow. > > > What I think I need is for an event to fire when someone answers a queued call; > then I can run an AGI script, or execute a script using the System() command. > Within my script, I need the variable ${CALLERID(num)} to look up the caller's > details from their number, and the answering extension to decide where to send > the notification. > > Is there a way of specifying in the dialplan or queue configuration that I want > to execute a script when an agent answers? > > So far, all I can think of is joining local channels into the queue instead of > the actual phones, so I get to run a bit of dialplan where I can kick off the > AGI script and then Dial() the actual extension; but that could get terribly > unwieldy if not done extremely carefully. > > > (Of course, the manager in question also insists for me to implement all this > without a moment's downtime. Kids, this is what happens when your brain is > deprived of oxygen .....) >See https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue for information on running an AGI, macro or gosub when the caller is connected to an agent. -- Telecomunicaciones Abiertas de M?xico S.A. de C.V. Carlos Ch?vez +52 (55)9116-9161