[asterisk-users] Set channel variable from within other channel

Danny Nicholas danny at debsinc.com
Thu Sep 9 09:12:15 CDT 2010


  _____  

From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Jonas Kellens
Sent: Thursday, September 09, 2010 8:56 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: [asterisk-users] Set channel variable from within other channel

 

Hello list,

is it possible to set a variable (channel variable) from within another
channel ?!

I'm currently working with 2 channels that I bridge afterwards. It would be
good to set a variable in one channel when something occurs in the other
channel.

If some variable is not set in channel 1, then this means something for
channel 2. But from within channel 2 I can not see the variables that are
set in channel 1.

The suggestion of using global variables I think will create difficulties
with simultaneous calls...


Kind regards,

Jonas.

AFAIK, it is not possible to set a local variable for 1 call from another.
If GLOBAL variables are a concern, why not use the ASTDB to store/retrieve
these values?

exten => 1234,1,Set(DB(passval/${EXTEN}/val1)=1) will create a key
passval/channelname/val with value 1

on further reflection

exten => 1234,1,Set(DB(passval/${EXTEN:0:7}/val1)=1) might create a better
reference key

For a call on SIP/170, line 1 would create passval/SIP-170abcdefg/val1, line
2 would create passval/SIP-170/val1

 

To see what the channel wrote, you would need to get the bridged channel
value (perhaps core show channels verbose?) and do

Exten => 3456,1,Set(CHAN2=bridged channel)

Exten => 3456,n,Set(TEST2=${DB(passval/${CHAN2}/val1)

 

Regards,

Danny Nicholas

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100909/cbb836ed/attachment.htm 


More information about the asterisk-users mailing list