[asterisk-users] Dialplan loop

James Collier james.collier at xtratelecom.es
Tue Aug 14 02:28:13 CDT 2007


I do something like this.  But I am using Realtime and 1.4

context1	85	1	Set	caller_num=${CALLERID(num)}
context1	85	2	SetMusicOnHold	default
context1	85	3	Playback	silence2
context1	85	4	AGI	context1.php
context1	85	5	Set	__FWCOUNT=0${FWCOUNT}
context1	85	6	Set	__FWCOUNT=$[${FWCOUNT}+1]
context1	85	7	GotoIf	$[${FWCOUNT}>10]?10
context1	85	8	Dial	SIP/ext1&SIP/ext2|30|m
context1	85	9	Hangup	
context1	85	10	Congestion	

-----Mensaje original-----
De: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com]En nombre de Anselm
Martin Hoffmeister
Enviado el: domingo, 12 de agosto de 2007 12:35
Para: Asterisk Users Mailing List - Non-Commercial Discussion
Asunto: Re: [asterisk-users] Dialplan loop


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


_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users



More information about the asterisk-users mailing list