0) { $response .= $buffer; } if ($contentlength == 0) { //if contentlenght is already don't process again if (strlen(trim($buffer)) > 0) { //run only if buffer has content $temparray = split(":", trim($buffer)); if ($temparray[0] == "Content-Length") { $contentlength = trim($temparray[1]); } } } usleep(100); //allow time for reponse //optional because of script timeout //don't let while loop become endless if ($i > 10000) { break; } if ($contentlength > 0) { //is contentlength set //stop reading if all content has been read. if (strlen($response) >= $contentlength) { break; } } $i++; } return $response; } else { echo "no handle"; } } $pgtitle = "FreeSWITCH: Status"; include("head.inc"); $password = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password']; $port = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port']; $host = $config['interfaces']['lan']['ipaddr']; ?>


\n\n"; $fp = event_socket_create($host, $port, $password); $cmd = "api sofia status"; $response = event_socket_request($fp, $cmd); echo "sofia status
\n"; echo "
\n";
echo $response; 
echo "
\n"; fclose($fp); echo "

\n\n"; $fp = event_socket_create($host, $port, $password); $cmd = "api sofia status profile internal"; $response = event_socket_request($fp, $cmd); echo "sofia status profile internal
\n"; echo "
\n";
echo $response; 
echo "
\n"; fclose($fp); echo "

\n\n"; $fp = event_socket_create($host, $port, $password); $cmd = "api sofia status profile external"; $response = event_socket_request($fp, $cmd); echo "sofia status profile external
\n"; echo "
\n";
echo $response; 
echo "
\n"; fclose($fp); echo "

\n\n"; $fp = event_socket_create($host, $port, $password); $cmd = "api status"; $response = event_socket_request($fp, $cmd); echo "status
\n"; echo "
\n";
echo $response; 
echo "
\n"; fclose($fp); echo "

\n\n"; $fp = event_socket_create($host, $port, $password); $cmd = "api show channels"; $response = event_socket_request($fp, $cmd); echo "show channels
\n"; echo "
\n";
echo $response; 
echo "
\n"; /* $response = "\n\n
".$response; $response = str_replace("\n", "
", $response); $response = str_replace(",", "", $response); $response = $response."
\n"; echo $response; */ fclose($fp); echo "

\n\n"; $fp = event_socket_create($host, $port, $password); $cmd = "api show calls"; $response = event_socket_request($fp, $cmd); echo "show calls
\n"; echo "
\n";
echo $response; 
echo "
\n"; fclose($fp); echo "

\n\n"; ?>