Dialplan – Working Out When Users Answer

Home » Asterisk Users » Dialplan – Working Out When Users Answer
Asterisk Users 7 Comments

Hey guys,

I’ve got a part of my dialplan that dials multiple people:

exten => direct,n,Dial(${QUEUEEXTS},${RINGTIME})

Multiple extensions are in the ${QUEUEEXTS} from an external script – e.g. SIP/100&SIP/101&SIP/105 etc

This works great, however I want to see if I can find a way to work out (and run an AGI script) when the call is picked up by someone.

Thanks all!

7 thoughts on - Dialplan – Working Out When Users Answer

  • Thanks Satish, fantastic advice. I didn’t even think to look into the dial options – doh!

    Thanks very much,

    Andrew

    From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] Hey guys,

    I’ve got a part of my dialplan that dials multiple people:

    exten => direct,n,Dial(${QUEUEEXTS},${RINGTIME})

    Multiple extensions are in the ${QUEUEEXTS} from an external script – e.g. SIP/100&SIP/101&SIP/105 etc

    This works great, however I want to see if I can find a way to work out (and run an AGI script) when the call is picked up by someone.

    Thanks all!

    Option M or U of Dial application would help you do this. https://wiki.asterisk.org/wiki/display/AST/Application_Dial.

    –Satish Barot

  • Hi Satish/list,

    Looks like I spoke to soon.

    I have the following in my dialplan:

    Dial(${QUEUEEXTS},${RINGTIME},U(queueControl^direct^CONNECTED))

    And after confirming with a “dialplan show” it was definitely in there, I continued to get this:

    ERROR[28167]: app_stack.c:420 gosub_exec: Attempt to reach a non-existent destination for gosub: (Context:queueControl, Extension:s, Priority:1)

    I can’t quite work out why it would be trying to s/1 instead of direct/CONNECTED =/.

    Any ideas?

    Thanks!

    From: Andrew White Sent: Wednesday, 19 December 2012 5:58 PM
    To: Asterisk Users Mailing List – Non-Commercial Discussion Subject: RE: [asterisk-users] Dialplan – working out when users answer

    Thanks Satish, fantastic advice. I didn’t even think to look into the dial options – doh!

    Thanks very much,

    Andrew

    From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] Hey guys,

    I’ve got a part of my dialplan that dials multiple people:

    exten => direct,n,Dial(${QUEUEEXTS},${RINGTIME})

    Multiple extensions are in the ${QUEUEEXTS} from an external script – e.g. SIP/100&SIP/101&SIP/105 etc

    This works great, however I want to see if I can find a way to work out (and run an AGI script) when the call is picked up by someone.

    Thanks all!

    Option M or U of Dial application would help you do this. https://wiki.asterisk.org/wiki/display/AST/Application_Dial.

    –Satish Barot

  • In your case, direct and CONNECTED have to be arguments and not the extension and priority value respectively. Calling Subroutine from dial will always start execution with extension s and priority 1. See the link for more information, Arguments are passed to subroutine using
    ^ as a delimiter.

    –Satish Barot

  • Hi Satish,

    Thanks for your response – sorry on the slow reply.

    So I’ve tried the following in the dialplan:

    exten => direct,n,Dial(${QUEUEEXTS},${RINGTIME},U(queueControl,direct^CONNECTED))

    This has a very strange behavior – the NoOp that is in queueControl,direct,n(CONNECTED) does not show up, however I get the following:

    [2013-01-07 17:31:39] ERROR[19135]: app_stack.c:420 gosub_exec: Attempt to reach a non-existent destination for gosub: (Context:queueControl, Extension:s, Priority:1)

    I’ve also tried with a macro:

    exten => direct,n,Dial(${QUEUEEXTS},${RINGTIME},M(inboundconnected))
    [macro-inboundconnected]
    exten => s,1,NoOp(Inbound connected!)

    It definitely seems like it’s being called, but again no NoOp:

    — Executing [direct@queueControl:11] Dial(“SIP/1000-000047f1”, “SIP/1000,20,M(inboundconnected)”) in new stack

    I would expect some kind of error if I was doing this wrong – have I missed something?

    Thanks for your or anyone elses help in advance!

    Andrew

    From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] Hey guys,

    I’ve got a part of my dialplan that dials multiple people:

    exten => direct,n,Dial(${QUEUEEXTS},${RINGTIME})

    Multiple extensions are in the ${QUEUEEXTS} from an external script – e.g. SIP/100&SIP/101&SIP/105 etc

    This works great, however I want to see if I can find a way to work out (and run an AGI script) when the call is picked up by someone.

    Thanks all!

    Option M or U of Dial application would help you do this. https://wiki.asterisk.org/wiki/display/AST/Application_Dial.

    –Satish Barot

  • HI Andrew, Show your queuecontrol context. You should have extension s with priority
    1 in this context.
    –Satish Barot

    On Mon, Jan 7, 2013 at 12:08 PM, Andrew White

  • Hey Satish,

    I’ve worked this out. I’m sorry, you were completely right and the context is fine. I was testing without answering the call, so the Dial was never connected! Doh!

    Thanks heaps for your help, it’s all working perfectly.

    Cheers,

    Andrew

    From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] Hey guys,

    I’ve got a part of my dialplan that dials multiple people:

    exten => direct,n,Dial(${QUEUEEXTS},${RINGTIME})

    Multiple extensions are in the ${QUEUEEXTS} from an external script – e.g. SIP/100&SIP/101&SIP/105 etc

    This works great, however I want to see if I can find a way to work out (and run an AGI script) when the call is picked up by someone.

    Thanks all!

    Option M or U of Dial application would help you do this. https://wiki.asterisk.org/wiki/display/AST/Application_Dial.

    –Satish Barot