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

Vincent vincent.delporte at bigfoot.com
Mon Nov 26 17:20:56 CST 2007


On Mon, 26 Nov 2007 23:40:37 +0100, Turbo Fredriksson
<turbo at bayour.com> wrote:
>What you do is you always write the beginning _and_ the end at once. Never try to do them
>'later'...

Thanks guys. I think I found where it goes wrong:

======

1. /tmp/test.wav exists -> the $[] is true:

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

======

2. /tmp/dummy.wav doesn't exist -> the $[] is false:

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

=> WARNING[5296]: func_logic.c:107 acf_if: Syntax
IF(<expr>?[<true>][:<false>])

======

For the "false" part, I tried the following, none works:
- nothing
- :
- :""

Is it a known bug, and does Asterisk 1.4.14 solve this?

Thank you.




More information about the asterisk-users mailing list