Branching Busy/Unavailable on DialPlan – Asterisk
February 16, 2011 at 11:57 am 1 comment
Asterisk is one of the most used open source pbx with multiple features that hardly could get in others. Now a days most of appliances are based on asterisk. Dial plan is the core routing part in asterisk which is written in extensions.conf file. Dial plan decides the flow of call based on its configuration and Branching has important role on it.
Here is basic configuration
exten => 1001,1,Dial(SIP/1001,30)
exten => 1001,2,Goto(1001-${DIALSTATUS},1)
exten => 1001-BUSY,1,Voicemail(b1001@default)
exten => 1001-BUSY,2,Hangup
exten => 1001-NOANSWER,1,Voicemail(u1001@default)
exten => 1001-NOANSWER,2,Hangup
exten => _1001-.,1,Goto(1001-NOANSWER,1)
Extension 1001 will dial and based on Dialstatus it will branch which could be treated as three parts ( here ).
If BUSY status then will go to voicemail with busy msg. If noanswer status then will jump to voicemail with not avaiable msg else rest will be treated as no answer. The same thing can be done using macro.
[macro-stdexten]
; Standard extension macro
; ${ARG1} – Voicemail box
; ${ARG2} – Device extension(s) to ring
; Usage
; in main context do exten => 1000,1,Macro(stdexten,1000,1000)
; I use variables defined in the globals section so it becomes
; exten => ${PHONE1},1,Macro(stdexten,${PHONE1},${PHONE1})
;
exten => s,1,Dial(${ARG2},20) ; Ring the interface, 20 seconds maximum
exten => s,2,Goto(s-${DIALSTATUS},1) ; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
exten => s-BUSY,1,Voicemail(b${ARG1}) ; If busy, send to voicemail w/ busy announce
exten => s-BUSY,2,Goto(public,s,1) ; If they press #, return to start
exten => s-NOANSWER,1,Voicemail(u${ARG1}) ; If unavailable, send to voicemail w/ unavail announce
exten => s-NOANSWER,2,Goto(public,s,1) ; If they press #, return to start
exten => _s-.,1,Goto(s-NOANSWER,1) ; Treat anything else as no answer
and to call this macro
exten => 1001,1,Macro(stdexten,1001,SIP/spa1001)
exten => spa1001,1,Goto(1001,1)
Entry filed under: VOIP.
1. sohailaziz | September 7, 2011 at 9:01 am
thanks , great post indeed