Dialplan_app Dial(): Return Value -1

Hello guys,

I have a problem with the dial application. Let me briefly describe my scenario:

Asterisk 1.4.42

When an incoming call is in progress a shell script is called via System() which activates power for an external speaker. If the call is answered or the timeout limit is reached power is deactivated. So far, so good. But I’m unable to make Asterisk continue the dialplan, if the caller hangs up before the call is answered or the timeout limit is reached. I guess, the reason is, that the dial function returns -1. I already tried TryExec, setting the variable DIALSTATUS by hand and I’m using the dial-option g. But it does not work.

Here is a minimal example of my dialplan so far:

exten => _X.,1,Verbose(Incoming Call to Phoneapplication)
exten => _X.,n,System(power on)
exten => _X.,n,Dial(SIP/${NUM}@${IP},10,M(off)gkktT)
[color=#0000BF];When the channel that triggered the Dial command hangs up, the Dial command exits, but does not continue the dialplan.[/color]
exten => _X.,n,ExecIF($["${DIALSTATUS}" = “BUSY”],System,power off)
exten => _X.,n,ExecIF($["${DIALSTATUS}" = “CONGESTION”],System,power off)
exten => _X.,n,ExecIF($["${DIALSTATUS}" = “CHANUNAVAIL”],System,power off)
exten => _X.,n,ExecIF($["${DIALSTATUS}" = “DONTCALL”],System,power off)
exten => _X.,n,ExecIF($["${DIALSTATUS}" = “INVALIDARGS”],System,power off)
exten => _X.,n,ExecIF($["${DIALSTATUS}" = “TORTURE”],System,power off)
exten => _X.,n,ExecIF($["${DIALSTATUS}" = “ANSWER”],System,power off)
exten => _X.,n,ExecIF($["${DIALSTATUS}" = “NOANSWER”],System,power off)
exten => _X.,n,ExecIF($["${DIALSTATUS}" = “CANCEL”],System,power off)
exten => _X.,n,System(power off)

[macro-off]
exten => s,1,Verbose(Macro: Power Off)
exten => s,n,System(power off)

And finally my question:
Is it or how is it possible to “force” asterisk to continue the dialplan after Dial command has exited with an “non-zero” return value.

Thanks for your time and your help
Henning

Dialplan to be run after the channel in the PBX has hungup has to be in the “h” extension.

Thanks David,

that was the solution. :smiley: