Dialplan: Error branching busy/unavailable +101?


#1

I set up my dialplan to branch if busy:

exten => 100,1,Dial(SIP/RedStapler,20)
exten => 100,2,VoiceMail(u100@default)
exten => 100,3,Hangup()
exten => 100,102,VoiceMail(b100@default)
exten => 100,103,Hangup()

Behind extension 100 is an XLite softphone. I found that in my installation, branching to prio 102 takes place if unavaible, prio 2 is executed when busy. Opposite to my documentation and the way the diaplan is set up! I am wondering if this is a problem with the XLite phone signalling the status wrong, a bug in Asterisk (1.0.9), or an error in my documentation, or even a combination. Unfortunately, I do not have a hard SIP phone (yet, still looking) for verification, and the extensions.conf file supplied by the samples uses a different method of branching. Couldn’t find anything in the forum either.


#2

G there’s an easy way to take XLite out of the equation.
Just shut down app and try to call.
What I found seems to point to an error either in Asterisk 1.0.9 or documentation: With XLite closed, I’d expect a branch to “unavailable” but rather get “busy”. Could be that branching is the problem, or it’s backwards in VoiceMail(). Or again, documentation off.

From there on I checked whether it’s that VoiceMail() has it backwords. Appears VoiceMail() is OK. VoiceMail(u100…) actually plays the “unavailable” theme.

So Asterisk 1.0.9 indeed branches to +101 if unavailable, as opposed to documentation. I’m scratching my head if it’s a bug in Asterisk, or documentation has it backwards?


#3

I wouldn’t say that the documentation is wrong, but your dialplan is unable to handle the situation if the user is not registered. There is a simpler (and more efficient) way of defining this in your extensions.conf. Just use the idea below:

exten => 100,1,Dial(SIP/RedStapler,20) exten => 100,2,Goto(100-${DIALSTATUS},1) exten => 100-BUSY,1,Voicemail(b100@default) exten => 100-BUSY,2,Hangup exten => 100-NOANSWER,1,Voicemail(u100@default) exten => 100-NOANSWER,2,Hangup exten => _100-.,1,Goto(100-NOANSWER,1) ; Treat anything else as no answer

A better thing to do would be define a macro, like this:

[code][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[/code]

To call this macro, use something like:

exten => 100,1,Macro(stdexten,100,SIP/RedStapler) exten => RedStapler,1,Goto(100,1)

Hope this helps! :smiley:


#4

THX, I am using this in extensions.conf now. This is certainly more mature than working through +101. Seems to work right, and unavailable returns unavailable.