Hi,
I am using an originate action to make an outbound call to someone and then connect the call to an IVR.
In this case, 2 channels will be created. I’m wondering how to pass a channel variable from the first channel to the second using dial plan or AMI. Please note I have to avoid using global variables. Thanks.
Why can’t you use global variables? Which version of Asterisk are you using?
The is a mechanism, available in 1.6 (at least 1.6.1+) which looks like it would support this, but it may have some of the attributes of global variables that you want to avoid.
AMI methods should be obvious.
I get worried when I see arbitrary, but absolute, constraints, that the question may be a homework one.
I am working on an AMI app that makes multiple concurrent outbound calls. It first calls someone, and then connects the call to an IVR. I need to find a reliable way to filter out unwanted events from Asterisk so that each thread handles only relevant events. I’m trying to see if that is doable with channel variables. I can set the variable along with each originate action, but the variable is only available in the first channel. I need to pass it to another channel and hope the variable will show up in one of the subsequent events. Obviously, global variables are not a good option because of multiple concurrent calls.
You can use the Set variable
exten => s,n,Set(__MCall=${anyvalue})
Now you can use __MCall variable one channel to another. Global variable overrite the previous value.
Make Sure about double underscore with variable name.
I hope this helps you.
The variable is passed by value, not by name/reference, and only to channels created by the channel on which it is set, and its descendents.
(I have some reservations about the likely application here.)