I have a agi script running in asterisk 1.4.28 but when upgrade the asterisk to 1.6.2.0 and PHP-5.3.1 the script doesnt work anymore. I try with a simple script but not run:
[code]#!/usr/bin/php -q
<?php set_time_limit(30); require('phpagi/phpagi.php'); error_reporting(E_ALL); $agi = new AGI(); $agi->answer(); $agi->stream_file('/var/lib/asterisk/sounds/en/tt-monkeys'); $agi->hangup(); ?>[/code]Output CLI:
== Using SIP RTP CoS mark 5
-- Executing [5444@default:1] AGI("SIP/4100-00000043", "getdata.agi") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/getdata.agi
<SIP/4100-00000043>AGI Tx >> agi_request: getdata.agi
<SIP/4100-00000043>AGI Tx >> agi_channel: SIP/4100-00000043
<SIP/4100-00000043>AGI Tx >> agi_language: es
<SIP/4100-00000043>AGI Tx >> agi_type: SIP
<SIP/4100-00000043>AGI Tx >> agi_uniqueid: 1263851318.67
<SIP/4100-00000043>AGI Tx >> agi_version: 1.6.2.1
<SIP/4100-00000043>AGI Tx >> agi_callerid: 4100
<SIP/4100-00000043>AGI Tx >> agi_calleridname: unknown
<SIP/4100-00000043>AGI Tx >> agi_callingpres: 0
<SIP/4100-00000043>AGI Tx >> agi_callingani2: 0
<SIP/4100-00000043>AGI Tx >> agi_callington: 0
<SIP/4100-00000043>AGI Tx >> agi_callingtns: 0
<SIP/4100-00000043>AGI Tx >> agi_dnid: 5444
<SIP/4100-00000043>AGI Tx >> agi_rdnis: unknown
<SIP/4100-00000043>AGI Tx >> agi_context: default
<SIP/4100-00000043>AGI Tx >> agi_extension: 5444
<SIP/4100-00000043>AGI Tx >> agi_priority: 1
<SIP/4100-00000043>AGI Tx >> agi_enhanced: 0.0
<SIP/4100-00000043>AGI Tx >> agi_accountcode:
<SIP/4100-00000043>AGI Tx >> agi_threadid: -1254409360
<SIP/4100-00000043>AGI Tx >>
-- <SIP/4100-00000043>AGI Script getdata.agi completed, returning 0
But if I try with standar script, it run fine:
[code]#!/usr/bin/php -q
<? ob_implicit_flush(false); set_time_limit(6); $stdin = fopen('php://stdin', 'r'); $stdlog = fopen('my_agi.log', 'w'); $debug = true; /* Read input from Asterisk and output via $astOutput */ function astRead() { global $stdin, $debug, $stdlog; $astOutput = str_replace("\n", "", fgets($stdin, 4096)); if ($debug) fputs($stdlog, "read: $input\n"); return $astOutput ; } /* Write AGI command to Asterisk */ function astWrite($agiCommand) { global $debug, $stdlog; if ($debug) fputs($stdlog, "write: $agiCommand\n"); echo $agiCommand."\n"; } /* Handling execution input from Asterisk */ $agivar = array(); while (!feof($stdin)) { $temp = fgets($stdin); $temp = str_replace("\n","",$temp); $s = explode(":",$temp); $agivar[$s[0]] = trim($s[1]); if ($temp == "") { break; } } /* Operational Code starts here */ /* Playback the demo-congrats.gsm file from the * directory /var/lib/asterisk/sounds/ */ astWrite("STREAM FILE /var/lib/asterisk/sounds/en/tt-monkeys #"); astRead(); /* Say the number 123456 astWrite("SAY NUMBER 123456 #"); astRead();*/ /* Finalization of AGI script and clean-ups */ fclose ($stdin); fclose ($stdlog); exit(0); ?>[/code]Output CLI:
-- Executing [5666@default:1] Answer("SIP/4100-00000044", "") in new stack
-- Executing [5666@default:2] AGI("SIP/4100-00000044", "getdata2.agi") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/getdata2.agi
<SIP/4100-00000044>AGI Tx >> agi_request: getdata2.agi
<SIP/4100-00000044>AGI Tx >> agi_channel: SIP/4100-00000044
<SIP/4100-00000044>AGI Tx >> agi_language: es
<SIP/4100-00000044>AGI Tx >> agi_type: SIP
<SIP/4100-00000044>AGI Tx >> agi_uniqueid: 1263851364.68
<SIP/4100-00000044>AGI Tx >> agi_version: 1.6.2.1
<SIP/4100-00000044>AGI Tx >> agi_callerid: 4100
<SIP/4100-00000044>AGI Tx >> agi_calleridname: unknown
<SIP/4100-00000044>AGI Tx >> agi_callingpres: 0
<SIP/4100-00000044>AGI Tx >> agi_callingani2: 0
<SIP/4100-00000044>AGI Tx >> agi_callington: 0
<SIP/4100-00000044>AGI Tx >> agi_callingtns: 0
<SIP/4100-00000044>AGI Tx >> agi_dnid: 5666
<SIP/4100-00000044>AGI Tx >> agi_rdnis: unknown
<SIP/4100-00000044>AGI Tx >> agi_context: default
<SIP/4100-00000044>AGI Tx >> agi_extension: 5666
<SIP/4100-00000044>AGI Tx >> agi_priority: 2
<SIP/4100-00000044>AGI Tx >> agi_enhanced: 0.0
<SIP/4100-00000044>AGI Tx >> agi_accountcode:
<SIP/4100-00000044>AGI Tx >> agi_threadid: -1254409360
<SIP/4100-00000044>AGI Tx >>
<SIP/4100-00000044>AGI Rx << STREAM FILE /var/lib/asterisk/sounds/en/tt-monkeys #
-- Playing '/var/lib/asterisk/sounds/en/tt-monkeys' (escape_digits=#) (sample_offset 0)
<SIP/4100-00000044>AGI Tx >> 200 result=-1 endpos=38080
-- <SIP/4100-00000044>AGI Script getdata2.agi completed, returning -1
So PHPAGI, its dead for asterisk-1.6.2.0 or I miss something.