"ERROR[25483]: utils.c:966 ast_carefulwrite: write() returned error: Broken pipe" and hangs up.
The status of cli when I call 777001 is:
-- Executing [777001@trunkinbound:1] Answer("SIP/carrier1-00000000", "") in new stack
-- Executing [777001@trunkinbound:2] Wait("SIP/carrier1-00000000", "0.5") in new stack
-- Executing [777001@trunkinbound:3] AGI("SIP/carrier1-00000000", "helloworld.php") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/helloworld.php
[Aug 10 05:45:40] ERROR[25483]: utils.c:966 ast_carefulwrite: write() returned error: Broken pipe
[Aug 10 05:45:40] ERROR[25483]: utils.c:966 ast_carefulwrite: write() returned error: Broken pipe
[Aug 10 05:45:40] ERROR[25483]: utils.c:966 ast_carefulwrite: write() returned error: Broken pipe
[Aug 10 05:45:40] ERROR[25483]: utils.c:966 ast_carefulwrite: write() returned error: Broken pipe
[Aug 10 05:45:40] ERROR[25483]: utils.c:966 ast_carefulwrite: write() returned error: Broken pipe
[Aug 10 05:45:40] ERROR[25483]: utils.c:966 ast_carefulwrite: write() returned error: Broken pipe
[Aug 10 05:45:40] ERROR[25483]: utils.c:966 ast_carefulwrite: write() returned error: Broken pipe
[Aug 10 05:45:40] ERROR[25483]: utils.c:966 ast_carefulwrite: write() returned error: Broken pipe
[Aug 10 05:45:40] ERROR[25483]: utils.c:966 ast_carefulwrite: write() returned error: Broken pipe
[Aug 10 05:45:40] ERROR[25483]: utils.c:966 ast_carefulwrite: write() returned error: Broken pipe
[Aug 10 05:45:40] ERROR[25483]: utils.c:966 ast_carefulwrite: write() returned error: Broken pipe
[Aug 10 05:45:40] ERROR[25483]: utils.c:966 ast_carefulwrite: write() returned error: Broken pipe
[Aug 10 05:45:40] ERROR[25483]: utils.c:966 ast_carefulwrite: write() returned error: Broken pipe
[Aug 10 05:45:40] ERROR[25483]: utils.c:966 ast_carefulwrite: write() returned error: Broken pipe
[Aug 10 05:45:40] ERROR[25483]: utils.c:966 ast_carefulwrite: write() returned error: Broken pipe
[Aug 10 05:45:40] ERROR[25483]: utils.c:966 ast_carefulwrite: write() returned error: Broken pipe
[Aug 10 05:45:40] ERROR[25483]: utils.c:966 ast_carefulwrite: write() returned error: Broken pipe
[Aug 10 05:45:40] ERROR[25483]: utils.c:966 ast_carefulwrite: write() returned error: Broken pipe
[Aug 10 05:45:40] ERROR[25483]: utils.c:966 ast_carefulwrite: write() returned error: Broken pipe
[Aug 10 05:45:40] ERROR[25483]: utils.c:966 ast_carefulwrite: write() returned error: Broken pipe
[Aug 10 05:45:40] ERROR[25483]: utils.c:966 ast_carefulwrite: write() returned error: Broken pipe
[Aug 10 05:45:40] ERROR[25483]: utils.c:966 ast_carefulwrite: write() returned error: Broken pipe
[Aug 10 05:45:40] ERROR[25483]: utils.c:966 ast_carefulwrite: write() returned error: Broken pipe
[Aug 10 05:45:40] ERROR[25483]: utils.c:966 ast_carefulwrite: write() returned error: Broken pipe
[Aug 10 05:45:40] ERROR[25483]: utils.c:966 ast_carefulwrite: write() returned error: Broken pipe
[Aug 10 05:45:40] ERROR[25483]: utils.c:966 ast_carefulwrite: write() returned error: Broken pipe
[Aug 10 05:45:40] ERROR[25483]: utils.c:966 ast_carefulwrite: write() returned error: Broken pipe
[Aug 10 05:45:40] ERROR[25483]: utils.c:966 ast_carefulwrite: write() returned error: Broken pipe
[Aug 10 05:45:40] ERROR[25483]: utils.c:966 ast_carefulwrite: write() returned error: Broken pipe
[Aug 10 05:45:40] ERROR[25483]: utils.c:966 ast_carefulwrite: write() returned error: Broken pipe
[Aug 10 05:45:40] ERROR[25483]: utils.c:966 ast_carefulwrite: write() returned error: Broken pipe
[Aug 10 05:45:40] ERROR[25483]: utils.c:966 ast_carefulwrite: write() returned error: Broken pipe
[Aug 10 05:45:40] ERROR[25483]: utils.c:966 ast_carefulwrite: write() returned error: Broken pipe
[Aug 10 05:45:40] ERROR[25483]: utils.c:966 ast_carefulwrite: write() returned error: Broken pipe
-- AGI Script helloworld.php completed, returning 0
-- Executing [777001@trunkinbound:4] Hangup("SIP/carrier1-00000000", "") in new stack
== Spawn extension (trunkinbound, 777001, 4) exited non-zero on 'SIP/carrier1-00000000'
Here is my "helloworld.php" file:
#!/usr/bin/php -q
<?
ob_implicit_flush(false);
set_time_limit(6);
$stdin = fopen(‘php://stdin’, ‘r’);
$stdlog = fopen(‘my_agi.log’, ‘w’);
$debug = false;
function astRead() {
global $in, $debug;
$input = str_replace("\n", "", fgets($in, 4096));
if ($debug) echo "VERBOSE \"read: $input\"\n";
return $input;
}
function astWrite($line) {
global $debug;
if ($debug) echo "VERBOSE \"write: $line\"\n";
print $line."\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;
}
}
/* Say the number 123456 */
astWrite("SAY NUMBER 123456 #");
astRead();
/* Finalization of AGI script and clean-ups */
fclose ($stdin);
fclose ($stdlog);
exit(0);
?>
Note: I have create a file named "my_agi.log" in the directory "/var/lib/asterisk/agi-bin" and changed the permission to both helloworld.php and my_agi.log to 755 and 777 both.
Here is my extension settings for helloworld.php in the extension.conf:
[trunkinbound]
exten => 777001,1,Answer
exten => 777001,n,Wait(0.5)
exten => 777001,n,AGI(helloworld.php)
exten => 777001,n,Hangup()
Can vicidial guys tell me where is the problem?
_____________________
Installer : GoAutoDial CE 2.1
Astguiclient VERSION: 2.4-309a
BUILD: 110430-1642
Kernel VERSION: 2.6.18-238.9.1.el5.goPAE
BUILD: 100510-2015
Asterisk: 1.4.39.1-vici
CentOS release 5.6 32 bit[/b]