[Asterisk-Users] How to handle "provider UNREACHABLE" in the dialplan?

Michiel van Baak michiel at vanbaak.info
Sat Feb 4 05:28:02 MST 2006


On 04:47, Sat 04 Feb 06, Joseph Tanner wrote:
> This is probably a stupid question, but how do you specify multiple
> fallovers?  I.e., if provider1 is not reachable/busy, try provider2. 
> If provider2 is down, try provider3.  If provider3 is down...etc.  I
> understand how to do it the old way, just keep adding 101 to the
> extension.  What would you add to a NOANSWER extension though?  I
> guess you could send it to a different context, then you could use
> another NOANSWER, but I like keeping things short and easy.

[snip]

> > [macro-safedial]
> > ;exten = s,1,Dial(${ARG1},${ARG2},g,${ARG4})
> > exten = s,1,Dial(${ARG1},${ARG2},${ARG3},${ARG4})
> > exten = s,2,Goto(s-${DIALSTATUS},1)
> > exten = s-CANCEL,1,Hangup
> > exten = s-NOANSWER,1,GotoIf($["${DIALEDTIME}" = "0"]?3)
> > exten = s-NOANSWER,2,Hangup
> > exten = s-NOANSWER,3,Verbose(1,Need failover for "${ARG1}")
> > exten = s-BUSY,1,Busy
> > exten = s-CHANUNAVAIL,1,Verbose(1,Need failover for "${ARG1}")
> > exten = s-CONGESTION,1,Congestion
> > exten = _s-.,1,Congestion
> > exten = s-,1,Congestion

I have this macro too in my extensions.conf
Later in the dialplan I use:

[outgoing-speakup]
;dutch telephone nrs.
exten => _0XXXXXXXXX,1,Set(CDR(ACCOUNTCODE)=outgoing-speakup)
exten => _0XXXXXXXXX,2,Set(CALLERID(all)=XXXXXXXXX)
exten => _0XXXXXXXXX,3,Macro(safedial,${IAXTRUNK_SPEAKUP01}/31${EXTEN:1},50,Tr)
exten => _0XXXXXXXXX,4,Macro(safedial,${IAXTRUNK_SPEAKUP02}/31${EXTEN:1},50,Tr)
exten => _0XXXXXXXXX,5,Macro(safedial,${ZAPTRUNK}/${EXTEN},50,Tr)
exten => _0XXXXXXXXX,6,Congestion()

Works like a charm.

In my production environment I actually load balance calls
using RAND so both IAXTRUNK_SPEAKUP01 and IAXTRUNK_SPEAKUP02
get an equal load of calls, but that's not relevant to your
question :)

-- 
Michiel van Baak
http://michiel.vanbaak.info
michiel at vanbaak.info
GnuPG key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x7E0B9A2D

"Why is it drug addicts and computer afficionados are both called users?"




More information about the asterisk-users mailing list