[asterisk-users] Loop Break

Steve Edwards asterisk.org at sedwards.com
Sat Jan 26 13:30:57 CST 2008


On Mon, 21 Jan 2008, Doug Lytle wrote:

> Tzafrir Cohen wrote:
>>
>> exten => s,1,Set(COUNT=$[${COUNT} + 1])
>> exten => s,n,NoOP(${COUNT})
>> exten => s,n,GotoIf($[ ${COUNT} > 3 ]?endloop)
>> exten => s,n,Goto(1)
>> exten => s,n(endloop),NoOp(Loop ended)
>
> You forgot to initialize your variable.
>
> Set(COUNT=0)

Or...

Define MAX-COUNT in the global context (more obvious and maintainable), 
assign it to COUNT at the top of your loop, decrement and compare to 0 
(something about being an old PDP-11 assembly language programmer...)

Thanks in advance,
------------------------------------------------------------------------
Steve Edwards      sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                             Fax: +1-760-731-3000



More information about the asterisk-users mailing list