[asterisk-users] Re: channel variable

Leif Madsen asterisk.leif.madsen at gmail.com
Tue Oct 10 20:40:55 MST 2006


On 8/24/06, Tony Mountifield <tony at softins.clara.co.uk> wrote:
> In article <6fbb529e0608240234x32c224ax37760dd5b989b594 at mail.gmail.com>,
> unplug <maillisting at gmail.com> wrote:
> > Tony Mountifield wrote:
> > >
> > > Try using Set(__testmode=1), but still refer to it as ${testmode}.
> > >
> > > The __ tells Asterisk to propagate the variable to created channels.
> >
> > Do you mean it is a global variable instead of channel variable?
>
> No, it is a channel variable. The __ on the beginning means it will be
> inherited by any channels created from the channel it was set on.

In following up with this very old thread... I was just playing with
variable inheritance, and if you are calling Set(__MYVAR=myval), and
then go off somewhere else (in my case it was via a GoSub()), and
Set(MYVAL=myotherval), then you effectively set the variable local
again and it will not be inherited.

My trick was to do a Set(__MYVAL=${MYVAL}) right before Dial()ing the
Local channel. This will forward the current value to the Local
channel.

--
Leif Madsen.
http://www.leifmadsen.com
http://www.oreilly.com/catalog/asterisk


More information about the asterisk-users mailing list