[asterisk-users] AEL question: testing channel variables

Julian Lyndon-Smith asterisk at dotr.com
Thu Jan 8 12:30:28 CST 2009


Klaus Darilion wrote:
> Hi!
>
> I use the following condition:
>
> if (${FOOBAR}=YES) {
>    ...
> }
>
> The problem is, that if FOOBAR is not defined at all Asterisk generates 
> a warning:
>
> WARNING[11982]: ast_expr2.fl:407 ast_yyerror: ast_yyerror():  syntax 
> error: syntax error, unexpected '=', expecting $end; Input:
> =YES
>
>
> Of course I could use the following code, but this bloats up the code:
>
>
> if (${EXISTS(${FOOBAR})}) {
>    if (${FOOBAR}=YES) {
>      ...
>    }
> }
>
>
> Is there another syntax to have nice looking code but avoid the warning?
>   

How about

if ("${FOOBAR}"="YES") {

Julian
> thanks
> klaus
>
> _______________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
>
>   


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________



More information about the asterisk-users mailing list