[asterisk-users] channel variables in AGI

Anthony Messina amessina at messinet.com
Wed Aug 18 22:07:52 CDT 2010


On Wednesday, August 11, 2010 11:08:37 am Tino wrote:
> #!/bin/bash -x
> T="$agi_uniqueid"
> 
> I want to save value of 'agi_uniqueid' channel variable into a variable
> called 'T' in my script

When executing and AGI from the dialplan, it will dump out it's variables 
immediately, so you need to tell Bash to read them in and write them to 
whatever variables you want.  For example, see:
http://messinet.com/trac/asterisk-fax-gw/browser/fax-gw.agi#L622

Here, I set the variable name from Asterisk to the variable value from 
Asterisk.

So I end up with:

agi_uniqueid=123456... (or whatever the uniqueid was)

Then I could go on to say
T="$agi_uniqueid"

-- 
Anthony - http://messinet.com - http://messinet.com/~amessina/gallery
8F89 5E72 8DF0 BCF0 10BE 9967 92DC 35DC B001 4A4E
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20100818/ab0b14b4/attachment.pgp 


More information about the asterisk-users mailing list