[asterisk-users] AEL2 Looping

Douglas Garstang dgarstang at oneeighty.com
Sat Jul 29 15:58:17 MST 2006


I actually did get it to work, by removing _all_ spaces from the for line...
 
for (x=0;${x}<3;x=${x}+1) {
 
This works for me. It's just a matter of finding WHICH space is breaking it.

	-----Original Message----- 
	From: Rushowr [mailto:rushowr at phreaker.net] 
	Sent: Sat 7/29/2006 12:24 PM 
	To: 'Asterisk Users Mailing List - Non-Commercial Discussion' 
	Cc: 
	Subject: RE: [asterisk-users] AEL2 Looping
	
	

	>> context new_pbx_betty_start {
	>>
	>>     _X. => {
	>>         for (x=0; ${x} < 3; x=${x} + 1) {
	>>             Verbose(x is ${x} !);
	>>         }                 
	>>     };
	>>
	>> }
	>I would have to see the output of "show dialplan new_pbx_betty_start" to
	know exactly >what is going on.  However, I'm guessing that if you remove
	the space between the
	>semicolon and the "x=${x} + 1", it will work.
	
	>On pretty much everything except expression evaluation (such as ${x} < 3),
	Asterisk
	>is sensitive to whitespace.  " x=${x} + 1" was most likely translated
	directly into
	>Set( x=$[${x} = 1]).  That means you are setting the variable name, " x",
	including
	>the leading space.  That is not the same variable as ${x} which you are
	using
	>everywhere else.
	
	Russel,
	
	Stupid question, but isn't the AEL2 parser supposed to handle the above code
	first? Hypothetically, if the parser DOES handle the code the example given
	by Murf on voip-info (which is the exact code Douglas posted, other than the
	name new_pbx_betty_start) should work properly. Also, to answer your
	question, removing the space does not help. I'm actually getting a bug
	report together concerning this, and I tested it with and without spaces in
	multiple places in the for loop definition. I'd give examples but I don't
	have access right now.
	
	Keep up the great work guys!
	Rushowr
	
	
	_______________________________________________
	--Bandwidth and Colocation provided by Easynews.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