[Asterisk-Users] expression parsing
ml at neoninternet.com
ml at neoninternet.com
Sat Jan 3 12:05:09 MST 2004
Hi. I've noticed a problem with the expression parsing in Asterisk. If the variable is not defined, I will get a parse error. Yeah, there are ways around it, but I would think that it should return false if 0, null, or undefined. I would change it, but I have no idea about bison and I only have very basic C skills.
There was a bug opened on this, and there was a valid work-around posted, but I would think that it would be 'nicer' if it would evaluate it this way. (Ref: http://bugs.digium.com/bug_view_page.php?bug_id=0000401 ) If you put a 0 after the } it does work as I would want it to without an error. The other suggestions did not work. I propose for this bug to be re-opened.
extensions.conf:
exten => 1234,3,GotoIf($[${a}]?4:5)
If a is undefined:
WARNING[37910]: File ast_expr.y, Line 346 (ast_yyerror): ast_yyerror(): syntax error: parse error
-- Executing GotoIf("SIP/1240-5eb6", "0?4:5") in new stack
-- Goto (default,1234,5)
If I change the extention to exten => 1234,3,GotoIf($[${a}0]?4:5) it works as expected.
Also, I'm not sure if this is my bad or what. If I use exten => 1234,3,GotoIf(${a}?4:5) and a is undefined:
-- Executing GotoIf("SIP/1240-2b8a", "?4:5") in new stack
-- Goto (default,1234,4)
it still returns true.
Behold the power of *,
Kevin
More information about the asterisk-users
mailing list