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)
Asterisk func rand
Synopsis:
Choose a random number in a rangeDescription:
RAND([min][,max])
Choose a random number between min and max. Min defaults to 0, if not
specified, while max defaults to RAND_MAX (2147483647 on many systems).
Notes
- *CLI> core show function RAND
- This functions is only availible in 1.4 and later.
Return value
Returns the resulting number.http://www.voip-info.org/wiki/view/Asterisk+func+rand
No hay comentarios:
Publicar un comentario