Dialplan to select alternative sip trunk on Busy Tone

My asterisk box is version 11 and I have 4 trunks (each single channel) for each my dialing code’s (mobile phone code/aria codes) for outgoing calls.

its working fine but, issue is when one channel is busy with a call and 2nd call for same dial pattern will fail due to no channel available to use. (Configuration is separate trunk for separate dial-prefix)

So I just wanted to allow automatic fail back or alternative channels to allow if particular trunk in use. So 2nd cal for same Prefix will go to next trunk.

current dial plan in my extensions.conf

exten => _076XXXXXX,1,Log(Dialing out from ${CALLERID(all)} to ${EXTEN})
exten => _076XXXXXX,n,Dial(SIP/GOIP1/${EXTEN},60)
exten => _076XXXXXX,n,Hangup()

exten => _71XXXXXX,1,Log(Dialing out from ${CALLERID(all)} to ${EXTEN})
exten => _71XXXXXX,n,Dial(SIP/GOIP2/${EXTEN},60)
exten => _71XXXXXX,n,Hangup()

Thanks
JCK

Crudely, add a Dial for the alternative trunk immediately after the Dial for the first choice.

For a cleaner solution, examine DIALSTATUS and/or HANGUCAUSE and Hangup if this indicates the retry is likely to fail.

Note the current calls to Hangup are redundant.

1 Like

Thank you for the advice. What do you think about below… will this work ?

exten => _076XXXXXX,1,Log(Dialing out from ${CALLERID(all)} to ${EXTEN})
exten => _076XXXXXX,n,Dial(SIP/GOIP1/${EXTEN},60)
 same => n, Verbose(2, D0 DIALSTATUS => ${DIALSTATUS})
 same => n, GotoIf($[ $['${GOSUB_RETVAL}'='BUSY'] | $['${GOSUB_RETVAL}'='NOANSWER'] ]?all_done)
 same => n, Dial(SIP/GOIP2/${EXTEN},60)
 same => n, Verbose(2, D1 DIALSTATUS => ${DIALSTATUS})
 same => n(all_done), Verbose(2, Call being completed ... HANGUPCAUSE was ${HANGUPCAUSE})
exten => _076XXXXXX,n,Hangup()

More Detailed advice much appriciated.

Rg
JCK

1 Like

Any More Advice’s…
Or
Can I just add below;
exten => _076XXXXXX,1,Log(Dialing out from ${CALLERID(all)} to ${EXTEN})
exten => _076XXXXXX,n,Dial(SIP/GOIP1/${EXTEN},60)
exten => _076XXXXXX,n,Dial(SIP/GOIP2/${EXTEN},60)
exten => _076XXXXXX,n,Hangup()

Thanks
JCK

The second will definitely work, but my result in the callee seeing two missed calls if they fail to answer.

For the first, you may find that DIALSTATUS isn’t sufficiently refined to distinguish cases that are and are not worth retrying.

Incidentally, looking at the subject, Asterisk will not listen for busy tone. If the busy status is not included in the signalling, you are our of luck. In particular, if you use DAHDI on an analogue line, or your SIP upstream answers the call immediately then plays call progress tones to you, Asterisk will treat the call as answered.

1 Like

The second one will WORK!!
For me the the second is worked. I made a minor change in this.
I choose to check {DIALSTATUS}** instead of **{GOSUB_RETVAL}.
I am using SIP technology in my work.

My block is given below,

exten => _X.,1,Answer()
same  => n,Dial(SIP/admin/111!${EXTEN})
same => n, Verbose(2, D0 DIALSTATUS => ${DIALSTATUS})
same => n, GotoIf($[ $['${DIALSTATUS}'='BUSY'] | $['${DIALSTATUS}'='NOANSWER'] ]?all_done)
same  => n,Dial(SIP/admin/112!${EXTEN})
same => n, Verbose(2, D1 DIALSTATUS => ${DIALSTATUS})
same => n(all_done), Verbose(2, Call being completed ... HANGUPCAUSE was ${HANGUPCAUSE})
same  => n,Hangup()

Thanks @janakackv

For future reference, you don’t need multiple levels of $[

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.