Asterisk func rand
Synopsis:
Choose a random number in a rangeDescription:
RAND([min][,max])
[from-internal-custom]
exten =>_0.,1,Verbose( Dialing to ${EXTEN:1})
same => 2,Goto(${RAND(3,7)})
;set priority number from 3~7 random
same=> 3,Dial(dongle/dongle0/${EXTEN:1},300,Tt)
same=> 4,Dial(dongle/dongle1/${EXTEN:1},300,Tt)
same=> 5,Dial(dongle/dongle2/${EXTEN:1},300,Tt)
same=> 6,Dial(dongle/dongle2/${EXTEN:1},300,Tt)
Example1
exten => s,1,Set(junky=${RAND(1,8)});
- Sets junky to a random number between 1 and 8, inclusive.
Example2
if we had few caller ID number want to use it, try this:
[outbound]
exten => _886X.,1,Noop
same => n,Gosub(pickCallerIDnum,cell${RAND(1,5)},1)
same => n,Dial(SIP/${EXTEN}@gateway,32,gCX)
[pickCallerIDnum]
exten => cell1,1,Set(CALLERID(num)=09xxxxxxx1)
same => n,Return
exten => cell2,1,Set(CALLERID(num)=09xxxxxxx2)
same => n,Return
exten => cell3,1,Set(CALLERID(num)=09xxxxxxx3)
same => n,Return
exten => cell4,1,Set(CALLERID(num)=09xxxxxxx4)
same => n,Return
exten => cell5,1,Set(CALLERID(num)=09xxxxxxx5)
same => n,Return
Example3
if we had 5 outbound gateway, we wanna use it equally, try this:
exten => _09XXXXXXXX,1,Set(VOLUME(RX)=5)
same => 2,Goto(${RAND(3,7)})
;set priority number from 3~7 random
same=> 3,Dial(SIP/${EXTEN}@gateway0)
same=> 4,Dial(SIP/${EXTEN}@gateway1)
same=> 5,Dial(SIP/${EXTEN}@gateway2)
same=> 6,Dial(SIP/${EXTEN}@gateway3)
same=> 7,Dial(SIP/${EXTEN}@gateway4)
No hay comentarios:
Publicar un comentario