[asterisk-users] Asterisk AMI

Ron nhadie at gmail.com
Sun Jun 13 13:23:38 CDT 2010


Hi All,

Been having problem using the AMI, i've got this PHP script:

$socket = fsockopen("1.2.3.4","5038", $errno, $errstr, $timeout);
fputs($socket, "Action: Login\r\n");
fputs($socket, "UserName: amiadmin\r\n");
fputs($socket, "Secret: amiadminpassword\r\n\r\n");

fputs($socket, "Action: Command\r\n");
fputs($socket, "Command: module reload chan_sip.so\r\n\r\n");
$wrets=fgets($socket,128);

fputs($socket, "Action: Command\r\n");
fputs($socket, "Command: module reload chan_iax2.so\r\n\r\n");
$wrets=fgets($socket,128);

fputs($socket, "Action: Reload\r\n");
fputs($socket, "Command: dialplan reload\r\n\r\n");
$wrets=fgets($socket,128);


The first (module reload chan_sip.so) and second (module reload 
chan_iax2.so_ gets executed properly, but the last one does not, i' 
getting an error:

ERROR[2067]: utils.c:968 ast_carefulwrite: write() returned error: 
Broken pipe
ERROR[2067]: utils.c:968 ast_carefulwrite: write() returned error: 
Broken pipe


Has anyone encountered this? TIA.

Regards
Ron



More information about the asterisk-users mailing list