[Home]

Summary:ASTERISK-02268: AGI get_variable doesn't work.
Reporter:muir (muir)Labels:
Date Opened:2004-08-24 23:49:02Date Closed:2011-06-07 14:10:02
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:I'm using the perl module Asterisk::AGI.

In my dialplan, I set a variable.
Later, using Asterisk::AGI I try to get the value of that variable.

The value I always get is undef.


****** ADDITIONAL INFORMATION ******

I'm using asterisk version CVS-HEAD-08/24/04-21:23:54
Comments:By: Mark Spencer (markster) 2004-08-25 08:33:34

Are you using get_variable on a call that has already been hungup?  If so, you need to be using DeadAGI

By: muir (muir) 2004-08-25 11:39:56

No.  The call is still live.

By: Clod Patry (junky) 2004-08-25 22:32:19

can ya show us how you did it exactly ?
afaik, get_variable works for every variables excepts for global variables like ${EPOCH},${CHANNEL},{TIMESTAMP}, etc.

show us how ya've called ur AGI too into the extensions.conf.

And next time, be more explicit when you're reporting a problem, it's easier for everyone.

Thanks.

By: Olle Johansson (oej) 2004-08-26 01:41:27

AGI does only support channel specific variables, variables that is part of the channel structure. Other variables that is embedded as functions in the source (pbx.c) doesn't work.

One could change the res_agi to allocate a string and call other functions to also support other variables and embedded variables, like ${EXTEN:3}.

In function handle_getvariable in res_agi.c we call
 pbx_builtin_getvar_helper(chan, argv[2]))

I guess we should ast_alloca some string buffers, copy the variable name as ${VARIABLE} into one of them and call pbx_substitute_variables_helper instead.

Any coders?

By: muir (muir) 2004-08-26 03:32:17

My aplogies.  After reading junky's comment, I went to make a clean
example.  To my great surprise: no bug.  

Turns out that the problem is in Asterisk::AGI.  In some debugging
code, I had the equivelent of $AGI->verbose("some string\n", 1).  That
extra "\n" messed up all future AGI commands that pulled information
from Asterisk.

I've also noticed that if you something like

$AGI->set_variable("Foo", "A normal CID Value <num>") it fails.  To get it
to work, quotes must be embedded:
$AGI->set_variable("Foo", qq'"A normal CID Value <num"').  Most gross.

Is Asterisk::AGI the only perl interface package?  If so, I hearby volunteer
myself to replace it.

As far as I'm concerned this can be closed.  I don't really understand oej's
comment so I can't evaluate if his comment presents a reason to keep this
open.

Thanks,
-Dave

By: twisted (twisted) 2004-08-26 15:11:38

closed per muir