B.139. While()

Starts a while loop.
While(expression)
Starts a while loop. The application returns to this point if EndWhile() is encountered as long as expression is true; if it is false, execution continues after EndWhile().
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()
exten => 123,n,Hangup()

Note

Internal help for this application in Asterisk 1.4:
  -= Info about application 'While' =- 

[Synopsis]
Start a while loop

[Description]
Usage:  While(<expr>)
Start a While Loop.  Execution will return to this point when
EndWhile is called until expr is no longer true.
diff output to internal help in Asterisk 1.2:
5c5
< Start a while loop
---
> Start A While Loop