[Asterisk-Users] trouble using variables with included contexts

Andy Howell AndyHowell at austin.rr.com
Mon Aug 8 07:05:06 MST 2005


I'm trying to set a variable in one context and use it in another:

[c1]
MY_GROUP = SIP/200&SIP/201

[c2]
include c1
exten s,1,NoOp(${MY_GROUP})

The noop prints out a blank string. In [c1], I've tried

exten s,1,SetVar(MY_GROUP=SIP/200&SIP/201)

and

exten s,1,SetVar(_MY_GROUP=SIP/200&SIP/201)

and

exten s,1,SetVar(__MY_GROUP=SIP/200&SIP/201)

and

exten s,1,SetGlobalVar(MY_GROUP=SIP/200&SIP/201)

Nothing set in [c1] works. If in [c2] I do:

exten s,1,SetVar(MY_GROUP=SIP/200&SIP/201)
exten s,2,NoOp(${MY_GROUP})

Then that works. From reading
http://www.voip-info.org/tiki-index.php?page=Asterisk%20variables

it seems like what I'm trying to do should work.

I using Asterisk 1.09. Putting in the MY_GROUP = SIP... in [globals]
section works, but that gets overwritten by AMP, so its not an option.

Any ideas what I'm doing wrong?

Thanks.




More information about the asterisk-users mailing list