[Asterisk-Dev] Oh what could the if-then-else syntax in AEL be?
Brian Capouch
brianc at palaver.net
Wed Jul 6 01:18:38 MST 2005
The parser doesn't like the example in README.ael:
if (${DIALSTATUS} = "BUSY") {
Voicemail(${EXTEN}|b);
} else
Voicemail(${EXTEN}|u);
};
Jul 6 03:10:36 WARNING[4125]: pbx_ael.c:129 __grab_token: Syntax error
at line 18 of 'extensions.ael', too many closing braces!
-- Added extension 's' priority 7 to macro-std-exten-ael
-- Added extension 's' priority 8 to macro-std-exten-ael
-- Added extension 's' priority 6 to macro-std-exten-ael
Jul 6 03:10:36 NOTICE[4125]: pbx_ael.c:1114 handle_root_token: Unknown
root token 'switch(${DIALSTATUS}) '
Jul 6 03:10:36 NOTICE[4125]: pbx_ael.c:1114 handle_root_token: Unknown
root token 'catch'
Jul 6 03:10:36 WARNING[4125]: pbx_ael.c:129 __grab_token: Syntax error
at line 33 of 'extensions.ael', too many closing braces!
Jul 6 03:10:36 NOTICE[4125]: pbx_ael.c:1114 handle_root_token: Unknown
root token '}'
***************
Maybe it should be like C, with an open brace ahead of the else clause:
if (${DIALSTATUS} = "BUSY") {
Voicemail(${EXTEN}|b);
} else {
Voicemail(${EXTEN}|u)
};
Parser doesn't like that one, either:
Jul 6 03:12:12 WARNING[4125]: pbx_ael.c:129 __grab_token: Syntax error
at line 33 of 'extensions.ael', too many closing braces!
******************
So, I can get the parser to shut up if I put a semicolon after the if()
part statement:
if (${DIALSTATUS} = "BUSY") {
Voicemail(${EXTEN}|b);
}; else {
Voicemail(${EXTEN}|u);
};
(Ahhhh.)
Only problem is, now the parser things the if() statement ends after the
if() part, so at runtime Asterisk wonders what application "else" might be:
Jul 6 03:14:40 WARNING[4269]: pbx.c:1648 pbx_extension_helper: No
application 'else' for extension (macro-std-exten-ael, s, 9)
********************
Something is borked, I fear. . . I'm pounding on it, but so far several
hours of changing things around in extensions.ael still yield me no joy.
B.
More information about the asterisk-dev
mailing list