Folks,
I'm trying to implement a simple loop in a dialplan. The object is to
set a counter, run through some IVR options, increment the counter,
return to the start, then finally fall through to an operator or
voicemail.
Am using 1.4.10 and have reviewed doc/
exten => s,1,Set(TIMEOUT(digit)=5)
exten => s,n,Set(TIMEOUT(response)=20)
exten => s,n,Set(loop = 0)
exten => s,n,GotoIfTime(*|sun|*|*?night)
exten => s,n,GotoIfTime(17:00-23:59|mon-fri|*|*?night)
exten => s,n,GotoIfTime(12:00-23:59|sat|*|*?night)
exten => s,n,GotoIfTime(00:00-07:59|mon-sat|*|*?night)
exten => s,n,GosubIf($["${answermode}" =
"holiday"]?holiday)
exten => s,n,Gosub(day)
exten => s,n(night),Background(silence/1)
exten => s,n,Background(welcome)
exten => s,n,Background(our-business-hours-are)
...
exten => s,n,Set(loop = $[${loop} + 1])
exten => s,n,GotoIf(${loop} = 1 ?night)
exten => s,n,Voicemail(1016)
exten => s,n(day),Background(silence/1)
The above loop increment doesn't work. The error message is:
WARNING[14490]: ast_expr2.fl:398 ast_yyerror: ast_yyerror(): syntax
error: syntax error, unexpected '+', expecting $end; Input:
+ 1
^
WARNING[14490]: ast_expr2.fl:402 ast_yyerror: If you have questions,
please refer to doc/channelvariables.txt in the asterisk source.
OK, and doc/channelvariables.txt shows:
exten => 1,2,Set(koko=$[2 * ${lala}])
as an example.
So if anyone can see what the difference is between:
exten => s,n,Set(loop = $[${loop} + 1])
and
exten => 1,2,Set(koko=$[2 * ${lala}])
please point out my error.
Thanx,
David A. Bandel
--
Focus on the dream, not the competition.
- Nemesis Air Racing Team motto
On Thu, Aug 09, 2007 at 08:12:12PM -0500, David Bandel wrote:> Folks, > > I'm trying to implement a simple loop in a dialplan. The object is to > set a counter, run through some IVR options, increment the counter, > return to the start, then finally fall through to an operator or > voicemail. > > Am using 1.4.10 and have reviewed doc/ > > exten => s,1,Set(TIMEOUT(digit)=5) > exten => s,n,Set(TIMEOUT(response)=20) > exten => s,n,Set(loop = 0) > exten => s,n,GotoIfTime(*|sun|*|*?night) > exten => s,n,GotoIfTime(17:00-23:59|mon-fri|*|*?night) > exten => s,n,GotoIfTime(12:00-23:59|sat|*|*?night) > exten => s,n,GotoIfTime(00:00-07:59|mon-sat|*|*?night) > exten => s,n,GosubIf($["${answermode}" = "holiday"]?holiday) > exten => s,n,Gosub(day) > > exten => s,n(night),Background(silence/1) > exten => s,n,Background(welcome) > exten => s,n,Background(our-business-hours-are) > ... > exten => s,n,Set(loop = $[${loop} + 1])exten => s,n,Set(loop=$[${loop} + 1])> exten => s,n,GotoIf(${loop} = 1 ?night) > exten => s,n,Voicemail(1016) > > exten => s,n(day),Background(silence/1) > > The above loop increment doesn't work. The error message is: > > WARNING[14490]: ast_expr2.fl:398 ast_yyerror: ast_yyerror(): syntax > error: syntax error, unexpected '+', expecting $end; Input: > + 1 > ^ > WARNING[14490]: ast_expr2.fl:402 ast_yyerror: If you have questions, > please refer to doc/channelvariables.txt in the asterisk source. > > OK, and doc/channelvariables.txt shows: > exten => 1,2,Set(koko=$[2 * ${lala}]) > as an example. > > So if anyone can see what the difference is between: > exten => s,n,Set(loop = $[${loop} + 1]) > and > exten => 1,2,Set(koko=$[2 * ${lala}])-- Tzafrir Cohen icq#16849755 jabber:tzafrir at jabber.org +972-50-7952406 mailto:tzafrir.cohen at xorcom.com http://www.xorcom.com iax:guest at local.xorcom.com/tzafrir
Am Donnerstag, den 09.08.2007, 20:12 -0500 schrieb David Bandel:> Folks, > > I'm trying to implement a simple loop in a dialplan. The object is to > set a counter, run through some IVR options, increment the counter, > return to the start, then finally fall through to an operator or > voicemail.> exten => s,n,Set(loop = 0)> ... > exten => s,n,Set(loop = $[${loop} + 1])> The above loop increment doesn't work. The error message is: > > WARNING[14490]: ast_expr2.fl:398 ast_yyerror: ast_yyerror(): syntax > error: syntax error, unexpected '+', expecting $end; Input: > + 1 > ^ > WARNING[14490]: ast_expr2.fl:402 ast_yyerror: If you have questions, > please refer to doc/channelvariables.txt in the asterisk source. >Try removing extra space characters around the "=". Very similar example from my dialplan exten => _2XX,n,Set(I=1) ... exten => _2XX,n,Set(EXTR=$[${I} + 1]) Works fine. Also assigning a variable a new value based on the old value works OK here (although not calculated, but concatenated): exten => _2XX,n,Set(D=${D}&SIP/sip501) I am using Asterisk 1.2 here, but I remember similar errors with stray " " characters. BR Anselm