[Asterisk-Users] Dial option g

George Burt george at trueshot.com
Sun Mar 6 13:00:23 MST 2005


I am trying to run a macro at the beginning of call and after the call is
terminated.

exten => 33,1,Macro(makeOnJS,${EXTEN},${CALLERIDNUM},${DATETIME})
exten => 33,2,Dial(SIP/33,15,tg)
exten => 33,3,NoOp(makeOffJS*${EXTEN}*${CALLERIDNUM}*${DATETIME})
exten => 33,4,Macro(makeOffJS,${EXTEN},${CALLERIDNUM},${DATETIME})
exten => 33,102,Voicemail2(b33)  ; go to Voicemail2 if phone is "B"usy
exten => 33,103,Macro(makeOffJS,${EXTEN},${CALLERIDNUM},${DATETIME})
exten => 33,104,Hangup ; and then hangup.


This runs the [macro-makeOnJS] just fine.

It runs the [macro-makeOffJS] only when the called party hangs up first.

In fact, that is exactly what the option g description says in the Dial
documentation:
g: When the called party hangs up, exit to execute more commands in the
current context.

In the "Return Codes" description of the Dial Command, it says:

Dial returns -1 if the originating channel hangs up, or if the call is
bridged and either of the parties in the bridge terminate the call.

I need a way to do something if the Dial returns a -1 code.

Any ideas?

Thanks,

George Burt




More information about the asterisk-users mailing list