diff options
Diffstat (limited to 'packages')
-rw-r--r-- | packages/siproxd.inc | 52 | ||||
-rw-r--r-- | packages/siproxd.xml | 3 |
2 files changed, 19 insertions, 36 deletions
diff --git a/packages/siproxd.inc b/packages/siproxd.inc index f198b4b1..2fb98309 100644 --- a/packages/siproxd.inc +++ b/packages/siproxd.inc @@ -27,14 +27,6 @@ POSSIBILITY OF SUCH DAMAGE. */ -require_once('globals.inc'); -require_once('config.inc'); -require_once('util.inc'); -require_once('pfsense-utils.inc'); -require_once('pkg-utils.inc'); -require_once('filter.inc'); -require_once('service-utils.inc'); - function siproxd_generate_rules($type) { global $config; @@ -78,17 +70,15 @@ function siproxd_generate_rules($type) { function sync_package_siproxd() { global $config; - log_error("1"); - conf_mount_rw(); - log_error("2"); - config_lock(); + + unlink_if_exists("/usr/local/etc/rc.d/siproxd"); $conf = &$config['installedpackages']['siproxd']['config'][0]; $fout = fopen("/usr/local/etc/siproxd.conf","w"); - log_error("3"); + fwrite($fout, "# This file was automatically generated by the pfSense\n"); fwrite($fout, "# package management system.\n\n"); - log_error("4"); + /* proxy is turned off in package settings */ if($_POST['rtpenable'] == "0") { fclose($fout); @@ -98,7 +88,7 @@ function sync_package_siproxd() { if($_POST['if_inbound'] != "") { fwrite($fout, "if_inbound = " . convert_friendly_interface_to_real_interface_name($_POST['if_inbound']) . "\n"); } - log_error("5"); + if($_POST['if_outbound'] != "") { if($config['interfaces'][$_POST['if_outbound']]['ipaddr'] == "pppoe") { fwrite($fout, "if_outbound = ng0\n"); @@ -106,13 +96,13 @@ function sync_package_siproxd() { fwrite($fout, "if_outbound = " . convert_friendly_interface_to_real_interface_name($_POST['if_outbound']) . "\n"); } } - log_error("6"); + if($_POST['port'] != "") { fwrite($fout, "sip_listen_port = " . $_POST['port'] . "\n"); } else { fwrite($fout, "sip_listen_port = 5060\n"); } - log_error("7"); + fwrite($fout, "daemonize = 1\n"); fwrite($fout, "silence_log = 0\n"); fwrite($fout, "log_calls = 1\n"); @@ -120,37 +110,37 @@ function sync_package_siproxd() { fwrite($fout, "chrootjail = /usr/local/siproxd/\n"); fwrite($fout, "registration_file = siproxd_registrations\n"); fwrite($fout, "pid_file = siproxd.pid\n"); - log_error("8"); + if($_POST['rtpenable'] != "") { fwrite($fout, "rtp_proxy_enable = " . $_POST['rtpenable'] . "\n"); } else { fwrite($fout, "rtp_proxy_enable = 1\n"); } - log_error("9"); + if($_POST['rtplower'] != "") { if($_POST['rtpupper'] != "") { fwrite($fout, "rtp_port_low = " . $_POST['rtplower'] . "\n"); fwrite($fout, "rtp_port_high = " . $_POST['rtpupper'] . "\n"); } } - log_error("10"); + if($_POST['rtptimeout'] != "") { fwrite($fout, "rtp_timeout = " . $_POST['rtptimeout'] . "\n"); } else { fwrite($fout, "rtp_timeout = 300\n"); } - log_error("11"); + if($_POST['defaulttimeout'] != "") { fwrite($fout, "default_expires = " . $_POST['defaulttimeout'] . "\n"); } else { fwrite($fout, "default_expires = 600\n"); } - log_error("12"); + if($_POST['authentication']) { fwrite($fout, "proxy_auth_realm = Authentication_Realm\n"); fwrite($fout, "proxy_auth_pwfile = /usr/local/etc/siproxd_passwd.cfg\n"); } - log_error("13"); + fwrite($fout, "debug_level = 0x00000000\n"); if($_POST['outboundproxyhost'] != "") { if($_POST['outboundproxyport'] != "") { @@ -158,23 +148,17 @@ function sync_package_siproxd() { fwrite($fout, "outbound_proxy_port = " . $_POST['outboundproxyport'] . "\n"); } } - log_error("14"); + fclose($fout); - log_error("15"); + write_rcfile(array( "file" => "siproxd.sh", "start" => "/usr/local/sbin/siproxd -c /usr/local/etc/siproxd.conf &", "stop" => "/usr/bin/killall siproxd" ) ); - log_error("16"); - exec("killall siproxd"); - start_service("siproxd"); - log_error("17"); - conf_mount_ro(); - log_error("18"); - config_unlock(); - log_error("19"); + + exec("killall siproxd"); } -?> +?>
\ No newline at end of file diff --git a/packages/siproxd.xml b/packages/siproxd.xml index 3217d8d4..0ee80b53 100644 --- a/packages/siproxd.xml +++ b/packages/siproxd.xml @@ -45,12 +45,11 @@ <version>0.5.13_pfs2</version> <title>siproxd: Settings</title> <include_file>/usr/local/pkg/siproxd.inc</include_file> - <aftersaveredirect>pkg_edit.php?xml=siproxd.xml&id=0</aftersaveredirect> + <aftersaveredirect>/pkg_edit.php?xml=siproxd.xml&id=0</aftersaveredirect> <menu> <name>siproxd</name> <tooltiptext>Modify siproxd users and settings.</tooltiptext> <section>Services</section> - <configfile>siproxd.xml</configfile> <url>/pkg_edit.php?xml=siproxd.xml&id=0</url> </menu> <service> |