Elvyn Bolges (ESCulapio)
unread,Feb 21, 2011, 10:53:46 AM2/21/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to asterisk-es
Hola Tod@s
Estoy presentando este error cuando intento conectarme con php al AMI,
aunque por el momento lo solucione abriendo la conexión via un script
por bash, luego de realizar prueba con telnet y que todo funcionara,
publico el post por si alguien tiene alguna sugerencia y/o le pasa
algo como esto:
El error.
ERROR[4777]: utils.c:1177 ast_careful_fwrite: fwrite() returned error:
Broken pipe
El Codigo, Aunque hay veces que funciona
<?php
$timeout = 10;
$asteriskip = "127.0.0.1";
$fb1 = fsockopen($asteriskip", "5038", $errno, $errstr, $timeout);
fputs($fb1, "Action: Login\r\n");
fputs($fb1, "Username: admin\r\n");
fputs($fb1, "Secret: admin\r\n\r\n");
fputs($fb1, "Action: Command\r\n");
fputs($fb1, "Command: Core reload\r\n\r\n");
fputs($fb1, "Action: Logoff\r\n\r\n");
$ws=fgets($fb1,128);
fclose($fb1);
$socket = fsockopen($asteriskip,"5038", $errno, $errstr, $timeout);
fputs($socket, "Action: Login\r\n");
fputs($socket, "UserName: admin\r\n");
fputs($socket, "Secret: admin\r\n\r\n");
fputs($socket, "Action: Originate\r\n" );
fputs($socket, "Channel: SIP/2001\r\n" );
fputs($socket, "Exten: 2000\r\n" );
fputs($socket, "Callerid: User <2000>\r\n");
fputs($socket, "Timeout: 15000\r\n" );
fputs($socket, "Context: usuarios\r\n" );
fputs($socket, "Priority: 1\r\n" );
fputs($socket, "Async: yes\r\n\r\n" );
fputs($socket, "Action: Logoff\r\n\r\n");
$wrets=fgets($socket,128);
fclose($socket);
Un saludo y gracias de antemanos