aboutsummaryrefslogtreecommitdiffstats
path: root/config/freeswitch_dev/v_status.tmp
diff options
context:
space:
mode:
authormcrane <mctch@yahoo.com>2009-07-28 07:07:15 -0600
committermcrane <mctch@yahoo.com>2009-07-28 07:07:15 -0600
commit7ccc368017533ea47ba728ad7a84215b149944ed (patch)
tree10136917f064664446f9452bf89610e8094804b3 /config/freeswitch_dev/v_status.tmp
parentf805de2a0fdc3e888f0144bfff6dab58f5e0b132 (diff)
downloadpfsense-packages-7ccc368017533ea47ba728ad7a84215b149944ed.tar.gz
pfsense-packages-7ccc368017533ea47ba728ad7a84215b149944ed.tar.bz2
pfsense-packages-7ccc368017533ea47ba728ad7a84215b149944ed.zip
FreeSWITCH package finish package file rename.
Diffstat (limited to 'config/freeswitch_dev/v_status.tmp')
-rw-r--r--config/freeswitch_dev/v_status.tmp336
1 files changed, 336 insertions, 0 deletions
diff --git a/config/freeswitch_dev/v_status.tmp b/config/freeswitch_dev/v_status.tmp
new file mode 100644
index 00000000..7c23c762
--- /dev/null
+++ b/config/freeswitch_dev/v_status.tmp
@@ -0,0 +1,336 @@
+<?php
+/* $Id$ */
+/*
+ v_status.php
+ Copyright (C) 2008 Mark J Crane
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+*/
+
+require("guiconfig.inc");
+require("/usr/local/pkg/v_config.inc");
+
+
+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';
+ }
+ if ($_GET['t'] == "backup") {
+ $tmp = '/root/backup/';
+ $filename = 'freeswitch.bak.tgz';
+ if (!is_dir('/root/backup/')) {
+ exec("mkdir /root/backup/");
+ }
+ system('cd /usr/local/;tar cvzf /root/backup/freeswitch.bak.tgz freeswitch');
+ }
+ 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;
+}
+
+if ($_GET['a'] == "other") {
+ if ($_GET['t'] == "restore") {
+ $tmp = '/root/backup/';
+ $filename = 'freeswitch.bak.tgz';
+
+ //extract a specific directory to /usr/local/freeswitch
+ if (file_exists('/root/backup/'.$filename)) {
+ //echo "The file $filename exists";
+
+ //Recommended
+ system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/db/');
+ system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/log/');
+ system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/recordings/');
+ system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/scripts/');
+ system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/storage/');
+ system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/sounds/custom/8000/');
+ system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/sounds/music/8000/');
+ system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/conf/ssl');
+ system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/conf/sip_profiles/');
+ system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/conf/vars.xml');
+ system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/conf/dialplan/default.xml');
+ system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/conf/dialplan/public.xml');
+
+ //Optional
+ //system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/conf/');
+ //system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/grammar/');
+ //system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/htdocs/');
+
+ header( 'Location: v_status.php?savemsg=Backup+has+been+restored.' ) ;
+ }
+ else {
+ header( 'Location: v_status.php?savemsg=Restore+failed.+Backup+file+not+found.' ) ;
+ }
+
+ exit;
+ }
+}
+
+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'];
+
+$savemsg = $_GET["savemsg"];
+
+//if service is not running then start it
+if (!pkg_is_service_running('freeswitch')) {
+ $handle = popen("/usr/local/etc/rc.d/freeswitch.sh start", "r");
+ pclose($handle);
+ //give freeswitch time to load
+ sleep(7);
+}
+?>
+
+<script language="Javascript" type="text/javascript" src="/edit_area/edit_area_full.js"></script>
+<script language="Javascript" type="text/javascript">
+ // initialisation
+ editAreaLoader.init({
+ id: "log" // id of the textarea to transform
+ ,start_highlight: false
+ ,allow_toggle: true
+ ,display: "later"
+ ,language: "en"
+ ,syntax: "html"
+ ,toolbar: "search, go_to_line,|, fullscreen, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help"
+ ,syntax_selection_allow: "css,html,js,php,xml,c,cpp,sql"
+ ,show_line_colors: true
+ });
+</script>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+
+<?php
+include("fbegin.inc");
+echo "<p class=\"pgtitle\">$v_project_label: Status</p>\n";
+
+
+if ($savemsg) {
+ print_info_box($savemsg);
+}
+?>
+
+<div id="mainlevel">
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+<tr><td class="tabnavtbl">
+<?php
+
+display_top_tabs(build_menu());
+
+?>
+</td></tr>
+</table>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabcont" >
+
+<?php
+
+echo "<br /><br />\n\n";
+
+
+$fp = event_socket_create($host, $port, $password);
+$cmd = "api sofia status";
+$response = event_socket_request($fp, $cmd);
+echo "<table width='690' cellpadding='0' cellspacing='0' border='0'>\n";
+echo "<tr>\n";
+echo "<td width='50%'>\n";
+echo " <b>sofia status</b> \n";
+echo "</td>\n";
+echo "<td width='50%' align='right'>\n";
+echo " <input type='button' value='reloadxml' onclick=\"document.location.href='/packages/freeswitch/v_cmd.php?cmd=api+reloadxml';\" />\n";
+echo "</td>\n";
+echo "</tr>\n";
+echo "</table>\n";
+echo "<pre style=\"font-size: 9pt;\">\n";
+echo $response;
+echo "</pre>\n";
+fclose($fp);
+echo "<br /><br />\n\n";
+
+foreach (ListFiles('/usr/local/freeswitch/conf/sip_profiles') as $key=>$sip_profile_file){
+
+ $sip_profile_name = str_replace(".xml", "", $sip_profile_file);
+ $fp = event_socket_create($host, $port, $password);
+ $cmd = "api sofia status profile ".$sip_profile_name;
+ $response = event_socket_request($fp, $cmd);
+ echo "<table width='690' cellpadding='0' cellspacing='0' border='0'>\n";
+ echo "<tr>\n";
+ echo "<td width='50%'>\n";
+ echo " <b>sofia status profile $sip_profile_name</b> \n";
+ echo "</td>\n";
+ echo "<td width='50%' align='right'>\n";
+ echo " <input type='button' value='start' onclick=\"document.location.href='/packages/freeswitch/v_cmd.php?cmd=api+sofia+profile+".$sip_profile_name."+start';\" />\n";
+ echo " <input type='button' value='stop' onclick=\"document.location.href='/packages/freeswitch/v_cmd.php?cmd=api+sofia+profile+".$sip_profile_name."+stop';\" />\n";
+ echo " <input type='button' value='restart' onclick=\"document.location.href='/packages/freeswitch/v_cmd.php?cmd=api+sofia+profile+".$sip_profile_name."+restart';\" />\n";
+ if ($sip_profile_name == "external") {
+ echo " <input type='button' value='rescan' onclick=\"document.location.href='/packages/freeswitch/v_cmd.php?cmd=api+sofia+profile+".$sip_profile_name."+rescan';\" />\n";
+ }
+ else {
+ echo " <input type='button' value='flush_inbound_reg' onclick=\"document.location.href='/packages/freeswitch/v_cmd.php?cmd=api+sofia+profile+".$sip_profile_name."+flush_inbound_reg';\" />\n";
+ }
+ echo "</td>\n";
+ echo "</tr>\n";
+ echo "</table>\n";
+ echo "<pre style=\"font-size: 9pt;\">\n";
+ echo $response;
+ 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);
+echo "<b>status</b><br />\n";
+echo "<pre style=\"font-size: 9pt;\">\n";
+echo $response;
+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";
+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";
+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='80%'>\n";
+echo "<b>Backup / Restore</b><br />\n";
+echo "The 'backup' button will tar gzip /usr/local/freeswitch/ to /root/backup/freeswitch.bak.tgz it then presents a file to download. \n";
+echo "If the backup file does not exist in /root/backup/freeswitch.bak.tgz then the 'restore' button will be hidden. \n";
+echo "Use Diagnostics->Command->File to upload: to browse to the file and then click on upload it now ready to be restored. \n";
+echo "<br /><br />\n";
+echo "</td>\n";
+echo "<td width='20%' valign='middle' align='right'>\n";
+echo " <input type='button' value='backup' onclick=\"document.location.href='/packages/freeswitch/v_status.php?a=download&t=backup';\" />\n";
+if (file_exists('/root/backup/freeswitch.bak.tgz')) {
+ echo " <input type='button' value='restore' onclick=\"document.location.href='/packages/freeswitch/v_status.php?a=other&t=restore';\" />\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>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='/packages/freeswitch/v_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='/packages/freeswitch/v_status.php?a=download&t=logs';\" />\n";
+echo "</tr>\n";
+echo "</table>\n";
+echo "<br /><br />\n\n";
+
+
+echo "<b>tail -n 500 /usr/local/freeswitch/log/freeswitch.log</b><br />\n";
+echo "<textarea id='log' name='log' cols='93' rows='30' wrap='off'>\n";
+echo system("tail -n 500 /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";
+
+?>
+
+ </td>
+ </tr>
+</table>
+
+</div>
+<?php include("fend.inc"); ?>
+
+</body>
+</html>