Summary: | ASTERISK-08600: ael2 does not support extension in macro | ||
Reporter: | Peng Yong (ppyy) | Labels: | |
Date Opened: | 2007-01-18 00:27:12.000-0600 | Date Closed: | 2011-06-07 14:02:35 |
Priority: | Major | Regression? | No |
Status: | Closed/Complete | Components: | PBX/pbx_ael |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ||
Description: | aelpalse give following error: LOG: lev:2 file:pbx_ael2.c line:3851 func: pbx_load_module Starting AEL load process. LOG: lev:2 file:pbx_ael2.c line:3858 func: pbx_load_module AEL load process: calculated config file name '/etc/asterisk/extensions.ael2'. LOG: lev:4 file:ael.y line:752 func: ael_yyerror ==== File: /etc/asterisk/extensions.ael2, Line 10, Cols: 10-11: Error: syntax error, unexpected '=>', expecting '(' or ';' or '=' or ':' macro MQueue(id) { s => { Queue(${id}|ht); goto que-${QUEUESTATUS}|1; } que-JOINEMPTY => { Background(queue/queprompt2); Hangup(); } que-FULL => { Background(queue/queprompt2); Hangup(); } que-TIMEOUT => { Background(queue/queprompt3); Hangup(); } _que-. => { goto que-JOINEMPTY|1; } t => { goto s|1; } i => { goto s|1; } } ****** ADDITIONAL INFORMATION ****** extension.conf can support extension in macro: [macro-stdexten]; ; ; Standard extension macro: ; ${ARG1} - Extension (we could have used ${MACRO_EXTEN} here as well ; ${ARG2} - Device(s) to ring ; exten => s,1,Dial(${ARG2},20) ; Ring the interface, 20 seconds maximum exten => s,2,Goto(s-${DIALSTATUS},1) ; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER) exten => s-NOANSWER,1,Voicemail(u${ARG1}) ; If unavailable, send to voicemail w/ unavail announce exten => s-NOANSWER,2,Goto(default,s,1) ; If they press #, return to start exten => s-BUSY,1,Voicemail(b${ARG1}) ; If busy, send to voicemail w/ busy announce exten => s-BUSY,2,Goto(default,s,1) ; If they press #, return to start exten => _s-.,1,Goto(s-NOANSWER,1) ; Treat anything else as no answer exten => a,1,VoicemailMain(${ARG1}) ; If they press *, send the user into VoicemailMain | ||
Comments: | By: Steve Murphy (murf) 2007-01-18 08:12:04.000-0600 The contents of the macro go into the "s" extension of the generated context. If you want to have other extensions, use the "catch" construct; see the wiki at: http://voip-info.org/wiki/view/Asterisk+AEL2#Macros catch a { VoiceMailMain(${ext}); return; } In your example: t => { goto s|1; } i => { goto s|1; } would be: catch t { goto s|1; } catch i { goto s|1; } Also, here would be a good time to translate your other code into something a bit more readable in AEL: switch(${QUEUESTATUS}) { case JOINEMPTY: .... break; case FULL: .... break; case TIMEOUT: .... break; default: .... break; } In general, you can usually replace almost every goto with something else in AEL. Avoid goto as much as possible. That's not an AEL constraint, it's just good programming. Good luck, and I hope you enjoy your AEL experience! You might (re)read the WIKI AEL2 page, it's the best reference right now. By: Steve Murphy (murf) 2007-01-18 08:15:14.000-0600 I wish all bugs were as easy to resolve! |