aboutsummaryrefslogtreecommitdiffstats
path: root/packages/freeswitch/freeswitch_status.tmp
diff options
context:
space:
mode:
authorMark Crane <mcrane@pfsense.org>2008-12-06 11:02:28 +0000
committerMark Crane <mcrane@pfsense.org>2008-12-06 11:02:28 +0000
commit1022bb41bcb1c5e42bd088c93bab4e1d99df3b87 (patch)
treef4479dc830091175abe8424942a0fac604e0eb80 /packages/freeswitch/freeswitch_status.tmp
parentdedba3abe3b07e7447c008e3b4c4aca01c206a31 (diff)
downloadpfsense-packages-1022bb41bcb1c5e42bd088c93bab4e1d99df3b87.tar.gz
pfsense-packages-1022bb41bcb1c5e42bd088c93bab4e1d99df3b87.tar.bz2
pfsense-packages-1022bb41bcb1c5e42bd088c93bab4e1d99df3b87.zip
Update FreeSWITCH package v0.3 added IVR, Recordings, enhanced GUI for Dialplan, Gateways, Public. Updated FreeSWITCH to revision 10638.
Diffstat (limited to 'packages/freeswitch/freeswitch_status.tmp')
-rw-r--r--packages/freeswitch/freeswitch_status.tmp184
1 files changed, 98 insertions, 86 deletions
diff --git a/packages/freeswitch/freeswitch_status.tmp b/packages/freeswitch/freeswitch_status.tmp
index af97cb3e..91fe2852 100644
--- a/packages/freeswitch/freeswitch_status.tmp
+++ b/packages/freeswitch/freeswitch_status.tmp
@@ -32,77 +32,28 @@
*/
require("guiconfig.inc");
+require("/usr/local/pkg/freeswitch.inc");
-function event_socket_create($host, $port, $password) {
- $fp = fsockopen($host, $port, $errno, $errdesc)
- or die("Connection to $host failed");
- socket_set_blocking($fp,false);
-
- if ($fp) {
- while (!feof($fp)) {
- $buffer = fgets($fp, 1024);
- usleep(100); //allow time for reponse
- if (trim($buffer) == "Content-Type: auth/request") {
- fputs($fp, "auth $password\n\n");
- break;
- }
- }
- return $fp;
- }
- else {
- return false;
- }
+if ($_GET['a'] == "download") {
+ if ($_GET['t'] == "logs") {
+ $tmp = '/usr/local/freeswitch/log/';
+ $filename = 'freeswitch.log';
+ }
+ if ($_GET['t'] == "cdrcsv") {
+ $tmp = '/usr/local/freeswitch/log/cdr-csv/';
+ $filename = 'Master.csv';
+ }
+ session_cache_limiter('public');
+ $fd = fopen($tmp.$filename, "rb");
+ header("Content-Type: binary/octet-stream");
+ header("Content-Length: " . filesize($tmp.$filename));
+ header('Content-Disposition: attachment; filename="'.$filename.'"');
+ fpassthru($fd);
+ exit;
}
-function event_socket_request($fp, $cmd) {
-
- if ($fp) {
- fputs($fp, $cmd."\n\n");
- usleep(100); //allow time for reponse
-
- $response = "";
- $i = 0;
- $contentlength = 0;
- while (!feof($fp)) {
- $buffer = fgets($fp, 4096);
- if ($contentlength > 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";
- }
-}
-
-
-
include("head.inc");
$password = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password'];
@@ -127,13 +78,15 @@ if ($savemsg) {
$tab_array = array();
$tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=freeswitch.xml&amp;id=0");
- $tab_array[] = array(gettext("Dialplan"), false, "/pkg_edit.php?xml=freeswitch_dialplan.xml&amp;id=0");
+ $tab_array[] = array(gettext("Dialplan"), false, "/freeswitch/freeswitch_dialplan_includes.php");
$tab_array[] = array(gettext("Extensions"), false, "/pkg.php?xml=freeswitch_extensions.xml");
$tab_array[] = array(gettext("External"), false, "/pkg_edit.php?xml=freeswitch_external.xml&amp;id=0");
- $tab_array[] = array(gettext("Gateways"), false, "/pkg.php?xml=freeswitch_gateways.xml");
+ $tab_array[] = array(gettext("Gateways"), false, "/freeswitch/freeswitch_gateways.php");
$tab_array[] = array(gettext("Internal"), false, "/pkg_edit.php?xml=freeswitch_internal.xml&amp;id=0");
+ $tab_array[] = array(gettext("IVR"), false, "/freeswitch/freeswitch_ivr.php");
$tab_array[] = array(gettext("Modules"), false, "/pkg_edit.php?xml=freeswitch_modules.xml&amp;id=0");
- $tab_array[] = array(gettext("Public"), false, "/pkg_edit.php?xml=freeswitch_public.xml&amp;id=0");
+ $tab_array[] = array(gettext("Public"), false, "/freeswitch/freeswitch_public_includes.php");
+ $tab_array[] = array(gettext("Rec"), false, "/freeswitch/freeswitch_recordings.php");
$tab_array[] = array(gettext("Status"), true, "/freeswitch/freeswitch_status.php");
$tab_array[] = array(gettext("Vars"), false, "/pkg_edit.php?xml=freeswitch_vars.xml&amp;id=0");
display_top_tabs($tab_array);
@@ -149,6 +102,7 @@ if ($savemsg) {
echo "<br /><br />\n\n";
+
$fp = event_socket_create($host, $port, $password);
$cmd = "api sofia status";
$response = event_socket_request($fp, $cmd);
@@ -168,6 +122,7 @@ echo "</pre>\n";
fclose($fp);
echo "<br /><br />\n\n";
+
$fp = event_socket_create($host, $port, $password);
$cmd = "api sofia status profile internal";
$response = event_socket_request($fp, $cmd);
@@ -189,6 +144,7 @@ echo "</pre>\n";
fclose($fp);
echo "<br /><br />\n\n";
+
$fp = event_socket_create($host, $port, $password);
$cmd = "api sofia status profile external";
$response = event_socket_request($fp, $cmd);
@@ -211,6 +167,7 @@ echo "</pre>\n";
fclose($fp);
echo "<br /><br />\n\n";
+
$fp = event_socket_create($host, $port, $password);
$cmd = "api status";
$response = event_socket_request($fp, $cmd);
@@ -221,32 +178,87 @@ echo "</pre>\n";
fclose($fp);
echo "<br /><br />\n\n";
+
$fp = event_socket_create($host, $port, $password);
$cmd = "api show channels";
$response = event_socket_request($fp, $cmd);
-echo "<b>show channels</b><br />\n";
-echo "<pre style=\"font-size: 9pt;\">\n";
-echo $response;
-echo "</pre>\n";
-/*
-$response = "<table border='0'><tr><td>".$response;
-$response = str_replace("\n", "</td></tr>\n<tr><td>", $response);
-$response = str_replace(",", "</td><td>", $response);
-$response = $response."</td></tr>\n<table>\n";
-echo $response;
-*/
+echo "<b>show channels</b>\n";
+if (strlen($response) > 40) {
+ echo "<textarea cols='85' rows='10' wrap='off'>\n";
+ echo $response;
+ echo "</textarea>\n";
+}
+else {
+ echo "<pre style=\"font-size: 9pt;\">\n";
+ echo $response;
+ echo "</pre>\n";
+}
fclose($fp);
echo "<br /><br />\n\n";
+echo "<br /><br />\n\n";
+
$fp = event_socket_create($host, $port, $password);
$cmd = "api show calls";
$response = event_socket_request($fp, $cmd);
-echo "<b>show calls</b><br />\n";
-echo "<pre style=\"font-size: 9pt;\">\n";
-echo $response;
-echo "</pre>\n";
+echo "<b>show calls</b>\n";
+if (strlen($response) > 40) {
+ echo "<textarea cols='85' rows='10' wrap='off'>\n";
+ echo $response;
+ echo "</textarea>\n";
+}
+else {
+ echo "<pre style=\"font-size: 9pt;\">\n";
+ echo $response;
+ echo "</pre>\n";
+}
fclose($fp);
echo "<br /><br />\n\n";
+echo "<br /><br />\n\n";
+
+
+echo "<table width='690' cellpadding='0' cellspacing='0' border='0'>\n";
+echo "<tr>\n";
+echo "<td width='50%'>\n";
+echo "<b>Call Detail Records</b><br />\n";
+echo "/usr/local/freeswitch/log/cdr-csv/Master.csv<br /><br />\n";
+echo "</td>\n";
+echo "<td width='50%' align='right'>\n";
+echo " <input type='button' value='download cdr csv' onclick=\"document.location.href='/freeswitch/freeswitch_status.php?a=download&t=cdrcsv';\" />\n";echo "</td>\n";
+echo "</tr>\n";
+echo "</table>\n";
+echo "<br /><br />\n\n";
+
+
+echo "<table width='690' cellpadding='0' cellspacing='0' border='0'>\n";
+echo "<tr>\n";
+echo "<td width='50%'>\n";
+echo "<b>Logs</b><br />\n";
+echo "/usr/local/freeswitch/log/cdr-csv/freeswitch.log<br /><br />\n";
+echo "</td>\n";
+echo "<td width='50%' align='right'>\n";
+echo " <input type='button' value='download logs' onclick=\"document.location.href='/freeswitch/freeswitch_status.php?a=download&t=logs';\" />\n";
+echo "</tr>\n";
+echo "</table>\n";
+echo "<br /><br />\n\n";
+
+
+echo "<b>tail -n 100 /usr/local/freeswitch/log/freeswitch.log</b><br />\n";
+echo "<textarea cols='85' rows='30' wrap='off'>\n";
+echo system("tail -n 100 /usr/local/freeswitch/log/freeswitch.log");
+echo "</textarea>\n";
+echo "<br /><br />\n\n";
+
+
+//$fp = event_socket_create($host, $port, $password);
+//$cmd = "api sofia ";
+//$response = event_socket_request($fp, $cmd);
+//echo "<b>api sofia</b><br />\n";
+//echo "<pre style=\"font-size: 9pt;\">\n";
+//echo $response;
+//echo "</pre>\n";
+//fclose($fp);
+//echo "<br /><br />\n\n";
?>
@@ -256,6 +268,6 @@ echo "<br /><br />\n\n";
</div>
<?php include("fend.inc"); ?>
-<meta http-equiv="refresh" content="60;url=<?php print $_SERVER['SCRIPT_NAME']; ?>">
+
</body>
-</html> \ No newline at end of file
+</html>