Return set variable from PHP - AGI

Hi - I’m trying to return a variable back to the dial plan from a php script called by AGI command. This used to work in 1.2 but cannot get it to work in 1.4. Any help appreciated, script below:

$BFILE = “somefilename”;
$str = “SET savedfile= “$BFILE”;
str_replace(”\n", ‘\n’, addslashes($BFILE));

What returns is an empty variable.


for a script that changes the CID info…

define(“AGIBIN_DIR”, “/var/lib/asterisk/agi-bin”);


$agi = new AGI();

$r = $agi->get_variable(“CALLERID(name)”);
if ($r[“result”] == 0) {

(deleted stuff)

$agi->set_variable(“CALLERID(num)”, $cidnum);

I’ve not done much work in PHP, but try changing this

$BFILE = "somefilename"; $str = "SET savedfile= \"$BFILE\"; str_replace("\n", '\n', addslashes($BFILE)); fwrite($stdout,$str);
to this

$BFILE = "somefilename"; str_replace("\n", '\n', addslashes($BFILE)); $str = "SET VARIABLE savedfile \"$BFILE\"; fwrite($stdout,$str);