From 7af1159c01ef441f1a451df51ba23efdab64a623 Mon Sep 17 00:00:00 2001 From: jim-p Date: Fri, 26 Nov 2010 11:29:39 -0500 Subject: Make siproxd use its own settings rather than use $_POST directly. Add sync command to xml file - previously, siproxd was not being sync'd on boot, only on save from the GUI, could have caused numerous issues. --- config/siproxd.inc | 49 +++++++++++++++++++++++++------------------------ config/siproxd.xml | 1 + 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/config/siproxd.inc b/config/siproxd.inc index 9eb6812b..93bdf203 100644 --- a/config/siproxd.inc +++ b/config/siproxd.inc @@ -103,32 +103,32 @@ function sync_package_siproxd() { @chgrp($siproxd_chroot, "nobody"); unlink_if_exists("/usr/local/etc/rc.d/siproxd"); - $conf = &$config['installedpackages']['siproxd']['config'][0]; + $siproxd_conf = &$config['installedpackages']['siproxdsettings']['config'][0]; $fout = fopen("/usr/local/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($_POST['rtpenable'] == "0") { + if($siproxd_conf['rtpenable'] == "0") { fclose($fout); return; } - if($_POST['if_inbound'] != "") { - fwrite($fout, "if_inbound = " . convert_friendly_interface_to_real_interface_name($_POST['if_inbound']) . "\n"); + if($siproxd_conf['if_inbound'] != "") { + fwrite($fout, "if_inbound = " . convert_friendly_interface_to_real_interface_name($siproxd_conf['if_inbound']) . "\n"); } - if($_POST['if_outbound'] != "") { - if(intval($config['version']) < 6 && $config['interfaces'][$_POST['if_outbound']]['ipaddr'] == "pppoe") { + 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($_POST['if_outbound']) . "\n"); + fwrite($fout, "if_outbound = " . convert_friendly_interface_to_real_interface_name($siproxd_conf['if_outbound']) . "\n"); } } - if($_POST['port'] != "") { - fwrite($fout, "sip_listen_port = " . $_POST['port'] . "\n"); + if($siproxd_conf['port'] != "") { + fwrite($fout, "sip_listen_port = " . $siproxd_conf['port'] . "\n"); } else { fwrite($fout, "sip_listen_port = 5060\n"); } @@ -142,46 +142,46 @@ function sync_package_siproxd() { fwrite($fout, "autosave_registrations = 10\n"); fwrite($fout, "pid_file = siproxd.pid\n"); - if($_POST['rtpenable'] != "") { - fwrite($fout, "rtp_proxy_enable = " . $_POST['rtpenable'] . "\n"); + if($siproxd_conf['rtpenable'] != "") { + fwrite($fout, "rtp_proxy_enable = " . $siproxd_conf['rtpenable'] . "\n"); } else { fwrite($fout, "rtp_proxy_enable = 1\n"); } - if(($_POST['rtplower'] != "") && ($_POST['rtpupper'] != "")) { - fwrite($fout, "rtp_port_low = " . $_POST['rtplower'] . "\n"); - fwrite($fout, "rtp_port_high = " . $_POST['rtpupper'] . "\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($_POST['rtptimeout'] != "") { - fwrite($fout, "rtp_timeout = " . $_POST['rtptimeout'] . "\n"); + if($siproxd_conf['rtptimeout'] != "") { + fwrite($fout, "rtp_timeout = " . $siproxd_conf['rtptimeout'] . "\n"); } else { fwrite($fout, "rtp_timeout = 300\n"); } - if($_POST['defaulttimeout'] != "") { - fwrite($fout, "default_expires = " . $_POST['defaulttimeout'] . "\n"); + if($siproxd_conf['defaulttimeout'] != "") { + fwrite($fout, "default_expires = " . $siproxd_conf['defaulttimeout'] . "\n"); } else { fwrite($fout, "default_expires = 600\n"); } - if($_POST['authentication']) { + if($siproxd_conf['authentication']) { fwrite($fout, "proxy_auth_realm = Authentication_Realm\n"); fwrite($fout, "proxy_auth_pwfile = /usr/local/etc/siproxd_passwd.cfg\n"); } fwrite($fout, "debug_level = 0x00000000\n"); - if($_POST['outboundproxyhost'] != "") { - if($_POST['outboundproxyport'] != "") { - fwrite($fout, "outbound_proxy_host = " . $_POST['outboundproxyhost'] . "\n"); - fwrite($fout, "outbound_proxy_port = " . $_POST['outboundproxyport'] . "\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($_POST['expeditedforwarding'] != "") + if($siproxd_conf['expeditedforwarding'] != "") fwrite($fout, "rtp_dscp = 46\n"); fclose($fout); @@ -202,6 +202,7 @@ function sync_package_siproxd() { filter_configure(); conf_mount_ro(); + } ?> diff --git a/config/siproxd.xml b/config/siproxd.xml index f4e1bd0b..7feb4d0f 100644 --- a/config/siproxd.xml +++ b/config/siproxd.xml @@ -169,6 +169,7 @@ sync_package_siproxd(); + sync_package_siproxd(); siproxd_generate_rules -- cgit v1.2.3