Soporte & Consultoria

Soporte Remoto y Consultoria skype : ambiorixg12.
Nota no se brinda ningun tipo de consulta o soporte fuera del blog de forma gratuita

domingo, 28 de diciembre de 2014

Asterisk random caller id and rand function


 exten => s,1,Set(junky=${RAND(1,8)});
     - Sets junky to a random number between 1 and 8, inclusive.


if we had few caller ID number want to use it, try this:

exten => _886X.,1,Noop
  same => n,Gosub(pickCallerIDnum,cell${RAND(1,5)},1)
  same => n,Dial(SIP/${EXTEN}@gateway,32,gCX)

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


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


Choose a random number in a range



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).


  • *CLI> core show function RAND

  • This functions is only availible in 1.4 and later.

Return value

Returns the resulting number.

No hay comentarios:

Publicar un comentario