[asterisk-users] Dialplan loop

David Bandel david.bandel at gmail.com
Thu Aug 9 20:12:12 CDT 2007


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



More information about the asterisk-users mailing list