I found the following PHP Script and wanted to know, once I saved the file and do a chmod 755 on it, do I leave the extension as .php? I want to be able to call it with AGI. Are is there something I need to do with Asterisk in order to call the script as .php? The reason I ask this is, I did this and when I call it from an extension it says file not found??? I did create the My_log file as well:
#!/usr/bin/php4 -q
<?php ob_implicit_flush(true); set_time_limit(6); $in = fopen("php://stdin","r"); $stdlog = fopen("/var/log/asterisk/my_agi.log", "w"); // toggle debugging output (more verbose) $debug = false; // Do function definitions before we start the main loop function read() { global $in, $debug, $stdlog; $input = str_replace("\n", "", fgets($in, 4096)); if ($debug) fputs($stdlog, "read: $input\n"); return $input; } function errlog($line) { global $err; echo "VERBOSE \"$line\"\n"; } function write($line) { global $debug, $stdlog; if ($debug) fputs($stdlog, "write: $line\n"); echo $line."\n"; } // parse agi headers into array while ($env=read()) { $s = split(": ",$env); $agi[str_replace("agi_","",$s[0])] = trim($s[1]); if (($env == "") || ($env == "\n")) { break; } } // main program echo "VERBOSE \"Here we go!\" 2\n"; read(); errlog("Call from ".$agi['channel']." - Calling phone"); read(); write("SAY DIGITS 22 X"); // X is the escape digit. since X is not DTMF, no exit is possible read(); write("SAY NUMBER 2233 X"); // X is the escape digit. since X is not DTMF, no exit is possible read(); // clean up file handlers etc. fclose($in); fclose($stdlog); exit; ?>