[asterisk-users] Dialplan loop

Anselm Martin Hoffmeister anselm at hoffmeister-online.de
Sun Aug 12 05:34:51 CDT 2007


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




More information about the asterisk-users mailing list