Trigger an action when a call is picked up from a queue

At the moment i have an AGI script running whenever a call hangs up, but I’m now wanting to do the same thing but right after a call has been picked up (not before). One of the requirements in the data sent is the SIP ID (SIP/7111 for example).

The call enters into a queue and then gets picked up by the agent, so it has to be right after the call is picked up (otherwise we won’t know who picked up the call because it could be one from a pool of many)

Is this at all possible? At the moment I’m grabbing the user agent from CDR, obviously not possible until the call has ended.

Example of what I have now (trimmed down for your pleasure)

[sub-queue-helpdesk-tech]
;Perform action on agent hangup
exten => h,1,AGI(api-mysql.php,${CDR(dstchannel)},${LINECALLERID}, ${CDR(lastdata)},${SOURCENUMBER},50) 
same => n,Queue(HelpDeskTech,tk)
same => n,Return()

Thanks in advance!

membergosub (or membermacro, but macros are deprecated).

Thanks for the prompt response David! Now, I’m struggling to find any documentation on that function, is that the actual function name?

I’ve found something that might be it

[quote]announce

The “announce = XXX” option in queues.conf makes Asterisk play the XXX announcement to the member of the queue who picks up the call in a similar manner to the A() option of the Dial() cmd. This can also be invoked in the Queue() application (‘Queue(queuename,options,URL,announceoverride,timeout,AGI,macro,gosub,rule)’).

Note that the announcement is played in the language set on the answering device, not in the language of the originating channel.[/quote]
From : http://www.voip-info.org/wiki/view/Asterisk+config+queues.conf

Is it the gosub option listed there?

It is the one documented here: svn.digium.com/svn/asterisk/trun … onf.sample

Where you define the queue in your dialplan you can specify a macro agi etc
[Syntax]
Queue(queuename[,options[,URL[,announceoverride[,timeout[,AGI[,macro[,gosub[,rule[,position]]]]]]]]])

we use the macro to store the call details in a CRM, we haev a modified version of freepbx that allows you to set teh macro name in the queue

AGI
Will setup an AGI script to be executed on the calling party’s channel
once they are connected to a queue member.
macro
Will run a macro on the calling party’s channel once they are
connected to a queue member.
gosub
Will run a gosub on the calling party’s channel once they are
connected to a queue member.
rule
Will cause the queue’s defaultrule to be overridden by the rule
specified.

[quote=“ianplain”]Where you define the queue in your dialplan you can specify a macro agi etc
[Syntax]
Queue(queuename[,options[,URL[,announceoverride[,timeout[,AGI[,macro[,gosub[,rule[,position]]]]]]]]])

we use the macro to store the call details in a CRM, we haev a modified version of freepbx that allows you to set teh macro name in the queue

AGI
Will setup an AGI script to be executed on the calling party’s channel
once they are connected to a queue member.
macro
Will run a macro on the calling party’s channel once they are
connected to a queue member.
gosub
Will run a gosub on the calling party’s channel once they are
connected to a queue member.
rule
Will cause the queue’s defaultrule to be overridden by the rule
specified.[/quote]

Thank you very much both of you! Both worked perfectly! :smile: