[QUESTION] Dial & continue with dialplan

Is it possible to continue with the dialplan in certain extension after Dial command is completed (regardless of the result of the Dial), and how?

For example:

exten => s,1,Dial(ZAP/g1/12345)
exten => s,n,Macro(doSomethingAfterDial)

No.

The dial is a “condition” application.
It returns when the dial has been terminated.

Technically a dial is terminated by a busy, congestion or hangup.
So a ongoing call is not “returning” from the “dial” - talk is part of it till state change.

May i ask what you try to accomplish ?
Maybe there is another/better way ?

voip-info.org/wiki-Asterisk+cmd+Dial
Dial(type/identifier, timeout, options, URL)
“The options parameter, which is optional, is a string containging zero or more of the following flags and parameters:

g: When the called party hangs up, exit to execute more commands in the current context.”

Looks like You can do something after dial

I was wondering the very same thing. In my case, I wanted to implement manual wrap-up mechanism for my agents (cause they can be logged in in multiple queues at the same time, and didn’t find proper out-of-the-box solution), so it would be excellent, if this worked:

exten => _999.,1,Macro(PauseAgent, ${EXTEN:3})
exten => _999.,2,Dial(${EXTEN:3})
exten => _999.,3,Wait(5)
exten => _999.,1,Macro(UnPauseAgent, ${EXTEN:3})

[quote=“fdragowski”]http://www.voip-info.org/wiki-Asterisk+cmd+Dial
Dial(type/identifier, timeout, options, URL)
“The options parameter, which is optional, is a string containging zero or more of the following flags and parameters:

g: When the called party hangs up, exit to execute more commands in the current context.”

Looks like You can do something after dial[/quote]

I will try this. Are there any other options as well?

[quote=“fdragowski”]http://www.voip-info.org/wiki-Asterisk+cmd+Dial
Dial(type/identifier, timeout, options, URL)
“The options parameter, which is optional, is a string containging zero or more of the following flags and parameters:

g: When the called party hangs up, exit to execute more commands in the current context.”

Looks like You can do something after dial[/quote]

No you cant.

Pay att. to the words
When the called party hangs up

That is the state-change i mentioned before.
There is no further processing after dial without a statechange.

we use a mini-IVR for some of our agents - here is the code:

exten => s,7,Dial(${ARG1},20,rt) ; Ring the interface, 20 seconds maximum exten => s,8,Goto(s-${DIALSTATUS},1) ; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER) exten => s-NOANSWER,1,Background(standarduser)

what this allows is for us to selectively do things after a call…in our case, we play a background prompt that allows teh caller to press 1 to continue holding, 2 to go into the customer service queue, or 3 to leave a voicemail (if the user has voicemail).

this works great for us…

Yep, i use that one too. But its not enabling you to process the dialplan WHILE the dial (here: 20s) is active.

I thought about “multitasking” scripts already too, the only way you can do it these days is to have an AGI script handling the call from the very beginning. The AGI can call subscripts.

[quote=“whoiswes”]we use a mini-IVR for some of our agents - here is the code:

exten => s,7,Dial(${ARG1},20,rt) ; Ring the interface, 20 seconds maximum exten => s,8,Goto(s-${DIALSTATUS},1) ; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER) exten => s-NOANSWER,1,Background(standarduser)

what this allows is for us to selectively do things after a call…in our case, we play a background prompt that allows teh caller to press 1 to continue holding, 2 to go into the customer service queue, or 3 to leave a voicemail (if the user has voicemail).

this works great for us…[/quote]

Which version of the Asterisk do you have?

this worked on both 1.0.7 and 1.2.4 - we just upgraded two weeks ago, but this macro has been in use for about 4 months now.

there is probably a better way to do it, but it works for us quite well…

[quote=“whoiswes”]
there is probably a better way to do it, but it works for us quite well…[/quote]

Well, we use that way too and its doing a pretty good job.

There is always a DIFFERENT way, but better… ?

[quote=“whoiswes”]we use a mini-IVR for some of our agents - here is the code:

exten => s,7,Dial(${ARG1},20,rt) ; Ring the interface, 20 seconds maximum exten => s,8,Goto(s-${DIALSTATUS},1) ; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER) exten => s-NOANSWER,1,Background(standarduser)

what this allows is for us to selectively do things after a call…in our case, we play a background prompt that allows teh caller to press 1 to continue holding, 2 to go into the customer service queue, or 3 to leave a voicemail (if the user has voicemail).

this works great for us…[/quote]

I have tried this, but I never seem to get ANSWER or NOANSWER…the dialplan simply stops after Dial command is completed. Am I missing something, that I should set?

Here’s my sample code:

[code][macro-DialSomeone]
exten => s,1,Verbose(DIALING SIP/${ARG1}@111.111.111.200 …)
exten => s,2,Dial(SIP/${ARG1}@111.111.111.200,20,rt)
exten => s,3,Goto(s-${DIALSTATUS},1)
; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)

exten => s-NOANSWER,1,Verbose(NOANSWER)
exten => s-BUSY,1,Verbose(BUSY)
exten => s-CHANUNAVAIL,1,Verbose(CHANUNAVAIL)
exten => s-CONGESTION,1,Verbose(CONGESTION)
exten => s-ANSWER,1,Verbose(ANSWER)

[from-sip]
exten => _1.,1,Macro(DialSomeone,${EXTEN:1})[/code]

Like i already said, asterisk is NOT processing the call any further after the DIAL command.

The only thing NEXT processed is either
busy
congestion
no-channel-avai…
hangup
etc

When the call is dialed, there “is nothing” further to handle.
Which is technically correct that way, cause when a DIAL is answered, we wait till its done…then we go on.

The next event rising a handling is one of the above.

But i do agree, it would be neat to have a function like “backstabhandling” which is a hook giving the user the ability to do some things with an established call - which every DIAL becomes automatically when answered.

The only way currently to work around that, is to have the call handled from the very beginnen by an AGI script. That one could call childs - independent of the callstate.

Yeah, I understand that you cannot do things while call (Dial application) is in progress, I was just wondering about that little script that whoiswes posted - in which obviously the dialplan is supposed to continue after the Dial application - but in reality this never happens - not even when the call ends. How did he did it?

The code, whoiswes posted, is doing nothing else then processing the call state change:

Busy, noasnwer etc.

Thats done by the line
"Goto Dialstatus" which should be named correct “Goto Dialresult”.