aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2010-11-29 16:55:05 -0500
committerjim-p <jimp@pfsense.org>2010-11-29 16:55:05 -0500
commite4fa141c82f135ae9d19a1006585642891924bf5 (patch)
treeb6d3e740d54b0c217859593c91cbd9a0c5c1466d
parente6a02e23c10bc38c08a1a7a654432af5a42de994 (diff)
downloadpfsense-packages-e4fa141c82f135ae9d19a1006585642891924bf5.tar.gz
pfsense-packages-e4fa141c82f135ae9d19a1006585642891924bf5.tar.bz2
pfsense-packages-e4fa141c82f135ae9d19a1006585642891924bf5.zip
Add page to view currently registered phones using siproxd.
-rw-r--r--config/siproxd.inc8
-rw-r--r--config/siproxd.xml10
-rw-r--r--config/siproxd_registered_phones.php163
-rw-r--r--config/siproxdusers.xml4
4 files changed, 182 insertions, 3 deletions
diff --git a/config/siproxd.inc b/config/siproxd.inc
index 0c5c1bb6..2a48137a 100644
--- a/config/siproxd.inc
+++ b/config/siproxd.inc
@@ -226,16 +226,18 @@ function sync_package_siproxd() {
write_rcfile(array(
"file" => "siproxd.sh",
"start" => "/usr/local/sbin/siproxd -c /usr/local/etc/siproxd.conf &",
- "stop" => "/usr/bin/killall siproxd"
+ "stop" => "/usr/bin/killall -9 siproxd"
)
);
- exec("killall siproxd");
+ exec("killall -9 siproxd");
- sleep(1);
+ sleep(3);
start_service("siproxd");
+ sleep(3);
+
filter_configure();
conf_mount_ro();
diff --git a/config/siproxd.xml b/config/siproxd.xml
index 1bf2d80a..bf9d493e 100644
--- a/config/siproxd.xml
+++ b/config/siproxd.xml
@@ -62,6 +62,10 @@
<text>Users</text>
<url>/pkg.php?xml=siproxdusers.xml</url>
</tab>
+ <tab>
+ <text>Registered Phones</text>
+ <url>/siproxd_registered_phones.php</url>
+ </tab>
</tabs>
<additional_files_needed>
<prefix>/usr/local/pkg/</prefix>
@@ -73,6 +77,11 @@
<chmod>077</chmod>
<item>http://www.pfsense.com/packages/config/siproxd.inc</item>
</additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/</prefix>
+ <chmod>077</chmod>
+ <item>http://www.pfsense.com/packages/config/siproxd_registered_phones.php</item>
+ </additional_files_needed>
<fields>
<field>
<fielddescr>Inbound interface</fielddescr>
@@ -293,3 +302,4 @@
validate_form_siproxd($_POST, &amp;$input_errors);
</custom_php_validation_command>
</packagegui>
+
diff --git a/config/siproxd_registered_phones.php b/config/siproxd_registered_phones.php
new file mode 100644
index 00000000..6ca9b0c0
--- /dev/null
+++ b/config/siproxd_registered_phones.php
@@ -0,0 +1,163 @@
+<?php
+/*
+ siproxd_registered_phones.php
+ Copyright (C) 2010 Jim Pingle
+ 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.
+*/
+/*
+ pfSense_MODULE: shell
+*/
+
+##|+PRIV
+##|*IDENT=page-status-siproxd
+##|*NAME=Status: siproxd registered phones
+##|*DESCR=Allow access to the 'Status: siproxd registered phones' page.
+##|*MATCH=siproxd_registered_phones.php*
+##|-PRIV
+
+$pgtitle = array(gettext("Status"), gettext("siproxd Registered Phones"));
+require("guiconfig.inc");
+
+$phonetext = file_get_contents("/var/siproxd/siproxd_registrations");
+$phonedata = explode("\n", $phonetext);
+
+if (!is_array($phonedata)) {
+ $phonedata = array();
+}
+
+$activephones = array();
+for ($i=0; $i < count($phonedata); $i++) {
+ list($stars, $active, $expires) = explode(":", $phonedata[$i]);
+ if ($active == "1") {
+ $phone = array();
+ $phone["expires"] = $expires;
+ $phone["real"]["type"] = $phonedata[++$i];
+ $phone["real"]["user"] = $phonedata[++$i];
+ $phone["real"]["host"] = $phonedata[++$i];
+ $phone["real"]["port"] = $phonedata[++$i];
+ $phone["nat"]["type"] = $phonedata[++$i];
+ $phone["nat"]["user"] = $phonedata[++$i];
+ $phone["nat"]["host"] = $phonedata[++$i];
+ $phone["nat"]["port"] = $phonedata[++$i];
+ $phone["registered"]["type"] = $phonedata[++$i];
+ $phone["registered"]["user"] = $phonedata[++$i];
+ $phone["registered"]["host"] = $phonedata[++$i];
+ $phone["registered"]["port"] = $phonedata[++$i];
+ $activephones[] = $phone;
+ }
+}
+
+require("head.inc");
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+
+<br />
+
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td>
+<?php
+ $tab_array = array();
+ $tab_array[] = array(gettext("Settings"), false, "pkg_edit.php?xml=siproxd.xml&amp;id=0");
+ $tab_array[] = array(gettext("Users"), false, "pkg.php?xml=siproxdusers.xml");
+ $tab_array[] = array(gettext("Registered Phones"), true, "siproxd_registered_phones.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0">
+ <thead>
+ <tr>
+ <td colspan="16" class="listtopic"><?php echo gettext("Currently Registered Phones") . " (" . count($activephones) . ")"; ?></td>
+ </tr>
+ <tr>
+ <th colspan="5">Real Phone</th>
+ <th colspan="5">NAT Address</th>
+ <th colspan="4">Registered With</th>
+ <th colspan="2">&nbsp;</th>
+ </tr>
+ <tr>
+ <th>Type</th>
+ <th>User</th>
+ <th>Host</th>
+ <th>Port</th>
+ <th>&nbsp;</th>
+ <th>Type</th>
+ <th>User</th>
+ <th>Host</th>
+ <th>Port</th>
+ <th>&nbsp;</th>
+ <th>Type</th>
+ <th>User</th>
+ <th>Host</th>
+ <th>Port</th>
+ <th>&nbsp;</th>
+ <th>Expires</th>
+ </tr>
+ </thead>
+ <?php if (count($phonedata) == 0): ?>
+ <tr><td colspan="16" align="center">No Phone Data Found</td></tr>
+ <? elseif (count($activephones) == 0): ?>
+ <tr><td colspan="16" align="center">No Active Phones</td></tr>
+ <? else: ?>
+ <? foreach ($activephones as $phone): ?>
+ <tr>
+ <td align="center" class="listlr"><? echo ($phone['real']['type']) ? $phone['real']['type'] : "sip"; ?></td>
+ <td align="center" class="listr"><? echo ($phone['real']['user']) ? $phone['real']['user'] : "&nbsp;"; ?></td>
+ <td align="center" class="listr"><? echo ($phone['real']['host']) ? $phone['real']['host'] : "&nbsp;"; ?></td>
+ <td align="center" class="listr"><? echo ($phone['real']['port']) ? $phone['real']['port'] : "5060"; ?></td>
+
+ <td align="center" class="list">&nbsp;</td>
+ <td align="center" class="listlr"><? echo ($phone['nat']['type']) ? $phone['nat']['type'] : "sip"; ?></td>
+ <td align="center" class="listr"><? echo ($phone['nat']['user']) ? $phone['nat']['user'] : "&nbsp;"; ?></td>
+ <td align="center" class="listr"><? echo ($phone['nat']['host']) ? $phone['nat']['host'] : "&nbsp;"; ?></td>
+ <td align="center" class="listr"><? echo ($phone['nat']['port']) ? $phone['nat']['port'] : "5060"; ?></td>
+
+ <td align="center" class="list">&nbsp;</td>
+ <td align="center" class="listlr"><? echo ($phone['registered']['type']) ? $phone['registered']['type'] : "sip"; ?></td>
+ <td align="center" class="listr"><? echo ($phone['registered']['user']) ? $phone['registered']['user'] : "&nbsp;"; ?></td>
+ <td align="center" class="listr"><? echo ($phone['registered']['host']) ? $phone['registered']['host'] : "&nbsp;"; ?></td>
+ <td align="center" class="listr"><? echo ($phone['registered']['port']) ? $phone['registered']['port'] : "5060"; ?></td>
+
+ <td align="center" class="list">&nbsp;</td>
+ <td align="center" class="listlr"><? echo date("m/d/Y h:i:sa", $phone['expires']); ?></td>
+ </tr>
+ <? endforeach; ?>
+ <? endif; ?>
+ </table>
+ </div>
+ </td>
+ </tr>
+
+</table>
+
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/config/siproxdusers.xml b/config/siproxdusers.xml
index a36e0554..4ed4abc7 100644
--- a/config/siproxdusers.xml
+++ b/config/siproxdusers.xml
@@ -59,6 +59,10 @@
<url>/pkg.php?xml=siproxdusers.xml</url>
<active/>
</tab>
+ <tab>
+ <text>Registered Phones</text>
+ <url>/siproxd_registered_phones.php</url>
+ </tab>
</tabs>
<configpath>installedpackages->package->$packagename->configuration->settings</configpath>
<adddeleteeditpagefields>