[asterisk-users] Dialplan loop

Tzafrir Cohen tzafrir.cohen at xorcom.com
Fri Aug 10 13:33:41 CDT 2007


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



More information about the asterisk-users mailing list