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

Joshua Colp jcolp at digium.com
Thu Feb 20 06:37:44 CST 2014


On 14-02-20 06:24 AM, Igor Dvorzhak wrote:
> 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



More information about the asterisk-users mailing list