Upgrade 3CX to v18 and get it hosted free!

Asterisk cmd While

Author image

While

Loop until condition is false

Synopsis

While(condition)

Description

Execution loops between a While and an EndWhile statement, until the condition specified in the While evaluates to false. The condition is evaluated once per loop, at the beginning.

Example

exten => 123,1,Answer
exten => 123,n,Set(i=1)
exten => 123,n,While($[${i} < 5])
exten => 123,n,SayNumber(${i})
exten => 123,n,Set(i=$[${i} + 1])
exten => 123,n,EndWhile

Notes

  • While / EndWhile supports nesting. That is, there can be more than one set of While / EndWhile executing for the channel at once.
  • If the While condition initially evaluates to false, dial plan execution continues after the matching EndWhile.
  • There is another loop control modifier, ContinueWhile

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.