Hi, all. I'm making my first foray into AEL. I'm starting with a simple macro, but I've already encountered an odd behaviour. I'm wondering if someone can shed some insight: Asterisk 1.2.9.1 macro newPlaceCallPSTN { s => { TIMEOUT(absolute)=7200; NoOp(Analog Out List: ${ANALOGOUT}); ChanIsAvail(${ANALOGOUT}); NoOp(Available Out List: ${}); // -- theChannel=Cut(AVAILCHAN|-|1); NoOp(Now Calling ${MACRO_EXTEN} on ${theChannel}....); // -- Dial(${theChannel}/${MACRO_EXTEN:${TRUNKMSD}}); }; }; ... I get: -- Executing macro("SIP/162-4c8b", "newPlaceCallPSTN") Oct 13 08:57:22 WARNING[15320]: ast_expr2.fl:183 ast_yyerror: ast_yyerror(): syntax error: syntax error, unexpected TOK_GT, expecting TOK_MINUS or TOK_COMPL or TOK_LP or TOKEN; Input: > { TIMEOUT(absolute)=7200; NoOp(Analog Out List: ZAP/4&ZAP/3&ZAP/2&ZAP/1); ChanIsAvail(ZAP/4&ZAP/3&ZAP/2&ZAP/1); NoOp(Available Out List: ); theChannel=Cut(AVAILCHAN|-|1); NoOp(Now Calling 95145121677 on ....); Dial(/5145121677); } ^ Oct 13 08:57:22 WARNING[15320]: ast_expr2.fl:187 ast_yyerror: If you have questions, please refer to doc/README.variables in the asterisk source. -- Executing Set("SIP/162-4c8b", "s =0") in new stack == Auto fallthrough, channel 'SIP/162-4c8b' status is 'UNKNOWN' From what I can see, ChanIsAvail() is not actually populating AVAILCHAN the way it should. Is there a different syntax I should be using with AEL for this function? -- --Michel Vaillancourt Senior Telephony Engineer Neoxo Inc (www.neoxo.com) +1 514 395 1106 ext 117
On Fri, 2006-10-13 at 06:30 -0700, asterisk-users-request@lists.digium.com wrote:> Hi, all. I'm making my first foray into AEL. I'm > starting with a > simple macro, but I've already encountered an odd behaviour. > I'm > wondering if someone can shed some insight: > > Asterisk 1.2.9.1 > > macro newPlaceCallPSTN { > s => { > TIMEOUT(absolute)=7200; > NoOp(Analog Out List: ${ANALOGOUT}); > ChanIsAvail(${ANALOGOUT}); > NoOp(Available Out List: ${}); > // -- > theChannel=Cut(AVAILCHAN|-|1); > NoOp(Now Calling ${MACRO_EXTEN} on ${theChannel}....); > // -- > Dial(${theChannel}/${MACRO_EXTEN:${TRUNKMSD}}); > }; > }; > > ... I get: > > -- Executing macro("SIP/162-4c8b", "newPlaceCallPSTN") > Oct 13 08:57:22 WARNING[15320]: ast_expr2.fl:183 ast_yyerror: > ast_yyerror(): syntax error: syntax error, unexpected TOK_GT, > expecting > TOK_MINUS or TOK_COMPL or TOK_LP or TOKEN; Input: > > { TIMEOUT(absolute)=7200; NoOp(Analog > Out List: > ZAP/4&ZAP/3&ZAP/2&ZAP/1); > ChanIsAvail(ZAP/4&ZAP/3&ZAP/2&ZAP/1); NoOp(Available > Out List: > ); theChannel=Cut(AVAILCHAN|-| > 1); > NoOp(Now Calling 95145121677 on ....); > Dial(/5145121677); } > ^ > Oct 13 08:57:22 WARNING[15320]: ast_expr2.fl:187 ast_yyerror: > If you > have questions, please refer to doc/README.variables in the > asterisk source. > -- Executing Set("SIP/162-4c8b", "s =0") in new stack > == Auto fallthrough, channel 'SIP/162-4c8b' status is > 'UNKNOWN' > > > From what I can see, ChanIsAvail() is not actually > populating > AVAILCHAN the way it should. Is there a different syntax I > should be > using with AEL for this function?I wish all AEL problems were this easy! The complaints are coming from the fact that you have to call the built-in function TIMEOUT from within the ${ } notation, or its equivalent... To do this you need an app call to put it in... Try: Set(TIMEOUT(absolute)=7200); instead. And, Function names (last time I checked) are case sensitive, so the line: theChannel=Cut(AVAILCHAN|-|1); Should most likely be: Set(theChannel=${CUT(${AVAILCHAN}|-|1)}); So, don't forget to wrap your variable names in ${} and don't forget that the first argument to the app Set() is treated as a variable name without having to have it wrapped in ${}. murf -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3239 bytes Desc: not available Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20061013/8602f9d5/smime.bin
On Fri, 2006-10-13 at 10:20 -0700, asterisk-users-request@lists.digium.com wrote:> Well, I made the changes you suggested, reloaded AEL > and got the same > result: > > -- Executing macro("SIP/162-c7ac", "newPlaceCallPSTN") > Oct 13 11:09:07 WARNING[15648]: ast_expr2.fl:183 ast_yyerror: > ast_yyerror(): syntax error: syntax error, unexpected TOK_GT, > expecting > TOK_MINUS or TOK_COMPL or TOK_LP or TOKEN; Input:> { Set(TIMEOUT(absolute)=7200); NoOp(Analog Out List: ZAP/4&ZAP/3&ZAP/2&ZAP/1); ChanIsAvail(ZAP/4&ZAP/3&ZAP/2&ZAP/1); NoOp(Available Out List: ); Set(theChannel=); NoOp(Now Calling 95145121677 on ....); Dial(/5145121677); } Something's seriously wrong, because it's ast_expr2 that's complaining! That code should only be looking inside $[..] expressions, and somehow, it's looking at more than that! Your code is "leaking" the expr stuff (stuff in $[...] into the AEL code. Check for $['s that aren't properly closed off. Beware AEL version 1 (native in 1.2). It's the reason I wrote AEL2 (native in 1.4). If you get tired of trying to debug it, I suggest either moving to 1.4, or trying to install the AEL2-1.2 branch from team/murf, and using AEL2 with 1.2. -- Steve Murphy Software Developer Digium -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3227 bytes Desc: not available Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20061013/3b7c0a5c/smime.bin