I have a weird problem with my return values not being what I expect from a Queue command in a php agi script…
[code]ob_implicit_flush(true);
set_time_limit(6);
$in = fopen(“php://stdin”,“r”);
$stdlog = fopen(“/var/log/asterisk/agi.log”, “w”);
// toggle debugging output (more verbose)
$debug = true;
// Do function definitions before we start the main loop
// Functions for variable input / output
function read() {
global $in, $debug, $stdlog;
$input = str_replace(“\n”, “”, fgets($in, 4096));
if ($debug) fputs($stdlog, “read: $input\n”);
return $input;
}
function write($line) {
global $debug, $stdlog;
if ($debug) fputs($stdlog, “write: $line\n”);
echo $line.“\n”;
}
write("EXEC Queue ".$val);
$appReturn = read();
echo “VERBOSE "RETURN VALUE >>>>> “.$appReturn.”" \n”;
[/code]
With agi debug on I see the ‘correct’ variable sent back but that’s not what my read() function sees.
Example debug output:
Any ideas?