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

didier didier.cuffaut at neuf.fr
Mon Nov 26 18:05:41 CST 2007


Rpgrade.... but are you sure a '}' is not missing in your h,n,SET....... ?

----- Original Message -----
From: Vincent <vincent.delporte at bigfoot.com>
To: <asterisk-users at lists.digium.com>
Sent: Monday, November 26, 2007 9:51 PM
Subject: [asterisk-users] Correct syntax for IF()?


> 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.
>
>
> _______________________________________________
> --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




More information about the asterisk-users mailing list