[Asterisk-Users] ImportVar Syntax

Kevin Bockman asterisk at wunderkin.com
Fri Feb 24 16:03:13 MST 2006


Steven Ringwald wrote:
> I am trying to use ImportVar to get some information out of a SIP/ZAP 
> channel. I cannot seem to find an example of the syntax, or what 
> variables I can access.
> 
> Basically, I would like to output which person is being called. i.e: 
> SIP/25 calls SIP/21. 25 executes a macro, and the result is SIP/21.  The 
> info that I want is stored in the channel's "Direct Bridge" variable.
> 
> I have tried: ImportVar(TEST=SIP/25-6d2a|name)
exten => s,n,ImportVar(BRIDGEPEER=${CHANNEL:0:$[${LEN(${CHANNEL})} - 
2]}\,2|BRIDGEPEER)

This is what I use.  You can see all variables related to the channel by 
using DumpChan app.  From the CLI, you can also do a show channel 
<blah>.  I remember there were some got-yas when using macros.  Take a 
look using DumpChan everywhere to make sure what variables are set 
first.  Doing a show channel from the CLI will show you all variables on 
the channel after the answer, which can vary from what is available in 
your macro at the time.


Kevin



More information about the asterisk-users mailing list