Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

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

[asterisk-users] Variables are empty after Redirecting a channel


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





PostPosted: Thu Feb 20, 2014 5:24 am    Post subject: [asterisk-users] Variables are empty after Redirecting a cha Reply with quote

Guys,

I am using
Asterisk 1.8.20.0 built by mockbuild @ buildvm-24.phx2.fedoraproject.org on a x86_64 running Linux on 2013-01-18 19:52:25 UTC

How can I set variable in one context and then Redirect a channel to another context and use variable there? The code below doesn't work, so I've got empty VAR1 in context_2

[context_1]

exten => s,1,SET(__VAR1=VALUE1)
exten => s,n,ChannelRedirect(${CHANNEL},context_2,AMD,1)

[context_2]

exten => AMD,1,NoOp(VAR1: ${VAR1})

Thank you in advance,
Igor
Back to top
mailinglist+asterisk a...
Guest





PostPosted: Thu Feb 20, 2014 7:33 am    Post subject: [asterisk-users] Variables are empty after Redirecting a cha Reply with quote

On 20/02/14 10:24, Igor Dvorzhak wrote:
Quote:
Guys,

I am using
Asterisk 1.8.20.0 built by mockbuild @ buildvm-24.phx2.fedoraproject.org on a x86_64 running Linux on 2013-01-18 19:52:25 UTC

How can I set variable in one context and then Redirect a channel to another context and use variable there? The code below doesn't work, so I've got empty VAR1 in context_2

[context_1]

exten => s,1,SET(__VAR1=VALUE1)
exten => s,n,ChannelRedirect(${CHANNEL},context_2,AMD,1)

[context_2]

exten => AMD,1,NoOp(VAR1: ${VAR1})

Thank you in advance,
Igor


You should be able to get something working using a shared variable. I have used them in one of my blog posts if you would like an example of their use
http://gblades.blogspot.co.uk/2013/07/how-to-get-sip-response-code-in.html
Back to top
jcolp at digium.com
Guest





PostPosted: Thu Feb 20, 2014 7:38 am    Post subject: [asterisk-users] Variables are empty after Redirecting a cha Reply with quote

On 14-02-20 06:24 AM, Igor Dvorzhak wrote:
Quote:
Guys,

I am using
Asterisk 1.8.20.0 built by mockbuild @ buildvm-24.phx2.fedoraproject.org
<http://buildvm-24.phx2.fedoraproject.org> on a x86_64 running Linux on
2013-01-18 19:52:25 UTC

How can I set variable in one context and then Redirect a channel to
another context and use variable there? The code below doesn't work, so
I've got empty VAR1 in context_2

[context_1]

exten => s,1,SET(__VAR1=VALUE1)
exten => s,n,ChannelRedirect(${CHANNEL},context_2,AMD,1)

You should be using Goto here instead of ChannelRedirect, since you are
redirecting the channel which is executing ChannelRedirect (that
slightly made my head hurt). Switching should also make the variable
work as you desire.

Cheers,

--
Joshua Colp
Digium, Inc. | Senior Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
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
idmedb at gmail.com
Guest





PostPosted: Fri Feb 21, 2014 9:09 am    Post subject: [asterisk-users] Variables are empty after Redirecting a cha Reply with quote

Sorry there is a mistake, actually I don't redirect executing channel:

exten => s,n,ChannelRedirect(${CHANNEL_TO_REDIRECT},context_2,AMD,1)


I can't use Goto because the ${CHANNEL_TO_REDIRECT} is active channel and Goto drops (hangs-up) it.


So is there a way to pass variable to the target context after ChannelRedirect?


Thanks,
Igor

On Thu, Feb 20, 2014 at 2:37 PM, Joshua Colp <jcolp@digium.com (jcolp@digium.com)> wrote: 
Quote:
You should be using Goto here instead of ChannelRedirect, since you are

redirecting the channel which is executing ChannelRedirect (that
slightly made my head hurt). Switching should also make the variable
work as you desire.

Cheers,

--
Joshua Colp
Digium, Inc. | Senior Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
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