Name

EVAL — Evaluates stored variables

Synopsis

EVAL(variable)

EVAL() is one of the most powerful dialplan functions. It permits one to store variable expressions in a location other than extensions.conf, such as a database, yet evaluate them in the dialplan, as if they were included there all along. You can bet that EVAL() is a cornerstone in making a dialplan truly dynamic.

; We might store something like "SIP/${DB(ext2chan/123)}" in the
; database entry for extension/123, which tells us to look up yet
; another database entry.
exten => _XXX,1,Set(dialline=${DB(extension/${EXTEN})})
exten => _XXX,n,Dial(${EVAL(${dialline})})
; Real world example (taken from production code)
exten => _1NXXNXXXXXX,n(generic),Set(provider=${DB(rt2provider/${route})}-nanp)
exten => _1NXXNXXXXXX,n(provider),Dial(${EVAL(${DB(provider/${provider})})})
exten => _1NXXNXXXXXX,n,Goto(nextroute)      

See Also

Exec()