[asterisk-users] trinary expression

John Williams williams at tni.com
Thu Aug 3 15:23:48 MST 2006


I have this in my dialplan:

exten => s,1,set(LPROMPTDIR=$["${LANGUAGE}"?"${LANGUAGE}/${PROMPTDIR}"::"${PROMPTDIR}"])
exten => s,n,set(LPROMPTDIR=$["${LANGUAGE}"?${LANGUAGE}/${PROMPTDIR}::${PROMPTDIR}])

The first gets eval-ed like this:

    -- Executing Set("Zap/3-1", "LPROMPTDIR="tw/china-ivr"") in new stack

And I end up with '"tw/china-ivr"' *INCLUDING THE QUOTES* in my variable.

The second get eval-ed like this:

Aug  3 18:07:42 WARNING[9110]: ast_expr2.y:843 op_div: non-numeric argument
Aug  3 18:07:42 WARNING[9110]: ast_expr2.y:708 op_minus: non-numeric argument
Aug  3 18:07:42 WARNING[9110]: ast_expr2.y:696 op_minus: non-numeric argument
    -- Executing Set("Zap/3-1", "LPROMPTDIR=0") in new stack

which is obviously not what I want.

Is this a known bug?

Is there a workaround, so I can use a string in the trinary and not end up
with quotes in my result?

~ John Williams





More information about the asterisk-users mailing list