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

Danny Nicholas danny at debsinc.com
Thu Sep 9 09:52:21 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 9:45 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] Set channel variable from within other channel

 

On 09/09/2010 04:12 PM, Danny Nicholas wrote: 

  _____  

size=2 width="100%" align=center> 

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


Danny,

the wiki mentions :

Set(DB(family/key)=${foo})

What is this 'passval' you are talking about ?!


Kind regards,

Jonas.

Just being a bit "over(under?) verbose)" .  Since I'm using ASTDB to "pass
values" between channels, my thought was that the "family" would be passval
and the key would be ${EXTEN}/val1 (so you could pass multiple values if
desired).  In a two-channel environment, it wouldn't be that relevant, but
since I assume you would want to be able to monitor X number of bridged
calls, the 3 value "family/key" combination made the most sense to me.

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


More information about the asterisk-users mailing list