diff options
author | Renato Botelho <garga@FreeBSD.org> | 2015-02-05 10:02:24 -0200 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2015-02-05 20:10:15 -0200 |
commit | 07cf2c4b20230ddedee1bf9dddc1e7cd407385f5 (patch) | |
tree | 44d40561519e0018ad586bb1449e107c9ae431f3 /config/siproxd | |
parent | e526e4aa28867b7743b0e76993f5f6bebd15bc1b (diff) | |
download | pfsense-packages-07cf2c4b20230ddedee1bf9dddc1e7cd407385f5.tar.gz pfsense-packages-07cf2c4b20230ddedee1bf9dddc1e7cd407385f5.tar.bz2 pfsense-packages-07cf2c4b20230ddedee1bf9dddc1e7cd407385f5.zip |
Packages repo cleanup:
- Drop support for pfSense < 2
- Remove archive/, old files can be reached using git
- Remove old and unused packages
- Move stale files from config subdir to a package subdir
Diffstat (limited to 'config/siproxd')
-rw-r--r-- | config/siproxd/siproxd.inc | 310 | ||||
-rw-r--r-- | config/siproxd/siproxd.xml | 344 | ||||
-rw-r--r-- | config/siproxd/siproxd_registered_phones.php | 163 | ||||
-rw-r--r-- | config/siproxd/siproxdusers.xml | 104 |
4 files changed, 921 insertions, 0 deletions
diff --git a/config/siproxd/siproxd.inc b/config/siproxd/siproxd.inc new file mode 100644 index 00000000..d76f79d3 --- /dev/null +++ b/config/siproxd/siproxd.inc @@ -0,0 +1,310 @@ +<?php +/* + siproxd.inc + Copyright (C) 2006 Scott Ullrich + 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. +*/ + +if(!function_exists("filter_configure")) + require_once("filter.inc"); +require_once("service-utils.inc"); + +// Check to find out on which system the package is running +if (substr(trim(file_get_contents("/etc/version")),0,3) == "2.0") { + define('SIPROXD', '/usr/local'); +} else { + define('SIPROXD', '/usr/pbi/siproxd-' . php_uname("m")); +} +// End of system check + +function sync_package_sipproxd_users() { + conf_mount_rw(); + + // put the constant to a variable + $varSIPROXD = SIPROXD; + + global $config; + $fout = fopen("$varSIPROXD/etc/siproxd_passwd.cfg","w"); + fwrite($fout, "# This file was automatically generated by the pfSense\n# package management system.\n\n"); + if($config['installedpackages']['siproxdusers']['config'] != "") { + foreach($config['installedpackages']['siproxdusers']['config'] as $rowhelper) { + fwrite($fout, $rowhelper['username'] . " " . $rowhelper['password'] . "\n"); + } + } + fclose($fout); + conf_mount_ro(); + system("/usr/bin/killall -HUP siproxd"); +} + +function siproxd_generate_rules($type) { + global $config; + + // put the constant to a variable + $varSIPROXD = SIPROXD; + + $siproxd_conf = &$config['installedpackages']['siproxdsettings']['config'][0]; + if (!is_service_running('siproxd')) { + log_error("Sipproxd is installed but not started. Not installing redirect rules."); + return; + } + + /* proxy is turned off in package settings */ + if($siproxd_conf['sipenable'] == "0") { + log_error("WARNING: siproxd proxy has not been enabled. Not installing rules."); + return "\n"; + } + + $ifaces = explode(",", $siproxd_conf['if_inbound']); + $ifaces = array_map('convert_friendly_interface_to_real_interface_name', $ifaces); + $rtplower = ($siproxd_conf['rtplower'] ? $siproxd_conf['rtplower'] : 7070); + $rtpupper = ($siproxd_conf['rtpupper'] ? $siproxd_conf['rtpupper'] : 7079); + $port = ($siproxd_conf['proxy_port'] ? $siproxd_conf['proxy_port'] : 5060); + + switch($type) { + case 'nat': + $rules .= "\n# Setup Sipproxd proxy redirect\n"; + foreach ($ifaces as $iface) { + if($iface <> "") + $rules .= "rdr on {$iface} proto udp from any to !($iface) port {$port} -> 127.0.0.1 port {$port}\n"; + } + break; + case 'filter': + case 'rule': + foreach ($ifaces as $iface) { + if($iface <> "") { + $rules .= "# allow SIP signaling and RTP traffic\n"; + $rules .= "pass in on {$iface} proto udp from any to any port = {$port}\n"; + if($siproxd_conf['rtpenable'] == "1") { + $rules .= "pass in on {$iface} proto udp from any to any port {$rtplower}:{$rtpupper}\n"; + } + } + } + break; + } + + return $rules; +} + +function sync_package_siproxd() { + global $config; + + // put the constant to a variable + $varSIPROXD = SIPROXD; + + conf_mount_rw(); + + $siproxd_chroot = "/var/siproxd/"; + @mkdir($siproxd_chroot); + @chown($siproxd_chroot, "nobody"); + @chgrp($siproxd_chroot, "nobody"); + + unlink_if_exists("$varSIPROXD/etc/rc.d/siproxd"); + $siproxd_conf = &$config['installedpackages']['siproxdsettings']['config'][0]; + $fout = fopen("$varSIPROXD/etc/siproxd.conf","w"); + + fwrite($fout, "# This file was automatically generated by the pfSense\n"); + fwrite($fout, "# package management system.\n\n"); + + /* proxy is turned off in package settings */ + if($siproxd_conf['sipenable'] == "0") { + fclose($fout); + return; + } + + if($siproxd_conf['if_inbound'] != "") { + fwrite($fout, "if_inbound = " . convert_friendly_interface_to_real_interface_name($siproxd_conf['if_inbound']) . "\n"); + } + + if($siproxd_conf['if_outbound'] != "") { + if(intval($config['version']) < 6 && $config['interfaces'][$siproxd_conf['if_outbound']]['ipaddr'] == "pppoe") { + fwrite($fout, "if_outbound = ng0\n"); + } else { + fwrite($fout, "if_outbound = " . convert_friendly_interface_to_real_interface_name($siproxd_conf['if_outbound']) . "\n"); + } + } + + if($siproxd_conf['port'] != "") { + fwrite($fout, "sip_listen_port = " . $siproxd_conf['port'] . "\n"); + } else { + fwrite($fout, "sip_listen_port = 5060\n"); + } + + fwrite($fout, "daemonize = 1\n"); + fwrite($fout, "silence_log = 0\n"); + //fwrite($fout, "log_calls = 1\n"); + fwrite($fout, "user = nobody\n"); + fwrite($fout, "chrootjail = {$siproxd_chroot}\n"); + fwrite($fout, "registration_file = siproxd_registrations\n"); + fwrite($fout, "autosave_registrations = 10\n"); + fwrite($fout, "pid_file = siproxd.pid\n"); + + if($siproxd_conf['rtpenable'] != "") { + fwrite($fout, "rtp_proxy_enable = " . $siproxd_conf['rtpenable'] . "\n"); + } else { + fwrite($fout, "rtp_proxy_enable = 1\n"); + } + + if(($siproxd_conf['rtplower'] != "") && ($siproxd_conf['rtpupper'] != "")) { + fwrite($fout, "rtp_port_low = " . $siproxd_conf['rtplower'] . "\n"); + fwrite($fout, "rtp_port_high = " . $siproxd_conf['rtpupper'] . "\n"); + } else { + fwrite($fout, "rtp_port_low = 7070\n"); + fwrite($fout, "rtp_port_high = 7079\n"); + } + + if($siproxd_conf['rtptimeout'] != "") { + fwrite($fout, "rtp_timeout = " . $siproxd_conf['rtptimeout'] . "\n"); + } else { + fwrite($fout, "rtp_timeout = 300\n"); + } + + if($siproxd_conf['defaulttimeout'] != "") { + fwrite($fout, "default_expires = " . $siproxd_conf['defaulttimeout'] . "\n"); + } else { + fwrite($fout, "default_expires = 600\n"); + } + + if($siproxd_conf['authentication']) { + fwrite($fout, "proxy_auth_realm = Authentication_Realm\n"); + fwrite($fout, "proxy_auth_pwfile = $varSIPROXD/etc/siproxd_passwd.cfg\n"); + } + + if($siproxd_conf['debug_level'] != "") { + fwrite($fout, "debug_level = " . $siproxd_conf['debug_level'] . "\n"); + } else { + fwrite($fout, "debug_level = 0x00000000\n"); + } + + if($siproxd_conf['debug_port'] != "") { + fwrite($fout, "debug_port = " . $siproxd_conf['debug_port'] . "\n"); + } + + if($siproxd_conf['outboundproxyhost'] != "") { + if($siproxd_conf['outboundproxyport'] != "") { + fwrite($fout, "outbound_proxy_host = " . $siproxd_conf['outboundproxyhost'] . "\n"); + fwrite($fout, "outbound_proxy_port = " . $siproxd_conf['outboundproxyport'] . "\n"); + } + } + + if($siproxd_conf['expeditedforwarding'] != "") + fwrite($fout, "rtp_dscp = 46\n"); + if($siproxd_conf['expeditedsipforwarding'] != "") + fwrite($fout, "sip_dscp = 26\n"); + + if ($siproxd_conf['rtp_input_dejitter'] != "") + fwrite($fout, "rtp_input_dejitter = " . $siproxd_conf['rtp_input_dejitter'] . "\n"); + if ($siproxd_conf['rtp_output_dejitter'] != "") + fwrite($fout, "rtp_output_dejitter = " . $siproxd_conf['rtp_output_dejitter'] . "\n"); + if ($siproxd_conf['tcp_timeout'] != "") + fwrite($fout, "tcp_timeout = " . $siproxd_conf['tcp_timeout'] . "\n"); + if ($siproxd_conf['tcp_connect_timeout'] != "") + fwrite($fout, "tcp_connect_timeout = " . $siproxd_conf['tcp_connect_timeout'] . "\n"); + if ($siproxd_conf['tcp_keepalive'] != "") + fwrite($fout, "tcp_keepalive = " . $siproxd_conf['tcp_keepalive'] . "\n"); + + fwrite($fout, "plugindir=$varSIPROXD/lib/siproxd/\n"); + fwrite($fout, "load_plugin=plugin_logcall.la\n"); + + if ($siproxd_conf['plugin_defaulttarget'] != "") + fwrite($fout, "load_plugin=plugin_defaulttarget.la\n"); + if (($siproxd_conf['plugin_defaulttarget'] != "") && ($siproxd_conf['plugin_defaulttarget_log'] != "")) + fwrite($fout, "plugin_defaulttarget_log = 1\n"); + if (($siproxd_conf['plugin_defaulttarget'] != "") && ($siproxd_conf['plugin_defaulttarget_target'] != "")) + fwrite($fout, "plugin_defaulttarget_target = " . $siproxd_conf['plugin_defaulttarget_target'] . "\n"); + + if ($siproxd_conf['plugin_fix_bogus_via'] != "") + fwrite($fout, "load_plugin=plugin_fix_bogus_via.la\n"); + if (($siproxd_conf['plugin_fix_bogus_via'] != "") && ($siproxd_conf['plugin_fix_bogus_via_networks'] != "")) + fwrite($fout, "plugin_fix_bogus_via_networks = " . $siproxd_conf['plugin_fix_bogus_via_networks'] . "\n"); + + if ($siproxd_conf['plugin_stun'] != "") + fwrite($fout, "load_plugin=plugin_stun.la\n"); + if (($siproxd_conf['plugin_stun'] != "") && ($siproxd_conf['plugin_stun_server'] != "")) + fwrite($fout, "plugin_stun_server = " . $siproxd_conf['plugin_stun_server'] . "\n"); + if (($siproxd_conf['plugin_stun'] != "") && ($siproxd_conf['plugin_stun_port'] != "")) + fwrite($fout, "plugin_stun_port = " . $siproxd_conf['plugin_stun_port'] . "\n"); + if (($siproxd_conf['plugin_stun'] != "") && ($siproxd_conf['plugin_stun_period'] != "")) + fwrite($fout, "plugin_stun_period = " . $siproxd_conf['plugin_stun_period'] . "\n"); + + fclose($fout); + + write_rcfile(array( + "file" => "siproxd.sh", + "start" => "$varSIPROXD/sbin/siproxd -c $varSIPROXD/etc/siproxd.conf &", + "stop" => "/usr/bin/killall -9 siproxd" + ) + ); + + exec("killall -9 siproxd"); + + sleep(3); + + start_service("siproxd"); + + sleep(3); + + filter_configure(); + + conf_mount_ro(); + +} + +function validate_form_siproxd($post, &$input_errors) { + if ($post['port'] && !is_port($post['port'])) + $input_errors[] = 'Invalid port entered for "Listening Port"'; + if ($post['rtplower'] && !is_port($post['rtplower'])) + $input_errors[] = 'Invalid port entered for "RTP port range (lower)".'; + if ($post['rtpupper'] && !is_port($post['rtpupper'])) + $input_errors[] = 'Invalid port entered for "RTP port range (upper)".'; + if ($post['rtplower'] && $post['rtpupper'] && ($post['rtplower'] >= $post['rtpupper'])) + $input_errors[] = 'RTP lower port cannot be equal to or higher than the RTP upper port.'; + if ($post['rtptimeout'] && (!is_numeric($post['rtptimeout']) || ($post['rtptimeout'] < 0))) + $input_errors[] = '"RTP stream timeout" must be numeric and greater than 0.'; + if ($post['defaulttimeout'] && (!is_numeric($post['defaulttimeout']) || ($post['defaulttimeout'] < 0))) + $input_errors[] = '"Default expiration timeout" must be numeric and greater than 0.'; + if ($post['outboundproxyhost'] && (!is_hostname($post['outboundproxyhost']) && !is_ipaddr($post['outboundproxyhost']))) + $input_errors[] = 'Invalid hostname or IP address entered for "Outbound Proxy Host".'; + if ($post['outboundproxyport'] && !is_port($post['outboundproxyport'])) + $input_errors[] = 'Invalid port entered for "Outbound Proxy Port".'; + if ($post['rtp_input_dejitter'] && (!is_numeric($post['rtp_input_dejitter']) || ($post['rtp_input_dejitter'] < 0))) + $input_errors[] = '"Input Dejitter" must be numeric and greater than 0.'; + if ($post['rtp_output_dejitter'] && (!is_numeric($post['rtp_output_dejitter']) || ($post['rtp_output_dejitter'] < 0))) + $input_errors[] = '"Output Dejitter" must be numeric and greater than 0.'; + if ($post['tcp_timeout'] && (!is_numeric($post['tcp_timeout']) || ($post['tcp_timeout'] < 0))) + $input_errors[] = '"TCP inactivity timeout" must be numeric and greater than 0.'; + if ($post['tcp_connect_timeout'] && (!is_numeric($post['tcp_connect_timeout']) || ($post['tcp_connect_timeout'] < 0))) + $input_errors[] = '"TCP Connect Timeout" must be numeric and greater than 0.'; + if ($post['tcp_keepalive'] && (!is_numeric($post['tcp_keepalive']) || ($post['tcp_keepalive'] < 0))) + $input_errors[] = '"TCP Keepalive" must be numeric and greater than 0.'; + if ($post['plugin_stun_server'] && (!is_hostname($post['plugin_stun_server']) && !is_ipaddr($post['plugin_stun_server']))) + $input_errors[] = 'Invalid hostname or IP address entered for "STUN Server".'; + if ($post['plugin_stun_port'] && !is_port($post['plugin_stun_port'])) + $input_errors[] = 'Invalid port entered for "STUN Port".'; + if ($post['plugin_stun_period'] && (!is_numeric($post['plugin_stun_period']) || ($post['plugin_stun_period'] < 0))) + $input_errors[] = '"STUN Period" must be numeric and greater than 0.'; + +} + +?> diff --git a/config/siproxd/siproxd.xml b/config/siproxd/siproxd.xml new file mode 100644 index 00000000..8b1b5856 --- /dev/null +++ b/config/siproxd/siproxd.xml @@ -0,0 +1,344 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE packagegui SYSTEM "./schema/packages.dtd"> +<?xml-stylesheet type="text/xsl" href="./xsl/package.xsl"?> +<packagegui> + <copyright> + <![CDATA[ +/* + siproxd.xml + Copyright (C) 2006 Scott Ullrich + 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. +*/ + ]]> + </copyright> + <description>Describe your package here</description> + <requirements>Describe your package requirements here</requirements> + <faq>Currently there are no FAQ items provided.</faq> + <name>siproxdsettings</name> + <version>0.8.0_2 pkg v1.0.2</version> + <title>siproxd: Settings</title> + <include_file>/usr/local/pkg/siproxd.inc</include_file> + <aftersaveredirect>/pkg_edit.php?xml=siproxd.xml&id=0</aftersaveredirect> + <menu> + <name>siproxd</name> + <tooltiptext>Modify siproxd users and settings.</tooltiptext> + <section>Services</section> + <url>/pkg_edit.php?xml=siproxd.xml&id=0</url> + </menu> + <service> + <name>siproxd</name> + <rcfile>siproxd.sh</rcfile> + <executable>siproxd</executable> + </service> + <tabs> + <tab> + <text>Settings</text> + <url>/pkg_edit.php?xml=siproxd.xml&id=0</url> + <active/> + </tab> + <tab> + <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> + <chmod>077</chmod> + <item>https://packages.pfsense.org/packages/config/siproxd/siproxdusers.xml</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>077</chmod> + <item>https://packages.pfsense.org/packages/config/siproxd/siproxd.inc</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/www/</prefix> + <chmod>077</chmod> + <item>https://packages.pfsense.org/packages/config/siproxd/siproxd_registered_phones.php</item> + </additional_files_needed> + <fields> + <field> + <fielddescr>Enable siproxd</fielddescr> + <fieldname>sipenable</fieldname> + <description>Enable or disable siproxd</description> + <type>checkbox</type> + </field> + <field> + <fielddescr>Inbound interface</fielddescr> + <fieldname>if_inbound</fieldname> + <description>Select the inbound interface.</description> + <type>interfaces_selection</type> + </field> + <field> + <fielddescr>Outbound interface</fielddescr> + <fieldname>if_outbound</fieldname> + <description>Select the outbound interface.</description> + <type>interfaces_selection</type> + </field> + <field> + <fielddescr>Listening port</fielddescr> + <fieldname>port</fieldname> + <description>Enter the port on which to listen for SIP traffic (default 5060). Do not change this unless you know what you're doing.</description> + <type>input</type> + </field> + <field> + <fielddescr>Default expiration timeout</fielddescr> + <fieldname>defaulttimeout</fieldname> + <description>If a REGISTER request dose not contain an Expires header or expires= parameter, this number of seconds will be used and reported back to the UA in the answer.</description> + <type>input</type> + </field> + <field> + <name>RTP Settings</name> + <type>listtopic</type> + </field> + <field> + <fielddescr>Enable RTP proxy</fielddescr> + <fieldname>rtpenable</fieldname> + <description>Enable or disable the RTP proxy. (default is enabled)</description> + <type>select</type> + <options> + <option> + <name>Enable</name> + <value>1</value> + </option> + <option> + <name>Disable</name> + <value>0</value> + </option> + </options> + </field> + <field> + <fielddescr>RTP port range (lower)</fielddescr> + <fieldname>rtplower</fieldname> + <description>Enter the bottom edge of the port range siproxd will allocate for incoming RTP traffic. This range must be one not blocked by the firewall (default 7070).</description> + <type>input</type> + </field> + <field> + <fielddescr>RTP port range (upper)</fielddescr> + <fieldname>rtpupper</fieldname> + <description>Enter the top edge of the port range siproxd will allocate for incoming RTP traffic. This range must be one not blocked by the firewall (default 7079).</description> + <type>input</type> + </field> + <field> + <fielddescr>RTP stream timeout</fielddescr> + <fieldname>rtptimeout</fieldname> + <description>After this number of seconds, an RTP stream is considered dead and proxying it will be stopped (default 300sec).</description> + <type>input</type> + </field> + <field> + <name>Dejittering Settings</name> + <type>listtopic</type> + </field> + <field> + <fielddescr>Input Dejitter</fielddescr> + <fieldname>rtp_input_dejitter</fieldname> + <description>Artificial delay to be used to de-jitter RTP data streams. This time is in microseconds. 0 - completely disable dejitter (default)</description> + <type>input</type> + </field> + <field> + <fielddescr>Output Dejitter</fielddescr> + <fieldname>rtp_output_dejitter</fieldname> + <description>Artificial delay to be used to de-jitter RTP data streams. This time is in microseconds. 0 - completely disable dejitter (default)</description> + <type>input</type> + </field> + <field> + <name>SIP over TCP Settings</name> + <type>listtopic</type> + </field> + <field> + <fielddescr>TCP inactivity timeout</fielddescr> + <fieldname>tcp_timeout</fieldname> + <description>Inactivity timeout (seconds). After that an idling TCP connection is disconnected. NOTE: Making this too short may cause multiple parallel registrations for the same phone. This timeout must be set larger than the used registration interval.</description> + <type>input</type> + </field> + <field> + <fielddescr>TCP Connect Timeout</fielddescr> + <fieldname>tcp_connect_timeout</fieldname> + <description>Defines How many msecs siproxd will wait for an successful connect when establishing an outgoing SIP signalling connection. This should be kept as short as possible as waiting for an TCP connection to establish is a BLOCKING operation - while waiting for a connect to succeed no SIP messages are processed (RTP is not affected).</description> + <type>input</type> + </field> + <field> + <fielddescr>TCP Keepalive</fielddescr> + <fieldname>tcp_keepalive</fieldname> + <description>For TCP SIP signalling, if > 0 empty SIP packets will be sent every 'n' seconds to keep the connection alive. Default is off.</description> + <type>input</type> + </field> + <field> + <name>Proxy Settings</name> + <type>listtopic</type> + </field> + <field> + <fielddescr>Enable proxy authentication</fielddescr> + <fieldname>authentication</fieldname> + <description>If this is checked, clients will be forced to authenticate themselves at the proxy (for registration only).</description> + <type>checkbox</type> + </field> + <field> + <fielddescr>Outbound proxy hostname</fielddescr> + <fieldname>outboundproxyhost</fieldname> + <description>Enter the hostname of an outbound proxy to send all traffic to. This is only useful if you have multiple masquerading firewalls to cross.</description> + <type>input</type> + </field> + <field> + <fielddescr>Outbound proxy port</fielddescr> + <fieldname>outboundproxyport</fieldname> + <description>Enter the port of the outbound proxy to send all traffic to. This is only useful if you have multiple masquerading firewalls to cross.</description> + <type>input</type> + </field> + <field> + <name>DSCP Settings</name> + <type>listtopic</type> + </field> + <field> + <fielddescr>Expedited RTP Forwarding</fielddescr> + <fieldname>expeditedforwarding</fieldname> + <description>This service is designed to allow ISPs to offer a service with attributes similar to a "leased line". This service offers the ULTIMATE IN LOW LOSS, LOW LATENCY AND LOW JITTER by ensuring that there is always sufficient room in output queues for the contracted expedited forwarding traffic. + </description> + <type>checkbox</type> + </field> + <field> + <fielddescr>Expedited SIP Forwarding</fielddescr> + <fieldname>expeditedsipforwarding</fieldname> + <description>This service is designed to allow ISPs to offer a service with attributes similar to a "leased line". This service offers the ULTIMATE IN LOW LOSS, LOW LATENCY AND LOW JITTER by ensuring that there is always sufficient room in output queues for the contracted expedited forwarding traffic.</description> + <type>checkbox</type> + </field> + <field> + <name>Plugin Settings - Default Target</name> + <type>listtopic</type> + </field> + <field> + <fielddescr>Enable Default Target Plugin</fielddescr> + <fieldname>plugin_defaulttarget</fieldname> + <description>Redirect unknown calls to a specified target.</description> + <type>checkbox</type> + </field> + <field> + <fielddescr>Log redirected calls</fielddescr> + <fieldname>plugin_defaulttarget_log</fieldname> + <description>Log redirected calls.</description> + <type>checkbox</type> + </field> + <field> + <fielddescr>Default Target</fielddescr> + <fieldname>plugin_defaulttarget_target</fieldname> + <description>Target must be a full SIP URI with the syntax sip:user@host[:port]</description> + <type>input</type> + </field> + <field> + <name>Plugin Settings - Bogus VIA Networks</name> + <type>listtopic</type> + </field> + <field> + <fielddescr>Enable Fix Bogus Via Networks Plugin</fielddescr> + <fieldname>plugin_fix_bogus_via</fieldname> + <description>Incoming (from public network) SIP messages are checked for broken SIP Via headers. If the IP address in the latest Via Header is part of the list below, it will be replaced by the IP where the SIP message has been received from.</description> + <type>checkbox</type> + </field> + <field> + <fielddescr>Bogus Via Networks</fielddescr> + <fieldname>plugin_fix_bogus_via_networks</fieldname> + <description>Comma separated list of networks which should have their via headers rewritten. Example: 10.0.0.0/8,172.16.0.0/12,192.168.0.0/16</description> + <type>input</type> + </field> + <field> + <name>Plugin Settings - STUN</name> + <type>listtopic</type> + </field> + <field> + <fielddescr>Enable STUN Plugin</fielddescr> + <fieldname>plugin_stun</fieldname> + <description>Uses an external STUN server to determine the public IP address of siproxd. Useful for "in-front-of-NAT-router" scenarios.</description> + <type>checkbox</type> + </field> + <field> + <fielddescr>STUN Hostname</fielddescr> + <fieldname>plugin_stun_server</fieldname> + <description>External STUN server hostname.</description> + <type>input</type> + </field> + <field> + <fielddescr>STUN Port</fielddescr> + <fieldname>plugin_stun_port</fieldname> + <description>External STUN server port.</description> + <type>input</type> + </field> + <field> + <fielddescr>STUN Period</fielddescr> + <fieldname>plugin_stun_period</fieldname> + <description>Period in seconds to request IP info from STUN server.</description> + <type>input</type> + </field> + <field> + <name>Debug Options</name> + <type>listtopic</type> + </field> + <field> + <fielddescr>Debug Level</fielddescr> + <fieldname>debug_level</fieldname> + <type>select</type> + <size>1</size> + <options> + <option><value>0x00000000</value><name>No Debug Info</name></option> + <option><value>0x00000001</value><name>babble (like entering/leaving func)</name></option> + <option><value>0x00000002</value><name>network</name></option> + <option><value>0x00000004</value><name>SIP manipulations</name></option> + <option><value>0x00000008</value><name>Client registration</name></option> + <option><value>0x00000010</value><name>non specified class</name></option> + <option><value>0x00000020</value><name>proxy</name></option> + <option><value>0x00000040</value><name>DNS stuff</name></option> + <option><value>0x00000080</value><name>network traffic</name></option> + <option><value>0x00000100</value><name>configuration</name></option> + <option><value>0x00000200</value><name>RTP proxy</name></option> + <option><value>0x00000400</value><name>Access list evaluation</name></option> + <option><value>0x00000800</value><name>Authentication</name></option> + <option><value>0x00001000</value><name>Plugins</name></option> + <option><value>0x00002000</value><name>RTP babble</name></option> + <option><value>-1</value><name>Everything</name></option> + </options> + </field> + <field> + <fielddescr>TCP Debug Port</fielddescr> + <fieldname>debug_port</fieldname> + <description>You may connect to this port from a remote machine and receive debug output. This allows better creation of debug output on embedded systems that do not have enough memory for large disk files. Port number 0 means this feature is disabled.</description> + <type>input</type> + </field> + </fields> + <custom_php_global_functions> + </custom_php_global_functions> + <custom_add_php_command> + sync_package_siproxd(); + </custom_add_php_command> + <custom_php_resync_config_command> + sync_package_siproxd(); + </custom_php_resync_config_command> + <filter_rules_needed>siproxd_generate_rules</filter_rules_needed> + <custom_php_validation_command> + validate_form_siproxd($_POST, $input_errors); + </custom_php_validation_command> +</packagegui> diff --git a/config/siproxd/siproxd_registered_phones.php b/config/siproxd/siproxd_registered_phones.php new file mode 100644 index 00000000..a8789d7f --- /dev/null +++ b/config/siproxd/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 + +require("guiconfig.inc"); +$pgtitle = array(gettext("Status"), gettext("siproxd Registered Phones")); + +$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&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"> </th> + </tr> + <tr> + <th>Type</th> + <th>User</th> + <th>Host</th> + <th>Port</th> + <th> </th> + <th>Type</th> + <th>User</th> + <th>Host</th> + <th>Port</th> + <th> </th> + <th>Type</th> + <th>User</th> + <th>Host</th> + <th>Port</th> + <th> </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'] : " "; ?></td> + <td align="center" class="listr"><? echo ($phone['real']['host']) ? $phone['real']['host'] : " "; ?></td> + <td align="center" class="listr"><? echo ($phone['real']['port']) ? $phone['real']['port'] : "5060"; ?></td> + + <td align="center" class="list"> </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'] : " "; ?></td> + <td align="center" class="listr"><? echo ($phone['nat']['host']) ? $phone['nat']['host'] : " "; ?></td> + <td align="center" class="listr"><? echo ($phone['nat']['port']) ? $phone['nat']['port'] : "5060"; ?></td> + + <td align="center" class="list"> </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'] : " "; ?></td> + <td align="center" class="listr"><? echo ($phone['registered']['host']) ? $phone['registered']['host'] : " "; ?></td> + <td align="center" class="listr"><? echo ($phone['registered']['port']) ? $phone['registered']['port'] : "5060"; ?></td> + + <td align="center" class="list"> </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/siproxd/siproxdusers.xml b/config/siproxd/siproxdusers.xml new file mode 100644 index 00000000..4ed4abc7 --- /dev/null +++ b/config/siproxd/siproxdusers.xml @@ -0,0 +1,104 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE packagegui SYSTEM "./schema/packages.dtd"> +<?xml-stylesheet type="text/xsl" href="./xsl/package.xsl"?> +<packagegui> + <copyright> + <![CDATA[ +/* $Id$ */ +/* ========================================================================== */ +/* + authng.xml + part of pfSense (http://www.pfSense.com) + Copyright (C) 2007 to whom it may belong + All rights reserved. + + Based on m0n0wall (http://m0n0.ch/wall) + Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. + 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. + */ +/* ========================================================================== */ + ]]> + </copyright> + <description>Describe your package here</description> + <requirements>Describe your package requirements here</requirements> + <faq>Currently there are no FAQ items provided.</faq> + <name>siproxdusers</name> + <version>0.5.9</version> + <title>siproxd: Users</title> + <include_file>/usr/local/pkg/siproxd.inc</include_file> + <tabs> + <tab> + <text>Settings</text> + <url>/pkg_edit.php?xml=siproxd.xml&id=0</url> + </tab> + <tab> + <text>Users</text> + <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> + <columnitem> + <fielddescr>Username</fielddescr> + <fieldname>username</fieldname> + </columnitem> + <columnitem> + <fielddescr>Description</fielddescr> + <fieldname>description</fieldname> + </columnitem> + </adddeleteeditpagefields> + <fields> + <field> + <fielddescr>Username</fielddescr> + <fieldname>username</fieldname> + <description>Enter the username here</description> + <type>input</type> + </field> + <field> + <fielddescr>Password</fielddescr> + <fieldname>password</fieldname> + <description>Enter the password here</description> + <type>password</type> + </field> + <field> + <fielddescr>Username Description</fielddescr> + <fieldname>description</fieldname> + <description>Enter the description of the user here</description> + <type>input</type> + </field> + </fields> + <custom_add_php_command> + sync_package_sipproxd_users(); + </custom_add_php_command> + <custom_php_resync_config_command> + sync_package_sipproxd_users(); + </custom_php_resync_config_command> +</packagegui>
\ No newline at end of file |