Hi All, please see my below dialplan, i want to break this loop after three attempts without AGI script. exten => s,1,Background(Balance-Inquiries) exten => s,n,Background(commanOptions) exten => s,n,WaitExten(2) exten => s,n,Goto(,s,1) Please Help me how can i break this loop in Asterisk. Thanks & regards, Asif
Mian M Asif wrote:> Hi All, > > please see my below dialplan, i want to break this loop after three > attempts without AGI script. > > exten => s,1,Background(Balance-Inquiries) > exten => s,n,Background(commanOptions) > exten => s,n,WaitExten(2) > exten => s,n,Goto(,s,1) > > > Please Help me how can i break this loop in Asterisk. > >exten => s,1,Set(COUNT=$[${COUNT} + 1]) exten => s,n,NoOP(${COUNT}) exten => s,n,GotoIf($[ ${COUNT} > 3 ]?103) This should get you working idea. Doug -- Ben Franklin quote: "Those who would give up Essential Liberty to purchase a little Temporary Safety, deserve neither Liberty nor Safety."
On Mon, Jan 21, 2008 at 08:58:53AM -0500, Doug Lytle wrote:> Mian M Asif wrote: > > Hi All, > > > > please see my below dialplan, i want to break this loop after three > > attempts without AGI script. > > > > exten => s,1,Background(Balance-Inquiries) > > exten => s,n,Background(commanOptions) > > exten => s,n,WaitExten(2) > > exten => s,n,Goto(,s,1) > > > > > > Please Help me how can i break this loop in Asterisk. > > > > > > exten => s,1,Set(COUNT=$[${COUNT} + 1]) > exten => s,n,NoOP(${COUNT}) > exten => s,n,GotoIf($[ ${COUNT} > 3 ]?103)Style nitpicking: 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) -- Tzafrir Cohen icq#16849755 jabber:tzafrir.cohen at xorcom.com +972-50-7952406 mailto:tzafrir.cohen at xorcom.com http://www.xorcom.com iax:guest at local.xorcom.com/tzafrir
Tzafrir Cohen wrote:> Style nitpicking: > > 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) *smirk* Doug -- Ben Franklin quote: "Those who would give up Essential Liberty to purchase a little Temporary Safety, deserve neither Liberty nor Safety."
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