Asterisk cmd Random

This application is deprecated. Use 'GotoIf($[${RAND(1,100)} > <number>]?<label>)' instead.


Random goto



Based upon a probability of 1-100 (percentage likeliness), goto the label specified. A probability of 1 will take the branch about 1% of the time; 5, 5%, 10, 10%, etc. A probability of 100 (or above) will always branch and is equivalent to Goto(label). A label is a a) priority, but it can also be b) an extension plus priority, or c) a context plus extension plus priority.


  ; Monitors a call 10% of the time
  exten => s,1,Random(90:s,3)
  exten => s,2,Monitor(gsm,/var/spool/asterisk/monitor/${EXTEN}-${TIMESTAMP},m)
  exten => s,3,Dial(SIP/8000)

See also

Asterisk | Applications | Functions | Variables | Expressions | Asterisk FAQ

Created by: Corydon76, Last modification: Wed 08 of Feb, 2012 (14:44) by bcnit
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+