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));
fwrite($stdout,$str);
What returns is an empty variable.
Thanks.
for a script that changes the CID info…
define(“AGIBIN_DIR”, “/var/lib/asterisk/agi-bin”);
include(AGIBIN_DIR."/phpagi.php");
$agi = new AGI();
$r = $agi->get_variable(“CALLERID(name)”);
if ($r[“result”] == 0) {
exit(1);
}
(deleted stuff)
$agi->set_variable(“CALLERID(num)”, $cidnum);
davevg
July 15, 2008, 6:57pm
3
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);