[asterisk-users] Correct syntax for IF()?

Vincent vincent.delporte at bigfoot.com
Mon Nov 26 15:51:36 CST 2007


Hello

	I've tried a bunch of things, but still get errors/warnings
when using the IF() function:

============== TEST #1
exten => h,n,Set(WAV_FILE=${IF($[ ${STAT(e,/tmp/${CALLTIME}.wav)}
]?${CALLTIME}.wav)})

[Nov 26 21:52:34] WARNING[5074]: func_logic.c:107 acf_if: Syntax
IF(<expr>?[<true>][:<false>])

============== TEST #2
exten =>
h,n,Set(WAV_FILE=${IF($[STAT(e,/tmp/${CALLTIME}.wav)]?${CALLTIME}.wav:"")})

[Nov 26 22:02:23] WARNING[5101]: ast_expr2.fl:398 ast_yyerror:
ast_yyerror():  syntax error: syntax error, unexpected '(', expecting
$end; Input:
STAT(e|/tmp/.wav)
    ^
[Nov 26 22:02:23] WARNING[5101]: ast_expr2.fl:402 ast_yyerror: If you
have questions, please refer to doc/channelvariables.txt in the
asterisk source.

============== TEST #3
exten =>
h,n,Set(WAV_FILE=${IF($[${STAT(e,/tmp/${CALLTIME}.wav)}=1]?${CALLTIME}.wav)})

[Nov 26 22:08:42] WARNING[5109]: ast_expr2.fl:398 ast_yyerror:
ast_yyerror():  syntax error: syntax error, unexpected '=', expecting
$end; Input:
=1
^
[Nov 26 22:08:42] WARNING[5109]: func_logic.c:107 acf_if: Syntax
IF(<expr>?[<true>][:<false>])

============== TEST #4
exten =>
h,n,Set(WAV_FILE=${IF($[STAT(e,/tmp/${CALLTIME}.wav)=1]?${CALLTIME}.wav)})

[Nov 26 22:10:38] WARNING[5113]: ast_expr2.fl:398 ast_yyerror:
ast_yyerror():  syntax error: syntax error, unexpected '(', expecting
$end; Input:
STAT(e|/tmp/.wav)=1
    ^
[Nov 26 22:10:38] WARNING[5113]: ast_expr2.fl:402 ast_yyerror: If you
have questions, please refer to doc/channelvariables.txt in the
asterisk source.

============== TEST #5
exten => h,n,Set(WAV_FILE=${IF($[${STAT(e,/tmp/${CALLTIME}.wav)} =
1]?${CALLTIME}.wav)})

[Nov 26 22:13:55] WARNING[5117]: ast_expr2.fl:398 ast_yyerror:
ast_yyerror():  syntax error: syntax error, unexpected '=', expecting
$end; Input:
 = 1
 ^
[Nov 26 22:13:55] WARNING[5117]: ast_expr2.fl:402 ast_yyerror: If you
have questions, please refer to doc/channelvariables.txt in the
asterisk source.
[Nov 26 22:13:55] WARNING[5117]: func_logic.c:107 acf_if: Syntax
IF(<expr>?[<true>][:<false>])

I can't figure out why * is unhappy :-/ Any idea?

Thank you.




More information about the asterisk-users mailing list