While() — Starts a while loop



Starts a while loop. Execution will return to this point when EndWhile() is called, until expr is no longer true. If a condition is met causing the loop to exit, Asterisk continues execution of the dialplan on the next priority after the corresponding EndWhile().

exten => 123,1,Set(COUNT=1)
exten => 123,2,While($[ ${COUNT} < 5 ])
exten => 123,3,SayNumber(${COUNT})
exten => 123,4,Set(COUNT=$[${COUNT} + 1])
exten => 123,5,EndWhile()

Get Asterisk: The Future of Telephony, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.