[asterisk-users] Dialplan question: Variables in GoTo() ?
Steve Edwards
asterisk.org at sedwards.com
Thu Mar 10 08:15:32 CST 2016
On Thu, 10 Mar 2016, A J Stiles wrote:
> Can you use variables in the target of a GoTo() statement?
Yes. Here are a few examples from one of my dialplans:
; invalid template
[i](!)
exten = i,1, verbose(1,[${EXTEN}@${CONTEXT}])
exten = i,n, goto(${CONTEXT},s,1)
; look up (set) DNIS (DID) channel variables
exten = _x.,n, goto(lookup-dnis,${EXTEN},1)
; dispatch to selected application
exten = _[123456],n, goto(${PRODUCT-${EXTEN}-APPLICATION},s,1)
This particular dialplan uses the invalid template in around 30 contexts
and 'goto(${CONTEXT},s,1)' about 15 times. Note that the last example
'nests' the variable expansion -- a variable within a variable.
--
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST
More information about the asterisk-users
mailing list