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       [email protected]      Voice: +1-760-468-3867 PST

--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
              http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to