Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

[asterisk-users] Dialplan question: Variables in GoTo() ?


 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> Asterisk Users
View previous topic :: View next topic  
Author Message
asterisk_list at earth...
Guest





PostPosted: Thu Mar 10, 2016 5:25 am    Post subject: [asterisk-users] Dialplan question: Variables in GoTo() ? Reply with quote

I can't seem to find a definitive answer on this, and I really don't want to
risk breaking a production server to find out; so I am going to try asking this
here, and maybe anyone else in the same situation searching the archives
sometime in future will find the answer I get.

Can you use variables in the target of a GoTo() statement?

What I am specifically thinking of is this;

[from_some_source]
exten => s,1,AGI(look_up_stuff.agi,${CALLERID(num)},${EXTEN})
; this AGI script sets variables: next_context, next_ext, next_step
exten => s,n,GoTo(${next_context},${next_ext},${next_step})

Will this work? Does Asterisk evaluate expressions like this, or does it
expect literals?


--
AJS

Note: Originating address only accepts e-mail from list! If replying off-
list, change address to asterisk1list at earthshod dot co dot uk .

--
_____________________________________________________________________
-- 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
Back to top
asterisk.org at sedwar...
Guest





PostPosted: Thu Mar 10, 2016 9:16 am    Post subject: [asterisk-users] Dialplan question: Variables in GoTo() ? Reply with quote

On Thu, 10 Mar 2016, A J Stiles wrote:

Quote:
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@sedwards.com 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
Back to top
jcolp at digium.com
Guest





PostPosted: Thu Mar 10, 2016 9:16 am    Post subject: [asterisk-users] Dialplan question: Variables in GoTo() ? Reply with quote

A J Stiles wrote:
Quote:
I can't seem to find a definitive answer on this, and I really don't want to
risk breaking a production server to find out; so I am going to try asking this
here, and maybe anyone else in the same situation searching the archives
sometime in future will find the answer I get.

Can you use variables in the target of a GoTo() statement?

What I am specifically thinking of is this;

[from_some_source]
exten => s,1,AGI(look_up_stuff.agi,${CALLERID(num)},${EXTEN})
; this AGI script sets variables: next_context, next_ext, next_step
exten => s,n,GoTo(${next_context},${next_ext},${next_step})

Will this work? Does Asterisk evaluate expressions like this, or does it
expect literals?

It most certainly will work. It evaluates on use.

--
Joshua Colp
Digium, Inc. | Senior Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - US
Check us out at: www.digium.com & www.asterisk.org


--
_____________________________________________________________________
-- 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
Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> Asterisk Users All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services