[Asterisk-Users] Loops and Variables

C F shmaltz at gmail.com
Mon Feb 20 06:56:41 MST 2006


I usually do the same for IVRs, but I always make sure not to use
itself as the increment, and I use a tempvar instead, like this:
exten => s,1,Set(COUNT=0)
exten => s,2,Goto(100);this is where we start the loop
exten => s,100,Set(TCOUNT=${COUNT})
exten => s,101,Noop(${COUNT})
exten => s,102,GotoIf($[${COUNT} > 5]?150);exit if more than 5 esle start again
exten => s,103,Set(COUNT=$[{TCOUNT} + 1])
exten => s,104,Goto(100)
exten => s,150,Noop(${COUNT})

I think the above is a bit cleaner, it might be a matter of taste.


On 2/20/06, Doug Lytle <Support at drdos.info> wrote:
> Doug Lytle wrote:
> > trixter aka Bret McDanel wrote:
> >> since you have had a little time to play with this, was this the
> >> problem?
> >>
> >
> > Haven't had a chance yet, will look at it when I get into work this
> > morning.
> >
>
> This works correctly now.
>
> Doug
>
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
>
> Asterisk-Users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
>



More information about the asterisk-users mailing list