Asterisk func eval

Evaluate stored variables.



Using EVAL basically causes a string to be evaluated twice. When a variable or expression is in the dialplan, it will be evaluated at runtime. However, if the result of the evaluation is in fact a variable or expression, using EVAL will have it evaluated a second time.

For example, if the variable ${MYVAR} contains "${OTHERVAR}", then the result of putting ${EVAL(${MYVAR})} in the dialplan will be the contents of the variable, OTHERVAR. Normally, by just putting ${MYVAR} in the dialplan, you would be left with "${OTHERVAR}".

Return value

Returns the resulting string.


exten => s,1,Set(foo=${EVAL(${MYVAR})})
; it's possible to use functions, this way:
same => n,Set(LOCAL(clid)=${EVAL(${CALLERID(num):-7})})

See also

Created by: murf, Last modification: Tue 26 of Jun, 2012 (15:19 UTC) by brownian
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+