Cant pass variable to Agi in drop call file

Hey there all, been pouring over the internet (especially this forum) trying to find out how i can pass a variable to an AGI script when i initiate a call out with a .call drop file in the outbound spool.

i am using this

Channel: Zap/2/xxxxxxxxxx Callerid: CALLERID(James) WaitTime: 15 Context: outboundmsg6 Extension: s SetVar: myvar=bigun

and in extensions.conf

[outboundmsg6] exten => s,1,Wait(3) exten => s,2,Answer exten => s,3,Wait(2) exten => s,4,AGI(agi_test_dialout.py) exten => s,5,Hangup

when i do an AGI enviroment dump to the terminal, i can see the other params show up, but not the variable.

what do i need to do?

where are you trying to retrieve the variable? what does your script look like?

sorry for the delay getting back, what i have that is trying to collect the variable is something like this

[code]
def read_asterisk_env_data():
env = {}
while 1:
line = sys.stdin.readline().strip()
if line == ‘’:
break
key,data = line.split(’:’)
if key[:4] <> ‘agi_’:
# skip input that does not begin with agi_
sys.stderr.write(“Did not work\n”);
sys.stderr.flush()
continue
key = key.strip()
data = data.strip()
sys.stderr.write ( ’ %s %s’ % (key, data))

when it prints, some of the variables go through, like the callerid,
but the variables do now. (myvar = bigun)

thanks for any tips

try to put two underscores under your variable name when you are setting it in the .call file. It’s been a while for me, but I think in the past when I’ve done apps with .call files, needed that. At least you need it when you are using Dial(LOCAL/xxx@context) type of constructs to achieve more complex behaviors… I’m guessing that the same might apply for using AGI scripts.

When using PHP-AGI (this may be the same for perl but I am unsure) the asterisk variables seem to be set in an array. Here is what I use:

Asterisk Dial Plan

Exten => s,1,Set(hangup_location=1)
Exten => s,2,Agi(my_agi.agi)

Agi Code

$hangup_location = $agi->get_variable(hangup_location);
$hangup_location = $hangup_location[data];