<?php
$timeout=15;
$socket = fsockopen("127.0.0.1","5038", $errno, $errstr, $timeout);
fputs($socket, "Action: Login\r\n");
fputs($socket, "UserName: manager\r\n");
fputs($socket, "Secret: jkfu57fh3d7nms2\r\n\r\n");
fputs($socket, "Action: PJSIPShowRegistrationInboundContactStatuses\r\n");
fputs($socket, "\r\n");
$started=true;
$line = '';
while (!feof($socket)) {
$line = fgets($socket, 4096);
echo $line;
$line = str_replace("\n","",$line);
$line = str_replace("\r","",$line);
if (strpos($line, "--END COMMAND--") !== false) {
$started=false;
break;
}
}
fputs($socket,"Action: Logoff\r\n");
fputs($socket,"\r\n");
?>
UserAgent: Grandstream GXP1630 1.0.7.3
RegExpire: 1639623367
ViaAddress: 192.168.1.26:5060