From 9715ca7d4ae42ff3f9fd36c4e594f20d3c2f9ef1 Mon Sep 17 00:00:00 2001 From: Colin Smith Date: Thu, 16 Jun 2005 00:36:41 +0000 Subject: Fix cosmetic problems and move sync function to globals. --- packages/siproxd.xml | 118 ++++++++++++++++++++++++++------------------------- 1 file changed, 60 insertions(+), 58 deletions(-) (limited to 'packages/siproxd.xml') diff --git a/packages/siproxd.xml b/packages/siproxd.xml index ad203854..af486211 100644 --- a/packages/siproxd.xml +++ b/packages/siproxd.xml @@ -104,73 +104,75 @@ - mwexec("pkg_add -rv libosip2"); $fout = fopen("/usr/local/etc/rc.d/siproxd.sh","w"); - fwrite($fout, "# PACKAGE: SipProxD\n"); + fwrite($fout, "# PACKAGE: siproxd\n"); fwrite($fout, "# EXECUTABLE: siproxd\n"); fwrite($fout, "#!/bin/sh\n\n/usr/local/sbin/siproxd\n"); fclose($fout); + + function sync_package_sipproxd() { + conf_mount_rw(); + config_lock(); + global $config; + if ($_POST == "") $_POST = $config['installedpackages']['siproxd']['config']; + $fout = fopen("/usr/local/etc/siproxd.conf","w"); + fwrite($fout, "# This file was automatically generated by the pfSense\n# package management system.\n\n"); + if($_POST['if_inbound'] != "") { + fwrite($fout, "if_inbound = " . convert_friendly_interface_to_real_interface_name($_POST['if_inbound']) . "\n"); + } + if($_POST['if_outbound'] != "") { + fwrite($fout, "if_outbound = " . convert_friendly_interface_to_real_interface_name($_POST['if_outbound']) . "\n\n"); + } + if($_POST['port'] != "") { + fwrite($fout, "sip_listen_port = " . $_POST['port'] . "\n\n"); + } else { + fwrite($fout, "sip_listen_port = 5060\n\n"); + } + fwrite($fout, "daemonize = 1\n\nsilence_log = 0\n\nlog_calls = 1\n\nuser = nobody\nchrootjail = /usr/local/siproxd/\n\nregistration +_file = siproxd_registrations\n\npid_file = siproxd.pid\n\n"); + if($_POST['rtpenable'] != "") { + fwrite($fout, "rtp_proxy_enable = " . $_POST['rtpenable'] . "\n\n"); + } else { + fwrite($fout, "rtp_proxy_enable = 1\n\n"); + } + if($_POST['rtplower'] != "") { + if($_POST['rtpupper'] != "") { + fwrite($fout, "rtp_port_low = " . $_POST['rtplower'] . "\n"); + fwrite($fout, "rtp_port_high = " . $_POST['rtpupper'] . "\n\n"); + } + } + if($_POST['rtptimeout'] != "") { + fwrite($fout, "rtp_timeout = " . $_POST['rtptimeout'] . "\n\n"); + } else { + fwrite($fout, "rtp_timeout = 300\n\n"); + } + if($_POST['defaulttimeout'] != "") { + fwrite($fout, "default_expires = " . $_POST['defaulttimeout'] . "\n\n"); + } else { + fwrite($fout, "default_expires = 600\n\n"); + } + if($_POST['authentication']) { + fwrite($fout, "proxy_auth_realm = Authentication_Realm\nproxy_auth_pwfile = /usr/local/etc/siproxd_passwd.cfg\n\n"); + } + fwrite($fout, "debug_level = 0x00000000\n\n"); + if($_POST['outboundproxyhost'] != "") { + if($_POST['outboundproxyport'] != "") { + fwrite($fout, "outbound_proxy_host = " . $_POST['outboundproxyhost'] . "\n"); + fwrite($fout, "outbound_proxy_port = " . $_POST['outboundproxyport'] . "\n"); + } + } + fclose($fout); + mwexec("killall siproxd"); + mwexec("/usr/local/etc/rc.d/siproxd.sh"); + conf_mount_ro(); + config_unlock(); + } + sync_package_sipproxd(); - function sync_package_sipproxd() { - conf_mount_rw(); - config_lock(); - global $config; - if ($_POST == "") $_POST = $config['installedpackages']['siproxd']['config']; - $fout = fopen("/usr/local/etc/siproxd.conf","w"); - fwrite($fout, "# This file was automatically generated by the pfSense\n# package management system.\n\n"); - if($_POST['if_inbound'] != "") { - fwrite($fout, "if_inbound = " . convert_friendly_interface_to_real_interface_name($_POST['if_inbound']) . "\n"); - } - if($_POST['if_outbound'] != "") { - fwrite($fout, "if_outbound = " . convert_friendly_interface_to_real_interface_name($_POST['if_outbound']) . "\n\n"); - } - if($_POST['port'] != "") { - fwrite($fout, "sip_listen_port = " . $_POST['port'] . "\n\n"); - } else { - fwrite($fout, "sip_listen_port = 5060\n\n"); - } - fwrite($fout, "daemonize = 1\n\nsilence_log = 0\n\nlog_calls = 1\n\nuser = nobody\nchrootjail = /usr/local/siproxd/\n\nregistration_file = siproxd_registrations\n\npid_file = siproxd.pid\n\n"); - if($_POST['rtpenable'] != "") { - fwrite($fout, "rtp_proxy_enable = " . $_POST['rtpenable'] . "\n\n"); - } else { - fwrite($fout, "rtp_proxy_enable = 1\n\n"); - } - if($_POST['rtplower'] != "") { - if($_POST['rtpupper'] != "") { - fwrite($fout, "rtp_port_low = " . $_POST['rtplower'] . "\n"); - fwrite($fout, "rtp_port_high = " . $_POST['rtpupper'] . "\n\n"); - } - } - if($_POST['rtptimeout'] != "") { - fwrite($fout, "rtp_timeout = " . $_POST['rtptimeout'] . "\n\n"); - } else { - fwrite($fout, "rtp_timeout = 300\n\n"); - } - if($_POST['defaulttimeout'] != "") { - fwrite($fout, "default_expires = " . $_POST['defaulttimeout'] . "\n\n"); - } else { - fwrite($fout, "default_expires = 600\n\n"); - } - if($_POST['authentication']) { - fwrite($fout, "proxy_auth_realm = Authentication_Realm\nproxy_auth_pwfile = /usr/local/etc/siproxd_passwd.cfg\n\n"); - } - fwrite($fout, "debug_level = 0x00000000\n\n"); - if($_POST['outboundproxyhost'] != "") { - if($_POST['outboundproxyport'] != "") { - fwrite($fout, "outbound_proxy_host = " . $_POST['outboundproxyhost'] . "\n"); - fwrite($fout, "outbound_proxy_port = " . $_POST['outboundproxyport'] . "\n"); - } - } - fclose($fout); - mwexec("killall siproxd"); - mwexec("/usr/local/etc/rc.d/siproxd.sh"); - conf_mount_ro(); - config_unlock(); - } sync_package_sipproxd(); -- cgit v1.2.3