[Home]

Summary:ASTERISK-05535: AGI does not set variables until script ends
Reporter:Terence (mrfreeze)Labels:
Date Opened:2005-11-09 15:24:09.000-0600Date Closed:2011-06-07 14:10:37
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Resources/res_agi
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:This is my extension:

exten => _X.,1,SetGlobalVar(conf=0)
exten => _X.,n,SetGlobalVar(pin=0)
exten => _X.,n,AGI(fun.php)
exten => _X.,n,NoOp(${conf})
exten => _X.,n,NoOp(${pin})


This is the output:

AGI Rx << SET VARIABLE conf 1234 ""
AGI Tx >> 200 result=1
AGI Rx << SET VARIABLE pin 5678 ""
AGI Tx >> 200 result=1
AGI Rx << GET FULL VARIABLE ${conf} ""
AGI Tx >> 200 result=1 (0)
AGI Rx << GET FULL VARIABLE ${pin} ""
AGI Tx >> 200 result=1 (0)

-- AGI Script fun.php completed, returning 0
-- Executing NoOp("OH323/POLYCOM@1.2.3.4", "1234") in new stack
-- Executing NoOp("OH323/POLYCOM@1.2.3.4", "5678") in new stack
Comments:By: Terence (mrfreeze) 2005-11-09 16:52:18.000-0600

It appears that AGIs set variables locally but gets them globally, if that makes sense... :/

By: Tilghman Lesher (tilghman) 2005-11-09 23:48:21.000-0600

The fifth argument, which you're setting to blank is for the channel name.  If you want the channel variables, then you need to simply not specify the 5th argument at all, e.g.

GET FULL VARIABLE ${conf}
GET FULL VARIABLE ${pin}