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

Vincent vincent.delporte at bigfoot.com
Mon Nov 26 18:04:10 CST 2007


On Tue, 27 Nov 2007 00:20:56 +0100, Vincent
<vincent.delporte at bigfoot.com> wrote:
>Is it a known bug, and does Asterisk 1.4.14 solve this?

FWIW, upgraded from 1.4.13 to 1.4.14, same warning. I guess it's not a
real issue, and I'll just go ahead and ignore it, and find a way to
act on whether the file exists or not.

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

;---------- OK if ${CALLTIME}.wav exists
    -- Executing [h at my-phones:2] Set("SIP/9001-081fae48",
"CALLTIME=test") in new stack
    -- Executing [h at my-phones:3] Set("SIP/9001-081fae48",
"WAV_FILE=test.wav") in new stack

;---------- NOK if it doesn't
    -- Executing [h at my-phones:2] Set("SIP/9001-081fad58",
"CALLTIME=dummy") in new stack

[Nov 27 01:00:56] WARNING[938]: func_logic.c:113 acf_if: Syntax
IF(<expr>?[<true>][:<false>])  (expr must be non-null, and either
<true> or <false> must be non-null)
[Nov 27 01:00:56] WARNING[938]: func_logic.c:114 acf_if:       In this
case, <expr>='', <true>='dummy.wav', and <false>='(null)'

    -- Executing [h at my-phones:3] Set("SIP/9001-081fad58", "WAV_FILE=")
in new stack

Thank you for your help.




More information about the asterisk-users mailing list