Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

[asterisk-users] Loop Break


 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> Asterisk Users
View previous topic :: View next topic  
Author Message
asif44pk at gmail.com
Guest





PostPosted: Mon Jan 21, 2008 8:08 am    Post subject: [asterisk-users] Loop Break Reply with quote

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
Back to top
support at drdos.info
Guest





PostPosted: Mon Jan 21, 2008 8:58 am    Post subject: [asterisk-users] Loop Break Reply with quote

Mian M Asif wrote:
Quote:
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."
Back to top
tzafrir.cohen at xorco...
Guest





PostPosted: Mon Jan 21, 2008 10:32 am    Post subject: [asterisk-users] Loop Break Reply with quote

On Mon, Jan 21, 2008 at 08:58:53AM -0500, Doug Lytle wrote:
Quote:
Mian M Asif wrote:
Quote:
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
Back to top
support at drdos.info
Guest





PostPosted: Mon Jan 21, 2008 10:46 am    Post subject: [asterisk-users] Loop Break Reply with quote

Tzafrir Cohen wrote:
Quote:
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."
Back to top
asterisk.org at sedwar...
Guest





PostPosted: Sat Jan 26, 2008 2:30 pm    Post subject: [asterisk-users] Loop Break Reply with quote

On Mon, 21 Jan 2008, Doug Lytle wrote:

Quote:
Tzafrir Cohen wrote:
Quote:

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
Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> Asterisk Users All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services