Upgrade 3CX to v18 and get it hosted free!

Asterisk cmd Random

Author image

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

Synopsis

Random goto

Description

Random(probability:label)

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.

Example

  ; 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

Related Posts:

Get 3CX - Absolutely Free!
Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.