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

Michiel van Baak michiel at vanbaak.info
Sat Feb 4 06:13:35 MST 2006


On 18:02, Sat 04 Feb 06, Umair Bari wrote:
> Dear Michiel,
> 
> Would you be kind enough to put more light on RAND stuff. How you do the
> load balancing.
> 
> Regards,
> 
> Umair Bari
> 

Umair,

Here is a actual copy/pasted block from my
[outgoing-speakup]
I have a block like this for dutch numbers, international
numbers, mobile numbers etc so they get another logentry
that I use in my cdr webtool.

;dutch telephone nrs.
exten => _0XXXXXXXXX,1,Verbose(1,Routing call from ${CALLERID(num)} to ${EXTEN} on channel ${CHANNEL})
exten => _0XXXXXXXXX,2,Set(CDR(ACCOUNTCODE)=outgoing-speakup)
exten => _0XXXXXXXXX,3,Set(CALLERID(all)=XXXXXXXXXX)
exten => _0XXXXXXXXX,4,GotoIf($[${RAND(0,99)} + 50 >= 100]?9)
exten => _0XXXXXXXXX,5,Macro(safedial,${IAXTRUNK_SPEAKUP01}/31${EXTEN:1},50,Tr)
exten => _0XXXXXXXXX,6,Macro(safedial,${IAXTRUNK_SPEAKUP02}/31${EXTEN:1},50,Tr)
exten => _0XXXXXXXXX,7,Macro(safedial,${ZAPTRUNK}/${EXTEN},50,Tr)
exten => _0XXXXXXXXX,8,Goto(12)
exten => _0XXXXXXXXX,9,Macro(safedial,${IAXTRUNK_SPEAKUP02}/31${EXTEN:1},50,Tr)
exten => _0XXXXXXXXX,10,Macro(safedial,${IAXTRUNK_SPEAKUP01}/31${EXTEN:1},50,Tr)
exten => _0XXXXXXXXX,11,Macro(safedial,${ZAPTRUNK}/${EXTEN},50,Tr)
exten => _0XXXXXXXXX,12,Congestion()

When I look at the console I see it indeed picks
IAXTRUNK_SPEAKUP01 and IAXTRUNK_SPEAKUP02 at random.

This is for 1.2.2 and later, that's when they moved the
Random() call to a dialplan function RAND

The only drawback I have is that if the other end is not
picking up I have to wait 150 seconds before I get a
Congestion ;) but I can live with that.
For that reason only the dutch numbers have the 3rd failover
to ZAPTRUNK

Hope this helps you a bit with understanding the RAND stuff.

-- 
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?"

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20060204/c7015b3c/attachment.pgp


More information about the asterisk-users mailing list