[Home]

Summary:ASTERISK-07876: Can't use channel variables in EXEC
Reporter:salaud (salaud)Labels:
Date Opened:2006-10-05 04:11:29Date Closed:2011-06-07 14:03:20
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Resources/res_agi
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:I've been trying to do an EXEC through AGI and do something like SayDigits(${CALLERIDNUM}) and can't get it work.  I'm using the perl AGI library, but I can look at the console messages on asterisk and see that any combination of "${CALLERIDNUM}" or '${CALLERIDNUM}' or even $[${CALLERIDNUM}] will not work.

Bottom line is that that channel variables should be able to work with an EXEC call through AGI.
Comments:By: Tilghman Lesher (tilghman) 2006-10-05 07:46:57

Variable interpolation has never worked in AGI, and I don't think we need to start.  The proper way to do this is to retrieve the variable value with GET VARIABLE and interpolate it yourself when calling EXEC.

Variable interpolation only occurs within the dialplan itself, not within any of the foreign accessor methods (i.e. AGI, Manager, CLI).

By: salaud (salaud) 2006-10-05 11:57:39

That was a bit heavy handed as a way to close an important issue.  I am writing an IVR generator and to make this type of application work it is very important.  The CMS simply allows the user to put in commands that will get executed.  They need to be able to specify channel variables, other variables, and expressions and expect them to work.

There are hack arounds, as you suggested.  Basically meaning that before every EXEC parse out all the parameters, possibly inventing your own syntax for variables and interpolate variables and possibly expressions too, potentially writing your own expression language!  This is essentially re-writing everything that's already in Asterisk.

I hope whomever is coding on this will realize that re-writing the parser, interpolation and expression language of asterisk is not the "proper" way to do these things.  It may be the history, but it's not at all a solution.

I don't have my hands down deep in the code, but is this really a huge change, that is to pass along the parameters to whatever function already handles this in asterisk libraries?  If every other application, including one that I could write using the libraries has access to the variable interpolation function and expressions, why can't AGI?

In any case, if this functionality is needed anywhere, AGI is definitely that place.  Placing this functionality low on the totem pole seems unreasonable.



By: Tilghman Lesher (tilghman) 2006-10-05 13:15:38

Then you need to change how your application generates rules.  It is not our fault that you have not planned for the fact that AGI should resolve all variables prior to passing commands.

At the very least, this a feature request, not a bug.