[asterisk-users] Variables set by AGI lost in dialplan

Deepesh D deep.d2010 at gmail.com
Thu Feb 14 03:40:37 CST 2013


I am using asterisk with a fast agi written in C

The following is a part of my dialplan

exten => _X.,n,MSet(my_var=0,my_var1=0)
exten => _X.,n,AGI
;; Call to a fast agi to set values of my_var my_var1
exten => _X.,n,Log(NOTICE,"${my_var} ${my_var1}") ;; log the values to
asterisk messages

Inside the AGI I do some calculations and set the values of my_var and
my_var1 variables like
SET VARIABLE my_var "0.008"
SET VARIABLE my_var1 "0.009"

The problem I am facing is that sometimes the variables are wrongly
received as 0 (zero) in the dialplan even if the AGI has set it to a
non-zero value. Inside the AGI I am logging the values of variables to
a log file, and the log file always shows non-zero values. But in my
asterisk messages file the values are zero for some calls.

This error does not happen for all calls and is not reproducible, it
is random. My asterisk server handles about 100 calls per minute, so
its impossible for me to do an 'agi set debug' and observer the output

More information about the asterisk-users mailing list