I have studied the AGI documentation and have looked through the forums but have been able to solve this problem.

I am trying to set a channel variable from a php agi script like this:

$r[1] is from a table row. The literal value is: t

When the syntax looks correct from the php cli. From the asterisk cli in agi debug mode there is no indication that the variable is set.

TIA, -Alec

Try this:

// Set my 2 variables.

$variable = “forward”;
$value = $r[1];

// Make sure they are in the correct format.

$str = “SET VARIABLE $variable “$value”;
str_replace(”\n", ‘\n’, addslashes($value));

// Spit out to Asterisk.

You could also make it into a function (which is recommended).

Have you tried the PHPAGI Libraries?

Chris. C.