aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/anyterm/access_anyterm.php44
-rw-r--r--config/anyterm/anyterm.inc118
-rw-r--r--config/anyterm/anyterm.xml116
-rwxr-xr-xconfig/anyterm/binaries7/anytermdbin3111332 -> 0 bytes
-rwxr-xr-xconfig/anyterm/binaries8/anytermdbin3156865 -> 0 bytes
-rw-r--r--config/avahi/avahi.inc24
-rwxr-xr-xconfig/blinkled8/binaries/blinkledbin9323 -> 0 bytes
-rw-r--r--config/blinkled8/blinkled.xml5
-rw-r--r--config/filemgr/filemgr.xml2
-rw-r--r--config/filemgr/rbfminc/file_editor_style.css5
-rw-r--r--config/filemgr/rbfminc/rename.tmp5
-rw-r--r--config/freeradius2/freeradius.inc364
-rw-r--r--config/freeradius2/freeradius_view_config.php14
-rw-r--r--config/freeradius2/freeradiussettings.xml2
-rwxr-xr-xconfig/freeswitch/begin_recording.wavbin19480 -> 0 bytes
-rw-r--r--config/freeswitch/call_forward_has_been_deleted.wavbin28668 -> 0 bytes
-rw-r--r--config/freeswitch/call_forward_has_been_set.wavbin30976 -> 0 bytes
-rwxr-xr-xconfig/freeswitch/class.phpmailer.tmp1896
-rwxr-xr-xconfig/freeswitch/class.smtp.tmp1062
-rw-r--r--config/freeswitch/dialplan.default.xml714
-rw-r--r--config/freeswitch/dialplan.public.xml69
-rw-r--r--config/freeswitch/disa.js78
-rw-r--r--config/freeswitch/fax_to_email.tmp182
-rw-r--r--config/freeswitch/freeswitch.inc3784
-rw-r--r--config/freeswitch/freeswitch.xml267
-rw-r--r--config/freeswitch/freeswitch_cmd.tmp49
-rw-r--r--config/freeswitch/freeswitch_dialplan.tmp163
-rw-r--r--config/freeswitch/freeswitch_dialplan_includes.tmp278
-rwxr-xr-xconfig/freeswitch/freeswitch_dialplan_includes_details.tmp53
-rw-r--r--config/freeswitch/freeswitch_dialplan_includes_details_edit.tmp389
-rw-r--r--config/freeswitch/freeswitch_dialplan_includes_edit.tmp543
-rw-r--r--config/freeswitch/freeswitch_extensions.tmp220
-rw-r--r--config/freeswitch/freeswitch_extensions_edit.tmp417
-rw-r--r--config/freeswitch/freeswitch_fax.tmp305
-rw-r--r--config/freeswitch/freeswitch_fax_edit.tmp723
-rw-r--r--config/freeswitch/freeswitch_features.tmp216
-rw-r--r--config/freeswitch/freeswitch_gateways.tmp214
-rw-r--r--config/freeswitch/freeswitch_gateways_edit.tmp694
-rw-r--r--config/freeswitch/freeswitch_hunt_group.tmp206
-rw-r--r--config/freeswitch/freeswitch_hunt_group_destinations.tmp52
-rw-r--r--config/freeswitch/freeswitch_hunt_group_destinations_edit.tmp269
-rw-r--r--config/freeswitch/freeswitch_hunt_group_edit.tmp509
-rw-r--r--config/freeswitch/freeswitch_ivr.tmp177
-rw-r--r--config/freeswitch/freeswitch_ivr_edit.tmp697
-rwxr-xr-xconfig/freeswitch/freeswitch_ivr_options.tmp52
-rw-r--r--config/freeswitch/freeswitch_ivr_options_edit.tmp248
-rw-r--r--config/freeswitch/freeswitch_mailto.tmp243
-rw-r--r--config/freeswitch/freeswitch_modules.xml1203
-rw-r--r--config/freeswitch/freeswitch_profile_edit.tmp143
-rw-r--r--config/freeswitch/freeswitch_profiles.tmp214
-rw-r--r--config/freeswitch/freeswitch_public.tmp162
-rw-r--r--config/freeswitch/freeswitch_public_includes.tmp282
-rwxr-xr-xconfig/freeswitch/freeswitch_public_includes_details.tmp53
-rw-r--r--config/freeswitch/freeswitch_public_includes_details_edit.tmp419
-rw-r--r--config/freeswitch/freeswitch_public_includes_edit.tmp543
-rw-r--r--config/freeswitch/freeswitch_recordings.tmp494
-rw-r--r--config/freeswitch/freeswitch_recordings_edit.tmp172
-rwxr-xr-xconfig/freeswitch/freeswitch_recordings_play.tmp70
-rw-r--r--config/freeswitch/freeswitch_status.tmp339
-rw-r--r--config/freeswitch/freeswitch_time_conditions.tmp178
-rw-r--r--config/freeswitch/freeswitch_time_conditions_edit.tmp201
-rw-r--r--config/freeswitch/freeswitch_vars.tmp162
-rw-r--r--config/freeswitch/index.tmp5
-rwxr-xr-xconfig/freeswitch/libcurl.so.5bin293352 -> 0 bytes
-rwxr-xr-xconfig/freeswitch/libiconv.so.3bin1045332 -> 0 bytes
-rwxr-xr-xconfig/freeswitch/libncurses.so.5.6bin127748 -> 0 bytes
-rwxr-xr-xconfig/freeswitch/libncurses.so.5.7bin127748 -> 0 bytes
-rwxr-xr-xconfig/freeswitch/libodbc.so.1bin456398 -> 0 bytes
-rwxr-xr-xconfig/freeswitch/libogg.so.5.3bin43004 -> 0 bytes
-rwxr-xr-xconfig/freeswitch/libspandsp.so.1bin1398998 -> 0 bytes
-rwxr-xr-xconfig/freeswitch/libtinfo.so.5.6bin187069 -> 0 bytes
-rwxr-xr-xconfig/freeswitch/libvorbis.so.4bin179138 -> 0 bytes
-rw-r--r--config/freeswitch/originate.js84
-rw-r--r--config/freeswitch/please_enter_the_extension_number.wavbin32360 -> 0 bytes
-rw-r--r--config/freeswitch/please_enter_the_phone_number.wavbin26552 -> 0 bytes
-rw-r--r--config/freeswitch/please_enter_the_pin_number.wavbin27504 -> 0 bytes
-rwxr-xr-xconfig/freeswitch/please_enter_your_pin_number.wavbin28212 -> 0 bytes
-rw-r--r--config/freeswitch/please_say_your_name_and_reason_for_calling.wavbin35860 -> 0 bytes
-rw-r--r--config/freeswitch/press_1_to_accept_2_to_reject_or_3_for_voicemail.wavbin68104 -> 0 bytes
-rwxr-xr-xconfig/freeswitch/your_pin_number_is_incorect_goodbye.wavbin43420 -> 0 bytes
-rwxr-xr-xconfig/freeswitch_dev/begin_recording.wavbin19480 -> 0 bytes
-rw-r--r--config/freeswitch_dev/call_forward_has_been_deleted.wavbin28668 -> 0 bytes
-rw-r--r--config/freeswitch_dev/call_forward_has_been_set.wavbin30976 -> 0 bytes
-rwxr-xr-xconfig/freeswitch_dev/class.phpmailer.tmp1896
-rwxr-xr-xconfig/freeswitch_dev/class.smtp.tmp1062
-rw-r--r--config/freeswitch_dev/dialplan.default.xml717
-rw-r--r--config/freeswitch_dev/dialplan.public.xml69
-rw-r--r--config/freeswitch_dev/disa.js78
-rw-r--r--config/freeswitch_dev/fax_to_email.tmp182
-rw-r--r--config/freeswitch_dev/freeswitch.xml262
-rw-r--r--config/freeswitch_dev/index.tmp5
-rwxr-xr-xconfig/freeswitch_dev/libcurl.so.5bin293352 -> 0 bytes
-rwxr-xr-xconfig/freeswitch_dev/libiconv.so.3bin1045332 -> 0 bytes
-rwxr-xr-xconfig/freeswitch_dev/libncurses.so.5.6bin127748 -> 0 bytes
-rwxr-xr-xconfig/freeswitch_dev/libncurses.so.5.7bin127748 -> 0 bytes
-rwxr-xr-xconfig/freeswitch_dev/libodbc.so.1bin456398 -> 0 bytes
-rwxr-xr-xconfig/freeswitch_dev/libogg.so.5.3bin43004 -> 0 bytes
-rwxr-xr-xconfig/freeswitch_dev/libspandsp.so.1bin1398998 -> 0 bytes
-rwxr-xr-xconfig/freeswitch_dev/libtinfo.so.5.6bin187069 -> 0 bytes
-rwxr-xr-xconfig/freeswitch_dev/libvorbis.so.4bin179138 -> 0 bytes
-rw-r--r--config/freeswitch_dev/originate.js84
-rw-r--r--config/freeswitch_dev/please_enter_the_extension_number.wavbin32360 -> 0 bytes
-rw-r--r--config/freeswitch_dev/please_enter_the_phone_number.wavbin26552 -> 0 bytes
-rw-r--r--config/freeswitch_dev/please_enter_the_pin_number.wavbin27504 -> 0 bytes
-rwxr-xr-xconfig/freeswitch_dev/please_enter_your_pin_number.wavbin28212 -> 0 bytes
-rw-r--r--config/freeswitch_dev/please_say_your_name_and_reason_for_calling.wavbin35860 -> 0 bytes
-rw-r--r--config/freeswitch_dev/press_1_to_accept_2_to_reject_or_3_for_voicemail.wavbin68104 -> 0 bytes
-rw-r--r--config/freeswitch_dev/v_auto_attendant.tmp183
-rw-r--r--config/freeswitch_dev/v_auto_attendant_edit.tmp701
-rwxr-xr-xconfig/freeswitch_dev/v_auto_attendant_options.tmp49
-rw-r--r--config/freeswitch_dev/v_auto_attendant_options_edit.tmp252
-rw-r--r--config/freeswitch_dev/v_cmd.tmp45
-rw-r--r--config/freeswitch_dev/v_config.inc3974
-rw-r--r--config/freeswitch_dev/v_dialplan.tmp171
-rw-r--r--config/freeswitch_dev/v_dialplan_includes.tmp287
-rwxr-xr-xconfig/freeswitch_dev/v_dialplan_includes_details.tmp50
-rw-r--r--config/freeswitch_dev/v_dialplan_includes_details_edit.tmp403
-rw-r--r--config/freeswitch_dev/v_dialplan_includes_edit.tmp545
-rw-r--r--config/freeswitch_dev/v_extensions.tmp226
-rw-r--r--config/freeswitch_dev/v_extensions_edit.tmp424
-rw-r--r--config/freeswitch_dev/v_fax.tmp316
-rw-r--r--config/freeswitch_dev/v_fax_edit.tmp760
-rw-r--r--config/freeswitch_dev/v_features.tmp223
-rw-r--r--config/freeswitch_dev/v_gateways.tmp220
-rw-r--r--config/freeswitch_dev/v_gateways_edit.tmp700
-rw-r--r--config/freeswitch_dev/v_hunt_group.tmp213
-rw-r--r--config/freeswitch_dev/v_hunt_group_destinations.tmp49
-rw-r--r--config/freeswitch_dev/v_hunt_group_destinations_edit.tmp272
-rw-r--r--config/freeswitch_dev/v_hunt_group_edit.tmp512
-rw-r--r--config/freeswitch_dev/v_mailto.tmp240
-rw-r--r--config/freeswitch_dev/v_modules.tmp2384
-rw-r--r--config/freeswitch_dev/v_profile_edit.tmp149
-rw-r--r--config/freeswitch_dev/v_profiles.tmp221
-rw-r--r--config/freeswitch_dev/v_public.tmp170
-rw-r--r--config/freeswitch_dev/v_public_includes.tmp289
-rwxr-xr-xconfig/freeswitch_dev/v_public_includes_details.tmp50
-rw-r--r--config/freeswitch_dev/v_public_includes_details_edit.tmp454
-rw-r--r--config/freeswitch_dev/v_public_includes_edit.tmp546
-rw-r--r--config/freeswitch_dev/v_recordings.tmp508
-rw-r--r--config/freeswitch_dev/v_recordings_edit.tmp174
-rw-r--r--config/freeswitch_dev/v_recordings_play.tmp69
-rw-r--r--config/freeswitch_dev/v_settings.tmp396
-rw-r--r--config/freeswitch_dev/v_status.tmp380
-rw-r--r--config/freeswitch_dev/v_vars.tmp169
-rwxr-xr-xconfig/freeswitch_dev/your_pin_number_is_incorect_goodbye.wavbin43420 -> 0 bytes
-rw-r--r--config/haproxy-devel/haproxy.inc589
-rwxr-xr-xconfig/haproxy-devel/haproxy_global.php122
-rw-r--r--config/haproxy-devel/haproxy_htmllist.inc170
-rw-r--r--config/haproxy-devel/haproxy_listeners.php34
-rw-r--r--config/haproxy-devel/haproxy_listeners_edit.php128
-rw-r--r--config/haproxy-devel/haproxy_pool_edit.php209
-rw-r--r--config/haproxy-devel/haproxy_socketinfo.inc6
-rw-r--r--config/haproxy-devel/haproxy_utils.inc131
-rw-r--r--config/lcdproc-dev/lcdproc.inc5
-rw-r--r--config/lcdproc-dev/lcdproc_client.php6
-rw-r--r--config/lightsquid/sqstat.class.php4
-rw-r--r--config/mailreport/mail_reports.inc17
-rw-r--r--config/mailreport/mailreport.xml2
-rw-r--r--config/mailreport/status_mail_report_add_graph.php7
-rw-r--r--config/mailscanner/mailscanner.inc32
-rw-r--r--config/nrpe2/nrpe2.inc9
-rw-r--r--config/nrpe2/nrpe2.xml9
-rw-r--r--config/olsrd.inc5
-rw-r--r--config/open-vm-tools/open-vm-tools.inc10
-rwxr-xr-xconfig/openvpn-client-export/openvpn-client-export.xml2
-rwxr-xr-xconfig/openvpn-client-export/readme.txt4
-rwxr-xr-xconfig/openvpn-client-export/source/openvpn-postinstall.nsi2
-rw-r--r--config/openvpn-client-export/source/openvpn-postinstall64.nsi2
-rwxr-xr-xconfig/openvpn-client-export/vpn_openvpn_export.php2
-rw-r--r--config/openvpn-client-export/vpn_openvpn_export_shared.php4
-rwxr-xr-xconfig/sarg/sarg_about.php4
-rw-r--r--config/suricata/suricata.xml2
-rw-r--r--config/suricata/suricata_alerts.php6
-rw-r--r--config/suricata/suricata_app_parsers.php3
-rw-r--r--config/suricata/suricata_barnyard.php4
-rw-r--r--config/suricata/suricata_blocked.php7
-rw-r--r--config/suricata/suricata_define_vars.php3
-rw-r--r--config/suricata/suricata_flow_stream.php3
-rw-r--r--config/suricata/suricata_migrate_config.php4
-rw-r--r--config/suricata/suricata_post_install.php42
-rw-r--r--config/suricata/suricata_rules.php15
-rw-r--r--config/suricata/suricata_rulesets.php3
-rw-r--r--config/suricata/suricata_sid_mgmt.php3
-rw-r--r--config/suricata/suricata_suppress.php18
184 files changed, 1386 insertions, 41563 deletions
diff --git a/config/anyterm/access_anyterm.php b/config/anyterm/access_anyterm.php
deleted file mode 100644
index b1703932..00000000
--- a/config/anyterm/access_anyterm.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-/*
- access_anyterm.php
- pfSense package (http://www.pfSense.com)
- Copyright (C) 2009 Scott Ullrich <sullrich@pfsense.org>
- 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.
-*/
-
-require("guiconfig.inc");
-
-if($config['installedpackages']['anyterm']['config'][0]['stunnelport']) {
- $port = $config['installedpackages']['anyterm']['config'][0]['stunnelport'];
- $httpors = "https";
-} else {
- $port = $config['installedpackages']['anyterm']['config'][0]['port'];
- $httpors = "http";
-}
-
-$location = "{$_SERVER['SERVER_ADDR']}:{$port}/anyterm.html";
-
-Header("Location: {$httpors}://{$location}");
-
-?> \ No newline at end of file
diff --git a/config/anyterm/anyterm.inc b/config/anyterm/anyterm.inc
deleted file mode 100644
index 5ec4e5f1..00000000
--- a/config/anyterm/anyterm.inc
+++ /dev/null
@@ -1,118 +0,0 @@
-<?php
-/*
- anyterm.inc
- pfSense package (http://www.pfSense.com)
- Copyright (C) 2009 Scott Ullrich <sullrich@pfsense.org>
- 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.
-*/
-
-function anyterm_deinstall() {
- global $g, $config;
- conf_mount_rw();
- exec("killall anytermd");
- exec("rm /usr/local/etc/rc.d/anyterm.sh");
- exec("rm /usr/local/sbin/anytermd");
-}
-
-function anyterm_install() {
- global $g, $config;
-
- conf_mount_rw();
-
- // Grab latest version of executablevi /
- $freebsdv=trim(`uname -r | cut -d'.' -f1`);
- `fetch -q -o /usr/local/sbin/ https://packages.pfsense.org/packages/config/anyterm/binaries{$freebsdv}/anytermd`;
- exec("chmod a+rx /usr/local/sbin/anytermd");
-
- if($config['installedpackages']['anyterm']['config'][0]['username'])
- $port = " --port {$config['installedpackages']['anyterm']['config'][0]['port']}";
-
- // This will bring up the pfSense style menu
- $anytermd_command = "anytermd --user root --command '/etc/rc.initial' --auth trivial $port";
-
- $anyterm = <<<EOD
-#!/bin/sh
-
-# PROVIDE: anyterm
-# REQUIRE: LOGIN
-# KEYWORD: FreeBSD
-
-. /etc/rc.subr
-
-name="anyterm"
-rcvar=`set_rcvar`
-command="/usr/local/bin/anyterm"
-anyterm_enable=\${anyterm-"YES"}
-
-start_cmd="anyterm_start"
-stop_postcmd="anyterm_stop"
-
-load_rc_config \$name
-
-anyterm_start () {
- if [ -f /var/etc/anyterm.conf ]; then
- if [ `ps awux | grep -v grep | grep anytermd | wc -l` -gt 0 ]; then
- killall anytermd
- fi
- /usr/bin/env \
- PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
- /usr/local/bin/php -q -d auto_prepend_file=config.inc <<ENDOFF
- <?php
- require_once("globals.inc");
- require_once("functions.inc");
- require_once("anyterm.inc");
- anyterm_install();
- ?>
-ENDOFF
-
- fi
-}
-
-anyterm_stop () {
- echo "Stopping anyterm."
- killall anyterm
-}
-
-run_rc_command "\$1"
-
-EOD;
-
- // Write out file
- $fd = fopen("/usr/local/etc/rc.d/anyterm.sh", "w");
- fwrite($fd, $anyterm);
- fclose($fd);
- // Make executable
- exec("chmod a+rx /usr/local/etc/rc.d/anyterm.sh");
-
- // Write out Anyterm configuration file (username and password for auth)
- $fd = fopen("/var/etc/anyterm.conf", "w");
- fwrite($fd, $config['installedpackages']['anyterm']['config'][0]['username'] . "\n");
- fwrite($fd, $config['installedpackages']['anyterm']['config'][0]['password'] . "\n");
- fclose($fd);
- exec("chmod a-r /var/etc/anyterm.conf ; chmod ug+r /var/etc/anyterm.conf ; killall anytermd");
- exec($anytermd_command);
-
-}
-
-?> \ No newline at end of file
diff --git a/config/anyterm/anyterm.xml b/config/anyterm/anyterm.xml
deleted file mode 100644
index f3b78012..00000000
--- a/config/anyterm/anyterm.xml
+++ /dev/null
@@ -1,116 +0,0 @@
-<?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$ */
-/* ========================================================================== */
-/*
- anyterm.xml
- pfSense package (http://www.pfSense.com)
- Copyright (C) 2009 Scott Ullrich
- 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>
- <name>anyterm</name>
- <version>1.0</version>
- <title>anyterm</title>
- <aftersaveredirect>/pkg_edit.php?xml=anyterm.xml&amp;id=0</aftersaveredirect>
- <include_file>/usr/local/pkg/anyterm.inc</include_file>
- <menu>
- <name>Anyterm</name>
- <tooltiptext></tooltiptext>
- <section>Diagnostics</section>
- <url>/pkg_edit.php?xml=anyterm.xml&amp;id=0</url>
- </menu>
- <service>
- <name>Anyterm</name>
- <rcfile>anyterm.sh</rcfile>
- <executable>anytermd</executable>
- <description>Ajax Interactive Shell</description>
- </service>
- <configpath>installedpackages->anyterm->config</configpath>
- <additional_files_needed>
- <prefix>/usr/local/pkg/</prefix>
- <chmod>077</chmod>
- <item>https://packages.pfsense.org/packages/config/anyterm/anyterm.inc</item>
- </additional_files_needed>
- <additional_files_needed>
- <prefix>/usr/local/www/</prefix>
- <chmod>077</chmod>
- <item>https://packages.pfsense.org/packages/config/anyterm/access_anyterm.php</item>
- </additional_files_needed>
- <tabs>
- <tab>
- <text>Settings</text>
- <url>/pkg_edit.php?xml=anyterm.xml&amp;id=0</url>
- <active/>
- </tab>
- <tab>
- <text>Ajax Shell</text>
- <url>access_anyterm.php</url>
- </tab>
- </tabs>
- <fields>
- <field>
- <fielddescr>Username</fielddescr>
- <fieldname>username</fieldname>
- <description>Enter the username for accessing Anyterm</description>
- <type>input</type>
- </field>
- <field>
- <fielddescr>Password</fielddescr>
- <fieldname>password</fieldname>
- <description>Enter the password for accessing Anyterm</description>
- <type>password</type>
- </field>
- <field>
- <fielddescr>Port</fielddescr>
- <fieldname>port</fieldname>
- <description>Enter the port that Anyterm will listen on Default is 8080.</description>
- <type>input</type>
- </field>
- <field>
- <fielddescr>STunnel Port</fielddescr>
- <fieldname>stunnelport</fieldname>
- <description>
- <![CDATA[
- [OPTIONAL] If you have setup a STunnel forward (recommended!) enter its port here.
- ]]>
- </description>
- <type>input</type>
- </field>
- </fields>
- <custom_php_resync_config_command>
- anyterm_install();
- </custom_php_resync_config_command>
- <custom_php_deinstall_command>
- anyterm_deinstall();
- </custom_php_deinstall_command>
-</packagegui> \ No newline at end of file
diff --git a/config/anyterm/binaries7/anytermd b/config/anyterm/binaries7/anytermd
deleted file mode 100755
index ce5304e7..00000000
--- a/config/anyterm/binaries7/anytermd
+++ /dev/null
Binary files differ
diff --git a/config/anyterm/binaries8/anytermd b/config/anyterm/binaries8/anytermd
deleted file mode 100755
index 733f7197..00000000
--- a/config/anyterm/binaries8/anytermd
+++ /dev/null
Binary files differ
diff --git a/config/avahi/avahi.inc b/config/avahi/avahi.inc
index 0bc181ec..e2cb7b6e 100644
--- a/config/avahi/avahi.inc
+++ b/config/avahi/avahi.inc
@@ -33,10 +33,16 @@ $pfs_version = substr(trim(file_get_contents("/etc/version")),0,3);
switch ($pfs_version) {
case "1.2":
case "2.0":
- define('AVAHI_BASE','/usr/local');
+ define('AVAHI_BASE', '/usr/local');
+ define('AVAHI_LOCALBASE', AVAHI_BASE);
+ break;
+ case "2.1":
+ define('AVAHI_BASE', '/usr/pbi/avahi-' . php_uname("m"));
+ define('AVAHI_LOCALBASE', AVAHI_BASE);
break;
default:
define('AVAHI_BASE', '/usr/pbi/avahi-' . php_uname("m"));
+ define('AVAHI_LOCALBASE', AVAHI_BASE . '/local');
}
function avahi_start() {
@@ -56,8 +62,8 @@ function avahi_install() {
$archive = (substr(trim(file_get_contents("/etc/version")),0,1) == "1") ? "avahi.tar.gz" : "";
// Extract out libraries and avahi-daemon
if(!empty($archive) && file_exists("/root/{$archive}")) {
- exec("mkdir -p " . AVAHI_BASE . "/etc/avahi/services/");
- exec("mv " . AVAHI_BASE . "/etc/avahi/*.service " . AVAHI_BASE . "/etc/avahi/services/");
+ exec("mkdir -p " . AVAHI_LOCALBASE . "/etc/avahi/services/");
+ exec("mv " . AVAHI_LOCALBASE . "/etc/avahi/*.service " . AVAHI_LOCALBASE . "/etc/avahi/services/");
exec("/usr/bin/tar xzPUf /root/{$archive} -C /");
unlink("/root/{$archive}");
// Make sure everthing was extracted
@@ -158,8 +164,8 @@ rlimit-nproc=3
EOF;
/* Write out .conf file */
- safe_mkdir(AVAHI_BASE . "/etc/avahi");
- $fd = fopen(AVAHI_BASE . "/etc/avahi/avahi-daemon.conf", "w");
+ safe_mkdir(AVAHI_LOCALBASE . "/etc/avahi");
+ $fd = fopen(AVAHI_LOCALBASE . "/etc/avahi/avahi-daemon.conf", "w");
fwrite($fd, $avahiconfig);
fclose($fd);
/* Write out rc.d startup file */
@@ -169,18 +175,18 @@ EOF;
$start .= " mount -t procfs procfs /proc\n";
$start .= "fi\n";
$start .= "/usr/bin/killall avahi-daemon\n";
- if (file_exists(AVAHI_BASE . "/etc/rc.d/dbus")) {
+ if (file_exists(AVAHI_LOCALBASE . "/etc/rc.d/dbus")) {
$start .= "/usr/bin/killall dbus-daemon\n";
$start .= "rm /var/run/dbus/dbus.pid\n";
- $start .= AVAHI_BASE . "/etc/rc.d/dbus onestart\n";
+ $start .= AVAHI_LOCALBASE . "/etc/rc.d/dbus onestart\n";
}
$start .= "sleep 5\n";
$start .= AVAHI_BASE . "/sbin/avahi-daemon -D\n";
$start .= "/etc/rc.conf_mount_ro\n";
$stop = "/usr/bin/killall avahi-daemon\n";
- if (file_exists(AVAHI_BASE . "/etc/rc.d/dbus")) {
- $stop .= AVAHI_BASE . "/etc/rc.d/dbus onestop\n";
+ if (file_exists(AVAHI_LOCALBASE . "/etc/rc.d/dbus")) {
+ $stop .= AVAHI_LOCALBASE . "/etc/rc.d/dbus onestop\n";
$stop .= "rm /var/run/dbus/dbus.pid\n";
}
diff --git a/config/blinkled8/binaries/blinkled b/config/blinkled8/binaries/blinkled
deleted file mode 100755
index fe7c0e4e..00000000
--- a/config/blinkled8/binaries/blinkled
+++ /dev/null
Binary files differ
diff --git a/config/blinkled8/blinkled.xml b/config/blinkled8/blinkled.xml
index 932d0b0e..ec70f392 100644
--- a/config/blinkled8/blinkled.xml
+++ b/config/blinkled8/blinkled.xml
@@ -16,11 +16,6 @@
<prefix>/usr/local/pkg/</prefix>
<chmod>0755</chmod>
</additional_files_needed>
- <additional_files_needed>
- <prefix>/usr/local/bin/</prefix>
- <chmod>0755</chmod>
- <item>https://packages.pfsense.org/packages/config/blinkled8/binaries/blinkled</item>
- </additional_files_needed>
<service>
<name>blinkled</name>
<rcfile>blinkled.sh</rcfile>
diff --git a/config/filemgr/filemgr.xml b/config/filemgr/filemgr.xml
index 5c44ba13..c2a7ac42 100644
--- a/config/filemgr/filemgr.xml
+++ b/config/filemgr/filemgr.xml
@@ -31,7 +31,7 @@
<requirements>none</requirements>
<faq>https://forum.pfsense.org/index.php/topic,26974.0.html</faq>
<name>File Manager</name>
- <version>0.1.2</version>
+ <version>0.1.4</version>
<title>Settings</title>
<include_file>/usr/local/pkg/filemgr.inc</include_file>
<menu>
diff --git a/config/filemgr/rbfminc/file_editor_style.css b/config/filemgr/rbfminc/file_editor_style.css
index 93b34ca7..df026a5f 100644
--- a/config/filemgr/rbfminc/file_editor_style.css
+++ b/config/filemgr/rbfminc/file_editor_style.css
@@ -2,8 +2,7 @@
/* CSS Document */
body,td,th {
- font-family: Arial, Helvetica, sans-serif;
-
+ font-family: Tahoma, sans-serif;
color: #000000;
}
@@ -100,7 +99,7 @@ img {
border-left: 1px solid #666666;
margin: 0px;
padding: 0px;
- font: 11px Arial, Helvetica, sans-serif;
+ font: 11px Tahoma, sans-serif;
}
.column1 {
margin: 0px;
diff --git a/config/filemgr/rbfminc/rename.tmp b/config/filemgr/rbfminc/rename.tmp
index 285e19d1..266e38d4 100644
--- a/config/filemgr/rbfminc/rename.tmp
+++ b/config/filemgr/rbfminc/rename.tmp
@@ -6,14 +6,15 @@ if($user_login == 'ok'){
include "functions.php";
-?><html>
+?>
+<html>
<head>
<title>Rename</title>
</head>
<body>
<script type="text/javascript">
//<![CDATA[
-<?
+<?php
//print_r($_POST);
if($_POST['o'] != $_POST['n']){
if(@rename($_POST['cf'].$_POST['o'], $_POST['cf'].$_POST['n'])){
diff --git a/config/freeradius2/freeradius.inc b/config/freeradius2/freeradius.inc
index a18872fc..df231821 100644
--- a/config/freeradius2/freeradius.inc
+++ b/config/freeradius2/freeradius.inc
@@ -48,63 +48,67 @@ require_once("services.inc");
// Check pfSense version
$pfs_version = substr(trim(file_get_contents("/etc/version")),0,3);
-if ($pfs_version > 2.0){
- define('FREERADIUS_BASE', '/usr/pbi/freeradius-' . php_uname("m"));
-}
-else{
- define('FREERADIUS_BASE', '/usr/local');
+define('FREERADIUS_BASE', '/usr/pbi/freeradius-' . php_uname("m"));
+$bash_path = FREERADIUS_BASE . "/bin/bash";
+
+if ($pfs_version == "2.1") {
+ define('FREERADIUS_LIB', FREERADIUS_BASE . '/lib');
+ define('FREERADIUS_ETC', FREERADIUS_BASE . '/etc');
+} else {
+ define('FREERADIUS_LIB', FREERADIUS_BASE . '/local/lib');
+ define('FREERADIUS_ETC', FREERADIUS_BASE . '/local/etc');
}
// Check freeradius lib version
$frlib="";
- $libfiles = scandir(FREERADIUS_BASE . "/lib/");
- foreach ($libfiles as $libfile){
- if (preg_match("/freeradius-/",$libfile))
- $frlib=FREERADIUS_BASE . "/lib/{$libfile}";
+ if (file_exists(FREERADIUS_LIB)) {
+ $libfiles = scandir(FREERADIUS_LIB);
+ foreach ($libfiles as $libfile){
+ if (preg_match("/freeradius-/",$libfile))
+ $frlib=FREERADIUS_BASE . "/lib/{$libfile}";
+ }
}
if ($frlib == ""){
log_error("freeRADIUS - No freeradius lib found on ".FREERADIUS_BASE."/lib");
}
function freeradius_deinstall_command() {
- if (substr(trim(file_get_contents("/etc/version")),0,3) == "2.0") {
- exec("cd /var/db/pkg && pkg_delete `ls | grep freeradius`");
- exec("rm -rf " . FREERADIUS_BASE . "/etc/raddb");
- exec("rm -rf /var/run/radiusd/");
- }
+ return;
}
function freeradius_install_command() {
- global $config;
+ global $config, $frlib;
conf_mount_rw();
- // put the constant to a variable
- $varFREERADIUS_BASE = FREERADIUS_BASE;
-
// We create here different folders for different counters.
- if (!file_exists("/var/log/radacct/datacounter/")) { exec("mkdir /var/log/radacct/datacounter && mkdir /var/log/radacct/datacounter/daily && mkdir /var/log/radacct/datacounter/weekly && mkdir /var/log/radacct/datacounter/monthly && mkdir /var/log/radacct/datacounter/forever"); }
- if (!file_exists("/var/log/radacct/timecounter/")) { exec("mkdir /var/log/radacct/timecounter"); }
-
- exec("mkdir " . FREERADIUS_BASE . "/etc/raddb/scripts");
+ @mkdir("/var/log/radacct/datacounter/daily", 0755, true);
+ @mkdir("/var/log/radacct/datacounter/weekly", 0755, true);
+ @mkdir("/var/log/radacct/datacounter/monthly", 0755, true);
+ @mkdir("/var/log/radacct/datacounter/forever", 0755, true);
+ @mkdir("/var/log/radacct/timecounter", 0755, true);
+ @mkdir(FREERADIUS_ETC . "/raddb/scripts", 0755, true);
+
+ unlink_if_exists("/usr/local/etc/raddb");
+ @symlink(FREERADIUS_ETC . "/raddb", "/usr/local/etc/raddb");
if (!file_exists("/var/log/radutmp")) { exec("touch /var/log/radutmp"); }
if (!file_exists("/var/log/radwtmp")) { exec("touch /var/log/radwtmp"); }
- exec("chown -R root:wheel " . FREERADIUS_BASE . "/etc/raddb && chown -R root:wheel {$frlib} && chown -R root:wheel /var/log/radacct");
+ exec("chown -R root:wheel " . FREERADIUS_ETC . "/raddb && chown -R root:wheel {$frlib} && chown -R root:wheel /var/log/radacct");
// creating a backup file of the original policy.conf no matter if user checked this or not
- if (!file_exists(FREERADIUS_BASE . "/etc/raddb/policy.conf.backup")) {
- log_error("FreeRADIUS: Creating backup of the original file to " . FREERADIUS_BASE . "/etc/raddb/policy.conf.backup");
- copy(FREERADIUS_BASE . "/etc/raddb/policy.conf", FREERADIUS_BASE . "/etc/raddb/policy.conf.backup");
+ if (!file_exists(FREERADIUS_ETC . "/raddb/policy.conf.backup")) {
+ log_error("FreeRADIUS: Creating backup of the original file to " . FREERADIUS_ETC . "/raddb/policy.conf.backup");
+ copy(FREERADIUS_ETC . "/raddb/policy.conf", FREERADIUS_ETC . "/raddb/policy.conf.backup");
}
// creating a backup file of the original /modules/files no matter if user checked this or not
- if (!file_exists(FREERADIUS_BASE . "/etc/raddb/files.backup")) {
- log_error("FreeRADIUS: Creating backup of the original file to " . FREERADIUS_BASE . "/etc/raddb/files.backup");
- copy(FREERADIUS_BASE . "/etc/raddb/modules/files", FREERADIUS_BASE . "/etc/raddb/files.backup");
+ if (!file_exists(FREERADIUS_ETC . "/raddb/files.backup")) {
+ log_error("FreeRADIUS: Creating backup of the original file to " . FREERADIUS_ETC . "/raddb/files.backup");
+ copy(FREERADIUS_ETC . "/raddb/modules/files", FREERADIUS_ETC . "/raddb/files.backup");
}
// Disable virtual-server we do not need by default
- if (file_exists(FREERADIUS_BASE . "/etc/raddb/sites-enabled/control-socket")) { unlink(FREERADIUS_BASE . "/etc/raddb/sites-enabled/control-socket"); }
- if (file_exists(FREERADIUS_BASE . "/etc/raddb/sites-enabled/inner-tunnel")) { unlink(FREERADIUS_BASE . "/etc/raddb/sites-enabled/inner-tunnel"); }
+ if (file_exists(FREERADIUS_ETC . "/raddb/sites-enabled/control-socket")) { unlink(FREERADIUS_ETC . "/raddb/sites-enabled/control-socket"); }
+ if (file_exists(FREERADIUS_ETC . "/raddb/sites-enabled/inner-tunnel")) { unlink(FREERADIUS_ETC . "/raddb/sites-enabled/inner-tunnel"); }
// We run this here just to suppress some warnings on syslog if file doesn't exist
freeradius_authorizedmacs_resync();
@@ -130,8 +134,8 @@ function freeradius_install_command() {
$rcfile = array();
$rcfile['file'] = 'radiusd.sh';
- $rcfile['start'] = "$varFREERADIUS_BASE" . '/etc/rc.d/radiusd onestart';
- $rcfile['stop'] = "$varFREERADIUS_BASE" . '/etc/rc.d/radiusd onestop';
+ $rcfile['start'] = FREERADIUS_ETC . '/rc.d/radiusd onestart';
+ $rcfile['stop'] = FREERADIUS_ETC . '/rc.d/radiusd onestop';
write_rcfile($rcfile);
conf_mount_ro();
start_service("radiusd");
@@ -251,7 +255,7 @@ extended_expressions = $varsettingsextendedexpressions
EOD;
// Deletes virtual-server coa by default. Will be re-enabled if there is an interface-type "coa"
-exec("rm -f " . FREERADIUS_BASE . "/etc/raddb/sites-enabled/coa");
+exec("rm -f " . FREERADIUS_ETC . "/raddb/sites-enabled/coa");
$arrinterfaces = $config['installedpackages']['freeradiusinterfaces']['config'];
if (is_array($arrinterfaces) && !empty($arrinterfaces)) {
@@ -278,7 +282,7 @@ EOD;
// Begin "if" for interface-type = coa
if ($item['varinterfacetype'] == 'coa') {
// Enables virtual-server coa because interface-type is coa
- exec("ln -s " . FREERADIUS_BASE . "/etc/raddb/sites-available/coa " . FREERADIUS_BASE . "/etc/raddb/sites-enabled/");
+ exec("ln -s " . FREERADIUS_ETC . "/raddb/sites-available/coa " . FREERADIUS_ETC . "/raddb/sites-enabled/");
$conf .= <<<EOD
listen {
type = $varinterfacetype
@@ -369,7 +373,7 @@ instantiate {
EOD;
conf_mount_rw();
- file_put_contents(FREERADIUS_BASE . '/etc/raddb/radiusd.conf', $conf);
+ file_put_contents(FREERADIUS_ETC . '/raddb/radiusd.conf', $conf);
conf_mount_ro();
// "freeradius_sqlconf_resync" is pointing to this function because we need to run "freeradius_serverdefault_resync" and after that restart freeradius.
@@ -570,7 +574,7 @@ if (is_array($arrusers) && !empty($arrusers)) {
if ($varusersmaxtotaloctets != '') {
if ($varusersreplyitem != '') { $varusersreplyitem .=","; }
//create exec script
- $varusersreplyitem .= "\n\tExec-Program-Wait = " . '"/bin/sh ' . FREERADIUS_BASE . '/etc/raddb/scripts/datacounter_auth.sh ' . "$varusersusername $varusersmaxtotaloctetstimerange" . '"';
+ $varusersreplyitem .= "\n\tExec-Program-Wait = " . '"/bin/sh ' . FREERADIUS_ETC . '/raddb/scripts/datacounter_auth.sh ' . "$varusersusername $varusersmaxtotaloctetstimerange" . '"';
// create limit file - will be always overwritten so we can increase limit from GUI
exec("`echo $varusersmaxtotaloctets > /var/log/radacct/datacounter/$varusersmaxtotaloctetstimerange/max-octets-$varusersusername`");
// if used-octets file exist we do NOT overwrite this file!!!
@@ -598,7 +602,7 @@ EOD;
} //end foreach
} // end if
- $filename = FREERADIUS_BASE . '/etc/raddb/users';
+ $filename = FREERADIUS_ETC . '/raddb/users';
conf_mount_rw();
file_put_contents($filename, $conf);
chmod($filename, 0640);
@@ -764,7 +768,7 @@ if (is_array($arrmacs) && !empty($arrmacs)) {
if ($varmacsmaxtotaloctets != '') {
if ($varmacsreplyitem != '') { $varmacsreplyitem .=","; }
//create exec script
- $varmacsreplyitem .= "\n\tExec-Program-Wait = " . '"/bin/sh ' . FREERADIUS_BASE . '/etc/raddb/scripts/datacounter_auth.sh ' . "$varmacsaddress $varmacsmaxtotaloctetstimerange" . '"';
+ $varmacsreplyitem .= "\n\tExec-Program-Wait = " . '"/bin/sh ' . FREERADIUS_ETC . '/raddb/scripts/datacounter_auth.sh ' . "$varmacsaddress $varmacsmaxtotaloctetstimerange" . '"';
// create limit file - will be always overwritten so we can increase limit from GUI
exec("`echo $varmacsmaxtotaloctets > /var/log/radacct/datacounter/$varmacsmaxtotaloctetstimerange/max-octets-$varmacsaddress`");
// if used-octets file exist we do NOT overwrite this file!!!
@@ -792,7 +796,7 @@ EOD;
} //end foreach
} // end if
- $filename = FREERADIUS_BASE . '/etc/raddb/authorized_macs';
+ $filename = FREERADIUS_ETC . '/raddb/authorized_macs';
conf_mount_rw();
file_put_contents($filename, $conf);
chmod($filename, 0640);
@@ -863,7 +867,7 @@ EOD;
}
conf_mount_rw();
- file_put_contents(FREERADIUS_BASE . '/etc/raddb/clients.conf', $conf);
+ file_put_contents(FREERADIUS_ETC . '/raddb/clients.conf', $conf);
conf_mount_ro();
freeradius_sync_on_changes();
@@ -931,12 +935,12 @@ function freeradius_eapconf_resync() {
// This is for enable/disbable MS SoH in EAP-PEAP and the virtuial-server "soh-server"
if ($eapconf['vareapconfpeapsohenable'] == 'Enable') {
$vareapconfpeapsoh = 'soh = yes' . "\n\t\t\tsoh_virtual_server = " . '"' . "soh-server" . '"';
- exec("ln -s " . FREERADIUS_BASE . "/etc/raddb/sites-available/soh " . FREERADIUS_BASE . "/etc/raddb/sites-enabled/");
+ exec("ln -s " . FREERADIUS_ETC . "/raddb/sites-available/soh " . FREERADIUS_ETC . "/raddb/sites-enabled/");
}
else {
$vareapconfpeapsoh = '### MS SoH Server is disabled ###';
- if (file_exists(FREERADIUS_BASE . "/etc/raddb/sites-enabled/soh")) {
- exec("rm -f " . FREERADIUS_BASE . "/etc/raddb/sites-enabled/soh");
+ if (file_exists(FREERADIUS_ETC . "/raddb/sites-enabled/soh")) {
+ exec("rm -f " . FREERADIUS_ETC . "/raddb/sites-enabled/soh");
}
}
@@ -950,9 +954,9 @@ if ($eapconf['vareapconfchoosecertmanager'] == 'on') {
$ca_cert = lookup_ca($eapconf["ssl_ca_cert"]);
if ($ca_cert != false) {
if(base64_decode($ca_cert['prv'])) {
- file_put_contents(FREERADIUS_BASE . "/etc/raddb/certs/ca_key.pem",
+ file_put_contents(FREERADIUS_ETC . "/raddb/certs/ca_key.pem",
base64_decode($ca_cert['prv']));
- $conf['ssl_ca_key'] = FREERADIUS_BASE . '/etc/raddb/certs/ca_key.pem';
+ $conf['ssl_ca_key'] = FREERADIUS_ETC . '/raddb/certs/ca_key.pem';
}
@@ -965,24 +969,24 @@ if ($eapconf['vareapconfchoosecertmanager'] == 'on') {
else{
$check_crl="check_crl = no";
}
- file_put_contents(FREERADIUS_BASE . "/etc/raddb/certs/ca_cert.pem",
+ file_put_contents(FREERADIUS_ETC . "/raddb/certs/ca_cert.pem",
base64_decode($ca_cert['crt']). $crl);
- $conf['ssl_ca_cert'] = FREERADIUS_BASE . "/etc/raddb/certs/ca_cert.pem";
+ $conf['ssl_ca_cert'] = FREERADIUS_ETC . "/raddb/certs/ca_cert.pem";
}
$svr_cert = lookup_cert($eapconf["ssl_server_cert"]);
if ($svr_cert != false) {
if(base64_decode($svr_cert['prv'])) {
- file_put_contents(FREERADIUS_BASE . "/etc/raddb/certs/server_key.pem",
+ file_put_contents(FREERADIUS_ETC . "/raddb/certs/server_key.pem",
base64_decode($svr_cert['prv']));
- $conf['ssl_key'] = FREERADIUS_BASE . '/etc/raddb/certs/server_key.pem';
+ $conf['ssl_key'] = FREERADIUS_ETC . '/raddb/certs/server_key.pem';
}
}
if(base64_decode($svr_cert['crt'])) {
- file_put_contents(FREERADIUS_BASE . "/etc/raddb/certs/server_cert.pem",
+ file_put_contents(FREERADIUS_ETC . "/raddb/certs/server_cert.pem",
base64_decode($svr_cert['crt']));
- $conf['ssl_server_cert'] = FREERADIUS_BASE . "/etc/raddb/certs/server_cert.pem";
+ $conf['ssl_server_cert'] = FREERADIUS_ETC . "/raddb/certs/server_cert.pem";
}
/* Not needed anymore because pfsense can do this by default
@@ -990,23 +994,23 @@ if ($eapconf['vareapconfchoosecertmanager'] == 'on') {
$svr_cert = lookup_cert($eapconf["ssl_client_cert"]);
if ($svr_cert != false) {
if(base64_decode($svr_cert['prv'])) {
- file_put_contents(FREERADIUS_BASE . "/etc/raddb/certs/client_key.pem",
+ file_put_contents(FREERADIUS_ETC . "/raddb/certs/client_key.pem",
base64_decode($svr_cert['prv']));
- $conf['ssl_key'] = FREERADIUS_BASE . '/etc/raddb/certs/client_key.pem';
+ $conf['ssl_key'] = FREERADIUS_ETC . '/raddb/certs/client_key.pem';
}
}
if(base64_decode($svr_cert['crt'])) {
- file_put_contents(FREERADIUS_BASE . "/etc/raddb/certs/client_cert.pem",
+ file_put_contents(FREERADIUS_ETC . "/raddb/certs/client_cert.pem",
base64_decode($svr_cert['crt']));
- $conf['ssl_client_cert'] = FREERADIUS_BASE . "/etc/raddb/certs/client_cert.pem";
+ $conf['ssl_client_cert'] = FREERADIUS_ETC . "/raddb/certs/client_cert.pem";
}
- exec("openssl pkcs12 -export -in " . FREERADIUS_BASE . "/etc/raddb/certs/client_cert.pem -inkey " . FREERADIUS_BASE . "/etc/raddb/certs/client_key.pem -out " . FREERADIUS_BASE . "/etc/raddb/certs/client_cert.p12 -passout pass\:");
+ exec("openssl pkcs12 -export -in " . FREERADIUS_ETC . "/raddb/certs/client_cert.pem -inkey " . FREERADIUS_ETC . "/raddb/certs/client_key.pem -out " . FREERADIUS_ETC . "/raddb/certs/client_cert.p12 -passout pass\:");
}
*/
- $conf['ssl_cert_dir'] = FREERADIUS_BASE . '/etc/raddb/certs';
+ $conf['ssl_cert_dir'] = FREERADIUS_ETC . '/raddb/certs';
}
$vareapconfprivatekeyfile = 'server_key.pem';
@@ -1015,11 +1019,11 @@ if ($eapconf['vareapconfchoosecertmanager'] == 'on') {
// generate new DH and RANDOM file
// We create a single empty file just to check if there is really a change from one to another cert manager to avoid building ne DH and random files
- if (!file_exists(FREERADIUS_BASE . "/etc/raddb/certs/pfsense_cert_mgr")) {
- log_error("freeRADIUS: Switched to pfSense Cert-Manager. Creating new DH and random file in " . FREERADIUS_BASE . "/etc/raddb/certs");
- exec("cd " . FREERADIUS_BASE . "/etc/raddb/certs && openssl dhparam -out dh 1024");
- exec("cd " . FREERADIUS_BASE . "/etc/raddb/certs && dd if=/dev/urandom of=./random count=10");
- exec("touch " . FREERADIUS_BASE . "/etc/raddb/certs/pfsense_cert_mgr");
+ if (!file_exists(FREERADIUS_ETC . "/raddb/certs/pfsense_cert_mgr")) {
+ log_error("freeRADIUS: Switched to pfSense Cert-Manager. Creating new DH and random file in " . FREERADIUS_ETC . "/raddb/certs");
+ exec("cd " . FREERADIUS_ETC . "/raddb/certs && openssl dhparam -out dh 1024");
+ exec("cd " . FREERADIUS_ETC . "/raddb/certs && dd if=/dev/urandom of=./random count=10");
+ exec("touch " . FREERADIUS_ETC . "/raddb/certs/pfsense_cert_mgr");
}
}
@@ -1114,7 +1118,7 @@ else {
}
EOD;
- $filename = FREERADIUS_BASE . '/etc/raddb/eap.conf';
+ $filename = FREERADIUS_ETC . '/raddb/eap.conf';
file_put_contents($filename, $conf);
chmod($filename, 0640);
conf_mount_ro();
@@ -1280,7 +1284,7 @@ sql sql2 {
}
EOD;
- $filename = FREERADIUS_BASE . '/etc/raddb/sql.conf';
+ $filename = FREERADIUS_ETC . '/raddb/sql.conf';
conf_mount_rw();
file_put_contents($filename, $conf);
chmod($filename, 0640);
@@ -2128,7 +2132,7 @@ post-proxy {
}
EOD;
- $filename = FREERADIUS_BASE . '/etc/raddb/sites-available/default';
+ $filename = FREERADIUS_ETC . '/raddb/sites-available/default';
conf_mount_rw();
file_put_contents($filename, $conf);
chmod($filename, 0640);
@@ -2223,7 +2227,7 @@ authorityKeyIdentifier = keyid:always,issuer:always
basicConstraints = CA:true
EOD;
- $filename = FREERADIUS_BASE . '/etc/raddb/certs/ca.cnf';
+ $filename = FREERADIUS_ETC . '/raddb/certs/ca.cnf';
conf_mount_rw();
file_put_contents($filename, $conf);
chmod($filename, 0640);
@@ -2308,7 +2312,7 @@ emailAddress = $varcertsserveremailaddress
commonName = "$varcertsservercommonname"
EOD;
- $filename = FREERADIUS_BASE . '/etc/raddb/certs/server.cnf';
+ $filename = FREERADIUS_ETC . '/raddb/certs/server.cnf';
conf_mount_rw();
file_put_contents($filename, $conf);
chmod($filename, 0640);
@@ -2393,7 +2397,7 @@ emailAddress = $varcertsclientemailaddress
commonName = "$varcertsclientcommonname"
EOD;
- $filename = FREERADIUS_BASE . '/etc/raddb/certs/client.cnf';
+ $filename = FREERADIUS_ETC . '/raddb/certs/client.cnf';
conf_mount_rw();
file_put_contents($filename, $conf);
chmod($filename, 0640);
@@ -2426,12 +2430,12 @@ if ($eapconf['vareapconfchoosecertmanager'] == '') {
if ($arrcerts['varcertscreateclient'] == 'yes') {
// delete all old certificates and keys
- log_error("freeRADIUS: deleting all client.csr .crt .key .pem .tar in " . FREERADIUS_BASE . "/etc/raddb/certs");
- exec("rm -f " . FREERADIUS_BASE . "/etc/raddb/certs/client.csr");
- exec("rm -f " . FREERADIUS_BASE . "/etc/raddb/certs/client.crt");
- exec("rm -f " . FREERADIUS_BASE . "/etc/raddb/certs/client.key");
- exec("rm -f " . FREERADIUS_BASE . "/etc/raddb/certs/client.pem");
- exec("rm -f " . FREERADIUS_BASE . "/etc/raddb/certs/client.tar");
+ log_error("freeRADIUS: deleting all client.csr .crt .key .pem .tar in " . FREERADIUS_ETC . "/raddb/certs");
+ exec("rm -f " . FREERADIUS_ETC . "/raddb/certs/client.csr");
+ exec("rm -f " . FREERADIUS_ETC . "/raddb/certs/client.crt");
+ exec("rm -f " . FREERADIUS_ETC . "/raddb/certs/client.key");
+ exec("rm -f " . FREERADIUS_ETC . "/raddb/certs/client.pem");
+ exec("rm -f " . FREERADIUS_ETC . "/raddb/certs/client.tar");
// run fuction to create ONLY new client.cnf files based on user input from freeradiuscert.xml
@@ -2439,21 +2443,21 @@ if ($eapconf['vareapconfchoosecertmanager'] == '') {
// make bootstrap executable and run to create cert based on client.cnf files
- exec("chmod 0770 " . FREERADIUS_BASE . "/etc/raddb/certs/bootstrap");
- exec(FREERADIUS_BASE . "/etc/raddb/certs/bootstrap");
+ exec("chmod 0770 " . FREERADIUS_ETC . "/raddb/certs/bootstrap");
+ exec(FREERADIUS_ETC . "/raddb/certs/bootstrap");
// rename client generated XX.pem to client.pem // use regex to replace spaces and so on.
- $varserial = preg_replace("/\s/","",file_get_contents(FREERADIUS_BASE . '/etc/raddb/certs/serial.old'));
- if (file_exists(FREERADIUS_BASE . "/etc/raddb/certs/$varserial.pem"))
- rename(FREERADIUS_BASE . "/etc/raddb/certs/$varserial.pem",FREERADIUS_BASE . "/etc/raddb/certs/client.pem");
+ $varserial = preg_replace("/\s/","",file_get_contents(FREERADIUS_ETC . '/raddb/certs/serial.old'));
+ if (file_exists(FREERADIUS_ETC . "/raddb/certs/$varserial.pem"))
+ rename(FREERADIUS_ETC . "/raddb/certs/$varserial.pem",FREERADIUS_ETC . "/raddb/certs/client.pem");
// tar client-cert files
- exec("cd " . FREERADIUS_BASE . "/etc/raddb/certs && tar -cf client.tar client.crt client.csr client.key ca.der client.pem");
+ exec("cd " . FREERADIUS_ETC . "/raddb/certs && tar -cf client.tar client.crt client.csr client.key ca.der client.pem");
// Make all files in certs folder read/write only for root
- exec("chmod -R 0600 " . FREERADIUS_BASE . "/etc/raddb/certs/");
- log_error("freeRADIUS: Created new client.csr .crt .key .pem and added them together with ca.der in " . FREERADIUS_BASE . "/etc/raddb/certs/client.tar");
+ exec("chmod -R 0600 " . FREERADIUS_ETC . "/raddb/certs/");
+ log_error("freeRADIUS: Created new client.csr .crt .key .pem and added them together with ca.der in " . FREERADIUS_ETC . "/raddb/certs/client.tar");
}
}
else {
@@ -2461,18 +2465,18 @@ if ($eapconf['vareapconfchoosecertmanager'] == '') {
if ($arrcerts['varcertsdeleteall'] == 'yes') {
// delete all old certificates and keys - deletes certs from pfsense cert-manager IN THIS FOLDER, too.
- log_error("freeRADIUS: deleting all CA, Server and Client certs, DH, random and database files in " . FREERADIUS_BASE . "/etc/raddb/certs");
- exec("rm -f " . FREERADIUS_BASE . "/etc/raddb/certs/ca.pem && rm -f " . FREERADIUS_BASE . "/etc/raddb/certs/server.pem && rm -f " . FREERADIUS_BASE . "/etc/raddb/certs/client.pem");
- exec("rm -f " . FREERADIUS_BASE . "/etc/raddb/certs/ca.der && rm -f " . FREERADIUS_BASE . "/etc/raddb/certs/server.der && rm -f " . FREERADIUS_BASE . "/etc/raddb/certs/client.der");
- exec("rm -f " . FREERADIUS_BASE . "/etc/raddb/certs/ca.csr && rm -f " . FREERADIUS_BASE . "/etc/raddb/certs/server.csr && rm -f " . FREERADIUS_BASE . "/etc/raddb/certs/client.csr");
- exec("rm -f " . FREERADIUS_BASE . "/etc/raddb/certs/ca.crt && rm -f " . FREERADIUS_BASE . "/etc/raddb/certs/server.crt && rm -f " . FREERADIUS_BASE . "/etc/raddb/certs/client.crt");
- exec("rm -f " . FREERADIUS_BASE . "/etc/raddb/certs/ca.key && rm -f " . FREERADIUS_BASE . "/etc/raddb/certs/server.key && rm -f " . FREERADIUS_BASE . "/etc/raddb/certs/client.key");
- exec("rm -f " . FREERADIUS_BASE . "/etc/raddb/certs/ca.p12 && rm -f " . FREERADIUS_BASE . "/etc/raddb/certs/server.p12 && rm -f " . FREERADIUS_BASE . "/etc/raddb/certs/client.p12");
- exec("rm -f " . FREERADIUS_BASE . "/etc/raddb/certs/serial*");
- exec("rm -f " . FREERADIUS_BASE . "/etc/raddb/certs/index*");
- exec("rm -f " . FREERADIUS_BASE . "/etc/raddb/certs/dh");
- exec("rm -f " . FREERADIUS_BASE . "/etc/raddb/certs/random");
- exec("rm -f " . FREERADIUS_BASE . "/etc/raddb/certs/client.tar");
+ log_error("freeRADIUS: deleting all CA, Server and Client certs, DH, random and database files in " . FREERADIUS_ETC . "/raddb/certs");
+ exec("rm -f " . FREERADIUS_ETC . "/raddb/certs/ca.pem && rm -f " . FREERADIUS_ETC . "/raddb/certs/server.pem && rm -f " . FREERADIUS_ETC . "/raddb/certs/client.pem");
+ exec("rm -f " . FREERADIUS_ETC . "/raddb/certs/ca.der && rm -f " . FREERADIUS_ETC . "/raddb/certs/server.der && rm -f " . FREERADIUS_ETC . "/raddb/certs/client.der");
+ exec("rm -f " . FREERADIUS_ETC . "/raddb/certs/ca.csr && rm -f " . FREERADIUS_ETC . "/raddb/certs/server.csr && rm -f " . FREERADIUS_ETC . "/raddb/certs/client.csr");
+ exec("rm -f " . FREERADIUS_ETC . "/raddb/certs/ca.crt && rm -f " . FREERADIUS_ETC . "/raddb/certs/server.crt && rm -f " . FREERADIUS_ETC . "/raddb/certs/client.crt");
+ exec("rm -f " . FREERADIUS_ETC . "/raddb/certs/ca.key && rm -f " . FREERADIUS_ETC . "/raddb/certs/server.key && rm -f " . FREERADIUS_ETC . "/raddb/certs/client.key");
+ exec("rm -f " . FREERADIUS_ETC . "/raddb/certs/ca.p12 && rm -f " . FREERADIUS_ETC . "/raddb/certs/server.p12 && rm -f " . FREERADIUS_ETC . "/raddb/certs/client.p12");
+ exec("rm -f " . FREERADIUS_ETC . "/raddb/certs/serial*");
+ exec("rm -f " . FREERADIUS_ETC . "/raddb/certs/index*");
+ exec("rm -f " . FREERADIUS_ETC . "/raddb/certs/dh");
+ exec("rm -f " . FREERADIUS_ETC . "/raddb/certs/random");
+ exec("rm -f " . FREERADIUS_ETC . "/raddb/certs/client.tar");
// run fuctions to create new .cnf files based on user input from freeradiuscert.xml
@@ -2481,28 +2485,28 @@ if ($eapconf['vareapconfchoosecertmanager'] == '') {
freeradius_clientcertcnf_resync();
// this command deletes the pfsense_cert_mgr checkfile so when we change back to pfsense cert manager a new DH + random file will be created
- if (file_exists(FREERADIUS_BASE . "/etc/raddb/certs/pfsense_cert_mgr")) {
- unlink(FREERADIUS_BASE . "/etc/raddb/certs/pfsense_cert_mgr");
+ if (file_exists(FREERADIUS_ETC . "/raddb/certs/pfsense_cert_mgr")) {
+ unlink(FREERADIUS_ETC . "/raddb/certs/pfsense_cert_mgr");
}
// generate new DH and RANDOM file
- log_error("freeRADIUS: Creating new DH and random file in " . FREERADIUS_BASE . "/etc/raddb/certs");
- exec("cd " . FREERADIUS_BASE . "/etc/raddb/certs && openssl dhparam -out dh 1024");
- exec("cd " . FREERADIUS_BASE . "/etc/raddb/certs && dd if=/dev/urandom of=./random count=10");
+ log_error("freeRADIUS: Creating new DH and random file in " . FREERADIUS_ETC . "/raddb/certs");
+ exec("cd " . FREERADIUS_ETC . "/raddb/certs && openssl dhparam -out dh 1024");
+ exec("cd " . FREERADIUS_ETC . "/raddb/certs && dd if=/dev/urandom of=./random count=10");
- log_error("freeRADIUS: Creating new CA, Server and Client certs in " . FREERADIUS_BASE . "/etc/raddb/certs");
+ log_error("freeRADIUS: Creating new CA, Server and Client certs in " . FREERADIUS_ETC . "/raddb/certs");
// make bootstrap executable and run to create certs based on .cnf files
- exec("chmod 0770 " . FREERADIUS_BASE . "/etc/raddb/certs/bootstrap");
- exec(FREERADIUS_BASE . "/etc/raddb/certs/bootstrap");
+ exec("chmod 0770 " . FREERADIUS_ETC . "/raddb/certs/bootstrap");
+ exec(FREERADIUS_ETC . "/raddb/certs/bootstrap");
// rename client generated 02.pem to client.pem
- if (file_exists(FREERADIUS_BASE . "/etc/raddb/certs/02.pem"))
- rename(FREERADIUS_BASE . "/etc/raddb/certs/02.pem",FREERADIUS_BASE . "/etc/raddb/certs/client.pem");
+ if (file_exists(FREERADIUS_ETC . "/raddb/certs/02.pem"))
+ rename(FREERADIUS_ETC . "/raddb/certs/02.pem",FREERADIUS_ETC . "/raddb/certs/client.pem");
// tar client-cert files
- exec("cd " . FREERADIUS_BASE . "/etc/raddb/certs && tar -cf client.tar client.crt client.csr client.key ca.der client.pem");
- exec("chmod -R 0600 " . FREERADIUS_BASE . "/etc/raddb/certs/");
- log_error("freeRADIUS: Added client.csr .crt .key .pem together with ca.der in " . FREERADIUS_BASE . "/etc/raddb/certs/client.tar");
+ exec("cd " . FREERADIUS_ETC . "/raddb/certs && tar -cf client.tar client.crt client.csr client.key ca.der client.pem");
+ exec("chmod -R 0600 " . FREERADIUS_ETC . "/raddb/certs/");
+ log_error("freeRADIUS: Added client.csr .crt .key .pem together with ca.der in " . FREERADIUS_ETC . "/raddb/certs/client.tar");
// If there were changes on the certificates we need to restart freeradius
restart_service('radiusd');
@@ -2689,7 +2693,7 @@ function freeradius_all_after_XMLRPC_resync() {
log_error("FreeRADIUS: Finished XMLRPC process. It should be OK. For more information look at the host which started sync.");
- exec(FREERADIUS_BASE . "/etc/rc.d/radiusd onerestart");
+ exec(FREERADIUS_ETC . "/rc.d/radiusd onerestart");
}
function freeradius_modulescounter_resync() {
@@ -2812,7 +2816,7 @@ counter forever {
}
EOD;
- $filename = FREERADIUS_BASE . '/etc/raddb/modules/counter';
+ $filename = FREERADIUS_ETC . '/raddb/modules/counter';
conf_mount_rw();
file_put_contents($filename, $conf);
chmod($filename, 0640);
@@ -2906,7 +2910,7 @@ nt-response=%{%{mschap:NT-Response}:-00}"
}
EOD;
- $filename = FREERADIUS_BASE . '/etc/raddb/modules/mschap';
+ $filename = FREERADIUS_ETC . '/raddb/modules/mschap';
conf_mount_rw();
file_put_contents($filename, $conf);
chmod($filename, 0640);
@@ -2951,7 +2955,7 @@ realm ntdomain {
}
EOD;
- $filename = FREERADIUS_BASE . '/etc/raddb/modules/realm';
+ $filename = FREERADIUS_ETC . '/raddb/modules/realm';
conf_mount_rw();
file_put_contents($filename, $conf);
chmod($filename, 0640);
@@ -3004,37 +3008,37 @@ if($arrmodulesldap['varmodulesldapenabletlssupport'] == 'on') {
$ca_cert = lookup_ca($arrmodulesldap["ssl_ca_cert1"]);
if ($ca_cert != false) {
if(base64_decode($ca_cert['prv'])) {
- file_put_contents(FREERADIUS_BASE . "/etc/raddb/certs/ca_ldap1_key.pem",
+ file_put_contents(FREERADIUS_ETC . "/raddb/certs/ca_ldap1_key.pem",
base64_decode($ca_cert['prv']));
- $conf['ssl_ca_key'] = FREERADIUS_BASE . '/etc/raddb/certs/ca_ldap1_key.pem';
+ $conf['ssl_ca_key'] = FREERADIUS_ETC . '/raddb/certs/ca_ldap1_key.pem';
}
if(base64_decode($ca_cert['crt'])) {
- file_put_contents(FREERADIUS_BASE . "/etc/raddb/certs/ca_ldap1_cert.pem",
+ file_put_contents(FREERADIUS_ETC . "/raddb/certs/ca_ldap1_cert.pem",
base64_decode($ca_cert['crt']));
- $conf['ssl_ca_cert1'] = FREERADIUS_BASE . "/etc/raddb/certs/ca_ldap1_cert.pem";
+ $conf['ssl_ca_cert1'] = FREERADIUS_ETC . "/raddb/certs/ca_ldap1_cert.pem";
}
$svr_cert = lookup_cert($arrmodulesldap["ssl_server_cert1"]);
if ($svr_cert != false) {
if(base64_decode($svr_cert['prv'])) {
- file_put_contents(FREERADIUS_BASE . "/etc/raddb/certs/radius_ldap1_cert.key",
+ file_put_contents(FREERADIUS_ETC . "/raddb/certs/radius_ldap1_cert.key",
base64_decode($svr_cert['prv']));
- $conf['ssl_key'] = FREERADIUS_BASE . '/etc/raddb/certs/radius_ldap1_cert.key';
+ $conf['ssl_key'] = FREERADIUS_ETC . '/raddb/certs/radius_ldap1_cert.key';
}
}
if(base64_decode($svr_cert['crt'])) {
- file_put_contents(FREERADIUS_BASE . "/etc/raddb/certs/radius_ldap1_cert.crt",
+ file_put_contents(FREERADIUS_ETC . "/raddb/certs/radius_ldap1_cert.crt",
base64_decode($svr_cert['crt']));
- $conf['ssl_server_cert1'] = FREERADIUS_BASE . "/etc/raddb/certs/radius_ldap1_cert.crt";
+ $conf['ssl_server_cert1'] = FREERADIUS_ETC . "/raddb/certs/radius_ldap1_cert.crt";
}
- $conf['ssl_cert_dir'] = FREERADIUS_BASE . '/etc/raddb/certs';
+ $conf['ssl_cert_dir'] = FREERADIUS_ETC . '/raddb/certs';
}
$varmodulesldapstarttls = "yes";
}
@@ -3051,37 +3055,37 @@ if($arrmodulesldap['varmodulesldap2enabletlssupport'] == 'on') {
$ca_cert = lookup_ca($arrmodulesldap["ssl_ca_cert2"]);
if ($ca_cert != false) {
if(base64_decode($ca_cert['prv'])) {
- file_put_contents(FREERADIUS_BASE . "/etc/raddb/certs/ca_ldap2_key.pem",
+ file_put_contents(FREERADIUS_ETC . "/raddb/certs/ca_ldap2_key.pem",
base64_decode($ca_cert['prv']));
- $conf['ssl_ca_key'] = FREERADIUS_BASE . '/etc/raddb/certs/ca_ldap2_key.pem';
+ $conf['ssl_ca_key'] = FREERADIUS_ETC . '/raddb/certs/ca_ldap2_key.pem';
}
if(base64_decode($ca_cert['crt'])) {
- file_put_contents(FREERADIUS_BASE . "/etc/raddb/certs/ca_ldap2_cert.pem",
+ file_put_contents(FREERADIUS_ETC . "/raddb/certs/ca_ldap2_cert.pem",
base64_decode($ca_cert['crt']));
- $conf['ssl_ca_cert2'] = FREERADIUS_BASE . "/etc/raddb/certs/ca_ldap2_cert.pem";
+ $conf['ssl_ca_cert2'] = FREERADIUS_ETC . "/raddb/certs/ca_ldap2_cert.pem";
}
$svr_cert = lookup_cert($arrmodulesldap["ssl_server_cert2"]);
if ($svr_cert != false) {
if(base64_decode($svr_cert['prv'])) {
- file_put_contents(FREERADIUS_BASE . "/etc/raddb/certs/radius_ldap2_cert.key",
+ file_put_contents(FREERADIUS_ETC . "/raddb/certs/radius_ldap2_cert.key",
base64_decode($svr_cert['prv']));
- $conf['ssl_key'] = FREERADIUS_BASE . '/etc/raddb/certs/radius_ldap2_cert.key';
+ $conf['ssl_key'] = FREERADIUS_ETC . '/raddb/certs/radius_ldap2_cert.key';
}
}
if(base64_decode($svr_cert['crt'])) {
- file_put_contents(FREERADIUS_BASE . "/etc/raddb/certs/radius_ldap2_cert.crt",
+ file_put_contents(FREERADIUS_ETC . "/raddb/certs/radius_ldap2_cert.crt",
base64_decode($svr_cert['crt']));
- $conf['ssl_server_cert2'] = FREERADIUS_BASE . "/etc/raddb/certs/radius_ldap2_cert.crt";
+ $conf['ssl_server_cert2'] = FREERADIUS_ETC . "/raddb/certs/radius_ldap2_cert.crt";
}
- $conf['ssl_cert_dir'] = FREERADIUS_BASE . '/etc/raddb/certs';
+ $conf['ssl_cert_dir'] = FREERADIUS_ETC . '/raddb/certs';
}
$varmodulesldap2starttls = "yes";
}
@@ -3204,7 +3208,7 @@ else {
$varmodulesldap2keepaliveidle = ($arrmodulesldap['varmodulesldap2keepaliveidle']?$arrmodulesldap['varmodulesldap2keepaliveidle']:'60');
$varmodulesldap2keepaliveprobes = ($arrmodulesldap['varmodulesldap2keepaliveprobes']?$arrmodulesldap['varmodulesldap2keepaliveprobes']:'3');
$varmodulesldap2keepaliveinterval = ($arrmodulesldap['varmodulesldap2keepaliveinterval']?$arrmodulesldap['varmodulesldap2keepaliveinterval']:'3');
-$raddb = FREERADIUS_BASE . '/etc/raddb';
+$raddb = FREERADIUS_ETC . '/raddb';
$conf .= <<<EOD
# -*- text -*-
#
@@ -3555,7 +3559,7 @@ ldap ldap2{
}
EOD;
- $filename = FREERADIUS_BASE . '/etc/raddb/modules/ldap';
+ $filename = FREERADIUS_ETC . '/raddb/modules/ldap';
conf_mount_rw();
file_put_contents($filename, $conf);
chmod($filename, 0640);
@@ -3576,29 +3580,29 @@ function freeradius_plainmacauth_resync() {
$varsettings = $config['installedpackages']['freeradiussettings']['config'][0];
// defining variables with filename path
- $filepolicyconf = FREERADIUS_BASE . '/etc/raddb/policy.conf';
- $filepolicyconfbackup = FREERADIUS_BASE . '/etc/raddb/policy.conf.backup';
- $filemodulesfiles = FREERADIUS_BASE . '/etc/raddb/modules/files';
- $filemodulesfilesbackup = FREERADIUS_BASE . '/etc/raddb/files.backup';
+ $filepolicyconf = FREERADIUS_ETC . '/raddb/policy.conf';
+ $filepolicyconfbackup = FREERADIUS_ETC . '/raddb/policy.conf.backup';
+ $filemodulesfiles = FREERADIUS_ETC . '/raddb/modules/files';
+ $filemodulesfilesbackup = FREERADIUS_ETC . '/raddb/files.backup';
// If unchecked then plain mac auth is disabled and backups of the original files will be restored
if ($varsettings['varsettingsenablemacauth'] == '') {
// This is a check - only restore files if they aren't already
- if (file_exists(FREERADIUS_BASE . "/etc/raddb/plain_macauth_enabled")) {
+ if (file_exists(FREERADIUS_ETC . "/raddb/plain_macauth_enabled")) {
log_error("FreeRADIUS: Plain-MAC-Auth disabled. Restoring the original file from {$filepolicyconfbackup} and {$filemodulesfilesbackup}");
copy($filepolicyconfbackup, $filepolicyconf);
copy($filemodulesfilesbackup, $filemodulesfiles);
- unlink(FREERADIUS_BASE . "/etc/raddb/plain_macauth_enabled");
+ unlink(FREERADIUS_ETC . "/raddb/plain_macauth_enabled");
freeradius_serverdefault_resync();
}
}
// If checked then plain mac auth is enabled
else {
// This is a check - only modify files if they aren't already
- if (!file_exists(FREERADIUS_BASE . "/etc/raddb/plain_macauth_enabled")) {
+ if (!file_exists(FREERADIUS_ETC . "/raddb/plain_macauth_enabled")) {
freeradius_modulesfiles_resync();
freeradius_policyconf_resync();
- exec("cd " . FREERADIUS_BASE . "/etc/raddb && touch " . FREERADIUS_BASE . "/etc/raddb/plain_macauth_enabled");
+ exec("cd " . FREERADIUS_ETC . "/raddb && touch " . FREERADIUS_ETC . "/raddb/plain_macauth_enabled");
log_error("FreeRADIUS: Plain-MAC-Auth enabled. Modified {$filepolicyconf} and {$filemodulesfiles}");
freeradius_serverdefault_resync();
}
@@ -3660,7 +3664,7 @@ files authorized_macs {
}
EOD;
- $filename = FREERADIUS_BASE . '/etc/raddb/modules/files';
+ $filename = FREERADIUS_ETC . '/raddb/modules/files';
conf_mount_rw();
file_put_contents($filename, $conf);
chmod($filename, 0640);
@@ -3886,7 +3890,7 @@ policy {
}
EOD;
- $filename = FREERADIUS_BASE . '/etc/raddb/policy.conf';
+ $filename = FREERADIUS_ETC . '/raddb/policy.conf';
conf_mount_rw();
file_put_contents($filename, $conf);
chmod($filename, 0640);
@@ -3895,7 +3899,7 @@ EOD;
}
function freeradius_motp_resync() {
- global $config;
+ global $config, $bash_path;
$conf = '';
$varsettings = $config['installedpackages']['freeradiussettings']['config'][0];
@@ -3907,38 +3911,14 @@ function freeradius_motp_resync() {
$varsettingsmotpchecksumtype = ($varsettings['varsettingsmotpchecksumtype']?$varsettings['varsettingsmotpchecksumtype']:'md5');
$varsettingsmotptokenlength = ($varsettings['varsettingsmotptokenlength']?$varsettings['varsettingsmotptokenlength']:'1-6');
- // check if disabled then we delete bash und otpverify.sh script
+ // check if disabled then we delete otpverify.sh script
if ($varsettings['varsettingsmotpenable'] == '') {
- if (file_exists(FREERADIUS_BASE . "/etc/raddb/scripts/otpverify.sh")) {
- unlink(FREERADIUS_BASE . "/etc/raddb/scripts/otpverify.sh");
- }
- if (exec("cd /var/db/pkg && ls | grep bash") == "bash-4.1.7") {
- exec("cd /var/db/pkg && pkg_delete `ls | grep bash`");
- log_error('FreeRADIUS: Uninstalling package "bash-4.1.7" which comes with Mobile-One-Time-Password (motp).');
+ if (file_exists(FREERADIUS_ETC . "/raddb/scripts/otpverify.sh")) {
+ @unlink(FREERADIUS_ETC . "/raddb/scripts/otpverify.sh");
}
- if (exec("cd /var/db/pkg && ls | grep bash") == "bash-4.2.20") {
- exec("cd /var/db/pkg && pkg_delete `ls | grep bash`");
- log_error('FreeRADIUS: Uninstalling package "bash-4.2.20" which comes with Mobile-One-Time-Password (motp).');
- }
- }
-
- // check if enabled then we need to download "bash"
- else {
- if (substr(trim(file_get_contents("/etc/version")),0,3) == "2.0") {
- if (exec("cd /var/db/pkg && ls | grep bash") != "bash-4.1.7") {
- log_error('FreeRADIUS: Downloading and installing package "bash-4.1.7" to use Mobile-One-Time-Password (motp).');
- exec("pkg_add -r http://ftp-archive.freebsd.org/pub/FreeBSD-Archive/ports/`uname -m`/packages-8.1-release/All/bash-4.1.7.tbz");
- }
- } else {
- if (exec("cd /var/db/pkg && ls | grep bash") != "bash-4.2.20") {
- log_error('FreeRADIUS: Downloading and installing package "bash-4.2.20" to use Mobile-One-Time-Password (motp).');
- exec("pkg_add -r http://ftp-archive.freebsd.org/pub/FreeBSD/ports/`uname -m`/packages-8.3-release/All/bash-4.2.20.tbz");
- }
- }
-
-
- $conf .= <<<EOD
-#!/bin/bash
+ } else {
+ $conf .= <<<EOD
+#!{$bash_path}
#
# Mobile One Time Passwords (Mobile-OTP) for Java 2 Micro Edition, J2ME
# written by Matthias Straub, Heilbronn, Germany, 2003
@@ -4055,32 +4035,30 @@ exit 11
EOD;
- $filename = FREERADIUS_BASE . '/etc/raddb/scripts/otpverify.sh';
- conf_mount_rw();
- file_put_contents($filename, $conf);
- chmod($filename, 0750);
- conf_mount_ro();
-
- // end of above 'check if enabled then we need to download "bash"'
+ $filename = FREERADIUS_ETC . '/raddb/scripts/otpverify.sh';
+ conf_mount_rw();
+ file_put_contents($filename, $conf);
+ chmod($filename, 0750);
+ conf_mount_ro();
}
}
function freeradius_modulesmotp_resync() {
- global $config;
+ global $config, $bash_path;
$conf = '';
// put the constant to a variable
- $varFREERADIUS_BASE = FREERADIUS_BASE;
+ $varFREERADIUS_ETC = FREERADIUS_ETC;
$conf .= <<<EOD
exec motp {
wait = yes
- program = "/usr/local/bin/bash $varFREERADIUS_BASE/etc/raddb/scripts/otpverify.sh %{request:User-Name} %{request:User-Password} %{reply:MOTP-Init-Secret} %{reply:MOTP-PIN} %{reply:MOTP-Offset}"
+ program = "{$bash_path} {$varFREERADIUS_ETC}/raddb/scripts/otpverify.sh %{request:User-Name} %{request:User-Password} %{reply:MOTP-Init-Secret} %{reply:MOTP-PIN} %{reply:MOTP-Offset}"
}
EOD;
- $filename = FREERADIUS_BASE . '/etc/raddb/modules/motp';
+ $filename = FREERADIUS_ETC . '/raddb/modules/motp';
conf_mount_rw();
file_put_contents($filename, $conf);
chmod($filename, 0640);
@@ -4093,28 +4071,28 @@ function freeradius_modulesdatacounter_resync() {
$conf = '';
// put the constant to a variable
- $varFREERADIUS_BASE = FREERADIUS_BASE;
+ $varFREERADIUS_ETC = FREERADIUS_ETC;
$conf .= <<<EOD
exec datacounterdaily {
wait = yes
- program = "/bin/sh $varFREERADIUS_BASE/etc/raddb/scripts/datacounter_acct.sh %{request:User-Name} daily %{request:Acct-Input-Octets} %{request:Acct-Output-Octets}"
+ program = "/bin/sh {$varFREERADIUS_ETC}/raddb/scripts/datacounter_acct.sh %{request:User-Name} daily %{request:Acct-Input-Octets} %{request:Acct-Output-Octets}"
}
exec datacounterweekly {
wait = yes
- program = "/bin/sh $varFREERADIUS_BASE/etc/raddb/scripts/datacounter_acct.sh %{request:User-Name} weekly %{request:Acct-Input-Octets} %{request:Acct-Output-Octets}"
+ program = "/bin/sh {$varFREERADIUS_ETC}/raddb/scripts/datacounter_acct.sh %{request:User-Name} weekly %{request:Acct-Input-Octets} %{request:Acct-Output-Octets}"
}
exec datacountermonthly {
wait = yes
- program = "/bin/sh $varFREERADIUS_BASE/etc/raddb/scripts/datacounter_acct.sh %{request:User-Name} monthly %{request:Acct-Input-Octets} %{request:Acct-Output-Octets}"
+ program = "/bin/sh {$varFREERADIUS_ETC}/raddb/scripts/datacounter_acct.sh %{request:User-Name} monthly %{request:Acct-Input-Octets} %{request:Acct-Output-Octets}"
}
exec datacounterforever {
wait = yes
- program = "/bin/sh $varFREERADIUS_BASE/etc/raddb/scripts/datacounter_acct.sh %{request:User-Name} forever %{request:Acct-Input-Octets} %{request:Acct-Output-Octets}"
+ program = "/bin/sh {$varFREERADIUS_ETC}/raddb/scripts/datacounter_acct.sh %{request:User-Name} forever %{request:Acct-Input-Octets} %{request:Acct-Output-Octets}"
}
EOD;
- $filename = FREERADIUS_BASE . '/etc/raddb/modules/datacounter_acct';
+ $filename = FREERADIUS_ETC . '/raddb/modules/datacounter_acct';
conf_mount_rw();
file_put_contents($filename, $conf);
chmod($filename, 0640);
@@ -4153,7 +4131,7 @@ else
fi
EOD;
- $filename = FREERADIUS_BASE . '/etc/raddb/scripts/datacounter_auth.sh';
+ $filename = FREERADIUS_ETC . '/raddb/scripts/datacounter_auth.sh';
conf_mount_rw();
file_put_contents($filename, $conf);
chmod($filename, 0750);
@@ -4201,7 +4179,7 @@ fi
EOD;
- $filename = FREERADIUS_BASE . '/etc/raddb/scripts/datacounter_acct.sh';
+ $filename = FREERADIUS_ETC . '/raddb/scripts/datacounter_acct.sh';
conf_mount_rw();
file_put_contents($filename, $conf);
chmod($filename, 0750);
@@ -4269,7 +4247,7 @@ ATTRIBUTE MOTP-Offset 902 string
EOD;
- $filename = FREERADIUS_BASE . '/etc/raddb/dictionary';
+ $filename = FREERADIUS_ETC . '/raddb/dictionary';
conf_mount_rw();
file_put_contents($filename, $conf);
chmod($filename, 0640);
diff --git a/config/freeradius2/freeradius_view_config.php b/config/freeradius2/freeradius_view_config.php
index bfabd7fa..b2959783 100644
--- a/config/freeradius2/freeradius_view_config.php
+++ b/config/freeradius2/freeradius_view_config.php
@@ -33,10 +33,10 @@
require("guiconfig.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('RADDB', '/usr/local/etc/raddb');
-} else {
+if (substr(trim(file_get_contents("/etc/version")),0,3) == "2.1") {
define('RADDB', '/usr/pbi/freeradius-' . php_uname("m") . '/etc/raddb');
+} else {
+ define('RADDB', '/usr/pbi/freeradius-' . php_uname("m") . '/local/etc/raddb');
}
// End of system check
@@ -67,10 +67,6 @@ if ($_REQUEST['file']!=""){
get_file($_REQUEST['file']);
}
else{
- $pf_version=substr(trim(file_get_contents("/etc/version")),0,3);
- if ($pf_version < 2.0)
- $one_two = true;
-
$pgtitle = "FreeRADIUS: View Configuration";
include("head.inc");
@@ -78,10 +74,6 @@ else{
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<?php include("fbegin.inc"); ?>
- <?php if($one_two): ?>
- <p class="pgtitle"><?=$pgtitle?></font></p>
- <?php endif; ?>
-
<?php if ($savemsg) print_info_box($savemsg); ?>
<form action="freeradius_view_config.php" method="post">
diff --git a/config/freeradius2/freeradiussettings.xml b/config/freeradius2/freeradiussettings.xml
index 1d908ca4..99af4d4a 100644
--- a/config/freeradius2/freeradiussettings.xml
+++ b/config/freeradius2/freeradiussettings.xml
@@ -316,7 +316,7 @@
<field>
<fielddescr>Enable Mobile-One-Time-Password</fielddescr>
<fieldname>varsettingsmotpenable</fieldname>
- <description><![CDATA[This enables the possibility to authenticate against an username and an one-time-password. The client which generates OTP can be installed on various mobile device plattforms like Android and more. If you enable this the first time we need to download and install package "bash-4.1.7" so the process will need some time. (Default: unchecked)]]></description>
+ <description><![CDATA[This enables the possibility to authenticate against an username and an one-time-password. The client which generates OTP can be installed on various mobile device plattforms like Android and more. (Default: unchecked)]]></description>
<type>checkbox</type>
<enablefields>varsettingsmotptimespan,varsettingsmotppasswordattempts,varsettingsmotpchecksumtype,varsettingsmotptokenlength</enablefields>
</field>
diff --git a/config/freeswitch/begin_recording.wav b/config/freeswitch/begin_recording.wav
deleted file mode 100755
index 9e4992ca..00000000
--- a/config/freeswitch/begin_recording.wav
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch/call_forward_has_been_deleted.wav b/config/freeswitch/call_forward_has_been_deleted.wav
deleted file mode 100644
index ebe6ed36..00000000
--- a/config/freeswitch/call_forward_has_been_deleted.wav
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch/call_forward_has_been_set.wav b/config/freeswitch/call_forward_has_been_set.wav
deleted file mode 100644
index 58262852..00000000
--- a/config/freeswitch/call_forward_has_been_set.wav
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch/class.phpmailer.tmp b/config/freeswitch/class.phpmailer.tmp
deleted file mode 100755
index 2ddc30fd..00000000
--- a/config/freeswitch/class.phpmailer.tmp
+++ /dev/null
@@ -1,1896 +0,0 @@
-<?php
-/*~ class.phpmailer.php
-.---------------------------------------------------------------------------.
-| Software: PHPMailer - PHP email class |
-| Version: 2.0.2 |
-| Contact: via sourceforge.net support pages (also www.codeworxtech.com) |
-| Info: http://phpmailer.sourceforge.net |
-| Support: http://sourceforge.net/projects/phpmailer/ |
-| ------------------------------------------------------------------------- |
-| Author: Andy Prevost (project admininistrator) |
-| Author: Brent R. Matzelle (original founder) |
-| Copyright (c) 2004-2007, Andy Prevost. All Rights Reserved. |
-| Copyright (c) 2001-2003, Brent R. Matzelle |
-| ------------------------------------------------------------------------- |
-| License: Distributed under the Lesser General Public License (LGPL) |
-| http://www.gnu.org/copyleft/lesser.html |
-| This program is distributed in the hope that it will be useful - WITHOUT |
-| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
-| FITNESS FOR A PARTICULAR PURPOSE. |
-| ------------------------------------------------------------------------- |
-| We offer a number of paid services (www.codeworxtech.com): |
-| - Web Hosting on highly optimized fast and secure servers |
-| - Technology Consulting |
-| - Oursourcing (highly qualified programmers and graphic designers) |
-'---------------------------------------------------------------------------'
-
-/**
- * PHPMailer - PHP email transport class
- * @package PHPMailer
- * @author Andy Prevost
- * @copyright 2004 - 2008 Andy Prevost
- */
-
-class PHPMailer {
-
- /////////////////////////////////////////////////
- // PROPERTIES, PUBLIC
- /////////////////////////////////////////////////
-
- /**
- * Email priority (1 = High, 3 = Normal, 5 = low).
- * @var int
- */
- var $Priority = 3;
-
- /**
- * Sets the CharSet of the message.
- * @var string
- */
- var $CharSet = 'iso-8859-1';
-
- /**
- * Sets the Content-type of the message.
- * @var string
- */
- var $ContentType = 'text/plain';
-
- /**
- * Sets the Encoding of the message. Options for this are "8bit",
- * "7bit", "binary", "base64", and "quoted-printable".
- * @var string
- */
- var $Encoding = '8bit';
-
- /**
- * Holds the most recent mailer error message.
- * @var string
- */
- var $ErrorInfo = '';
-
- /**
- * Sets the From email address for the message.
- * @var string
- */
- var $From = 'root@localhost';
-
- /**
- * Sets the From name of the message.
- * @var string
- */
- var $FromName = 'Root User';
-
- /**
- * Sets the Sender email (Return-Path) of the message. If not empty,
- * will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
- * @var string
- */
- var $Sender = '';
-
- /**
- * Sets the Subject of the message.
- * @var string
- */
- var $Subject = '';
-
- /**
- * Sets the Body of the message. This can be either an HTML or text body.
- * If HTML then run IsHTML(true).
- * @var string
- */
- var $Body = '';
-
- /**
- * Sets the text-only body of the message. This automatically sets the
- * email to multipart/alternative. This body can be read by mail
- * clients that do not have HTML email capability such as mutt. Clients
- * that can read HTML will view the normal Body.
- * @var string
- */
- var $AltBody = '';
-
- /**
- * Sets word wrapping on the body of the message to a given number of
- * characters.
- * @var int
- */
- var $WordWrap = 0;
-
- /**
- * Method to send mail: ("mail", "sendmail", or "smtp").
- * @var string
- */
- var $Mailer = 'mail';
-
- /**
- * Sets the path of the sendmail program.
- * @var string
- */
- var $Sendmail = '/usr/sbin/sendmail';
-
- /**
- * Path to PHPMailer plugins. This is now only useful if the SMTP class
- * is in a different directory than the PHP include path.
- * @var string
- */
- var $PluginDir = '';
-
- /**
- * Holds PHPMailer version.
- * @var string
- */
- var $Version = "2.0.2";
-
- /**
- * Sets the email address that a reading confirmation will be sent.
- * @var string
- */
- var $ConfirmReadingTo = '';
-
- /**
- * Sets the hostname to use in Message-Id and Received headers
- * and as default HELO string. If empty, the value returned
- * by SERVER_NAME is used or 'localhost.localdomain'.
- * @var string
- */
- var $Hostname = '';
-
- /**
- * Sets the message ID to be used in the Message-Id header.
- * If empty, a unique id will be generated.
- * @var string
- */
- var $MessageID = '';
-
- /////////////////////////////////////////////////
- // PROPERTIES FOR SMTP
- /////////////////////////////////////////////////
-
- /**
- * Sets the SMTP hosts. All hosts must be separated by a
- * semicolon. You can also specify a different port
- * for each host by using this format: [hostname:port]
- * (e.g. "smtp1.example.com:25;smtp2.example.com").
- * Hosts will be tried in order.
- * @var string
- */
- var $Host = 'localhost';
-
- /**
- * Sets the default SMTP server port.
- * @var int
- */
- var $Port = 25;
-
- /**
- * Sets the SMTP HELO of the message (Default is $Hostname).
- * @var string
- */
- var $Helo = '';
-
- /**
- * Sets connection prefix.
- * Options are "", "ssl" or "tls"
- * @var string
- */
- var $SMTPSecure = "";
-
- /**
- * Sets SMTP authentication. Utilizes the Username and Password variables.
- * @var bool
- */
- var $SMTPAuth = false;
-
- /**
- * Sets SMTP username.
- * @var string
- */
- var $Username = '';
-
- /**
- * Sets SMTP password.
- * @var string
- */
- var $Password = '';
-
- /**
- * Sets the SMTP server timeout in seconds. This function will not
- * work with the win32 version.
- * @var int
- */
- var $Timeout = 10;
-
- /**
- * Sets SMTP class debugging on or off.
- * @var bool
- */
- var $SMTPDebug = false;
-
- /**
- * Prevents the SMTP connection from being closed after each mail
- * sending. If this is set to true then to close the connection
- * requires an explicit call to SmtpClose().
- * @var bool
- */
- var $SMTPKeepAlive = false;
-
- /**
- * Provides the ability to have the TO field process individual
- * emails, instead of sending to entire TO addresses
- * @var bool
- */
- var $SingleTo = false;
-
- /////////////////////////////////////////////////
- // PROPERTIES, PRIVATE
- /////////////////////////////////////////////////
-
- var $smtp = NULL;
- var $to = array();
- var $cc = array();
- var $bcc = array();
- var $ReplyTo = array();
- var $attachment = array();
- var $CustomHeader = array();
- var $message_type = '';
- var $boundary = array();
- var $language = array();
- var $error_count = 0;
- var $LE = "\n";
- var $sign_key_file = "";
- var $sign_key_pass = "";
-
- /////////////////////////////////////////////////
- // METHODS, VARIABLES
- /////////////////////////////////////////////////
-
- /**
- * Sets message type to HTML.
- * @param bool $bool
- * @return void
- */
- function IsHTML($bool) {
- if($bool == true) {
- $this->ContentType = 'text/html';
- } else {
- $this->ContentType = 'text/plain';
- }
- }
-
- /**
- * Sets Mailer to send message using SMTP.
- * @return void
- */
- function IsSMTP() {
- $this->Mailer = 'smtp';
- }
-
- /**
- * Sets Mailer to send message using PHP mail() function.
- * @return void
- */
- function IsMail() {
- $this->Mailer = 'mail';
- }
-
- /**
- * Sets Mailer to send message using the $Sendmail program.
- * @return void
- */
- function IsSendmail() {
- $this->Mailer = 'sendmail';
- }
-
- /**
- * Sets Mailer to send message using the qmail MTA.
- * @return void
- */
- function IsQmail() {
- $this->Sendmail = '/var/qmail/bin/sendmail';
- $this->Mailer = 'sendmail';
- }
-
- /////////////////////////////////////////////////
- // METHODS, RECIPIENTS
- /////////////////////////////////////////////////
-
- /**
- * Adds a "To" address.
- * @param string $address
- * @param string $name
- * @return void
- */
- function AddAddress($address, $name = '') {
- $cur = count($this->to);
- $this->to[$cur][0] = trim($address);
- $this->to[$cur][1] = $name;
- }
-
- /**
- * Adds a "Cc" address. Note: this function works
- * with the SMTP mailer on win32, not with the "mail"
- * mailer.
- * @param string $address
- * @param string $name
- * @return void
- */
- function AddCC($address, $name = '') {
- $cur = count($this->cc);
- $this->cc[$cur][0] = trim($address);
- $this->cc[$cur][1] = $name;
- }
-
- /**
- * Adds a "Bcc" address. Note: this function works
- * with the SMTP mailer on win32, not with the "mail"
- * mailer.
- * @param string $address
- * @param string $name
- * @return void
- */
- function AddBCC($address, $name = '') {
- $cur = count($this->bcc);
- $this->bcc[$cur][0] = trim($address);
- $this->bcc[$cur][1] = $name;
- }
-
- /**
- * Adds a "Reply-To" address.
- * @param string $address
- * @param string $name
- * @return void
- */
- function AddReplyTo($address, $name = '') {
- $cur = count($this->ReplyTo);
- $this->ReplyTo[$cur][0] = trim($address);
- $this->ReplyTo[$cur][1] = $name;
- }
-
- /////////////////////////////////////////////////
- // METHODS, MAIL SENDING
- /////////////////////////////////////////////////
-
- /**
- * Creates message and assigns Mailer. If the message is
- * not sent successfully then it returns false. Use the ErrorInfo
- * variable to view description of the error.
- * @return bool
- */
- function Send() {
- $header = '';
- $body = '';
- $result = true;
-
- if((count($this->to) + count($this->cc) + count($this->bcc)) < 1) {
- $this->SetError($this->Lang('provide_address'));
- return false;
- }
-
- /* Set whether the message is multipart/alternative */
- if(!empty($this->AltBody)) {
- $this->ContentType = 'multipart/alternative';
- }
-
- $this->error_count = 0; // reset errors
- $this->SetMessageType();
- $header .= $this->CreateHeader();
- $body = $this->CreateBody();
-
- if($body == '') {
- return false;
- }
-
- /* Choose the mailer */
- switch($this->Mailer) {
- case 'sendmail':
- $result = $this->SendmailSend($header, $body);
- break;
- case 'smtp':
- $result = $this->SmtpSend($header, $body);
- break;
- case 'mail':
- $result = $this->MailSend($header, $body);
- break;
- default:
- $result = $this->MailSend($header, $body);
- break;
- //$this->SetError($this->Mailer . $this->Lang('mailer_not_supported'));
- //$result = false;
- //break;
- }
-
- return $result;
- }
-
- /**
- * Sends mail using the $Sendmail program.
- * @access private
- * @return bool
- */
- function SendmailSend($header, $body) {
- if ($this->Sender != '') {
- $sendmail = sprintf("%s -oi -f %s -t", escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
- } else {
- $sendmail = sprintf("%s -oi -t", escapeshellcmd($this->Sendmail));
- }
-
- if(!@$mail = popen($sendmail, 'w')) {
- $this->SetError($this->Lang('execute') . $this->Sendmail);
- return false;
- }
-
- fputs($mail, $header);
- fputs($mail, $body);
-
- $result = pclose($mail);
- if (version_compare(phpversion(), '4.2.3') == -1) {
- $result = $result >> 8 & 0xFF;
- }
- if($result != 0) {
- $this->SetError($this->Lang('execute') . $this->Sendmail);
- return false;
- }
- return true;
- }
-
- /**
- * Sends mail using the PHP mail() function.
- * @access private
- * @return bool
- */
- function MailSend($header, $body) {
-
- $to = '';
- for($i = 0; $i < count($this->to); $i++) {
- if($i != 0) { $to .= ', '; }
- $to .= $this->AddrFormat($this->to[$i]);
- }
-
- $toArr = split(',', $to);
-
- $params = sprintf("-oi -f %s", $this->Sender);
- if ($this->Sender != '' && strlen(ini_get('safe_mode')) < 1) {
- $old_from = ini_get('sendmail_from');
- ini_set('sendmail_from', $this->Sender);
- if ($this->SingleTo === true && count($toArr) > 1) {
- foreach ($toArr as $key => $val) {
- $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
- }
- } else {
- $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
- }
- } else {
- if ($this->SingleTo === true && count($toArr) > 1) {
- foreach ($toArr as $key => $val) {
- $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
- }
- } else {
- $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header);
- }
- }
-
- if (isset($old_from)) {
- ini_set('sendmail_from', $old_from);
- }
-
- if(!$rt) {
- $this->SetError($this->Lang('instantiate'));
- return false;
- }
-
- return true;
- }
-
- /**
- * Sends mail via SMTP using PhpSMTP (Author:
- * Chris Ryan). Returns bool. Returns false if there is a
- * bad MAIL FROM, RCPT, or DATA input.
- * @access private
- * @return bool
- */
- function SmtpSend($header, $body) {
- include_once($this->PluginDir . 'class.smtp.php');
- $error = '';
- $bad_rcpt = array();
-
- if(!$this->SmtpConnect()) {
- return false;
- }
-
- $smtp_from = ($this->Sender == '') ? $this->From : $this->Sender;
- if(!$this->smtp->Mail($smtp_from)) {
- $error = $this->Lang('from_failed') . $smtp_from;
- $this->SetError($error);
- $this->smtp->Reset();
- return false;
- }
-
- /* Attempt to send attach all recipients */
- for($i = 0; $i < count($this->to); $i++) {
- if(!$this->smtp->Recipient($this->to[$i][0])) {
- $bad_rcpt[] = $this->to[$i][0];
- }
- }
- for($i = 0; $i < count($this->cc); $i++) {
- if(!$this->smtp->Recipient($this->cc[$i][0])) {
- $bad_rcpt[] = $this->cc[$i][0];
- }
- }
- for($i = 0; $i < count($this->bcc); $i++) {
- if(!$this->smtp->Recipient($this->bcc[$i][0])) {
- $bad_rcpt[] = $this->bcc[$i][0];
- }
- }
-
- if(count($bad_rcpt) > 0) { // Create error message
- for($i = 0; $i < count($bad_rcpt); $i++) {
- if($i != 0) {
- $error .= ', ';
- }
- $error .= $bad_rcpt[$i];
- }
- $error = $this->Lang('recipients_failed') . $error;
- $this->SetError($error);
- $this->smtp->Reset();
- return false;
- }
-
- if(!$this->smtp->Data($header . $body)) {
- $this->SetError($this->Lang('data_not_accepted'));
- $this->smtp->Reset();
- return false;
- }
- if($this->SMTPKeepAlive == true) {
- $this->smtp->Reset();
- } else {
- $this->SmtpClose();
- }
-
- return true;
- }
-
- /**
- * Initiates a connection to an SMTP server. Returns false if the
- * operation failed.
- * @access private
- * @return bool
- */
- function SmtpConnect() {
- if($this->smtp == NULL) {
- $this->smtp = new SMTP();
- }
-
- $this->smtp->do_debug = $this->SMTPDebug;
- $hosts = explode(';', $this->Host);
- $index = 0;
- $connection = ($this->smtp->Connected());
-
- /* Retry while there is no connection */
- while($index < count($hosts) && $connection == false) {
- $hostinfo = array();
- if(eregi('^(.+):([0-9]+)$', $hosts[$index], $hostinfo)) {
- $host = $hostinfo[1];
- $port = $hostinfo[2];
- } else {
- $host = $hosts[$index];
- $port = $this->Port;
- }
-
- if($this->smtp->Connect(((!empty($this->SMTPSecure))?$this->SMTPSecure.'://':'').$host, $port, $this->Timeout)) {
- if ($this->Helo != '') {
- $this->smtp->Hello($this->Helo);
- } else {
- $this->smtp->Hello($this->ServerHostname());
- }
-
- $connection = true;
- if($this->SMTPAuth) {
- if(!$this->smtp->Authenticate($this->Username, $this->Password)) {
- $this->SetError($this->Lang('authenticate'));
- $this->smtp->Reset();
- $connection = false;
- }
- }
- }
- $index++;
- }
- if(!$connection) {
- $this->SetError($this->Lang('connect_host'));
- }
-
- return $connection;
- }
-
- /**
- * Closes the active SMTP session if one exists.
- * @return void
- */
- function SmtpClose() {
- if($this->smtp != NULL) {
- if($this->smtp->Connected()) {
- $this->smtp->Quit();
- $this->smtp->Close();
- }
- }
- }
-
- /**
- * Sets the language for all class error messages. Returns false
- * if it cannot load the language file. The default language type
- * is English.
- * @param string $lang_type Type of language (e.g. Portuguese: "br")
- * @param string $lang_path Path to the language file directory
- * @access public
- * @return bool
- */
- function SetLanguage($lang_type, $lang_path = 'language/') {
- if(file_exists($lang_path.'phpmailer.lang-'.$lang_type.'.php')) {
- include($lang_path.'phpmailer.lang-'.$lang_type.'.php');
- } elseif (file_exists($lang_path.'phpmailer.lang-en.php')) {
- include($lang_path.'phpmailer.lang-en.php');
- } else {
- $this->SetError('Could not load language file');
- return false;
- }
- $this->language = $PHPMAILER_LANG;
-
- return true;
- }
-
- /////////////////////////////////////////////////
- // METHODS, MESSAGE CREATION
- /////////////////////////////////////////////////
-
- /**
- * Creates recipient headers.
- * @access private
- * @return string
- */
- function AddrAppend($type, $addr) {
- $addr_str = $type . ': ';
- $addr_str .= $this->AddrFormat($addr[0]);
- if(count($addr) > 1) {
- for($i = 1; $i < count($addr); $i++) {
- $addr_str .= ', ' . $this->AddrFormat($addr[$i]);
- }
- }
- $addr_str .= $this->LE;
-
- return $addr_str;
- }
-
- /**
- * Formats an address correctly.
- * @access private
- * @return string
- */
- function AddrFormat($addr) {
- if(empty($addr[1])) {
- $formatted = $this->SecureHeader($addr[0]);
- } else {
- $formatted = $this->EncodeHeader($this->SecureHeader($addr[1]), 'phrase') . " <" . $this->SecureHeader($addr[0]) . ">";
- }
-
- return $formatted;
- }
-
- /**
- * Wraps message for use with mailers that do not
- * automatically perform wrapping and for quoted-printable.
- * Original written by philippe.
- * @access private
- * @return string
- */
- function WrapText($message, $length, $qp_mode = false) {
- $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE;
- // If utf-8 encoding is used, we will need to make sure we don't
- // split multibyte characters when we wrap
- $is_utf8 = (strtolower($this->CharSet) == "utf-8");
-
- $message = $this->FixEOL($message);
- if (substr($message, -1) == $this->LE) {
- $message = substr($message, 0, -1);
- }
-
- $line = explode($this->LE, $message);
- $message = '';
- for ($i=0 ;$i < count($line); $i++) {
- $line_part = explode(' ', $line[$i]);
- $buf = '';
- for ($e = 0; $e<count($line_part); $e++) {
- $word = $line_part[$e];
- if ($qp_mode and (strlen($word) > $length)) {
- $space_left = $length - strlen($buf) - 1;
- if ($e != 0) {
- if ($space_left > 20) {
- $len = $space_left;
- if ($is_utf8) {
- $len = $this->UTF8CharBoundary($word, $len);
- } elseif (substr($word, $len - 1, 1) == "=") {
- $len--;
- } elseif (substr($word, $len - 2, 1) == "=") {
- $len -= 2;
- }
- $part = substr($word, 0, $len);
- $word = substr($word, $len);
- $buf .= ' ' . $part;
- $message .= $buf . sprintf("=%s", $this->LE);
- } else {
- $message .= $buf . $soft_break;
- }
- $buf = '';
- }
- while (strlen($word) > 0) {
- $len = $length;
- if ($is_utf8) {
- $len = $this->UTF8CharBoundary($word, $len);
- } elseif (substr($word, $len - 1, 1) == "=") {
- $len--;
- } elseif (substr($word, $len - 2, 1) == "=") {
- $len -= 2;
- }
- $part = substr($word, 0, $len);
- $word = substr($word, $len);
-
- if (strlen($word) > 0) {
- $message .= $part . sprintf("=%s", $this->LE);
- } else {
- $buf = $part;
- }
- }
- } else {
- $buf_o = $buf;
- $buf .= ($e == 0) ? $word : (' ' . $word);
-
- if (strlen($buf) > $length and $buf_o != '') {
- $message .= $buf_o . $soft_break;
- $buf = $word;
- }
- }
- }
- $message .= $buf . $this->LE;
- }
-
- return $message;
- }
-
- /**
- * Finds last character boundary prior to maxLength in a utf-8
- * quoted (printable) encoded string.
- * Original written by Colin Brown.
- * @access private
- * @param string $encodedText utf-8 QP text
- * @param int $maxLength find last character boundary prior to this length
- * @return int
- */
- function UTF8CharBoundary($encodedText, $maxLength) {
- $foundSplitPos = false;
- $lookBack = 3;
- while (!$foundSplitPos) {
- $lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack);
- $encodedCharPos = strpos($lastChunk, "=");
- if ($encodedCharPos !== false) {
- // Found start of encoded character byte within $lookBack block.
- // Check the encoded byte value (the 2 chars after the '=')
- $hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2);
- $dec = hexdec($hex);
- if ($dec < 128) { // Single byte character.
- // If the encoded char was found at pos 0, it will fit
- // otherwise reduce maxLength to start of the encoded char
- $maxLength = ($encodedCharPos == 0) ? $maxLength :
- $maxLength - ($lookBack - $encodedCharPos);
- $foundSplitPos = true;
- } elseif ($dec >= 192) { // First byte of a multi byte character
- // Reduce maxLength to split at start of character
- $maxLength = $maxLength - ($lookBack - $encodedCharPos);
- $foundSplitPos = true;
- } elseif ($dec < 192) { // Middle byte of a multi byte character, look further back
- $lookBack += 3;
- }
- } else {
- // No encoded character found
- $foundSplitPos = true;
- }
- }
- return $maxLength;
- }
-
- /**
- * Set the body wrapping.
- * @access private
- * @return void
- */
- function SetWordWrap() {
- if($this->WordWrap < 1) {
- return;
- }
-
- switch($this->message_type) {
- case 'alt':
- /* fall through */
- case 'alt_attachments':
- $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap);
- break;
- default:
- $this->Body = $this->WrapText($this->Body, $this->WordWrap);
- break;
- }
- }
-
- /**
- * Assembles message header.
- * @access private
- * @return string
- */
- function CreateHeader() {
- $result = '';
-
- /* Set the boundaries */
- $uniq_id = md5(uniqid(time()));
- $this->boundary[1] = 'b1_' . $uniq_id;
- $this->boundary[2] = 'b2_' . $uniq_id;
-
- $result .= $this->HeaderLine('Date', $this->RFCDate());
- if($this->Sender == '') {
- $result .= $this->HeaderLine('Return-Path', trim($this->From));
- } else {
- $result .= $this->HeaderLine('Return-Path', trim($this->Sender));
- }
-
- /* To be created automatically by mail() */
- if($this->Mailer != 'mail') {
- if(count($this->to) > 0) {
- $result .= $this->AddrAppend('To', $this->to);
- } elseif (count($this->cc) == 0) {
- $result .= $this->HeaderLine('To', 'undisclosed-recipients:;');
- }
- if(count($this->cc) > 0) {
- $result .= $this->AddrAppend('Cc', $this->cc);
- }
- }
-
- $from = array();
- $from[0][0] = trim($this->From);
- $from[0][1] = $this->FromName;
- $result .= $this->AddrAppend('From', $from);
-
- /* sendmail and mail() extract Cc from the header before sending */
- if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->cc) > 0)) {
- $result .= $this->AddrAppend('Cc', $this->cc);
- }
-
- /* sendmail and mail() extract Bcc from the header before sending */
- if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->bcc) > 0)) {
- $result .= $this->AddrAppend('Bcc', $this->bcc);
- }
-
- if(count($this->ReplyTo) > 0) {
- $result .= $this->AddrAppend('Reply-To', $this->ReplyTo);
- }
-
- /* mail() sets the subject itself */
- if($this->Mailer != 'mail') {
- $result .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader($this->Subject)));
- }
-
- if($this->MessageID != '') {
- $result .= $this->HeaderLine('Message-ID',$this->MessageID);
- } else {
- $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE);
- }
- $result .= $this->HeaderLine('X-Priority', $this->Priority);
- $result .= $this->HeaderLine('X-Mailer', 'PHPMailer (phpmailer.sourceforge.net) [version ' . $this->Version . ']');
-
- if($this->ConfirmReadingTo != '') {
- $result .= $this->HeaderLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>');
- }
-
- // Add custom headers
- for($index = 0; $index < count($this->CustomHeader); $index++) {
- $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), $this->EncodeHeader(trim($this->CustomHeader[$index][1])));
- }
- if (!$this->sign_key_file) {
- $result .= $this->HeaderLine('MIME-Version', '1.0');
- $result .= $this->GetMailMIME();
- }
-
- return $result;
- }
-
- /**
- * Returns the message MIME.
- * @access private
- * @return string
- */
- function GetMailMIME() {
- $result = '';
- switch($this->message_type) {
- case 'plain':
- $result .= $this->HeaderLine('Content-Transfer-Encoding', $this->Encoding);
- $result .= sprintf("Content-Type: %s; charset=\"%s\"", $this->ContentType, $this->CharSet);
- break;
- case 'attachments':
- /* fall through */
- case 'alt_attachments':
- if($this->InlineImageExists()){
- $result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", 'multipart/related', $this->LE, $this->LE, $this->boundary[1], $this->LE);
- } else {
- $result .= $this->HeaderLine('Content-Type', 'multipart/mixed;');
- $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
- }
- break;
- case 'alt':
- $result .= $this->HeaderLine('Content-Type', 'multipart/alternative;');
- $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
- break;
- }
-
- if($this->Mailer != 'mail') {
- $result .= $this->LE.$this->LE;
- }
-
- return $result;
- }
-
- /**
- * Assembles the message body. Returns an empty string on failure.
- * @access private
- * @return string
- */
- function CreateBody() {
- $result = '';
- if ($this->sign_key_file) {
- $result .= $this->GetMailMIME();
- }
-
- $this->SetWordWrap();
-
- switch($this->message_type) {
- case 'alt':
- $result .= $this->GetBoundary($this->boundary[1], '', 'text/plain', '');
- $result .= $this->EncodeString($this->AltBody, $this->Encoding);
- $result .= $this->LE.$this->LE;
- $result .= $this->GetBoundary($this->boundary[1], '', 'text/html', '');
- $result .= $this->EncodeString($this->Body, $this->Encoding);
- $result .= $this->LE.$this->LE;
- $result .= $this->EndBoundary($this->boundary[1]);
- break;
- case 'plain':
- $result .= $this->EncodeString($this->Body, $this->Encoding);
- break;
- case 'attachments':
- $result .= $this->GetBoundary($this->boundary[1], '', '', '');
- $result .= $this->EncodeString($this->Body, $this->Encoding);
- $result .= $this->LE;
- $result .= $this->AttachAll();
- break;
- case 'alt_attachments':
- $result .= sprintf("--%s%s", $this->boundary[1], $this->LE);
- $result .= sprintf("Content-Type: %s;%s" . "\tboundary=\"%s\"%s", 'multipart/alternative', $this->LE, $this->boundary[2], $this->LE.$this->LE);
- $result .= $this->GetBoundary($this->boundary[2], '', 'text/plain', '') . $this->LE; // Create text body
- $result .= $this->EncodeString($this->AltBody, $this->Encoding);
- $result .= $this->LE.$this->LE;
- $result .= $this->GetBoundary($this->boundary[2], '', 'text/html', '') . $this->LE; // Create the HTML body
- $result .= $this->EncodeString($this->Body, $this->Encoding);
- $result .= $this->LE.$this->LE;
- $result .= $this->EndBoundary($this->boundary[2]);
- $result .= $this->AttachAll();
- break;
- }
-
- if($this->IsError()) {
- $result = '';
- } else if ($this->sign_key_file) {
- $file = tempnam("", "mail");
- $fp = fopen($file, "w");
- fwrite($fp, $result);
- fclose($fp);
- $signed = tempnam("", "signed");
-
- if (@openssl_pkcs7_sign($file, $signed, "file://".$this->sign_key_file, array("file://".$this->sign_key_file, $this->sign_key_pass), null)) {
- $fp = fopen($signed, "r");
- $result = fread($fp, filesize($this->sign_key_file));
- fclose($fp);
- } else {
- $this->SetError($this->Lang("signing").openssl_error_string());
- $result = '';
- }
-
- unlink($file);
- unlink($signed);
- }
-
- return $result;
- }
-
- /**
- * Returns the start of a message boundary.
- * @access private
- */
- function GetBoundary($boundary, $charSet, $contentType, $encoding) {
- $result = '';
- if($charSet == '') {
- $charSet = $this->CharSet;
- }
- if($contentType == '') {
- $contentType = $this->ContentType;
- }
- if($encoding == '') {
- $encoding = $this->Encoding;
- }
- $result .= $this->TextLine('--' . $boundary);
- $result .= sprintf("Content-Type: %s; charset = \"%s\"", $contentType, $charSet);
- $result .= $this->LE;
- $result .= $this->HeaderLine('Content-Transfer-Encoding', $encoding);
- $result .= $this->LE;
-
- return $result;
- }
-
- /**
- * Returns the end of a message boundary.
- * @access private
- */
- function EndBoundary($boundary) {
- return $this->LE . '--' . $boundary . '--' . $this->LE;
- }
-
- /**
- * Sets the message type.
- * @access private
- * @return void
- */
- function SetMessageType() {
- if(count($this->attachment) < 1 && strlen($this->AltBody) < 1) {
- $this->message_type = 'plain';
- } else {
- if(count($this->attachment) > 0) {
- $this->message_type = 'attachments';
- }
- if(strlen($this->AltBody) > 0 && count($this->attachment) < 1) {
- $this->message_type = 'alt';
- }
- if(strlen($this->AltBody) > 0 && count($this->attachment) > 0) {
- $this->message_type = 'alt_attachments';
- }
- }
- }
-
- /* Returns a formatted header line.
- * @access private
- * @return string
- */
- function HeaderLine($name, $value) {
- return $name . ': ' . $value . $this->LE;
- }
-
- /**
- * Returns a formatted mail line.
- * @access private
- * @return string
- */
- function TextLine($value) {
- return $value . $this->LE;
- }
-
- /////////////////////////////////////////////////
- // CLASS METHODS, ATTACHMENTS
- /////////////////////////////////////////////////
-
- /**
- * Adds an attachment from a path on the filesystem.
- * Returns false if the file could not be found
- * or accessed.
- * @param string $path Path to the attachment.
- * @param string $name Overrides the attachment name.
- * @param string $encoding File encoding (see $Encoding).
- * @param string $type File extension (MIME) type.
- * @return bool
- */
- function AddAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
- if(!@is_file($path)) {
- $this->SetError($this->Lang('file_access') . $path);
- return false;
- }
-
- $filename = basename($path);
- if($name == '') {
- $name = $filename;
- }
-
- $cur = count($this->attachment);
- $this->attachment[$cur][0] = $path;
- $this->attachment[$cur][1] = $filename;
- $this->attachment[$cur][2] = $name;
- $this->attachment[$cur][3] = $encoding;
- $this->attachment[$cur][4] = $type;
- $this->attachment[$cur][5] = false; // isStringAttachment
- $this->attachment[$cur][6] = 'attachment';
- $this->attachment[$cur][7] = 0;
-
- return true;
- }
-
- /**
- * Attaches all fs, string, and binary attachments to the message.
- * Returns an empty string on failure.
- * @access private
- * @return string
- */
- function AttachAll() {
- /* Return text of body */
- $mime = array();
-
- /* Add all attachments */
- for($i = 0; $i < count($this->attachment); $i++) {
- /* Check for string attachment */
- $bString = $this->attachment[$i][5];
- if ($bString) {
- $string = $this->attachment[$i][0];
- } else {
- $path = $this->attachment[$i][0];
- }
-
- $filename = $this->attachment[$i][1];
- $name = $this->attachment[$i][2];
- $encoding = $this->attachment[$i][3];
- $type = $this->attachment[$i][4];
- $disposition = $this->attachment[$i][6];
- $cid = $this->attachment[$i][7];
-
- $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE);
- $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $name, $this->LE);
- $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE);
-
- if($disposition == 'inline') {
- $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE);
- }
-
- $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $name, $this->LE.$this->LE);
-
- /* Encode as string attachment */
- if($bString) {
- $mime[] = $this->EncodeString($string, $encoding);
- if($this->IsError()) {
- return '';
- }
- $mime[] = $this->LE.$this->LE;
- } else {
- $mime[] = $this->EncodeFile($path, $encoding);
- if($this->IsError()) {
- return '';
- }
- $mime[] = $this->LE.$this->LE;
- }
- }
-
- $mime[] = sprintf("--%s--%s", $this->boundary[1], $this->LE);
-
- return join('', $mime);
- }
-
- /**
- * Encodes attachment in requested format. Returns an
- * empty string on failure.
- * @access private
- * @return string
- */
- function EncodeFile ($path, $encoding = 'base64') {
- if(!@$fd = fopen($path, 'rb')) {
- $this->SetError($this->Lang('file_open') . $path);
- return '';
- }
- $magic_quotes = get_magic_quotes_runtime();
- set_magic_quotes_runtime(0);
- $file_buffer = fread($fd, filesize($path));
- $file_buffer = $this->EncodeString($file_buffer, $encoding);
- fclose($fd);
- set_magic_quotes_runtime($magic_quotes);
-
- return $file_buffer;
- }
-
- /**
- * Encodes string to requested format. Returns an
- * empty string on failure.
- * @access private
- * @return string
- */
- function EncodeString ($str, $encoding = 'base64') {
- $encoded = '';
- switch(strtolower($encoding)) {
- case 'base64':
- /* chunk_split is found in PHP >= 3.0.6 */
- $encoded = chunk_split(base64_encode($str), 76, $this->LE);
- break;
- case '7bit':
- case '8bit':
- $encoded = $this->FixEOL($str);
- if (substr($encoded, -(strlen($this->LE))) != $this->LE)
- $encoded .= $this->LE;
- break;
- case 'binary':
- $encoded = $str;
- break;
- case 'quoted-printable':
- $encoded = $this->EncodeQP($str);
- break;
- default:
- $this->SetError($this->Lang('encoding') . $encoding);
- break;
- }
- return $encoded;
- }
-
- /**
- * Encode a header string to best of Q, B, quoted or none.
- * @access private
- * @return string
- */
- function EncodeHeader ($str, $position = 'text') {
- $x = 0;
-
- switch (strtolower($position)) {
- case 'phrase':
- if (!preg_match('/[\200-\377]/', $str)) {
- /* Can't use addslashes as we don't know what value has magic_quotes_sybase. */
- $encoded = addcslashes($str, "\0..\37\177\\\"");
- if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) {
- return ($encoded);
- } else {
- return ("\"$encoded\"");
- }
- }
- $x = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches);
- break;
- case 'comment':
- $x = preg_match_all('/[()"]/', $str, $matches);
- /* Fall-through */
- case 'text':
- default:
- $x += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
- break;
- }
-
- if ($x == 0) {
- return ($str);
- }
-
- $maxlen = 75 - 7 - strlen($this->CharSet);
- /* Try to select the encoding which should produce the shortest output */
- if (strlen($str)/3 < $x) {
- $encoding = 'B';
- if (function_exists('mb_strlen') && $this->HasMultiBytes($str)) {
- // Use a custom function which correctly encodes and wraps long
- // multibyte strings without breaking lines within a character
- $encoded = $this->Base64EncodeWrapMB($str);
- } else {
- $encoded = base64_encode($str);
- $maxlen -= $maxlen % 4;
- $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
- }
- } else {
- $encoding = 'Q';
- $encoded = $this->EncodeQ($str, $position);
- $encoded = $this->WrapText($encoded, $maxlen, true);
- $encoded = str_replace('='.$this->LE, "\n", trim($encoded));
- }
-
- $encoded = preg_replace('/^(.*)$/m', " =?".$this->CharSet."?$encoding?\\1?=", $encoded);
- $encoded = trim(str_replace("\n", $this->LE, $encoded));
-
- return $encoded;
- }
-
- /**
- * Checks if a string contains multibyte characters.
- * @access private
- * @param string $str multi-byte text to wrap encode
- * @return bool
- */
- function HasMultiBytes($str) {
- if (function_exists('mb_strlen')) {
- return (strlen($str) > mb_strlen($str, $this->CharSet));
- } else { // Assume no multibytes (we can't handle without mbstring functions anyway)
- return False;
- }
- }
-
- /**
- * Correctly encodes and wraps long multibyte strings for mail headers
- * without breaking lines within a character.
- * Adapted from a function by paravoid at http://uk.php.net/manual/en/function.mb-encode-mimeheader.php
- * @access private
- * @param string $str multi-byte text to wrap encode
- * @return string
- */
- function Base64EncodeWrapMB($str) {
- $start = "=?".$this->CharSet."?B?";
- $end = "?=";
- $encoded = "";
-
- $mb_length = mb_strlen($str, $this->CharSet);
- // Each line must have length <= 75, including $start and $end
- $length = 75 - strlen($start) - strlen($end);
- // Average multi-byte ratio
- $ratio = $mb_length / strlen($str);
- // Base64 has a 4:3 ratio
- $offset = $avgLength = floor($length * $ratio * .75);
-
- for ($i = 0; $i < $mb_length; $i += $offset) {
- $lookBack = 0;
-
- do {
- $offset = $avgLength - $lookBack;
- $chunk = mb_substr($str, $i, $offset, $this->CharSet);
- $chunk = base64_encode($chunk);
- $lookBack++;
- }
- while (strlen($chunk) > $length);
-
- $encoded .= $chunk . $this->LE;
- }
-
- // Chomp the last linefeed
- $encoded = substr($encoded, 0, -strlen($this->LE));
- return $encoded;
- }
-
- /**
- * Encode string to quoted-printable.
- * @access private
- * @return string
- */
- function EncodeQP( $input = '', $line_max = 76, $space_conv = false ) {
- $hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
- $lines = preg_split('/(?:\r\n|\r|\n)/', $input);
- $eol = "\r\n";
- $escape = '=';
- $output = '';
- while( list(, $line) = each($lines) ) {
- $linlen = strlen($line);
- $newline = '';
- for($i = 0; $i < $linlen; $i++) {
- $c = substr( $line, $i, 1 );
- $dec = ord( $c );
- if ( ( $i == 0 ) && ( $dec == 46 ) ) { // convert first point in the line into =2E
- $c = '=2E';
- }
- if ( $dec == 32 ) {
- if ( $i == ( $linlen - 1 ) ) { // convert space at eol only
- $c = '=20';
- } else if ( $space_conv ) {
- $c = '=20';
- }
- } elseif ( ($dec == 61) || ($dec < 32 ) || ($dec > 126) ) { // always encode "\t", which is *not* required
- $h2 = floor($dec/16);
- $h1 = floor($dec%16);
- $c = $escape.$hex[$h2].$hex[$h1];
- }
- if ( (strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted
- $output .= $newline.$escape.$eol; // soft line break; " =\r\n" is okay
- $newline = '';
- // check if newline first character will be point or not
- if ( $dec == 46 ) {
- $c = '=2E';
- }
- }
- $newline .= $c;
- } // end of for
- $output .= $newline.$eol;
- } // end of while
- return trim($output);
- }
-
- /**
- * Encode string to q encoding.
- * @access private
- * @return string
- */
- function EncodeQ ($str, $position = 'text') {
- /* There should not be any EOL in the string */
- $encoded = preg_replace("[\r\n]", '', $str);
-
- switch (strtolower($position)) {
- case 'phrase':
- $encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
- break;
- case 'comment':
- $encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
- case 'text':
- default:
- /* Replace every high ascii, control =, ? and _ characters */
- $encoded = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e',
- "'='.sprintf('%02X', ord('\\1'))", $encoded);
- break;
- }
-
- /* Replace every spaces to _ (more readable than =20) */
- $encoded = str_replace(' ', '_', $encoded);
-
- return $encoded;
- }
-
- /**
- * Adds a string or binary attachment (non-filesystem) to the list.
- * This method can be used to attach ascii or binary data,
- * such as a BLOB record from a database.
- * @param string $string String attachment data.
- * @param string $filename Name of the attachment.
- * @param string $encoding File encoding (see $Encoding).
- * @param string $type File extension (MIME) type.
- * @return void
- */
- function AddStringAttachment($string, $filename, $encoding = 'base64', $type = 'application/octet-stream') {
- /* Append to $attachment array */
- $cur = count($this->attachment);
- $this->attachment[$cur][0] = $string;
- $this->attachment[$cur][1] = $filename;
- $this->attachment[$cur][2] = $filename;
- $this->attachment[$cur][3] = $encoding;
- $this->attachment[$cur][4] = $type;
- $this->attachment[$cur][5] = true; // isString
- $this->attachment[$cur][6] = 'attachment';
- $this->attachment[$cur][7] = 0;
- }
-
- /**
- * Adds an embedded attachment. This can include images, sounds, and
- * just about any other document. Make sure to set the $type to an
- * image type. For JPEG images use "image/jpeg" and for GIF images
- * use "image/gif".
- * @param string $path Path to the attachment.
- * @param string $cid Content ID of the attachment. Use this to identify
- * the Id for accessing the image in an HTML form.
- * @param string $name Overrides the attachment name.
- * @param string $encoding File encoding (see $Encoding).
- * @param string $type File extension (MIME) type.
- * @return bool
- */
- function AddEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
-
- if(!@is_file($path)) {
- $this->SetError($this->Lang('file_access') . $path);
- return false;
- }
-
- $filename = basename($path);
- if($name == '') {
- $name = $filename;
- }
-
- /* Append to $attachment array */
- $cur = count($this->attachment);
- $this->attachment[$cur][0] = $path;
- $this->attachment[$cur][1] = $filename;
- $this->attachment[$cur][2] = $name;
- $this->attachment[$cur][3] = $encoding;
- $this->attachment[$cur][4] = $type;
- $this->attachment[$cur][5] = false;
- $this->attachment[$cur][6] = 'inline';
- $this->attachment[$cur][7] = $cid;
-
- return true;
- }
-
- /**
- * Returns true if an inline attachment is present.
- * @access private
- * @return bool
- */
- function InlineImageExists() {
- $result = false;
- for($i = 0; $i < count($this->attachment); $i++) {
- if($this->attachment[$i][6] == 'inline') {
- $result = true;
- break;
- }
- }
-
- return $result;
- }
-
- /////////////////////////////////////////////////
- // CLASS METHODS, MESSAGE RESET
- /////////////////////////////////////////////////
-
- /**
- * Clears all recipients assigned in the TO array. Returns void.
- * @return void
- */
- function ClearAddresses() {
- $this->to = array();
- }
-
- /**
- * Clears all recipients assigned in the CC array. Returns void.
- * @return void
- */
- function ClearCCs() {
- $this->cc = array();
- }
-
- /**
- * Clears all recipients assigned in the BCC array. Returns void.
- * @return void
- */
- function ClearBCCs() {
- $this->bcc = array();
- }
-
- /**
- * Clears all recipients assigned in the ReplyTo array. Returns void.
- * @return void
- */
- function ClearReplyTos() {
- $this->ReplyTo = array();
- }
-
- /**
- * Clears all recipients assigned in the TO, CC and BCC
- * array. Returns void.
- * @return void
- */
- function ClearAllRecipients() {
- $this->to = array();
- $this->cc = array();
- $this->bcc = array();
- }
-
- /**
- * Clears all previously set filesystem, string, and binary
- * attachments. Returns void.
- * @return void
- */
- function ClearAttachments() {
- $this->attachment = array();
- }
-
- /**
- * Clears all custom headers. Returns void.
- * @return void
- */
- function ClearCustomHeaders() {
- $this->CustomHeader = array();
- }
-
- /////////////////////////////////////////////////
- // CLASS METHODS, MISCELLANEOUS
- /////////////////////////////////////////////////
-
- /**
- * Adds the error message to the error container.
- * Returns void.
- * @access private
- * @return void
- */
- function SetError($msg) {
- $this->error_count++;
- $this->ErrorInfo = $msg;
- }
-
- /**
- * Returns the proper RFC 822 formatted date.
- * @access private
- * @return string
- */
- function RFCDate() {
- $tz = date('Z');
- $tzs = ($tz < 0) ? '-' : '+';
- $tz = abs($tz);
- $tz = (int)($tz/3600)*100 + ($tz%3600)/60;
- $result = sprintf("%s %s%04d", date('D, j M Y H:i:s'), $tzs, $tz);
-
- return $result;
- }
-
- /**
- * Returns the appropriate server variable. Should work with both
- * PHP 4.1.0+ as well as older versions. Returns an empty string
- * if nothing is found.
- * @access private
- * @return mixed
- */
- function ServerVar($varName) {
- global $HTTP_SERVER_VARS;
- global $HTTP_ENV_VARS;
-
- if(!isset($_SERVER)) {
- $_SERVER = $HTTP_SERVER_VARS;
- if(!isset($_SERVER['REMOTE_ADDR'])) {
- $_SERVER = $HTTP_ENV_VARS; // must be Apache
- }
- }
-
- if(isset($_SERVER[$varName])) {
- return $_SERVER[$varName];
- } else {
- return '';
- }
- }
-
- /**
- * Returns the server hostname or 'localhost.localdomain' if unknown.
- * @access private
- * @return string
- */
- function ServerHostname() {
- if ($this->Hostname != '') {
- $result = $this->Hostname;
- } elseif ($this->ServerVar('SERVER_NAME') != '') {
- $result = $this->ServerVar('SERVER_NAME');
- } else {
- $result = 'localhost.localdomain';
- }
-
- return $result;
- }
-
- /**
- * Returns a message in the appropriate language.
- * @access private
- * @return string
- */
- function Lang($key) {
- if(count($this->language) < 1) {
- $this->SetLanguage('en'); // set the default language
- }
-
- if(isset($this->language[$key])) {
- return $this->language[$key];
- } else {
- return 'Language string failed to load: ' . $key;
- }
- }
-
- /**
- * Returns true if an error occurred.
- * @return bool
- */
- function IsError() {
- return ($this->error_count > 0);
- }
-
- /**
- * Changes every end of line from CR or LF to CRLF.
- * @access private
- * @return string
- */
- function FixEOL($str) {
- $str = str_replace("\r\n", "\n", $str);
- $str = str_replace("\r", "\n", $str);
- $str = str_replace("\n", $this->LE, $str);
- return $str;
- }
-
- /**
- * Adds a custom header.
- * @return void
- */
- function AddCustomHeader($custom_header) {
- $this->CustomHeader[] = explode(':', $custom_header, 2);
- }
-
- /**
- * Evaluates the message and returns modifications for inline images and backgrounds
- * @access public
- * @return $message
- */
- function MsgHTML($message,$basedir='') {
- preg_match_all("/(src|background)=\"(.*)\"/Ui", $message, $images);
- if(isset($images[2])) {
- foreach($images[2] as $i => $url) {
- // do not change urls for absolute images (thanks to corvuscorax)
- if (!preg_match('/^[A-z][A-z]*:\/\//',$url)) {
- $filename = basename($url);
- $directory = dirname($url);
- ($directory == '.')?$directory='':'';
- $cid = 'cid:' . md5($filename);
- $fileParts = split("\.", $filename);
- $ext = $fileParts[1];
- $mimeType = $this->_mime_types($ext);
- if ( strlen($basedir) > 1 && substr($basedir,-1) != '/') { $basedir .= '/'; }
- if ( strlen($directory) > 1 && substr($basedir,-1) != '/') { $directory .= '/'; }
- $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64', $mimeType);
- if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType) ) {
- $message = preg_replace("/".$images[1][$i]."=\"".preg_quote($url, '/')."\"/Ui", $images[1][$i]."=\"".$cid."\"", $message);
- }
- }
- }
- }
- $this->IsHTML(true);
- $this->Body = $message;
- $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s','',$message)));
- if ( !empty($textMsg) && empty($this->AltBody) ) {
- $this->AltBody = $textMsg;
- }
- if ( empty($this->AltBody) ) {
- $this->AltBody = 'To view this email message, open the email in with HTML compatibility!' . "\n\n";
- }
- }
-
- /**
- * Gets the mime type of the embedded or inline image
- * @access private
- * @return mime type of ext
- */
- function _mime_types($ext = '') {
- $mimes = array(
- 'hqx' => 'application/mac-binhex40',
- 'cpt' => 'application/mac-compactpro',
- 'doc' => 'application/msword',
- 'bin' => 'application/macbinary',
- 'dms' => 'application/octet-stream',
- 'lha' => 'application/octet-stream',
- 'lzh' => 'application/octet-stream',
- 'exe' => 'application/octet-stream',
- 'class' => 'application/octet-stream',
- 'psd' => 'application/octet-stream',
- 'so' => 'application/octet-stream',
- 'sea' => 'application/octet-stream',
- 'dll' => 'application/octet-stream',
- 'oda' => 'application/oda',
- 'pdf' => 'application/pdf',
- 'ai' => 'application/postscript',
- 'eps' => 'application/postscript',
- 'ps' => 'application/postscript',
- 'smi' => 'application/smil',
- 'smil' => 'application/smil',
- 'mif' => 'application/vnd.mif',
- 'xls' => 'application/vnd.ms-excel',
- 'ppt' => 'application/vnd.ms-powerpoint',
- 'wbxml' => 'application/vnd.wap.wbxml',
- 'wmlc' => 'application/vnd.wap.wmlc',
- 'dcr' => 'application/x-director',
- 'dir' => 'application/x-director',
- 'dxr' => 'application/x-director',
- 'dvi' => 'application/x-dvi',
- 'gtar' => 'application/x-gtar',
- 'php' => 'application/x-httpd-php',
- 'php4' => 'application/x-httpd-php',
- 'php3' => 'application/x-httpd-php',
- 'phtml' => 'application/x-httpd-php',
- 'phps' => 'application/x-httpd-php-source',
- 'js' => 'application/x-javascript',
- 'swf' => 'application/x-shockwave-flash',
- 'sit' => 'application/x-stuffit',
- 'tar' => 'application/x-tar',
- 'tgz' => 'application/x-tar',
- 'xhtml' => 'application/xhtml+xml',
- 'xht' => 'application/xhtml+xml',
- 'zip' => 'application/zip',
- 'mid' => 'audio/midi',
- 'midi' => 'audio/midi',
- 'mpga' => 'audio/mpeg',
- 'mp2' => 'audio/mpeg',
- 'mp3' => 'audio/mpeg',
- 'aif' => 'audio/x-aiff',
- 'aiff' => 'audio/x-aiff',
- 'aifc' => 'audio/x-aiff',
- 'ram' => 'audio/x-pn-realaudio',
- 'rm' => 'audio/x-pn-realaudio',
- 'rpm' => 'audio/x-pn-realaudio-plugin',
- 'ra' => 'audio/x-realaudio',
- 'rv' => 'video/vnd.rn-realvideo',
- 'wav' => 'audio/x-wav',
- 'bmp' => 'image/bmp',
- 'gif' => 'image/gif',
- 'jpeg' => 'image/jpeg',
- 'jpg' => 'image/jpeg',
- 'jpe' => 'image/jpeg',
- 'png' => 'image/png',
- 'tiff' => 'image/tiff',
- 'tif' => 'image/tiff',
- 'css' => 'text/css',
- 'html' => 'text/html',
- 'htm' => 'text/html',
- 'shtml' => 'text/html',
- 'txt' => 'text/plain',
- 'text' => 'text/plain',
- 'log' => 'text/plain',
- 'rtx' => 'text/richtext',
- 'rtf' => 'text/rtf',
- 'xml' => 'text/xml',
- 'xsl' => 'text/xml',
- 'mpeg' => 'video/mpeg',
- 'mpg' => 'video/mpeg',
- 'mpe' => 'video/mpeg',
- 'qt' => 'video/quicktime',
- 'mov' => 'video/quicktime',
- 'avi' => 'video/x-msvideo',
- 'movie' => 'video/x-sgi-movie',
- 'doc' => 'application/msword',
- 'word' => 'application/msword',
- 'xl' => 'application/excel',
- 'eml' => 'message/rfc822'
- );
- return ( ! isset($mimes[strtolower($ext)])) ? 'application/octet-stream' : $mimes[strtolower($ext)];
- }
-
- /**
- * Set (or reset) Class Objects (variables)
- *
- * Usage Example:
- * $page->set('X-Priority', '3');
- *
- * @access public
- * @param string $name Parameter Name
- * @param mixed $value Parameter Value
- * NOTE: will not work with arrays, there are no arrays to set/reset
- */
- function set ( $name, $value = '' ) {
- if ( isset($this->$name) ) {
- $this->$name = $value;
- } else {
- $this->SetError('Cannot set or reset variable ' . $name);
- return false;
- }
- }
-
- /**
- * Read a file from a supplied filename and return it.
- *
- * @access public
- * @param string $filename Parameter File Name
- */
- function getFile($filename) {
- $return = '';
- if ($fp = fopen($filename, 'rb')) {
- while (!feof($fp)) {
- $return .= fread($fp, 1024);
- }
- fclose($fp);
- return $return;
- } else {
- return false;
- }
- }
-
- /**
- * Strips newlines to prevent header injection.
- * @access private
- * @param string $str String
- * @return string
- */
- function SecureHeader($str) {
- $str = trim($str);
- $str = str_replace("\r", "", $str);
- $str = str_replace("\n", "", $str);
- return $str;
- }
-
- /**
- * Set the private key file and password to sign the message.
- *
- * @access public
- * @param string $key_filename Parameter File Name
- * @param string $key_pass Password for private key
- */
- function Sign($key_filename, $key_pass) {
- $this->sign_key_file = $key_filename;
- $this->sign_key_pass = $key_pass;
- }
-
-}
-
-?>
diff --git a/config/freeswitch/class.smtp.tmp b/config/freeswitch/class.smtp.tmp
deleted file mode 100755
index 398c3ffb..00000000
--- a/config/freeswitch/class.smtp.tmp
+++ /dev/null
@@ -1,1062 +0,0 @@
-<?php
-/*~ class.smtp.php
-.---------------------------------------------------------------------------.
-| Software: PHPMailer - PHP email class |
-| Version: 2.0.2 |
-| Contact: via sourceforge.net support pages (also www.codeworxtech.com) |
-| Info: http://phpmailer.sourceforge.net |
-| Support: http://sourceforge.net/projects/phpmailer/ |
-| ------------------------------------------------------------------------- |
-| Author: Andy Prevost (project admininistrator) |
-| Author: Brent R. Matzelle (original founder) |
-| Copyright (c) 2004-2007, Andy Prevost. All Rights Reserved. |
-| Copyright (c) 2001-2003, Brent R. Matzelle |
-| ------------------------------------------------------------------------- |
-| License: Distributed under the Lesser General Public License (LGPL) |
-| http://www.gnu.org/copyleft/lesser.html |
-| This program is distributed in the hope that it will be useful - WITHOUT |
-| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
-| FITNESS FOR A PARTICULAR PURPOSE. |
-| ------------------------------------------------------------------------- |
-| We offer a number of paid services (www.codeworxtech.com): |
-| - Web Hosting on highly optimized fast and secure servers |
-| - Technology Consulting |
-| - Oursourcing (highly qualified programmers and graphic designers) |
-'---------------------------------------------------------------------------'
-
-/**
- * SMTP is rfc 821 compliant and implements all the rfc 821 SMTP
- * commands except TURN which will always return a not implemented
- * error. SMTP also provides some utility methods for sending mail
- * to an SMTP server.
- * @package PHPMailer
- * @author Chris Ryan
- */
-
-class SMTP
-{
- /**
- * SMTP server port
- * @var int
- */
- var $SMTP_PORT = 25;
-
- /**
- * SMTP reply line ending
- * @var string
- */
- var $CRLF = "\r\n";
-
- /**
- * Sets whether debugging is turned on
- * @var bool
- */
- var $do_debug; # the level of debug to perform
-
- /**
- * Sets VERP use on/off (default is off)
- * @var bool
- */
- var $do_verp = false;
-
- /**#@+
- * @access private
- */
- var $smtp_conn; # the socket to the server
- var $error; # error if any on the last call
- var $helo_rply; # the reply the server sent to us for HELO
- /**#@-*/
-
- /**
- * Initialize the class so that the data is in a known state.
- * @access public
- * @return void
- */
- function SMTP() {
- $this->smtp_conn = 0;
- $this->error = null;
- $this->helo_rply = null;
-
- $this->do_debug = 0;
- }
-
- /*************************************************************
- * CONNECTION FUNCTIONS *
- ***********************************************************/
-
- /**
- * Connect to the server specified on the port specified.
- * If the port is not specified use the default SMTP_PORT.
- * If tval is specified then a connection will try and be
- * established with the server for that number of seconds.
- * If tval is not specified the default is 30 seconds to
- * try on the connection.
- *
- * SMTP CODE SUCCESS: 220
- * SMTP CODE FAILURE: 421
- * @access public
- * @return bool
- */
- function Connect($host,$port=0,$tval=30) {
- # set the error val to null so there is no confusion
- $this->error = null;
-
- # make sure we are __not__ connected
- if($this->connected()) {
- # ok we are connected! what should we do?
- # for now we will just give an error saying we
- # are already connected
- $this->error = array("error" => "Already connected to a server");
- return false;
- }
-
- if(empty($port)) {
- $port = $this->SMTP_PORT;
- }
-
- #connect to the smtp server
- $this->smtp_conn = fsockopen($host, # the host of the server
- $port, # the port to use
- $errno, # error number if any
- $errstr, # error message if any
- $tval); # give up after ? secs
- # verify we connected properly
- if(empty($this->smtp_conn)) {
- $this->error = array("error" => "Failed to connect to server",
- "errno" => $errno,
- "errstr" => $errstr);
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": $errstr ($errno)" . $this->CRLF;
- }
- return false;
- }
-
- # sometimes the SMTP server takes a little longer to respond
- # so we will give it a longer timeout for the first read
- // Windows still does not have support for this timeout function
- if(substr(PHP_OS, 0, 3) != "WIN")
- socket_set_timeout($this->smtp_conn, $tval, 0);
-
- # get any announcement stuff
- $announce = $this->get_lines();
-
- # set the timeout of any socket functions at 1/10 of a second
- //if(function_exists("socket_set_timeout"))
- // socket_set_timeout($this->smtp_conn, 0, 100000);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $announce;
- }
-
- return true;
- }
-
- /**
- * Performs SMTP authentication. Must be run after running the
- * Hello() method. Returns true if successfully authenticated.
- * @access public
- * @return bool
- */
- function Authenticate($username, $password) {
- // Start authentication
- fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($code != 334) {
- $this->error =
- array("error" => "AUTH not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
-
- // Send encoded username
- fputs($this->smtp_conn, base64_encode($username) . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($code != 334) {
- $this->error =
- array("error" => "Username not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
-
- // Send encoded password
- fputs($this->smtp_conn, base64_encode($password) . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($code != 235) {
- $this->error =
- array("error" => "Password not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
-
- return true;
- }
-
- /**
- * Returns true if connected to a server otherwise false
- * @access private
- * @return bool
- */
- function Connected() {
- if(!empty($this->smtp_conn)) {
- $sock_status = socket_get_status($this->smtp_conn);
- if($sock_status["eof"]) {
- # hmm this is an odd situation... the socket is
- # valid but we are not connected anymore
- if($this->do_debug >= 1) {
- echo "SMTP -> NOTICE:" . $this->CRLF .
- "EOF caught while checking if connected";
- }
- $this->Close();
- return false;
- }
- return true; # everything looks good
- }
- return false;
- }
-
- /**
- * Closes the socket and cleans up the state of the class.
- * It is not considered good to use this function without
- * first trying to use QUIT.
- * @access public
- * @return void
- */
- function Close() {
- $this->error = null; # so there is no confusion
- $this->helo_rply = null;
- if(!empty($this->smtp_conn)) {
- # close the connection and cleanup
- fclose($this->smtp_conn);
- $this->smtp_conn = 0;
- }
- }
-
- /***************************************************************
- * SMTP COMMANDS *
- *************************************************************/
-
- /**
- * Issues a data command and sends the msg_data to the server
- * finializing the mail transaction. $msg_data is the message
- * that is to be send with the headers. Each header needs to be
- * on a single line followed by a <CRLF> with the message headers
- * and the message body being seperated by and additional <CRLF>.
- *
- * Implements rfc 821: DATA <CRLF>
- *
- * SMTP CODE INTERMEDIATE: 354
- * [data]
- * <CRLF>.<CRLF>
- * SMTP CODE SUCCESS: 250
- * SMTP CODE FAILURE: 552,554,451,452
- * SMTP CODE FAILURE: 451,554
- * SMTP CODE ERROR : 500,501,503,421
- * @access public
- * @return bool
- */
- function Data($msg_data) {
- $this->error = null; # so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Data() without being connected");
- return false;
- }
-
- fputs($this->smtp_conn,"DATA" . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 354) {
- $this->error =
- array("error" => "DATA command not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
-
- # the server is ready to accept data!
- # according to rfc 821 we should not send more than 1000
- # including the CRLF
- # characters on a single line so we will break the data up
- # into lines by \r and/or \n then if needed we will break
- # each of those into smaller lines to fit within the limit.
- # in addition we will be looking for lines that start with
- # a period '.' and append and additional period '.' to that
- # line. NOTE: this does not count towards are limit.
-
- # normalize the line breaks so we know the explode works
- $msg_data = str_replace("\r\n","\n",$msg_data);
- $msg_data = str_replace("\r","\n",$msg_data);
- $lines = explode("\n",$msg_data);
-
- # we need to find a good way to determine is headers are
- # in the msg_data or if it is a straight msg body
- # currently I am assuming rfc 822 definitions of msg headers
- # and if the first field of the first line (':' sperated)
- # does not contain a space then it _should_ be a header
- # and we can process all lines before a blank "" line as
- # headers.
- $field = substr($lines[0],0,strpos($lines[0],":"));
- $in_headers = false;
- if(!empty($field) && !strstr($field," ")) {
- $in_headers = true;
- }
-
- $max_line_length = 998; # used below; set here for ease in change
-
- while(list(,$line) = @each($lines)) {
- $lines_out = null;
- if($line == "" && $in_headers) {
- $in_headers = false;
- }
- # ok we need to break this line up into several
- # smaller lines
- while(strlen($line) > $max_line_length) {
- $pos = strrpos(substr($line,0,$max_line_length)," ");
-
- # Patch to fix DOS attack
- if(!$pos) {
- $pos = $max_line_length - 1;
- }
-
- $lines_out[] = substr($line,0,$pos);
- $line = substr($line,$pos + 1);
- # if we are processing headers we need to
- # add a LWSP-char to the front of the new line
- # rfc 822 on long msg headers
- if($in_headers) {
- $line = "\t" . $line;
- }
- }
- $lines_out[] = $line;
-
- # now send the lines to the server
- while(list(,$line_out) = @each($lines_out)) {
- if(strlen($line_out) > 0)
- {
- if(substr($line_out, 0, 1) == ".") {
- $line_out = "." . $line_out;
- }
- }
- fputs($this->smtp_conn,$line_out . $this->CRLF);
- }
- }
-
- # ok all the message data has been sent so lets get this
- # over with aleady
- fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 250) {
- $this->error =
- array("error" => "DATA not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
- return true;
- }
-
- /**
- * Expand takes the name and asks the server to list all the
- * people who are members of the _list_. Expand will return
- * back and array of the result or false if an error occurs.
- * Each value in the array returned has the format of:
- * [ <full-name> <sp> ] <path>
- * The definition of <path> is defined in rfc 821
- *
- * Implements rfc 821: EXPN <SP> <string> <CRLF>
- *
- * SMTP CODE SUCCESS: 250
- * SMTP CODE FAILURE: 550
- * SMTP CODE ERROR : 500,501,502,504,421
- * @access public
- * @return string array
- */
- function Expand($name) {
- $this->error = null; # so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Expand() without being connected");
- return false;
- }
-
- fputs($this->smtp_conn,"EXPN " . $name . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 250) {
- $this->error =
- array("error" => "EXPN not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
-
- # parse the reply and place in our array to return to user
- $entries = explode($this->CRLF,$rply);
- while(list(,$l) = @each($entries)) {
- $list[] = substr($l,4);
- }
-
- return $list;
- }
-
- /**
- * Sends the HELO command to the smtp server.
- * This makes sure that we and the server are in
- * the same known state.
- *
- * Implements from rfc 821: HELO <SP> <domain> <CRLF>
- *
- * SMTP CODE SUCCESS: 250
- * SMTP CODE ERROR : 500, 501, 504, 421
- * @access public
- * @return bool
- */
- function Hello($host="") {
- $this->error = null; # so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Hello() without being connected");
- return false;
- }
-
- # if a hostname for the HELO was not specified determine
- # a suitable one to send
- if(empty($host)) {
- # we need to determine some sort of appopiate default
- # to send to the server
- $host = "localhost";
- }
-
- // Send extended hello first (RFC 2821)
- if(!$this->SendHello("EHLO", $host))
- {
- if(!$this->SendHello("HELO", $host))
- return false;
- }
-
- return true;
- }
-
- /**
- * Sends a HELO/EHLO command.
- * @access private
- * @return bool
- */
- function SendHello($hello, $host) {
- fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER: " . $this->CRLF . $rply;
- }
-
- if($code != 250) {
- $this->error =
- array("error" => $hello . " not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
-
- $this->helo_rply = $rply;
-
- return true;
- }
-
- /**
- * Gets help information on the keyword specified. If the keyword
- * is not specified then returns generic help, ussually contianing
- * A list of keywords that help is available on. This function
- * returns the results back to the user. It is up to the user to
- * handle the returned data. If an error occurs then false is
- * returned with $this->error set appropiately.
- *
- * Implements rfc 821: HELP [ <SP> <string> ] <CRLF>
- *
- * SMTP CODE SUCCESS: 211,214
- * SMTP CODE ERROR : 500,501,502,504,421
- * @access public
- * @return string
- */
- function Help($keyword="") {
- $this->error = null; # to avoid confusion
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Help() without being connected");
- return false;
- }
-
- $extra = "";
- if(!empty($keyword)) {
- $extra = " " . $keyword;
- }
-
- fputs($this->smtp_conn,"HELP" . $extra . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 211 && $code != 214) {
- $this->error =
- array("error" => "HELP not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
-
- return $rply;
- }
-
- /**
- * Starts a mail transaction from the email address specified in
- * $from. Returns true if successful or false otherwise. If True
- * the mail transaction is started and then one or more Recipient
- * commands may be called followed by a Data command.
- *
- * Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF>
- *
- * SMTP CODE SUCCESS: 250
- * SMTP CODE SUCCESS: 552,451,452
- * SMTP CODE SUCCESS: 500,501,421
- * @access public
- * @return bool
- */
- function Mail($from) {
- $this->error = null; # so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Mail() without being connected");
- return false;
- }
-
- $useVerp = ($this->do_verp ? "XVERP" : "");
- fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $useVerp . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 250) {
- $this->error =
- array("error" => "MAIL not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
- return true;
- }
-
- /**
- * Sends the command NOOP to the SMTP server.
- *
- * Implements from rfc 821: NOOP <CRLF>
- *
- * SMTP CODE SUCCESS: 250
- * SMTP CODE ERROR : 500, 421
- * @access public
- * @return bool
- */
- function Noop() {
- $this->error = null; # so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Noop() without being connected");
- return false;
- }
-
- fputs($this->smtp_conn,"NOOP" . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 250) {
- $this->error =
- array("error" => "NOOP not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
- return true;
- }
-
- /**
- * Sends the quit command to the server and then closes the socket
- * if there is no error or the $close_on_error argument is true.
- *
- * Implements from rfc 821: QUIT <CRLF>
- *
- * SMTP CODE SUCCESS: 221
- * SMTP CODE ERROR : 500
- * @access public
- * @return bool
- */
- function Quit($close_on_error=true) {
- $this->error = null; # so there is no confusion
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Quit() without being connected");
- return false;
- }
-
- # send the quit command to the server
- fputs($this->smtp_conn,"quit" . $this->CRLF);
-
- # get any good-bye messages
- $byemsg = $this->get_lines();
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $byemsg;
- }
-
- $rval = true;
- $e = null;
-
- $code = substr($byemsg,0,3);
- if($code != 221) {
- # use e as a tmp var cause Close will overwrite $this->error
- $e = array("error" => "SMTP server rejected quit command",
- "smtp_code" => $code,
- "smtp_rply" => substr($byemsg,4));
- $rval = false;
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $e["error"] . ": " .
- $byemsg . $this->CRLF;
- }
- }
-
- if(empty($e) || $close_on_error) {
- $this->Close();
- }
-
- return $rval;
- }
-
- /**
- * Sends the command RCPT to the SMTP server with the TO: argument of $to.
- * Returns true if the recipient was accepted false if it was rejected.
- *
- * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
- *
- * SMTP CODE SUCCESS: 250,251
- * SMTP CODE FAILURE: 550,551,552,553,450,451,452
- * SMTP CODE ERROR : 500,501,503,421
- * @access public
- * @return bool
- */
- function Recipient($to) {
- $this->error = null; # so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Recipient() without being connected");
- return false;
- }
-
- fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 250 && $code != 251) {
- $this->error =
- array("error" => "RCPT not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
- return true;
- }
-
- /**
- * Sends the RSET command to abort and transaction that is
- * currently in progress. Returns true if successful false
- * otherwise.
- *
- * Implements rfc 821: RSET <CRLF>
- *
- * SMTP CODE SUCCESS: 250
- * SMTP CODE ERROR : 500,501,504,421
- * @access public
- * @return bool
- */
- function Reset() {
- $this->error = null; # so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Reset() without being connected");
- return false;
- }
-
- fputs($this->smtp_conn,"RSET" . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 250) {
- $this->error =
- array("error" => "RSET failed",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
-
- return true;
- }
-
- /**
- * Starts a mail transaction from the email address specified in
- * $from. Returns true if successful or false otherwise. If True
- * the mail transaction is started and then one or more Recipient
- * commands may be called followed by a Data command. This command
- * will send the message to the users terminal if they are logged
- * in.
- *
- * Implements rfc 821: SEND <SP> FROM:<reverse-path> <CRLF>
- *
- * SMTP CODE SUCCESS: 250
- * SMTP CODE SUCCESS: 552,451,452
- * SMTP CODE SUCCESS: 500,501,502,421
- * @access public
- * @return bool
- */
- function Send($from) {
- $this->error = null; # so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Send() without being connected");
- return false;
- }
-
- fputs($this->smtp_conn,"SEND FROM:" . $from . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 250) {
- $this->error =
- array("error" => "SEND not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
- return true;
- }
-
- /**
- * Starts a mail transaction from the email address specified in
- * $from. Returns true if successful or false otherwise. If True
- * the mail transaction is started and then one or more Recipient
- * commands may be called followed by a Data command. This command
- * will send the message to the users terminal if they are logged
- * in and send them an email.
- *
- * Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF>
- *
- * SMTP CODE SUCCESS: 250
- * SMTP CODE SUCCESS: 552,451,452
- * SMTP CODE SUCCESS: 500,501,502,421
- * @access public
- * @return bool
- */
- function SendAndMail($from) {
- $this->error = null; # so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called SendAndMail() without being connected");
- return false;
- }
-
- fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 250) {
- $this->error =
- array("error" => "SAML not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
- return true;
- }
-
- /**
- * Starts a mail transaction from the email address specified in
- * $from. Returns true if successful or false otherwise. If True
- * the mail transaction is started and then one or more Recipient
- * commands may be called followed by a Data command. This command
- * will send the message to the users terminal if they are logged
- * in or mail it to them if they are not.
- *
- * Implements rfc 821: SOML <SP> FROM:<reverse-path> <CRLF>
- *
- * SMTP CODE SUCCESS: 250
- * SMTP CODE SUCCESS: 552,451,452
- * SMTP CODE SUCCESS: 500,501,502,421
- * @access public
- * @return bool
- */
- function SendOrMail($from) {
- $this->error = null; # so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called SendOrMail() without being connected");
- return false;
- }
-
- fputs($this->smtp_conn,"SOML FROM:" . $from . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 250) {
- $this->error =
- array("error" => "SOML not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
- return true;
- }
-
- /**
- * This is an optional command for SMTP that this class does not
- * support. This method is here to make the RFC821 Definition
- * complete for this class and __may__ be implimented in the future
- *
- * Implements from rfc 821: TURN <CRLF>
- *
- * SMTP CODE SUCCESS: 250
- * SMTP CODE FAILURE: 502
- * SMTP CODE ERROR : 500, 503
- * @access public
- * @return bool
- */
- function Turn() {
- $this->error = array("error" => "This method, TURN, of the SMTP ".
- "is not implemented");
- if($this->do_debug >= 1) {
- echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF;
- }
- return false;
- }
-
- /**
- * Verifies that the name is recognized by the server.
- * Returns false if the name could not be verified otherwise
- * the response from the server is returned.
- *
- * Implements rfc 821: VRFY <SP> <string> <CRLF>
- *
- * SMTP CODE SUCCESS: 250,251
- * SMTP CODE FAILURE: 550,551,553
- * SMTP CODE ERROR : 500,501,502,421
- * @access public
- * @return int
- */
- function Verify($name) {
- $this->error = null; # so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Verify() without being connected");
- return false;
- }
-
- fputs($this->smtp_conn,"VRFY " . $name . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 250 && $code != 251) {
- $this->error =
- array("error" => "VRFY failed on name '$name'",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
- return $rply;
- }
-
- /*******************************************************************
- * INTERNAL FUNCTIONS *
- ******************************************************************/
-
- /**
- * Read in as many lines as possible
- * either before eof or socket timeout occurs on the operation.
- * With SMTP we can tell if we have more lines to read if the
- * 4th character is '-' symbol. If it is a space then we don't
- * need to read anything else.
- * @access private
- * @return string
- */
- function get_lines() {
- $data = "";
- while($str = @fgets($this->smtp_conn,515)) {
- if($this->do_debug >= 4) {
- echo "SMTP -> get_lines(): \$data was \"$data\"" .
- $this->CRLF;
- echo "SMTP -> get_lines(): \$str is \"$str\"" .
- $this->CRLF;
- }
- $data .= $str;
- if($this->do_debug >= 4) {
- echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF;
- }
- # if the 4th character is a space then we are done reading
- # so just break the loop
- if(substr($str,3,1) == " ") { break; }
- }
- return $data;
- }
-
-}
-
-
- ?>
diff --git a/config/freeswitch/dialplan.default.xml b/config/freeswitch/dialplan.default.xml
deleted file mode 100644
index 426dedd8..00000000
--- a/config/freeswitch/dialplan.default.xml
+++ /dev/null
@@ -1,714 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- NOTICE:
-
- This context is usually accessed via authenticated callers on the sip profile on port 5060
- or transfered callers from the public context which arrived via the sip profile on port 5080.
-
- Authenticated users will use the user_context variable on the user to determine what context
- they can access. You can also add a user in the directory with the cidr= attribute acl.conf.xml
- will build the domains acl using this value.
--->
-<!-- http://wiki.freeswitch.org/wiki/Dialplan_XML -->
-<include>
- <context name="default">
-
- <extension name="unloop">
- <condition field="${unroll_loops}" expression="^true$"/>
- <condition field="${sip_looped_call}" expression="^true$">
- <action application="deflect" data="${destination_number}"/>
- </condition>
- </extension>
-
- <!-- Example of doing things based on time of day. -->
- <extension name="tod_example" continue="true">
- <!-- man strftime - M-F, 9AM to 6PM -->
- <condition field="${strftime(%w)}" expression="^([1-5])$"/>
- <condition field="${strftime(%H%M)}" expression="^((09|1[0-7])[0-5][0-9]|1800)$">
- <action application="set" data="open=true"/>
- </condition>
- </extension>
-
- <extension name="global-intercept">
- <condition field="destination_number" expression="^\*886$">
- <action application="answer"/>
- <action application="intercept" data="${hash(select/${domain_name}-last_dial/global)}"/>
- <action application="sleep" data="2000"/>
- </condition>
- </extension>
-
- <extension name="group-intercept">
- <condition field="destination_number" expression="^\*8$">
- <action application="answer"/>
- <action application="intercept" data="${hash(select/${domain_name}-last_dial/${callgroup})}"/>
- <action application="sleep" data="2000"/>
- </condition>
- </extension>
-
- <extension name="intercept-ext">
- <condition field="destination_number" expression="^\*\*(\d+)$">
- <action application="answer"/>
- <action application="intercept" data="${hash(select/${domain_name}-last_dial_ext/$1)}"/>
- <action application="sleep" data="2000"/>
- </condition>
- </extension>
-
- <extension name="redial">
- <condition field="destination_number" expression="^\*870$">
- <action application="transfer" data="${hash(select/${domain_name}-last_dial/${caller_id_number})}"/>
- </condition>
- </extension>
-
- <extension name="global" continue="true">
- <condition field="${network_addr}" expression="^$" break="never">
- <action application="set" data="use_profile=${cond(${acl($${local_ip_v4} rfc1918)} == true ? nat : default)}"/>
- <anti-action application="set" data="use_profile=${cond(${acl(${network_addr} rfc1918)} == true ? nat : default)}"/>
- </condition>
- <condition field="${call_debug}" expression="^true$" break="never">
- <action application="info"/>
- </condition>
- <!--
- This is an example of how to auto detect if telephone-event is missing and activate inband detection
- -->
- <!--
- <condition field="${switch_r_sdp}" expression="a=rtpmap:(\d+)\stelephone-event/8000" break="never">
- <action application="set" data="rtp_payload_number=$1"/>
- <anti-action application="start_dtmf"/>
- </condition>
- -->
- <condition field="${sip_has_crypto}" expression="^(AES_CM_128_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_80)$" break="never">
- <action application="set" data="sip_secure_media=true"/>
- <!-- Offer SRTP on outbound legs if we have it on inbound. -->
- <!-- <action application="export" data="sip_secure_media=true"/> -->
- </condition>
-
- <condition>
- <action application="hash" data="insert/${domain_name}-spymap/${caller_id_number}/${uuid}"/>
- <action application="hash" data="insert/${domain_name}-last_dial/${caller_id_number}/${destination_number}"/>
- <action application="hash" data="insert/${domain_name}-last_dial/global/${uuid}"/>
- </condition>
- </extension>
-
- <!-- If sip_req_host is not a local domain then this has to be an external sip uri -->
- <!--
- <extension name="external_sip_uri" continue="true">
- <condition field="source" expression="mod_sofia"/>
- <condition field="${outside_call}" expression="^$"/>
- <condition field="${domain_exists(${sip_req_host})}" expression="true">
- <anti-action application="bridge" data="sofia/${use_profile}/${sip_to_uri}"/>
- </condition>
- </extension>
- -->
- <!--
- snom button demo, call 9000 to make button 2 mapped to transfer the current call to a conference
- -->
-
- <extension name="snom-demo-2">
- <condition field="destination_number" expression="^\*9001$">
- <action application="eval" data="${snom_bind_key(2 off DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message notused)}"/>
- <action application="transfer" data="3000"/>
- </condition>
- </extension>
-
- <extension name="snom-demo-1">
- <condition field="destination_number" expression="^\*9000$">
- <!--<key> <light> <label> <user> <host> <profile> <action_name> <action>-->
- <action application="eval" data="${snom_bind_key(2 on DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message api+uuid_transfer ${uuid} 9001)}"/>
- <action application="playback" data="$${hold_music}"/>
- </condition>
- </extension>
-
- <extension name="eavesdrop">
- <condition field="destination_number" expression="^\*88(.*)$|^\*0(.*)$">
- <action application="answer"/>
- <action application="eavesdrop" data="${hash(select/${domain_name}-spymap/$1)}"/>
- </condition>
- </extension>
-
- <extension name="eavesdrop">
- <condition field="destination_number" expression="^\*779$">
- <action application="answer"/>
- <action application="set" data="eavesdrop_indicate_failed=tone_stream://%(500, 0, 320)"/>
- <action application="set" data="eavesdrop_indicate_new=tone_stream://%(500, 0, 620)"/>
- <action application="set" data="eavesdrop_indicate_idle=tone_stream://%(250, 0, 920)"/>
- <action application="eavesdrop" data="all"/>
- </condition>
- </extension>
-
- <extension name="call_return">
- <condition field="destination_number" expression="^\*69$|^869$|^lcr$">
- <action application="transfer" data="${hash(select/${domain_name}-call_return/${caller_id_number})}"/>
- </condition>
- </extension>
-
- <extension name="del-group">
- <condition field="destination_number" expression="^\*80(\d{2})$">
- <action application="answer"/>
- <action application="group" data="delete:$1@${domain_name}:${sofia_contact(${sip_from_user}@${domain_name})}"/>
- <action application="gentones" data="%(1000, 0, 320)"/>
- </condition>
- </extension>
-
- <extension name="add-group">
- <condition field="destination_number" expression="^\*81(\d{2})$">
- <action application="answer"/>
- <action application="group" data="insert:$1@${domain_name}:${sofia_contact(${sip_from_user}@${domain_name})}"/>
- <action application="gentones" data="%(1000, 0, 640)"/>
- </condition>
- </extension>
-
- <extension name="call-group-simo">
- <condition field="destination_number" expression="^\*82(\d{2})$">
- <action application="bridge" data="{ignore_early_media=true}${group(call:$1@${domain_name})}"/>
- </condition>
- </extension>
-
- <extension name="call-group-order">
- <condition field="destination_number" expression="^\*83(\d{2})$">
- <action application="set" data="call_timeout=10"/>
- <action application="bridge" data="{ignore_early_media=true}${group(call:$1@${domain_name}:order)}"/>
- </condition>
- </extension>
-
- <extension name="extension-intercom">
- <condition field="destination_number" expression="^\*8(10[01][0-9])$">
- <action application="set" data="dialed_extension=$1"/>
- <action application="export" data="sip_auto_answer=true"/>
- <action application="bridge" data="user/${dialed_extension}@${domain_name}"/>
- </condition>
- </extension>
-
- <X-PRE-PROCESS cmd="include" data="default/*.xml"/>
-
- <!--
- dial the extension 3, 4, or 5 digit extensions for 30 seconds and go to voicemail if the
- call fails (continue_on_fail=true), otherwise hang up after a successful
- bridge (hangup_after-bridge=true)
- -->
- <extension name="Local_Extension">
- <condition field="destination_number" expression="(^\d{5}$|^\d{4}$|^\d{3}$)">
- <action application="set" data="dialed_extension=$1"/>
- <action application="export" data="dialed_extension=$1"/>
- <!-- bind_meta_app can have these args <key> [a|b|ab] [a|b|o|s] <app> -->
- <action application="bind_meta_app" data="1 b s execute_extension::dx XML features"/>
- <action application="bind_meta_app" data="2 b s record_session::$${base_dir}/recordings/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>
- <action application="bind_meta_app" data="3 b s execute_extension::cf XML features"/>
- <action application="set" data="ringback=${us-ring}"/>
- <action application="set" data="transfer_ringback=$${hold_music}"/>
- <action application="set" data="call_timeout=30"/>
- <!-- <action application="set" data="sip_exclude_contact=${network_addr}"/> -->
- <action application="set" data="hangup_after_bridge=true"/>
- <!--<action application="set" data="continue_on_fail=NORMAL_TEMPORARY_FAILURE,USER_BUSY,NO_ANSWER,TIMEOUT,NO_ROUTE_DESTINATION"/> -->
- <action application="set" data="continue_on_fail=true"/>
- <action application="hash" data="insert/${domain_name}-call_return/${dialed_extension}/${caller_id_number}"/>
- <action application="hash" data="insert/${domain_name}-last_dial_ext/${dialed_extension}/${uuid}"/>
- <action application="set" data="called_party_callgroup=${user_data(${dialed_extension}@${domain_name} var callgroup)}"/>
- <!--<action application="export" data="nolocal:sip_secure_media=${user_data(${dialed_extension}@${domain_name} var sip_secure_media)}"/>-->
- <action application="hash" data="insert/${domain_name}-last_dial/${called_party_callgroup}/${uuid}"/>
- <action application="bridge" data="user/${dialed_extension}@${domain_name}"/>
- <action application="answer"/>
- <action application="sleep" data="1000"/>
- <action application="voicemail" data="default ${domain_name} ${dialed_extension}"/>
- </condition>
- </extension>
-
- <extension name="group_dial_sales">
- <condition field="destination_number" expression="^\*2000$">
- <action application="bridge" data="${group_call(sales@${domain_name})}"/>
- </condition>
- </extension>
-
- <extension name="group_dial_support">
- <condition field="destination_number" expression="^\*2001$">
- <action application="bridge" data="group/support@${domain_name}"/>
- </condition>
- </extension>
-
- <extension name="group_dial_billing">
- <condition field="destination_number" expression="^\*2002$">
- <action application="bridge" data="group/billing@${domain_name}"/>
- </condition>
- </extension>
-
- <!-- voicemail operator extension -->
- <!--
- <extension name="operator">
- <condition field="destination_number" expression="^\*operator$|^0$">
- <action application="set" data="transfer_ringback=$${hold_music}"/>
- <action application="transfer" data="1000 XML features"/>
- </condition>
- </extension>
- -->
-
- <!-- voicemail main2 extension -->
- <extension name="vmain2">
- <condition field="destination_number" expression="^vmain2$|^\*97$|^\*4000$">
- <action application="answer"/>
- <action application="sleep" data="1000"/>
- <action application="voicemail" data="check default ${domain_name}"/>
- </condition>
- </extension>
-
- <!-- voicemail main extension -->
- <extension name="vmain">
- <condition field="destination_number" expression="^vmain$|^\*98$">
- <action application="answer"/>
- <action application="sleep" data="1000"/>
- <action application="voicemail" data="check default ${domain_name} ${sip_from_user}"/>
- </condition>
- </extension>
-
- <extension name="send_to_voicemail_5digits">
- <condition field="destination_number" expression="^\*99(\d{5})$">
- <action application="answer"/>
- <action application="sleep" data="1000"/>
- <action application="set" data="dialed_extension=$1"/>
- <action application="export" data="dialed_extension=$1"/>
- <action application="voicemail" data="default ${domain_name} ${dialed_extension}"/>
- </condition>
- </extension>
-
- <extension name="send_to_voicemail_4digits">
- <condition field="destination_number" expression="^\*99(\d{4})$">
- <action application="answer"/>
- <action application="sleep" data="1000"/>
- <action application="set" data="dialed_extension=$1"/>
- <action application="export" data="dialed_extension=$1"/>
- <action application="voicemail" data="default ${domain_name} ${dialed_extension}"/>
- </condition>
- </extension>
-
- <extension name="send_to_voicemail_3digits">
- <condition field="destination_number" expression="^\*99(\d{3})$">
- <action application="answer"/>
- <action application="sleep" data="1000"/>
- <action application="set" data="dialed_extension=$1"/>
- <action application="export" data="dialed_extension=$1"/>
- <action application="voicemail" data="default ${domain_name} ${dialed_extension}"/>
- </condition>
- </extension>
-
- <!-- dial via SIP uri -->
- <extension name="sip_uri">
- <condition field="destination_number" expression="^sip:(.*)$">
- <action application="bridge" data="sofia/${use_profile}/$1"/>
- </condition>
- </extension>
-
- <!--
- start a dynamic conference with the settings of the "default" conference profile in conference.conf.xml
- -->
- <extension name="nb_conferences">
- <condition field="destination_number" expression="^\*(30\d{2})$">
- <action application="answer"/>
- <action application="conference" data="$1-${domain_name}@default"/>
- </condition>
- </extension>
-
- <extension name="wb_conferences">
- <condition field="destination_number" expression="^\*(31\d{2})$">
- <action application="answer"/>
- <action application="conference" data="$1-${domain_name}@wideband"/>
- </condition>
- </extension>
-
- <extension name="uwb_conferences">
- <condition field="destination_number" expression="^\*(32\d{2})$">
- <action application="answer"/>
- <action application="conference" data="$1-${domain_name}@ultrawideband"/>
- </condition>
- </extension>
- <!-- MONO 48kHz conferences -->
- <extension name="cdquality_conferences">
- <condition field="destination_number" expression="^\*(33\d{2})$">
- <action application="answer"/>
- <action application="conference" data="$1-${domain_name}@cdquality"/>
- </condition>
- </extension>
-
- <!-- dial the freeswitch conference via SIP-->
- <extension name="freeswitch_public_conf_via_sip">
- <condition field="destination_number" expression="^\*9(888|1616|3232)$">
- <action application="export" data="hold_music=silence"/>
- <!--
- This will take the SAS from the b-leg and send it to the display on the a-leg phone.
- Known working with Polycom and Snom maybe others.
- -->
- <!--
- <action application="set" data="exec_after_bridge_app=${sched_api(+4 zrtp expand uuid_display ${uuid} \${uuid_getvar(\${uuid_getvar(${uuid} signal_bond)} zrtp_sas1_string )} \${uuid_getvar(\${uuid_getvar(${uuid} signal_bond)} zrtp_sas2_string )} )}"/>
- <action application="export" data="nolocal:zrtp_secure_media=true"/>
- -->
- <action application="bridge" data="sofia/${use_profile}/$1@conference.freeswitch.org"/>
- </condition>
- </extension>
-
- <!--
- This extension will start a conference and invite a group.
- At anytime the participant can dial *2 to bridge directly to the boss.
- All other callers are then hung up on.
- -->
- <extension name="mad_boss_intercom">
- <condition field="destination_number" expression="^\*0911$">
- <action application="set" data="conference_auto_outcall_caller_id_name=Mad Boss1"/>
- <action application="set" data="conference_auto_outcall_caller_id_number=0911"/>
- <action application="set" data="conference_auto_outcall_timeout=60"/>
- <action application="set" data="conference_auto_outcall_flags=mute"/>
- <action application="set" data="conference_auto_outcall_prefix={sip_auto_answer=true,execute_on_answer='bind_meta_app 2 a s1 transfer::intercept:${uuid} inline'}"/>
- <action application="set" data="sip_exclude_contact=${network_addr}"/>
- <action application="conference_set_auto_outcall" data="${group_call(sales)}"/>
- <action application="conference" data="madboss_intercom1@default+flags{endconf|deaf}"/>
- </condition>
- </extension>
-
- <!--
- This extension will start a conference and invite a few of people.
- At anytime the participant can dial *2 to bridge directly to the boss.
- All other callers are then hung up on.
- -->
- <extension name="mad_boss_intercom">
- <condition field="destination_number" expression="^\*0912$">
- <action application="set" data="conference_auto_outcall_caller_id_name=Mad Boss2"/>
- <action application="set" data="conference_auto_outcall_caller_id_number=0912"/>
- <action application="set" data="conference_auto_outcall_timeout=60"/>
- <action application="set" data="conference_auto_outcall_flags=mute"/>
- <action application="set" data="conference_auto_outcall_prefix={sip_auto_answer=true,execute_on_answer='bind_meta_app 2 a s1 transfer::intercept:${uuid} inline'}"/>
- <action application="set" data="sip_exclude_contact=${network_addr}"/>
- <action application="conference_set_auto_outcall" data="loopback/9999"/>
- <action application="conference" data="madboss_intercom2@default+flags{endconf|deaf}"/>
- </condition>
- </extension>
-
- <!--This extension will start a conference and invite several people upon entering -->
- <extension name="mad_boss">
- <condition field="destination_number" expression="^\*0913$">
- <!--These params effect the outcalls made once you join-->
- <action application="set" data="conference_auto_outcall_caller_id_name=Mad Boss"/>
- <action application="set" data="conference_auto_outcall_caller_id_number=0911"/>
- <action application="set" data="conference_auto_outcall_timeout=60"/>
- <action application="set" data="conference_auto_outcall_flags=none"/>
- <!--<action application="set" data="conference_auto_outcall_announce=say:You have been called into an emergency conference"/>-->
- <!--Add as many of these as you need, These are the people you are going to call-->
- <action application="conference_set_auto_outcall" data="loopback/9999"/>
- <action application="conference" data="madboss3@default"/>
- </condition>
- </extension>
-
- <!-- a sample IVR -->
- <extension name="ivr_demo">
- <condition field="destination_number" expression="^\*5000$">
- <action application="answer"/>
- <action application="sleep" data="2000"/>
- <action application="ivr" data="demo_ivr"/>
- </condition>
- </extension>
-
- <!-- Create a conference on the fly and pull someone in at the same time. -->
- <extension name="dynamic_conference">
- <condition field="destination_number" expression="^\*5001$">
- <action application="conference" data="bridge:mydynaconf:sofia/${use_profile}/1234@conference.freeswitch.org"/>
- </condition>
- </extension>
-
- <extension name="rtp_multicast_page">
- <condition field="destination_number" expression="^\*pagegroup$|^\*7243">
- <action application="answer"/>
- <action application="esf_page_group"/>
- </condition>
- </extension>
-
- <!--
- Parking extensions... transferring calls to 5900 will park them in a queue.
- -->
- <extension name="park">
- <condition field="destination_number" expression="^\*5900$">
- <action application="set" data="fifo_music=$${hold_music}"/>
- <action application="fifo" data="5900@${domain_name} in"/>
- </condition>
- </extension>
-
- <!--
- Parking pickup extension. Calling 5901 will pickup the call.
- -->
- <extension name="unpark">
- <condition field="destination_number" expression="^\*5901$">
- <action application="answer"/>
- <action application="fifo" data="5900@${domain_name} out nowait"/>
- </condition>
- </extension>
-
- <!--
- This extension is used with snom phones.
-
- Set a function key to park+lot (lot being a number or name.)
- Set type to Park+Orbit. You can then park and pickup using
- the softkey on the phone. Should work with other phones.
- -->
- <extension name="park">
- <condition field="source" expression="mod_sofia"/>
- <condition field="destination_number" expression="park\+(\d+)">
- <action application="fifo" data="$1@${domain_name} in undef $${hold_music}"/>
- </condition>
- </extension>
- <!--
- The extension is parking pickup with a to param of the fifo we are calling
- Some phones send things like orbit= and you can extract that info.
- -->
- <extension name="unpark">
- <condition field="source" expression="mod_sofia"/>
- <condition field="destination_number" expression="^parking$"/>
- <condition field="${sip_to_params}" expression="fifo\=(\d+)">
- <action application="answer"/>
- <action application="fifo" data="$1@${domain_name} out nowait"/>
- </condition>
- </extension>
-
- <!--
- This extension is used with linksys phones.
-
- Set a Phone tab option Call Park Serv to yes. You can park and
- pickup using soft keys "park" and "unpark" found during
- active call when moving navigation button. The other option
- is to use phone's star codes (defaults to *38 and *39).
- -->
- <extension name="park">
- <condition field="source" expression="mod_sofia"/>
- <condition field="destination_number" expression="callpark"/>
- <condition field="${sip_refer_to}">
- <expression><![CDATA[<sip:callpark@${domain_name};orbit=(\d+)>]]></expression>
- <action application="fifo" data="$1@${domain_name} in undef $${hold_music}"/>
- </condition>
- </extension>
-
- <!--
- This extension is used with linksys phones.
-
- The extension is parking pickup with a to param of the fifo
- we are calling. Linksys sends orbit=<parkingslotnumber>
- and we extract that info.
- -->
- <extension name="unpark">
- <condition field="source" expression="mod_sofia"/>
- <condition field="destination_number" expression="pickup"/>
- <condition field="${sip_to_params}" expression="orbit\=(\d+)">
- <action application="answer"/>
- <action application="fifo" data="$1@${domain_name} out nowait"/>
- </condition>
- </extension>
-
- <!--
- Here are some examples of how to override the ringback heard by the
- far end. You have two variables that you can use to override this.
-
- ringback - used when a call isn't answered. (early media)
- transfer_ringback - used when the call is already answered. (post answer)
- -->
-
- <!-- Demonstration of how to override the ringback in various situations -->
- <extension name="wait">
- <condition field="destination_number" expression="^wait$">
- <action application="pre_answer"/>
- <action application="sleep" data="20000"/>
- <action application="answer"/>
- <action application="sleep" data="1000"/>
- <action application="playback" data="voicemail/vm-goodbye.wav"/>
- <action application="hangup"/>
- </condition>
- </extension>
-
- <extension name="fax_receive">
- <condition field="destination_number" expression="^\*9978$">
- <action application="answer" />
- <action application="playback" data="silence_stream://2000"/>
- <action application="rxfax" data="/tmp/rxfax.tif"/>
- <action application="hangup"/>
- </condition>
- </extension>
-
- <extension name="fax_transmit">
- <condition field="destination_number" expression="^\*9979$">
- <action application="txfax" data="/tmp/txfax.tif"/>
- <action application="hangup"/>
- </condition>
- </extension>
-
- <!-- Send a 180 and let the far end generate ringback. -->
- <extension name="ringback_180">
- <condition field="destination_number" expression="^\*9980$">
- <action application="ring_ready"/>
- <action application="sleep" data="20000"/>
- <action application="answer"/>
- <action application="sleep" data="1000"/>
- <action application="playback" data="voicemail/vm-goodbye.wav"/>
- <action application="hangup"/>
- </condition>
- </extension>
-
- <!-- Send a 183 and send uk-ring as the ringtone. (early media) -->
- <extension name="ringback_183_uk_ring">
- <condition field="destination_number" expression="^\*9981$">
- <action application="set" data="ringback=$${uk-ring}"/>
- <action application="bridge" data="loopback/wait"/>
- </condition>
- </extension>
-
- <!-- Send a 183 and use music as the ringtone. (early media) -->
- <extension name="ringback_183_music_ring">
- <condition field="destination_number" expression="^\*9982$">
- <action application="set" data="ringback=$${hold_music}"/>
- <action application="bridge" data="loopback/wait"/>
- </condition>
- </extension>
-
- <!-- Answer the call and use music as the ringtone. (post answer) -->
- <extension name="ringback_post_answer_uk_ring">
- <condition field="destination_number" expression="^\*9983$">
- <action application="set" data="transfer_ringback=$${uk-ring}"/>
- <action application="answer"/>
- <action application="bridge" data="loopback/wait"/>
- </condition>
- </extension>
-
- <!-- Answer the call and use music as the ringtone. (post answer) -->
- <extension name="ringback_post_answer_music">
- <condition field="destination_number" expression="^\*9984$">
- <action application="set" data="transfer_ringback=$${hold_music}"/>
- <action application="answer"/>
- <action application="bridge" data="loopback/wait"/>
- </condition>
- </extension>
-
- <extension name="ClueCon">
- <condition field="destination_number" expression="^\*9991$">
- <action application="set" data="effective_caller_id_name=ClueCon"/>
- <action application="bridge" data="sofia/$${domain}/brian@bkw.org"/>
- </condition>
- </extension>
-
- <extension name="show_info">
- <condition field="destination_number" expression="^\*9992$">
- <action application="answer"/>
- <action application="info"/>
- <action application="sleep" data="250"/>
- <action application="hangup"/>
- </condition>
- </extension>
-
- <extension name="video_record">
- <condition field="destination_number" expression="^\*9993$">
- <action application="answer"/>
- <action application="record_fsv" data="/tmp/testrecord.fsv"/>
- </condition>
- </extension>
-
- <extension name="video_playback">
- <condition field="destination_number" expression="^\*9994$">
- <action application="answer"/>
- <action application="play_fsv" data="/tmp/testrecord.fsv"/>
- </condition>
- </extension>
-
- <extension name="delay_echo">
- <condition field="destination_number" expression="^\*9995$">
- <action application="answer"/>
- <action application="delay_echo" data="5000"/>
- </condition>
- </extension>
-
- <extension name="echo">
- <condition field="destination_number" expression="^\*9996$">
- <action application="answer"/>
- <action application="echo"/>
- </condition>
- </extension>
-
- <extension name="milliwatt">
- <condition field="destination_number" expression="^\*9997$">
- <action application="answer"/>
- <action application="playback" data="tone_stream://%(10000,0,1004);loops=-1"/>
- </condition>
- </extension>
-
- <extension name="tone_stream">
- <condition field="destination_number" expression="^\*9998$">
- <action application="answer"/>
- <action application="playback" data="tone_stream://path=${base_dir}/conf/tetris.ttml;loops=10"/>
- </condition>
- </extension>
-
- <!--
- You will no longer hear the bong tone. The wav file is playing stating the call is secure.
- The file will not play unless you have both TLS and SRTP active.
- -->
-
- <extension name="hold_music">
- <condition field="destination_number" expression="^\*9999$"/>
- <condition field="${sip_has_crypto}" expression="^(AES_CM_128_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_80)$">
- <action application="answer"/>
- <action application="execute_extension" data="is_secure XML features"/>
- <action application="playback" data="$${hold_music}"/>
- <!-- This really should be an IVR for zrtp enrollment but this is just a demo-->
- <anti-action application="set" data="zrtp_enrollment=true"/>
- <anti-action application="answer"/>
- <anti-action application="playback" data="$${hold_music}"/>
- </condition>
- </extension>
-
- <!--
- You can place files in the default directory to get included.
- -->
- <!--<X-PRE-PROCESS cmd="include" data="default/*.xml"/>-->
-
- <!--
- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
-
- Anything you put below this line will usually get ignored due to the file in
- default/99999_enum.xml as it will transfer the call to the enum dialplan.
-
- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
- -->
-
- <extension name="enum">
- <condition field="${module_exists(mod_enum)}" expression="true"/>
- <condition field="destination_number" expression="^(.*)$">
- <action application="transfer" data="$1 enum"/>
- </condition>
- </extension>
-
- <!--
- <extension name="refer">
- <condition field="${sip_refer_to}">
- <expression><![CDATA[<sip:${destination_number}@${domain_name}>]]></expression>
- </condition>
- <condition field="${sip_refer_to}">
- <expression><![CDATA[<sip:(.*)@(.*)>]]></expression>
- <action application="set" data="refer_user=$1"/>
- <action application="set" data="refer_domain=$2"/>
- <action application="info"/>
- <action application="bridge" data="sofia/${use_profile}/${refer_user}@${refer_domain}"/>
- </condition>
- </extension>
- -->
- <!--
- This is an example of how to override the RURI on an outgoing invite to a registered contact.
- -->
- <!--
- <extension name="ruri">
- <condition field="destination_number" expression="^ruri$">
- <action application="bridge" data="sofia/${ruri_profile}/${ruri_user}${regex(${sofia_contact(${ruri_contact})}|^[^\@]+(.*)|%1)}"/>
- </condition>
- </extension>
-
- <extension name="7004">
- <condition field="destination_number" expression="^\*7004$">
- <action application="set" data="ruri_profile=default"/>
- <action application="set" data="ruri_user=2000"/>
- <action application="set" data="ruri_contact=1001@${domain_name}"/>
- <action application="execute_extension" data="ruri"/>
- </condition>
- </extension>
- -->
-
- <!-- SEE WARNING ABOVE IF YOU ARE TRYING TO ADD EXTENSIONS HERE! -->
-
- </context>
-</include>
diff --git a/config/freeswitch/dialplan.public.xml b/config/freeswitch/dialplan.public.xml
deleted file mode 100644
index f30227e0..00000000
--- a/config/freeswitch/dialplan.public.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<!--
- NOTICE:
-
- This context is usually accessed via the external sip profile sitting on port 5080.
-
- It is recommended to have separate inbound and outbound contexts. Not only for security
- but clearing up why you would need to do such a thing. You don't want outside un-authenticated
- callers hitting your default context which allows dialing calls thru your providers and results
- in Toll Fraud.
--->
-
-<!-- http://wiki.freeswitch.org/wiki/Dialplan_XML -->
-<include>
- <context name="public">
-
- <extension name="unloop">
- <condition field="${unroll_loops}" expression="^true$"/>
- <condition field="${sip_looped_call}" expression="^true$">
- <action application="deflect" data="${destination_number}"/>
- </condition>
- </extension>
- <!--
- Tag anything pass thru here as an outside_call so you can make sure not
- to create any routing loops based on the conditions that it came from
- the outside of the switch.
- -->
- <extension name="outside_call" continue="true">
- <condition>
- <action application="set" data="outside_call=true"/>
- </condition>
- </extension>
-
- <extension name="call_debug" continue="true">
- <condition field="${call_debug}" expression="^true$" break="never">
- <action application="info"/>
- </condition>
- </extension>
-
- <!--
- <extension name="public_extensions">
- <condition field="destination_number" expression="^(10[01][0-9])$">
- <action application="transfer" data="$1 XML default"/>
- </condition>
- </extension>
- -->
-
- <!--
- You can place files in the public directory to get included.
- -->
- <X-PRE-PROCESS cmd="include" data="public/*.xml"/>
- <!--
- If you have made it this far lets challenge the caller and if they authenticate
- lets try what they dialed in the default context. (commented out by default)
- -->
- <!--
- <extension name="check_auth" continue="true">
- <condition field="${sip_authorized}" expression="^true$" break="never">
- <anti-action application="respond" data="407"/>
- </condition>
- </extension>
-
- <extension name="transfer_to_default">
- <condition>
- <action application="transfer" data="${destination_number} XML default"/>
- </condition>
- </extension>
- -->
- </context>
-</include>
diff --git a/config/freeswitch/disa.js b/config/freeswitch/disa.js
deleted file mode 100644
index f705b79c..00000000
--- a/config/freeswitch/disa.js
+++ /dev/null
@@ -1,78 +0,0 @@
-include("/usr/local/freeswitch/scripts/config.js");
-
- //var admin_pin = ""; //don't require a pin
- //if you choose not to require a pin then then you may want to add a dialplan condition for a specific caller id
- var predefined_destination = ""; //example: 9999
- //predefined_destination leave empty in most cases
- //Use this to define a single destination
- var digitmaxlength = 0;
- var timeoutpin = 7500;
- var timeouttransfer = 7500;
-
- function mycb( session, type, obj, arg ) {
- try {
- if ( type == "dtmf" ) {
- console_log( "info", "digit: "+obj.digit+"\n" );
- if ( obj.digit == "#" ) {
- //console_log( "info", "detected pound sign.\n" );
- exit = true;
- return( false );
- }
-
- dtmf.digits += obj.digit;
-
- if ( dtmf.digits.length >= digitmaxlength ) {
- exit = true;
- return( false );
- }
- }
- } catch (e) {
- console_log( "err", e+"\n" );
- }
- return( true );
- } //end function mycb
-
-
- //console_log( "info", "DISA Request\n" );
-
- var dtmf = new Object( );
- dtmf.digits = "";
-
- if ( session.ready( ) ) {
- session.answer( );
-
- if (admin_pin.length > 0) {
- digitmaxlength = 6;
- session.streamFile( "/usr/local/freeswitch/sounds/custom/8000/please_enter_the_pin_number.wav", mycb, "dtmf");
- session.collectInput( mycb, dtmf, timeoutpin );
- //console_log( "info", "DISA pin: " + dtmf.digits + "\n" );
- }
-
- if (dtmf.digits == admin_pin || admin_pin.length == 0) {
-
- //console_log( "info", "DISA pin is correct\n" );
-
- us_ring = session.getVariable("us-ring");
- session.execute("set", "ringback="+us_ring); //set to ringtone
- session.execute("set", "transfer_ringback="+us_ring); //set to ringtone
- session.execute("set", "hangup_after_bridge=true");
-
- if (predefined_destination.length == 0) {
- dtmf.digits = ""; //clear dtmf digits to prepare for next dtmf request
- digitmaxlength = 11;
- session.streamFile( "/usr/local/freeswitch/sounds/custom/8000/please_enter_the_phone_number.wav", mycb, "dtmf");
- session.collectInput( mycb, dtmf, timeouttransfer );
- console_log( "info", "DISA Transfer: " + dtmf.digits + "\n" );
- session.execute("transfer", dtmf.digits + " XML default");
- }
- else {
- session.execute("transfer", predefined_destination + " XML default");
- }
-
- }
- else {
- session.streamFile( "/usr/local/freeswitch/sounds/custom/8000/your_pin_number_is_incorect_goodbye.wav", mycb, "dtmf");
- console_log( "info", "DISA Pin: " + dtmf.digits + " is incorrect\n" );
- }
-
- }
diff --git a/config/freeswitch/fax_to_email.tmp b/config/freeswitch/fax_to_email.tmp
deleted file mode 100644
index fcd6af06..00000000
--- a/config/freeswitch/fax_to_email.tmp
+++ /dev/null
@@ -1,182 +0,0 @@
-<?php
-/* $Id$ */
-/*
- fax_to_email.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-require_once("/etc/inc/config.inc");
-require_once("/usr/local/pkg/freeswitch.inc");
-global $config;
-
-ob_end_clean();
-ob_start();
-
-echo "\n---------------------------------\n";
-
-
-$phpversion = substr(phpversion(), 0, 1);
-if ($phpversion == '4') {
- $faxemail = $_REQUEST["email"];
- $faxextension = $_REQUEST["extension"];
- $faxname = $_REQUEST["name"];
-}
-else {
- $tmparray = explode("=", $_SERVER["argv"][1]);
- $faxemail = $tmparray[1];
- unset($tmparray);
-
- $tmparray = explode("=", $_SERVER["argv"][2]);
- $faxextension = $tmparray[1];
- unset($tmparray);
-
- $tmparray = explode("=", $_SERVER["argv"][3]);
- $faxname = $tmparray[1];
- unset($tmparray);
-}
-
-//echo "faxemail $faxemail\n";
-//echo "faxextension $faxextension\n";
-//echo "faxname $faxname\n";
-//echo "cd $dir_fax; /usr/local/bin/tiff2png ".$dir_fax.$faxname.".png\n";
-
-
-$dir_fax = '/usr/local/freeswitch/storage/fax/'.$faxextension.'/inbox/';
-
-
-if (!file_exists($dir_fax.$faxname.".png")) {
- //cd /usr/local/freeswitch/storage/fax/9975/inbox/;/usr/local/bin/tiff2png /usr/local/freeswitch/storage/fax/9975/inbox/1001-2009-06-06-01-15-11.tif
- //echo "cd $dir_fax; /usr/local/bin/tiff2png ".$dir_fax.$faxname.".tif\n";
- exec("cd $dir_fax; /usr/local/bin/tiff2png ".$dir_fax.$faxname.".tif");
-}
-
-if (!file_exists($dir_fax.$faxname.".pdf")) {
- //echo "cd $dir_fax; /usr/local/bin/tiff2pdf -f -o ".$faxname.".pdf ".$dir_fax.$faxname.".tif\n";
- exec("cd $dir_fax; /usr/local/bin/tiff2pdf -f -o ".$faxname.".pdf ".$dir_fax.$faxname.".tif");
-}
-
-
-$tmp_subject = "Fax Received: ".$faxname;
-$tmp_textplain = "\nFax Received:\n";
-$tmp_textplain .= "Name: ".$faxname."\n";
-$tmp_textplain .= "Extension: ".$faxextension."\n";
-$tmp_texthtml = $tmp_textplain;
-
-
-$tmp_smtphost = $config['installedpackages']['freeswitchsettings']['config'][0]['smtphost'];
-$tmp_smtpsecure = $config['installedpackages']['freeswitchsettings']['config'][0]['smtpsecure']; //options "", "TLS", "SSL"
-$tmp_smtpsecure = strtolower($tmp_smtpsecure);
-$tmp_smtpauth = $config['installedpackages']['freeswitchsettings']['config'][0]['smtpauth']; // SMTP authentication: true or false
-$tmp_smtpusername = $config['installedpackages']['freeswitchsettings']['config'][0]['smtpusername'];
-$tmp_smtppassword = $config['installedpackages']['freeswitchsettings']['config'][0]['smtppassword'];
-$tmp_smtpfrom = $config['installedpackages']['freeswitchsettings']['config'][0]['smtpfrom'];
-$tmp_smtpfromname = $config['installedpackages']['freeswitchsettings']['config'][0]['smtpfromname'];
-
-ini_set(max_execution_time,900); //15 minutes
-ini_set('memory_limit', '96M');
-$fd = fopen("php://stdin", "r");
-
-$email = file_get_contents ("php://stdin");
-
-fclose($fd);
-
-if($fd){
- $fp = fopen("/tmp/faxtoemail.txt", "w");
-}
-
-
-
-
-
-
-
-//send the email
-
- include "/usr/local/www/packages/freeswitch/class.phpmailer.php";
- include "/usr/local/www/packages/freeswitch/class.smtp.php"; // optional, gets called from within class.phpmailer.php if not already loaded
-
- $mail = new PHPMailer();
-
- $mail->IsSMTP(); // set mailer to use SMTP
- if ($tmp_smtpauth == "true") {
- $mail->SMTPAuth = $tmp_smtpauth; // turn on/off SMTP authentication
- }
- $mail->Host = $tmp_smtphost;
- if (strlen($tmp_smtpsecure)>0) {
- $mail->SMTPSecure = $tmp_smtpsecure;
- }
- if ($tmp_smtpusername) {
- $mail->Username = $tmp_smtpusername;
- $mail->Password = $tmp_smtppassword;
- }
- $mail->SMTPDebug = 2;
-
- echo "tmp_smtpfrom: $tmp_smtpfrom\n";
- echo "tmp_smtpfromname: $tmp_smtpfromname\n";
- echo "tmp_subject: $tmp_subject\n";
-
- $mail->From = $tmp_smtpfrom;
- $mail->FromName = $tmp_smtpfromname;
- $mail->Subject = $tmp_subject;
- $mail->AltBody = $tmp_textplain; // optional, comment out and test
- $mail->MsgHTML($tmp_texthtml);
-
-
- $tmp_to = $faxemail;
- $tmp_to = str_replace(";", ",", $tmp_to);
- $tmp_to_array = split(",", $tmp_to);
- foreach($tmp_to_array as $tmp_to_row) {
- if (strlen($tmp_to_row) > 0) {
- echo "tmp_to_row: $tmp_to_row\n";
- $mail->AddAddress($tmp_to_row);
- }
- }
-
- if (strlen($faxname) > 0) {
- $mail->AddAttachment($dir_fax.$faxname.'.tif'); // tif attachment
- $mail->AddAttachment($dir_fax.$faxname.'.pdf'); // pdf attachment
- $mail->AddAttachment($dir_fax.$faxname.'.png'); // png attachment
- //$filename='fax.tif'; $encoding = "base64"; $type = "image/tif";
- //$mail->AddStringAttachment(base64_decode($strfax),$filename,$encoding,$type);
- }
-
- if(!$mail->Send()) {
- echo "Mailer Error: " . $mail->ErrorInfo;
- }
- else {
- echo "Message sent!";
- }
-
-
-$content = ob_get_contents(); //get the output from the buffer
-ob_end_clean(); //clean the buffer
-
-fwrite($fp, $content);
-fclose($fp);
-
-?> \ No newline at end of file
diff --git a/config/freeswitch/freeswitch.inc b/config/freeswitch/freeswitch.inc
deleted file mode 100644
index 3a2be3c2..00000000
--- a/config/freeswitch/freeswitch.inc
+++ /dev/null
@@ -1,3784 +0,0 @@
-<?php
-/* $Id$ */
-/*
-/* ========================================================================== */
-/*
- freeswitch.inc
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-//ob_start("ob_gzhandler");
-
-function build_menu() {
-
- //$script_name_array = split ("/", $_SERVER["SCRIPT_NAME"]);
- //$script_name = $script_name_array[count($script_name_array)-1];
- //echo "script_name: ".$script_name."<br />";
-
- $tab_array = array();
- $menu_selected = false;
- if ($_SERVER["SCRIPT_NAME"] == "/pkg_edit.php?xml=freeswitch.xml&amp;id=0") { $menu_selected = true; }
- $tab_array[] = array(gettext("Settings"), $menu_selected, "/pkg_edit.php?xml=freeswitch.xml&amp;id=0");
- unset($menu_selected);
-
- $menu_selected = false;
- if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_dialplan_includes.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_dialplan.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_dialplan_includes_edit.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_dialplan_includes_details_edit.php") { $menu_selected = true; }
- $tab_array[] = array(gettext("Dialplan"), $menu_selected, "/packages/freeswitch/freeswitch_dialplan_includes.php");
- unset($menu_selected);
-
- $menu_selected = false;
- if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_extensions.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_extensions_edit.php") { $menu_selected = true; }
- $tab_array[] = array(gettext("Extensions"), $menu_selected, "/packages/freeswitch/freeswitch_extensions.php");
- unset($menu_selected);
-
- $menu_selected = false;
- if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_features.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_fax.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_fax_edit.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_ivr.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_ivr_edit.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_ivr_options_edit.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_recordings.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_recordings_edit.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_hunt_group.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_hunt_group_edit.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_hunt_group_destinations.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_hunt_group_destinations_edit.php") { $menu_selected = true; }
- $tab_array[] = array(gettext("Features"), $menu_selected, "/packages/freeswitch/freeswitch_features.php");
- unset($menu_selected);
-
- $menu_selected = false;
- if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_gateways.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_gateways_edit.php") { $menu_selected = true; }
- $tab_array[] = array(gettext("Gateways"), $menu_selected, "/packages/freeswitch/freeswitch_gateways.php");
- unset($menu_selected);
-
- $menu_selected = false;
- if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_profiles.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_profile_edit.php") { $menu_selected = true; }
- $tab_array[] = array(gettext("Profiles"), $menu_selected, "/packages/freeswitch/freeswitch_profiles.php");
- unset($menu_selected);
-
- $menu_selected = false;
- if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_public.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_public_includes.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_public_includes_edit.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_public_includes_details_edit.php") { $menu_selected = true; }
- $tab_array[] = array(gettext("Public"), $menu_selected, "/packages/freeswitch/freeswitch_public_includes.php");
- unset($menu_selected);
-
- $menu_selected = false;
- if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_status.php") { $menu_selected = true; }
- $tab_array[] = array(gettext("Status"), $menu_selected, "/packages/freeswitch/freeswitch_status.php");
- unset($menu_selected);
-
- $menu_selected = false;
- if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_vars.php") { $menu_selected = true; }
- $tab_array[] = array(gettext("Vars"), $menu_selected, "/packages/freeswitch/freeswitch_vars.php");
- unset($menu_selected);
-
- return $tab_array;
-}
-
-
-function guid()
-{
- if (function_exists('com_create_guid')){
- return com_create_guid();
- }else{
- mt_srand((double)microtime()*10000);//optional for php 4.2.0 and up.
- $charid = strtoupper(md5(uniqid(rand(), true)));
- $hyphen = chr(45);// "-"
- $uuid = chr(123)// "{"
- .substr($charid, 0, 8).$hyphen
- .substr($charid, 8, 4).$hyphen
- .substr($charid,12, 4).$hyphen
- .substr($charid,16, 4).$hyphen
- .substr($charid,20,12)
- .chr(125);// "}"
- return $uuid;
- }
-}
-//echo guid();
-
-
-if (!function_exists("pkg_is_service_running")) {
- function pkg_is_service_running($servicename)
- {
- //exec("/bin/ps ax | awk '{ print $5 }'", $psout);
- //array_shift($psout);
- //foreach($psout as $line) {
- // $ps[] = trim(array_pop(explode(' ', array_pop(explode('/', $line)))));
- //}
- //if(pkg_is_service_running($servicename, $ps) or is_process_running($servicename) ) {
- return true;
- //}
- //else {
- // return false;
- //}
- }
-}
-
-
-function event_socket_create($host, $port, $password)
-{
- //$host has been deprecated
-
- //build the interface list
- $i = 0; $ifdescrs = array('wan' => 'WAN', 'lan' => 'LAN');
- for ($j = 1; isset($config['interfaces']['opt' . $j]); $j++) {
- $ifdescrs['opt' . $j] = $config['interfaces']['opt' . $j]['descr'];
- }
-
- //get the interface ip addresses and try to connect to them
- foreach ($ifdescrs as $ifdescr => $ifname){
- $ifinfo = get_interface_info($ifdescr);
- $interface_ip_address = $ifinfo['ipaddr'];
-
- if (strlen($interface_ip_address) > 0) {
-
- $fp = fsockopen($interface_ip_address, $port, $errno, $errdesc, 3);
- socket_set_blocking($fp,false);
-
- if (!$fp) {
- //connection failed continue through the loop testing other addresses
- //invalid handle
- }
- else {
- //connected to the socket return the handle
-
- while (!feof($fp)) {
- $buffer = fgets($fp, 1024);
- usleep(100); //allow time for reponse
- if (trim($buffer) == "Content-Type: auth/request") {
- fputs($fp, "auth $password\n\n");
- break;
- }
- }
- return $fp;
- }
-
- } //end if interface_ip_address
- } //end foreach
-} //end function
-
-
-function event_socket_request($fp, $cmd)
-{
- if ($fp) {
- fputs($fp, $cmd."\n\n");
- usleep(100); //allow time for reponse
-
- $response = "";
- $i = 0;
- $contentlength = 0;
- while (!feof($fp)) {
- $buffer = fgets($fp, 4096);
- if ($contentlength > 0) {
- $response .= $buffer;
- }
-
- if ($contentlength == 0) { //if contentlenght is already don't process again
- if (strlen(trim($buffer)) > 0) { //run only if buffer has content
- $temparray = split(":", trim($buffer));
- if ($temparray[0] == "Content-Length") {
- $contentlength = trim($temparray[1]);
- }
- }
- }
-
- usleep(100); //allow time for reponse
-
- //optional because of script timeout //don't let while loop become endless
- if ($i > 10000) { break; }
-
- if ($contentlength > 0) { //is contentlength set
- //stop reading if all content has been read.
- if (strlen($response) >= $contentlength) {
- break;
- }
- }
- $i++;
- }
-
- return $response;
- }
- else {
- echo "no handle";
- }
-}
-
-
-function event_socket_request_cmd($cmd)
-{
- global $config;
- $password = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password'];
- $port = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port'];
- $host = $config['interfaces']['lan']['ipaddr'];
-
- if (pkg_is_service_running('freeswitch')) {
- $fp = event_socket_create($host, $port, $password);
- $response = event_socket_request($fp, $cmd);
- fclose($fp);
- }
- unset($host, $port, $password);
-
-}
-
-function byte_convert( $bytes ) {
-
- if ($bytes<=0)
- return '0 Byte';
-
- $convention=1000; //[1000->10^x|1024->2^x]
- $s=array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB');
- $e=floor(log($bytes,$convention));
- return round($bytes/pow($convention,$e),2).' '.$s[$e];
-}
-
-function ListFiles($dir) {
-
- if($dh = opendir($dir)) {
-
- $files = Array();
- $inner_files = Array();
-
- while($file = readdir($dh)) {
- if($file != "." && $file != ".." && $file[0] != '.') {
- if(is_dir($dir . "/" . $file)) {
- //$inner_files = ListFiles($dir . "/" . $file); //recursive
- if(is_array($inner_files)) $files = array_merge($files, $inner_files);
- } else {
- array_push($files, $file);
- //array_push($files, $dir . "/" . $file);
- }
- }
- }
-
- closedir($dh);
- return $files;
- }
-}
-
-function recording_js()
-{
-
- global $config;
- $admin_pin = $config['installedpackages']['freeswitchsettings']['config'][0]['admin_pin'];
-
- $fout = fopen("/usr/local/freeswitch/scripts/recordings.js","w");
- $tmp = " var pin = \"".$admin_pin."\";\n";
- $tmp .= " //var pin = \"\"; //don't require a pin\n";
- $tmp .= " //if you choose not to require a pin then then you may want to add a dialplan condition for a specific caller id\n";
- $tmp .= "\n";
- $tmp .= " var digitmaxlength = 0;\n";
- $tmp .= " var timeoutpin = 7500;\n";
- $tmp .= " var timeouttransfer = 7500;\n";
- $tmp .= " var objdate = new Date();\n";
- $tmp .= "\n";
- $tmp .= " var adjusthours = 0; //Adjust Server time that is set to GMT 7 hours\n";
- $tmp .= " var adjustoperator = \"-\"; //+ or -\n";
- $tmp .= "\n";
- $tmp .= " if (adjustoperator == \"-\") {\n";
- $tmp .= " var objdate2 = new Date(objdate.getFullYear(),objdate.getMonth(),objdate.getDate(),(objdate.getHours() - adjusthours),objdate.getMinutes(),objdate.getSeconds());\n";
- $tmp .= " }\n";
- $tmp .= " if (adjustoperator == \"+\") {\n";
- $tmp .= " var objdate2 = new Date(objdate.getFullYear(),objdate.getMonth(),objdate.getDate(),(objdate.getHours() + adjusthours),objdate.getMinutes(),objdate.getSeconds());\n";
- $tmp .= " }\n";
- $tmp .= "\n";
- $tmp .= " var Hours = objdate2.getHours();\n";
- $tmp .= " var Mins = objdate2.getMinutes();\n";
- $tmp .= " var Seconds = objdate2.getSeconds();\n";
- $tmp .= " var Month = objdate2.getMonth() + 1;\n";
- $tmp .= " var Date = objdate2.getDate();\n";
- $tmp .= " var Year = objdate2.getYear()\n";
- $tmp .= " var Day = objdate2.getDay()+1;\n";
- $tmp .= " var exit = false;\n";
- $tmp .= "\n";
- $tmp .= "\n";
- $tmp .= " function mycb( session, type, data, arg ) {\n";
- $tmp .= " if ( type == \"dtmf\" ) {\n";
- $tmp .= " //console_log( \"info\", \"digit: \"+data.digit+\"\\n\" );\n";
- $tmp .= " if ( data.digit == \"#\" ) {\n";
- $tmp .= " //console_log( \"info\", \"detected pound sign.\\n\" );\n";
- $tmp .= " return( true );\n";
- $tmp .= " }\n";
- $tmp .= " dtmf.digits += data.digit;\n";
- $tmp .= "\n";
- $tmp .= " if ( dtmf.digits.length < digitmaxlength ) {\n";
- $tmp .= " return( true );\n";
- $tmp .= " }\n";
- $tmp .= " }\n";
- $tmp .= " return( false );\n";
- $tmp .= " }\n";
- $tmp .= "\n";
- $tmp .= " //console_log( \"info\", \"Recording Request\\n\" );\n";
- $tmp .= "\n";
- $tmp .= " var dtmf = new Object( );\n";
- $tmp .= " dtmf.digits = \"\";\n";
- $tmp .= "\n";
- $tmp .= " if ( session.ready( ) ) {\n";
- $tmp .= " session.answer( );\n";
- $tmp .= "\n";
-
- $tmp .= "\n";
- $tmp .= " if (pin.length > 0) {\n";
- //$tmp .= " session.execute(\"set\", \"tts_engine=flite\");\n";
- //$tmp .= " session.execute(\"set\", \"tts_voice=kal\");\n";
- //$tmp .= " session.execute(\"speak\", \"Please enter your pin number now.\");\n";
- $tmp .= " digitmaxlength = 6;\n";
- $tmp .= " session.execute(\"set\", \"playback_terminators=#\");\n";
- $tmp .= " session.streamFile( \"/usr/local/freeswitch/sounds/custom/8000/please_enter_the_pin_number.wav\", mycb, \"dtmf\");\n";
- $tmp .= " session.collectInput( mycb, dtmf, timeoutpin );\n";
- $tmp .= " }\n";
- $tmp .= "\n";
- $tmp .= " if (dtmf.digits == pin || pin.length == 0) {\n";
- //$tmp .= " //console_log( \"info\", \"Recordings pin is correct\\n\" );\n";
- //$tmp .= " session.execute(\"set\", \"tts_engine=flite\");\n";
- //$tmp .= " session.execute(\"set\", \"tts_voice=kal\");\n";
- //$tmp .= " session.execute(\"speak\", \"Begin recording.\");\n";
- $tmp .= " session.streamFile( \"/usr/local/freeswitch/sounds/custom/8000/begin_recording.wav\", mycb, \"dtmf\");\n";
- $tmp .= " session.execute(\"set\", \"playback_terminators=#\");\n";
- $tmp .= " session.execute(\"record\", \"/usr/local/freeswitch/recordings/temp\"+Year+Month+Day+Hours+Mins+Seconds+\".wav 180 200\");\n";
- $tmp .= " }\n";
- $tmp .= " else {\n";
- $tmp .= " console_log( \"info\", \"Pin: \" + dtmf.digits + \" is incorrect\\n\" );\n";
- //$tmp .= " session.execute(\"set\", \"tts_engine=flite\");\n";
- //$tmp .= " session.execute(\"set\", \"tts_voice=kal\");\n";
- //$tmp .= " session.execute(\"speak\", \"Your pin number is incorect, goodbye.\");\n";
- $tmp .= " session.streamFile( \"/usr/local/freeswitch/sounds/custom/8000/your_pin_number_is_incorect_goodbye.wav\", mycb, \"dtmf\");\n";
- $tmp .= " }\n";
- $tmp .= " session.hangup();\n";
- $tmp .= "\n";
- $tmp .= " }";
- fwrite($fout, $tmp);
- unset($tmp);
- fclose($fout);
-
-}
-
-
-function sync_package_freeswitch_settings()
-{
-
- global $config;
- if($config['installedpackages']['freeswitchsettings']['config'] != "") {
-
- conf_mount_rw();
- config_unlock();
-
- foreach($config['installedpackages']['freeswitchsettings']['config'] as $rowhelper) {
-
- $fout = fopen("/usr/local/freeswitch/conf/directory/default/default.xml","w");
- $tmpxml = "<include>\n";
- $tmpxml .= " <user id=\"default\"> <!--if id is numeric mailbox param is not necessary-->\n";
- $tmpxml .= " <variables>\n";
- $tmpxml .= " <!--all variables here will be set on all inbound calls that originate from this user -->\n";
- $tmpxml .= " <!-- set these to take advantage of a dialplan localized to this user -->\n";
- $tmpxml .= " <variable name=\"numbering_plan\" value=\"" . $rowhelper['numbering_plan'] . "\"/>\n";
- $tmpxml .= " <variable name=\"default_gateway\" value=\"" . $rowhelper['default_gateway'] . "\"/>\n";
- $tmpxml .= " <variable name=\"default_area_code\" value=\"" . $rowhelper['default_area_code'] . "\"/>\n";
- $tmpxml .= " </variables>\n";
- $tmpxml .= " </user>\n";
- $tmpxml .= "</include>\n";
- fwrite($fout, $tmpxml);
- unset($tmpxml);
- fclose($fout);
-
- $fout = fopen("/usr/local/freeswitch/conf/autoload_configs/event_socket.conf.xml","w");
- $tmpxml = "<configuration name=\"event_socket.conf\" description=\"Socket Client\">\n";
- $tmpxml .= " <settings>\n";
- $tmpxml .= " <param name=\"listen-ip\" value=\"0.0.0.0\"/>\n";
- $tmpxml .= " <param name=\"listen-port\" value=\"" . $rowhelper['event_socket_port'] . "\"/>\n";
- $tmpxml .= " <param name=\"password\" value=\"" . $rowhelper['event_socket_password'] . "\"/>\n";
- $tmpxml .= " <!--<param name=\"apply-inbound-acl\" value=\"lan\"/>-->\n";
- $tmpxml .= " </settings>\n";
- $tmpxml .= "</configuration>";
- fwrite($fout, $tmpxml);
- unset($tmpxml, $event_socket_password);
- fclose($fout);
-
- $fout = fopen("/usr/local/freeswitch/conf/autoload_configs/xml_rpc.conf","w");
- $tmpxml = "<configuration name=\"xml_rpc.conf\" description=\"XML RPC\">\n";
- $tmpxml .= " <settings>\n";
- $tmpxml .= " <!-- The port where you want to run the http service (default 8080) -->\n";
- $tmpxml .= " <param name=\"http-port\" value=\"" . $rowhelper['xml_rpc_http_port'] . "\"/>\n";
- $tmpxml .= " <!-- if all 3 of the following params exist all http traffic will require auth -->\n";
- $tmpxml .= " <param name=\"auth-realm\" value=\"" . $rowhelper['xml_rpc_auth_realm'] . "\"/>\n";
- $tmpxml .= " <param name=\"auth-user\" value=\"" . $rowhelper['xml_rpc_auth_user'] . "\"/>\n";
- $tmpxml .= " <param name=\"auth-pass\" value=\"" . $rowhelper['xml_rpc_auth_pass'] . "\"/>\n";
- $tmpxml .= " </settings>\n";
- $tmpxml .= "</configuration>\n";
- fwrite($fout, $tmpxml);
- unset($tmpxml);
- fclose($fout);
-
- recording_js();
-
- //shout.conf.xml
- $fout = fopen("/usr/local/freeswitch/conf/autoload_configs/shout.conf.xml","w");
- $tmpxml = "<configuration name=\"shout.conf\" description=\"mod shout config\">\n";
- $tmpxml .= " <settings>\n";
- $tmpxml .= " <!-- Don't change these unless you are insane -->\n";
- $tmpxml .= " <param name=\"decoder\" value=\"" . $rowhelper['mod_shout_decoder'] . "\"/>\n";
- $tmpxml .= " <param name=\"volume\" value=\"" . $rowhelper['mod_shout_volume'] . "\"/>\n";
- $tmpxml .= " <!--<param name=\"outscale\" value=\"8192\"/>-->\n";
- $tmpxml .= " </settings>\n";
- $tmpxml .= "</configuration>";
- fwrite($fout, $tmpxml);
- unset($tmpxml);
- fclose($fout);
-
- //config.js
- $admin_pin = $config['installedpackages']['freeswitchsettings']['config'][0]['admin_pin'];
- $fout = fopen("/usr/local/freeswitch/scripts/config.js","w");
- $tmp = "//javascript include\n\n";
- $tmp .= "var admin_pin = \"" . $admin_pin . "\";\n";
- fwrite($fout, $tmp);
- unset($tmp);
- fclose($fout);
-
- }
-
- conf_mount_ro();
- $cmd = "api reloadxml";
- //event_socket_request_cmd($cmd);
- unset($cmd);
- }
-}
-
-
-function sync_package_freeswitch_dialplan()
-{
-
- global $config;
- conf_mount_rw();
- config_unlock();
-
- //using backup files rather than pfsense config.xml for this file
- $config['installedpackages']['freeswitchpublic']['config'][0]['dialplan_default_xml'] = "";
-
- //if(strlen($config['installedpackages']['freeswitchdialplan']['config'][0]['dialplan_default_xml']) == 0) {
- /* dialplan not found in the pfsense config.xml get the default dialplan and save to config.xml. */
- //$filename = "/usr/local/freeswitch/conf/dialplan/default.xml";
- //$fout = fopen($filename,"r");
- //$tmpxml = fread($fout, filesize($filename));
- //$config['installedpackages']['freeswitchdialplan']['config'][0]['dialplan_default_xml'] = base64_encode($tmpxml);
- //unset($filename, $dialplan);
- //fclose($fout);
- //}
- //else {
- /* found the dialplan in the pfsense config.xml save it to default.xml. */
- //$fout = fopen("/usr/local/freeswitch/conf/dialplan/default.xml","w");
- //$tmpxml = $config['installedpackages']['freeswitchdialplan']['config'][0]['dialplan_default_xml'];
- //fwrite($fout, base64_decode($tmpxml));
- //fclose($fout);
- //unset($tmpxml);
- //}
-
- conf_mount_ro();
- //$cmd = "api reloadxml";
- //event_socket_request_cmd($cmd);
- //unset($cmd);
-
-}
-
-
-function sync_package_freeswitch_extensions()
-{
-
- global $config;
- if($config['installedpackages']['freeswitchextensions']['config'] != "") {
-
- conf_mount_rw();
- config_unlock();
-
- /* delete all old extensions to prepare for new ones */
- unlink_if_exists("/usr/local/freeswitch/conf/directory/default/1*.xml");
- unlink_if_exists("/usr/local/freeswitch/conf/directory/default/2*.xml");
- unlink_if_exists("/usr/local/freeswitch/conf/directory/default/3*.xml");
- unlink_if_exists("/usr/local/freeswitch/conf/directory/default/4*.xml");
- unlink_if_exists("/usr/local/freeswitch/conf/directory/default/5*.xml");
- unlink_if_exists("/usr/local/freeswitch/conf/directory/default/6*.xml");
- unlink_if_exists("/usr/local/freeswitch/conf/directory/default/7*.xml");
- unlink_if_exists("/usr/local/freeswitch/conf/directory/default/8*.xml");
- unlink_if_exists("/usr/local/freeswitch/conf/directory/default/9*.xml");
-
- foreach($config['installedpackages']['freeswitchextensions']['config'] as $rowhelper) {
- if ($rowhelper['enabled'] != "false") {
- $fout = fopen("/usr/local/freeswitch/conf/directory/default/".$rowhelper['extension'].".xml","w");
-
- $tmpxml = "<include>\n";
- if (strlen($rowhelper['cidr']) == 0) {
- $tmpxml .= " <user id=\"" . $rowhelper['extension'] . "\" mailbox=\"" . $rowhelper['mailbox'] . "\">\n";
- }
- else {
- $tmpxml .= " <user id=\"" . $rowhelper['extension'] . "\" mailbox=\"" . $rowhelper['mailbox'] . "\" cidr=\"" . $rowhelper['cidr'] . "\">\n";
- }
- $tmpxml .= " <params>\n";
- $tmpxml .= " <param name=\"password\" value=\"" . $rowhelper['password'] . "\"/>\n";
- $tmpxml .= " <param name=\"vm-password\" value=\"" . $rowhelper['vm-password'] . "\"/>\n";
- if (strlen($rowhelper['vm-mailto']) > 0) {
- $tmpxml .= " <param name=\"vm-email-all-messages\" value=\"true\"/>\n";
-
- switch ($rowhelper['vm-attach-file']) {
- case "true":
- $tmpxml .= " <param name=\"vm-attach-file\" value=\"true\"/>\n";
- break;
- case "false":
- $tmpxml .= " <param name=\"vm-attach-file\" value=\"false\"/>\n";
- break;
- default:
- $tmpxml .= " <param name=\"vm-attach-file\" value=\"true\"/>\n";
- }
- switch ($rowhelper['vm-keep-local-after-email']) {
- case "true":
- $tmpxml .= " <param name=\"vm-keep-local-after-email\" value=\"true\"/>\n";
- break;
- case "false":
- $tmpxml .= " <param name=\"vm-keep-local-after-email\" value=\"false\"/>\n";
- break;
- default:
- $tmpxml .= " <param name=\"vm-keep-local-after-email\" value=\"true\"/>\n";
- }
- $tmpxml .= " <param name=\"vm-mailto\" value=\"" . $rowhelper['vm-mailto'] . "\"/>\n";
- }
- if (strlen($rowhelper['auth-acl']) > 0) {
- $tmpxml .= " <param name=\"auth-acl\" value=\"" . $rowhelper['auth-acl'] . "\"/>\n";
- }
- $tmpxml .= " </params>\n";
- $tmpxml .= " <variables>\n";
- $tmpxml .= " <variable name=\"toll_allow\" value=\"domestic,international,local\"/>\n";
- $tmpxml .= " <variable name=\"accountcode\" value=\"" . $rowhelper['accountcode'] . "\"/>\n";
- $tmpxml .= " <variable name=\"user_context\" value=\"" . $rowhelper['user_context'] . "\"/>\n";
- if (strlen($rowhelper['effective_caller_id_number']) > 0) {
- $tmpxml .= " <variable name=\"effective_caller_id_name\" value=\"" . $rowhelper['effective_caller_id_name'] . "\"/>\n";
- $tmpxml .= " <variable name=\"effective_caller_id_number\" value=\"" . $rowhelper['effective_caller_id_number'] . "\"/>\n";
- }
- if (strlen($rowhelper['outbound_caller_id_number']) > 0) {
- $tmpxml .= " <variable name=\"outbound_caller_id_name\" value=\"" . $rowhelper['outbound_caller_id_name'] . "\"/>\n";
- $tmpxml .= " <variable name=\"outbound_caller_id_number\" value=\"" . $rowhelper['outbound_caller_id_number'] . "\"/>\n";
- }
- if (strlen($rowhelper['sip-force-contact']) > 0) {
- $tmpxml .= " <variable name=\"sip-force-contact\" value=\"" . $rowhelper['sip-force-contact'] . "\"/>\n";
- }
- $tmpxml .= " </variables>\n";
- $tmpxml .= " </user>\n";
- $tmpxml .= "</include>\n";
- fwrite($fout, $tmpxml);
- unset($tmpxml);
- fclose($fout);
- }
- }
-
- conf_mount_ro();
- $cmd = "api reloadxml";
- //event_socket_request_cmd($cmd);
- unset($cmd);
-
- }
-}
-
-
-function sync_package_freeswitch_gateways()
-{
-
- global $config;
- if($config['installedpackages']['freeswitchgateways']['config'] != "") {
-
- conf_mount_rw();
- config_unlock();
-
- /* delete all old gateways to prepare for new ones */
- unlink_if_exists("/usr/local/freeswitch/conf/sip_profiles/external/*.xml");
-
- foreach($config['installedpackages']['freeswitchgateways']['config'] as $rowhelper) {
-
- if ($rowhelper['enabled'] != "false") {
- $fout = fopen("/usr/local/freeswitch/conf/sip_profiles/external/".$rowhelper['gateway'].".xml","w");
-
- $tmpxml .= "<include>\n";
- $tmpxml .= " <gateway name=\"" . $rowhelper['gateway'] . "\">\n";
- if (strlen($rowhelper['username']) > 0) {
- $tmpxml .= " <param name=\"username\" value=\"" . $rowhelper['username'] . "\"/>\n";
- }
- if (strlen($rowhelper['auth-username']) > 0) {
- $tmpxml .= " <param name=\"auth-username\" value=\"" . $rowhelper['auth-username'] . "\"/>\n";
- }
- if (strlen($rowhelper['password']) > 0) {
- $tmpxml .= " <param name=\"password\" value=\"" . $rowhelper['password'] . "\"/>\n";
- }
- if (strlen($rowhelper['realm']) > 0) {
- $tmpxml .= " <param name=\"realm\" value=\"" . $rowhelper['realm'] . "\"/>\n";
- }
- if (strlen($rowhelper['from-user']) > 0) {
- $tmpxml .= " <param name=\"from-user\" value=\"" . $rowhelper['from-user'] . "\"/>\n";
- }
- if (strlen($rowhelper['from-domain']) > 0) {
- $tmpxml .= " <param name=\"from-domain\" value=\"" . $rowhelper['from-domain'] . "\"/>\n";
- }
- if (strlen($rowhelper['proxy']) > 0) {
- $tmpxml .= " <param name=\"proxy\" value=\"" . $rowhelper['proxy'] . "\"/>\n";
- }
- if (strlen($rowhelper['expire-seconds']) > 0) {
- $tmpxml .= " <param name=\"expire-seconds\" value=\"" . $rowhelper['expire-seconds'] . "\"/>\n";
- }
- if (strlen($rowhelper['register']) > 0) {
- $tmpxml .= " <param name=\"register\" value=\"" . $rowhelper['register'] . "\"/>\n";
- }
-
- if (strlen($rowhelper['register-transport']) > 0) {
- switch ($rowhelper['register-transport']) {
- case "udp":
- $tmpxml .= " <param name=\"register-transport\" value=\"udp\"/>\n";
- break;
- case "tcp":
- $tmpxml .= " <param name=\"register-transport\" value=\"tcp\"/>\n";
- break;
- case "tls":
- $tmpxml .= " <param name=\"register-transport\" value=\"tls\"/>\n";
- $tmpxml .= " <param name=\"contact-params\" value=\"transport=tls\"/>\n";
- break;
- default:
- $tmpxml .= " <param name=\"register-transport\" value=\"" . $rowhelper['register-transport'] . "\"/>\n";
- }
- }
-
- if (strlen($rowhelper['retry-seconds']) > 0) {
- $tmpxml .= " <param name=\"retry-seconds\" value=\"" . $rowhelper['retry-seconds'] . "\"/>\n";
- }
- if (strlen($rowhelper['extension']) > 0) {
- $tmpxml .= " <param name=\"extension\" value=\"" . $rowhelper['extension'] . "\"/>\n";
- }
- if (strlen($rowhelper['ping']) > 0) {
- $tmpxml .= " <param name=\"ping\" value=\"" . $rowhelper['ping'] . "\"/>\n";
- }
- if (strlen($rowhelper['context']) > 0) {
- $tmpxml .= " <param name=\"context\" value=\"" . $rowhelper['context'] . "\"/>\n";
- }
- if (strlen($rowhelper['caller-id-in-from']) > 0) {
- $tmpxml .= " <param name=\"caller-id-in-from\" value=\"" . $rowhelper['caller-id-in-from'] . "\"/>\n";
- }
- if (strlen($rowhelper['supress-cng']) > 0) {
- $tmpxml .= " <param name=\"supress-cng\" value=\"" . $rowhelper['supress-cng'] . "\"/>\n";
- }
-
- $tmpxml .= " </gateway>\n";
- $tmpxml .= "</include>";
-
- fwrite($fout, $tmpxml);
- unset($tmpxml);
- fclose($fout);
- }
-
- }
-
- conf_mount_ro();
- $cmd = "api sofia profile external restart reloadxml";
- //event_socket_request_cmd($cmd);
- unset($cmd);
-
- }
-
-}
-
-
-function sync_package_freeswitch_modules()
-{
-
- global $config;
- conf_mount_rw();
- config_unlock();
-
- foreach($config['installedpackages']['freeswitchmodules']['config'] as $rowhelper) {
- $fout = fopen("/usr/local/freeswitch/conf/autoload_configs/modules.conf.xml","w");
-
- $tmpxml ="";
- $tmpxml .= "<configuration name=\"modules.conf\" description=\"Modules\">\n";
- $tmpxml .= " <modules>\n";
- $tmpxml .= "\n";
- $tmpxml .= " <!-- Loggers (I'd load these first) -->\n";
- if ($rowhelper['mod_console'] == "enable"){ $tmpxml .= " <load module=\"mod_console\"/>\n"; }
- if ($rowhelper['mod_logfile'] == "enable"){ $tmpxml .= " <load module=\"mod_logfile\"/>\n"; }
- if ($rowhelper['mod_syslog'] == "enable"){ $tmpxml .= " <load module=\"mod_syslog\"/>\n"; }
- $tmpxml .= "\n";
- if ($rowhelper['mod_yaml'] == "enable"){ $tmpxml .= " <load module=\"mod_yaml\"/>\n"; }
- $tmpxml .= "\n";
- $tmpxml .= " <!-- Multi-Faceted -->\n";
- $tmpxml .= " <!-- mod_enum is a dialplan interface, an application interface and an api command interface -->\n";
- if ($rowhelper['mod_enum'] == "enable"){ $tmpxml .= " <load module=\"mod_enum\"/>\n"; }
- $tmpxml .= "\n";
- $tmpxml .= " <!-- XML Interfaces -->\n";
- if ($rowhelper['mod_xml_rpc'] == "enable"){ $tmpxml .= " <load module=\"mod_xml_rpc\"/>\n"; }
- if ($rowhelper['mod_xml_curl'] == "enable"){ $tmpxml .= " <load module=\"mod_xml_curl\"/>\n"; }
- if ($rowhelper['mod_xml_cdr'] == "enable"){ $tmpxml .= " <load module=\"mod_xml_cdr\"/>\n"; }
- $tmpxml .= "\n";
- $tmpxml .= " <!-- Event Handlers -->\n";
- if ($rowhelper['mod_cdr_csv'] == "enable"){ $tmpxml .= " <load module=\"mod_cdr_csv\"/>\n"; }
- if ($rowhelper['mod_event_multicast'] == "enable"){ $tmpxml .= " <load module=\"mod_event_multicast\"/>\n"; }
- if ($rowhelper['mod_event_socket'] == "enable"){ $tmpxml .= " <load module=\"mod_event_socket\"/>\n"; }
- if ($rowhelper['mod_zeroconf'] == "enable"){ $tmpxml .= " <load module=\"mod_zeroconf\"/>\n"; }
- $tmpxml .= "\n";
- $tmpxml .= " <!-- Directory Interfaces -->\n";
- if ($rowhelper['mod_ldap'] == "enable"){ $tmpxml .= " <load module=\"mod_ldap\"/>\n"; }
- $tmpxml .= "\n";
- $tmpxml .= " <!-- Endpoints -->\n";
- if ($rowhelper['mod_dingaling'] == "enable"){ $tmpxml .= " <load module=\"mod_dingaling\"/>\n"; }
- if ($rowhelper['mod_iax'] == "enable"){ $tmpxml .= " <load module=\"mod_iax\"/>\n"; }
- if ($rowhelper['mod_portaudio'] == "enable"){ $tmpxml .= " <load module=\"mod_portaudio\"/>\n"; }
- if ($rowhelper['mod_alsa'] == "enable"){ $tmpxml .= " <load module=\"mod_alsa\"/>\n"; }
- if ($rowhelper['mod_sofia'] == "enable"){ $tmpxml .= " <load module=\"mod_sofia\"/>\n"; }
- if ($rowhelper['mod_loopback'] == "enable"){ $tmpxml .= " <load module=\"mod_loopback\"/>\n"; }
- if ($rowhelper['mod_wanpipe'] == "enable"){ $tmpxml .= " <load module=\"mod_wanpipe\"/>\n"; }
- if ($rowhelper['mod_woomera'] == "enable"){ $tmpxml .= " <load module=\"mod_woomera\"/>\n"; }
- if ($rowhelper['mod_openzap'] == "enable"){ $tmpxml .= " <load module=\"mod_openzap\"/>\n"; }
- $tmpxml .= "\n";
- $tmpxml .= " <!-- Applications -->\n";
- if ($rowhelper['mod_commands'] == "enable"){ $tmpxml .= " <load module=\"mod_commands\"/>\n"; }
- if ($rowhelper['mod_conference'] == "enable"){ $tmpxml .= " <load module=\"mod_conference\"/>\n"; }
- if ($rowhelper['mod_dptools'] == "enable"){ $tmpxml .= " <load module=\"mod_dptools\"/>\n"; }
- if ($rowhelper['mod_expr'] == "enable"){ $tmpxml .= " <load module=\"mod_expr\"/>\n"; }
- if ($rowhelper['mod_fax'] == "enable"){ $tmpxml .= " <load module=\"mod_fax\"/>\n"; }
- if ($rowhelper['mod_fifo'] == "enable"){ $tmpxml .= " <load module=\"mod_fifo\"/>\n"; }
- if ($rowhelper['mod_voicemail'] == "enable"){ $tmpxml .= " <load module=\"mod_voicemail\"/>\n"; }
- if ($rowhelper['mod_limit'] == "enable"){ $tmpxml .= " <load module=\"mod_limit\"/>\n"; }
- if ($rowhelper['mod_esf'] == "enable"){ $tmpxml .= " <load module=\"mod_esf\"/>\n"; }
- if ($rowhelper['mod_fsv'] == "enable"){ $tmpxml .= " <load module=\"mod_fsv\"/>\n"; }
- $tmpxml .= "\n";
- $tmpxml .= " <!-- SNOM Module -->\n";
- if ($rowhelper['mod_snom'] == "enable"){ $tmpxml .= " <load module=\"mod_snom\"/>\n"; }
- $tmpxml .= "\n";
- $tmpxml .= " <!-- Dialplan Interfaces -->\n";
- if ($rowhelper['mod_dialplan_directory'] == "enable"){ $tmpxml .= " <load module=\"mod_dialplan_directory\"/>\n"; }
- if ($rowhelper['mod_dialplan_xml'] == "enable"){ $tmpxml .= " <load module=\"mod_dialplan_xml\"/>\n"; }
- if ($rowhelper['mod_dialplan_asterisk'] == "enable"){ $tmpxml .= " <load module=\"mod_dialplan_asterisk\"/>\n"; }
- $tmpxml .= "\n";
- $tmpxml .= " <!-- Codec Interfaces -->\n";
- if ($rowhelper['mod_voipcodecs'] == "enable"){ $tmpxml .= " <load module=\"mod_voipcodecs\"/>\n"; }
- if ($rowhelper['mod_g723_1'] == "enable"){ $tmpxml .= " <load module=\"mod_g723_1\"/>\n"; }
- if ($rowhelper['mod_g729'] == "enable"){ $tmpxml .= " <load module=\"mod_g729\"/>\n"; }
- if ($rowhelper['mod_amr'] == "enable"){ $tmpxml .= " <load module=\"mod_amr\"/>\n"; }
- if ($rowhelper['mod_ilbc'] == "enable"){ $tmpxml .= " <load module=\"mod_ilbc\"/>\n"; }
- if ($rowhelper['mod_speex'] == "enable"){ $tmpxml .= " <load module=\"mod_speex\"/>\n"; }
- if ($rowhelper['mod_siren'] == "enable"){ $tmpxml .= " <load module=\"mod_siren\"/>\n"; }
- if ($rowhelper['mod_celt'] == "enable"){ $tmpxml .= " <load module=\"mod_celt\"/>\n"; }
- if ($rowhelper['mod_h26x'] == "enable"){ $tmpxml .= " <load module=\"mod_h26x\"/>\n"; }
- $tmpxml .= "\n";
- $tmpxml .= " <!-- File Format Interfaces -->\n";
- if ($rowhelper['mod_sndfile'] == "enable"){ $tmpxml .= " <load module=\"mod_sndfile\"/>\n"; }
- if ($rowhelper['mod_native_file'] == "enable"){ $tmpxml .= " <load module=\"mod_native_file\"/>\n"; }
- $tmpxml .= " <!--For icecast/mp3 streams/files-->\n";
- if ($rowhelper['mod_shout'] == "enable"){ $tmpxml .= " <load module=\"mod_shout\"/>\n"; }
- $tmpxml .= " <!--For local streams (play all the files in a directory)-->\n";
- if ($rowhelper['mod_local_stream'] == "enable"){ $tmpxml .= " <load module=\"mod_local_stream\"/>\n"; }
- if ($rowhelper['mod_tone_stream'] == "enable"){ $tmpxml .= " <load module=\"mod_tone_stream\"/>\n"; }
- $tmpxml .= "\n";
- $tmpxml .= " <!-- Timers -->\n";
- $tmpxml .= "\n";
- $tmpxml .= " <!-- Languages -->\n";
- if ($rowhelper['mod_spidermonkey'] == "enable"){ $tmpxml .= " <load module=\"mod_spidermonkey\"/>\n"; }
- if ($rowhelper['mod_spidermonkey_odbc'] == "enable"){ $tmpxml .= " <load module=\"mod_spidermonkey_odbc\"/>\n"; }
- if ($rowhelper['mod_perl'] == "enable"){ $tmpxml .= " <load module=\"mod_perl\"/>\n"; }
- if ($rowhelper['mod_python'] == "enable"){ $tmpxml .= " <load module=\"mod_python\"/>\n"; }
- if ($rowhelper['mod_java'] == "enable"){ $tmpxml .= " <load module=\"mod_java\"/>\n"; }
- if ($rowhelper['mod_lua'] == "enable"){ $tmpxml .= " <load module=\"mod_lua\"/>\n"; }
- $tmpxml .= "\n";
- $tmpxml .= " <!-- ASR /TTS -->\n";
- if ($rowhelper['mod_flite'] == "enable"){ $tmpxml .= " <load module=\"mod_flite\"/>\n"; }
- if ($rowhelper['mod_pocketsphinx'] == "enable"){ $tmpxml .= " <load module=\"mod_pocketsphinx\"/>\n"; }
- if ($rowhelper['mod_cepstral'] == "enable"){ $tmpxml .= " <load module=\"mod_cepstral\"/>\n"; }
- if ($rowhelper['mod_openmrcp'] == "enable"){ $tmpxml .= " <load module=\"mod_openmrcp\"/>\n"; }
- if ($rowhelper['mod_rss'] == "enable"){ $tmpxml .= " <load module=\"mod_rss\"/>\n"; }
- $tmpxml .= "\n";
- $tmpxml .= " <!-- Say -->\n";
- if ($rowhelper['mod_say_en'] == "enable"){ $tmpxml .= " <load module=\"mod_say_en\"/>\n"; }
- if ($rowhelper['mod_say_de'] == "enable"){ $tmpxml .= " <load module=\"mod_say_de\"/>\n"; }
- if ($rowhelper['mod_say_es'] == "enable"){ $tmpxml .= " <load module=\"mod_say_es\"/>\n"; }
- if ($rowhelper['mod_say_fr'] == "enable"){ $tmpxml .= " <load module=\"mod_say_fr\"/>\n"; }
- if ($rowhelper['mod_say_it'] == "enable"){ $tmpxml .= " <load module=\"mod_say_it\"/>\n"; }
- if ($rowhelper['mod_say_nl'] == "enable"){ $tmpxml .= " <load module=\"mod_say_nl\"/>\n"; }
- if ($rowhelper['mod_say_ru'] == "enable"){ $tmpxml .= " <load module=\"mod_say_ru\"/>\n"; }
- if ($rowhelper['mod_say_zh'] == "enable"){ $tmpxml .= " <load module=\"mod_say_zh\"/>\n"; }
- $tmpxml .= " </modules>\n";
- $tmpxml .= "</configuration>";
-
- fwrite($fout, $tmpxml);
- unset($tmpxml);
- fclose($fout);
- }
-
- conf_mount_ro();
- $cmd = "api reloadxml";
- //event_socket_request_cmd($cmd);
- unset($cmd);
-
-}
-
-
-function sync_package_freeswitch_public()
-{
-
- global $config;
- conf_mount_rw();
- config_unlock();
-
- //using backup files rather than pfsense config.xml for this file
- $config['installedpackages']['freeswitchpublic']['config'][0]['public_xml'] = "";
-
- //if(strlen($config['installedpackages']['freeswitchpublic']['config'][0]['public_xml']) == 0) {
- // /* dialplan_public_xml not found in the pfsense config.xml get the default public.xml and save to config.xml. */
- // $filename = "/usr/local/freeswitch/conf/dialplan/public.xml";
- // $fout = fopen($filename,"r");
- // $tmpxml = fread($fout, filesize($filename));
- // $tmpxml = str_replace("<anti-action application=\"export\" data=\"domain_name=\${sip_req_host}\"/>", "<!--<anti-action application=\"export\" data=\"domain_name=\${sip_req_host}\"/>-->", $tmpxml);
- // $config['installedpackages']['freeswitchpublic']['config'][0]['public_xml'] = base64_encode($tmpxml);
-
- // unset($filename, $tmpxml);
- // fclose($fout);
- //}
- //else {
- // /* found dialplan_public_xml in the pfsense config.xml save it to public.xml. */
- // $fout = fopen("/usr/local/freeswitch/conf/dialplan/public.xml","w");
- // $tmpxml = $config['installedpackages']['freeswitchpublic']['config'][0]['public_xml'];
- // fwrite($fout, base64_decode($tmpxml));
- // fclose($fout);
- // unset($tmpxml);
- //}
-
- conf_mount_ro();
- //$cmd = "api reloadxml";
- ////event_socket_request_cmd($cmd);
- //unset($cmd);
-
-}
-
-
-function sync_package_freeswitch_vars()
-{
-
- global $config;
- conf_mount_rw();
- config_unlock();
-
- //using backup files rather than pfsense config.xml for this file
- $config['installedpackages']['freeswitchpublic']['config'][0]['vars_xml'] = "";
-
- //if(strlen($config['installedpackages']['freeswitchvars']['config'][0]['vars_xml']) == 0) {
- // /* dialplan not found in the pfsense config.xml get the default dialplan and save to config.xml. */
- // $filename = "/usr/local/freeswitch/conf/vars.xml";
- // $fout = fopen($filename,"r");
- // $tmpxml = fread($fout, filesize($filename));
- // $config['installedpackages']['freeswitchvars']['config'][0]['vars_xml'] = base64_encode($tmpxml);
- // unset($filename, $dialplan);
- // fclose($fout);
- //}
- //else {
- // /* found the dialplan in the pfsense config.xml save it to default.xml. */
- // $fout = fopen("/usr/local/freeswitch/conf/vars.xml","w");
- // $tmpxml = $config['installedpackages']['freeswitchvars']['config'][0]['vars_xml'];
- // fwrite($fout, base64_decode($tmpxml));
- // fclose($fout);
- // unset($tmpxml);
- //}
-
- conf_mount_ro();
- //$cmd = "api reloadxml";
- ////event_socket_request_cmd($cmd);
- //unset($cmd);
-
-}
-
-
-function sync_package_freeswitch_internal()
-{
- global $config;
- conf_mount_rw();
- config_unlock();
-
- if(strlen($config['installedpackages']['freeswitchinternal']['config'][0]['internal_xml']) == 0) {
- /* internal_xml not found in the pfsense config.xml get the internal.xml and save to config.xml. */
- $filename = "/usr/local/freeswitch/conf/sip_profiles/internal.xml";
- $fout = fopen($filename,"r");
- $tmpxml = fread($fout, filesize($filename));
- $config['installedpackages']['freeswitchinternal']['config'][0]['internal_xml'] = base64_encode($tmpxml);
- unset($filename, $dialplan);
- fclose($fout);
- }
- else {
- /* found the internal_xml in the pfsense config.xml save it to internal.xml. */
- $fout = fopen("/usr/local/freeswitch/conf/sip_profiles/internal.xml","w");
- $tmpxml = $config['installedpackages']['freeswitchinternal']['config'][0]['internal_xml'];
- fwrite($fout, base64_decode($tmpxml));
- fclose($fout);
- unset($tmpxml);
- }
-
- conf_mount_ro();
- $cmd = "api reloadxml";
- //event_socket_request_cmd($cmd);
- unset($cmd);
-
-}
-
-
-function sync_package_freeswitch_external()
-{
- global $config;
- conf_mount_rw();
- config_unlock();
-
- if(strlen($config['installedpackages']['freeswitchexternal']['config'][0]['external_xml']) == 0) {
- /* external_xml not found in the pfsense config.xml get the external.xml and save to config.xml. */
- $filename = "/usr/local/freeswitch/conf/sip_profiles/external.xml";
- $fout = fopen($filename,"r");
- $tmpxml = fread($fout, filesize($filename));
- $config['installedpackages']['freeswitchexternal']['config'][0]['external_xml'] = base64_encode($tmpxml);
- unset($filename, $dialplan);
- fclose($fout);
- }
- else {
- /* found the external_xml in the pfsense config.xml save it to external.xml. */
- $fout = fopen("/usr/local/freeswitch/conf/sip_profiles/external.xml","w");
- $tmpxml = $config['installedpackages']['freeswitchexternal']['config'][0]['external_xml'];
- fwrite($fout, base64_decode($tmpxml));
- fclose($fout);
- unset($tmpxml);
- }
-
- conf_mount_ro();
- $cmd = "api reloadxml";
- //event_socket_request_cmd($cmd);
- unset($cmd);
-
-}
-
-
-function sync_package_freeswitch_hunt_group()
-{
-
- //Hunt Group Javascript Notes:
- //get the domain
- //loop through all Hunt Groups
- //get the Hunt Group information such as the name and description
- //add each Hunt Group to the dialplan
- //get the list of destinations then build the Hunt Group javascript
-
-
- global $config;
- conf_mount_rw();
- config_lock();
-
-
- //get the domain
- $password = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password'];
- $host = $config['interfaces']['lan']['ipaddr'];
- $port = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port'];
-
- if (pkg_is_service_running('freeswitch')) {
- $fp = event_socket_create($host, $port, $password);
- $cmd = "api global_getvar domain";
- $domain = trim(event_socket_request($fp, $cmd));
- }
-
- $tmp = "";
- $tmp .= "\n";
- $tmp .= " var domain = \"".$domain."\"; //by default this is the ipv4 address of FreeSWITCH used for transfer to voicemail\n";
- //$tmp .= " var exit = false;\n";
- $tmp .= "\n";
- $tmp .= "\n";
-
- //loop through all Hunt Groups
- $x = 0;
- $a_hunt_group = &$config['installedpackages']['freeswitchhuntgroup']['config'];
- if (count($a_hunt_group) > 0) {
- foreach($a_hunt_group as $rowhelper) {
-
- //get the Hunt Group information such as the name and description
- //$rowhelper['huntgroupid']
- //$rowhelper['huntgroupextension']
- //$rowhelper['huntgroupname']
- //$rowhelper['huntgrouptype']
- //$rowhelper['huntgrouptimeout']
- //$rowhelper['huntgroupcontext']
- //$rowhelper['huntgroupringback']
- //$rowhelper['huntgroupcidnameprefix']
- //$rowhelper['huntgrouppin']
- //$rowhelper['huntgroupcallerannounce']
- //$rowhelper['huntgroupdescr']
-
- //add each Hunt Group to the dialplan
- $a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config'];
- $a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config'];
-
- if (strlen($rowhelper['huntgroupid']) > 0) {
- $action = 'add'; //set default action to add
- $i = 0;
- if (count($a_dialplan_includes) > 0) {
-
- foreach($a_dialplan_includes as $row) {
-
- //$row['dialplanincludeid'];
- //$row['extensionname'];
- //$row['context'];
- //$row['enabled'];
-
- if ($row['opt1name'] == "huntgroupid" && $row['opt1value'] == $rowhelper['huntgroupid']) {
- $action = 'update';
- $dialplanincludeid = $row['dialplanincludeid'];
- $extensionname = $row['extensionname'];
- $order = $row['order'];
- $context = $row['context'];
- $enabled = $row['enabled'];
- $descr = $row['descr'];
- $opt1name = $row['opt1name'];
- $opt1value = $row['opt1value'];
- $id = $i;
- }
- $i++;
- }
- unset($i);
- }
-
-
- $ent = array();
- if ($action == 'add') {
- //create huntgroup extension in the dialplan
- $ent = array();
- $dialplanincludeid = guid();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['extensionname'] = $rowhelper['huntgroupname'];
- $ent['order'] = '9001'; //if update use the existing order number and extension name and desc
- $ent['context'] = $rowhelper['huntgroupcontext'];
- $ent['enabled'] = 'true';
- $ent['descr'] = 'huntgroup';
- $ent['opt1name'] = 'huntgroupid';
- $ent['opt1value'] = $rowhelper['huntgroupid'];
-
- $a_dialplan_includes[] = $ent; //add to the config
- unset($ent);
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'condition'; //condition, action, antiaction
- $ent['fieldtype'] = 'destination_number';
- $ent['fielddata'] = '^'.$rowhelper['huntgroupextension'].'$';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
-
- $huntgroupid = str_replace(array("{", "}"), "", $rowhelper['huntgroupid']);
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldtype'] = 'javascript';
- $ent['fielddata'] = 'huntgroup_'.$huntgroupid.'.js';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
-
- unset($huntgroupid);
-
- }
- if ($action == 'update') {
- //update the huntgroup
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['extensionname'] = $rowhelper['huntgroupname'];
- $ent['order'] = $order;
- $ent['context'] = $context;
- $ent['enabled'] = $enabled;
- $ent['descr'] = $descr;
- $ent['opt1name'] = $opt1name;
- $ent['opt1value'] = $opt1value;
-
- //update the config
- $a_dialplan_includes[$id] = $ent;
-
- unset($ent);
- unset($extensionname);
- unset($order);
- unset($context);
- unset($enabled);
- unset($descr);
- unset($opt1name);
- unset($opt1value);
- unset($id);
- }
- unset($action);
- unset($dialplanincludeid);
-
- //check whether the fifo queue exists already
- $action = 'add'; //set default action to add
- $i = 0;
- if (count($a_dialplan_includes) > 0) {
-
- foreach($a_dialplan_includes as $row) {
-
- //$row['dialplanincludeid'];
- //$row['extensionname'];
- //$row['context'];
- //$row['enabled'];
-
- if ($row['opt1name'] == "huntgroupfifoid" && $row['opt1value'] == $rowhelper['huntgroupid']) {
- $action = 'update';
- $dialplanincludeid = $row['dialplanincludeid'];
- $extensionname = $row['extensionname'];
- $order = $row['order'];
- $context = $row['context'];
- $enabled = $row['enabled'];
- $descr = $row['descr'];
- $opt1name = $row['opt1name'];
- $opt1value = $row['opt1value'];
- $id = $i;
- }
- $i++;
- }
- unset($i);
- }
-
- if ($action == 'add') {
-
- //create a fifo queue for each huntgroup
- $ent = array();
- $dialplanincludeid = guid();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['extensionname'] = $rowhelper['huntgroupname'].'.park';
- $ent['order'] = '9999'; //if update use the existing order number and extension name and desc
- $ent['context'] = $rowhelper['huntgroupcontext'];
- $ent['enabled'] = 'true';
- $ent['descr'] = 'fifo '.$rowhelper['huntgroupextension'];
- $ent['opt1name'] = 'huntgroupfifoid';
- $ent['opt1value'] = $rowhelper['huntgroupid'];
- $a_dialplan_includes[] = $ent; //add to the config
- unset($ent);
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'condition'; //condition, action, antiaction
- $ent['fieldtype'] = 'destination_number';
- $ent['fielddata'] = '^\*'.$rowhelper['huntgroupextension'].'$';
- $ent['fieldorder'] = '000';
- $a_dialplan_include_details[] = $ent; //add to the config
- unset($ent);
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldtype'] = 'set';
- $ent['fielddata'] = 'fifo_music=$${hold_music}';
- $ent['fieldorder'] = '001';
- $a_dialplan_include_details[] = $ent; //add to the config
- unset($ent);
-
- $huntgrouptimeouttype = $rowhelper['huntgrouptimeouttype'];
- $huntgrouptimeoutdestination = $rowhelper['huntgrouptimeoutdestination'];
- if ($huntgrouptimeouttype == "voicemail") { $huntgrouptimeoutdestination = '***'.$huntgrouptimeoutdestination; }
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldtype'] = 'set';
- $ent['fielddata'] = 'fifo_orbit_exten='.$huntgrouptimeoutdestination.':'.$rowhelper['huntgrouptimeout'];
- $ent['fieldorder'] = '002';
- $a_dialplan_include_details[] = $ent;
- unset($ent); //add to the config
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldtype'] = 'fifo';
- $ent['fielddata'] = $rowhelper['huntgroupextension'].'@${domain_name} in';
- $ent['fieldorder'] = '003';
- $a_dialplan_include_details[] = $ent; //add to the config
- unset($ent);
- }
- if ($action == 'update') {
- //update the huntgroup
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['extensionname'] = $rowhelper['huntgroupname'].'.park';
- $ent['order'] = $order;
- $ent['context'] = $rowhelper['huntgroupcontext'];
- $ent['enabled'] = $enabled;
- $ent['descr'] = 'fifo '.$rowhelper['huntgroupextension'];
- $ent['opt1name'] = $opt1name;
- $ent['opt1value'] = $opt1value;
-
- //update the config
- $a_dialplan_includes[$id] = $ent;
-
- unset($ent);
- unset($extensionname);
- unset($order);
- unset($context);
- unset($enabled);
- unset($descr);
- unset($opt1name);
- unset($opt1value);
- unset($id);
-
- //delete dialplan include details
- if (count($a_dialplan_include_details) > 0) {
- foreach($a_dialplan_include_details as $row) {
- if ($row['dialplanincludeid'] == $dialplanincludeid) {
- $id = $i;
- unset($a_dialplan_include_details[$id]);
- }
- $i++;
- }
- unset($i);
- }
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'condition'; //condition, action, antiaction
- $ent['fieldtype'] = 'destination_number';
- $ent['fielddata'] = '^\*'.$rowhelper['huntgroupextension'].'$';
- $ent['fieldorder'] = '000';
- $a_dialplan_include_details[] = $ent; //add to the config
- unset($ent);
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldtype'] = 'set';
- $ent['fielddata'] = 'fifo_music=$${hold_music}';
- $ent['fieldorder'] = '001';
- $a_dialplan_include_details[] = $ent; //add to the config
- unset($ent);
-
- $huntgrouptimeouttype = $rowhelper['huntgrouptimeouttype'];
- $huntgrouptimeoutdestination = $rowhelper['huntgrouptimeoutdestination'];
- if ($huntgrouptimeouttype == "voicemail") { $huntgrouptimeoutdestination = '***'.$huntgrouptimeoutdestination; }
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldtype'] = 'set';
- $ent['fielddata'] = 'fifo_orbit_exten='.$huntgrouptimeoutdestination.':'.$rowhelper['huntgrouptimeout'];
- $ent['fieldorder'] = '002';
- $a_dialplan_include_details[] = $ent;
- unset($ent); //add to the config
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldtype'] = 'fifo';
- $ent['fielddata'] = $rowhelper['huntgroupextension'].'@${domain_name} in';
- $ent['fieldorder'] = '003';
- $a_dialplan_include_details[] = $ent; //add to the config
- unset($ent);
- }
-
- write_config();
- sync_package_freeswitch_dialplan_includes();
- unset($dialplanincludeid);
-
- } //end if strlen huntgroupid; add the Hunt Group to the dialplan
-
-
- //Get the list of destinations then build the Hunt Group javascript
- $tmp = "";
- $tmp .= "\n";
- $tmp .= "session.answer();\n";
- $tmp .= "var domain_name = session.getVariable(\"domain_name\");\n";
- $tmp .= "var extension = '".$rowhelper['huntgroupextension']."';\n";
- $tmp .= "var result;\n";
- $tmp .= "var timeoutpin = 7500;\n";
- $tmp .= "\n";
- $tmp .= "var objdate = new Date();\n";
- $tmp .= "var adjusthours = 0; //Adjust Server time that is set to GMT 7 hours\n";
- $tmp .= "var adjustoperator = \"-\"; //+ or -\n";
- $tmp .= "if (adjustoperator == \"-\") {\n";
- $tmp .= "var objdate2 = new Date(objdate.getFullYear(),objdate.getMonth(),objdate.getDate(),(objdate.getHours() - adjusthours),objdate.getMinutes(),objdate.getSeconds());\n";
- $tmp .= "}\n";
- $tmp .= "if (adjustoperator == \"+\") {\n";
- $tmp .= "var objdate2 = new Date(objdate.getFullYear(),objdate.getMonth(),objdate.getDate(),(objdate.getHours() + adjusthours),objdate.getMinutes(),objdate.getSeconds());\n";
- $tmp .= "}\n";
- $tmp .= "var Hours = objdate2.getHours();\n";
- $tmp .= "var Mins = objdate2.getMinutes();\n";
- $tmp .= "var Seconds = objdate2.getSeconds();\n";
- $tmp .= "var Month = objdate2.getMonth() + 1;\n";
- $tmp .= "var Date = objdate2.getDate();\n";
- $tmp .= "var Year = objdate2.getYear()\n";
- $tmp .= "var Day = objdate2.getDay()+1;\n";
- $tmp .= "var exit = false;\n";
- $tmp .= "\n";
-
- $tmp .= " function get_sofia_contact(extension,domain_name, profile){\n";
- $tmp .= " if (profile == \"auto\") {\n";
- $i = 0;
- foreach (ListFiles('/usr/local/freeswitch/conf/sip_profiles') as $key=>$sip_profile_file){
- $sip_profile_name = str_replace(".xml", "", $sip_profile_file);
- if ($i == 0) {
- $tmp .= " profile = \"".$sip_profile_name."\";\n";
- $tmp .= " session.execute(\"set\", \"sofia_contact_\"+extension+\"=\${sofia_contact(\"+profile+\"/\"+extension+\"@\"+domain_name+\")}\");\n";
- $tmp .= " sofia_contact = session.getVariable(\"sofia_contact_\"+extension);\n";
- }
- else {
- $tmp .= "\n";
- $tmp .= " if (sofia_contact == \"error/user_not_registered\") {\n";
- $tmp .= " profile = \"".$sip_profile_name."\";\n";
- $tmp .= " session.execute(\"set\", \"sofia_contact_\"+extension+\"=\${sofia_contact(\"+profile+\"/\"+extension+\"@\"+domain_name+\")}\");\n";
- $tmp .= " sofia_contact = session.getVariable(\"sofia_contact_\"+extension);\n";
- $tmp .= " }\n";
- }
- $i++;
- }
- unset ($i);
- $tmp .= " }\n";
- $tmp .= " else {\n";
- $tmp .= " session.execute(\"set\", \"sofia_contact_\"+extension+\"=\${sofia_contact(\"+profile+\"/\"+extension+\"@\"+domain_name+\")}\");\n";
- $tmp .= " sofia_contact = session.getVariable(\"sofia_contact_\"+extension);\n";
- $tmp .= " }\n";
- $tmp .= " console_log( \"info\", \"sofia_contact \"+profile+\": \"+sofia_contact+\".\\n\" );\n";
- $tmp .= " return sofia_contact;\n";
- $tmp .= " }\n";
- $tmp .= "\n";
-
- $tmp .= "\n";
- $tmp .= " function mycb( session, type, obj, arg ) {\n";
- $tmp .= " try {\n";
- $tmp .= " if ( type == \"dtmf\" ) {\n";
- $tmp .= " console_log( \"info\", \"digit: \"+obj.digit+\"\\n\" );\n";
- $tmp .= " if ( obj.digit == \"#\" ) {\n";
- $tmp .= " //console_log( \"info\", \"detected pound sign.\\n\" );\n";
- $tmp .= " exit = true;\n";
- $tmp .= " return( false );\n";
- $tmp .= " }\n";
- $tmp .= "\n";
- $tmp .= " dtmf.digits += obj.digit;\n";
- $tmp .= "\n";
- $tmp .= " if ( dtmf.digits.length >= digitmaxlength ) {\n";
- $tmp .= " exit = true;\n";
- $tmp .= " return( false );\n";
- $tmp .= " }\n";
- $tmp .= " }\n";
- $tmp .= " } catch (e) {\n";
- $tmp .= " console_log( \"err\", e+\"\\n\" );\n";
- $tmp .= " }\n";
- $tmp .= " return( true );\n";
- $tmp .= " } //end function mycb\n";
- $tmp .= "\n";
-
- $tmp .= "\n";
- $tmp .= "dialed_extension = session.getVariable(\"dialed_extension\");\n";
- $tmp .= "domain_name = session.getVariable(\"domain_name\");\n";
- $tmp .= "domain = session.getVariable(\"domain\");\n";
- $tmp .= "us_ring = session.getVariable(\"us-ring\");\n";
- $tmp .= "caller_id_name = session.getVariable(\"caller_id_name\");\n";
- $tmp .= "caller_id_number = session.getVariable(\"caller_id_number\");\n";
- $tmp .= "effective_caller_id_name = session.getVariable(\"effective_caller_id_name\");\n";
- $tmp .= "effective_caller_id_number = session.getVariable(\"effective_caller_id_number\");\n";
- $tmp .= "outbound_caller_id_name = session.getVariable(\"outbound_caller_id_name\");\n";
- $tmp .= "outbound_caller_id_number = session.getVariable(\"outbound_caller_id_number\");\n";
- $tmp .= "\n";
-
-
- //pin number requested from caller if provided
- if (strlen($rowhelper['huntgrouppin']) > 0) {
- $tmp .= "var pin = '".$rowhelper['huntgrouppin']."';\n";
- $tmp .= "if (pin.length > 0) {\n";
- $tmp .= " var dtmf = new Object();\n";
- $tmp .= " dtmf.digits = \"\";\n";
- $tmp .= " digitmaxlength = 6;\n";
- $tmp .= " session.execute(\"set\", \"playback_terminators=#\");\n";
- $tmp .= " session.streamFile( \"/usr/local/freeswitch/sounds/custom/8000/please_enter_the_pin_number.wav\", mycb, \"dtmf\");\n";
- $tmp .= " session.collectInput( mycb, dtmf, timeoutpin );\n";
- $tmp .= "\n";
- $tmp .= " if (dtmf.digits == pin || pin.length == 0) {\n";
- $tmp .= " //continue\n";
- $tmp .= " }\n";
- $tmp .= " else {\n";
- $tmp .= " console_log( \"info\", \"Pin: \" + dtmf.digits + \" is incorrect\\n\" );\n";
- $tmp .= " session.streamFile( \"/usr/local/freeswitch/sounds/custom/8000/your_pin_number_is_incorect_goodbye.wav\", mycb, \"dtmf\");\n";
- $tmp .= " session.hangup();\n";
- $tmp .= " }\n";
- $tmp .= "}\n";
- $tmp .= "\n";
- }
-
- //caller announce requested from caller if provided
- if ($rowhelper['huntgroupcallerannounce'] == "true") {
- $tmp .= "function originate(session, sipuri, extension, caller_announce, caller_id_name, caller_id_number) {\n";
- $tmp .= " caller_id_name = caller_id_name.replace(\" \", \"+\");\n";
- $tmp .= " apiExecute(\"jsrun\", \"originate.js \"+session.uuid+\" \"+sipuri+\" \"+extension+\" \"+caller_announce+\" \"+caller_id_name+\" \"+caller_id_number);\n";
- $tmp .= "}";
- $tmp .= "\n";
- $tmp .= "var caller_announce = extension+\"_\"+Year+Month+Day+Hours+Mins+Seconds+\".wav\";\n";
- $tmp .= "session.streamFile( \"/usr/local/freeswitch/sounds/custom/8000/please_say_your_name_and_reason_for_calling.wav\");\n";
- $tmp .= "session.execute(\"gentones\", \"%(1000, 0, 640)\");\n";
- $tmp .= "session.execute(\"set\", \"playback_terminators=#\");\n";
- $tmp .= "session.execute(\"record\", \"/tmp/\"+caller_announce+\" 180 200\");\n";
- $tmp .= "\n";
- $tmp .= "result = session.setAutoHangup(false);\n";
- $tmp .= "session.execute(\"transfer\", \"*\"+extension+\" XML default\");\n";
- $tmp .= "\n";
- }
-
- //set caller id prefix
- if (strlen($rowhelper['huntgroupcidnameprefix'])> 0) {
- $tmp .= "session.execute(\"set\", \"caller_id_name=".$rowhelper['huntgroupcidnameprefix']."\"+caller_id_name);\n";
- $tmp .= "session.execute(\"set\", \"effective_caller_id_name=".$rowhelper['huntgroupcidnameprefix']."\"+effective_caller_id_name);\n";
- $tmp .= "session.execute(\"set\", \"outbound_caller_id_name=".$rowhelper['huntgroupcidnameprefix']."\"+outbound_caller_id_name);\n";
- }
-
- //set ring back
- if (isset($rowhelper['huntgroupringback'])){
- if ($rowhelper['huntgroupringback'] == "ring"){
- $tmp .= "session.execute(\"set\", \"ringback=\"+us_ring); //set to ringtone\n";
- $tmp .= "session.execute(\"set\", \"transfer_ringback=\"+us_ring); //set to ringtone\n";
- }
- if ($rowhelper['huntgroupringback'] == "music"){
- $tmp .= "session.execute(\"set\", \"ringback=\${hold_music}\"); //set to ringtone\n";
- $tmp .= "session.execute(\"set\", \"transfer_ringback=\${hold_music}\"); //set to ringtone\n";
- }
- }
- else {
- $tmp .= "session.execute(\"set\", \"ringback=\${hold_music}\"); //set to ringtone\n";
- $tmp .= "session.execute(\"set\", \"transfer_ringback=\${hold_music}\"); //set to ringtone\n";
- }
-
- if ($rowhelper['huntgrouptimeout'] > 0) {
- $tmp .= "session.execute(\"set\", \"call_timeout=".$rowhelper['huntgrouptimeout']."\");\n";
- $tmp .= "session.execute(\"set\", \"continue_on_fail=true\");\n";
- }
- $tmp .= "session.execute(\"set\", \"hangup_after_bridge=true\");\n";
- $tmp .= "\n";
- $tmp .= "//console_log( \"info\", \"dialed extension:\"+dialed_extension+\".\\n\" );\n";
- $tmp .= "//console_log( \"info\", \"domain: \"+domain+\".\\n\" );\n";
- $tmp .= "//console_log( \"info\", \"us_ring: \"+us_ring+\".\\n\" );\n";
- $tmp .= "//console_log( \"info\", \"domain: \"+domain+\".\\n\" );\n";
- $tmp .= "//console_log( \"info\", \"domain_name: \"+domain_name+\".\\n\" );\n";
- $tmp .= "\n";
-
- $tmp .= "//console_log( \"info\", \"action call now don't wait for dtmf\\n\" );\n";
- if ($rowhelper['huntgroupcallerannounce'] == "true") {
- //do nothing
- }
- else {
- $tmp .= "if ( session.ready() ) {\n";
- $tmp .= " session.answer();\n";
- }
- $tmp .= "\n";
-
- $a_hunt_group = &$config['installedpackages']['freeswitchhuntgroup']['config'];
- if (isset($id) && $a_hunt_group[0]) {
- $huntgrouptimeout = $a_hunt_group[$id]['huntgrouptimeout'];
- $huntgrouptimeoutdestination = $a_hunt_group[$id]['huntgrouptimeoutdestination'];
- }
-
- //order the array
- if (!function_exists(cmp_hunt_group_order)) {
- function cmp_hunt_group_order($a, $b) {
- if ($a["destinationorder"] > $b["destinationorder"]) {
- return 1;
- }
- else {
- return 0;
- }
- }
- }
-
-
- $a_hunt_group_destinations = &$config['installedpackages']['freeswitchhuntgroupdestinations']['config'];
- if (count($a_hunt_group_destinations) > 0) { usort($a_hunt_group_destinations, "cmp_hunt_group_order"); }
- if (count($a_hunt_group_destinations) > 0) {
-
- $i = 0;
- foreach($a_hunt_group_destinations as $row) {
-
- /*
- $row['huntgroupid']
- $row['destinationnumber']
- $row['destinationtype']
- $row['destinationprofile']
- $row['destinationorder']
- $row['destinationdescr']
- */
-
- if ($row['huntgroupid'] == $rowhelper['huntgroupid']) {
-
- //set the default profile
- if (strlen($row['destinationnumber']) == 0) { $row['destinationnumber'] = "internal"; }
-
- if ($row['destinationtype'] == "extension") {
- $tmp .= "sofia_contact_".$row['destinationnumber']." = get_sofia_contact(\"".$row['destinationnumber']."\",domain_name, \"".$row['destinationprofile']."\");\n";
- $tmp_sub_array["application"] = "bridge";
- $tmp_sub_array["data"] = "sofia_contact_".$row['destinationnumber'];
- $tmp_array[$i] = $tmp_sub_array;
- unset($tmp_sub_array);
- }
- if ($row['destinationtype'] == "voicemail") {
- $tmp_sub_array["application"] = "voicemail";
- $tmp .= "session.execute(\"voicemail\", \"default \${domain} ".$row['destinationnumber']."\");\n";
- //$tmp_sub_array["application"] = "voicemail";
- //$tmp_sub_array["data"] = "default \${domain} ".$row['destinationnumber'];
- //$tmp_array[$i] = $tmp_sub_array;
- unset($tmp_sub_array);
- }
- if ($row['destinationtype'] == "sip uri") {
- $tmp_sub_array["application"] = "bridge";
- $tmp_sub_array["data"] = "\"".$row['destinationnumber']."\"";
- $tmp_array[$i] = $tmp_sub_array;
- unset($tmp_sub_array);
- }
- $i++;
-
- } //end huntgroupid
-
- } //end for each
- unset($i);
- } //if count
-
- $i = 0;
- if(count($tmp_array) > 0) {
- foreach ($tmp_array as $row) {
- $tmpdata = $row["data"];
- if ($row["application"] == "voicemail") { $tmpdata = "***".$tmpdata; }
- if ($i < 1) {
- $tmp_buffer = $tmpdata;
- }
- else {
- $tmp_buffer .= "+\",\"+".$tmpdata;
- }
- $i++;
- }
- }
- unset($i);
- $delimiter = ",";
- $tmp_application = $tmp_array[0]["application"];
-
- switch ($rowhelper['huntgrouptype']) {
- case "simultaneous":
- //print_r($tmp_array);
- if ($rowhelper['huntgroupcallerannounce'] == "true") {
- $i = 0;
- if (count($tmp_array) > 0) {
- foreach ($tmp_array as $row) {
- $tmpdata = $row["data"];
- if ($row["application"] == "voicemail") { $tmpdata = "***".$tmpdata; }
- $tmp .= " result = originate (session, ".$tmpdata.", extension, caller_announce, caller_id_name, caller_id_number);\n";
- }
- }
- }
- else {
- $tmp .= "\n";
- $tmp .= " session.execute(\"".$tmp_application."\", $tmp_buffer);\n";
- //$tmp .= " session.execute(\"bridge\", sofia_contact_100+\",\"+sofia_contact_101+\",\"+sofia_contact_102+\",\"+sofia_contact_103+\",\"+sofia_contact_104);\n";
- //$tmp .= " //session.execute(\"bridge\", \"sofia/gateway/flowroute.com/12081231234,\"+sofia_contact_101);\n";
- }
- unset($tmp_array);
- break;
- case "sequentially":
-
- $tmp .= "\n";
- //print_r($tmp_array);
- $i = 0;
- if (count($tmp_array) > 0) {
- if ($rowhelper['huntgroupcallerannounce'] == "true") {
- $i = 0;
- if (count($tmp_array) > 0) {
- //foreach ($tmp_array as $row) {
- //$tmpdata = $row["data"];
- //if ($row["application"] == "voicemail") { $tmpdata = "***".$tmpdata; }
- $tmp .= " result = originate (session, ".$tmp_buffer.", extension, caller_announce, caller_id_name, caller_id_number);\n";
- //}
- }
- }
- else {
- foreach ($tmp_array as $row) {
- $tmp .= " session.execute(\"".$row["application"]."\", ".$row["data"].");\n";
- }
- }
- unset($tmp_array);
- }
-
- break;
- }
-
- //set the timeout destination
- $huntgrouptimeoutdestination = $a_hunt_group[$x]['huntgrouptimeoutdestination'];
- $huntgrouptimeouttype = $a_hunt_group[$x]['huntgrouptimeouttype'];
- if ($huntgrouptimeouttype == "extension") { $huntgrouptimeouttype = "bridge"; }
- if ($huntgrouptimeouttype == "voicemail") { $huntgrouptimeouttype = "transfer"; $huntgrouptimeoutdestination = "*99".$huntgrouptimeoutdestination; }
- if ($huntgrouptimeouttype == "sip uri") { $huntgrouptimeouttype = "bridge"; }
- $tmp .= "\n";
- if ($row['huntgroupcallerannounce'] == "true") {
- //do nothing
- }
- else {
- $tmp .= " //timeout\n";
- $tmp .= " session.execute(\"".$huntgrouptimeouttype."\", \"".$huntgrouptimeoutdestination."\");\n";
- }
-
- $tmp .= "\n";
- $tmp .= " //clear variables\n";
- $tmp .= " dialed_extension = \"\";\n";
- $tmp .= " new_extension = \"\";\n";
- $tmp .= " domain_name = \"\";\n";
- $tmp .= " domain = \"\";";
-
- $tmp .= "\n";
- if ($rowhelper['huntgroupcallerannounce'] == "true") {
- //do nothing
- }
- else {
- $tmp .= "} //end if session.ready\n";
- }
- $tmp .= "\n";
-
- if (strlen($rowhelper['huntgroupid']) > 0) {
- $huntgroupfilename = "huntgroup_".str_replace(array("{", "}"), "", $rowhelper['huntgroupid']).".js";
- $fout = fopen("/usr/local/freeswitch/scripts/".$huntgroupfilename,"w");
- fwrite($fout, $tmp);
- unset($huntgroupfilename);
- fclose($fout);
- }
-
- $x++;
- } //end foreach
- } //end if count
- conf_mount_ro();
- config_unlock();
-
-} //end function
-
-
-function sync_package_freeswitch_fax()
-{
-
- global $config;
- conf_mount_rw();
- config_lock();
-
- //loop through all faxes
- $a_fax = &$config['installedpackages']['freeswitchfax']['config'];
- if (count($a_fax) > 0) {
- foreach($a_fax as $rowhelper) {
-
- //get the fax information such as the name and description
- //$rowhelper['faxid']
- //$rowhelper['faxextension']
- //$rowhelper['faxname']
- //$rowhelper['faxemail']
- //$rowhelper['faxdomain']
- //$rowhelper['faxdescription']
-
- //add each fax extension to the dialplan
- $a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config'];
- $a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config'];
-
- //determine if the entry should be an add, or update to the dialplan
- if (strlen($rowhelper['faxid']) > 0) {
- $action = 'add'; //set default action to add
- $i = 0;
- if (count($a_dialplan_includes) > 0) {
-
- foreach($a_dialplan_includes as $row) {
-
- //$row['faxid'];
- //$row['faxname'];
- //$row['context'];
- //$row['enabled'];
-
- if ($row['opt1name'] == "faxid" && $row['opt1value'] == $rowhelper['faxid']) {
- //update
- $action = 'update';
-
- $dialplanincludeid = $rowhelper['dialplanincludeid'];
- $extensionname = $row['extensionname'];
- $order = $row['order'];
- $context = $row['context'];
- $enabled = $row['enabled'];
- $descr = $row['descr'];
- $opt1name = $row['opt1name'];
- $opt1value = $row['opt1value'];
- $id = $i;
- //echo "update".$i."<br />\n";
-
- if (file_exists("/usr/local/freeswitch/conf/dialplan/default/".$order."_".$extensionname.".xml")){
- unlink("/usr/local/freeswitch/conf/dialplan/default/".$order."_".$extensionname.".xml");
- }
- }
- $i++;
-
- }
- }
-
- $ent = array();
- if ($action == 'add') {
- $faxid = $rowhelper['faxid'];
- if (strlen($rowhelper['faxname']) > 0) {
- $ent['dialplanincludeid'] = $faxid;
- $ent['extensionname'] = $rowhelper['faxname'];
- $ent['order'] = '9001'; //if update use the existing order number and extension name and desc
- $ent['context'] = "default";
- //$ent['context'] = $rowhelper['huntgroupcontext'];
- $ent['enabled'] = 'true';
- $ent['descr'] = 'fax';
- $ent['opt1name'] = 'faxid';
- $ent['opt1value'] = $rowhelper['faxid'];
-
- //add to the config
- $a_dialplan_includes[] = $ent;
- unset($ent);
-
- //<!-- default ${domain_name} -->
- //<condition field="destination_number" expression="^\*9978$">
- $ent = array();
- $ent['dialplanincludeid'] = $faxid;
- $ent['tag'] = 'condition'; //condition, action, antiaction
- $ent['fieldorder'] = '000';
- $ent['fieldtype'] = 'destination_number';
- $ent['fielddata'] = '^'.$rowhelper['faxextension'].'$';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
-
- //<action application="answer" />
- $ent = array();
- $ent['dialplanincludeid'] = $faxid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldorder'] = '001';
- $ent['fieldtype'] = 'answer';
- $ent['fielddata'] = '';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
-
- //<action application="playback" data="silence_stream://2000"/>
- $ent = array();
- $ent['dialplanincludeid'] = $faxid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldorder'] = '002';
- $ent['fieldtype'] = 'playback';
- $ent['fielddata'] = 'silence_stream://2000';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
-
- //<action application="set" data="last_fax=${caller_id_number}-${strftime(%Y-%m-%d-%H-%M-%S)}"/>
- $ent = array();
- $ent['dialplanincludeid'] = $faxid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldorder'] = '003';
- $ent['fieldtype'] = 'set';
- $ent['fielddata'] = 'last_fax=${caller_id_number}-${strftime(%Y-%m-%d-%H-%M-%S)}';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
-
- //<action application="rxfax" data="/usr/local/freeswitch/storage/fax/inbox/${last_fax}.tif"/>
- $ent = array();
- $ent['dialplanincludeid'] = $faxid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldorder'] = '004';
- $ent['fieldtype'] = 'rxfax';
- $ent['fielddata'] = '/usr/local/freeswitch/storage/fax/'.$rowhelper['faxextension'].'/inbox/${last_fax}.tif';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
-
- //<action application="system" data="/opt/freeswitch/scripts/emailfax.sh USER DOMAIN /usr/local/freeswitch/storage/fax/inbox/9872/${last_fax}.tif"/>
- $ent = array();
- $ent['dialplanincludeid'] = $faxid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldorder'] = '005';
- $ent['fieldtype'] = 'system';
- $ent['fielddata'] = '/usr/local/bin/php /usr/local/www/packages/freeswitch/fax_to_email.php email='.$rowhelper['faxemail'].' extension='.$rowhelper['faxextension'].' name=${last_fax} >> /tmp/fax.txt';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
-
- //<action application="hangup"/>
- $ent = array();
- $ent['dialplanincludeid'] = $faxid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldorder'] = '006';
- $ent['fieldtype'] = 'hangup';
- $ent['fielddata'] = '';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
- }
-
- unset($faxid);
-
- }
- if ($action == 'update') {
-
- $ent['dialplanincludeid'] = $rowhelper['faxid'];
- $ent['extensionname'] = $rowhelper['faxname'];
- $ent['order'] = $order;
- $ent['context'] = $context;
- $ent['enabled'] = $enabled;
- $ent['descr'] = $faxdescription;
- $ent['opt1name'] = $opt1name;
- $ent['opt1value'] = $opt1value;
-
- //update the config
- $a_dialplan_includes[$id] = $ent;
-
- unset($ent);
- unset($extensionname);
- unset($order);
- unset($context);
- unset($enabled);
- unset($descr);
- unset($opt1name);
- unset($opt1value);
- unset($id);
- }
- write_config();
-
- sync_package_freeswitch_dialplan_includes();
- unset($dialplanincludeid);
-
- } //end if strlen faxid; add the fax to the dialplan
-
- } //end foreach
- } //end if count
- conf_mount_ro();
- config_unlock();
-
-} //end function
-
-
-function get_recording_filename($id)
-{
- global $config;
- $a_recordings = &$config['installedpackages']['freeswitchrecordings']['config'];
- if (count($a_recordings) > 0) {
- global $config;
- foreach($a_recordings as $rowhelper) {
- if ($rowhelper['recordingid'] == $id) {
- return $rowhelper['filename'];
- }
- }
- }
-}
-
-
-function sync_package_freeswitch_ivr()
-{
-
- global $config;
- conf_mount_rw();
- config_lock();
-
- $a_ivr = &$config['installedpackages']['freeswitchivr']['config'];
- if (count($a_ivr) > 0) {
- foreach($a_ivr as $rowhelper) {
-
- /*
- $rowhelper['ivrid']
- $rowhelper['ivrextension']
- $rowhelper['ivrname']
- $rowhelper['recordingid']
- $rowhelper['ivrtimeout']
- $rowhelper['ivrcalltimeout']
- $rowhelper['ivrcontext']
- $rowhelper['ivrdirectdial']
- $rowhelper['ivrconditionjs']
- $rowhelper['ivrringback']
- $rowhelper['ivrcidnameprefix']
- $rowhelper['ivrdescr']
- */
-
- $a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config'];
- $a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config'];
-
-
- //add the IVR to the dialplan
- if (strlen($rowhelper['ivrid']) > 0) {
- $action = 'add'; //set default action to add
- $i = 0;
- if (count($a_dialplan_includes) > 0) {
- foreach($a_dialplan_includes as $row) {
-
- //$row['dialplanincludeid'];
- //$row['extensionname'];
- //$row['context'];
- //$row['enabled'];
- //echo "if (".$row['opt1name']." == \"ivrid\" && ".$row['opt1value']." == ".$rowhelper['ivrid'].") \n";
-
- if ($row['opt1name'] == "ivrid" && $row['opt1value'] == $rowhelper['ivrid']) {
- //update
- $action = 'update';
- $dialplanincludeid = $row['dialplanincludeid'];
- $extensionname = $row['extensionname'];
- $order = $row['order'];
- $context = $row['context'];
- $enabled = $row['enabled'];
- $descr = $row['descr'];
- $opt1name = $row['opt1name'];
- $opt1value = $row['opt1value'];
- $id = $i;
- //echo "update".$i."<br />\n";
-
- }
- $i++;
-
- } //end foreach
- } //if count
-
-
- $ent = array();
- if ($action == 'add') {
-
- $dialplanincludeid = guid();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['extensionname'] = $rowhelper['ivrextension'];
- $ent['order'] = '9001'; //if update use the existing order number and extension name and desc
- $ent['context'] = $rowhelper['ivrcontext'];
- $ent['enabled'] = 'true';
- $ent['descr'] = 'IVR';
- $ent['opt1name'] = 'ivrid';
- $ent['opt1value'] = $rowhelper['ivrid'];
-
- //add to the config
- $a_dialplan_includes[] = $ent;
- unset($ent);
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'condition'; //condition, action, antiaction
- $ent['fieldtype'] = 'destination_number';
- $ent['fielddata'] = '^'.$rowhelper['ivrextension'].'$';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
-
- $ivrid = str_replace(array("{", "}"), "", $rowhelper['ivrid']);
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldtype'] = 'javascript';
- $ent['fielddata'] = 'ivr_'.$ivrid.'.js';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
-
- unset($ivrid);
-
- }
- if ($action == 'update') {
-
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['extensionname'] = $rowhelper['ivrextension'];
- $ent['order'] = $order;
- $ent['context'] = $context;
- $ent['enabled'] = $enabled;
- $ent['descr'] = $descr;
- $ent['opt1name'] = $opt1name;
- $ent['opt1value'] = $opt1value;
-
- //update the config
- $a_dialplan_includes[$id] = $ent;
-
- unset($ent);
- unset($extensionname);
- unset($order);
- unset($context);
- unset($enabled);
- unset($descr);
- unset($opt1name);
- unset($opt1value);
- unset($id);
- }
- write_config();
-
- sync_package_freeswitch_dialplan_includes();
- unset($dialplanincludeid);
-
- } //end if strlen ivrid; add the IVR to the dialplan
-
- // Build the IVR javascript
- $recording_action_filename = get_recording_filename($rowhelper['recordingidaction']);
- $recording_antiaction_filename = get_recording_filename($rowhelper['recordingidantiaction']);
-
- $password = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password'];
- $port = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port'];
- $host = $config['interfaces']['lan']['ipaddr'];
-
- if (pkg_is_service_running('freeswitch')) {
- $fp = event_socket_create($host, $port, $password);
- $cmd = "api global_getvar domain";
- $domain = trim(event_socket_request($fp, $cmd));
- }
-
-
- $tmp = ""; //make sure the variable starts with no value
- $tmp .= "\n";
- $tmp .= " var condition = true;\n";
- $tmp .= "\n";
- $tmp .= " var domain = \"".$domain."\"; //by default this is the ipv4 address of FreeSWITCH used for transfer to voicemail\n";
- $tmp .= " var digitmaxlength = 0;\n";
- $tmp .= " var objdate = new Date();\n";
- $tmp .= "\n";
- $tmp .= " var adjusthours = 0; //Adjust Server time that is set to GMT 7 hours\n";
- $tmp .= " var adjustoperator = \"-\"; //+ or -\n";
- $tmp .= "\n";
- $tmp .= " if (adjustoperator == \"-\") {\n";
- $tmp .= " var objdate2 = new Date(objdate.getFullYear(),objdate.getMonth(),objdate.getDate(),(objdate.getHours() - adjusthours),objdate.getMinutes(),objdate.getSeconds());\n";
- $tmp .= " }\n";
- $tmp .= " if (adjustoperator == \"+\") {\n";
- $tmp .= " var objdate2 = new Date(objdate.getFullYear(),objdate.getMonth(),objdate.getDate(),(objdate.getHours() + adjusthours),objdate.getMinutes(),objdate.getSeconds());\n";
- $tmp .= " }\n";
- $tmp .= "\n";
- $tmp .= " var Hours = objdate2.getHours();\n";
- $tmp .= " var Mins = objdate2.getMinutes();\n";
- $tmp .= " var Seconds = objdate2.getSeconds();\n";
- $tmp .= " var Month = objdate2.getMonth() + 1;\n";
- $tmp .= " var Date = objdate2.getDate();\n";
- $tmp .= " var Year = objdate2.getYear()\n";
- $tmp .= " var Day = objdate2.getDay()+1;\n";
- $tmp .= " var exit = false;\n";
- $tmp .= "\n";
- $tmp .= " dialed_extension = session.getVariable(\"dialed_extension\");\n";
- $tmp .= " domain_name = session.getVariable(\"domain_name\");\n";
- $tmp .= " domain = session.getVariable(\"domain\");\n";
- $tmp .= " us_ring = session.getVariable(\"us-ring\");\n";
- $tmp .= " caller_id_name = session.getVariable(\"caller_id_name\");\n";
- $tmp .= " caller_id_number = session.getVariable(\"caller_id_number\");\n";
- $tmp .= " effective_caller_id_name = session.getVariable(\"effective_caller_id_name\");\n";
- $tmp .= " effective_caller_id_number = session.getVariable(\"effective_caller_id_number\");\n";
- $tmp .= " outbound_caller_id_name = session.getVariable(\"outbound_caller_id_name\");\n";
- $tmp .= " outbound_caller_id_number = session.getVariable(\"outbound_caller_id_number\");\n";
- $tmp .= "\n";
-
- //set caller id prefix
- if (strlen($rowhelper['ivrcidnameprefix'])> 0) {
- $tmp .= "session.execute(\"set\", \"caller_id_name=".$rowhelper['ivrcidnameprefix']."\"+caller_id_name);\n";
- $tmp .= "session.execute(\"set\", \"effective_caller_id_name=".$rowhelper['ivrcidnameprefix']."\"+effective_caller_id_name);\n";
- $tmp .= "session.execute(\"set\", \"outbound_caller_id_name=".$rowhelper['ivrcidnameprefix']."\"+outbound_caller_id_name);\n";
- }
-
- $tmp .= "\n";
-
- $tmp .= " session.execute(\"set\", \"continue_on_fail=true\");\n";
- if (strlen($rowhelper['ivrcalltimeout']) == 0){
- $tmp .= " session.execute(\"set\", \"call_timeout=30\");\n"; //ivrcalltimeout
- }
- else {
- $tmp .= " session.execute(\"set\", \"call_timeout=".$rowhelper['ivrcalltimeout']."\");\n"; //ivrcalltimeout
- }
-
- if (isset($rowhelper['ivrringback'])){
- if ($rowhelper['ivrringback'] == "ring"){
- $tmp .= " session.execute(\"set\", \"ringback=\"+us_ring); //set to ringtone\n";
- $tmp .= " session.execute(\"set\", \"transfer_ringback=\"+us_ring); //set to ringtone\n";
- }
- if ($rowhelper['ivrringback'] == "music"){
- $tmp .= " session.execute(\"set\", \"ringback=\${hold_music}\"); //set to ringtone\n";
- $tmp .= " session.execute(\"set\", \"transfer_ringback=\${hold_music}\"); //set to ringtone\n";
- }
- }
- else {
- $tmp .= " session.execute(\"set\", \"ringback=\${hold_music}\"); //set to ringtone\n";
- $tmp .= " session.execute(\"set\", \"transfer_ringback=\${hold_music}\"); //set to ringtone\n";
- }
- $tmp .= "\n";
- $tmp .= "//console_log( \"info\", \"IVR Server Time is: \"+Hours+\":\"+Mins+\" \\n\" );\n";
- $tmp .= "\n";
-
- $tmp .= " function get_sofia_contact(extension,domain_name, profile){\n";
- $tmp .= " if (profile == \"auto\") {\n";
- $i = 0;
- foreach (ListFiles('/usr/local/freeswitch/conf/sip_profiles') as $key=>$sip_profile_file){
- $sip_profile_name = str_replace(".xml", "", $sip_profile_file);
- if ($i == 0) {
- $tmp .= " profile = \"".$sip_profile_name."\";\n";
- $tmp .= " session.execute(\"set\", \"sofia_contact_\"+extension+\"=\${sofia_contact(\"+profile+\"/\"+extension+\"@\"+domain_name+\")}\");\n";
- $tmp .= " sofia_contact = session.getVariable(\"sofia_contact_\"+extension);\n";
- }
- else {
- $tmp .= "\n";
- $tmp .= " if (sofia_contact == \"error/user_not_registered\") {\n";
- $tmp .= " profile = \"".$sip_profile_name."\";\n";
- $tmp .= " session.execute(\"set\", \"sofia_contact_\"+extension+\"=\${sofia_contact(\"+profile+\"/\"+extension+\"@\"+domain_name+\")}\");\n";
- $tmp .= " sofia_contact = session.getVariable(\"sofia_contact_\"+extension);\n";
- $tmp .= " }\n";
- }
- $i++;
- }
- unset ($i);
- $tmp .= " }\n";
- $tmp .= " else {\n";
- $tmp .= " session.execute(\"set\", \"sofia_contact_\"+extension+\"=\${sofia_contact(\"+profile+\"/\"+extension+\"@\"+domain_name+\")}\");\n";
- $tmp .= " sofia_contact = session.getVariable(\"sofia_contact_\"+extension);\n";
- $tmp .= " }\n";
- $tmp .= " console_log( \"info\", \"sofia_contact \"+profile+\": \"+sofia_contact+\".\\n\" );\n";
- $tmp .= " return sofia_contact;\n";
- $tmp .= " }\n";
- $tmp .= "\n";
-
- $tmp .= " function mycb( session, type, obj, arg ) {\n";
- $tmp .= " try {\n";
- $tmp .= " if ( type == \"dtmf\" ) {\n";
- $tmp .= " console_log( \"info\", \"digit: \"+obj.digit+\"\\n\" );\n";
- $tmp .= " if ( obj.digit == \"#\" ) {\n";
- $tmp .= " //console_log( \"info\", \"detected pound sign.\\n\" );\n";
- $tmp .= " exit = true;\n";
- $tmp .= " return( false );\n";
- $tmp .= " }\n";
- $tmp .= "\n";
- $tmp .= " dtmf.digits += obj.digit;\n";
- $tmp .= "\n";
- $tmp .= " if ( dtmf.digits.length >= digitmaxlength ) {\n";
- $tmp .= " exit = true;\n";
- $tmp .= " return( false );\n";
- $tmp .= " }\n";
- $tmp .= " }\n";
- $tmp .= " } catch (e) {\n";
- $tmp .= " console_log( \"err\", e+\"\\n\" );\n";
- $tmp .= " }\n";
- $tmp .= " return( true );\n";
- $tmp .= " } //end function mycb\n";
-
- $tmp .= "\n";
- $tmp .= base64_decode($rowhelper['ivrconditionjs']);
- $tmp .= "\n";
- $tmp .= "\n";
-
- //$tmp .= " //condition = true; //debugging\n";
-
- $actiondirect = false;
- $actiondefault = false;
- $actioncount = 0;
- foreach($config['installedpackages']['freeswitchivroptions']['config'] as $row) {
- //find the correct IVR options with the correct action
- if ($row['ivrid'] == $rowhelper['ivrid']) {
-
- if ($row['optionaction'] == "action") {
- $actioncount++;
- if (strtolower($row['optionnumber']) == "n") { //direct the call now don't wait for dtmf
- //echo "now found\n";
- $actiondirect = true;
- $actiondirecttype = $row['optiontype'];
- $actiondirectprofile = $row['optionprofile'];
- $actiondirectdest = $row['optiondest'];
- }
- if (strtolower($row['optionnumber']) == "d") { //default option used when dtmf doesn't match any other option
- //echo "default found\n";
- $actiondefault = true;
- $actiondefaulttype = $row['optiontype'];
- $actiondefaultprofile = $row['optionprofile'];
- $actiondefaultdest = $row['optiondest'];
- }
- }
- }
- }
- //$tmp .= "action count: ".$actioncount."<br />\n";
- if ($actioncount > 0) {
- if ($actiondirect) {
- $tmp .= " if (condition) {\n";
- $tmp .= " //direct\n";
- $tmp .= " //console_log( \"info\", \"action direct\\n\" );\n";
- if ($actiondirecttype == "extension") {
- $tmp .= " sofia_contact_".$actiondirectdest." = get_sofia_contact(\"".$actiondirectdest."\",domain_name, \"".$actiondirectprofile."\");\n";
- $tmp .= " session.execute(\"bridge\", sofia_contact_".$actiondirectdest."); //".$actiondirectdest."\n";
- if ($actiondirectprofile == "auto") {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$actiondirectdest."\");\n";
- }
- else {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$actiondirectdest."\");\n";
- }
- }
- if ($actiondirecttype == "voicemail") {
- if ($actiondirectprofile == "auto") {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$actiondirectdest."\");\n";
- }
- else {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$actiondirectdest."\");\n";
- }
- }
- if ($actiondirecttype == "sip uri") {
- $tmp .= " session.execute(\"bridge\", \"".$actiondirectdest."\"); //".$actiondirectdest."\n";
-
- }
-
- $tmp .= "}\n";
-
- }
- else {
- $tmp .= " if (condition) {\n";
- $tmp .= " //action\n";
- $tmp .= "\n";
- $tmp .= " //console_log( \"info\", \"action call now don't wait for dtmf\\n\" );\n";
- $tmp .= " var dtmf = new Object( );\n";
- $tmp .= " dtmf.digits = \"\";\n";
- $tmp .= " if ( session.ready( ) ) {\n";
- $tmp .= " session.answer( );\n";
- $tmp .= "\n";
- $tmp .= " digitmaxlength = 1;\n";
- $tmp .= " while (session.ready() && ! exit ) {\n";
- $tmp .= " //session.streamFile( \"C:/Program Files/FreeSWITCH/sounds/".$recording_action_filename."\", mycb, \"dtmf ".$rowhelper['ivrtimeout']."\" );\n";
- $tmp .= " session.streamFile( \"/usr/local/freeswitch/recordings/".$recording_action_filename."\", mycb, \"dtmf ".$rowhelper['ivrtimeout']."\" );\n";
- $tmp .= " if (session.ready()) {\n";
- $tmp .= " if (dtmf.digits.length == 0) {\n";
- $tmp .= " dtmf.digits += session.getDigits(1, \"#\", ".($rowhelper['ivrtimeout']*1000)."); // ".$rowhelper['ivrtimeout']." seconds\n";
- $tmp .= " if (dtmf.digits.length == 0) {\n";
- //$tmp .= " console_log( "info", "time out option: " + dtmf.digits + "\n" );\n";
-
- $a_ivr_options = &$config['installedpackages']['freeswitchivroptions']['config'];
- //find the timeout IVR options with the correct action
- if (count($a_ivr_options) > 0) {
- foreach($a_ivr_options as $row) {
-
- if ($row['ivrid'] == $rowhelper['ivrid']) {
-
- if ($row['optionaction'] == "action") {
- if (strtolower($row['optionnumber']) == "t") {
- if ($row['optiontype'] == "extension") {
- $tmp .= " sofia_contact_".$row['optiondest']." = get_sofia_contact(\"".$row['optiondest']."\",domain_name, \"".$row['optionprofile']."\");\n";
- $tmp .= " session.execute(\"bridge\", sofia_contact_".$row['optiondest']."); //".$row['optiondescr']."\n";
- if ($row['optionprofile'] == "auto") {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\");\n";
- }
- else {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\");\n";
- }
- }
- if ($row['optiontype'] == "voicemail") {
- if ($row['optionprofile'] == "auto") {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\"); //".$row['optiondescr']."\n";
- }
- else {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\"); //".$row['optiondescr']."\n";
- }
- }
- if ($row['optiontype'] == "sip uri") {
- $tmp .= " session.execute(\"bridge\", \"".$row['optiondest']."\"); //".$row['optiondescr']."\n";
- }
- }
- } //end anti-action
-
- } //end ivrid
-
- } //end for each
- } //if count
-
- $tmp .= " }\n";
- $tmp .= " else {\n";
- $tmp .= " break; //dtmf found end the while loop\n";
- $tmp .= " }\n";
- $tmp .= " }\n";
- $tmp .= " }\n";
- $tmp .= " }\n";
- $tmp .= "\n";
- $tmp .= " //pickup the remaining digits\n";
- //$tmp .= " //http://wiki.freeswitch.org/wiki/Session_getDigits\n";
- //$tmp .= " //getDigits(length, terminators, timeout, digit_timeout, abs_timeout)\n";
- //$tmp .= " //dtmf.digits += session.getDigits(2, \"#\", 3000); //allow up to 3 digits\n";
- $tmp .= " dtmf.digits += session.getDigits(4, \"#\", 3000); //allow up to 5 digits\n";
- $tmp .= "\n";
- $tmp .= "\n";
- //$tmp .= " console_log( \"info\", \"IVR Digit Pressed: \" + dtmf.digits + \"\\n\" );\n";
-
-
- //action
- $tmpaction = "";
-
- $tmp .= " if ( dtmf.digits.length > \"0\" ) {\n";
- $x = 0;
- $a_ivr_options = &$config['installedpackages']['freeswitchivroptions']['config'];
- if (count($a_ivr_options) > 0) {
- foreach($a_ivr_options as $row) {
-
- /*
- $row['ivrid']
- $row['optionnumber']
- $row['optiontype']
- $row['optionaction']
- $row['optiondest']
- $row['optiondescr']
- */
-
- $tmpactiondefault = "";
-
- //find the correct IVR options with the correct action
- if ($row['ivrid'] == $rowhelper['ivrid']){
-
- if ($row['optionaction'] == "action") {
- //$tmpaction .= "\n";
-
- switch ($row['optionnumber']) {
- //case "t":
- // break;
- //case "d":
- // break;
- default:
- //$tmpaction .= " //console_log( \"info\", \"IVR Detected 1 digit \\n\" );\n";
- if ($x == 0) {
- $tmpaction .= " if ( dtmf.digits == \"".$row['optionnumber']."\" ) { //".$row['optiondescr']."\n";
- }
- else {
- $tmpaction .= " else if ( dtmf.digits == \"".$row['optionnumber']."\" ) { //".$row['optiondescr']."\n";
- }
- if ($row['optiontype'] == "extension") {
- $tmpaction .= " sofia_contact_".$row['optiondest']." = get_sofia_contact(\"".$row['optiondest']."\",domain_name, \"".$row['optionprofile']."\");\n";
- $tmpaction .= " session.execute(\"bridge\", sofia_contact_".$row['optiondest']."); //".$row['optiondescr']."\n";
- if ($row['optionprofile'] == "auto") {
- $tmpaction .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\");\n";
- }
- else {
- $tmpaction .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\"); //".$row['optiondescr']."\n";
- }
- }
- if ($row['optiontype'] == "voicemail") {
- if ($row['optionprofile'] == "auto") {
- $tmpaction .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\"); //".$row['optiondescr']."\n";
- }
- else {
- $tmpaction .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\"); //".$row['optiondescr']."\n";
- }
- }
- if ($row['optiontype'] == "sip uri") {
- $tmpaction .= " session.execute(\"bridge\", \"".$row['optiondest']."\"); //".$row['optiondescr']."\n";
- }
-
- $tmpaction .= " }\n";
-
- }
-
- $x++;
- } //end if action
-
- } //end ivrid
-
-
- } //end foreach
- } //end if count
-
- $tmp .= $tmpaction;
- if ($rowhelper['ivrdirectdial'] == "true") {
- $tmp .= " else {\n";
- $tmp .= " session.execute(\"transfer\", dtmf.digits+\" XML default\");\n";
- //$tmp .= $tmpactiondefault;
- $tmp .= " }\n";
- }
- else {
- if ($actiondefault) {
- $tmp .= " else {\n";
- $tmp .= " //console_log( \"info\", \"default option when there is no matching dtmf found\\n\" );\n";
- if ($actiondefaulttype == "extension") {
- $tmp .= " sofia_contact_".$actiondefaultdest." = get_sofia_contact(\"".$actiondefaultdest."\",domain_name, \"".$actiondirectprofile."\");\n";
- $tmp .= " session.execute(\"bridge\", sofia_contact_".$actiondefaultdest."); //".$actiondefaultdest."\n";
- if ($actiondirectprofile == "auto") {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$actiondefaultdest."\");\n";
- }
- else {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$actiondefaultdest."\");\n";
- }
- }
- if ($actiondefaulttype == "voicemail") {
- if ($actiondirectprofile == "auto") {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$actiondefaultdest."\");\n";
- }
- else {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$actiondefaultdest."\");\n";
- }
- }
- if ($actiondefaulttype == "sip uri") {
- $tmp .= " session.execute(\"bridge\", \"".$actiondefaultdest."\"); //".$actiondefaultdest."\n";
- }
- $tmp .= " }\n";
-
- }
- }
-
- $tmp .= "\n";
- unset($tmpaction);
-
-
- $tmp .= " } \n";
- //$tmp .= " else if ( dtmf.digits.length == \"4\" ) {\n";
- //$tmp .= " //Transfer to the extension the caller\n";
- //$tmp .= " session.execute(\"transfer\", dtmf.digits+\" XML default\");\n";
- //$tmp .= " } else {\n";
- //$tmp .= $tmpactiondefault;
- //$tmp .= " }\n";
- $tmp .= "\n";
- $tmp .= " } //end if session.ready\n";
- $tmp .= "\n";
- $tmp .= " }\n"; //end if condition
-
- } //if ($actiondirect)
- } //actioncount
-
- $antiactiondirect = false;
- $antiactiondefault = false;
- $antiactioncount = 0;
- foreach($config['installedpackages']['freeswitchivroptions']['config'] as $row) {
- //find the correct IVR options with the correct action
- if ($row['ivrid'] == $rowhelper['ivrid']) {
- if ($row['optionaction'] == "anti-action") {
- $antiactioncount++;
- if (strtolower($row['optionnumber']) == "n") { //direct the call now don't wait for dtmf
- $antiactiondirect = true;
- $antiactiondirecttype = $row['optiontype'];
- $antiactiondirectdest = $row['optiondest'];
- $antiactiondirectprofile = $row['optionprofile'];
- }
- if (strtolower($row['optionnumber']) == "d") { //default option used when an dtmf doesn't match any option
- $antiactiondefault = true;
- $antiactiondefaulttype = $row['optiontype'];
- $antiactiondefaultdest = $row['optiondest'];
- $antiactiondefaultprofile = $row['optionprofile'];
- }
- }
- }
- }
- //$tmp .= "anti-action count: ".$antiactioncount."<br />\n";
-
-
- if ($antiactioncount > 0) {
- if ($antiactiondirect) {
- $tmp .= " else {\n";
- $tmp .= " //console_log( \"info\", \"anti-action call now don't wait for dtmf\\n\" );\n";
-
- if ($antiactiondirecttype == "extension") {
- $tmp .= " sofia_contact_".$antiactiondirectdest." = get_sofia_contact(\"".$antiactiondirectdest."\",domain_name, \"".$antiactiondirectprofile."\");\n";
- $tmp .= " session.execute(\"bridge\", sofia_contact_".$antiactiondirectdest."); //".$antiactiondirectdest."\n";
- if ($antiactiondirectprofile == "auto") {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$antiactiondirectdest."\");\n";
- }
- else {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$antiactiondirectdest."\");\n";
- }
- }
- if ($antiactiondirecttype == "voicemail") {
- if ($antiactiondirectprofile == "auto") {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$antiactiondirectdest."\");\n";
- }
- else {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$antiactiondirectdest."\");\n";
- }
- }
- if ($antiactiondirecttype == "sip uri") {
- $tmp .= " session.execute(\"bridge\", \"".$antiactiondirectdest."\"); //".$antiactiondirectdest."\n";
- }
- $tmp .= "}\n";
- }
- else {
- $tmp .= " else {\n";
- $tmp .= " //anti-action\n";
- $tmp .= " //console_log( \"info\", \"anti-action options\\n\" );\n";
- $tmp .= "\n";
- $tmp .= " var dtmf = new Object( );\n";
- $tmp .= " dtmf.digits = \"\";\n";
- $tmp .= " if ( session.ready( ) ) {\n";
- $tmp .= " session.answer( );\n";
- $tmp .= "\n";
- $tmp .= " digitmaxlength = 1;\n";
- $tmp .= " while (session.ready() && ! exit ) {\n";
- $tmp .= " session.streamFile( \"/usr/local/freeswitch/recordings/".$recording_antiaction_filename."\", mycb, \"dtmf ".$rowhelper['ivrtimeout']."\" );\n";
- $tmp .= " if (session.ready()) {\n";
- $tmp .= " if (dtmf.digits.length == 0) {\n";
- $tmp .= " dtmf.digits += session.getDigits(1, \"#\", ".($rowhelper['ivrtimeout']*1000)."); // ".$rowhelper['ivrtimeout']." seconds\n";
- $tmp .= " if (dtmf.digits.length == 0) {\n";
- //$tmp .= " console_log( "info", "time out option: " + dtmf.digits + "\n" );\n";
-
-
- //find the timeout IVR options with the correct action
- if (count($a_ivr_options) > 0) {
- foreach($a_ivr_options as $row) {
-
- if ($row['ivrid'] == $rowhelper['ivrid']) {
-
- if ($row['optionaction'] == "anti-action") {
- if (strtolower($row['optionnumber']) == "t") {
- if ($row['optiontype'] == "extension") {
- $tmp .= " sofia_contact_".$row['optiondest']." = get_sofia_contact(\"".$row['optiondest']."\",domain_name, \"".$row['optionprofile']."\");\n";
- $tmp .= " session.execute(\"bridge\", sofia_contact_".$row['optiondest']."); //".$row['optiondescr']."\n";
- if ($row['optionprofile'] == "auto") {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\");\n";
- }
- else {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\");\n";
- }
- }
- if ($row['optiontype'] == "voicemail") {
- if ($row['optionprofile'] == "auto") {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\"); //".$row['optiondescr']."\n";
- }
- else {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\"); //".$row['optiondescr']."\n";
- }
- }
- if ($row['optiontype'] == "sip uri") {
- $tmp .= " session.execute(\"bridge\", \"".$row['optiondest']."\"); //".$row['optiondescr']."\n";
- }
- }
-
- } //end anti-action
-
- } //end ivrid
-
- } //end for each
- } //if count
-
-
- $tmp .= " }\n";
- $tmp .= " else {\n";
- $tmp .= " break; //dtmf found end the while loop\n";
- $tmp .= " }\n";
-
- $tmp .= " }\n";
- $tmp .= " }\n";
- $tmp .= " }\n";
- $tmp .= "\n";
- $tmp .= " //pickup the remaining digits\n";
- $tmp .= " //http://wiki.freeswitch.org/wiki/Session_getDigits\n";
- $tmp .= " //getDigits(length, terminators, timeout, digit_timeout, abs_timeout)\n";
- $tmp .= " dtmf.digits += session.getDigits(4, \"#\", 3000);\n";
- $tmp .= "\n";
- $tmp .= " console_log( \"info\", \"IVR Digit Pressed: \" + dtmf.digits + \"\\n\" );\n";
- $tmp .= "\n";
-
-
- $tmpantiaction = "";
- $tmp .= " if ( dtmf.digits.length > \"0\" ) {\n";
-
- $x = 0;
- if (count($a_ivr_options) > 0) {
- foreach($a_ivr_options as $row) {
-
- /*
- $row['ivrid']
- $row['optionnumber']
- $row['optiontype']
- $row['optionaction']
- $row['optiondest']
- $row['optiondescr']
- */
- //$tmpantiactiondefault = "";
-
- //find the correct IVR options with the correct action
- if ($row['ivrid'] == $rowhelper['ivrid']) {
-
- if ($row['optionaction'] == "anti-action") {
-
- switch ($row['optionnumber']) {
- //case "t":
- // //break;
- //case "d":
- // //break;
- default:
- //$tmpantiaction .= " //console_log( \"info\", \"IVR Detected 1 digit \\n\" );\n";
-
- if ($x == 0) {
- $tmpantiaction .= " if ( dtmf.digits == \"".$row['optionnumber']."\" ) { //".$row['optiondescr']."\n";
- }
- else {
- $tmpantiaction .= " else if ( dtmf.digits == \"".$row['optionnumber']."\" ) { //".$row['optiondescr']."\n";
- }
-
- if ($row['optiontype'] == "extension") {
- $tmpantiaction .= " sofia_contact_".$row['optiondest']." = get_sofia_contact(\"".$row['optiondest']."\",domain_name, \"".$row['optionprofile']."\");\n";
- $tmpantiaction .= " session.execute(\"bridge\", sofia_contact_".$row['optiondest']."); //".$row['optiondescr']."\n";
- if ($row['optionprofile'] == "auto") {
- $tmpantiaction .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\");\n";
- }
- else {
- $tmpantiaction .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\");\n";
- }
- }
- if ($row['optiontype'] == "voicemail") {
- if ($row['optionprofile'] == "auto") {
- $tmpantiaction .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\"); //".$row['optiondescr']."\n";
- }
- else {
- $tmpantiaction .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\"); //".$row['optiondescr']."\n";
- }
- }
- if ($row['optiontype'] == "sip uri") {
- $tmpantiaction .= " session.execute(\"bridge\", \"".$row['optiondest']."\"); //".$row['optiondescr']."\n";
- }
- $tmpantiaction .= " }\n";
-
- } //end switch
-
- $x++;
- } //end anti-action
-
- } //end ivrid
-
-
- } //end for each
- } //if count
-
- $tmp .= $tmpantiaction;
- if ($rowhelper['ivrdirectdial'] == "true") {
- $tmp .= " else {\n";
- $tmp .= " session.execute(\"transfer\", dtmf.digits+\" XML default\");\n";
- //$tmp .= $tmpantiactiondefault;
- $tmp .= " }\n";
- }
- else {
- if ($antiactiondefault) {
- $tmp .= " else {\n";
- $tmp .= " //console_log( \"info\", \"default option used when dtmf doesn't match any other option\\n\" );\n";
-
- if ($antiactiondefaulttype == "extension") {
- $tmp .= " sofia_contact_".$antiactiondefaultdest." = get_sofia_contact(\"".$antiactiondefaultdest."\",domain_name, \"".$actiondirectprofile."\");\n";
- $tmp .= " session.execute(\"bridge\", sofia_contact_".$antiactiondefaultdest."); //".$antiactiondefaultdest."\n";
- if ($actiondirectprofile == "auto") {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$antiactiondefaultdest."\");\n";
- }
- else {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$antiactiondefaultdest."\");\n";
- }
- }
- if ($antiactiondefaulttype == "voicemail") {
- if ($actiondirectprofile == "auto") {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$antiactiondefaultdest."\");\n";
- }
- else {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$antiactiondefaultdest."\");\n";
- }
- }
- if ($antiactiondefaulttype == "sip uri") {
- $tmp .= " session.execute(\"bridge\", \"".$antiactiondefaultdest."\"); //".$antiactiondefaultdest."\n";
- }
- $tmp .= " }\n";
- }
- }
- $tmp .= "\n";
- unset($tmpantiaction);
-
- $tmp .= " } \n";
- //$tmp .= " else if ( dtmf.digits.length == \"3\" ) {\n";
- //$tmp .= " //Transfer to the extension the caller chose\n";
- //$tmp .= " session.execute(\"transfer\", dtmf.digits+\" XML default\"); \n";
- //$tmp .= " }\n";
- //$tmp .= " else {\n";
- //$tmp .= $tmpantiactiondefault;
- //$tmp .= " }\n";
- $tmp .= "\n";
- $tmp .= " } //end if session.ready\n";
- $tmp .= "\n";
- $tmp .= " } //end if condition";
-
- } //if ($antiactiondirect)
- } //antiactioncount
- unset($tmpactiondefault);
- unset($tmpantiactiondefault);
-
- if (strlen($rowhelper['ivrid']) > 0) {
- $ivrfilename = "ivr_".str_replace(array("{", "}"), "", $rowhelper['ivrid']).".js";
- $fout = fopen("/usr/local/freeswitch/scripts/".$ivrfilename,"w");
- fwrite($fout, $tmp);
- unset($ivrfilename);
- fclose($fout);
- }
-
- } //end foreach
- } //end if count
- conf_mount_ro();
- config_unlock();
-
-} //end function
-
-
-
-function sync_package_freeswitch_dialplan_includes()
-{
-
- global $config;
- conf_mount_rw();
- config_lock();
-
- $a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config'];
- $a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config'];
-
- //order the array
- if (!function_exists('cmp_number_dialplan_details')) {
- function cmp_number_dialplan_details($a, $b) {
- if ($a["fieldorder"] > $b["fieldorder"]) {
- return 1;
- }
- else {
- return 0;
- }
- }
- }
-
- if (count($a_dialplan_includes) > 0) {
- foreach($config['installedpackages']['freeswitchdialplanincludes']['config'] as $rowhelper) {
- $tmp = "";
- $tmp .= "\n";
-
- //$rowhelper['dialplanincludeid'];
- //$rowhelper['extensionname'];
- //$rowhelper['context'];
- //$rowhelper['enabled'];
-
- $tmp = "<extension name=\"".$rowhelper['extensionname']."\">\n";
-
- if (count($a_dialplan_include_details) > 0) {
-
- if (count($a_dialplan_include_details) > 0) { usort($a_dialplan_include_details, "cmp_number_dialplan_details"); }
-
- $conditioncount = 0;
- $i = 0;
- foreach ($a_dialplan_include_details as $ent) {
- if ($ent['tag'] == "condition" && $rowhelper['dialplanincludeid'] == $ent['dialplanincludeid']) {
- $conditioncount++;
- $i++;
- }
- }
-
- $i = 1;
- foreach ($a_dialplan_include_details as $ent) {
- if ($ent['tag'] == "condition" && $rowhelper['dialplanincludeid'] == $ent['dialplanincludeid']) {
- if ($conditioncount == 1) { //single condition
- //start tag
- $tmp .= " <condition field=\"".$ent['fieldtype']."\" expression=\"".$ent['fielddata']."\">\n";
- }
- else { //more than one condition
- if ($i < $conditioncount) {
- //all tags should be self-closing except the last one
- $tmp .= " <condition field=\"".$ent['fieldtype']."\" expression=\"".$ent['fielddata']."\"/>\n";
- }
- else {
- //for the last tag use the start tag
- $tmp .= " <condition field=\"".$ent['fieldtype']."\" expression=\"".$ent['fielddata']."\">\n";
- }
- }
- $i++;
- }
- } //end for each
-
- } //end if count
-
- if (count($a_dialplan_include_details) > 0) {
- $i = 0;
- foreach ($a_dialplan_include_details as $ent) {
- if ($ent['tag'] == "action" && $rowhelper['dialplanincludeid'] == $ent['dialplanincludeid']) {
- $tmp .= " <action application=\"".$ent['fieldtype']."\" data=\"".$ent['fielddata']."\"/>\n";
- }
- $i++;
- }
- }
-
- if (count($a_dialplan_include_details) > 0) {
- $i = 0;
- foreach ($a_dialplan_include_details as $ent) {
- if ($ent['tag'] == "anti-action" && $rowhelper['dialplanincludeid'] == $ent['dialplanincludeid']) {
- $tmp .= " <anti-action application=\"".$ent['fieldtype']."\" data=\"".$ent['fielddata']."\"/>\n";
- }
- $i++;
- }
- }
-
- //if (count($a_dialplan_include_details) > 0) {
- //foreach ($a_dialplan_include_details as $ent) {
- // $i = 0;
- // if ($ent['tag'] == "param" && $rowhelper['dialplanincludeid'] == $ent['dialplanincludeid']) {
- //$ent['tag']
- //$ent['fieldtype']
- //$ent['fielddata']
- // }
- // $i++;
- // }
- //}
-
- if ($conditioncount > 0) {
- $tmp .= " </condition>\n";
- }
- unset ($conditioncount);
- $tmp .= "</extension>\n";
-
-
- if ($rowhelper['enabled'] == "true") {
- $dialplanincludefilename = $rowhelper['order']."_".$rowhelper['extensionname'].".xml";
- $fout = fopen("/usr/local/freeswitch/conf/dialplan/default/".$dialplanincludefilename,"w");
- fwrite($fout, $tmp);
- fclose($fout);
- }
- unset($dialplanincludefilename);
- unset($tmp);
-
-
- } //end foreach
- } //if array count
-
- conf_mount_ro();
- config_unlock();
-
-}
-
-
-function sync_package_freeswitch_public_includes()
-{
-
- global $config;
- conf_mount_rw();
- config_lock();
-
- $a_public_includes = &$config['installedpackages']['freeswitchpublicincludes']['config'];
- $a_public_include_details = &$config['installedpackages']['freeswitchpublicincludedetails']['config'];
-
- if (count($a_public_includes) > 0) {
-
- //order the array
- function cmp_number_public_include_details($a, $b) {
- if ($a["fieldorder"] > $b["fieldorder"]) {
- return 1;
- }
- else {
- return 0;
- }
- }
-
-
- foreach($a_public_includes as $rowhelper) {
- $tmp = "";
- $tmp .= "\n";
-
- //$rowhelper['publicincludeid'];
- //$rowhelper['extensionname'];
- //$rowhelper['context'];
- //$rowhelper['enabled'];
-
- $tmp = "<extension name=\"".$rowhelper['extensionname']."\">\n";
-
- if (count($a_public_include_details) > 0) {
-
- if (count($a_public_include_details) > 0) { usort($a_public_include_details, "cmp_number_public_include_details"); }
-
- $conditioncount = 0;
- $i = 0;
- foreach ($a_public_include_details as $ent) {
- if ($ent['tag'] == "condition" && $rowhelper['publicincludeid'] == $ent['publicincludeid']) {
- $conditioncount++;
- $i++;
- }
- }
-
- $i = 1;
- foreach ($a_public_include_details as $ent) {
- if ($ent['tag'] == "condition" && $rowhelper['publicincludeid'] == $ent['publicincludeid']) {
- if ($conditioncount == 1) { //single condition
- //start tag
- $tmp .= " <condition field=\"".$ent['fieldtype']."\" expression=\"".$ent['fielddata']."\">\n";
- }
- else { //more than one condition
- if ($i < $conditioncount) {
- //all tags should be self-closing except the last one
- $tmp .= " <condition field=\"".$ent['fieldtype']."\" expression=\"".$ent['fielddata']."\"/>\n";
- }
- else {
- //for the last tag use the start tag
- $tmp .= " <condition field=\"".$ent['fieldtype']."\" expression=\"".$ent['fielddata']."\">\n";
- }
- }
- $i++;
- }
- } //end for each
-
- } //end if count
-
-
- if (count($a_public_include_details) > 0) {
- $i = 0;
- foreach ($a_public_include_details as $ent) {
- if ($ent['tag'] == "action" && $rowhelper['publicincludeid'] == $ent['publicincludeid']) {
- $tmp .= " <action application=\"".$ent['fieldtype']."\" data=\"".$ent['fielddata']."\"/>\n";
- }
- $i++;
- }
- }
-
- if (count($a_public_include_details) > 0) {
- $i = 0;
- foreach ($a_public_include_details as $ent) {
- if ($ent['tag'] == "anti-action" && $rowhelper['publicincludeid'] == $ent['publicincludeid']) {
- $tmp .= " <anti-action application=\"".$ent['fieldtype']."\" data=\"".$ent['fielddata']."\"/>\n";
- }
- $i++;
- }
- }
-
- //if (count($a_public_include_details) > 0) {
- //foreach ($a_public_include_details as $ent) {
- // $i = 0;
- // if ($ent['tag'] == "param" && $rowhelper['publicincludeid'] == $ent['publicincludeid']) {
- //$ent['tag']
- //$ent['fieldtype']
- //$ent['fielddata']
- // }
- // $i++;
- // }
- //}
-
- if ($conditioncount > 0) {
- $tmp .= " </condition>\n";
- }
- unset ($conditioncount);
- $tmp .= "</extension>\n";
-
-
- if ($rowhelper['enabled'] == "true") {
- $publicincludefilename = $rowhelper['order']."_".$rowhelper['extensionname'].".xml";
- $fout = fopen("/usr/local/freeswitch/conf/dialplan/public/".$publicincludefilename,"w");
- fwrite($fout, $tmp);
- fclose($fout);
- }
- unset($publicincludefilename);
- unset($tmp);
-
-
- } //end foreach
- } //end if count
- conf_mount_ro();
- config_unlock();
-
-}
-
-
-function sync_package_freeswitch()
-{
- global $config;
- sync_package_freeswitch_settings();
- sync_package_freeswitch_dialplan();
- sync_package_freeswitch_dialplan_includes();
- sync_package_freeswitch_extensions();
- sync_package_freeswitch_gateways();
- sync_package_freeswitch_modules();
- sync_package_freeswitch_public();
- sync_package_freeswitch_public_includes();
- sync_package_freeswitch_vars();
- sync_package_freeswitch_internal();
- sync_package_freeswitch_external();
- //sync_package_freeswitch_recordings();
- if (pkg_is_service_running('freeswitch')) {
- sync_package_freeswitch_ivr();
- }
-
-}
-
-
-function freeswitch_php_install_command()
-{
- global $config;
- //exec("/etc/./rc.conf_mount_rw");
-
- $freeswitch_package_version = "0.9.51";
- $freeswitch_build_version = "1.0.4 pre 8";
- $freeswitch_build_revision = "13784";
-
- //set script execution time limit to 24 hours
- set_time_limit (86400);
- ini_set(max_execution_time,86400);
-
- //hide errors
- ini_set('display_errors', '0');
-
- //used with fax to png, and fax to pdf conversion
- exec("pkg_add -r tiff2png");
-
- //add sqlite package
- exec("pkg_add -r sqlite34");
-
- clearstatcache();
- if (!is_dir('/usr/local/www/packages/')) {
- exec("mkdir /usr/local/www/packages/");
- }
-
- if (!is_dir('/usr/local/www/packages/freeswitch/')) {
- exec("mkdir /usr/local/www/packages/freeswitch/");
- }
-
- //$struname = exec('uname -v');
- //if (stristr($struname, 'FreeBSD 7.2')) {
- // $freebsd_version = "7.2";
- //}
-
- $download_path = 'https://packages.pfsense.org/packages/config/freeswitch/';
- //exec("cd /tmp/;fetch ".$download_path."freeswitch.tgz"); //handled by freeswitch.xml
- exec("tar zxvf /tmp/freeswitch.tgz -C /usr/local/");
- unlink_if_exists("/tmp/freeswitch.tgz");
-
- if (!is_dir('/usr/local/freeswitch/storage/fax/')) {
- exec("mkdir /usr/local/freeswitch/storage/fax/");
- }
-
- if (!is_dir('/usr/local/freeswitch/storage/fax/receive/')) {
- exec("mkdir /usr/local/freeswitch/storage/fax/receive/");
- }
-
- //download the dialplan default.xml
- exec("cd /tmp/;fetch ".$download_path."dialplan.default.xml");
- exec("cp /tmp/dialplan.default.xml /usr/local/freeswitch/conf/dialplan/default.xml");
- unlink_if_exists("/tmp/dialplan.default.xml");
-
- //download the dialplan public.xml
- exec("cd /tmp/;fetch ".$download_path."dialplan.public.xml");
- exec("cp /tmp/dialplan.public.xml /usr/local/freeswitch/conf/dialplan/public.xml");
- unlink_if_exists("/tmp/dialplan.public.xml");
-
- //make a backup copy of the default config used with the 'Restore Default' buttons on the text areas.
- exec("cp -R /usr/local/freeswitch/conf /usr/local/freeswitch/conf.orig");
-
- //remove some default config files that are not needed
- unlink_if_exists("/usr/local/freeswitch/conf/dialplan/default/01_example.com.xml");
- unlink_if_exists("/usr/local/freeswitch/conf/dialplan/public/00_inbound_did.xml");
-
- if (!is_dir('/usr/local/freeswitch/sounds/custom/')) {
- exec("mkdir /usr/local/freeswitch/sounds/custom/");
- }
-
- if (!is_dir('/usr/local/freeswitch/sounds/custom/8000/')) {
- exec("mkdir /usr/local/freeswitch/sounds/custom/8000/");
- }
-
- //copy audio files
- exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch ".$download_path."please_enter_your_pin_number.wav");
- exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch ".$download_path."please_enter_the_pin_number.wav");
- exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch ".$download_path."please_enter_the_extension_number.wav");
- exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch ".$download_path."please_enter_the_phone_number.wav");
- exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch ".$download_path."call_forward_has_been_set.wav");
- exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch ".$download_path."call_forward_has_been_deleted.wav");
- exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch ".$download_path."begin_recording.wav");
- exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch ".$download_path."your_pin_number_is_incorect_goodbye.wav");
- exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch ".$download_path."please_say_your_name_and_reason_for_calling.wav");
- exec("cd /usr/local/freeswitch/sounds/custom/8000/;fetch ".$download_path."press_1_to_accept_2_to_reject_or_3_for_voicemail.wav");
-
- //mod_fax
- exec("cd /usr/local/freeswitch/mod/;fetch ".$download_path."mod_fax.so");
-
- //download lib files
- exec("cd /usr/local/lib/;fetch ".$download_path."libtinfo.so.5.6");
- exec("cd /usr/local/lib/;fetch ".$download_path."libncurses.so.5.6");
- exec("cd /usr/local/lib/;fetch ".$download_path."libncurses.so.5.7");
- exec("cd /usr/local/lib/;fetch ".$download_path."libogg.so.5.3");
- exec("cp /usr/local/lib/libogg.so.5.3 /usr/local/lib/libogg.so.5");
- exec("cd /usr/local/lib/;fetch ".$download_path."libvorbis.so.4");
- exec("cd /usr/local/lib/;fetch ".$download_path."libcurl.so.5");
- exec("cd /usr/local/lib/;fetch ".$download_path."libodbc.so.1");
- exec("cd /usr/local/lib/;fetch ".$download_path."libiconv.so.3");
- exec("cd /usr/local/lib/;fetch ".$download_path."libspandsp.so.1");
- exec("cp /usr/local/lib/libspandsp.so.1 /usr/local/lib/libspandsp.so.2");
-
- //download xml package files
- exec("cd /usr/local/pkg/;fetch ".$download_path."freeswitch_modules.xml");
-
-
- //misc files
- if (!is_dir('/usr/local/www/edit_area/')) {
- exec("cd /tmp/;fetch ".$download_path."edit_area.tgz");
- system('cd /usr/local/www; tar xvpfz /tmp/edit_area.tgz edit_area');
- unlink_if_exists("/tmp/edit_area.tgz");
- }
-
-
- //rename PHP files from .tmp to .php
- exec("cd /tmp/;fetch ".$download_path."index.tmp");
- exec("cp /tmp/index.tmp /usr/local/www/packages/freeswitch/index.php");
- unlink_if_exists("/tmp/index.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."class.smtp.tmp");
- exec("cp /tmp/class.smtp.tmp /usr/local/www/packages/freeswitch/class.smtp.php");
- unlink_if_exists("/tmp/class.smtp.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."class.phpmailer.tmp");
- exec("cp /tmp/class.phpmailer.tmp /usr/local/www/packages/freeswitch/class.phpmailer.php");
- unlink_if_exists("/tmp/class.phpmailer.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_cmd.tmp");
- exec("cp /tmp/freeswitch_cmd.tmp /usr/local/www/packages/freeswitch/freeswitch_cmd.php");
- unlink_if_exists("/tmp/freeswitch_cmd.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_dialplan.tmp");
- exec("cp /tmp/freeswitch_dialplan.tmp /usr/local/www/packages/freeswitch/freeswitch_dialplan.php");
- unlink_if_exists("/tmp/freeswitch_dialplan.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_dialplan_includes_details.tmp");
- exec("cp /tmp/freeswitch_dialplan_includes_details.tmp /usr/local/www/packages/freeswitch/freeswitch_dialplan_includes_details.php");
- unlink_if_exists("/tmp/freeswitch_dialplan_includes_details.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_dialplan_includes_details_edit.tmp");
- exec("cp /tmp/freeswitch_dialplan_includes_details_edit.tmp /usr/local/www/packages/freeswitch/freeswitch_dialplan_includes_details_edit.php");
- unlink_if_exists("/tmp/freeswitch_dialplan_includes_details_edit.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_dialplan_includes.tmp");
- exec("cp /tmp/freeswitch_dialplan_includes.tmp /usr/local/www/packages/freeswitch/freeswitch_dialplan_includes.php");
- unlink_if_exists("/tmp/freeswitch_dialplan_includes.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_dialplan_includes_edit.tmp");
- exec("cp /tmp/freeswitch_dialplan_includes_edit.tmp /usr/local/www/packages/freeswitch/freeswitch_dialplan_includes_edit.php");
- unlink_if_exists("/tmp/freeswitch_dialplan_includes_edit.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_extensions.tmp");
- exec("cp /tmp/freeswitch_extensions.tmp /usr/local/www/packages/freeswitch/freeswitch_extensions.php");
- unlink_if_exists("/tmp/freeswitch_extensions.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_extensions_edit.tmp");
- exec("cp /tmp/freeswitch_extensions_edit.tmp /usr/local/www/packages/freeswitch/freeswitch_extensions_edit.php");
- unlink_if_exists("/tmp/freeswitch_extensions_edit.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_fax.tmp");
- exec("cp /tmp/freeswitch_fax.tmp /usr/local/www/packages/freeswitch/freeswitch_fax.php");
- unlink_if_exists("/tmp/freeswitch_fax.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_fax_edit.tmp");
- exec("cp /tmp/freeswitch_fax_edit.tmp /usr/local/www/packages/freeswitch/freeswitch_fax_edit.php");
- unlink_if_exists("/tmp/freeswitch_fax_edit.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."fax_to_email.tmp");
- exec("cp /tmp/fax_to_email.tmp /usr/local/www/packages/freeswitch/fax_to_email.php");
- unlink_if_exists("/tmp/fax_to_email.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_features.tmp");
- exec("cp /tmp/freeswitch_features.tmp /usr/local/www/packages/freeswitch/freeswitch_features.php");
- unlink_if_exists("/tmp/freeswitch_features.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_gateways.tmp");
- exec("cp /tmp/freeswitch_gateways.tmp /usr/local/www/packages/freeswitch/freeswitch_gateways.php");
- unlink_if_exists("/tmp/freeswitch_gateways.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_gateways_edit.tmp");
- exec("cp /tmp/freeswitch_gateways_edit.tmp /usr/local/www/packages/freeswitch/freeswitch_gateways_edit.php");
- unlink_if_exists("/tmp/freeswitch_gateways_edit.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_hunt_group.tmp");
- exec("cp /tmp/freeswitch_hunt_group.tmp /usr/local/www/packages/freeswitch/freeswitch_hunt_group.php");
- unlink_if_exists("/tmp/freeswitch_hunt_group.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_hunt_group_edit.tmp");
- exec("cp /tmp/freeswitch_hunt_group_edit.tmp /usr/local/www/packages/freeswitch/freeswitch_hunt_group_edit.php");
- unlink_if_exists("/tmp/freeswitch_hunt_group_edit.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_hunt_group_destinations.tmp");
- exec("cp /tmp/freeswitch_hunt_group_destinations.tmp /usr/local/www/packages/freeswitch/freeswitch_hunt_group_destinations.php");
- unlink_if_exists("/tmp/freeswitch_hunt_group_destinations.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_hunt_group_destinations_edit.tmp");
- exec("cp /tmp/freeswitch_hunt_group_destinations_edit.tmp /usr/local/www/packages/freeswitch/freeswitch_hunt_group_destinations_edit.php");
- unlink_if_exists("/tmp/freeswitch_hunt_group_destinations_edit.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_ivr.tmp");
- exec("cp /tmp/freeswitch_ivr.tmp /usr/local/www/packages/freeswitch/freeswitch_ivr.php");
- unlink_if_exists("/tmp/freeswitch_ivr.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_ivr_edit.tmp");
- exec("cp /tmp/freeswitch_ivr_edit.tmp /usr/local/www/packages/freeswitch/freeswitch_ivr_edit.php");
- unlink_if_exists("/tmp/freeswitch_ivr_edit.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_ivr_options.tmp");
- exec("cp /tmp/freeswitch_ivr_options.tmp /usr/local/www/packages/freeswitch/freeswitch_ivr_options.php");
- unlink_if_exists("/tmp/freeswitch_ivr_options.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_ivr_options_edit.tmp");
- exec("cp /tmp/freeswitch_ivr_options_edit.tmp /usr/local/www/packages/freeswitch/freeswitch_ivr_options_edit.php");
- unlink_if_exists("/tmp/freeswitch_ivr_options_edit.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_profiles.tmp");
- exec("cp /tmp/freeswitch_profiles.tmp /usr/local/www/packages/freeswitch/freeswitch_profiles.php");
- unlink_if_exists("/tmp/freeswitch_profiles.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_profile_edit.tmp");
- exec("cp /tmp/freeswitch_profile_edit.tmp /usr/local/www/packages/freeswitch/freeswitch_profile_edit.php");
- unlink_if_exists("/tmp/freeswitch_profile_edit.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_public.tmp");
- exec("cp /tmp/freeswitch_public.tmp /usr/local/www/packages/freeswitch/freeswitch_public.php");
- unlink_if_exists("/tmp/freeswitch_public.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_public_includes.tmp");
- exec("cp /tmp/freeswitch_public_includes.tmp /usr/local/www/packages/freeswitch/freeswitch_public_includes.php");
- unlink_if_exists("/tmp/freeswitch_public_includes.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_public_includes_edit.tmp");
- exec("cp /tmp/freeswitch_public_includes_edit.tmp /usr/local/www/packages/freeswitch/freeswitch_public_includes_edit.php");
- unlink_if_exists("/tmp/freeswitch_public_includes_edit.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_public_includes_details.tmp");
- exec("cp /tmp/freeswitch_public_includes_details.tmp /usr/local/www/packages/freeswitch/freeswitch_public_includes_details.php");
- unlink_if_exists("/tmp/freeswitch_public_includes_details.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_public_includes_details_edit.tmp");
- exec("cp /tmp/freeswitch_public_includes_details_edit.tmp /usr/local/www/packages/freeswitch/freeswitch_public_includes_details_edit.php");
- unlink_if_exists("/tmp/freeswitch_public_includes_details_edit.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_mailto.tmp");
- exec("cp /tmp/freeswitch_mailto.tmp /usr/local/www/packages/freeswitch/freeswitch_mailto.php");
- unlink_if_exists("/tmp/freeswitch_mailto.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_recordings.tmp");
- exec("cp /tmp/freeswitch_recordings.tmp /usr/local/www/packages/freeswitch/freeswitch_recordings.php");
- unlink_if_exists("/tmp/freeswitch_recordings.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_recordings_edit.tmp");
- exec("cp /tmp/freeswitch_recordings_edit.tmp /usr/local/www/packages/freeswitch/freeswitch_recordings_edit.php");
- unlink_if_exists("/tmp/freeswitch_recordings_edit.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_recordings_play.tmp");
- exec("cp /tmp/freeswitch_recordings_play.tmp /usr/local/www/packages/freeswitch/freeswitch_recordings_play.php");
- unlink_if_exists("/tmp/freeswitch_recordings_play.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_status.tmp");
- exec("cp /tmp/freeswitch_status.tmp /usr/local/www/packages/freeswitch/freeswitch_status.php");
- unlink_if_exists("/tmp/freeswitch_status.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_time_conditions.tmp");
- exec("cp /tmp/freeswitch_time_conditions.tmp /usr/local/www/packages/freeswitch/freeswitch_time_conditions.php");
- unlink_if_exists("/tmp/freeswitch_time_conditions.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_time_conditions_edit.tmp");
- exec("cp /tmp/freeswitch_time_conditions_edit.tmp /usr/local/www/packages/freeswitch/freeswitch_time_conditions_edit.php");
- unlink_if_exists("/tmp/freeswitch_time_conditions_edit.tmp");
-
- exec("cd /tmp/;fetch ".$download_path."freeswitch_vars.tmp");
- exec("cp /tmp/freeswitch_vars.tmp /usr/local/www/packages/freeswitch/freeswitch_vars.php");
- unlink_if_exists("/tmp/freeswitch_vars.tmp");
-
- exec("cd /usr/local/freeswitch/scripts/;fetch ".$download_path."disa.js");
- exec("cd /usr/local/freeswitch/scripts/;fetch ".$download_path."originate.js");
- exec("cp /usr/local/freeswitch/htdocs/slim.swf /usr/local/www/packages/freeswitch/slim.swf");
-
- /* freeswitch settings defaults */
- if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['numbering_plan']) == 0) {
- $config['installedpackages']['freeswitchsettings']['config'][0]['numbering_plan'] = "US";
- }
- if(strlen($config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password']) == 0) {
- $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password'] = "ClueCon";
- }
- if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port']) == 0) {
- $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port'] = "8021";
- }
- if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_http_port']) == 0) {
- $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_http_port'] = "8787";
- }
- if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_realm']) == 0) {
- $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_realm'] = "freeswitch";
- }
- if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_user']) == 0) {
- $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_user'] = "freeswitch";
- }
- if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_pass']) == 0) {
- $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_pass'] = "works";
- }
- if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['admin_pin']) == 0) {
- $config['installedpackages']['freeswitchsettings']['config'][0]['admin_pin'] = "7575";
- }
- if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['mod_shout_decoder']) == 0) {
- $config['installedpackages']['freeswitchsettings']['config'][0]['mod_shout_decoder'] = "i386";
- }
- if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['mod_shout_volume']) == 0) {
- $config['installedpackages']['freeswitchsettings']['config'][0]['mod_shout_volume'] = "0.3";
- }
-
- $numbering_plan = $config['installedpackages']['freeswitchsettings']['config'][0]['numbering_plan'];
- $event_socket_password = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password'];
- $event_socket_port = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port'];
- $xml_rpc_http_port = $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_http_port'];
- $xml_rpc_auth_realm = $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_realm'];
- $xml_rpc_auth_user = $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_user'];
- $xml_rpc_auth_pass = $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_pass'];
- $admin_pin = $config['installedpackages']['freeswitchsettings']['config'][0]['admin_pin'];
-
- //write the recording.js script
- recording_js();
-
- //add recording.js to the dialplan
- $a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config'];
- $a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config'];
-
- //delete dialplan recording from the previous install
- if (count($a_dialplan_includes) > 0) {
- $i = 0;
- foreach ($a_dialplan_includes as $ent) {
- if ($ent['extensionname'] == "Recordings") {
- unset($a_dialplan_includes[$i]);
- }
- $i++;
- }
- }
-
- //delete the recording dialplan details
- if (count($a_dialplan_include_details) > 0) {
- $i = 0;
- foreach ($a_dialplan_include_details as $ent) {
- if ($ent['fielddata'] == "^732673$") {
- unset($a_dialplan_include_details[$i]);
- }
- if ($ent['fielddata'] == "recordings.js") {
- unset($a_dialplan_include_details[$i]);
- }
- $i++;
- }
- }
-
- //add recording to the dialplan
- $dialplanincludeid = guid();
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['extensionname'] = 'Recordings';
- $ent['order'] = '9000';
- $ent['context'] = 'default';
- $ent['enabled'] = 'true';
- $ent['descr'] = '*732673 Default system recordings tool';
- $a_dialplan_includes[] = $ent;
- unset($ent);
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'condition'; //condition, action, antiaction
- $ent['fieldtype'] = 'destination_number';
- $ent['fielddata'] = '^\*(732673)$';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldtype'] = 'javascript';
- $ent['fielddata'] = 'recordings.js';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
-
-
- //delete dialplan DISA from the previous install
- $disa_enabled = 'false';
- if (count($a_dialplan_includes) > 0) {
- $i = 0;
- foreach ($a_dialplan_includes as $ent) {
- if ($ent['extensionname'] == "DISA") {
- $disa_enabled = $ent['enabled'];
- unset($a_dialplan_includes[$i]);
- }
- $i++;
- }
- }
-
- //add the DISA to the dialplan
- $dialplanincludeid = guid();
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['extensionname'] = 'DISA';
- $ent['order'] = '000';
- $ent['context'] = 'default';
- $ent['enabled'] = $disa_enabled;
- $ent['descr'] = '*3472 Direct Inward System Access';
- $a_dialplan_includes[] = $ent;
- unset($ent);
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'condition'; //condition, action, antiaction, set
- $ent['fieldtype'] = 'destination_number';
- $ent['fielddata'] = '^\*(3472)$';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'action'; //condition, action, antiaction, set
- $ent['fieldtype'] = 'javascript';
- $ent['fielddata'] = 'disa.js';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
-
- write_config();
-
- //prepare switch.conf.xml for voicemail to email
- $filename = "/usr/local/freeswitch/conf/autoload_configs/switch.conf.xml";
- $handle = fopen($filename,"rb");
- $contents = fread($handle, filesize($filename));
- fclose($handle);
-
- $handle = fopen($filename,"w");
- $contents = str_replace("<param name=\"mailer-app\" value=\"sendmail\"/>", "<param name=\"mailer-app\" value=\"/usr/local/bin/php\"/>", $contents);
- $contents = str_replace("<param name=\"mailer-app-args\" value=\"-t\"/>", "<param name=\"mailer-app-args\" value=\"/usr/local/www/packages/freeswitch/freeswitch_mailto.php\"/>", $contents);
- fwrite($handle, $contents);
- unset($contents);
- fclose($handle);
- unset($filename);
-
- //prepare shout.conf.xml for mod_shout
- $fout = fopen("/usr/local/freeswitch/conf/autoload_configs/shout.conf.xml","w");
- $tmpxml = "<configuration name=\"shout.conf\" description=\"mod shout config\">\n";
- $tmpxml .= " <settings>\n";
- $tmpxml .= " <!-- Don't change these unless you are insane -->\n";
- $tmpxml .= " <param name=\"decoder\" value=\"i586\"/>\n";
- $tmpxml .= " <!--<param name=\"volume\" value=\".1\"/>-->\n";
- $tmpxml .= " <!--<param name=\"outscale\" value=\"8192\"/>-->\n";
- $tmpxml .= " </settings>\n";
- $tmpxml .= "</configuration>";
- fwrite($fout, $tmpxml);
- unset($tmpxml);
- fclose($fout);
-
- $fout = fopen("/usr/local/freeswitch/conf/autoload_configs/event_socket.conf.xml","w");
- $tmpxml = "<configuration name=\"event_socket.conf\" description=\"Socket Client\">\n";
- $tmpxml .= " <settings>\n";
- $tmpxml .= " <param name=\"listen-ip\" value=\"". $config['interfaces']['lan']['ipaddr'] ."\"/>\n";
- $tmpxml .= " <param name=\"listen-port\" value=\"". $event_socket_port ."\"/>\n";
- $tmpxml .= " <param name=\"password\" value=\"". $event_socket_password ."\"/>\n";
- $tmpxml .= " <!--<param name=\"apply-inbound-acl\" value=\"lan\"/>-->\n";
- $tmpxml .= " </settings>\n";
- $tmpxml .= "</configuration>";
- fwrite($fout, $tmpxml);
- unset($tmpxml);
- fclose($fout);
-
- /* freeswitch modules defaults */
-
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_console']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_console'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_logfile']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_logfile'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_syslog']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_syslog'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_yaml']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_yaml'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_enum']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_enum'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_xml_rpc']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_xml_rpc'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_xml_curl']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_xml_curl'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_xml_cdr']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_xml_cdr'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_cdr_csv']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_cdr_csv'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_event_multicast']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_event_multicast'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_event_socket']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_event_socket'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_zeroconf']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_zeroconf'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_ldap']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_ldap'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_dingaling']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_dingaling'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_iax']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_iax'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_portaudio']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_portaudio'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_alsa']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_alsa'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_sofia']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_sofia'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_loopback']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_loopback'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_wanpipe']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_wanpipe'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_woomera']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_woomera'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_openzap']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_openzap'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_commands']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_commands'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_conference']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_conference'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_dptools']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_dptools'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_expr']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_expr'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_fax']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_fax'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_fifo']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_fifo'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_voicemail']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_voicemail'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_limit']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_limit'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_esf']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_esf'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_fsv']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_fsv'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_snom']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_snom'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_dialplan_directory']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_dialplan_directory'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_dialplan_xml']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_dialplan_xml'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_dialplan_asterisk']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_dialplan_asterisk'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_voipcodecs']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_voipcodecs'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_g723_1']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_g723_1'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_g729']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_g729'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_amr']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_amr'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_ilbc']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_ilbc'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_speex']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_speex'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_siren']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_siren'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_celt']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_celt'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_h26x']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_h26x'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_sndfile']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_sndfile'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_native_file']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_native_file'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_shout']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_shout'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_local_stream']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_local_stream'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_tone_stream']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_tone_stream'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_spidermonkey']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_spidermonkey'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_spidermonkey_odbc']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_spidermonkey_odbc'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_perl']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_perl'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_python']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_python'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_java']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_java'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_lua']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_lua'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_flite']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_flite'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_pocketsphinx']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_pocketsphinx'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_cepstral']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_cepstral'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_openmrcp']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_openmrcp'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_rss']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_rss'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_en']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_en'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_de']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_de'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_es']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_es'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_fr']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_fr'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_it']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_it'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_nl']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_nl'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_ru']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_ru'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_zh']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_zh'] = "disable";
- }
-
- //create the backup directory
- if (!is_dir('/root/backup/')) {
- exec("mkdir /root/backup/");
- }
-
- //extract a specific directory to /usr/local/freeswitch
- $filename = 'freeswitch.bak.tgz';
- if (file_exists('/root/backup/'.$filename)) {
- //echo "The file $filename exists";
-
- exec("rm -R /usr/local/freeswitch/conf/sip_profiles/");
- exec("rm -R /usr/local/freeswitch/sounds/music/");
-
- //Recommended
- system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/db/');
- system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/log/');
- system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/recordings/');
- system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/scripts/');
- system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/storage/');
- system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/sounds/custom/8000/');
- system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/sounds/music/8000/');
- system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/conf/ssl/');
- system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/conf/sip_profiles/');
- system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/conf/vars.xml');
- system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/conf/dialplan/default.xml');
- system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/conf/dialplan/public.xml');
-
- //Optional
- //system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/conf/');
- //system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/grammar/');
- //system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/htdocs/');
-
- unset($filename);
- }
-
-
- exec("rm -R /freeswitch");
- exec("cp /usr/local/freeswitch/conf/directory/default/brian.xml /usr/local/freeswitch/conf/directory/default/brian.xml.noload");
- unlink_if_exists("/usr/local/freeswitch/conf/directory/default/brian.xml");
- unlink_if_exists("/usr/local/freeswitch/conf/directory/default/example.com.xml");
- unlink_if_exists("/usr/local/freeswitch/conf/dialplan/default/99999_enum.xml");
-
- write_rcfile(array(
- "file" => "freeswitch.sh",
- "start" => "/usr/local/freeswitch/bin/./freeswitch -nc",
- "stop" => "/usr/local/freeswitch/bin/./freeswitch -stop"
- )
- );
-
- sync_package_freeswitch();
- $handle = popen("/usr/local/etc/rc.d/freeswitch.sh start", "r");
- pclose($handle);
-
- if (pkg_is_service_running('freeswitch')) {
- sync_package_freeswitch_ivr();
- }
-
- $config['installedpackages']['freeswitchsettings']['config'][0]['freeswitch_version'] = $freeswitch_build_version." revision ".$freeswitch_build_revision.".";
- $config['installedpackages']['freeswitchsettings']['config'][0]['freeswitch_package_version'] = $freeswitch_package_version;
-
- conf_mount_ro();
- config_unlock();
-
-}
-
-
-function freeswitch_deinstall_command()
-{
-
- conf_mount_rw();
- config_lock();
-
- exec("killall -9 freeswitch");
- unlink_if_exists("/usr/local/pkg/freeswitch.xml");
- unlink_if_exists("/usr/local/pkg/freeswitch.inc");
- unlink_if_exists("/usr/local/pkg/freeswitch_dialplan.xml");
- unlink_if_exists("/usr/local/pkg/freeswitch_extensions.xml");
- unlink_if_exists("/usr/local/pkg/freeswitch_external.xml");
- unlink_if_exists("/usr/local/pkg/freeswitch_internal.xml");
- unlink_if_exists("/usr/local/pkg/freeswitch_modules.xml");
- unlink_if_exists("/usr/local/pkg/freeswitch_public.xml");
- unlink_if_exists("/usr/local/pkg/freeswitch_vars.xml");
-
- unlink_if_exists("/usr/local/www/packages/freeswitch/class.smtp.php");
- unlink_if_exists("/usr/local/www/packages/freeswitch/class.phpmailer.php");
- unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_cmd.php");
- unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_dialplan_includes_details.php");
- unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_dialplan_includes_edit.php");
- unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_dialplan_includes.php");
- unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_dialplan_includes_details_edit.php");
- unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_extensions.php");
- unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_extensions_edit.php");
- unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_ivr.php");
- unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_ivr_edit.php");
- unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_ivr_options_edit.php");
- unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_ivr_options.php");
- unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_gateways.php");
- unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_gateways_edit.php");
- unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_mailto.php");
- unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_public_includes_details.php");
- unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_public_includes_edit.php");
- unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_public_includes.php");
- unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_public_includes_details_edit.php");
- unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_recordings.php");
- unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_recordings_edit.php");
- unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_recordings_play.php");
- unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_time_conditions.php");
- unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_time_conditions_edit.php");
- unlink_if_exists("/usr/local/www/packages/freeswitch/freeswitch_status.php");
- unlink_if_exists("/usr/local/www/packages/freeswitch/slim.swf");
-
- exec("rm -R /usr/local/freeswitch/");
- exec("rm -R /usr/local/www/packages/freeswitch/");
- unlink_if_exists("/usr/local/etc/rc.d/freeswitch.sh");
- unlink_if_exists("/tmp/freeswitch.tar.gz");
- unlink_if_exists("/tmp/pkg_mgr_FreeSWITCH.log");
-
- conf_mount_ro();
- config_unlock();
-
-}
-
-?>
diff --git a/config/freeswitch/freeswitch.xml b/config/freeswitch/freeswitch.xml
deleted file mode 100644
index dc5cfc36..00000000
--- a/config/freeswitch/freeswitch.xml
+++ /dev/null
@@ -1,267 +0,0 @@
-<?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$ */
-/* ========================================================================== */
-/*
- freeswitch.xml
- Copyright (C) 2008 Mark J Crane
- All rights reserved
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-*/
-/* ========================================================================== */
-/*
- 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>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow.</description>
- <requirements>Describe your package requirements here</requirements>
- <faq>Currently there are no FAQ items provided.</faq>
- <name>FreeSWITCH Settings</name>
- <version>0.9.5.8</version>
- <title>FreeSWITCH: Settings</title>
- <include_file>/usr/local/pkg/freeswitch.inc</include_file>
- <menu>
- <name>FreeSWITCH</name>
- <tooltiptext>Modify FreeSWITCH settings.</tooltiptext>
- <section>Services</section>
- <configfile>freeswitch.xml</configfile>
- <url>/pkg_edit.php?xml=freeswitch.xml&amp;id=0</url>
- </menu>
- <service>
- <name>freeswitch</name>
- <rcfile>freeswitch.sh</rcfile>
- <executable>freeswitch</executable>
- <description>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow. </description>
- </service>
- <tabs>
- <tab>
- <text>Settings</text>
- <url>/pkg_edit.php?xml=freeswitch.xml&amp;id=0</url>
- <active/>
- </tab>
- <tab>
- <text>Dialplan</text>
- <url>/packages/freeswitch/freeswitch_dialplan_includes.php</url>
- </tab>
- <tab>
- <text>Extensions</text>
- <url>/packages/freeswitch/freeswitch_extensions.php</url>
- </tab>
- <tab>
- <text>Features</text>
- <url>/packages/freeswitch/freeswitch_features.php</url>
- </tab>
- <tab>
- <text>Gateways</text>
- <url>/packages/freeswitch/freeswitch_gateways.php</url>
- </tab>
- <tab>
- <text>Profiles</text>
- <url>/packages/freeswitch/freeswitch_profiles.php</url>
- </tab>
- <tab>
- <text>Public</text>
- <url>/packages/freeswitch/freeswitch_public_includes.php</url>
- </tab>
- <tab>
- <text>Status</text>
- <url>/packages/freeswitch/freeswitch_status.php</url>
- </tab>
- <tab>
- <text>Vars</text>
- <url>/packages/freeswitch/freeswitch_vars.php</url>
- </tab>
- </tabs>
- <configpath>installedpackages->package->$packagename->configuration->freeswitchsettings</configpath>
- <additional_files_needed>
- <prefix>/tmp/</prefix>
- <chmod>0755</chmod>
- <item>http://portableusbapps.com/packages/config/freeswitch/freeswitch.tgz</item>
- </additional_files_needed>
- <additional_files_needed>
- <prefix>/usr/local/pkg/</prefix>
- <chmod>0755</chmod>
- <item>https://packages.pfsense.org/packages/config/freeswitch/freeswitch.inc</item>
- </additional_files_needed>
- <fields>
- <field>
- <fielddescr>Numbering Plan</fielddescr>
- <fieldname>numbering_plan</fieldname>
- <description>Enter the numbering plan here. example: US</description>
- <type>input</type>
- </field>
- <field>
- <fielddescr>Default Gateway</fielddescr>
- <fieldname>default_gateway</fieldname>
- <description>Enter the default gateway name here.</description>
- <type>input</type>
- </field>
- <field>
- <fielddescr>Default Area Code</fielddescr>
- <fieldname>default_area_code</fieldname>
- <description>Enter the area code here. example: 918</description>
- <type>input</type>
- </field>
- <field>
- <fielddescr>Event Socket Port</fielddescr>
- <fieldname>event_socket_port</fieldname>
- <description>Enter the event socket port here. default: 8021</description>
- <type>input</type>
- </field>
- <field>
- <fielddescr>Event Socket Password</fielddescr>
- <fieldname>event_socket_password</fieldname>
- <description>Enter the event socket password here. default: ClueCon</description>
- <type>password</type>
- </field>
- <field>
- <fielddescr>XML RPC HTTP Port</fielddescr>
- <fieldname>xml_rpc_http_port</fieldname>
- <description>Enter the XML RPC HTTP Port here. default: 8787</description>
- <type>input</type>
- </field>
- <field>
- <fielddescr>XML RPC Auth Realm</fielddescr>
- <fieldname>xml_rpc_auth_realm</fieldname>
- <description>Enter the XML RPC Auth Realm here. default: freeswitch</description>
- <type>input</type>
- </field>
- <field>
- <fielddescr>XML RPC Auth User</fielddescr>
- <fieldname>xml_rpc_auth_user</fieldname>
- <description>Enter the XML RPC Auth User here. default: freeswitch</description>
- <type>input</type>
- </field>
- <field>
- <fielddescr>XML RPC Auth Password</fielddescr>
- <fieldname>xml_rpc_auth_pass</fieldname>
- <description>Enter the XML RPC Auth Password here. default: works</description>
- <type>password</type>
- </field>
- <field>
- <fielddescr>Admin PIN Number</fielddescr>
- <fieldname>admin_pin</fieldname>
- <description>Enter a admin pin number. Used to authenticate the admin from the phone.</description>
- <type>password</type>
- </field>
- <field>
- <fielddescr>SMTP Host</fielddescr>
- <fieldname>smtphost</fieldname>
- <description>Enter the SMTP host address. If you using a different port append it on the end with a colon. e.g. smtp.gmail.com:465</description>
- <type>input</type>
- </field>
- <field>
- <fielddescr>SMTP Secure</fielddescr>
- <fieldname>smtpsecure</fieldname>
- <description>Select the SMTP security. None, TLS, SSL</description>
- <type>select</type>
- <options>
- <option>
- <name>none</name>
- <value></value>
- </option>
- <option>
- <name>tls</name>
- <value>tls</value>
- </option>
- <option>
- <name>ssl</name>
- <value>ssl</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>SMTP Auth</fielddescr>
- <fieldname>smtpauth</fieldname>
- <description>Use SMTP Authentication true or false.</description>
- <type>select</type>
- <options>
- <option>
- <name>true</name>
- <value>true</value>
- </option>
- <option>
- <name>false</name>
- <value>false</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>SMTP Username</fielddescr>
- <fieldname>smtpusername</fieldname>
- <description>Enter the SMTP authentication username.</description>
- <type>input</type>
- </field>
- <field>
- <fielddescr>SMTP Password</fielddescr>
- <fieldname>smtppassword</fieldname>
- <description>Enter the SMTP authentication password.</description>
- <type>password</type>
- </field>
- <field>
- <fielddescr>SMTP From</fielddescr>
- <fieldname>smtpfrom</fieldname>
- <description>Enter the SMTP From email address.</description>
- <type>input</type>
- </field>
- <field>
- <fielddescr>SMTP From Name</fielddescr>
- <fieldname>smtpfromname</fieldname>
- <description>Enter the SMTP From Name.</description>
- <type>input</type>
- </field>
- <field>
- <fielddescr>Mod Shout Decoder</fielddescr>
- <fieldname>mod_shout_decoder</fieldname>
- <description>Enter the Decoder. default: i386</description>
- <type>input</type>
- </field>
- <field>
- <fielddescr>Mod Shout Volume</fielddescr>
- <fieldname>mod_shout_volume</fieldname>
- <description>Enter the Volume. default: 0.3</description>
- <type>input</type>
- </field>
- </fields>
- <custom_add_php_command>
- </custom_add_php_command>
- <custom_php_resync_config_command>
- sync_package_freeswitch_settings();
- </custom_php_resync_config_command>
- <custom_delete_php_command>
- sync_package_freeswitch_settings();
- </custom_delete_php_command>
- <custom_php_install_command>
- freeswitch_php_install_command();
- </custom_php_install_command>
- <custom_php_deinstall_command>
- freeswitch_deinstall_command();
- </custom_php_deinstall_command>
-</packagegui>
diff --git a/config/freeswitch/freeswitch_cmd.tmp b/config/freeswitch/freeswitch_cmd.tmp
deleted file mode 100644
index 21dba508..00000000
--- a/config/freeswitch/freeswitch_cmd.tmp
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-/* $Id$ */
-/*
- freeswitch_cmd.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
-
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/freeswitch.inc");
-$cmd = $_GET['cmd'];
-
-
-$password = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password'];
-$port = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port'];
-$host = '';
-
-$fp = event_socket_create($host, $port, $password);
-$response = event_socket_request($fp, $cmd);
-fclose($fp);
-
-header("Location: /packages/freeswitch/freeswitch_status.php?savemsg=".urlencode($response));
-
-?> \ No newline at end of file
diff --git a/config/freeswitch/freeswitch_dialplan.tmp b/config/freeswitch/freeswitch_dialplan.tmp
deleted file mode 100644
index fcfb3192..00000000
--- a/config/freeswitch/freeswitch_dialplan.tmp
+++ /dev/null
@@ -1,163 +0,0 @@
-<?php
-/* $Id$ */
-/*
- freeswitch_dialplan.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/freeswitch.inc");
-
-//$a_extensions = &$config['installedpackages']['freeswitchprofiles']['config'];
-
-if ($_GET['a'] == "default") {
- conf_mount_rw();
- exec("cp /usr/local/freeswitch/conf.orig/dialplan/default.xml /usr/local/freeswitch/conf/dialplan/default.xml");
- $savemsg = "Default Restored";
- conf_mount_ro();
-}
-
-if ($_POST['a'] == "save") {
- conf_mount_rw();
- $content = ereg_replace("\r","",$_POST['code']);
- $fd = fopen("/usr/local/freeswitch/conf/dialplan/default.xml", "w");
- fwrite($fd, $content);
- fclose($fd);
- $savemsg = "Saved";
- conf_mount_ro();
-}
-
-
-$fd = fopen("/usr/local/freeswitch/conf/dialplan/default.xml", "r");
-$content = fread($fd, filesize("/usr/local/freeswitch/conf/dialplan/default.xml"));
-fclose($fd);
-
-include("head.inc");
-
-?>
-
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-
-<script language="Javascript">
-function sf() { document.forms[0].savetopath.focus(); }
-</script>
-<script language="Javascript" type="text/javascript" src="/edit_area/edit_area_full.js"></script>
-<script language="Javascript" type="text/javascript">
- // initialisation
- editAreaLoader.init({
- id: "code" // id of the textarea to transform
- ,start_highlight: false
- ,allow_toggle: false
- ,language: "en"
- ,syntax: "html"
- ,toolbar: "search, go_to_line,|, fullscreen, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help"
- ,syntax_selection_allow: "css,html,js,php,xml,c,cpp,sql"
- ,show_line_colors: true
- });
-</script>
-
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">FreeSWITCH: Dialplan</p>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-display_top_tabs(build_menu());
-
-?>
-</td></tr>
-</table>
-
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
-<form action="freeswitch_dialplan.php" method="post" name="iform" id="iform">
-<?php
-
-?>
- <table width="98%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width='90%'><p><span class="vexpl"><span class="red"><strong>Default Dialplan<br>
- </strong></span>
- The default dialplan is used to setup call destinations based on conditions and context.
- You can use the dialplan to send calls to gateways, IVRs, external numbers, to scripts, or any destination.
- </p>
- </td>
- <td width='10%' align='right' valign='middle'><input type="submit" value="save" /></td>
- </tr>
- </table>
- <br />
- <br />
-
- <textarea style="width:98%" id="code" name="code" rows="30" cols="<?php echo $cols; ?>" name="content"><?php echo htmlentities($content); ?></textarea>
- <br />
- <br />
-
- <table width="98%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td>/usr/local/freeswitch/conf/dialplan/default.xml</td>
- <td align='right'>
- <input type="hidden" name="f" value="<?php echo $_GET['f']; ?>" />
- <input type="hidden" name="a" value="save" />
- <?php
- echo "<input type='button' value='Restore Default' onclick=\"document.location.href='/packages/freeswitch/freeswitch_dialplan.php?a=default&f=default.xml';\" />";
- ?>
- </td>
- </tr>
- </table>
-
-</form>
-
-<br>
-<br>
-
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-
-</td>
-</tr>
-</table>
-
-</div>
-
-
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch/freeswitch_dialplan_includes.tmp b/config/freeswitch/freeswitch_dialplan_includes.tmp
deleted file mode 100644
index 55379ea5..00000000
--- a/config/freeswitch/freeswitch_dialplan_includes.tmp
+++ /dev/null
@@ -1,278 +0,0 @@
-<?php
-/* $Id$ */
-/*
- freeswitch_dialplan_includes.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/freeswitch.inc");
-
-
-//freeswitchdialplanincludes
- //dialplanincludeid
- //extensionname
- //context
- //default
- //enabled
- //descr
-
-//freeswitchdialplanincludedetails
-
- //dialplanincludeid
- //tag
- //condition
- //action
- //antiaction
- //param
- //tagorder
- //1-20
- //fieldtype
-
- //fielddata
-
-
-$a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config'];
-$a_dialplan_includes_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config'];
-
-
-if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'dialplanincludes') {
-
- if ($a_dialplan_includes[$_GET['id']]) {
-
- $dialplanincludeid = $a_dialplan_includes[$_GET['id']][dialplanincludeid];
-
- $extensionname = $a_dialplan_includes[$_GET['id']][extensionname];
- $order = $a_dialplan_includes[$_GET['id']][order];
- $dialplanincludefilename = $order."_".$extensionname.".xml";
-
- //delete the dialplan include details. aka. child data
- if (count($a_dialplan_includes_details) > 0) {
- $i=0;
- foreach($a_dialplan_includes_details as $row) {
- if ($row["dialplanincludeid"] == $dialplanincludeid) {
- //echo "child id: ".$i."<br />\n";
- unset($a_dialplan_includes_details[$i]);
- }
- $i++;
- }
- }
-
- //if the dialplan include xml file exists then delete it
- if (file_exists("/usr/local/freeswitch/conf/dialplan/default/".$dialplanincludefilename)) {
- unlink("/usr/local/freeswitch/conf/dialplan/default/".$dialplanincludefilename);
- }
-
- unset($dialplanincludefilename);
- unset($a_dialplan_includes[$_GET['id']]);
- write_config();
- sync_package_freeswitch_dialplan_includes();
- header("Location: freeswitch_dialplan_includes.php");
- exit;
- }
- }
-}
-
-include("head.inc");
-
-?>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">FreeSWITCH: Dialplan</p>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-display_top_tabs(build_menu());
-
-?>
-</td></tr>
-</table>
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
-<form action="freeswitch_dialplan_includes.php" method="post" name="iform" id="iform">
-<?php
-
-
-//echo "<pre>";
-//print_r ($a_dialplan_includes);
-//echo "</pre>";
-
-
-//if ($config_change == 1) {
-// write_config();
-// $config_change = 0;
-//}
-
-//if ($savemsg) print_info_box($savemsg);
-//if (file_exists($d_hostsdirty_path)): echo"<p>";
-//print_info_box_np("This has been changed.<br>You must apply the changes in order for them to take effect.");
-//echo"<br />";
-//endif;
-
-?>
-
- <br />
- <br />
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td><span class="vexpl"><span class="red"><strong>Dialplan
- </strong></span></span>
- </td>
- <td align='right'>
- <input type='button' value='default.xml' onclick="document.location.href='/packages/freeswitch/freeswitch_dialplan.php';">
- </td>
- </tr>
- <tr>
- <td colspan='2'>
- <span class="vexpl">
- The dialplan is used to setup call destinations based on conditions and context. You can use the dialplan to send calls to gateways, IVRs, external numbers, to scripts, or any destination.
- </span>
- </td>
-
- </tr>
- </table>
-
- <br />
- <br />
- <br />
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="20%" class="listhdrr">Extension Name</td>
- <td width="25%" class="listhdrr">Order</td>
- <td width="25%" class="listhdrr">Enabled</td>
- <td width="50%" class="listhdr">Description</td>
- <td width="10%" class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="freeswitch_dialplan_includes_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
-
- <?php
- //create a temporary id for the array
- $i = 0;
- if (count($a_dialplan_includes) > 0) {
- foreach ($a_dialplan_includes as $ent) {
- $a_dialplan_includes[$i]['id'] = $i;
- $i++;
- }
- }
-
- //order the array
- function cmp_number($a, $b) {
- if ($a["order"] > $b["order"]) {
- return 1;
- }
- else {
- return 0;
- }
- }
- if (count($a_public_includes) > 0) { usort($a_dialplan_includes, "cmp_number"); }
-
- $i = 0;
- if (count($a_dialplan_includes) > 0) {
- foreach ($a_dialplan_includes as $ent) {
- ?>
- <tr>
- <td class="listlr" ondblclick="document.location='freeswitch_dialplan_includes_edit.php?id=<?=$ent['id'];?>'">
- <?=$ent['extensionname']?>
- </td>
- <td class="listlr" ondblclick="document.location='freeswitch_dialplan_includes_edit.php?id=<?=$ent['id'];?>'">
- <?=$ent['order']?>
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_edit.php?id=<?=$ent['id'];?>';">
- <?=$ent['enabled'];?>&nbsp;
- </td>
- <td class="listbg" ondblclick="document.location='freeswitch_dialplan_includes_edit.php?id=<?=$ent['id'];?>';">
- <font color="#FFFFFF"><?=htmlspecialchars($ent['descr']);?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="freeswitch_dialplan_includes_edit.php?id=<?=$ent['id'];?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="freeswitch_dialplan_includes.php?type=dialplanincludes&act=del&id=<?=$ent['id'];?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
- $i++;
- }
- }
- ?>
- <tr>
- <td class="list" colspan="4"></td>
- <td class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="freeswitch_dialplan_includes_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
-
- <tr>
- <td class="list" colspan="4"></td>
- <td class="list"></td>
- </tr>
- </table>
-
-</form>
-
-/usr/local/freeswitch/conf/dialplan/default/
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-
-</td>
-</tr>
-</table>
-
-</div>
-
-
-<?php include("fend.inc"); ?>
-</body>
-</html> \ No newline at end of file
diff --git a/config/freeswitch/freeswitch_dialplan_includes_details.tmp b/config/freeswitch/freeswitch_dialplan_includes_details.tmp
deleted file mode 100755
index 1504d590..00000000
--- a/config/freeswitch/freeswitch_dialplan_includes_details.tmp
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-/* $Id$ */
-/*
- freeswitch_dialplan_includes_details.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/freeswitch.inc");
-
-
-$a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config'];
-
-
-if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'dialplanincludedetails') {
- if ($a_dialplan_include_details[$_GET['id']]) {
- unset($a_dialplan_include_details[$_GET['id']]);
- write_config();
- sync_package_freeswitch_dialplan_includes();
- //touch($d_hostsdirty_path);
- header("Location: freeswitch_dialplan_includes_edit.php?id=".$_GET['parentid']);
- exit;
- }
- }
-}
-
-?> \ No newline at end of file
diff --git a/config/freeswitch/freeswitch_dialplan_includes_details_edit.tmp b/config/freeswitch/freeswitch_dialplan_includes_details_edit.tmp
deleted file mode 100644
index f3cbf71d..00000000
--- a/config/freeswitch/freeswitch_dialplan_includes_details_edit.tmp
+++ /dev/null
@@ -1,389 +0,0 @@
-<?php
-/* $Id$ */
-/*
-
- freeswitch_dialplan_includes_details_edit.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/freeswitch.inc");
-
-
-$a_dialplan_includes_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config'];
-
-$id = $_GET['id'];
-if (isset($_POST['id'])) {
- $id = $_POST['id'];
-}
-
-$parentid = $_GET['parentid'];
-if (isset($_POST['parentid'])) {
- $parentid = $_POST['parentid'];
-}
-
-$dialplanincludeid = $_GET['dialplanincludeid'];
-if (isset($_POST['dialplanincludeid'])) {
- $dialplanincludeid = $_POST['dialplanincludeid'];
-}
-
-
- //dialplanincludeid
- //tag
- //condition
- //action
- //antiaction
- //param
- //fieldorder
- //1-20
- //fieldtype
-
- //fielddata
-
-
-if (isset($id) && $a_dialplan_includes_details[$id]) {
- $pconfig['dialplanincludeid'] = $a_dialplan_includes_details[$id]['dialplanincludeid'];
- $pconfig['tag'] = $a_dialplan_includes_details[$id]['tag'];
- $pconfig['fieldorder'] = $a_dialplan_includes_details[$id]['fieldorder'];
- $pconfig['fieldtype'] = $a_dialplan_includes_details[$id]['fieldtype'];
- $pconfig['fielddata'] = $a_dialplan_includes_details[$id]['fielddata'];
-}
-//else {
-// if (isset($_GET['a'])) {
-// if ($_GET['a'] == "action"){ $pconfig['optionaction'] = "action"; }
-// if ($_GET['a'] == "antiaction"){ $pconfig['optionaction'] = "anti-action"; }
-// }
-//}
-
-
-
-if ($_POST) {
-
- unset($input_errors);
- $pconfig = $_POST;
-
-
- if (!$input_errors) {
-
- $ent = array();
- $ent['dialplanincludeid'] = $_POST['dialplanincludeid'];
- $ent['tag'] = $_POST['tag'];
- $ent['fieldorder'] = $_POST['fieldorder'];
- $ent['fieldtype'] = $_POST['fieldtype'];
- $ent['fielddata'] = $_POST['fielddata'];
-
-
- if (isset($id) && $a_dialplan_includes_details[$id]) {
- //update
- $a_dialplan_includes_details[$id] = $ent;
- }
- else {
- //add
- $a_dialplan_includes_details[] = $ent;
- }
-
- write_config();
- sync_package_freeswitch_dialplan_includes();
-
- header("Location: freeswitch_dialplan_includes_edit.php?id=".$parentid);
- exit;
- }
-}
-
-include("head.inc");
-
-?>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">FreeSWITCH: Dialplan: Details: Edit</p>
-
-<?php if ($input_errors) print_input_errors($input_errors); ?>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-display_top_tabs(build_menu());
-
-?>
-</td></tr>
-</table>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
- <br />
- <form action="freeswitch_dialplan_includes_details_edit.php" method="post" name="iform" id="iform">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="22%" valign="top" class="vncellreq">Tag</td>
- <td width="78%" class="vtable">
- <script type="text/javascript">
- function dialplan_include_details_tag_onchange() {
- var tag = document.getElementById("form_tag").value;
- if (tag == "condition") {
- document.getElementById("label_fieldtype").innerHTML = "Field";
- document.getElementById("label_fielddata").innerHTML = "Expression";
- }
- else if (tag == "action") {
- document.getElementById("label_fieldtype").innerHTML = "Application";
- document.getElementById("label_fielddata").innerHTML = "Data";
- }
- else if (tag == "anti-action") {
- document.getElementById("label_fieldtype").innerHTML = "Application";
- document.getElementById("label_fielddata").innerHTML = "Data";
- }
- else if (tag == "param") {
- document.getElementById("label_fieldtype").innerHTML = "Name";
- document.getElementById("label_fielddata").innerHTML = "Value";
- }
- if (tag == "") {
- document.getElementById("label_fieldtype").innerHTML = "Type";
- document.getElementById("label_fielddata").innerHTML = "Data";
- }
- }
- </script>
- <?php
- echo " <select name='tag' class='formfld' id='form_tag' onchange='dialplan_include_details_tag_onchange();'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['tag'])) {
- case "condition":
- echo " <option selected='yes'>condition</option>\n";
- echo " <option>action</option>\n";
- echo " <option>anti-action</option>\n";
- //echo " <option>param</option>\n";
- break;
- case "action":
- echo " <option>condition</option>\n";
- echo " <option selected='yes'>action</option>\n";
- echo " <option>anti-action</option>\n";
- //echo " <option>param</option>\n";
- break;
- case "anti-action":
- echo " <option>condition</option>\n";
- echo " <option>action</option>\n";
- echo " <option selected='yes'>anti-action</option>\n";
- //echo " <option>param</option>\n";
- break;
- case "param":
- echo " <option>condition</option>\n";
- echo " <option>action</option>\n";
- echo " <option>anti-action</option>\n";
- //echo " <option selected='yes'>param</option>\n";
- break;
- default:
- echo " <option>condition</option>\n";
- echo " <option>action</option>\n";
- echo " <option>anti-action</option>\n";
- //echo " <option>param</option>\n";
- }
- echo " </select>\n";
-
- //condition
- //field expression
- //action
- //application
- //data
- //antiaction
- //application
- //data
- //param
- //name
- //value
-
- ?>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq" id="label_fieldtype">Type</td>
- <td width="78%" class="vtable">
- <input name="fieldtype" type="text" class="formfld" id="fieldtype" size="40" value="<?=htmlspecialchars($pconfig['fieldtype']);?>">
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq" id="label_fielddata">Data</td>
- <td width="78%" class="vtable">
- <input name="fielddata" type="text" class="formfld" id="fielddata" size="40" value="<?=htmlspecialchars($pconfig['fielddata']);?>">
- <br> <span class="vexpl"></span></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq" id="label_fieldtype">Order</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='fieldorder' class='formfld'>\n";
- //echo " <option></option>\n";
- if (strlen(htmlspecialchars($pconfig['fieldorder']))> 0) {
- echo " <option selected='yes' value='".htmlspecialchars($pconfig['fieldorder'])."'>".htmlspecialchars($pconfig['fieldorder'])."</option>\n";
- }
- $i=0;
- while($i<=999) {
- if (strlen($i) == 1) {
- echo " <option value='00$i'>00$i</option>\n";
- }
- if (strlen($i) == 2) {
- echo " <option value='0$i'>0$i</option>\n";
- }
- if (strlen($i) == 3) {
- echo " <option value='$i'>$i</option>\n";
- }
-
- $i++;
- }
- echo " </select>\n";
- ?>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="dialplanincludeid" type="hidden" value="<?=$dialplanincludeid;?>">
- <input name="parentid" type="hidden" value="<?=$parentid;?>">
- <?php if (isset($id) && $a_dialplan_includes_details[$id]): ?>
- <input name="id" type="hidden" value="<?=$id;?>">
- <?php endif; ?>
- <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()">
- </td>
- </tr>
- </table>
- </form>
-
- <br />
- <br />
- <b>Additional Information</b>
- <br />
- <br />
- <a href='http://wiki.freeswitch.org/wiki/Dialplan_XML' target='_blank'>http://wiki.freeswitch.org/wiki/Dialplan_XML</a>
-
- <br />
- <br />
- <br />
- <br />
-
- <b>Conditions</b>
- <br />
- <br />
- Conditions are pattern matching tags that help FreeSwitch decide if the current call should be processed in this extension or not. When matching conditions against the current call you have several <b>fields</b> that you can compare against.
- <ul>
- <li><b>context</b></li>
- <li><b>rdnis</b> Redirected Number, the directory number to which the call was last presented.</li>
- <li><b>destination_number</b> Called Number, the number this call is trying to reach (within a given context)</li>
- <li><b>dialplan</b> Name of the dialplan module that are used, the name is provided by each dialplan module. Example: XML</li>
- <li><b>caller_id_name</b> Name of the caller (provided by the User Agent that has called us).</li>
- <li><b>caller_id_number</b> Directory Number of the party who called (callee) -- can be masked (hidden)</li>
- <li><b>ani</b> Automatic Number Identification, the number of the calling party (callee) -- cannot be masked</li>
- <li><b>ani2</b> The type of device placing the call [1]</li>
- <li><b>uuid</b> Unique identifier of the current call? (looks like a GUID)</li>
- <li><b>source</b> Name of the FreeSwitch module that received the call (e.g. PortAudio)</li>
- <li><b>chan_name</b> Name of the current channel (Example: PortAudio/1234). Give us examples when this one can be used.</li>
- <li><b>network_addr</b> IP address of the signalling source for a VoIP call.</li>
- </ul>
- In addition to the above you can also do variables using the syntax ${variable} or api functions using the syntax %{api} {args}
- <br />
- <br />
- Variables may be used in either the field or the expression, as follows
-
- <br />
- <br />
- <br />
- <br />
-
- <b>Action and Anti-Actions</b>
- <br />
- <br />
- Actions are executed when the <b>condition matches</b>. Anti-Actions are executed when the <b>condition does NOT match</b>.
- Additional information on applications for Actions and Anti-Actions.<br />
- <a href='http://wiki.freeswitch.org/wiki/Modules#Applications' target='_blank'>http://wiki.freeswitch.org/wiki/Modules#Applications</a>
- <br />
- <a href='http://wiki.freeswitch.org/wiki/Dialplan_Functions' target='_blank'>http://wiki.freeswitch.org/wiki/Dialplan_Functions</a>
- <br />
- <br />
- <br />
- The following is a partial list of <b>applications</b>.
- <ul>
- <li><b>answer</b> answer the call</li>
- <li><b>bridge</b> bridge the call<li>
- <li><b>cond</b></li>
- <li><b>db</b> is a a runtime database either sqlite by default or odbc</li>
- <li><b>global_set</b> allows setting of global vars similar to the ones found in vars.xml</li>
- <li><b>group</b> allows grouping of several extensions for things like ring groups</li>
- <li><b>expr</b></li>
- <li><b>hangup</b> hangs up the call</li>
- <li><b>info</b> sends call info to the console</li>
- <li><b>javascript</b> run javascript .js files</li>
- <li><b>playback</b></li>
- <li><b>reject</b> reject the call</li>
- <li><b>respond</b></li>
- <li><b>ring_ready</b></li>
- <li><b>set</b> set a variable</li>
- <li><b>set_user</b></li>
- <li><b>sleep</b></li>
- <li><b>sofia_contact</b></li>
- <li><b>transfer</b> transfer the call to another extension or number<li>
- <li><b>voicemail</b> send the call to voicemail</li>
- </ul>
-
-
- <br />
- <br />
-
- <!--
- <b>Param</b>
- Example parameters by name and value
- <br />
- <a href='http://wiki.freeswitch.org/wiki/Special:Search?search=param&go=Go' target='_blank'>http://wiki.freeswitch.org/wiki/Special:Search?search=param&go=Go</a>
- <ul>
- <li><b>codec-ms</b> 20</li>
- <li><b>codec-prefs</b> PCMU@20i</li>
- <li><b>debug</b> 1</li>
- <li><b>dialplan</b> XML</li>
- <li><b>dtmf-duration</b> 100</li>
- <li><b>rfc2833-pt</b>" 101</li>
- <li><b>sip-port</b> 5060</li>
- <li><b>use-rtp-timer</b> true</li>
- </ul>
- <br />
- <br />
- -->
-
-
- <br />
- <br />
- <br />
- <br />
- <br />
-
- </td>
- </tr>
-</table>
-
-</div>
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch/freeswitch_dialplan_includes_edit.tmp b/config/freeswitch/freeswitch_dialplan_includes_edit.tmp
deleted file mode 100644
index a6118042..00000000
--- a/config/freeswitch/freeswitch_dialplan_includes_edit.tmp
+++ /dev/null
@@ -1,543 +0,0 @@
-<?php
-/* $Id$ */
-/*
- freeswitch_dialplan_includes_edit.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/freeswitch.inc");
-
-
-//freeswitchdialplanincludes
- //dialplanincludeid
- //extensionname
- //context
- //default
- //enabled
- //descr
-
-//
-
-
-
-$a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config'];
-$a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config'];
-
-$id = $_GET['id'];
-if (isset($_POST['id'])) {
- $id = $_POST['id'];
-}
-$parentid = $id;
-
-
-if (isset($id) && $a_dialplan_includes[$id]) {
- $pconfig['dialplanincludeid'] = $a_dialplan_includes[$id]['dialplanincludeid'];
- $dialplanincludeid = $a_dialplan_includes[$id]['dialplanincludeid'];
- $pconfig['extensionname'] = $a_dialplan_includes[$id]['extensionname'];
- $pconfig['order'] = $a_dialplan_includes[$id]['order'];
- $pconfig['context'] = $a_dialplan_includes[$id]['context'];
- $pconfig['enabled'] = $a_dialplan_includes[$id]['enabled'];
- $pconfig['descr'] = $a_dialplan_includes[$id]['descr'];
- $pconfig['opt1name'] = $a_dialplan_includes[$id]['opt1name'];
- $pconfig['opt1value'] = $a_dialplan_includes[$id]['opt1value'];
-}
-
-if ($_POST) {
-
- unset($input_errors);
- $pconfig = $_POST;
-
- if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'dialplanincludedetails') {
- if ($a_dialplan_include_details[$_GET['id']]) {
- unset($a_dialplan_include_details[$_GET['id']]);
- write_config();
- sync_package_freeswitch_dialplan_includes();
- header("Location: freeswitch_dialplan_include_edit.php?id=".$_GET['id']);
- exit;
- }
- }
- }
-
-
- if (!$input_errors) {
-
- $ent = array();
- if (strlen($_POST['dialplanincludeid']) > 0) {
- //update
- $ent['dialplanincludeid'] = $_POST['dialplanincludeid'];
- }
- else {
- //add
- $ent['dialplanincludeid'] = guid();
- }
- $ent['extensionname'] = $_POST['extensionname'];
- $ent['order'] = $_POST['order'];
- //$ent['context'] = $_POST['context'];
- $ent['context'] = 'default';
- $ent['enabled'] = $_POST['enabled'];
- $ent['descr'] = $_POST['descr'];
- $ent['opt1name'] = $_POST['opt1name'];
- $ent['opt1value'] = $_POST['opt1value'];
-
-
- if (isset($id) && $a_dialplan_includes[$id]) {
-
- if (count($a_dialplan_includes)>0) {
- foreach($a_dialplan_includes as $rowhelper) {
-
- //$rowhelper['dialplanincludeid'];
- //$rowhelper['extensionname'];
- //$rowhelper['context'];
- //$rowhelper['enabled'];
-
- $filenamechanged = false;
- if ($rowhelper['dialplanincludeid'] == $_POST['dialplanincludeid']) {
-
- if ($rowhelper['extensionname'] != $_POST['extensionname']) {
- //if the extension name has changed then remove the current dialplan xml file
- //to prepare for the new file
- $filenamechanged = true;
- }
- if ($rowhelper['order'] != $_POST['order']) {
- //if the order has changed then remove the current dialplan xml file
- //to prepare for the new file
- $filenamechanged = true;
- }
- if ($_POST['enabled'] == "false") {
- //if the extension name is disabled then remove the dialplan xml file
- $filenamechanged = true;
- }
- if ($filenamechanged){
- $dialplanincludefilename = $rowhelper['order']."_".$rowhelper['extensionname'].".xml";
- if (file_exists("/usr/local/freeswitch/conf/dialplan/default/".$dialplanincludefilename)) {
- unlink("/usr/local/freeswitch/conf/dialplan/default/".$dialplanincludefilename);
- }
- unset($dialplanincludefilename);
- }
-
- }
- unset($filenamechanged);
-
- } //end foreach
- } //end count
-
- //update the config
- $a_dialplan_includes[$id] = $ent;
- }
- else {
- //add to the config
- $a_dialplan_includes[] = $ent;
- }
-
-
- write_config();
- sync_package_freeswitch_dialplan_includes();
-
- header("Location: freeswitch_dialplan_includes.php");
- exit;
- }
-}
-
-include("head.inc");
-
-?>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">FreeSWITCH: Dialplan: Edit</p>
-
-<?php if ($input_errors) print_input_errors($input_errors); ?>
-
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-display_top_tabs(build_menu());
-
-?>
-</td></tr>
-</table>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Dialplan:<br>
- </strong></span>
- Dialplan Include general settings.
- </span></p></td>
- </tr>
- </table>
- <br />
-
- <form action="freeswitch_dialplan_includes_edit.php" method="post" name="iform" id="iform">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="22%" valign="top" class="vncellreq">Extension Name</td>
- <td width="78%" class="vtable">
- <input name="extensionname" type="text" class="formfld" id="extensionname" size="40" value="<?=htmlspecialchars($pconfig['extensionname']);?>">
- <br />
- Supported characters are 'a-z', 'A-Z', '0-9', underscore '_', and period '.'.
- </td>
- </tr>
- <!--
- <tr>
- <td width="22%" valign="top" class="vncellreq">Context</td>
- <td width="78%" class="vtable">
- <input name="context" type="text" class="formfld" id="context" size="40" value="<?=htmlspecialchars($pconfig['context']);?>">
- <br />
- e.g. default
- </td>
- </tr>
- -->
-
- <tr>
- <td width="22%" valign="top" class="vncellreq">Enabled</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='enabled' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['enabled'])) {
- case "true":
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- break;
- case "false":
- echo " <option value='true'>true</option>\n";
- echo " <option value='false' selected='yes'>false</option>\n";
-
- break;
- default:
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- }
- echo " </select>\n";
- ?>
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncellreq">Order</td>
- <td width="78%" class="vtable">
- <?php
-
- echo " <select name='order' class='formfld'>\n";
- //echo " <option></option>\n";
- if (strlen(htmlspecialchars($pconfig['order']))> 0) {
- echo " <option selected='yes' value='".htmlspecialchars($pconfig['order'])."'>".htmlspecialchars($pconfig['order'])."</option>\n";
- }
- $i=0;
- while($i<=999) {
- if (strlen($i) == 1) {
- echo " <option value='00$i'>00$i</option>\n";
- }
- if (strlen($i) == 2) {
- echo " <option value='0$i'>0$i</option>\n";
- }
- if (strlen($i) == 3) {
- echo " <option value='$i'>$i</option>\n";
- }
-
- $i++;
- }
- echo " </select>\n";
- ?>
- <br />
- Processing of each dialplan include is determined by this order.
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncell">Description</td>
- <td width="78%" class="vtable">
- <input name="descr" type="text" class="formfld" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>">
- <br> <span class="vexpl">You may enter a description here
- for your reference (not parsed).</span></td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="dialplanincludeid" type="hidden" value="<?=htmlspecialchars($pconfig['dialplanincludeid']);?>">
- <?php
- if (strlen($id) > 0 && $a_dialplan_includes[$id]) {
- echo "\n";
- echo " <input name=\"id\" type=\"hidden\" value=\"$id\">\n";
- echo " <input name=\"opt1name\" type=\"hidden\" value=\"".htmlspecialchars($pconfig['opt1name'])."\">\n";
- echo " <input name=\"opt1value\" type=\"hidden\" value=\"".htmlspecialchars($pconfig['opt1value'])."\">\n";
- }
- ?>
- <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()">
- </td>
- </tr>
- </table>
- </form>
-
- <br>
- <br>
-
- <form action="freeswitch_dialplan_includes_edit.php" method="post" name="iform2" id="iform2">
- <?php
-
- //echo "<pre>";
- //print_r ($a_dialplan_includes);
- //echo "</pre>";
-
- //if ($savemsg) print_info_box($savemsg);
- //if (file_exists($d_hostsdirty_path)): echo"<p>";
- //print_info_box_np("The FreeSWITCH recordings have been changed.<br>You must apply the changes in order for them to take effect.");
- //echo"<br />";
- //endif;
-
- //create a temporary id for the array
- $i = 0;
- if (count($a_dialplan_include_details) > 0) {
- foreach ($a_dialplan_include_details as $ent) {
- $a_dialplan_include_details[$i]['id'] = $i;
- $i++;
- }
- }
-
- //order the array
- function cmp_number($a, $b) {
- if ($a["fieldorder"] > $b["fieldorder"]) {
- return 1;
- }
- else {
- return 0;
- }
- }
- if (count($a_dialplan_include_details) > 0) { usort($a_dialplan_include_details, "cmp_number"); }
-
- ?>
-
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Conditions and Actions<br />
- </strong></span>
- The following conditions, actions and anti-actions are used in the dialplan to direct call flow. Each is processed in order until you reach the action tag which tells FreeSWITCH what action to perform. You are not limited to only one condition or action tag for a given extension.
- </span></p></td>
- </tr>
- </table>
- <br />
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="40" class="listhdrr">Tag</td>
- <td width="40" class="listhdrr">Type</td>
- <td width="50%" class="listhdrr">Data</td>
- <td width="40" class="listhdrr">Order</td>
- <td width="40" class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="freeswitch_dialplan_includes_details_edit.php?parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>&a=action"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
-
- <?php
-
- $i = 0;
- if (count($a_dialplan_include_details) > 0) {
-
- foreach ($a_dialplan_include_details as $ent) {
- if ($ent['tag'] == "condition" && $dialplanincludeid == $ent['dialplanincludeid']) {
- ?>
- <tr>
- <td class="listlr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>'">
- <?=$ent['tag']?>
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';">
- <?=$ent['fieldtype'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';">
- <?=$ent['fielddata'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';">
- <?=$ent['fieldorder'];?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="freeswitch_dialplan_includes_details.php?type=dialplanincludedetails&act=del&id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
- }
- $i++;
- }
- }
-
- $i = 0;
- if (count($a_dialplan_include_details) > 0) {
-
- foreach ($a_dialplan_include_details as $ent) {
- if ($ent['tag'] == "action" && $dialplanincludeid == $ent['dialplanincludeid']) {
- ?>
- <tr>
- <td class="listlr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>'">
- <?=$ent['tag']?>
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';">
- <?=$ent['fieldtype'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';">
- <?=$ent['fielddata'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';">
- <?=$ent['fieldorder'];?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="freeswitch_dialplan_includes_details.php?type=dialplanincludedetails&act=del&id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
- }
- $i++;
- }
- }
-
- $i = 0;
- if (count($a_dialplan_include_details) > 0) {
-
- foreach ($a_dialplan_include_details as $ent) {
- if ($ent['tag'] == "anti-action" && $dialplanincludeid == $ent['dialplanincludeid']) {
- ?>
- <tr>
- <td class="listlr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>'">
- <?=$ent['tag']?>
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';">
- <?=$ent['fieldtype'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';">
- <?=$ent['fielddata'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';">
- <?=$ent['fieldorder'];?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="freeswitch_dialplan_includes_details.php?type=dialplanincludedetails&act=del&id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
- }
- $i++;
- }
- }
-
- $i = 0;
- if (count($a_dialplan_include_details) > 0) {
-
- foreach ($a_dialplan_include_details as $ent) {
- if ($ent['tag'] == "param" && $dialplanincludeid == $ent['dialplanincludeid']) {
- ?>
- <tr>
- <td class="listlr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>'">
- <?=$ent['tag']?>
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';">
- <?=$ent['fieldtype'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';">
- <?=$ent['fielddata'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';">
- <?=$ent['fieldorder'];?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="freeswitch_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="freeswitch_dialplan_includes_details.php?type=dialplanincludedetails&act=del&id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
- }
- $i++;
- }
- }
- ?>
- <tr>
- <td class="list" colspan="4"></td>
- <td class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="freeswitch_dialplan_includes_details_edit.php?parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>&a=action"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
-
-
- <tr>
- <td class="list" colspan="4"></td>
- <td class="list"></td>
- </tr>
- </table>
-
- </form>
-
-
-
-
- <br>
- <br>
-
- </td>
- </tr>
-</table>
-
-</div>
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch/freeswitch_extensions.tmp b/config/freeswitch/freeswitch_extensions.tmp
deleted file mode 100644
index b1db2702..00000000
--- a/config/freeswitch/freeswitch_extensions.tmp
+++ /dev/null
@@ -1,220 +0,0 @@
-<?php
-/* $Id$ */
-/*
- freeswitch_extensions.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/freeswitch.inc");
-
-$a_extensions = &$config['installedpackages']['freeswitchextensions']['config'];
-
-
-if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'extensions') {
- if ($a_extensions[$_GET['id']]) {
- $tmp_file_name = "/usr/local/freeswitch/conf/directory/default/".$_GET['extension'].".xml";
- if (file_exists($tmp_file_name)) {
- unlink($tmp_file_name);
- }
- unset($a_extensions[$_GET['id']]);
- write_config();
- header("Location: freeswitch_extensions.php");
- exit;
- }
- }
-}
-
-include("head.inc");
-
-?>
-
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">FreeSWITCH: Extensions</p>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-display_top_tabs(build_menu());
-
-?>
-</td></tr>
-</table>
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
-<form action="freeswitch_extensions.php" method="post" name="iform" id="iform">
-<?php
-
-if ($config_change == 1) {
- write_config();
- $config_change = 0;
-}
-
-//if ($savemsg) print_info_box($savemsg);
-//if (file_exists($d_hostsdirty_path)): echo"<p>";
-//print_info_box_np("The FreeSWITCH extensions have been changed.<br>You must apply the changes in order for them to take effect.");
-//echo"<br />";
-//endif;
-
-?>
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Extensions<br>
- </strong></span>
- Use this to configure your SIP extensions.
- </p></td>
- </tr>
- </table>
- <br />
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="20%" class="listhdrr">Extension</td>
- <td width="25%" class="listhdrr">Mail To</td>
- <td width="25%" class="listhdrr">Call Group</td>
- <td width="25%" class="listhdr">Description</td>
- <td width="10%" class="list">
-
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="freeswitch_extensions_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
-
- </td>
- </tr>
-
-
- <?php
-
- //create a temporary id for the array
- $i = 0;
- if (count($a_extensions) > 0) {
- foreach ($a_extensions as $ent) {
- $a_extensions[$i]['id'] = $i;
- $i++;
- }
- }
-
- //order the array
- function cmp_number($a, $b) {
- if ($a["extension"] > $b["extension"]) {
- return 1;
- }
- else {
- return 0;
- }
- }
- if (count($a_extensions) > 0) { usort($a_extensions, "cmp_number"); }
-
- $i = 0;
- if (count($a_extensions) > 0) {
-
- foreach ($a_extensions as $ent) {
-
- ?>
- <tr>
- <td class="listr" ondblclick="document.location='freeswitch_extensions_edit.php?id=<?=$ent['id'];?>';">
- <?=$ent['extension'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_extensions_edit.php?id=<?=$ent['id'];?>';">
- <?=$ent['vm-mailto'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_extensions_edit.php?id=<?=$ent['id'];?>';">
- <?=$ent['callgroup'];?>&nbsp;
- </td>
- <td class="listbg" ondblclick="document.location='freeswitch_extensions_edit.php?id=<?=$ent['id'];?>';">
- <font color="#FFFFFF"><?=htmlspecialchars($ent['description']);?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="freeswitch_extensions_edit.php?id=<?=$ent['id'];?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="freeswitch_extensions.php?type=extensions&act=del&id=<?=$ent['id'];?>&extension=<?=$ent['extension'];?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
-
- $i++;
- }
- }
- ?>
-
- <tr>
- <td class="list" colspan="4"></td>
- <td class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="freeswitch_extensions_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
-
-
- <tr>
- <td class="list" colspan="4"></td>
- <td class="list"></td>
- </tr>
- </table>
-
-</form>
-
-
-/usr/local/freeswitch/conf/directory/default/
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-
-</td>
-</tr>
-</table>
-
-</div>
-
-
-<?php include("fend.inc"); ?>
-</body>
-</html> \ No newline at end of file
diff --git a/config/freeswitch/freeswitch_extensions_edit.tmp b/config/freeswitch/freeswitch_extensions_edit.tmp
deleted file mode 100644
index de98d447..00000000
--- a/config/freeswitch/freeswitch_extensions_edit.tmp
+++ /dev/null
@@ -1,417 +0,0 @@
-<?php
-/* $Id$ */
-/*
- freeswitch_extensions_edit.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/freeswitch.inc");
-
-
-$a_extensions = &$config['installedpackages']['freeswitchextensions']['config'];
-
-$id = $_GET['id'];
-if (isset($_POST['id'])) {
- $id = $_POST['id'];
-}
-
-if (isset($id) && $a_extensions[$id]) {
-
- $pconfig['extension'] = $a_extensions[$id]['extension'];
- $pconfig['password'] = $a_extensions[$id]['password'];
- $pconfig['mailbox'] = $a_extensions[$id]['mailbox'];
- $pconfig['vm-password'] = $a_extensions[$id]['vm-password'];
- $pconfig['accountcode'] = $a_extensions[$id]['accountcode'];
- $pconfig['effective_caller_id_name'] = $a_extensions[$id]['effective_caller_id_name'];
- $pconfig['effective_caller_id_number'] = $a_extensions[$id]['effective_caller_id_number'];
- $pconfig['effective_caller_id_number'] = $a_extensions[$id]['effective_caller_id_number'];
- $pconfig['outbound_caller_id_name'] = $a_extensions[$id]['outbound_caller_id_name'];
- $pconfig['outbound_caller_id_number'] = $a_extensions[$id]['outbound_caller_id_number'];
- $pconfig['vm-mailto'] = $a_extensions[$id]['vm-mailto'];
- $pconfig['vm-attach-file'] = $a_extensions[$id]['vm-attach-file'];
- $pconfig['vm-keep-local-after-email'] = $a_extensions[$id]['vm-keep-local-after-email'];
- $pconfig['user_context'] = $a_extensions[$id]['user_context'];
- $pconfig['callgroup'] = $a_extensions[$id]['callgroup'];
- $pconfig['auth-acl'] = $a_extensions[$id]['auth-acl'];
- $pconfig['cidr'] = $a_extensions[$id]['cidr'];
- $pconfig['sip-force-contact'] = $a_extensions[$id]['sip-force-contact'];
- $pconfig['enabled'] = $a_extensions[$id]['enabled'];
- $pconfig['description'] = $a_extensions[$id]['description'];
-
-}
-
-if ($_POST) {
-
- unset($input_errors);
- $pconfig = $_POST;
-
-
- if (!$input_errors) {
-
- $effective_caller_id_number = $_POST['effective_caller_id_number'];
- $outbound_caller_id_number = $_POST['outbound_caller_id_number'];
- $replace_array = array("(", ")", " ", "-");
- $effective_caller_id_number = str_replace($replace_array, "", $effective_caller_id_number);
- $outbound_caller_id_number = str_replace($replace_array, "", $outbound_caller_id_number);
-
- $ent = array();
- $ent['extension'] = $_POST['extension'];
- $ent['password'] = $_POST['password'];
- $ent['mailbox'] = $_POST['mailbox'];
- $ent['vm-password'] = $_POST['vm-password'];
- $ent['accountcode'] = $_POST['accountcode'];
- $ent['effective_caller_id_name'] = $_POST['effective_caller_id_name'];
- $ent['effective_caller_id_number'] = $effective_caller_id_number;
- $ent['outbound_caller_id_name'] = $_POST['outbound_caller_id_name'];
- $ent['outbound_caller_id_number'] = $outbound_caller_id_number;
- $ent['vm-mailto'] = $_POST['vm-mailto'];
- $ent['vm-attach-file'] = $_POST['vm-attach-file'];
- $ent['vm-keep-local-after-email'] = $_POST['vm-keep-local-after-email'];
- $ent['user_context'] = $_POST['user_context'];
- $ent['callgroup'] = $_POST['callgroup'];
- $ent['auth-acl'] = $_POST['auth-acl'];
- $ent['cidr'] = $_POST['cidr'];
- $ent['sip-force-contact'] = $_POST['sip-force-contact'];
- $ent['enabled'] = $_POST['enabled'];
- $ent['description'] = $_POST['description'];
-
- if (isset($id) && $a_extensions[$id]) {
- //update
- $a_extensions[$id] = $ent;
- }
- else {
- //add
- $a_extensions[] = $ent;
- }
-
- write_config();
- sync_package_freeswitch_extensions();
-
- header("Location: freeswitch_extensions.php");
- exit;
- }
-}
-
-include("head.inc");
-
-?>
-
-<script type="text/javascript" language="JavaScript">
-
-function show_advanced_config() {
- document.getElementById("showadvancedbox").innerHTML='';
- aodiv = document.getElementById('showadvanced');
- aodiv.style.display = "block";
-}
-
-</script>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">FreeSWITCH: Extensions: Edit</p>
-<?php if ($input_errors) print_input_errors($input_errors); ?>
-
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-display_top_tabs(build_menu());
-
-?>
-</td></tr>
-</table>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Extension Setup<br>
- </strong></span>
- /usr/local/freeswitch/conf/directory/default/
- </p></td>
- </tr>
- </table>
- <br />
-
- <form action="freeswitch_extensions_edit.php" method="post" name="iform" id="iform">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
-
- <tr>
- <td width="25%" valign="top" class="vncellreq">Extension</td>
- <td width="75%" class="vtable">
- <input name="extension" type="text" class="formfld unknown" id="extension" size="40" value="<?=htmlspecialchars($pconfig['extension']);?>">
- <br><span class="vexpl">Enter the extension here. The default configuration 3 or 4 digit extensions.<br></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncellreq">Password</td>
- <td width="75%" class="vtable">
- <input name="password" type="password" class="formfld pwd" id="password" size="40" value="<?=htmlspecialchars($pconfig['password']);?>">
- <br><span class="vexpl">Enter the password here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncellreq">Mailbox</td>
- <td width="75%" class="vtable">
- <input name="mailbox" type="text" class="formfld unknown" id="mailbox" size="40" value="<?=htmlspecialchars($pconfig['mailbox']);?>">
- <br><span class="vexpl">Enter the mailbox here. Example: extension 1001 then mailbox 1001<br></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncellreq">Voicemail Password</td>
- <td width="75%" class="vtable">
- <input name="vm-password" type="password" class="formfld pwd" id="vm-password" size="40" value="<?=htmlspecialchars($pconfig['vm-password']);?>">
- <br><span class="vexpl">Enter the voicemail password here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncellreq">Account Code</td>
- <td width="75%" class="vtable">
- <input name="accountcode" type="text" class="formfld unknown" id="accountcode" size="40" value="<?=htmlspecialchars($pconfig['accountcode']);?>">
- <br><span class="vexpl">Enter the account code here. Example: extension 1001 then accountcode 1001<br></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncellreq" nowrap>Effective Caller ID Name</td>
- <td width="75%" class="vtable">
- <input name="effective_caller_id_name" type="text" class="formfld unknown" id="effective_caller_id_name" size="40" value="<?=htmlspecialchars($pconfig['effective_caller_id_name']);?>">
- <br><span class="vexpl">Enter the effective caller id name here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncellreq" nowrap>Effective Caller ID Number</td>
- <td width="75%" class="vtable">
- <input name="effective_caller_id_number" type="text" class="formfld unknown" id="effective_caller_id_number" size="40" value="<?=htmlspecialchars($pconfig['effective_caller_id_number']);?>">
- <br><span class="vexpl">Enter the effective caller id number here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncellreq" nowrap>Voicemail Mail To</td>
- <td width="75%" class="vtable">
- <input name="vm-mailto" type="text" class="formfld unknown" id="vm-mailto" size="40" value="<?=htmlspecialchars($pconfig['vm-mailto']);?>">
- <br><span class="vexpl">Optional: Enter the email address to send voicemail to.<br></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncellreq" nowrap>Voicemail Attach File</td>
- <td width="75%" class="vtable">
- <?php
- echo " <select name='vm-attach-file' class='formfld unknown'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['vm-attach-file'])) {
- case "true":
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- break;
- case "false":
- echo " <option value='true'>true</option>\n";
- echo " <option value='false' selected='yes'>false</option>\n";
-
- break;
- default:
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- }
- echo " </select>\n";
- ?>
- Choose whether to attach the file to the email.
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncellreq" nowrap>VM Keep Local After Email</td>
- <td width="75%" class="vtable">
- <?php
- echo " <select name='vm-keep-local-after-email' class='formfld unknown'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['vm-keep-local-after-email'])) {
- case "true":
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- break;
- case "false":
- echo " <option value='true'>true</option>\n";
- echo " <option value='false' selected='yes'>false</option>\n";
-
- break;
- default:
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- }
- echo " </select>\n";
- ?>
- Keep local file after sending the email.
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncellreq">User Context</td>
- <td width="75%" class="vtable">
- <input name="user_context" type="text" class="formfld unknown" id="user_context" size="40" value="<?=htmlspecialchars($pconfig['user_context']);?>">
- <br><span class="vexpl">Enter the user context here. Example: default<br></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncellreq">Call Group</td>
- <td width="75%" class="vtable">
- <input name="callgroup" type="text" class="formfld unknown" id="callgroup" size="40" value="<?=htmlspecialchars($pconfig['callgroup']);?>">
- <br><span class="vexpl">Enter the user call group here. Example: sales, support<br></span>
- </td>
- </tr>
- </table>
-
- <div id="showadvancedbox">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="25%" valign="top" class="vncell">Show Advanced</td>
- <td width="75%" class="vtable">
- <input type="button" onClick="show_advanced_config()" value="Advanced"></input></a>
- </td>
- </tr>
- </table>
- </div>
- <div id="showadvanced" style="display:none">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="25%" valign="top" class="vncell">Auth-ACL</td>
- <td width="75%" class="vtable">
- <input name="auth-acl" type="text" class="formfld unknown" id="auth-acl" size="40" value="<?=htmlspecialchars($pconfig['auth-acl']);?>">
- <br> <span class="vexpl">Enter the auth acl here.<br></span>
- </td>
- </tr>
- <tr>
- <td valign="top" class="vncell">CIDR</td>
- <td class="vtable">
- <input name="cidr" type="text" class="formfld unknown" id="cidr" size="40" value="<?=htmlspecialchars($pconfig['cidr']);?>">
- <br> <span class="vexpl">Enter the cidr here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncell" nowrap>Outbound Caller ID Name</td>
- <td width="75%" class="vtable">
- <input name="outbound_caller_id_name" type="text" class="formfld unknown" id="outbound_caller_id_name" size="40" value="<?=htmlspecialchars($pconfig['outbound_caller_id_name']);?>">
- <br><span class="vexpl">Enter the outbound caller id name here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncell" nowrap>Outbound Caller ID Number</td>
- <td width="75%" class="vtable">
- <input name="outbound_caller_id_number" type="text" class="formfld unknown" id="outbound_caller_id_number" size="40" value="<?=htmlspecialchars($pconfig['outbound_caller_id_number']);?>">
- <br><span class="vexpl">Enter the outbound caller id number here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">SIP-Force-Contact</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='sip-force-contact' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['sip-force-contact'])) {
- case "NDLB-connectile-dysfunction":
- echo " <option value='NDLB-connectile-dysfunction' selected='yes'>Rewrite contact IP and port</option>\n";
- echo " <option value='NDLB-tls-connectile-dysfunction'>Rewrite contact port</option>\n";
- break;
- case "NDLB-tls-connectile-dysfunction":
- echo " <option value='NDLB-connectile-dysfunction'>Rewrite contact IP and port</option>\n";
- echo " <option value='NDLB-tls-connectile-dysfunction' selected='yes'>Rewrite contact port</option>\n";
- default:
- echo " <option value='NDLB-connectile-dysfunction'>Rewrite contact IP and port</option>\n";
- echo " <option value='NDLB-tls-connectile-dysfunction'>Rewrite contact port</option>\n";
- }
- echo " </select>\n";
- ?>
- <br />
- Choose sip-force-contact can be used to NDLB-connectile-dysfunction rewrites contact IP and port, <br />and NDLB-tls-connectile-dysfunction rewrites the contact port.<br />
- </td>
- </tr>
- </table>
- </div>
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="22%" valign="top" class="vncellreq">Enabled</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='enabled' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['enabled'])) {
- case "true":
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- break;
- case "false":
- echo " <option value='true'>true</option>\n";
- echo " <option value='false' selected='yes'>false</option>\n";
-
- break;
- default:
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- }
- echo " </select>\n";
- ?>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncellreq">Extension Description</td>
- <td width="75%" class="vtable">
- <input name="description" type="text" class="formfld unknown" id="description" size="40" value="<?=htmlspecialchars($pconfig['description']);?>">
- <br><span class="vexpl">Enter the description of the extension here.<br></span>
- </td>
- </tr>
- <tr>
- <td valign="top">&nbsp;</td>
- <td>
- <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()">
- <?php if (isset($id) && $a_extensions[$id]): ?>
- <input name="id" type="hidden" value="<?=$id;?>">
- <?php endif; ?>
- </td>
- </tr>
- </table>
- </form>
-
- <br>
- <br>
- <br>
- <br>
- <br>
- <br>
-
- </td>
- </tr>
-</table>
-
-</div>
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch/freeswitch_fax.tmp b/config/freeswitch/freeswitch_fax.tmp
deleted file mode 100644
index 38992663..00000000
--- a/config/freeswitch/freeswitch_fax.tmp
+++ /dev/null
@@ -1,305 +0,0 @@
-<?php
-/* $Id$ */
-/*
- freeswitch_fax.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/freeswitch.inc");
-
-$a_fax = &$config['installedpackages']['freeswitchfax']['config'];
-$dir_fax = '/usr/local/freeswitch/storage/fax/inbox/';
-
-if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'fax') {
- if ($a_fax[$_GET['id']]) {
-
- $faxid = $a_fax[$_GET['id']][faxid];
- $faxname = $a_fax[$_GET['id']][faxname];
-
- $a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config'];
- $a_dialplan_includes_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config'];
-
- //delete the dialplan include
- if (count($a_dialplan_includes) > 0) {
- $i=0;
- foreach($a_dialplan_includes as $row) {
- if ($row["dialplanincludeid"] == $faxid) {
- $order = $row['order'];
- unset($a_dialplan_includes[$i]);
- }
- $i++;
- }
- }
-
- //delete the dialplan include details. aka. child data
- if (count($a_dialplan_includes_details) > 0) {
- $i=0;
- foreach($a_dialplan_includes_details as $row) {
- if ($row["dialplanincludeid"] == $faxid) {
- unset($a_dialplan_includes_details[$i]);
- }
- $i++;
- }
- }
-
- if (file_exists("/usr/local/freeswitch/conf/dialplan/default/".$order."_".$faxname.".xml")){
- unlink("/usr/local/freeswitch/conf/dialplan/default/".$order."_".$faxname.".xml");
- }
-
- //remove fax entries
- unset($a_fax[$_GET['id']]);
-
- write_config();
- header("Location: freeswitch_fax.php");
- exit;
- }
- }
-}
-
-if ($_GET['a'] == "download") {
-
- session_cache_limiter('public');
-
- if ($_GET['type'] = "fax_file") {
- if (file_exists($dir_fax.$_GET['filename'])) {
- $fd = fopen($dir_fax.$_GET['filename'], "rb");
- if ($_GET['t'] == "bin") {
- header("Content-Type: application/force-download");
- header("Content-Type: application/octet-stream");
- header("Content-Type: application/download");
- header("Content-Description: File Transfer");
- header('Content-Disposition: attachment; filename="'.$_GET['filename'].'"');
- }
- else {
- $file_ext = substr($_GET['filename'], -3);
- if ($file_ext == "png") {
- header("Content-Type: image/png");
- }
- }
- header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
- header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
- header("Content-Length: " . filesize($dir_fax.$_GET['filename']));
- fpassthru($fd);
- }
- }
-
- exit;
-}
-else {
- //echo $dir_fax.$_GET['filename'];
-}
-
-
-if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'fax_file') {
- //if ($a_fax[$_GET['id']]) {
- $tmp_file_array = split("\.",$_GET['filename']);
- $file_name = $tmp_file_array[0];
- $file_ext = $tmp_file_array[1];
- unlink_if_exists($dir_fax.$file_name.".pdf");
- unlink_if_exists($dir_fax.$file_name.".png");
- unlink_if_exists($dir_fax.$file_name.".tif");
- //unset($a_fax[$_GET['id']]);
- write_config();
- header("Location: freeswitch_fax.php");
- exit;
- //}
- }
-
-}
-
-include("head.inc");
-
-?>
-
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">FreeSWITCH: FAX</p>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-display_top_tabs(build_menu());
-
-?>
-</td></tr>
-</table>
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
-<form action="freeswitch_fax.php" method="post" name="iform" id="iform">
-<?php
-
-if ($config_change == 1) {
- write_config();
- $config_change = 0;
-}
-
-//if ($savemsg) print_info_box($savemsg);
-//if (file_exists($d_hostsdirty_path)): echo"<p>";
-//print_info_box_np("The FreeSWITCH fax have been changed.<br>You must apply the changes in order for them to take effect.");
-//echo"<br />";
-//endif;
-
-?>
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>FAX<br>
- </strong></span>
- To receive a FAX setup a fax extension and then direct the incoming FAX with a dedicated number or you can detect the FAX tone by using <a href='http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_tone_detect' target='_blank'>tone detection</a> on the Public tab.
- </p></td>
- </tr>
- </table>
- <br />
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="40" class="listhdrr">Extension</td>
- <td width="40" class="listhdrr" nowrap>Name</td>
- <td width="40%" class="listhdrr" nowrap>Email</td>
- <td width="40" class="listhdrr">Domain</td>
- <td width="50%" class="listhdr">Description</td>
- <td width="40" class="list">
-
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="freeswitch_fax_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
-
- </td>
- </tr>
-
-
- <?php
-
- //create a temporary id for the array
- $i = 0;
- if (count($a_fax) > 0) {
- foreach ($a_fax as $ent) {
- $a_fax[$i]['id'] = $i;
- $i++;
- }
- }
-
- //order the array
- function cmp_number($a, $b) {
- if ($a["faxextension"] > $b["faxextension"]) {
- return 1;
- }
- else {
- return 0;
- }
- }
- if (count($a_fax) > 0) { usort($a_fax, "cmp_number"); }
-
- $i = 0;
- if (count($a_fax) > 0) {
-
- foreach ($a_fax as $ent) {
- if (strlen($ent['faxextension']) > 0) {
- ?>
- <tr>
- <td class="listr" ondblclick="document.location='freeswitch_fax_edit.php?id=<?=$ent['id'];?>';">
- <?=$ent['faxextension'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_fax_edit.php?id=<?=$ent['id'];?>';">
- <?=$ent['faxname'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_fax_edit.php?id=<?=$ent['id'];?>';">
- <?=$ent['faxemail'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_fax_edit.php?id=<?=$ent['id'];?>';">
- <?=$ent['faxdomain'];?>&nbsp;
- </td>
- <td class="listbg" ondblclick="document.location='freeswitch_fax_edit.php?id=<?=$ent['id'];?>';">
- <font color="#FFFFFF"><?=htmlspecialchars($ent['faxdescription']);?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="freeswitch_fax_edit.php?id=<?=$ent['id'];?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="freeswitch_fax.php?type=fax&act=del&id=<?=$ent['id'];?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
- }
-
- $i++;
- }
- }
- ?>
-
- <tr>
- <td class="list" colspan="5"></td>
- <td class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="freeswitch_fax_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
-
-
- <tr>
- <td class="list" colspan="5"></td>
- <td class="list"></td>
- </tr>
- </table>
-
-</form>
-
-
-<br />
-<br />
-<br />
-<br />
-
-
-</td>
-</tr>
-</table>
-
-</div>
-
-
-<?php include("fend.inc"); ?>
-</body>
-</html> \ No newline at end of file
diff --git a/config/freeswitch/freeswitch_fax_edit.tmp b/config/freeswitch/freeswitch_fax_edit.tmp
deleted file mode 100644
index 43b22cf3..00000000
--- a/config/freeswitch/freeswitch_fax_edit.tmp
+++ /dev/null
@@ -1,723 +0,0 @@
-<?php
-/* $Id$ */
-/*
- freeswitch_fax_edit.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/freeswitch.inc");
-
-$a_fax = &$config['installedpackages']['freeswitchfax']['config'];
-
-$id = $_GET['id'];
-if (strlen($id) == 0) {
- $id = $_POST['id'];
-}
-$parentid = $id;
-
-if (isset($id) && $a_fax[$id]) {
- $pconfig['faxid'] = $a_fax[$id]['faxid'];
- $faxid = $a_fax[$id]['faxid'];
- $pconfig['faxextension'] = $a_fax[$id]['faxextension'];
- $pconfig['faxname'] = $a_fax[$id]['faxname'];
- $pconfig['faxemail'] = $a_fax[$id]['faxemail'];
- $pconfig['faxdomain'] = $a_fax[$id]['faxdomain'];
- $pconfig['faxdescription'] = $a_fax[$id]['faxdescription'];
-}
-
-
-$dir_fax_inbox = '/usr/local/freeswitch/storage/fax/'.$pconfig['faxextension'].'/inbox/';
-$dir_fax_sent = '/usr/local/freeswitch/storage/fax/'.$pconfig['faxextension'].'/sent/';
-$dir_fax_temp = '/usr/local/freeswitch/storage/fax/'.$pconfig['faxextension'].'/temp/';
-
-if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'fax') {
- if ($a_fax[$_GET['id']]) {
-
- $faxid = $a_fax[$_GET['id']][faxid];
- $faxname = $a_fax[$_GET['id']][faxname];
-
- $a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config'];
- $a_dialplan_includes_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config'];
-
- //delete the dialplan include
- if (count($a_dialplan_includes) > 0) {
- $i=0;
- foreach($a_dialplan_includes as $row) {
- if ($row["dialplanincludeid"] == $faxid) {
- $order = $row['order'];
- unset($a_dialplan_includes[$i]);
- }
- $i++;
- }
- }
-
- //delete the dialplan include details. aka. child data
- if (count($a_dialplan_includes_details) > 0) {
- $i=0;
- foreach($a_dialplan_includes_details as $row) {
- if ($row["dialplanincludeid"] == $faxid) {
- unset($a_dialplan_includes_details[$i]);
- }
- $i++;
- }
- }
-
- if (file_exists("/usr/local/freeswitch/conf/dialplan/default/".$order."_".$faxname.".xml")){
- unlink("/usr/local/freeswitch/conf/dialplan/default/".$order."_".$faxname.".xml");
- }
-
- //remove fax entries
- unset($a_fax[$_GET['id']]);
-
- write_config();
- header("Location: freeswitch_fax.php");
- exit;
- }
- }
-}
-
-if (($_POST['type'] == "fax_send") && is_uploaded_file($_FILES['fax_file']['tmp_name'])) {
-
- $fax_number = $_POST['fax_number'];
- $fax_name = $_FILES['fax_file']['name'];
- $fax_name = str_replace(".tif", "", $fax_name);
- $fax_name = str_replace(".tiff", "", $fax_name);
- $fax_name = str_replace(".pdf", "", $fax_name);
- $fax_gateway = $_POST['fax_gateway'];
-
- $password = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password'];
- $port = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port'];
- $host = $config['interfaces']['lan']['ipaddr'];
-
- //upload the file
- move_uploaded_file($_FILES['fax_file']['tmp_name'], $dir_fax_temp.$_FILES['fax_file']['name']);
-
- $fax_file_extension = substr($dir_fax_temp.$_FILES['fax_file']['name'], -4);
- if ($fax_file_extension == ".pdf") {
- exec("cd ".$dir_fax_temp.";gs -q -sDEVICE=tiffg3 -r204x98 -dNOPAUSE -sOutputFile=".$fax_name.".tif -- ".$fax_name.".pdf -c quit");
- //exec("rm ".$dir_fax_temp.$fax_name.".pdf");
- }
- if ($fax_file_extension == ".tiff") {
- exec("cp ".$dir_fax_temp.$fax_name.".tiff ".$dir_fax_temp.$fax_name.".tif");
- exec("rm ".$dir_fax_temp.$fax_name.".tiff");
- }
-
- //send the fax
- $fp = event_socket_create($host, $port, $password);
- $cmd = "api originate [absolute_codec_string=PCMU]sofia/gateway/".$fax_gateway."/".$fax_number." &txfax(".$dir_fax_temp.$fax_name.".tif)";
- $response = event_socket_request($fp, $cmd);
- $response = str_replace("\n", "", $response);
- $uuid = str_replace("+OK ", "", $response);
- fclose($fp);
-
- //if ($response >= 1) {
- // $fp = event_socket_create($host, $port, $password);
- // $cmd = "api uuid_getvar ".$uuid." fax_result_text";
- // echo $cmd."\n";
- // $response = event_socket_request($fp, $cmd);
- // $response = trim($response);
- // fclose($fp);
- //}
-
- sleep(5);
-
- //copy the .tif to the sent directory
- exec("cp ".$dir_fax_temp.$fax_name.".tif ".$dir_fax_sent.$fax_name.".tif");
-
- //delete the .tif from the temp directory
- //exec("rm ".$dir_fax_temp.$fax_name.".tif");
-
- //convert the tif to pdf and png
- exec("cd $dir_fax_sent; /usr/local/bin/tiff2png ".$dir_fax_sent.$fax_name.".tif");
- exec("cd $dir_fax_sent; /usr/local/bin/tiff2pdf -f -o ".$fax_name.".pdf ".$dir_fax_sent.$fax_name.".tif");
-
- header("Location: freeswitch_fax_edit.php?id=".$id."&msg=".$response);
- exit;
-}
-
-if ($_GET['a'] == "download") {
-
- session_cache_limiter('public');
-
- if ($_GET['type'] == "fax_inbox") {
-
- if (file_exists($dir_fax_inbox.$_GET['filename'])) {
-
- $fd = fopen($dir_fax_inbox.$_GET['filename'], "rb");
- if ($_GET['t'] == "bin") {
- header("Content-Type: application/force-download");
- header("Content-Type: application/octet-stream");
- header("Content-Type: application/download");
- header("Content-Description: File Transfer");
- header('Content-Disposition: attachment; filename="'.$_GET['filename'].'"');
- }
- else {
- $file_ext = substr($_GET['filename'], -3);
- if ($file_ext == "png") {
- header("Content-Type: image/png");
- }
- }
- header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
- header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
- header("Content-Length: " . filesize($dir_fax_inbox.$_GET['filename']));
- fpassthru($fd);
- }
- else {
- echo "not found";
- }
- exit;
- }
-
-}
-else {
- //echo $dir_fax_inbox.$_GET['filename'];
-}
-
-
-if ($_GET['a'] == "download") {
-
- session_cache_limiter('public');
-
- if ($_GET['type'] == "fax_sent") {
- if (file_exists($dir_fax_sent.$_GET['filename'])) {
- $fd = fopen($dir_fax_sent.$_GET['filename'], "rb");
- if ($_GET['t'] == "bin") {
- header("Content-Type: application/force-download");
- header("Content-Type: application/octet-stream");
- header("Content-Type: application/download");
- header("Content-Description: File Transfer");
- header('Content-Disposition: attachment; filename="'.$_GET['filename'].'"');
- }
- else {
- $file_ext = substr($_GET['filename'], -3);
- if ($file_ext == "png") {
- header("Content-Type: image/png");
- }
- }
- header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
- header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
- header("Content-Length: " . filesize($dir_fax_sent.$_GET['filename']));
- fpassthru($fd);
- }
-
- }
-
- exit;
-}
-else {
- //echo $dir_fax_inbox.$_GET['filename'];
-}
-
-
-if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'fax_inbox') {
- //if ($a_fax[$_GET['id']]) {
- $tmp_file_array = split("\.",$_GET['filename']);
- $file_name = $tmp_file_array[0];
- $file_ext = $tmp_file_array[1];
- unlink_if_exists($dir_fax_inbox.$file_name.".pdf");
- unlink_if_exists($dir_fax_inbox.$file_name.".png");
- unlink_if_exists($dir_fax_inbox.$file_name.".tif");
- //unset($a_fax[$_GET['id']]);
- write_config();
- header("Location: freeswitch_fax.php");
- exit;
- //}
- }
-}
-
-
-if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'fax_sent') {
- //if ($a_fax[$_GET['id']]) {
- $tmp_file_array = split("\.",$_GET['filename']);
- $file_name = $tmp_file_array[0];
- $file_ext = $tmp_file_array[1];
- unlink_if_exists($dir_fax_sent.$file_name.".pdf");
- unlink_if_exists($dir_fax_sent.$file_name.".png");
- unlink_if_exists($dir_fax_sent.$file_name.".tif");
- //unset($a_fax[$_GET['id']]);
- write_config();
- header("Location: freeswitch_fax.php");
- exit;
- //}
- }
-}
-
-
-if ($_POST) {
-
- unset($input_errors);
- $pconfig = $_POST;
-
- if (!$input_errors) {
-
- $ent = array();
- if (strlen($_POST['faxid']) > 0) {
- $ent['faxid'] = $_POST['faxid'];
- }
- else {
- $ent['faxid'] = guid();
- }
- $ent['faxextension'] = $_POST['faxextension'];
- $ent['faxname'] = $_POST['faxname'];
- $ent['faxemail'] = $_POST['faxemail'];
- $ent['faxdomain'] = $_POST['faxdomain'];
- $ent['faxdescription'] = $_POST['faxdescription'];
-
- if (isset($id) && $a_fax[$id]) {
- //update
- $a_fax[$id] = $ent;
- }
- else {
- //add
- $a_fax[] = $ent;
- }
-
- if (!is_dir('/usr/local/freeswitch/storage/fax/')) {
- exec("mkdir /usr/local/freeswitch/storage/fax/");
- }
-
- $faxfolder = '/usr/local/freeswitch/storage/fax/'.$_POST['faxextension'];
- if (!is_dir($faxfolder)) {
- exec('mkdir '.$faxfolder);
- }
- if (!is_dir($faxfolder.'/inbox/')) {
- exec('mkdir '.$faxfolder.'/inbox/');
- }
- if (!is_dir($faxfolder.'/sent/')) {
- exec('mkdir '.$faxfolder.'/sent/');
- }
- if (!is_dir($faxfolder.'/temp/')) {
- exec('mkdir '.$faxfolder.'/temp/');
- }
- write_config();
- sync_package_freeswitch_fax();
-
- header("Location: freeswitch_fax.php");
- exit;
- }
-}
-
-include("head.inc");
-
-?>
-
-<script type="text/javascript" language="JavaScript">
-
-function show_advanced_config() {
- document.getElementById("showadvancedbox").innerHTML='';
- aodiv = document.getElementById('showadvanced');
- aodiv.style.display = "block";
-}
-
-</script>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">FreeSWITCH: FAX: Edit</p>
-<?php if ($input_errors) print_input_errors($input_errors); ?>
-
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-display_top_tabs(build_menu());
-
-?>
-</td></tr>
-</table>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>FAX Setup<br>
- </strong></span>
- </p></td>
- </tr>
- </table>
- <br />
-
- <form action="freeswitch_fax_edit.php" method="post" name="iform" id="iform">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="25%" valign="top" class="vncellreq">Extension</td>
- <td width="75%" class="vtable">
- <input name="faxextension" type="text" class="formfld unknown" id="faxextension" size="40" value="<?=htmlspecialchars($pconfig['faxextension']);?>">
- <br><span class="vexpl">Enter the fax extension here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncellreq">Name</td>
- <td width="75%" class="vtable">
- <input name="faxname" type="text" class="formfld unknown" id="faxname" size="40" value="<?=htmlspecialchars($pconfig['faxname']);?>">
- <br><span class="vexpl">Enter the name here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncellreq">Email</td>
- <td width="75%" class="vtable">
- <input name="faxemail" type="text" class="formfld unknown" id="faxemail" size="40" value="<?=htmlspecialchars($pconfig['faxemail']);?>">
- <br><span class="vexpl">Optional: Enter the email address to send the FAX to.<br></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncellreq">Domain</td>
- <td width="75%" class="vtable">
- <input name="faxdomain" type="text" class="formfld unknown" id="faxdomain" size="40" value="<?=htmlspecialchars($pconfig['faxdomain']);?>">
- <br><span class="vexpl">Enter the domain here.<br></span>
- </td>
- </tr>
- <!--
- <tr>
- <td width="25%" valign="top" class="vncellreq" nowrap>Attach File</td>
- <td width="75%" class="vtable">
- <?php
- /*
- echo " <select name='vm-attach-file' class='formfld unknown'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['vm-attach-file'])) {
- case "true":
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- break;
- case "false":
- echo " <option value='true'>true</option>\n";
- echo " <option value='false' selected='yes'>false</option>\n";
-
- break;
- default:
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- }
- echo " </select>\n";
- */
- ?>
- Choose whether to attach the file to the email.
- </td>
- </tr>
- -->
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="25%" valign="top" class="vncellreq">Description</td>
- <td width="75%" class="vtable">
- <input name="faxdescription" type="text" class="formfld unknown" id="faxdescription" size="40" value="<?=htmlspecialchars($pconfig['faxdescription']);?>">
- <br><span class="vexpl">Enter the description here.<br></span>
- </td>
- </tr>
- <tr>
- <td valign="top">&nbsp;</td>
- <td>
- <input name="faxid" type="hidden" value="<?=htmlspecialchars($pconfig['faxid']);?>">
- <?php if (isset($id) && $a_fax[$id]): ?>
- <input name="id" type="hidden" value="<?=$id;?>">
- <?php endif; ?>
- <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()">
- </td>
- </tr>
- </table>
- </form>
-
- <br />
- <br />
- <br />
- <br />
-
-
- <table width="100%" border="0" cellpadding="3" cellspacing="0">
- <tr>
- <td width='30%'>
- <span class="vexpl"><span class="red"><strong>Send</strong></span>
- </td>
- </tr>
- <tr>
- <td>
- To send a fax you can upload a .tif file or if ghost script has been installed then you can also send a fax by uploading a PDF. (pkg_add -r ghostscript8-nox11; rehash)
- When sending a fax you can view status of the transmission by viewing the logs from the Status tab or by watching the response from the FreeSWITCH console.
- </td>
- </tr>
- <tr>
- <td align='right' nowrap>
- <form action="" method="POST" enctype="multipart/form-data" name="frmUpload" onSubmit="">
- <table border='0' cellpadding='3' cellspacing='0' width='100%'>
- <tr>
- <td valign="middle" class="label">
- Fax Number
- </td>
- <td valign="top" class="label">
- <input type="text" name="fax_number" value="">
- </td>
- <td align="left">Upload:</td>
- <td valign="top" class="label">
- <input name="id" type="hidden" value="$id">
- <input name="type" type="hidden" value="fax_send">
- <input name="fax_file" type="file" class="button" id="fax_file">
- </td>
- <td valign="middle" class="label">
- Gateway
- </td>
- <td valign="top" class="label">
-
- <?php
- //create a temporary id for the array
- $a_gateways = &$config['installedpackages']['freeswitchgateways']['config'];
-
- $i = 0;
- if (count($a_gateways) > 0) {
- foreach ($a_gateways as $ent) {
- $a_gateways[$i]['id'] = $i;
- $i++;
- }
- }
-
- //order the array
- function cmp_string($a, $b) {
- return strcmp($a["gateway"], $b["gateway"]);
- }
- if (count($a_gateways) > 0) { usort($a_gateways, "cmp_string"); }
-
- echo "<select name='fax_gateway' class='formfld'>";
- $i = 0;
- if (count($a_gateways) > 0) {
-
- foreach ($a_gateways as $ent) {
- echo "<option>".$ent['gateway']."</option>\n";
- }
- }
- echo "</select>\n";
-
- ?>
- </td>
- <td>
- <input name="submit" type="submit" class="button" id="upload" value="Send FAX">
- </td>
- </tr>
- </table>
- </div>
- </form>
- </td>
- </tr>
- </table>
-
-
-
- <br />
- <br />
- <br />
- <br />
-
- <table width="100%" border="0" cellpadding="5" cellspacing="0">
- <tr>
- <td>
- <span class="vexpl"><span class="red"><strong>Inbox</strong></span>
- </td>
- <td align='right'>
- <b>location:</b> <?php echo $dir_fax_inbox; ?>
- </td>
- </tr>
- </table>
-
- <div id="niftyOutter">
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="50%" class="listhdrr">File Name (download)</td>
- <td width="10%" class="listhdrr">Download</td>
- <td width="10%" class="listhdrr">View</td>
- <td width="20%" class="listhdr">Last Modified</td>
- <td width="10%" class="listhdr" nowrap>Size</td>
- </tr>
-
- <?php
-
- if ($handle = opendir($dir_fax_inbox)) {
- while (false !== ($file = readdir($handle))) {
- if ($file != "." && $file != ".." && is_file($dir_fax_inbox.$file)) {
-
- $tmp_filesize = filesize($dir_fax_inbox.$file);
- $tmp_filesize = byte_convert($tmp_filesize);
-
- $tmp_file_array = split("\.",$file);
- $file_name = $tmp_file_array[0];
- $file_ext = $tmp_file_array[1];
-
- if ($file_ext == "tif") {
-
- echo "<tr>\n";
- echo " <td class=\"listlr\" ondblclick=\"\">\n";
- echo " <a href=\"freeswitch_fax_edit.php?id=".$id."&a=download&type=fax_inbox&t=bin&filename=".$file."\">\n";
- echo " $file";
- echo " </a>";
- echo " </td>\n";
- echo " <td class=\"listlr\" ondblclick=\"\">\n";
- echo " <a href=\"freeswitch_fax_edit.php?id=".$id."&a=download&type=fax_inbox&t=bin&filename=".$file_name.".pdf\">\n";
- echo " pdf";
- echo " </a>";
- echo " </td>\n";
- echo " <td class=\"listlr\" ondblclick=\"\">\n";
- echo " <a href=\"freeswitch_fax_edit.php?id=".$id."&a=download&type=fax_inbox&t=png&filename=".$file_name.".png\" target=\"_blank\">\n";
- echo " png";
- echo " </a>";
- echo " </td>\n";
- echo " <td class=\"listlr\" ondblclick=\"\">\n";
- echo date ("F d Y H:i:s", filemtime($dir_fax_inbox.$file));
- echo " </td>\n";
- echo " <td class=\"listlr\" ondblclick=\"\">\n";
- echo " ".$tmp_filesize;
- echo " </td>\n";
- echo " <td valign=\"middle\" nowrap class=\"list\">\n";
- echo " <table border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n";
- echo " <tr>\n";
- //echo " <td valign=\"middle\"><a href=\"freeswitch_fax_edit.php?id=$i\"><img src=\"/themes/".$g['theme']."/images/icons/icon_e.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n";
- echo " <td><a href=\"freeswitch_fax_edit.php?id=".$id."&type=fax_inbox&act=del&filename=".$file."\" onclick=\"return confirm('Do you really want to delete this file?')\"><img src=\"/themes/". $g['theme']."/images/icons/icon_x.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n";
- echo " </tr>\n";
- echo " </table>\n";
- echo " </td>\n";
- echo "</tr>\n";
- }
-
- }
- }
- closedir($handle);
- }
- ?>
-
- <tr>
- <td class="list" colspan="3"></td>
- <td class="list"></td>
- </tr>
- </table>
-
- <br />
- <br />
- <br />
- <br />
-
- <table width="100%" border="0" cellpadding="5" cellspacing="0">
- <tr>
- <td>
- <span class="vexpl"><span class="red"><strong>Sent</strong></span>
- </td>
- <td align='right'>
- <b>location:</b> <?php echo $dir_fax_sent; ?>
- </td>
- </tr>
- </table>
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="50%" class="listhdrr">File Name (download)</td>
- <td width="10%" class="listhdrr">Download</td>
- <td width="10%" class="listhdrr">View</td>
- <td width="20%" class="listhdr">Last Modified</td>
- <td width="10%" class="listhdr" nowrap>Size</td>
- </tr>
-
- <?php
-
- if ($handle = opendir($dir_fax_sent)) {
- while (false !== ($file = readdir($handle))) {
- if ($file != "." && $file != ".." && is_file($dir_fax_sent.$file)) {
-
- $tmp_filesize = filesize($dir_fax_sent.$file);
- $tmp_filesize = byte_convert($tmp_filesize);
-
- $tmp_file_array = split("\.",$file);
- $file_name = $tmp_file_array[0];
- $file_ext = $tmp_file_array[1];
-
- if ($file_ext == "tif") {
-
- echo "<tr>\n";
- echo " <td class=\"listlr\" ondblclick=\"\">\n";
- echo " <a href=\"freeswitch_fax_edit.php?id=".$id."&a=download&type=fax_sent&t=bin&filename=".$file."\">\n";
- echo " $file";
- echo " </a>";
- echo " </td>\n";
- echo " <td class=\"listlr\" ondblclick=\"\">\n";
- echo " <a href=\"freeswitch_fax_edit.php?id=".$id."&a=download&type=fax_sent&t=bin&filename=".$file_name.".pdf\">\n";
- echo " pdf";
- echo " </a>";
- echo " </td>\n";
- echo " <td class=\"listlr\" ondblclick=\"\">\n";
- echo " <a href=\"freeswitch_fax_edit.php?id=".$id."&a=download&type=fax_sent&t=png&filename=".$file_name.".png\" target=\"_blank\">\n";
- echo " png";
- echo " </a>";
- echo " </td>\n";
- echo " <td class=\"listlr\" ondblclick=\"\">\n";
- echo date ("F d Y H:i:s", filemtime($dir_fax_sent.$file));
- echo " </td>\n";
- echo " <td class=\"listlr\" ondblclick=\"\">\n";
- echo " ".$tmp_filesize;
- echo " </td>\n";
- echo " <td valign=\"middle\" nowrap class=\"list\">\n";
- echo " <table border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n";
- echo " <tr>\n";
- //echo " <td valign=\"middle\"><a href=\"freeswitch_fax_edit.php?id=$i\"><img src=\"/themes/".$g['theme']."/images/icons/icon_e.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n";
- echo " <td><a href=\"freeswitch_fax_edit.php?id=".$id."&type=fax_sent&act=del&filename=".$file."\" onclick=\"return confirm('Do you really want to delete this file?')\"><img src=\"/themes/". $g['theme']."/images/icons/icon_x.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n";
- echo " </tr>\n";
- echo " </table>\n";
- echo " </td>\n";
- echo "</tr>\n";
- }
-
- }
- }
- closedir($handle);
- }
- ?>
-
- <tr>
- <td class="list" colspan="3"></td>
- <td class="list"></td>
- </tr>
- </table>
-
-
- <br />
- <br />
- <br />
- <br />
-
-
- </td>
- </tr>
-</table>
-
-</div>
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch/freeswitch_features.tmp b/config/freeswitch/freeswitch_features.tmp
deleted file mode 100644
index 1a2ed969..00000000
--- a/config/freeswitch/freeswitch_features.tmp
+++ /dev/null
@@ -1,216 +0,0 @@
-<?php
-/* $Id$ */
-/*
- freeswitch_extensions.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/freeswitch.inc");
-
-$a_extensions = &$config['installedpackages']['freeswitchextensions']['config'];
-
-
-if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'extensions') {
- if ($a_extensions[$_GET['id']]) {
- unset($a_extensions[$_GET['id']]);
- write_config();
- header("Location: freeswitch_extensions.php");
- exit;
- }
- }
-}
-
-include("head.inc");
-
-?>
-
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">FreeSWITCH: Extensions</p>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-display_top_tabs(build_menu());
-
-?>
-</td></tr>
-</table>
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
- <!--
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Features<br>
- </strong></span>
- List of a few of the features.
- </p></td>
- </tr>
- </table>
- <br />-->
-
- <br />
- <br />
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td class="listtopic" colspan='2'>Auto Attendant</td>
- </tr>
- <tr>
- <td width='10%' class="vncell"><a href='freeswitch_ivr.php'>Open</a></td>
- <td class="vtable">
- An interactive voice response (IVR) often refered to as an Auto Attendant.
- It associates a recording to multiple options that can be used to direct
- calls to extensions, voicemail, queues, other IVR applications, and external
- phone numbers.
- </td>
- </tr>
- </table>
-
- <br />
- <br />
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td class="listtopic" colspan='2'>Direct Inward System Access</td>
- </tr>
- <tr>
- <td width='10%' class="vncell"></td>
- <td class="vtable">
- Direct Inward System Access (DISA) allows inbound callers to make internal or external calls. For security reasons it is disabled by default.
- To enable it first set a secure pin number from the Settings->Admin PIN Number.
- Then go to Dialplan tab and find the DISA entry and edit it to set 'Enabled' to 'true'.
- To use DISA dial *3427 (disa) enter the admin pin code and the extension or phone number you wish to call.
- </td>
- </tr>
- </table>
-
- <br />
- <br />
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td class="listtopic" colspan='2'>FAX</td>
- </tr>
- <tr>
- <td width='10%' class="vncell"><a href='freeswitch_fax.php'>Open</a></td>
- <td class="vtable">
- Transmit and View Received Faxes.
- </td>
- </tr>
- </table>
-
- <br />
- <br />
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td class="listtopic" colspan='2'>Hunt Group</td>
- </tr>
- <tr>
- <td width='10%' class="vncell"><a href='freeswitch_hunt_group.php'>Open</a></td>
- <td class="vtable">
- Hunt Group is a group of destinations to call at once or in succession.
- </td>
- </tr>
- </table>
-
- <br />
- <br />
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td class="listtopic" colspan='2'>Modules</td>
- </tr>
- <tr>
- <td width='10%' class="vncell"><a href='/pkg_edit.php?xml=freeswitch_modules.xml&amp;id=0'>Open</a></td>
- <td class="vtable">
- Modules add additional features and can be enabled or disabled to provide the desired features.
- </td>
- </tr>
- </table>
-
- <br />
- <br />
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td class="listtopic" colspan='2'>Music on Hold</td>
- </tr>
- <tr>
- <td width='10%' class="vncell"><a href='freeswitch_recordings.php'>Open</a></td>
- <td class="vtable">
- Music on hold can be in WAV or MP3 format. To play an MP3 files you must have mod_shout enabled on the 'Modules' tab.
- For best performance upload 16bit 8khz/16khz Mono WAV files.
- </td>
- </tr>
- </table>
-
- <br />
- <br />
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td class="listtopic" colspan='2'>Recordings</td>
- </tr>
- <tr>
- <td width='10%' class="vncell"><a href='freeswitch_recordings.php'>Open</a></td>
- <td class="vtable">
- To make a recording dial *732673 (record) or you can make a 16bit 8khz/16khz
- Mono WAV file then copy it to the following directory then refresh the page to play
- it back. Click on the 'Filename' to download it or the 'Recording Name' to play the audio.
- </td>
- </tr>
- </table>
-
-<br />
-<br />
-<br />
-<br />
-<br />
-<br />
-<br />
-<br />
-
-</td>
-</tr>
-</table>
-
-</div>
-
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch/freeswitch_gateways.tmp b/config/freeswitch/freeswitch_gateways.tmp
deleted file mode 100644
index 16d933fd..00000000
--- a/config/freeswitch/freeswitch_gateways.tmp
+++ /dev/null
@@ -1,214 +0,0 @@
-<?php
-/* $Id$ */
-/*
- freeswitch_gateways.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/freeswitch.inc");
-
-$a_gateways = &$config['installedpackages']['freeswitchgateways']['config'];
-
-
-if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'gateways') {
- if ($a_gateways[$_GET['id']]) {
- $tmp_file_name = "/usr/local/freeswitch/conf/sip_profiles/external/".$_GET['gateway'].".xml";
- if (file_exists($tmp_file_name)) {
- unlink($tmp_file_name);
- }
- unset($a_gateways[$_GET['id']]);
- write_config();
- header("Location: freeswitch_gateways.php");
- exit;
- }
- }
-}
-
-include("head.inc");
-
-?>
-
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">FreeSWITCH: Gateways</p>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-display_top_tabs(build_menu());
-
-?>
-</td></tr>
-</table>
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
-<form action="freeswitch_gateways.php" method="post" name="iform" id="iform">
-<?php
-
-if ($config_change == 1) {
- write_config();
- $config_change = 0;
-}
-
-//if ($savemsg) print_info_box($savemsg);
-//if (file_exists($d_hostsdirty_path)): echo"<p>";
-//print_info_box_np("The FreeSWITCH gateways have been changed.<br>You must apply the changes in order for them to take effect.");
-//echo"<br />";
-//endif;
-
-?>
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Gateways<br>
- </strong></span>
- Use this to configure your SIP gateways also known as providers.
- </p></td>
- </tr>
- </table>
- <br />
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="20%" class="listhdrr">Gateway</td>
- <td width="25%" class="listhdrr">Context</td>
- <td width="25%" class="listhdrr">Enabled</td>
- <td width="25%" class="listhdr">Description</td>
- <td width="10%" class="list">
-
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="freeswitch_gateways_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
-
- </td>
- </tr>
-
-
- <?php
- //create a temporary id for the array
- $i = 0;
- if (count($a_gateways) > 0) {
- foreach ($a_gateways as $ent) {
- $a_gateways[$i]['id'] = $i;
- $i++;
- }
- }
-
- //order the array
- function cmp_string($a, $b) {
- return strcmp($a["gateway"], $b["gateway"]);
- }
- if (count($a_gateways) > 0) { usort($a_gateways, "cmp_string"); }
-
- $i = 0;
- if (count($a_gateways) > 0) {
-
- foreach ($a_gateways as $ent) {
-
- ?>
- <tr>
- <td class="listr" ondblclick="document.location='freeswitch_gateways_edit.php?id=<?=$ent['id'];?>';">
- <?=$ent['gateway'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_gateways_edit.php?id=<?=$ent['id'];?>';">
- <?=$ent['context'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_gateways_edit.php?id=<?=$ent['id'];?>';">
- <?=$ent['enabled'];?>&nbsp;
- </td>
- <td class="listbg" ondblclick="document.location='freeswitch_gateways_edit.php?id=<?=$ent['id'];?>';">
- <font color="#FFFFFF"><?=htmlspecialchars($ent['description']);?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="freeswitch_gateways_edit.php?id=<?=$ent['id'];?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="freeswitch_gateways.php?type=gateways&act=del&id=<?=$ent['id'];?>&gateway=<?=$ent['gateway'];?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
-
- $i++;
- }
- }
- ?>
-
- <tr>
- <td class="list" colspan="4"></td>
- <td class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="freeswitch_gateways_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
-
-
- <tr>
- <td class="list" colspan="4"></td>
- <td class="list"></td>
- </tr>
- </table>
-
-</form>
-
-
-/usr/local/freeswitch/conf/sip_profiles/external/
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-
-</td>
-</tr>
-</table>
-
-</div>
-
-
-<?php include("fend.inc"); ?>
-</body>
-</html> \ No newline at end of file
diff --git a/config/freeswitch/freeswitch_gateways_edit.tmp b/config/freeswitch/freeswitch_gateways_edit.tmp
deleted file mode 100644
index 977e562e..00000000
--- a/config/freeswitch/freeswitch_gateways_edit.tmp
+++ /dev/null
@@ -1,694 +0,0 @@
-<?php
-/* $Id$ */
-/*
-
- freeswitch_gateways_edit.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/freeswitch.inc");
-
-
-$a_gateways = &$config['installedpackages']['freeswitchgateways']['config'];
-
-$id = $_GET['id'];
-if (isset($_POST['id'])) {
- $id = $_POST['id'];
-}
-
-if (isset($id) && $a_gateways[$id]) {
-
- $pconfig['gatewayid'] = $a_gateways[$id]['gatewayid'];
- $gatewayid = $a_gateways[$id]['gatewayid'];
- $pconfig['gateway'] = $a_gateways[$id]['gateway'];
- $pconfig['username'] = $a_gateways[$id]['username'];
- $pconfig['auth-username'] = $a_gateways[$id]['auth-username'];
- $pconfig['password'] = $a_gateways[$id]['password'];
- $pconfig['realm'] = $a_gateways[$id]['realm'];
- $pconfig['from-user'] = $a_gateways[$id]['from-user'];
- $pconfig['from-domain'] = $a_gateways[$id]['from-domain'];
- $pconfig['proxy'] = $a_gateways[$id]['proxy'];
- $pconfig['expire-seconds'] = $a_gateways[$id]['expire-seconds'];
- $pconfig['register'] = $a_gateways[$id]['register'];
- $pconfig['register-transport'] = $a_gateways[$id]['register-transport'];
- $pconfig['retry-seconds'] = $a_gateways[$id]['retry-seconds'];
- $pconfig['extension'] = $a_gateways[$id]['extension'];
- $pconfig['ping'] = $a_gateways[$id]['ping'];
- $pconfig['caller-id-in-from'] = $a_gateways[$id]['caller-id-in-from'];
- $pconfig['supress-cng'] = $a_gateways[$id]['supress-cng'];
-
- $pconfig['effective_caller_id_name'] = $a_gateways[$id]['effective_caller_id_name'];
- $pconfig['effective_caller_id_number'] = $a_gateways[$id]['effective_caller_id_number'];
- $pconfig['outbound_caller_id_name'] = $a_gateways[$id]['outbound_caller_id_name'];
- $pconfig['outbound_caller_id_number'] = $a_gateways[$id]['outbound_caller_id_number'];
-
- $pconfig['context'] = $a_gateways[$id]['context'];
- $pconfig['enabled'] = $a_gateways[$id]['enabled'];
- $pconfig['description'] = $a_gateways[$id]['description'];
-}
-
-if ($_POST) {
-
- unset($input_errors);
- $pconfig = $_POST;
-
- if (!$input_errors) {
-
- $effective_caller_id_number = $_POST['effective_caller_id_number'];
- $outbound_caller_id_number = $_POST['outbound_caller_id_number'];
- $replace_array = array("(", ")", " ", "-");
- $effective_caller_id_number = str_replace($replace_array, "", $effective_caller_id_number);
- $outbound_caller_id_number = str_replace($replace_array, "", $outbound_caller_id_number);
-
- $ent = array();
- if (strlen($_POST['ivrid']) > 0) {
- $ent['gatewayid'] = $_POST['ivrid'];
- }
- else {
- $ent['gatewayid'] = guid();
- }
- $ent['gateway'] = $_POST['gateway'];
- $ent['username'] = $_POST['username'];
- $ent['auth-username'] = $_POST['auth-username'];
- $ent['password'] = $_POST['password'];
- $ent['realm'] = $_POST['realm'];
- $ent['from-user'] = $_POST['from-user'];
- $ent['from-domain'] = $_POST['from-domain'];
- $ent['proxy'] = $_POST['proxy'];
- $ent['expire-seconds'] = $_POST['expire-seconds'];
- $ent['register'] = $_POST['register'];
- $ent['register-transport'] = $_POST['register-transport'];
- $ent['retry-seconds'] = $_POST['retry-seconds'];
- $ent['extension'] = $_POST['extension'];
- $ent['ping'] = $_POST['ping'];
- $ent['caller-id-in-from'] = $_POST['caller-id-in-from'];
- $ent['supress-cng'] = $_POST['supress-cng'];
-
- $ent['effective_caller_id_name'] = $_POST['effective_caller_id_name'];
- $ent['effective_caller_id_number'] = $effective_caller_id_number;
- $ent['outbound_caller_id_name'] = $_POST['outbound_caller_id_name'];
- $ent['outbound_caller_id_number'] = $outbound_caller_id_number;
-
- $ent['context'] = $_POST['context'];
- $ent['enabled'] = $_POST['enabled'];
- $ent['description'] = $_POST['description'];
-
- if (isset($id) && $a_gateways[$id]) {
- //update
- $a_gateways[$id] = $ent;
- }
- else {
- //add
- $a_gateways[] = $ent;
- }
-
-
- if (strlen(trim($_POST['dialplan_expression']))> 0) {
-
- $gatewayid = $_POST['gatewayid'];
- $gateway = $_POST['gateway'];
- $context = $_POST['context'];
-
- $default_area_code = &$config['installedpackages']['freeswitchsettings']['config'][0]['default_area_code'];
- $a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config'];
- $a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config'];
-
-
- $tmp_array = split("\\\n", $_POST['dialplan_expression']);
-
- foreach($tmp_array as $dialplan_expression) {
-
- $dialplan_expression = trim($dialplan_expression);
- if (strlen($dialplan_expression)>0) {
-
- switch ($dialplan_expression) {
- case "^(\d{7})$":
- $action_data = "sofia/gateway/".$gateway."/1".$default_area_code."\$1";
- $label = "7 digits";
- $abbrv = "7d";
- break;
- case "^(\d{10})$":
- $action_data = "sofia/gateway/".$gateway."/1\$1";
- $label = "10 digits";
- $abbrv = "10d";
- break;
- case "^(\d{11})$":
- $action_data = "sofia/gateway/".$gateway."/\$1";
- $label = "11 digits";
- $abbrv = "11d";
- break;
- case "^(311)$":
- $action_data = "sofia/gateway/".$gateway."/\$1";
- $label = "311";
- $abbrv = "311";
- break;
- case "^(411)$":
- $action_data = "sofia/gateway/".$gateway."/\$1";
- $label = "411";
- $abbrv = "411";
- break;
- case "^(911)$":
- $action_data = "sofia/gateway/".$gateway."/\$1";
- $label = "911";
- $abbrv = "911";
- break;
- case "^9(\d{3})$":
- $action_data = "sofia/gateway/".$gateway."/1".$default_area_code."\$1";
- $label = "dial 9, 3 digits";
- $abbrv = "9.3d";
- break;
- case "^9(\d{4})$":
- $action_data = "sofia/gateway/".$gateway."/1".$default_area_code."\$1";
- $label = "dial 9, 4 digits";
- $abbrv = "9.4d";
- break;
- case "^9(\d{7})$":
- $action_data = "sofia/gateway/".$gateway."/1".$default_area_code."\$1";
- $label = "dial 9, 7 digits";
- $abbrv = "9.7d";
- break;
- case "^9(\d{10})$":
- $action_data = "sofia/gateway/".$gateway."/\$1";
- $label = "dial 9, 10 digits";
- $abbrv = "9.10d";
- break;
- case "^9(\d{11})$":
- $action_data = "sofia/gateway/".$gateway."/\$1";
- $label = "dial 9, 11 digits";
- $abbrv = "9.11d";
- break;
- case "^1?(8(00|55|66|77|88)[2-9]\d{6})$":
- $action_data = "sofia/gateway/".$gateway."/\$1";
- $label = "toll free";
- $abbrv = "tollfree";
- break;
- default:
- $action_data = "sofia/gateway/".$gateway."/\$1";
- $label = $dialplan_expression;
- $abbrv = $dialplan_expression;
- }
-
- $dialplanincludeid = guid();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['extensionname'] = $gateway.".".$abbrv;
- $ent['order'] = '9002'; //if update use the existing order number and extension name and desc
- $ent['context'] = $context;
- $ent['enabled'] = 'true';
- $ent['descr'] = $label.' '.$gateway;
- $ent['opt1name'] = 'gatewayid';
- $ent['opt1value'] = $gatewayid;
- $a_dialplan_includes[] = $ent;
- unset($ent);
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'condition'; //condition, action, antiaction
- $ent['fieldtype'] = 'destination_number';
- $ent['fielddata'] = $dialplan_expression;
- $ent['fieldorder'] = '000';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
-
- if (strlen($effective_caller_id_name) > 0) {
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldtype'] = 'set';
- $ent['fielddata'] = 'effective_caller_id_name='.$effective_caller_id_name;
- $ent['fieldorder'] = '001';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
- }
- if (strlen($effective_caller_id_number) > 0) {
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldtype'] = 'set';
- $ent['fielddata'] = 'effective_caller_id_number='.$effective_caller_id_number;
- $ent['fieldorder'] = '001';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
- }
- if (strlen($outbound_caller_id_name) > 0) {
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldtype'] = 'set';
- $ent['fielddata'] = 'outbound_caller_id_name='.$outbound_caller_id_name;
- $ent['fieldorder'] = '001';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
- }
- if (strlen($outbound_caller_id_number) > 0) {
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldtype'] = 'set';
- $ent['fielddata'] = 'outbound_caller_id_number='.$outbound_caller_id_number;
- $ent['fieldorder'] = '001';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
- }
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldtype'] = 'bridge';
- $ent['fielddata'] = $action_data;
- $ent['fieldorder'] = '001';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
-
- unset($label);
- unset($abbrv);
- unset($dialplan_expression);
- unset($action_data);
- } //if strlen
- } //end for each
- }
-
- write_config();
- sync_package_freeswitch_gateways();
- sync_package_freeswitch_dialplan_includes();
-
- header("Location: freeswitch_gateways.php");
- exit;
- }
-}
-
-include("head.inc");
-
-?>
-
-
-<script type="text/javascript" language="JavaScript">
-
-function enable_change(enable_over) {
- var endis;
- endis = !(document.iform.enable.checked || enable_over);
- document.iform.range_from.disabled = endis;
- document.iform.range_to.disabled = endis;
-}
-
-function show_advanced_config() {
- document.getElementById("showadvancedbox").innerHTML='';
- aodiv = document.getElementById('showadvanced');
- aodiv.style.display = "block";
-}
-
-</script>
-
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">FreeSWITCH: Gateways: Edit</p>
-<?php if ($input_errors) print_input_errors($input_errors); ?>
-
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-display_top_tabs(build_menu());
-
-?>
-</td></tr>
-</table>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Gateway Setup<br>
- </strong></span>
- The 'SIP Provider Examples' from the FreeSWITCH wiki can be used as reference to get started. <br />
- <a href='http://wiki.freeswitch.org/wiki/SIP_Provider_Examples' target='_blank'>http://wiki.freeswitch.org/wiki/SIP_Provider_Examples</a>
- </p></td>
- </tr>
- </table>
- <br />
-
- <form action="freeswitch_gateways_edit.php" method="post" name="iform" id="iform">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="22%" valign="top" class="vncellreq">Gateway</td>
- <td width="78%" class="vtable">
- <input name="gateway" type="text" class="formfld" id="gateway" size="40" value="<?=htmlspecialchars($pconfig['gateway']);?>">
- <br><span class="vexpl">Enter the gateway name here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Username</td>
- <td width="78%" class="vtable">
- <input name="username" type="text" class="formfld" id="username" size="40" value="<?=htmlspecialchars($pconfig['username']);?>">
- <br><span class="vexpl">Enter the username here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Password</td>
- <td width="78%" class="vtable">
- <input name="password" type="password" class="formfld" id="password" size="40" value="<?=htmlspecialchars($pconfig['password']);?>">
- <br><span class="vexpl">Enter the password here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">From-user</td>
- <td width="78%" class="vtable">
- <input name="from-user" type="text" class="formfld" id="from-user" size="40" value="<?=htmlspecialchars($pconfig['from-user']);?>">
- <br><span class="vexpl">Enter the from-user here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">From-domain</td>
- <td width="78%" class="vtable">
- <input name="from-domain" type="text" class="formfld" id="from-domain" size="40" value="<?=htmlspecialchars($pconfig['from-domain']);?>">
- <br><span class="vexpl">Enter the from-domain here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Proxy</td>
- <td width="78%" class="vtable">
- <input name="proxy" type="text" class="formfld" id="proxy" size="40" value="<?=htmlspecialchars($pconfig['proxy']);?>">
- <br><span class="vexpl">Enter the proxy here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Realm</td>
- <td width="78%" class="vtable">
- <input name="realm" type="text" class="formfld" id="realm" size="40" value="<?=htmlspecialchars($pconfig['realm']);?>">
- <br><span class="vexpl">Enter the realm here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Expire-seconds</td>
- <td width="78%" class="vtable">
- <input name="expire-seconds" type="text" class="formfld" id="expire-seconds" size="40" value="<?=htmlspecialchars($pconfig['expire-seconds']);?>">
- <br><span class="vexpl">Enter the expire-seconds here. Example: 600<br></span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Register</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='register' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['register'])) {
- case "true":
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- break;
- case "false":
- echo " <option value='true'>true</option>\n";
- echo " <option value='false' selected='yes'>false</option>\n";
-
- break;
- default:
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- }
- echo " </select>\n";
- ?>
- Choose whether to register.
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncellreq">Retry-seconds</td>
- <td width="78%" class="vtable">
- <input name="retry-seconds" type="text" class="formfld" id="retry-seconds" size="40" value="<?=htmlspecialchars($pconfig['retry-seconds']);?>">
- <br> <span class="vexpl">Enter the retry_seconds here. Example: 30<br></span>
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncell">Effective Caller ID Name</td>
- <td width="78%" class="vtable">
- <input name="effective_caller_id_name" type="text" class="formfld" id="effective_caller_id_name" size="40" value="<?=htmlspecialchars($pconfig['effective_caller_id_name']);?>">
- <br> <span class="vexpl">Enter the effective caller ID name here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Effective Caller ID Number</td>
- <td width="78%" class="vtable">
- <input name="effective_caller_id_number" type="text" class="formfld" id="effective_caller_id_number" size="40" value="<?=htmlspecialchars($pconfig['effective_caller_id_number']);?>">
- <br> <span class="vexpl">Enter the effective caller ID number here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Outbound Caller ID Name</td>
- <td width="78%" class="vtable">
- <input name="outbound_caller_id_name" type="text" class="formfld" id="outbound_caller_id_name" size="40" value="<?=htmlspecialchars($pconfig['outbound_caller_id_name']);?>">
- <br> <span class="vexpl">Enter the outbound caller ID name here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Outbound Caller ID Number</td>
- <td width="78%" class="vtable">
- <input name="outbound_caller_id_number" type="text" class="formfld" id="outbound_caller_id_number" size="40" value="<?=htmlspecialchars($pconfig['outbound_caller_id_number']);?>">
- <br> <span class="vexpl">Enter the outbound caller ID number here.<br></span>
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncellreq">Context</td>
- <td width="78%" class="vtable">
- <input name="context" type="text" class="formfld" id="context" size="40" value="<?=htmlspecialchars($pconfig['context']);?>">
- <br> <span class="vexpl">Enter the context here. Example: public<br></span>
- </td>
- </tr>
- </table>
- <div id="showadvancedbox">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="22%" valign="top" class="vncell">Show Advanced</td>
- <td width="78%" class="vtable">
- <input type="button" onClick="show_advanced_config()" value="Advanced"></input></a>
- </td>
- </tr>
- </table>
- </div>
- <div id="showadvanced" style="display:none">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="22%" valign="top" class="vncell">Auth-username</td>
- <td width="78%" class="vtable">
- <input name="auth-username" type="text" class="formfld" id="auth-username" size="40" value="<?=htmlspecialchars($pconfig['auth-username']);?>">
- <br> <span class="vexpl">Enter the auth-username here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Register-transport</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='register-transport' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['register-transport'])) {
- case "udp":
- echo " <option value='udp' selected='yes'>udp</option>\n";
- echo " <option value='tcp'>tcp</option>\n";
- echo " <option value='tls'>tls</option>\n";
- break;
- case "tcp":
- echo " <option value='udp'>udp</option>\n";
- echo " <option value='tcp' selected='yes'>tcp</option>\n";
- echo " <option value='tls'>tls</option>\n";
- case "tls":
- echo " <option value='udp'>udp</option>\n";
- echo " <option value='tcp'>tcp</option>\n";
- echo " <option value='tls' selected='yes'>tls</option>\n";
- break;
- default:
- echo " <option value='udp'>udp</option>\n";
- echo " <option value='tcp'>tcp</option>\n";
- echo " <option value='tls'>tls</option>\n";
- }
- echo " </select>\n";
- ?>
- Choose whether to register-transport.
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Extension</td>
- <td width="78%" class="vtable">
- <input name="extension" type="text" class="formfld" id="extension" size="40" value="<?=htmlspecialchars($pconfig['extension']);?>">
- <br> <span class="vexpl">Enter the extension here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Ping</td>
- <td width="78%" class="vtable">
- <input name="ping" type="text" class="formfld" id="ping" size="40" value="<?=htmlspecialchars($pconfig['ping']);?>">
- <br> <span class="vexpl">Enter the ping interval here in seconds.<br></span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Caller-id-in-from</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='caller-id-in-from' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['caller-id-in-from'])) {
- case "true":
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- break;
- case "false":
- echo " <option value='true'>true</option>\n";
- echo " <option value='false' selected='yes'>false</option>\n";
-
- break;
- default:
- echo " <option value='true'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- }
- echo " </select>\n";
- ?>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Supress-cng</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='supress-cng' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['supress-cng'])) {
- case "true":
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- break;
- case "false":
- echo " <option value='true'>true</option>\n";
- echo " <option value='false' selected='yes'>false</option>\n";
-
- break;
- default:
- echo " <option value='true'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- }
- echo " </select>\n";
- ?>
- </td>
- </tr>
- </table>
-
- </div>
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="22%" valign="top" class="vncellreq">Enabled</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='enabled' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['enabled'])) {
- case "true":
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- break;
- case "false":
- echo " <option value='true'>true</option>\n";
- echo " <option value='false' selected='yes'>false</option>\n";
-
- break;
- default:
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- }
- echo " </select>\n";
- ?>
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncell">Dialplan Expression</td>
- <td width="78%" class="vtable">
- <?php
- echo "<textarea name=\"dialplan_expression\" id=\"dialplan_expression\" cols=\"30\" rows=\"4\" wrap=\"off\"></textarea>\n";
- ?>
- <br>
- <select name='dialplan_expression_select' id='dialplan_expression_select' onchange="document.getElementById('dialplan_expression').value += document.getElementById('dialplan_expression_select').value + '\n';" class='formfld'>
- <option></option>
- <option value='^(\d{7})$'>7 digits local</option>
- <option value='^(\d{10})$'>10 digits long distance</option>
- <option value='^(\d{11})$'>11 digits long distance</option>
- <option value='^011(.*)$'>011 International</option>
- <option value='^311$'>311 information</option>
- <option value='^411$'>411 information</option>
- <option value='^911$'>911 emergency</option>
- <option value='^1?(8(00|55|66|77|88)[2-9]\d{6})$'>toll free</option>
- <option value='^9(\d{3})$'>Dial 9 then 3 digits</option>
- <option value='^9(\d{4})$'>Dial 9 then 4 digits</option>
- <option value='^9(\d{7})$'>Dial 9 then 7 digits</option>
- <option value='^9(\d{10})$'>Dial 9 then 10 digits</option>
- <option value='^9(\d{11})$'>Dial 9 then 11 digits</option>
- </select>
- <span class="vexpl">
- <br />
- Shortcut to create the outbound dialplan entries for this Gateway. The entries are saved to and edited from the 'Dialplan' tab.
- </span></td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncell">Gateway Description</td>
- <td width="78%" class="vtable">
- <input name="description" type="text" class="formfld" id="description" size="40" value="<?=htmlspecialchars($pconfig['description']);?>">
- <br> <span class="vexpl">Enter the description of the gateway here.</span></td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()">
- <?php if (isset($id) && $a_gateways[$id]): ?>
- <input name="id" type="hidden" value="<?=$id;?>">
- <input name="gatewayid" type="hidden" value="<?=htmlspecialchars($pconfig['gatewayid']);?>">
- <?php endif; ?>
- </td>
- </tr>
- </table>
- </form>
-
- <br>
- <br>
- <br>
- <br>
- <br>
- <br>
-
- </td>
- </tr>
-</table>
-
-</div>
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch/freeswitch_hunt_group.tmp b/config/freeswitch/freeswitch_hunt_group.tmp
deleted file mode 100644
index ea3fe44d..00000000
--- a/config/freeswitch/freeswitch_hunt_group.tmp
+++ /dev/null
@@ -1,206 +0,0 @@
-<?php
-/* $Id$ */
-/*
- freeswitch_hunt_group.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/freeswitch.inc");
-
-
-$a_hunt_group = &$config['installedpackages']['freeswitchhuntgroup']['config'];
-$a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config'];
-$a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config'];
-
-if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'huntgroup') {
- if ($a_hunt_group[$_GET['id']]) {
- if (file_exists("/usr/local/freeswitch/scripts/huntgroup_".$_GET['huntgroupid'].".js")) {
- unlink("/usr/local/freeswitch/scripts/huntgroup_".$_GET['huntgroupid'].".js");
- }
- /*
- //delete dialplan include details
- if (count($a_dialplan_includes) > 0) {
- $i = 0;
- foreach($a_dialplan_includes as $row) {
- echo $row['opt1value']." == {".$_GET['huntgroupid']."}<br />\n";
- if ($row['opt1value'] == '{'.$_GET['huntgroupid'].'}') {
- $dialplanincludeid = $row['dialplanincludeid'];
- $id = $i;
- unset($a_dialplan_include_details[$id]);
- }
- $i++;
- }
- unset($i);
- }
-
- //delete dialplan include details
- if (count($a_dialplan_include_details) > 0) {
- $i = 0;
- foreach($a_dialplan_include_details as $row) {
- if ($row['dialplanincludeid'] == $dialplanincludeid) {
- $id = $i;
- unset($a_dialplan_include_details[$id]);
- }
- $i++;
- }
- unset($i);
- }
- */
- unset($a_hunt_group[$_GET['id']]);
- write_config();
- sync_package_freeswitch_hunt_group();
- header("Location: freeswitch_hunt_group.php");
- exit;
- }
- }
-}
-
-include("head.inc");
-
-?>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">FreeSWITCH: Hunt Group</p>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-display_top_tabs(build_menu());
-
-?>
-</td></tr>
-</table>
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
-<form action="freeswitch_hunt_group.php" method="post" name="iform" id="iform">
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Hunt Group<br />
- </strong></span>
- Hunt Group is a group of destinations to call at once or in succession.
- </span></p></td>
- </tr>
- </table>
- <br />
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="20%" class="listhdrr">Extension</td>
- <td width="25%" class="listhdrr">Name</td>
- <td width="50%" class="listhdr">Description</td>
- <td width="10%" class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="freeswitch_hunt_group_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
-
- <?php
- $i = 0;
- if (count($a_hunt_group) > 0) {
- foreach ($a_hunt_group as $ent) {
- if (strlen($ent['huntgroupid']) > 0) {
-
- $huntgroupid = str_replace(array("{", "}"), "", $ent['huntgroupid']);
-
- ?>
- <tr>
- <td class="listlr" ondblclick="document.location='freeswitch_hunt_group_edit.php?id=<?=$i;?>'">
- <?=$ent['huntgroupextension']?>
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_hunt_group_edit.php?id=<?=$i;?>';">
- <?=$ent['huntgroupname'];?>&nbsp;
- </td>
- <td class="listbg" ondblclick="document.location='freeswitch_hunt_group_edit.php?id=<?=$i;?>';">
- <font color="#FFFFFF"><?=htmlspecialchars($ent['huntgroupdescr']);?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="freeswitch_hunt_group_edit.php?id=<?=$i;?>&huntgroupid=<?php echo $ent['huntgroupid'];?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="freeswitch_hunt_group.php?type=huntgroup&act=del&id=<?=$i;?>&huntgroupid=<?php echo $huntgroupid; ?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
- }
- $i++;
- }
- }
- ?>
- <tr>
- <td class="list" colspan="3"></td>
- <td class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="freeswitch_hunt_group_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
-
- <tr>
- <td class="list" colspan="3"></td>
- <td class="list"></td>
- </tr>
- </table>
-
-</form>
-
-<br>
-<br>
-/usr/local/freeswitch/scripts/
-<br>
-<br>
-<br>
-<br>
-
-</td>
-</tr>
-</table>
-
-</div>
-
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch/freeswitch_hunt_group_destinations.tmp b/config/freeswitch/freeswitch_hunt_group_destinations.tmp
deleted file mode 100644
index 7f1adaf0..00000000
--- a/config/freeswitch/freeswitch_hunt_group_destinations.tmp
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-/* $Id$ */
-/*
- freeswitch_hunt_group_destinations.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/freeswitch.inc");
-
-
-$a_hunt_group_destinations = &$config['installedpackages']['freeswitchhuntgroupdestinations']['config'];
-
-
-if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'huntgroupdestinations') {
- if ($a_hunt_group_destinations[$_GET['id']]) {
- unset($a_hunt_group_destinations[$_GET['id']]);
- write_config();
- sync_package_freeswitch_hunt_group();
- header("Location: freeswitch_hunt_group_edit.php?id=".$_GET['parentid']);
- exit;
- }
- }
-}
-
-?> \ No newline at end of file
diff --git a/config/freeswitch/freeswitch_hunt_group_destinations_edit.tmp b/config/freeswitch/freeswitch_hunt_group_destinations_edit.tmp
deleted file mode 100644
index 4d6d1c01..00000000
--- a/config/freeswitch/freeswitch_hunt_group_destinations_edit.tmp
+++ /dev/null
@@ -1,269 +0,0 @@
-<?php
-/* $Id$ */
-/*
-
- freeswitch_hunt_group_destinations_edit.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/freeswitch.inc");
-
-
-$a_hunt_group_destinations = &$config['installedpackages']['freeswitchhuntgroupdestinations']['config'];
-
-
-$id = $_GET['id'];
-if (isset($_POST['id'])) {
- $id = $_POST['id'];
-}
-
-$parentid = $_GET['parentid'];
-if (isset($_POST['parentid'])) {
- $parentid = $_POST['parentid'];
-}
-
-$huntgroupid = $_GET['huntgroupid'];
-if (isset($_POST['huntgroupid'])) {
- $huntgroupid = $_POST['huntgroupid'];
-}
-
-
-if (isset($id) && $a_hunt_group_destinations[$id]) {
- $pconfig['destinationnumber'] = $a_hunt_group_destinations[$id]['destinationnumber'];
- $pconfig['destinationtype'] = $a_hunt_group_destinations[$id]['destinationtype'];
- $pconfig['destinationprofile'] = $a_hunt_group_destinations[$id]['destinationprofile'];
- $pconfig['destinationorder'] = $a_hunt_group_destinations[$id]['destinationorder'];
- $pconfig['destinationdescr'] = $a_hunt_group_destinations[$id]['destinationdescr'];
-}
-else {
- if (isset($_GET['a'])) {
- //if ($_GET['a'] == "action"){ $pconfig['destinationaction'] = "action"; }
- //if ($_GET['a'] == "antiaction"){ $pconfig['destinationaction'] = "anti-action"; }
- }
-}
-
-
-if ($_POST) {
-
- unset($input_errors);
- $pconfig = $_POST;
-
-
- if (!$input_errors) {
-
- $huntgroupdestinationent = array();
- $huntgroupdestinationent['huntgroupid'] = $_POST['huntgroupid'];
- $huntgroupdestinationent['destinationnumber'] = $_POST['destinationnumber'];
- $huntgroupdestinationent['destinationtype'] = $_POST['destinationtype'];
- $huntgroupdestinationent['destinationprofile'] = $_POST['destinationprofile'];
- $huntgroupdestinationent['destinationorder'] = $_POST['destinationorder'];
- $huntgroupdestinationent['destinationdescr'] = $_POST['destinationdescr'];
-
- if (isset($id) && $a_hunt_group_destinations[$id]) {
- //update
- $a_hunt_group_destinations[$id] = $huntgroupdestinationent;
- }
- else {
- //add
- $a_hunt_group_destinations[] = $huntgroupdestinationent;
- }
-
-
- write_config();
- sync_package_freeswitch_hunt_group();
-
- header("Location: freeswitch_hunt_group_edit.php?id=".$parentid);
- exit;
- }
-}
-
-include("head.inc");
-
-?>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">FreeSWITCH: Hunt Group: Destinations: Edit</p>
-<?php if ($input_errors) print_input_errors($input_errors); ?>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-display_top_tabs(build_menu());
-
-?>
-</td></tr>
-</table>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
- <br />
- <form action="freeswitch_hunt_group_destinations_edit.php" method="post" name="iform" id="iform">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="22%" valign="top" class="vncellreq">Destination</td>
- <td width="78%" class="vtable">
- <input name="destinationnumber" type="text" class="formfld" id="destinationnumber" size="40" value="<?=htmlspecialchars($pconfig['destinationnumber']);?>">
- <br>
- <span class="vexpl">
- <!--<b>examples:</b><br />-->
- extension: 1001<br />
- voicemail: 1001<br />
- sip uri (voicemail): sofia/internal/*98@${domain}<br />
- sip uri (external number): sofia/gateway/gatewayname/12081231234<br />
- sip uri (auto attendant): sofia/internal/5002@${domain}<br />
- </span>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Type</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='destinationtype' class='formfld'>\n";
- echo " <option></option>\n";
- if (htmlspecialchars($pconfig['destinationtype']) == "extension") {
- echo " <option selected='yes'>extension</option>\n";
- }
- else {
- echo " <option>extension</option>\n";
- }
- if (htmlspecialchars($pconfig['destinationtype']) == "voicemail") {
- echo " <option selected='yes'>voicemail</option>\n";
- }
- else {
- echo " <option>voicemail</option>\n";
- }
- if (htmlspecialchars($pconfig['destinationtype']) == "sip uri") {
- echo " <option selected='yes'>sip uri</option>\n";
- }
- else {
- echo " <option>sip uri</option>\n";
- }
- echo " </select>\n";
- ?>
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncellreq">Profile</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='destinationprofile' class='formfld'>\n";
- echo " <option></option>\n";
- if (htmlspecialchars($pconfig['destinationprofile']) == "auto") {
- echo " <option selected='yes'>auto</option>\n";
- }
- else {
- echo " <option>auto</option>\n";
- }
- foreach (ListFiles('/usr/local/freeswitch/conf/sip_profiles') as $key=>$sip_profile_file){
- $sip_profile_name = str_replace(".xml", "", $sip_profile_file);
-
- if (htmlspecialchars($pconfig['destinationprofile']) == $sip_profile_name) {
- echo " <option selected='yes'>$sip_profile_name</option>\n";
- }
- else {
- echo " <option>$sip_profile_name</option>\n";
- }
- }
- echo " </select>\n";
-
-
- ?>
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncell">Order</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='destinationorder' class='formfld'>\n";
- //echo " <option></option>\n";
- if (strlen(htmlspecialchars($pconfig['destinationorder']))> 0) {
- echo " <option selected='yes' value='".htmlspecialchars($pconfig['destinationorder'])."'>".htmlspecialchars($pconfig['destinationorder'])."</option>\n";
- }
- $i=0;
- while($i<=999) {
- if (strlen($i) == 1) {
- echo " <option value='00$i'>00$i</option>\n";
- }
- if (strlen($i) == 2) {
- echo " <option value='0$i'>0$i</option>\n";
- }
- if (strlen($i) == 3) {
- echo " <option value='$i'>$i</option>\n";
- }
-
- $i++;
- }
- echo " </select>\n";
- ?>
- <br />
- Processing of each destination is determined by this order.
-
- <br> <span class="vexpl"></span></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Description</td>
- <td width="78%" class="vtable">
- <input name="destinationdescr" type="text" class="formfld" id="destinationdescr" size="40" value="<?=htmlspecialchars($pconfig['destinationdescr']);?>">
- <br> <span class="vexpl">You may enter a description here
- for your reference (not parsed).</span></td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="huntgroupid" type="hidden" value="<?=$huntgroupid;?>">
- <input name="parentid" type="hidden" value="<?=$parentid;?>">
- <?php if (isset($id) && $a_hunt_group_destinations[$id]): ?>
- <input name="id" type="hidden" value="<?=$id;?>">
- <?php endif; ?>
- <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()">
- </td>
- </tr>
- </table>
- </form>
-
- <br>
- <br>
- <br>
- <br>
- <br>
- <br>
-
- </td>
- </tr>
-</table>
-
-</div>
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch/freeswitch_hunt_group_edit.tmp b/config/freeswitch/freeswitch_hunt_group_edit.tmp
deleted file mode 100644
index fe22a78e..00000000
--- a/config/freeswitch/freeswitch_hunt_group_edit.tmp
+++ /dev/null
@@ -1,509 +0,0 @@
-<?php
-/* $Id$ */
-/*
-
- freeswitch_hunt_group_edit.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/freeswitch.inc");
-
-
-$a_hunt_group = &$config['installedpackages']['freeswitchhuntgroup']['config'];
-$a_hunt_group_destinations = &$config['installedpackages']['freeswitchhuntgroupdestinations']['config'];
-
-
-$id = $_GET['id'];
-if (isset($_POST['id'])) {
- $id = $_POST['id'];
-}
-$parentid = $id;
-
-
-
-if (isset($id) && $a_hunt_group[$id]) {
- $pconfig['huntgroupid'] = $a_hunt_group[$id]['huntgroupid'];
- $huntgroupid = $a_hunt_group[$id]['huntgroupid'];
- $pconfig['huntgroupextension'] = $a_hunt_group[$id]['huntgroupextension'];
- $pconfig['huntgroupname'] = $a_hunt_group[$id]['huntgroupname'];
- $pconfig['huntgrouptype'] = $a_hunt_group[$id]['huntgrouptype'];
- $pconfig['huntgroupcontext'] = $a_hunt_group[$id]['huntgroupcontext'];
- $pconfig['huntgrouptimeout'] = $a_hunt_group[$id]['huntgrouptimeout'];
- $pconfig['huntgrouptimeoutdestination'] = $a_hunt_group[$id]['huntgrouptimeoutdestination'];
- $pconfig['huntgrouptimeouttype'] = $a_hunt_group[$id]['huntgrouptimeouttype'];
- $pconfig['huntgroupringback'] = $a_hunt_group[$id]['huntgroupringback'];
- $pconfig['huntgroupcidnameprefix'] = $a_hunt_group[$id]['huntgroupcidnameprefix'];
- $pconfig['huntgrouppin'] = $a_hunt_group[$id]['huntgrouppin'];
- $pconfig['huntgroupcallerannounce'] = $a_hunt_group[$id]['huntgroupcallerannounce'];
- $pconfig['huntgroupdescr'] = $a_hunt_group[$id]['huntgroupdescr'];
-}
-
-if ($_POST) {
-
- unset($input_errors);
- $pconfig = $_POST;
-
- if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'destinations') {
- if ($a_hunt_group_destinations[$_GET['optionid']]) {
- unset($a_hunt_group_destinations[$_GET['optionid']]);
- write_config();
- sync_package_freeswitch_hunt_group();
- header("Location: freeswitch_hunt_group_edit.php?id=".$_GET['id']);
- exit;
- }
- }
- }
-
-
- if (!$input_errors) {
-
- $huntgroupent = array();
- if (strlen($_POST['huntgroupid']) > 0) {
- $huntgroupent['huntgroupid'] = $_POST['huntgroupid'];
- }
- else {
- $huntgroupent['huntgroupid'] = guid();
- }
- $huntgroupent['huntgroupextension'] = $_POST['huntgroupextension'];
- $huntgroupent['huntgroupname'] = $_POST['huntgroupname'];
- $huntgroupent['huntgrouptype'] = $_POST['huntgrouptype'];
- $huntgroupent['huntgroupcontext'] = $_POST['huntgroupcontext'];
- $huntgroupent['huntgrouptimeout'] = $_POST['huntgrouptimeout'];
- $huntgroupent['huntgrouptimeoutdestination'] = $_POST['huntgrouptimeoutdestination'];
- $huntgroupent['huntgrouptimeouttype'] = $_POST['huntgrouptimeouttype'];
- $huntgroupent['huntgroupringback'] = $_POST['huntgroupringback'];
- $huntgroupent['huntgroupcidnameprefix'] = $_POST['huntgroupcidnameprefix'];
- $huntgroupent['huntgrouppin'] = $_POST['huntgrouppin'];
- $huntgroupent['huntgroupcallerannounce'] = $_POST['huntgroupcallerannounce'];
- $huntgroupent['huntgroupdescr'] = $_POST['huntgroupdescr'];
-
- if (isset($id) && $a_hunt_group[$id]) {
- //update
- $a_hunt_group[$id] = $huntgroupent;
- }
- else {
- //add
- $a_hunt_group[] = $huntgroupent;
- }
-
- //touch($d_hostsdirty_path);
- write_config();
- sync_package_freeswitch_hunt_group();
-
- header("Location: freeswitch_hunt_group.php");
- exit;
- }
-}
-
-include("head.inc");
-
-?>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">FreeSWITCH: Hunt Group: Edit</p>
-<?php if ($input_errors) print_input_errors($input_errors); ?>
-
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-display_top_tabs(build_menu());
-
-?>
-</td></tr>
-</table>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>General Settings:<br>
- </strong></span>
- Hunt Group general settings.
- </span></p></td>
- </tr>
- </table>
- <br />
-
- <form action="freeswitch_hunt_group_edit.php" method="post" name="iform" id="iform">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="22%" valign="top" class="vncellreq">Extension</td>
- <td width="78%" class="vtable">
- <input name="huntgroupextension" type="text" class="formfld" id="huntgroupextension" size="40" value="<?=htmlspecialchars($pconfig['huntgroupextension']);?>">
- <br> <span class="vexpl">e.g. <em>7002</em></span></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Hunt Group Name</td>
- <td width="78%" class="vtable">
- <input name="huntgroupname" type="text" class="formfld" id="huntgroupname" size="40" value="<?=htmlspecialchars($pconfig['huntgroupname']);?>">
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncellreq">Type</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='huntgrouptype' class='formfld'>\n";
- echo " <option></option>\n";
- if (htmlspecialchars($pconfig['huntgrouptype']) == "simultaneous") {
- echo " <option selected='yes'>simultaneous</option>\n";
- }
- else {
- echo " <option>simultaneous</option>\n";
- }
- if (htmlspecialchars($pconfig['huntgrouptype']) == "sequentially") {
- echo " <option selected='yes'>sequentially</option>\n";
- }
- else {
- echo " <option>sequentially</option>\n";
- }
- echo " </select>\n";
- ?>
- </td>
- </tr>
-
- <?php
- if (strlen($pconfig['huntgrouptimeout']) == 0) {
- $pconfig['huntgrouptimeout'] = 30; //set a default timeout
- }
- ?>
- <tr>
- <td width="22%" valign="top" class="vncell">Context</td>
- <td width="78%" class="vtable">
- <input name="huntgroupcontext" type="text" class="formfld" id="huntgroupextension" size="40" value="<?=htmlspecialchars($pconfig['huntgroupcontext']);?>">
- <br> <span class="vexpl">e.g. <em>default</em></span></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Timeout</td>
- <td width="78%" class="vtable">
- <input name="huntgrouptimeout" type="text" class="formfld" id="huntgrouptimeout" size="40" value="<?=htmlspecialchars($pconfig['huntgrouptimeout']);?>">
- <br>
- <span class="vexpl">
- The timeout sets the time in seconds to continue to call before timing out.
- </span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Timeout Type</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='huntgrouptimeouttype' class='formfld'>\n";
- echo " <option></option>\n";
- if (htmlspecialchars($pconfig['huntgrouptimeouttype']) == "extension") {
- echo " <option selected='yes'>extension</option>\n";
- }
- else {
- echo " <option>extension</option>\n";
- }
- if (htmlspecialchars($pconfig['huntgrouptimeouttype']) == "voicemail") {
- echo " <option selected='yes'>voicemail</option>\n";
- }
- else {
- echo " <option>voicemail</option>\n";
- }
- if (htmlspecialchars($pconfig['huntgrouptimeouttype']) == "sip uri") {
- echo " <option selected='yes'>sip uri</option>\n";
- }
- else {
- echo " <option>sip uri</option>\n";
- }
- echo " </select>\n";
- ?>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Timeout Destination</td>
- <td width="78%" class="vtable">
- <input name="huntgrouptimeoutdestination" type="text" class="formfld" id="huntgrouptimeoutdestination" size="40" value="<?=htmlspecialchars($pconfig['huntgrouptimeoutdestination']);?>">
- <br> <span class="vexpl">Destination<br>
- e.g. <em>1001</em></span></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Ring Back</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='huntgroupringback' class='formfld'>\n";
- echo " <option></option>\n";
- if (htmlspecialchars($pconfig['huntgroupringback']) == "ring") {
- echo " <option selected='yes'>ring</option>\n";
- }
- else {
- echo " <option>ring</option>\n";
- }
- if (htmlspecialchars($pconfig['huntgroupringback']) == "music") {
- echo " <option selected='yes'>music</option>\n";
- }
- else {
- echo " <option>music</option>\n";
- }
- echo " </select>\n";
- ?>
- <br>
- <span class="vexpl">
- Defines what the caller will hear while destination is being called. The choices are music
- (music on hold) ring (ring tone.) default: music
- </span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">CID Prefix</td>
- <td width="78%" class="vtable">
- <input name="huntgroupcidnameprefix" type="text" class="formfld" id="huntgroupcidnameprefix" size="40" value="<?=htmlspecialchars($pconfig['huntgroupcidnameprefix']);?>">
- <br>
- <span class="vexpl">
- Set a prefix on the caller ID name. (optional)
- </span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">PIN</td>
- <td width="78%" class="vtable">
- <input name="huntgrouppin" type="text" class="formfld" id="huntgrouppin" size="40" value="<?=htmlspecialchars($pconfig['huntgrouppin']);?>">
- <br>
- <span class="vexpl">
- If this is provided then the caller will be required to enter the PIN number. (optional)
- </span>
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncell">Caller Announce</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='huntgroupcallerannounce' class='formfld'>\n";
- echo " <option></option>\n";
- if (htmlspecialchars($pconfig['huntgroupcallerannounce']) == "true") {
- echo " <option selected='yes'>true</option>\n";
- }
- else {
- echo " <option>true</option>\n";
- }
- if (htmlspecialchars($pconfig['huntgroupcallerannounce']) == "false") {
- echo " <option selected='yes'>false</option>\n";
- }
- else {
- echo " <option>false</option>\n";
- }
- echo " </select>\n";
- ?>
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncell">Description</td>
- <td width="78%" class="vtable">
- <input name="huntgroupdescr" type="text" class="formfld" id="descr" size="40" value="<?=htmlspecialchars($pconfig['huntgroupdescr']);?>">
- <br>
- <span class="vexpl">
- You may enter a description here for your reference (not parsed).
- </span>
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()">
- <input name="huntgroupid" type="hidden" value="<?=htmlspecialchars($pconfig['huntgroupid']);?>">
- <?php if (isset($id) && $a_hunt_group[$id]): ?>
- <input name="id" type="hidden" value="<?=$id;?>">
- <?php endif; ?>
- </td>
- </tr>
- </table>
- </form>
-
- <br>
- <br>
-
- <form action="freeswitch_hunt_group_edit.php" method="post" name="iform2" id="iform2">
- <?php
-
-
- //echo "<pre>";
- //print_r ($a_hunt_group);
- //echo "</pre>";
-
- //if ($savemsg) print_info_box($savemsg);
- //if (file_exists($d_hostsdirty_path)): echo"<p>";
- //print_info_box_np("The FreeSWITCH recordings have been changed.<br>You must apply the changes in order for them to take effect.");
- //echo"<br />";
- //endif;
-
- ?>
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Destinations<br />
- </strong></span>
- The following destinations will be called.
- </span></p></td>
- </tr>
- </table>
- <br />
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="40%" class="listhdrr">Destination</td>
- <td width="40" class="listhdrr">Type</td>
- <td width="40" class="listhdrr">Profile</td>
- <td width="40" class="listhdrr">Order</td>
- <td width="45%" class="listhdr">Description</td>
- <td width="30" class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle">
- <?php if (strlen($huntgroupid) > 1) { ?>
- <a href="freeswitch_hunt_group_destinations_edit.php?parentid=<?=$parentid;?>&huntgroupid=<?=$huntgroupid;?>&a=action"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- <?php } ?>
- </tr>
- </table>
- </td>
- </tr>
-
- <?php
- //create a temporary id for the array
- $i = 0;
- if (count($a_hunt_group_destinations) > 0) {
- foreach ($a_hunt_group_destinations as $ent) {
- $a_hunt_group_destinations[$i]['id'] = $i;
- $i++;
- }
- }
-
- //order the array
- function cmp_number($a, $b) {
- if ($a["destinationorder"] > $b["destinationorder"]) {
- return 1;
- }
- else {
- return 0;
- }
- }
- if (count($a_hunt_group_destinations) > 0) { usort($a_hunt_group_destinations, "cmp_number"); }
-
- $i = 0;
- if (count($a_hunt_group_destinations) > 0) {
- foreach ($a_hunt_group_destinations as $ent) {
- if ($huntgroupid == $ent['huntgroupid']) {
- ?>
- <tr>
- <td class="listlr" ondblclick="document.location='freeswitch_hunt_group_destinations_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&huntgroupid=<?=$huntgroupid;?>'">
- <?=$ent['destinationnumber']?>
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_hunt_group_destinations_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&huntgroupid=<?=$huntgroupid;?>';">
- <?=$ent['destinationtype'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_hunt_group_destinations_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&huntgroupid=<?=$huntgroupid;?>';">
- <?=$ent['destinationprofile'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_hunt_group_destinations_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&huntgroupid=<?=$huntgroupid;?>';">
- <?=$ent['destinationorder'];?>&nbsp;
- </td>
- <td class="listbg" ondblclick="document.location='freeswitch_hunt_group_destinations_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&huntgroupid=<?=$huntgroupid;?>';">
- <font color="#FFFFFF"><?=htmlspecialchars($ent['destinationdescr']);?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <?php
- if (strlen($huntgroupid) > 1) {
- echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n";
- echo " <tr>\n";
- echo " <td valign=\"middle\"><a href=\"freeswitch_hunt_group_destinations_edit.php?id=".$ent['id']."&parentid=".$parentid."&huntgroupid=".$huntgroupid."\"><img src=\"/themes/".$g['theme']."/images/icons/icon_e.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n";
- echo " <td><a href=\"freeswitch_hunt_group_destinations.php?type=huntgroupdestinations&act=del&id=".$ent['id']."&parentid=".$parentid."&huntgroupid=".$huntgroupid."\" onclick=\"return confirm('Do you really want to delete this recording?')\"><img src=\"/themes/".$g['theme']."/images/icons/icon_x.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n";
- echo " </tr>\n";
- echo "</table>\n";
- }
- ?>
- </td>
- </tr>
- <?php
- }
- $i++;
- }
- }
- ?>
- <tr>
- <td class="list" colspan="5"></td>
- <td class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle">
- <?php if (strlen($huntgroupid) > 1) { ?>
- <a href="freeswitch_hunt_group_destinations_edit.php?parentid=<?=$parentid;?>&huntgroupid=<?=$huntgroupid;?>&a=action"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a>
- <?php } ?>
- </td>
- </tr>
- </table>
- </td>
- </tr>
-
-
- <tr>
- <td class="list" colspan="5"></td>
- <td class="list"></td>
- </tr>
- </table>
-
- </form>
-
-
-
-
- </td>
- </tr>
-
-
- <tr>
- <td class="list" colspan="4"></td>
- <td class="list"></td>
- </tr>
- </table>
-
-
-
- <br>
- <br>
-
- </td>
- </tr>
-</table>
-
-</div>
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch/freeswitch_ivr.tmp b/config/freeswitch/freeswitch_ivr.tmp
deleted file mode 100644
index c1e53dff..00000000
--- a/config/freeswitch/freeswitch_ivr.tmp
+++ /dev/null
@@ -1,177 +0,0 @@
-<?php
-/* $Id$ */
-/*
- freeswitch_ivr.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/freeswitch.inc");
-
-
-$a_ivr = &$config['installedpackages']['freeswitchivr']['config'];
-
-
-if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'ivr') {
- if ($a_ivr[$_GET['id']]) {
- unlink("/usr/local/freeswitch/scripts/ivr_".$_GET['ivrid'].".js");
- unset($a_ivr[$_GET['id']]);
- write_config();
- sync_package_freeswitch_ivr();
- header("Location: freeswitch_ivr.php");
- exit;
- }
- }
-}
-
-include("head.inc");
-
-?>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">FreeSWITCH: IVR</p>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-display_top_tabs(build_menu());
-
-?>
-</td></tr>
-</table>
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
-<form action="freeswitch_ivr.php" method="post" name="iform" id="iform">
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>IVR<br />
- </strong></span>
- An interactive voice response (IVR) often refered to as an Auto Attendant.
- It associates a recording to multiple options that can be used to direct calls
- to extensions, voicemail, queues, other IVR applications, and external
- phone numbers.
- </span></p></td>
- </tr>
- </table>
- <br />
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="20%" class="listhdrr">Extension</td>
- <td width="25%" class="listhdrr">Name</td>
- <td width="50%" class="listhdr">Description</td>
- <td width="10%" class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="freeswitch_ivr_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
-
- <?php
- $i = 0;
- if (count($a_ivr) > 0) {
- foreach ($a_ivr as $ent) {
- if (strlen($ent['ivrid']) > 0) {
-
- $ivrid = str_replace(array("{", "}"), "", $ent['ivrid']);
-
- ?>
- <tr>
- <td class="listlr" ondblclick="document.location='freeswitch_ivr_edit.php?id=<?=$i;?>'">
- <?=$ent['ivrextension']?>
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_ivr_edit.php?id=<?=$i;?>';">
- <?=$ent['ivrname'];?>&nbsp;
- </td>
- <td class="listbg" ondblclick="document.location='freeswitch_ivr_edit.php?id=<?=$i;?>';">
- <font color="#FFFFFF"><?=htmlspecialchars($ent['ivrdescr']);?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="freeswitch_ivr_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="freeswitch_ivr.php?type=ivr&act=del&id=<?=$i;?>&ivrid=<?php echo $ivrid; ?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
- }
- $i++;
- }
- }
- ?>
- <tr>
- <td class="list" colspan="3"></td>
- <td class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="freeswitch_ivr_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
-
- <tr>
- <td class="list" colspan="3"></td>
- <td class="list"></td>
- </tr>
- </table>
-
-</form>
-
-<br>
-<br>
-/usr/local/freeswitch/scripts/
-<br>
-<br>
-<br>
-<br>
-
-</td>
-</tr>
-</table>
-
-</div>
-
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch/freeswitch_ivr_edit.tmp b/config/freeswitch/freeswitch_ivr_edit.tmp
deleted file mode 100644
index 6b64994e..00000000
--- a/config/freeswitch/freeswitch_ivr_edit.tmp
+++ /dev/null
@@ -1,697 +0,0 @@
-<?php
-/* $Id$ */
-/*
-
- freeswitch_ivr_edit.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/freeswitch.inc");
-
-
-$a_ivr = &$config['installedpackages']['freeswitchivr']['config'];
-$a_ivr_options = &$config['installedpackages']['freeswitchivroptions']['config'];
-
-
-$id = $_GET['id'];
-if (isset($_POST['id'])) {
- $id = $_POST['id'];
-}
-$parentid = $id;
-
-//set default $ivrconditionjs
- $ivrconditionjs = "function isholiday( Month, Date ) {\n";
- $ivrconditionjs .= " var Holiday = 0; //default false\n";
- $ivrconditionjs .= " if (Month == \"12\" && Date == \"25\") {\n";
- $ivrconditionjs .= " Holiday = 1; //true\n";
- $ivrconditionjs .= " }\n";
- $ivrconditionjs .= " if (Month == \"7\" && Date == \"4\") {\n";
- $ivrconditionjs .= " Holiday = 1; //true\n";
- $ivrconditionjs .= " }\n";
- $ivrconditionjs .= " if (Month == \"1\" && Date == \"1\") {\n";
- $ivrconditionjs .= " Holiday = 1; //true\n";
- $ivrconditionjs .= " }\n";
- $ivrconditionjs .= " if (Holiday == 1) {\n";
- $ivrconditionjs .= " return true;\n";
- $ivrconditionjs .= " }\n";
- $ivrconditionjs .= " else {\n";
- $ivrconditionjs .= " return false;\n";
- $ivrconditionjs .= " }\n";
- $ivrconditionjs .= "}\n";
- $ivrconditionjs .= "\n";
- $ivrconditionjs .= "function isweekday( Day ) {\n";
- $ivrconditionjs .= " if (Day > 1 && Day < 7) {\n";
- $ivrconditionjs .= " return true;\n";
- $ivrconditionjs .= " }\n";
- $ivrconditionjs .= " else {\n";
- $ivrconditionjs .= " return false;\n";
- $ivrconditionjs .= " }\n";
- $ivrconditionjs .= "}\n";
- $ivrconditionjs .= "\n";
- $ivrconditionjs .= "function isweekend( Day ) {\n";
- $ivrconditionjs .= " if (Day > 1 && Day < 7) {\n";
- $ivrconditionjs .= " return false;\n";
- $ivrconditionjs .= " }\n";
- $ivrconditionjs .= " else {\n";
- $ivrconditionjs .= " return true;\n";
- $ivrconditionjs .= " }\n";
- $ivrconditionjs .= "}\n";
- $ivrconditionjs .= "\n";
- $ivrconditionjs .= "function isofficehours( Hours ) {\n";
- $ivrconditionjs .= " if (Hours >= 9 && Hours < 17) {\n";
- $ivrconditionjs .= " return true;\n";
- $ivrconditionjs .= " }\n";
- $ivrconditionjs .= " else {\n";
- $ivrconditionjs .= " return false;\n";
- $ivrconditionjs .= " }\n";
- $ivrconditionjs .= "}\n";
- $ivrconditionjs .= "\n";
- $ivrconditionjs .= "function isafterhours( Hours ) {\n";
- $ivrconditionjs .= " if (Hours >= 9 && Hours < 17) {\n";
- $ivrconditionjs .= " return false;\n";
- $ivrconditionjs .= " }\n";
- $ivrconditionjs .= " else {\n";
- $ivrconditionjs .= " return true;\n";
- $ivrconditionjs .= " }\n";
- $ivrconditionjs .= "}\n";
- $ivrconditionjs .= "\n";
- $ivrconditionjs .= "//set default\n";
- $ivrconditionjs .= "condition = true;\n";
- $ivrconditionjs .= "\n";
- $ivrconditionjs .= "//Holiday?\n";
- $ivrconditionjs .= "if (isholiday( Month, Date )) {\n";
- $ivrconditionjs .= " console_log( \"info\", \"holiday\\n\" );\n";
- $ivrconditionjs .= " condition = false;\n";
- $ivrconditionjs .= "}\n";
- $ivrconditionjs .= "\n";
- $ivrconditionjs .= "//Weekend?\n";
- $ivrconditionjs .= "if (isweekend( Day )) {\n";
- $ivrconditionjs .= " console_log( \"info\", \"weekend\\n\" );\n";
- $ivrconditionjs .= " condition = false;\n";
- $ivrconditionjs .= "}\n";
- $ivrconditionjs .= "\n";
- $ivrconditionjs .= "// After Hours?\n";
- $ivrconditionjs .= "if (isafterhours( Hours )) {\n";
- $ivrconditionjs .= " console_log( \"info\", \"after hours\\n\" );\n";
- $ivrconditionjs .= " condition = false;\n";
- $ivrconditionjs .= "}\n";
- $ivrconditionjs .= "\n";
-
-
-if (isset($id) && $a_ivr[$id]) {
- $pconfig['ivrid'] = $a_ivr[$id]['ivrid'];
- $ivrid = $a_ivr[$id]['ivrid'];
- $pconfig['ivrextension'] = $a_ivr[$id]['ivrextension'];
- $pconfig['ivrname'] = $a_ivr[$id]['ivrname'];
- $pconfig['recordingidaction'] = $a_ivr[$id]['recordingidaction'];
- $pconfig['recordingidantiaction'] = $a_ivr[$id]['recordingidantiaction'];
- $pconfig['ivrtimeout'] = $a_ivr[$id]['ivrtimeout'];
- $pconfig['ivrcalltimeout'] = $a_ivr[$id]['ivrcalltimeout'];
- $pconfig['ivrcontext'] = $a_ivr[$id]['ivrcontext'];
- $pconfig['ivrdirectdial'] = $a_ivr[$id]['ivrdirectdial'];
- $pconfig['ivrringback'] = $a_ivr[$id]['ivrringback'];
- $pconfig['ivrcidnameprefix'] = $a_ivr[$id]['ivrcidnameprefix'];
- $pconfig['ivrconditionjs'] = ($a_ivr[$id]['ivrconditionjs']);
- $pconfig['ivrdescr'] = $a_ivr[$id]['ivrdescr'];
-}
-
-if ($_POST) {
-
- unset($input_errors);
- $pconfig = $_POST;
-
-
- if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'options') {
- if ($a_ivroptions[$_GET['optionid']]) {
- unset($a_ivr_options[$_GET['optionid']]);
- write_config();
- sync_package_freeswitch_ivr();
- header("Location: freeswitch_ivr_edit.php?id=".$_GET['id']);
- exit;
- }
- }
- }
-
-
- if (!$input_errors) {
-
- $ivrent = array();
- if (strlen($_POST['ivrid']) > 0) {
- $ivrent['ivrid'] = $_POST['ivrid'];
- }
- else {
- $ivrent['ivrid'] = guid();
- }
- $ivrent['ivrextension'] = $_POST['ivrextension'];
- $ivrent['ivrname'] = $_POST['ivrname'];
- $ivrent['recordingidaction'] = $_POST['recordingidaction'];
- $ivrent['recordingidantiaction'] = $_POST['recordingidantiaction'];
- $ivrent['ivrtimeout'] = $_POST['ivrtimeout'];
- $ivrent['ivrcalltimeout'] = $_POST['ivrcalltimeout'];
- $ivrent['ivrcontext'] = $_POST['ivrcontext'];
- $ivrent['ivrdirectdial'] = $_POST['ivrdirectdial'];
- $ivrent['ivrringback'] = $_POST['ivrringback'];
- $ivrent['ivrcidnameprefix'] = $_POST['ivrcidnameprefix'];
- $ivrent['ivrconditionjs'] = base64_encode($_POST['ivrconditionjs']);
- $ivrent['ivrdescr'] = $_POST['ivrdescr'];
-
- if (isset($id) && $a_ivr[$id]) {
- //update
- $a_ivr[$id] = $ivrent;
- }
- else {
- //add
- $a_ivr[] = $ivrent;
- }
-
- //touch($d_hostsdirty_path);
- write_config();
- sync_package_freeswitch_ivr();
-
- header("Location: freeswitch_ivr.php");
- exit;
- }
-}
-
-include("head.inc");
-
-?>
-<script language="Javascript">
-function sf() { document.forms[0].savetopath.focus(); }
-</script>
-<script language="Javascript" type="text/javascript" src="/edit_area/edit_area_full.js"></script>
-<script language="Javascript" type="text/javascript">
- // initialisation
- editAreaLoader.init({
- id: "ivrconditionjs" // id of the textarea to transform
- ,start_highlight: true
- ,allow_toggle: false
- ,language: "en"
- ,syntax: "js"
- ,toolbar: "search, go_to_line,|, fullscreen, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help"
- ,syntax_selection_allow: "css,html,js,php,xml,c,cpp,sql"
- ,show_line_colors: true
- });
-</script>
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">FreeSWITCH: IVR: Edit</p>
-<?php if ($input_errors) print_input_errors($input_errors); ?>
-
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-display_top_tabs(build_menu());
-
-?>
-</td></tr>
-</table>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>General Settings:<br>
- </strong></span>
- Interactive voice response general settings.
- </span></p></td>
- </tr>
- </table>
- <br />
-
- <form action="freeswitch_ivr_edit.php" method="post" name="iform" id="iform">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="22%" valign="top" class="vncellreq">Extension</td>
- <td width="78%" class="vtable">
- <input name="ivrextension" type="text" class="formfld" id="ivrextension" size="40" value="<?=htmlspecialchars($pconfig['ivrextension']);?>">
- <br> <span class="vexpl">e.g. <em>5002</em></span></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">IVR Name</td>
- <td width="78%" class="vtable">
- <input name="ivrname" type="text" class="formfld" id="ivrname" size="40" value="<?=htmlspecialchars($pconfig['ivrname']);?>">
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Recording Action</td>
- <td width="78%" class="vtable">
- <?php
- $a_recordings = &$config['installedpackages']['freeswitchrecordings']['config'];
- echo " <select name='recordingidaction' class='formfld'>\n";
- echo " <option></option>\n";
- if (count($a_recordings) > 0) {
- foreach ($a_recordings as $ent) {
- if (htmlspecialchars($pconfig['recordingidaction']) == $ent['recordingid']) {
- echo " <option value='".$ent['recordingid']."' selected='yes'>".$ent['recordingname']."</option>\n";
- }
- else {
- echo " <option value='".$ent['recordingid']."'>".$ent['recordingname']."</option>\n";
- }
- }
- }
- echo " </select>\n";
- ?>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Recording Anti-Action</td>
- <td width="78%" class="vtable">
- <?php
- //$a_recordings = &$config['installedpackages']['freeswitchrecordings']['config'];
- echo " <select name='recordingidantiaction' class='formfld'>\n";
- echo " <option></option>\n";
- if (count($a_recordings) > 0) {
- foreach ($a_recordings as $ent) {
- if (htmlspecialchars($pconfig['recordingidantiaction']) == $ent['recordingid']) {
- echo " <option value='".$ent['recordingid']."' selected='yes'>".$ent['recordingname']."</option>\n";
- }
- else {
- echo " <option value='".$ent['recordingid']."'>".$ent['recordingname']."</option>\n";
- }
- }
- }
- echo " </select>\n";
- ?>
- </td>
- </tr>
- <?php
- if (strlen($pconfig['ivrtimeout']) == 0) {
- $pconfig['ivrtimeout'] = 10; //set a default timeout
- }
- ?>
- <tr>
- <td width="22%" valign="top" class="vncellreq">IVR Timeout</td>
- <td width="78%" class="vtable">
- <input name="ivrtimeout" type="text" class="formfld" id="ivrtimeout" size="40" value="<?=htmlspecialchars($pconfig['ivrtimeout']);?>">
- <br>
- <span class="vexpl">After the recording concludes the
- timeout sets the time in seconds to continue to wait for DTMF.
- If the DTMF is <br />not detected during that time the 't'
- timeout option is executed.
- </span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Call Timeout</td>
- <td width="78%" class="vtable">
- <input name="ivrcalltimeout" type="text" class="formfld" id="ivrcalltimeout" size="40" value="<?=htmlspecialchars($pconfig['ivrcalltimeout']);?>">
- <br>
- <span class="vexpl">
- Call timeout is the time in seconds to ring the destination. After this time is exceeded calls
- to extensions will be sent to voicemail. default: 30 seconds
- </span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Context</td>
- <td width="78%" class="vtable">
- <input name="ivrcontext" type="text" class="formfld" id="ivrextension" size="40" value="<?=htmlspecialchars($pconfig['ivrcontext']);?>">
- <br> <span class="vexpl">e.g. <em>default</em></span></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Direct Dial</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='ivrdirectdial' class='formfld'>\n";
- echo " <option></option>\n";
- if (strlen($pconfig['ivrdirectdial']) == 0) { //set default
- echo " <option value='true'>enable</option>\n";
- echo " <option selected='yes' value='false'>disabled</option>\n";
- }
- else {
- if (htmlspecialchars($pconfig['ivrdirectdial']) == "true") {
- echo " <option selected='yes' value='true'>enabled</option>\n";
- }
- else {
- echo " <option value='true'>enable</option>\n";
- }
- if (htmlspecialchars($pconfig['ivrdirectdial']) == "false") {
- echo " <option selected='yes' value='false'>disabled</option>\n";
- }
- else {
- echo " <option value='false'>disable</option>\n";
- }
- }
-
- echo " </select>\n";
- ?>
- <br><span class="vexpl">Allows callers to dial directly to extensions and feature codes that are up to 5 digits in length.</span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Ring Back</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='ivrringback' class='formfld'>\n";
- echo " <option></option>\n";
- if (htmlspecialchars($pconfig['ivrringback']) == "ring") {
- echo " <option selected='yes'>ring</option>\n";
- }
- else {
- echo " <option>ring</option>\n";
- }
- if (htmlspecialchars($pconfig['ivrringback']) == "music") {
- echo " <option selected='yes'>music</option>\n";
- }
- else {
- echo " <option>music</option>\n";
- }
- echo " </select>\n";
- ?>
- <br>
- <span class="vexpl">
- Defines what the caller will hear while destination is being called. The choices are music
- (music on hold) ring (ring tone.) default: music
- </span>
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncellreq">CID Prefix</td>
- <td width="78%" class="vtable">
- <input name="ivrcidnameprefix" type="text" class="formfld" id="ivrcidnameprefix" size="40" value="<?=htmlspecialchars($pconfig['ivrcidnameprefix']);?>">
- <br> <span class="vexpl">Set a prefix on the caller ID name. (optional)</span></td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncellreq">Description</td>
- <td width="78%" class="vtable">
- <input name="ivrdescr" type="text" class="formfld" id="descr" size="40" value="<?=htmlspecialchars($pconfig['ivrdescr']);?>">
- <br>
- <span class="vexpl">
- You may enter a description here for your reference (not parsed).
- </span>
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncellreq">Javascript Condition</td>
- <td width="78%" class="vtable">
- <?php
- if (strlen(htmlspecialchars(base64_decode($pconfig['ivrconditionjs']))) == 0) {
- echo "<textarea name=\"ivrconditionjs\" id=\"ivrconditionjs\" cols=\"75\" rows=\"10\" wrap=\"off\">".$ivrconditionjs."</textarea>\n";
- }
- else {
- echo "<textarea name=\"ivrconditionjs\" id=\"ivrconditionjs\" cols=\"75\" rows=\"10\" wrap=\"off\">".htmlspecialchars(base64_decode($pconfig['ivrconditionjs']))."</textarea>\n";
- }
- ?>
- <br> <span class="vexpl">A simple valid condition is:
- condition=true; To re-populate the default simply empty the
- textarea and click on save. The following javascript variables
- have been defined: Hours, Mins, Seconds, Month, Date, Year,
- and Day.</span></td>
- </tr>
-
-
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()">
- <input name="ivrid" type="hidden" value="<?=htmlspecialchars($pconfig['ivrid']);?>">
- <?php if (isset($id) && $a_ivr[$id]): ?>
- <input name="id" type="hidden" value="<?=$id;?>">
- <?php endif; ?>
- </td>
- </tr>
- </table>
- </form>
-
- <br>
- <br>
-
- <form action="freeswitch_ivr_edit.php" method="post" name="iform2" id="iform2">
- <?php
-
-
- //echo "<pre>";
- //print_r ($a_ivr);
- //echo "</pre>";
-
- //if ($savemsg) print_info_box($savemsg);
- //if (file_exists($d_hostsdirty_path)): echo"<p>";
- //print_info_box_np("The FreeSWITCH recordings have been changed.<br>You must apply the changes in order for them to take effect.");
- //echo"<br />";
- //endif;
-
- ?>
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong><br>
- </strong></span>
- Options are the choices that are available to the caller when they
- are calling the auto attendant. If the caller presses 2 then the call
- is directed to the corresponding destination.
- </span></p></td>
- </tr>
- </table>
-
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Action<br />
- </strong></span>
- The options that are executed when the <b>condition matches.</b>
- </span></p></td>
- </tr>
- </table>
- <br />
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="30" class="listhdrr">Option</td>
- <td width="30" class="listhdrr">Type</td>
- <td width="30" class="listhdrr">Profile</td>
- <td width="150" class="listhdrr">Destination</td>
- <td width="30%" class="listhdr">Description</td>
- <td width="40" class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle">
- <?php if (strlen($ivrid) > 1) { ?>
- <a href="freeswitch_ivr_options_edit.php?parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>&a=action"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a>
- <?php } ?>
- </td>
- </tr>
- </table>
- </td>
- </tr>
-
- <?php
- $i = 0;
- if (count($a_ivr_options) > 0) {
- foreach ($a_ivr_options as $ent) {
- if ($ent['optionaction'] == "action" && $ivrid == $ent['ivrid']) {
- ?>
- <tr>
- <td class="listlr" ondblclick="document.location='freeswitch_ivr_options_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>'">
- <?=$ent['optionnumber']?>
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_ivr_options_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>';">
- <?=$ent['optiontype'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_ivr_options_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>';">
- <?=$ent['optionprofile'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_ivr_options_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>';">
- <?=$ent['optiondest'];?>&nbsp;
- </td>
- <td class="listbg" ondblclick="document.location='freeswitch_ivr_options_edit.php?id=<?=$id;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>';">
- <font color="#FFFFFF"><?=htmlspecialchars($ent['optiondescr']);?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="freeswitch_ivr_options_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="freeswitch_ivr_options.php?type=ivroptions&act=del&id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>" onclick="return confirm('Do you really want to delete this recording?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
- }
- $i++;
- }
- }
- ?>
- <tr>
- <td class="list" colspan="5"></td>
- <td class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle">
- <?php if (strlen($ivrid) > 1) { ?>
- <a href="freeswitch_ivr_options_edit.php?parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>&a=action"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a>
- <?php } ?>
- </td>
- </tr>
- </table>
- </td>
- </tr>
-
-
- <tr>
- <td class="list" colspan="5"></td>
- <td class="list"></td>
- </tr>
- </table>
-
- </form>
-
-
-
- <form action="freeswitch_ivr_edit.php" method="post" name="iform2" id="iform2">
- <?php
-
-
- //echo "<pre>";
- //print_r ($a_ivr);
- //echo "</pre>";
-
- //if ($savemsg) print_info_box($savemsg);
- //if (file_exists($d_hostsdirty_path)): echo"<p>";
- //print_info_box_np("The FreeSWITCH recordings have been changed.<br>You must apply the changes in order for them to take effect.");
- //echo"<br />";
- //endif;
-
- ?>
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Anti-Action<br />
- </strong></span>
- The options that are executed when the <b>condition does NOT match.</b>
- </span></p></td>
- </tr>
- </table>
- <br />
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="30" class="listhdrr">Option</td>
- <td width="30" class="listhdrr">Type</td>
- <td width="30" class="listhdrr">Profile</td>
- <td width="150" class="listhdrr">Destination</td>
- <td width="30%" class="listhdr">Description</td>
- <td width="40" class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle">
- <?php if (strlen($ivrid) > 1) { ?>
- <a href="freeswitch_ivr_options_edit.php?parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>&a=antiaction"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a>
- <?php } ?>
- </td>
- </tr>
- </table>
- </td>
- </tr>
-
- <?php
- $i = 0;
- if (count($a_ivr_options) > 0) {
- foreach ($a_ivr_options as $ent) {
- if ($ent['optionaction'] == "anti-action" && $ivrid == $ent['ivrid']) {
- ?>
- <tr>
- <td class="listlr" ondblclick="document.location='freeswitch_ivr_options_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>'">
- <?=$ent['optionnumber']?>
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_ivr_options_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>';">
- <?=$ent['optiontype'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_ivr_options_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>';">
- <?=$ent['optionprofile'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_ivr_options_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>';">
- <?=$ent['optiondest'];?>&nbsp;
- </td>
- <td class="listbg" ondblclick="document.location='freeswitch_ivr_options_edit.php?id=<?=$id;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>';">
- <font color="#FFFFFF"><?=htmlspecialchars($ent['optiondescr']);?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="freeswitch_ivr_options_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="freeswitch_ivr_options.php?type=ivroptions&act=del&id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>" onclick="return confirm('Do you really want to delete this recording?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
- }
- $i++;
- }
- }
- ?>
- <tr>
- <td class="list" colspan="5"></td>
- <td class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle">
- <?php if (strlen($ivrid) > 1) { ?>
- <a href="freeswitch_ivr_options_edit.php?parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>&a=antiaction"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a>
- <? } ?>
- </td>
- </tr>
- </table>
- </td>
- </tr>
-
-
- <tr>
- <td class="list" colspan="5"></td>
- <td class="list"></td>
- </tr>
- </table>
-
- </form>
-
- <br>
- <br>
-
- </td>
- </tr>
-</table>
-
-</div>
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch/freeswitch_ivr_options.tmp b/config/freeswitch/freeswitch_ivr_options.tmp
deleted file mode 100755
index 096e5b6e..00000000
--- a/config/freeswitch/freeswitch_ivr_options.tmp
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-/* $Id$ */
-/*
- freeswitch_ivr_options.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/freeswitch.inc");
-
-
-$a_ivr_options = &$config['installedpackages']['freeswitchivroptions']['config'];
-
-
-if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'ivroptions') {
- if ($a_ivr_options[$_GET['id']]) {
- unset($a_ivr_options[$_GET['id']]);
- write_config();
- sync_package_freeswitch_ivr();
- header("Location: freeswitch_ivr_edit.php?id=".$_GET['parentid']);
- exit;
- }
- }
-}
-
-?> \ No newline at end of file
diff --git a/config/freeswitch/freeswitch_ivr_options_edit.tmp b/config/freeswitch/freeswitch_ivr_options_edit.tmp
deleted file mode 100644
index 894064e3..00000000
--- a/config/freeswitch/freeswitch_ivr_options_edit.tmp
+++ /dev/null
@@ -1,248 +0,0 @@
-<?php
-/* $Id$ */
-/*
-
- freeswitch_recordings_edit.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/freeswitch.inc");
-
-
-$a_ivr_options = &$config['installedpackages']['freeswitchivroptions']['config'];
-
-$id = $_GET['id'];
-if (isset($_POST['id'])) {
- $id = $_POST['id'];
-}
-
-$parentid = $_GET['parentid'];
-if (isset($_POST['parentid'])) {
- $parentid = $_POST['parentid'];
-}
-
-$ivrid = $_GET['ivrid'];
-if (isset($_POST['ivrid'])) {
- $ivrid = $_POST['ivrid'];
-}
-
-
-if (isset($id) && $a_ivr_options[$id]) {
- $pconfig['optionaction'] = $a_ivr_options[$id]['optionaction'];
- $pconfig['optionnumber'] = $a_ivr_options[$id]['optionnumber'];
- $pconfig['optiontype'] = $a_ivr_options[$id]['optiontype'];
- $pconfig['optionprofile'] = $a_ivr_options[$id]['optionprofile'];
- $pconfig['optiondest'] = $a_ivr_options[$id]['optiondest'];
- $pconfig['optiondescr'] = $a_ivr_options[$id]['optiondescr'];
-}
-else {
- if (isset($_GET['a'])) {
- if ($_GET['a'] == "action"){ $pconfig['optionaction'] = "action"; }
- if ($_GET['a'] == "antiaction"){ $pconfig['optionaction'] = "anti-action"; }
- }
-}
-
-
-if ($_POST) {
-
- unset($input_errors);
- $pconfig = $_POST;
-
-
- if (!$input_errors) {
-
- $ivroptionent = array();
- $ivroptionent['ivrid'] = $_POST['ivrid'];
- $ivroptionent['optionnumber'] = $_POST['optionnumber'];
- $ivroptionent['optiontype'] = $_POST['optiontype'];
- $ivroptionent['optionprofile'] = $_POST['optionprofile'];
- $ivroptionent['optionaction'] = $_POST['optionaction'];
- $ivroptionent['optiondest'] = $_POST['optiondest'];
- $ivroptionent['optiondescr'] = $_POST['optiondescr'];
-
- if (isset($id) && $a_ivr_options[$id]) {
- //update
- $a_ivr_options[$id] = $ivroptionent;
- }
- else {
- //add
- $a_ivr_options[] = $ivroptionent;
- }
-
-
- write_config();
- sync_package_freeswitch_ivr();
-
- header("Location: freeswitch_ivr_edit.php?id=".$parentid);
- exit;
- }
-}
-
-include("head.inc");
-
-?>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">FreeSWITCH: IVR: Options: Edit</p>
-<?php if ($input_errors) print_input_errors($input_errors); ?>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-display_top_tabs(build_menu());
-
-?>
-</td></tr>
-</table>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
- <br />
- <form action="freeswitch_ivr_options_edit.php" method="post" name="iform" id="iform">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="22%" valign="top" class="vncellreq">Option Number</td>
- <td width="78%" class="vtable">
- <input name="optionnumber" type="text" class="formfld" id="optionnumber" size="40" value="<?=htmlspecialchars($pconfig['optionnumber']);?>">
- <br> <span class="vexpl">Option Number<br>
- e.g. <em>1</em></span></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Type</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='optiontype' class='formfld'>\n";
- echo " <option></option>\n";
- if (htmlspecialchars($pconfig['optiontype']) == "extension") {
- echo " <option selected='yes'>extension</option>\n";
- }
- else {
- echo " <option>extension</option>\n";
- }
- if (htmlspecialchars($pconfig['optiontype']) == "voicemail") {
- echo " <option selected='yes'>voicemail</option>\n";
- }
- else {
- echo " <option>voicemail</option>\n";
- }
- if (htmlspecialchars($pconfig['optiontype']) == "sip uri") {
- echo " <option selected='yes'>sip uri</option>\n";
- }
- else {
- echo " <option>sip uri</option>\n";
- }
- echo " </select>\n";
- ?>
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncellreq">Profile</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='optionprofile' class='formfld'>\n";
- echo " <option></option>\n";
- if (htmlspecialchars($pconfig['optionprofile']) == "auto") {
- echo " <option selected='yes'>auto</option>\n";
- }
- else {
- echo " <option>auto</option>\n";
- }
- foreach (ListFiles('/usr/local/freeswitch/conf/sip_profiles') as $key=>$sip_profile_file){
- $sip_profile_name = str_replace(".xml", "", $sip_profile_file);
-
- if (htmlspecialchars($pconfig['optionprofile']) == $sip_profile_name) {
- echo " <option selected='yes'>$sip_profile_name</option>\n";
- }
- else {
- echo " <option>$sip_profile_name</option>\n";
- }
- }
- echo " </select>\n";
-
- ?>
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncellreq">Destination</td>
- <td width="78%" class="vtable">
- <input name="optiondest" type="text" class="formfld" id="optiondest" size="40" value="<?=htmlspecialchars($pconfig['optiondest']);?>">
- <br>
- <span class="vexpl">
- <!--<b>examples:</b><br />-->
- extension: 1001<br />
- voicemail: 1001<br />
- sip uri (voicemail): sofia/internal/*98@${domain}<br />
- sip uri (external number): sofia/gateway/gatewayname/12081231234<br />
- sip uri (auto attendant): sofia/internal/5002@${domain}<br />
- </span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Description</td>
- <td width="78%" class="vtable">
- <input name="optiondescr" type="text" class="formfld" id="optiondescr" size="40" value="<?=htmlspecialchars($pconfig['optiondescr']);?>">
- <br> <span class="vexpl">You may enter a description here
- for your reference (not parsed).</span></td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="ivrid" type="hidden" value="<?=$ivrid;?>">
- <input name="parentid" type="hidden" value="<?=$parentid;?>">
- <input name="optionaction" type="hidden" value="<?=$pconfig['optionaction'];?>">
- <?php if (isset($id) && $a_ivr_options[$id]): ?>
- <input name="id" type="hidden" value="<?=$id;?>">
- <?php endif; ?>
- <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()">
- </td>
- </tr>
- </table>
- </form>
-
- <br>
- <br>
- <br>
- <br>
- <br>
- <br>
-
- </td>
- </tr>
-</table>
-
-</div>
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch/freeswitch_mailto.tmp b/config/freeswitch/freeswitch_mailto.tmp
deleted file mode 100644
index fa27ff68..00000000
--- a/config/freeswitch/freeswitch_mailto.tmp
+++ /dev/null
@@ -1,243 +0,0 @@
-<?php
-/* $Id$ */
-/*
- freeswitch_mailto.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-require_once("/etc/inc/config.inc");
-require_once("/usr/local/pkg/freeswitch.inc");
-global $config;
-
-$tmp_smtphost = $config['installedpackages']['freeswitchsettings']['config'][0]['smtphost'];
-$tmp_smtpsecure = $config['installedpackages']['freeswitchsettings']['config'][0]['smtpsecure']; //options "", "TLS", "SSL"
-$tmp_smtpsecure = strtolower($tmp_smtpsecure);
-$tmp_smtpauth = $config['installedpackages']['freeswitchsettings']['config'][0]['smtpauth']; // SMTP authentication: true or false
-$tmp_smtpusername = $config['installedpackages']['freeswitchsettings']['config'][0]['smtpusername'];
-$tmp_smtppassword = $config['installedpackages']['freeswitchsettings']['config'][0]['smtppassword'];
-$tmp_smtpfrom = $config['installedpackages']['freeswitchsettings']['config'][0]['smtpfrom'];
-$tmp_smtpfromname = $config['installedpackages']['freeswitchsettings']['config'][0]['smtpfromname'];
-
-
-ini_set(max_execution_time,900); //15 minutes
-ini_set('memory_limit', '96M');
-$fd = fopen("php://stdin", "r");
-
-$email = file_get_contents ("php://stdin");
-
-fclose($fd);
-
-if($fd){
- $fp = fopen("/tmp/voicemailtoemail.txt", "w");
-}
-
-
-ob_end_clean();
-ob_start();
-
-
-//get main header and body
- $tmparray = split("\n\n", $email);
- $mainheader = $tmparray[0];
- $maincontent = substr($email, strlen($mainheader), strlen($email));
-
-//get the boundary
- $tmparray = split("\n", $mainheader);
- $contenttmp = $tmparray[1]; //Content-Type: multipart/mixed; boundary="XXXX_boundary_XXXX"
- $tmparray = split('; ', $contenttmp); //boundary="XXXX_boundary_XXXX"
- $contenttmp = $tmparray[1];
- $tmparray = split('=', $contenttmp); //"XXXX_boundary_XXXX"
- $boundary = $tmparray[1];
- $boundary = trim($boundary,'"');
- //echo "boundary: $boundary\n";
-
-//put the main headers into an array
- $mainheaderarray = split("\n", $mainheader);
- //print_r($mainheaderarray);
- foreach ($mainheaderarray as $val) {
- $tmparray = split(': ', $val);
- //print_r($tmparray);
- $var[$tmparray[0]] = trim($tmparray[1]);
- }
-
- $var['To'] = str_replace("<", "", $var['To']);
- $var['To'] = str_replace(">", "", $var['To']);
-
- echo "To: ".$var['To']."\n";
- echo "From: ".$var['From']."\n";
- echo "Subject: ".$var['Subject']."\n";
- //print_r($var);
- echo "\n\n";
-
-
-// split mime type multi-part into each part
- $maincontent = str_replace($boundary."--", $boundary, $maincontent);
- $tmparray = split("--".$boundary, $maincontent);
-
-// loop through each mime part
- $i=0;
- foreach ($tmparray as $mimepart) {
-
- $mimearray = split("\n\n", $mimepart);
- $subheader = $mimearray[0];
- $headermimearray = split("\n", trim($subheader));
-
- $x=0;
- foreach ($headermimearray as $val) {
- if(stristr($val, ':') === FALSE) {
- $tmparray = split('=', $val); //':' not found
- if (trim($tmparray[0]) == "boundary") {
- $subboundary = $tmparray[1];
- $subboundary = trim($subboundary,'"');
- //echo "subboundary: ".$subboundary."\n";
- }
- }
- else {
- $tmparray = split(':', $val); //':' found
- }
-
- //print_r($tmparray);
- $var[trim($tmparray[0])] = trim($tmparray[1]);
- }
- //print_r($var);
-
-
- $contenttypearray = split(' ', $headermimearray[0]);
-
- if ($contenttypearray[0] == "Content-Type:") {
- $contenttype = trim($contenttypearray[1]);
-
- switch ($contenttype) {
- case "multipart/alternative;":
-
- //echo "type: ".$contenttype."\n";
- $content = trim(substr($mimepart, strlen($subheader), strlen($mimepart)));
-
- $content = str_replace($subboundary."--", $subboundary, $content);
- $tmpsubarray = split("--".$subboundary, $content);
- foreach ($tmpsubarray as $mimesubsubpart) {
-
- $mimesubsubarray = split("\n\n", $mimesubsubpart);
- $subsubheader = $mimesubsubarray[0];
-
- $headersubsubmimeearray = split("\n", trim($subsubheader));
- $subsubcontenttypearray = split(' ', $headersubsubmimeearray[0]);
- //echo "subsubcontenttypearray[0] ".$subsubcontenttypearray[0]."\n";
-
- if ($subsubcontenttypearray[0] == "Content-Type:") {
- $subsubcontenttype = trim($subsubcontenttypearray[1]);
- switch ($subsubcontenttype) {
- case "text/plain;":
- $textplain = trim(substr($mimesubsubpart, strlen($subsubheader), strlen($mimesubsubpart)));
- //echo "text/plain: $textplain\n";
- break;
- case "text/html;":
- $texthtml = trim(substr($mimesubsubpart, strlen($subsubheader), strlen($mimesubsubpart)));
- //echo "text/html: $texthtml\n";
- break;
- }
- } //end if
-
-
- } //end foreach
-
- break;
- case "audio/wav;":
- //echo "type: ".$contenttype."\n";
- $strwav = trim(substr($mimepart, strlen($subheader), strlen($mimepart)));
- //echo "\n*** begin wav ***\n".$strwav."\n*** end wav ***\n";
- break;
-
- }//end switch
- } //end if
-
- $i++;
-
- } //end foreach
-
-
-//send the email
-
- include "/usr/local/www/packages/freeswitch/class.phpmailer.php";
- include "/usr/local/www/packages/freeswitch/class.smtp.php"; // optional, gets called from within class.phpmailer.php if not already loaded
-
- $mail = new PHPMailer();
-
- $mail->IsSMTP(); // set mailer to use SMTP
- if ($tmp_smtpauth == "true") {
- $mail->SMTPAuth = $tmp_smtpauth; // turn on/off SMTP authentication
- }
- $mail->Host = $tmp_smtphost;
- if (strlen($tmp_smtpsecure)>0) {
- $mail->SMTPSecure = $tmp_smtpsecure;
- }
- if ($tmp_smtpusername) {
- $mail->Username = $tmp_smtpusername;
- $mail->Password = $tmp_smtppassword;
- }
- $mail->SMTPDebug = 2;
-
-
- $mail->From = $tmp_smtpfrom;
- $mail->FromName = $tmp_smtpfromname;
- $mail->Subject = $var['Subject'];
- $mail->AltBody = $textplain; // optional, comment out and test
- $mail->MsgHTML($texthtml);
-
-
- $tmp_to = $var['To'];
- $tmp_to = str_replace(";", ",", $tmp_to);
- $tmp_to_array = split(",", $tmp_to);
- foreach($tmp_to_array as $tmp_to_row) {
- if (strlen($tmp_to_row) > 0) {
- $mail->AddAddress($tmp_to_row);
- }
- }
-
- if (strlen($strwav) > 0) {
- //$mail->AddAttachment("/usr/local/freeswitch/data/domain/example.wav"); // attachment
- $filename='voicemail.wav'; $encoding = "base64"; $type = "audio/wav";
- $mail->AddStringAttachment(base64_decode($strwav),$filename,$encoding,$type);
- }
- unset($strwav);
-
- if(!$mail->Send()) {
- echo "Mailer Error: " . $mail->ErrorInfo;
- }
- else {
- echo "Message sent!";
- }
-
-
-$content = ob_get_contents(); //get the output from the buffer
-ob_end_clean(); //clean the buffer
-
-fwrite($fp, $content);
-fclose($fp);
-
-?> \ No newline at end of file
diff --git a/config/freeswitch/freeswitch_modules.xml b/config/freeswitch/freeswitch_modules.xml
deleted file mode 100644
index 8c211820..00000000
--- a/config/freeswitch/freeswitch_modules.xml
+++ /dev/null
@@ -1,1203 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE packagegui SYSTEM "./schema/packages.dtd">
-<packagegui>
- <copyright>
- <![CDATA[
-/* $Id$ */
-/* ========================================================================== */
-/*
- freeswitch_modules.xml
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow.</description>
- <requirements>Describe your package requirements here</requirements>
- <faq>Currently there are no FAQ items provided.</faq>
- <name>FreeSWITCH Modules</name>
- <version>0.2</version>
- <title>FreeSWITCH: Modules</title>
- <include_file>/usr/local/pkg/freeswitch.inc</include_file>
- <menu>
- <name>FreeSWITCH</name>
- <tooltiptext>Modify FreeSWITCH Modules.</tooltiptext>
- <section>Services</section>
- <configfile>freeswitch.xml</configfile>
- <url>/pkg_edit.php?xml=freeswitch.xml&amp;id=0</url>
- </menu>
- <service>
- <name>freeswitch</name>
- <rcfile>freeswitch.sh</rcfile>
- <executable>freeswitch</executable>
- <description>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow.</description>
- </service>
- <tabs>
- <tab>
- <text>Settings</text>
- <url>/pkg_edit.php?xml=freeswitch.xml&amp;id=0</url>
- </tab>
- <tab>
- <text>Dialplan</text>
- <url>/packages/freeswitch/freeswitch_dialplan_includes.php</url>
- </tab>
- <tab>
- <text>Extensions</text>
- <url>/packages/freeswitch/freeswitch_extensions.php</url>
- </tab>
- <tab>
- <text>Features</text>
- <url>/packages/freeswitch/freeswitch_features.php</url>
- </tab>
- <tab>
- <text>Gateways</text>
- <url>/packages/freeswitch/freeswitch_gateways.php</url>
- </tab>
- <tab>
- <text>Profiles</text>
- <url>/packages/freeswitch/freeswitch_profiles.php</url>
- </tab>
- <tab>
- <text>Public</text>
- <url>/packages/freeswitch/freeswitch_public_includes.php</url>
- </tab>
- <tab>
- <text>Status</text>
- <url>/packages/freeswitch/freeswitch_status.php</url>
- </tab>
- <tab>
- <text>Vars</text>
- <url>/packages/freeswitch/freeswitch_vars.php</url>
- </tab>
- </tabs>
- <configpath>installedpackages->package->$packagename->configuration->freeswitchmodules</configpath>
- <fields>
- <field>
- <fielddescr>&lt;b&gt;Loggers&lt;/b&gt;</fielddescr>
- <fieldname>loggers</fieldname>
- <description></description>
- <type>listtopic</type>
- </field>
- <field>
- <fielddescr>mod_console</fielddescr>
- <fieldname>mod_console</fieldname>
- <description>Send logs to the console.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_logfile</fielddescr>
- <fieldname>mod_logfile</fieldname>
- <description>Send logs to the local file system.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_syslog</fielddescr>
- <fieldname>mod_syslog</fieldname>
- <description>Send logs to a remote syslog server.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>&lt;b&gt;Multi-Faceted&lt;/b&gt;</fielddescr>
- <fieldname>multi-faceted</fieldname>
- <description></description>
- <type>listtopic</type>
- </field>
- <field>
- <fielddescr>mod_enum</fielddescr>
- <fieldname>mod_enum</fieldname>
- <description>Route PSTN numbers over internet according to ENUM servers, such as e164.org.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>&lt;b&gt;XML Interfaces&lt;/b&gt;</fielddescr>
- <fieldname>xml_interfaces</fieldname>
- <description></description>
- <type>listtopic</type>
- </field>
- <field>
- <fielddescr>mod_xml_rpc</fielddescr>
- <fieldname>mod_xml_rpc</fieldname>
- <description>XML Remote Procedure Calls. Issue commands from your web application.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_xml_curl</fielddescr>
- <fieldname>mod_xml_curl</fieldname>
- <description>XML Gateway Code. Configure FreeSWITCH from a web server on boot and on the fly.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_xml_cdr</fielddescr>
- <fieldname>mod_xml_cdr</fieldname>
- <description>XML based call detail record handler.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>&lt;b&gt;Event Handlers&lt;/b&gt;</fielddescr>
- <fieldname>event_handlers</fieldname>
- <description></description>
- <type>listtopic</type>
- </field>
- <field>
- <fielddescr>mod_cdr_csv</fielddescr>
- <fieldname>mod_cdr_csv</fieldname>
- <description>CSV call detail record handler.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_event_multicast</fielddescr>
- <fieldname>mod_event_multicast</fieldname>
- <description>Broadcasts events to netmask.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_event_socket</fielddescr>
- <fieldname>mod_event_socket</fieldname>
- <description>Sends events via a single socket.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_zeroconf</fielddescr>
- <fieldname>mod_zeroconf</fieldname>
- <description>Support for zeroconf.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>&lt;b&gt;Directory Interfaces&lt;/b&gt;</fielddescr>
- <fieldname>directory_interfaces</fieldname>
- <description></description>
- <type>listtopic</type>
- </field>
- <field>
- <fielddescr>mod_ldap</fielddescr>
- <fieldname>mod_ldap</fieldname>
- <description>LDAP module made to obtain dialplans, user accounts, etc.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>&lt;b&gt;Endpoints&lt;/b&gt;</fielddescr>
- <fieldname>endpoints</fieldname>
- <description></description>
- <type>listtopic</type>
- </field>
- <field>
- <fielddescr>mod_dingaling</fielddescr>
- <fieldname>mod_dingaling</fieldname>
- <description>Jabber/GoogleTalk Talk integration module.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_iax</fielddescr>
- <fieldname>mod_iax</fieldname>
- <description>IAX2.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_portaudio</fielddescr>
- <fieldname>mod_portaudio</fieldname>
- <description>Voice through a local soundcard.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_alsa</fielddescr>
- <fieldname>mod_alsa</fieldname>
- <description></description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_sofia</fielddescr>
- <fieldname>mod_sofia</fieldname>
- <description>SIP module.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_loopback</fielddescr>
- <fieldname>mod_loopback</fieldname>
- <description>A loopback channel driver to make an outbound call as an inbound call.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_wanpipe</fielddescr>
- <fieldname>mod_wanpipe</fieldname>
- <description>T1/E1 Sangoma Card module.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_woomera</fielddescr>
- <fieldname>mod_woomera</fieldname>
- <description>H.323/Woomera module.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_openzap</fielddescr>
- <fieldname>mod_openzap</fieldname>
- <description>Interface to Zaptel hardware.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>&lt;b&gt;Applications&lt;/b&gt;</fielddescr>
- <fieldname>applications</fieldname>
- <description></description>
- <type>listtopic</type>
- </field>
- <field>
- <fielddescr>mod_commands</fielddescr>
- <fieldname>mod_commands</fieldname>
- <description>A mass plethora of API interface commands.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_conference</fielddescr>
- <fieldname>mod_conference</fieldname>
- <description>Conference room module.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_dptools</fielddescr>
- <fieldname>mod_dptools</fieldname>
- <description>Dialplan Tools: provides a number of apps and utilities for the dialplan.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_expr</fielddescr>
- <fieldname>mod_expr</fieldname>
- <description>Brian Allen Vanderburgs expression evaluation library.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_fax</fielddescr>
- <fieldname>mod_fax</fieldname>
- <description>FAX provides fax send and receive.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_fifo</fielddescr>
- <fieldname>mod_fifo</fieldname>
- <description>FIFO provides custom call queues including call park.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_voicemail</fielddescr>
- <fieldname>mod_voicemail</fieldname>
- <description>Full featured voicemail module.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_limit</fielddescr>
- <fieldname>mod_limit</fieldname>
- <description>Resource limitation module.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_esf</fielddescr>
- <fieldname>mod_esf</fieldname>
- <description>Holds the multi cast paging application for SIP.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_fsv</fielddescr>
- <fieldname>mod_fsv</fieldname>
- <description>FreeSWITCH Video application (Recording and playback).</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>&lt;b&gt;SNOM Module&lt;/b&gt;</fielddescr>
- <fieldname>snom_module</fieldname>
- <description></description>
- <type>listtopic</type>
- </field>
- <field>
- <fielddescr>mod_snom</fielddescr>
- <fieldname>mod_snom</fieldname>
- <description></description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>&lt;b&gt;Dialplan Interfaces&lt;/b&gt;</fielddescr>
- <fieldname>dialplan_interfaces</fieldname>
- <description></description>
- <type>listtopic</type>
- </field>
- <field>
- <fielddescr>mod_dialplan_directory</fielddescr>
- <fieldname>mod_dialplan_directory</fieldname>
- <description>Allows you to obtain a dialplan from a directory resource.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_dialplan_xml</fielddescr>
- <fieldname>mod_dialplan_xml</fieldname>
- <description>Allows you to program dialplans in XML format.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_dialplan_asterisk</fielddescr>
- <fieldname>mod_dialplan_asterisk</fieldname>
- <description>Allows you to create dialplans the old-fashioned way.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_yaml</fielddescr>
- <fieldname>mod_yaml</fieldname>
- <description>Allows you to program dialplans in YAML format.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>&lt;b&gt;Codec Interfaces&lt;/b&gt;</fielddescr>
- <fieldname>codec_interfaces</fieldname>
- <description></description>
- <type>listtopic</type>
- </field>
- <field>
- <fielddescr>mod_voipcodecs</fielddescr>
- <fieldname>mod_voipcodecs</fieldname>
- <description></description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_g723_1</fielddescr>
- <fieldname>mod_g723_1</fieldname>
- <description>G.723.1 codec.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_g729</fielddescr>
- <fieldname>mod_g729</fieldname>
- <description>G729 codec is only supported in passthrough mode.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_amr</fielddescr>
- <fieldname>mod_amr</fieldname>
- <description>amr codec.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_ilbc</fielddescr>
- <fieldname>mod_ilbc</fieldname>
- <description>ILBC codec.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_speex</fielddescr>
- <fieldname>mod_speex</fieldname>
- <description>Speex codec.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_siren</fielddescr>
- <fieldname>mod_siren</fieldname>
- <description>Siren codec.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_celt</fielddescr>
- <fieldname>mod_celt</fieldname>
- <description>Celt codec.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_h26x</fielddescr>
- <fieldname>mod_h26x</fieldname>
- <description>H26X signed linear codec. Video Pass-thru.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>&lt;b&gt;File Format Interfaces&lt;/b&gt;</fielddescr>
- <fieldname>file_format_interfaces</fieldname>
- <description></description>
- <type>listtopic</type>
- </field>
- <field>
- <fielddescr>mod_sndfile</fielddescr>
- <fieldname>mod_sndfile</fieldname>
- <description>Multi-format file format transcoder (WAV, etc).</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_native_file</fielddescr>
- <fieldname>mod_native_file</fieldname>
- <description>File interface for codec specific file formats.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>&lt;b&gt;Streams/Files&lt;/b&gt;</fielddescr>
- <fieldname>streams_files</fieldname>
- <description></description>
- <type>listtopic</type>
- </field>
- <field>
- <fielddescr>mod_shout</fielddescr>
- <fieldname>mod_shout</fieldname>
- <description>mp3 files and shoutcast streams.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_local_stream</fielddescr>
- <fieldname>mod_local_stream</fieldname>
- <description>For local streams (play all the files in a directory).</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_tone_stream</fielddescr>
- <fieldname>mod_tone_stream</fieldname>
- <description>Generate tone streams.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>&lt;b&gt;Languages&lt;/b&gt;</fielddescr>
- <fieldname>languages</fieldname>
- <description></description>
- <type>listtopic</type>
- </field>
- <field>
- <fielddescr>mod_spidermonkey</fielddescr>
- <fieldname>mod_spidermonkey</fieldname>
- <description>JavaScript support.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_perl</fielddescr>
- <fieldname>mod_perl</fieldname>
- <description>Perl support.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_python</fielddescr>
- <fieldname>mod_python</fieldname>
- <description>Python support.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_java</fielddescr>
- <fieldname>mod_java</fieldname>
- <description>Java support.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_lua</fielddescr>
- <fieldname>mod_lua</fieldname>
- <description>Lua support.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>&lt;b&gt;ASR /TTS&lt;/b&gt;</fielddescr>
- <fieldname>asr_tts</fieldname>
- <description></description>
- <type>listtopic</type>
- </field>
- <field>
- <fielddescr>mod_flite</fielddescr>
- <fieldname>mod_flite</fieldname>
- <description>Free open source Text to Speech.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_pocketsphinx</fielddescr>
- <fieldname>mod_pocketsphinx</fieldname>
- <description>Free open source Speech Recognition.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_cepstral</fielddescr>
- <fieldname>mod_cepstral</fieldname>
- <description>Links into Cepstral for dynamic sound output. Not available on this build.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_openmrcp</fielddescr>
- <fieldname>mod_openmrcp</fieldname>
- <description>Module for an open MRCP implementation.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_rss</fielddescr>
- <fieldname>mod_rss</fieldname>
- <description>Reads RSS feeds via a TTS engine.</description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>&lt;b&gt;Say&lt;/b&gt;</fielddescr>
- <fieldname>say</fieldname>
- <description></description>
- <type>listtopic</type>
- </field>
- <field>
- <fielddescr>mod_say_en</fielddescr>
- <fieldname>mod_say_en</fieldname>
- <description></description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>mod_say_zh</fielddescr>
- <fieldname>mod_say_zh</fieldname>
- <description></description>
- <type>select</type>
- <options>
- <option>
- <name>enable</name>
- <value>enable</value>
- </option>
- <option>
- <name>disable</name>
- <value>disable</value>
- </option>
- </options>
- </field>
- </fields>
- <custom_add_php_command>
- </custom_add_php_command>
- <custom_php_resync_config_command>
- sync_package_freeswitch_modules();
- </custom_php_resync_config_command>
- <custom_delete_php_command>
- sync_package_freeswitch_modules();
- </custom_delete_php_command>
- <custom_php_deinstall_command>
- </custom_php_deinstall_command>
-</packagegui> \ No newline at end of file
diff --git a/config/freeswitch/freeswitch_profile_edit.tmp b/config/freeswitch/freeswitch_profile_edit.tmp
deleted file mode 100644
index 2466f115..00000000
--- a/config/freeswitch/freeswitch_profile_edit.tmp
+++ /dev/null
@@ -1,143 +0,0 @@
-<?php
-/* $Id$ */
-/*
- freeswitch_profile_edit.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/freeswitch.inc");
-
-//$a_extensions = &$config['installedpackages']['freeswitchprofiles']['config'];
-
-$fd = fopen("/usr/local/freeswitch/conf/sip_profiles/".$_GET['f'], "r");
-$content = fread($fd, filesize("/usr/local/freeswitch/conf/sip_profiles/".$_GET['f']));
-fclose($fd);
-
-include("head.inc");
-
-?>
-
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-
-<script language="Javascript">
-function sf() { document.forms[0].savetopath.focus(); }
-</script>
-<script language="Javascript" type="text/javascript" src="/edit_area/edit_area_full.js"></script>
-<script language="Javascript" type="text/javascript">
- // initialisation
- editAreaLoader.init({
- id: "code" // id of the textarea to transform
- ,start_highlight: false
- ,allow_toggle: false
- ,language: "en"
- ,syntax: "html"
- ,toolbar: "search, go_to_line,|, fullscreen, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help"
- ,syntax_selection_allow: "css,html,js,php,xml,c,cpp,sql"
- ,show_line_colors: true
- });
-</script>
-
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">FreeSWITCH: Edit Profile</p>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-display_top_tabs(build_menu());
-
-?>
-</td></tr>
-</table>
-
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
-<form action="freeswitch_profiles.php" method="post" name="iform" id="iform">
-<?php
-
-?>
- <table width="98%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Edit Profile<br>
- </strong></span>
- Use this to configure your SIP profiles.
- </p>
- </td>
- <td align='right' valign='middle'>Filename: <input type="text" name="f" value="<?php echo $_GET['f']; ?>" /><input type="submit" value="save" /></td>
- </tr>
- </table>
- <br />
- <br />
-
- <textarea style="width:98%" id="code" name="code" rows="30" cols="<?php echo $cols; ?>" name="content"><?php echo htmlentities($content); ?></textarea>
- <br />
- <br />
-
- <table width="98%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td>/usr/local/freeswitch/conf/sip_profiles/<?php echo $_GET['f']; ?></td>
- <td align='right'>
- <input type="hidden" name="a" value="save" />
- <?php
- echo "<input type='button' value='Restore Default' onclick=\"document.location.href='/packages/freeswitch/freeswitch_profiles.php?a=default&f=".$_GET['f']."';\" />";
- ?>
- </td>
- </tr>
- </table>
-
-</form>
-
-<br>
-<br>
-
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-
-</td>
-</tr>
-</table>
-
-</div>
-
-
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch/freeswitch_profiles.tmp b/config/freeswitch/freeswitch_profiles.tmp
deleted file mode 100644
index 188619f4..00000000
--- a/config/freeswitch/freeswitch_profiles.tmp
+++ /dev/null
@@ -1,214 +0,0 @@
-<?php
-/* $Id$ */
-/*
- freeswitch_profiles.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/freeswitch.inc");
-
-//$a_extensions = &$config['installedpackages']['freeswitchextensions']['config'];
-
-
-if ($_GET['a'] == "default") {
- conf_mount_rw();
- exec("cp /usr/local/freeswitch/conf.orig/sip_profiles/".$_GET['f']." /usr/local/freeswitch/conf/sip_profiles/".$_GET['f']);
- $savemsg = "Restore Default";
- conf_mount_ro();
-}
-
-if ($_POST['a'] == "save") {
- conf_mount_rw();
- $content = ereg_replace("\r","",$_POST['code']);
- $fd = fopen("/usr/local/freeswitch/conf/sip_profiles/".$_POST['f'], "w");
- fwrite($fd, $content);
- fclose($fd);
- $savemsg = "Saved";
- conf_mount_ro();
-}
-
-
-if ($_GET['a'] == "del") {
- if ($_GET['type'] == 'profile') {
- //if ($a_profiles[$_GET['id']]) {
- //unset($a_extensions[$_GET['id']]);
- //write_config();
-
- exec("rm /usr/local/freeswitch/conf/sip_profiles/".$_GET['f']);
- header("Location: freeswitch_profiles.php");
- exit;
- //}
- }
-}
-
-include("head.inc");
-
-?>
-
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">FreeSWITCH: Profiles</p>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-display_top_tabs(build_menu());
-
-?>
-</td></tr>
-</table>
-
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
-<form action="freeswitch_profiles.php" method="post" name="iform" id="iform">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Profiles<br>
- </strong></span>
- Use this to configure your SIP profiles.
- </p></td>
- </tr>
- </table>
- <br />
-
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="25%" class="listhdrr">Name</td>
- <td width="70%" class="listhdr">Description</td>
- <td width="5%" class="list">
- </td>
- </tr>
-
-
- <?php
-
- foreach (ListFiles('/usr/local/freeswitch/conf/sip_profiles') as $key=>$file){
- ?>
- <tr>
- <td class="listr" ondblclick="document.location='freeswitch_profile_edit.php?f=<?=$file;?>';" valign="middle">
- <?=$file;?>&nbsp;
- </td>
- <td class="listbg" ondblclick="document.location='freeswitch_profile_edit.php?f=<?=$file;?>';">
- <?php
-
- switch ($file) {
- case "internal.xml":
- echo "<font color='#FFFFFF'>";
- echo "The Internal profile by default requires registration which is most often used for extensions. ";
- echo "By default the Internal profile binds to the WAN IP which is accessible to the internal network. ";
- echo "A rule can be set from PFSense -> Firewall -> Rules -> WAN to the the WAN IP for port 5060 which ";
- echo "enables phones register from outside the network.";
- echo "";
- echo "</font>";
- echo "&nbsp;";
- break;
- case "internal-ipv6.xml":
- echo "<font color='#FFFFFF'>The Internal IPV6 profile binds to the IP version 6 address and is similar to the Internal profile.</font>&nbsp;";
- break;
- case "external.xml":
- echo "<font color='#FFFFFF'>";
- echo "The External profile handles outbound registrations to a SIP provider or other SIP Server. The SIP provider sends calls to you, and you ";
- echo "send calls to your provider, through the external profile. The external profile allows anonymous calling, which is ";
- echo "required as your provider will never authenticate with you to send you a call. Calls can be sent using a SIP URL \"my.domain.com:5080\" ";
- echo "</font>&nbsp;";
- break;
- case "lan.xml":
- echo "<font color='#FFFFFF'>The LAN profile is the same as the Internal profile except that it is bound to the LAN IP.</font>&nbsp;";
- break;
- default:
- echo "<font color='#FFFFFF'>default</font>&nbsp;";
- }
- ?>
- </td>
- <td valign="middle" nowrap class="list" valign="top">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="freeswitch_profile_edit.php?type=profile&f=<?=$file;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="freeswitch_profiles.php?type=profile&a=del&f=<?=$file;?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
- $i++;
- }
-
- ?>
-
- <tr>
- <td class="list" colspan="4"></td>
- <td class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"></td>
- </tr>
- </table>
- </td>
- </tr>
-
-
- <tr>
- <td class="list" colspan="4"></td>
- <td class="list"></td>
- </tr>
- </table>
-
-</form>
-
-<br>
-<br>
-/usr/local/freeswitch/conf/sip_profiles
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-
-</td>
-</tr>
-</table>
-
-</div>
-
-
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch/freeswitch_public.tmp b/config/freeswitch/freeswitch_public.tmp
deleted file mode 100644
index 0c05fe47..00000000
--- a/config/freeswitch/freeswitch_public.tmp
+++ /dev/null
@@ -1,162 +0,0 @@
-<?php
-/* $Id$ */
-/*
- freeswitch_public.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/freeswitch.inc");
-
-//$a_extensions = &$config['installedpackages']['freeswitchprofiles']['config'];
-
-if ($_GET['a'] == "default") {
- conf_mount_rw();
- exec("cp /usr/local/freeswitch/conf.orig/dialplan/public.xml /usr/local/freeswitch/conf/dialplan/public.xml");
- $savemsg = "Default Restored";
- conf_mount_ro();
-}
-
-if ($_POST['a'] == "save") {
- conf_mount_rw();
- $content = ereg_replace("\r","",$_POST['code']);
- $fd = fopen("/usr/local/freeswitch/conf/dialplan/public.xml", "w");
- fwrite($fd, $content);
- fclose($fd);
- $savemsg = "Saved";
- conf_mount_ro();
-}
-
-
-$fd = fopen("/usr/local/freeswitch/conf/dialplan/public.xml", "r");
-$content = fread($fd, filesize("/usr/local/freeswitch/conf/dialplan/public.xml"));
-fclose($fd);
-
-include("head.inc");
-
-?>
-
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-
-<script language="Javascript">
-function sf() { document.forms[0].savetopath.focus(); }
-</script>
-<script language="Javascript" type="text/javascript" src="/edit_area/edit_area_full.js"></script>
-<script language="Javascript" type="text/javascript">
- // initialisation
- editAreaLoader.init({
- id: "code" // id of the textarea to transform
- ,start_highlight: false
- ,allow_toggle: false
- ,language: "en"
- ,syntax: "html"
- ,toolbar: "search, go_to_line,|, fullscreen, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help"
- ,syntax_selection_allow: "css,html,js,php,xml,c,cpp,sql"
- ,show_line_colors: true
- });
-</script>
-
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">FreeSWITCH: Public</p>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-display_top_tabs(build_menu());
-
-?>
-</td></tr>
-</table>
-
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
-<form action="freeswitch_public.php" method="post" name="iform" id="iform">
-<?php
-
-?>
- <table width="98%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width='90%'><p><span class="vexpl"><span class="red"><strong>Public<br>
- </strong></span>
- Directs inbound calls to extensions, IVRs, external numbers, and scripts.
- </p>
- </td>
- <td width='10%' align='right' valign='middle'><input type="submit" value="save" /></td>
- </tr>
- </table>
- <br />
- <br />
-
- <textarea style="width:98%" id="code" name="code" rows="30" cols="<?php echo $cols; ?>" name="content"><?php echo htmlentities($content); ?></textarea>
- <br />
- <br />
-
- <table width="98%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td>/usr/local/freeswitch/conf/dialplan/public.xml</td>
- <td align='right'>
- <input type="hidden" name="f" value="<?php echo $_GET['f']; ?>" />
- <input type="hidden" name="a" value="save" />
- <?php
- echo "<input type='button' value='Restore Default' onclick=\"document.location.href='/packages/freeswitch/freeswitch_public.php?a=default&f=public.xml';\" />";
- ?>
- </td>
- </tr>
- </table>
-
-</form>
-
-<br>
-<br>
-
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-
-</td>
-</tr>
-</table>
-
-</div>
-
-
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch/freeswitch_public_includes.tmp b/config/freeswitch/freeswitch_public_includes.tmp
deleted file mode 100644
index 51a535d4..00000000
--- a/config/freeswitch/freeswitch_public_includes.tmp
+++ /dev/null
@@ -1,282 +0,0 @@
-<?php
-/* $Id$ */
-/*
- freeswitch_public_includes.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/freeswitch.inc");
-
-
-//freeswitchpublicincludes
- //publicincludeid
- //extensionname
- //context
- //default
- //enabled
- //descr
-
-//freeswitchpublicincludedetails
-
- //publicincludeid
- //tag
- //condition
- //action
- //antiaction
- //param
- //tagorder
- //1-20
- //fieldtype
-
- //fielddata
-
-
-$a_public_includes = &$config['installedpackages']['freeswitchpublicincludes']['config'];
-$a_public_includes_details = &$config['installedpackages']['freeswitchpublicincludedetails']['config'];
-
-
-if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'publicincludes') {
-
- if ($a_public_includes[$_GET['id']]) {
-
- $publicincludeid = $a_public_includes[$_GET['id']][publicincludeid];
-
- $extensionname = $a_public_includes[$_GET['id']][extensionname];
- $order = $a_public_includes[$_GET['id']][order];
- $publicincludefilename = $order."_".$extensionname.".xml";
-
- //delete the public include details. aka. child data
- if (count($a_public_includes_details) > 0) {
- $i=0;
- if (count($a_public_includes_details) > 0) {
- foreach($a_public_includes_details as $row) {
- if ($row["publicincludeid"] == $publicincludeid) {
- //echo "child id: ".$i."<br />\n";
- unset($a_public_includes_details[$i]);
- }
- $i++;
- }
- }
- }
-
- //if the public include xml file exists then delete it
- if (file_exists("/usr/local/freeswitch/conf/dialplan/public/".$publicincludefilename)) {
- unlink("/usr/local/freeswitch/conf/dialplan/public/".$publicincludefilename);
- }
-
- unset($publicincludefilename);
- unset($a_public_includes[$_GET['id']]);
- write_config();
- sync_package_freeswitch_public_includes();
- header("Location: freeswitch_public_includes.php");
- exit;
- }
- }
-}
-
-include("head.inc");
-
-?>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">FreeSWITCH: Public</p>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-display_top_tabs(build_menu());
-
-?>
-</td></tr>
-</table>
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
-<form action="freeswitch_public_includes.php" method="post" name="iform" id="iform">
-<?php
-
-
-//echo "<pre>";
-//print_r ($a_public_includes);
-//echo "</pre>";
-
-
-//if ($config_change == 1) {
-// write_config();
-// $config_change = 0;
-//}
-
-//if ($savemsg) print_info_box($savemsg);
-//if (file_exists($d_hostsdirty_path)): echo"<p>";
-//print_info_box_np("The FreeSWITCH recordings have been changed.<br>You must apply the changes in order for them to take effect.");
-//echo"<br />";
-//endif;
-
-?>
-
- <br />
- <br />
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td><span class="vexpl"><span class="red"><strong>Public
- </strong></span></span>
- </td>
- <td align='right'>
- <input type='button' value='public.xml' alt='' onclick="document.location.href='/packages/freeswitch/freeswitch_public.php';">
- </td>
- </tr>
- <tr>
- <td colspan='2'>
- <span class="vexpl">
- The public dialplan is used to route incoming calls to destinations based on conditions and context. It can send incoming calls to IVRs, extensions, external numbers, and scripts.
- </span>
- </td>
-
- </tr>
- </table>
-
- <br />
- <br />
- <br />
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="20%" class="listhdrr">Extension Name</td>
- <td width="25%" class="listhdrr">Order</td>
- <td width="25%" class="listhdrr">Enabled</td>
- <td width="50%" class="listhdr">Description</td>
- <td width="10%" class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="freeswitch_public_includes_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
-
- <?php
- //create a temporary id for the array
- $i = 0;
- if (count($a_public_includes) > 0) {
- foreach ($a_public_includes as $ent) {
- $a_public_includes[$i]['id'] = $i;
- $i++;
- }
- }
-
- //order the array
- function cmp_number($a, $b) {
- if ($a["order"] > $b["order"]) {
- return 1;
- }
- else {
- return 0;
- }
- }
- if (count($a_public_includes) > 0) { usort($a_public_includes, "cmp_number"); }
-
- $i = 0;
- if (count($a_public_includes) > 0) {
- foreach ($a_public_includes as $ent) {
- if (strlen($ent['extensionname'].$ent['enabled']) > 0) {
- ?>
- <tr>
- <td class="listlr" ondblclick="document.location='freeswitch_public_includes_edit.php?id=<?=$ent['id'];?>'">
- <?=$ent['extensionname']?>
- </td>
- <td class="listlr" ondblclick="document.location='freeswitch_public_includes_edit.php?id=<?=$ent['id'];?>'">
- <?=$ent['order']?>
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_public_includes_edit.php?id=<?=$ent['id'];?>';">
- <?=$ent['enabled'];?>&nbsp;
- </td>
- <td class="listbg" ondblclick="document.location='freeswitch_public_includes_edit.php?id=<?=$ent['id'];?>';">
- <font color="#FFFFFF"><?=htmlspecialchars($ent['descr']);?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="freeswitch_public_includes_edit.php?id=<?=$ent['id'];?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="freeswitch_public_includes.php?type=publicincludes&act=del&id=<?=$ent['id'];?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
- } //end if strlen
- $i++;
- } //end for each
- } //end if count
- ?>
- <tr>
- <td class="list" colspan="4"></td>
- <td class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="freeswitch_public_includes_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
-
- <tr>
- <td class="list" colspan="4"></td>
- <td class="list"></td>
- </tr>
- </table>
-
-</form>
-
-/usr/local/freeswitch/conf/dialplan/public/
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-
-</td>
-</tr>
-</table>
-
-</div>
-
-
-<?php include("fend.inc"); ?>
-</body>
-</html> \ No newline at end of file
diff --git a/config/freeswitch/freeswitch_public_includes_details.tmp b/config/freeswitch/freeswitch_public_includes_details.tmp
deleted file mode 100755
index 3b3130b0..00000000
--- a/config/freeswitch/freeswitch_public_includes_details.tmp
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-/* $Id$ */
-/*
- freeswitch_public_includes_details.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/freeswitch.inc");
-
-
-$a_public_include_details = &$config['installedpackages']['freeswitchpublicincludedetails']['config'];
-
-
-if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'publicincludedetails') {
- if ($a_public_include_details[$_GET['id']]) {
- unset($a_public_include_details[$_GET['id']]);
- write_config();
- sync_package_freeswitch_public_includes();
- //touch($d_hostsdirty_path);
- header("Location: freeswitch_public_includes_edit.php?id=".$_GET['parentid']);
- exit;
- }
- }
-}
-
-?> \ No newline at end of file
diff --git a/config/freeswitch/freeswitch_public_includes_details_edit.tmp b/config/freeswitch/freeswitch_public_includes_details_edit.tmp
deleted file mode 100644
index c6cba5be..00000000
--- a/config/freeswitch/freeswitch_public_includes_details_edit.tmp
+++ /dev/null
@@ -1,419 +0,0 @@
-<?php
-/* $Id$ */
-/*
- freeswitch_public_includes_details_edit.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/freeswitch.inc");
-
-
-$a_public_includes_details = &$config['installedpackages']['freeswitchpublicincludedetails']['config'];
-
-$id = $_GET['id'];
-if (isset($_POST['id'])) {
- $id = $_POST['id'];
-}
-
-$parentid = $_GET['parentid'];
-if (isset($_POST['parentid'])) {
- $parentid = $_POST['parentid'];
-}
-
-$publicincludeid = $_GET['publicincludeid'];
-if (isset($_POST['publicincludeid'])) {
- $publicincludeid = $_POST['publicincludeid'];
-}
-
-
- //publicincludeid
- //tag
- //condition
- //action
- //antiaction
- //param
- //fieldtype
- //fielddata
- //fieldorder
- //000-999
-
-if (isset($id) && $a_public_includes_details[$id]) {
- $pconfig['publicincludeid'] = $a_public_includes_details[$id]['publicincludeid'];
- $pconfig['tag'] = $a_public_includes_details[$id]['tag'];
- $pconfig['fieldtype'] = $a_public_includes_details[$id]['fieldtype'];
- $pconfig['fielddata'] = $a_public_includes_details[$id]['fielddata'];
- $pconfig['fieldorder'] = $a_public_includes_details[$id]['fieldorder'];
-}
-//else {
-// if (isset($_GET['a'])) {
-// if ($_GET['a'] == "action"){ $pconfig['optionaction'] = "action"; }
-// if ($_GET['a'] == "antiaction"){ $pconfig['optionaction'] = "anti-action"; }
-// }
-//}
-
-
-
-if ($_POST) {
-
- unset($input_errors);
- $pconfig = $_POST;
-
- if (!$input_errors) {
-
- $ent = array();
- $ent['publicincludeid'] = $_POST['publicincludeid'];
- $ent['tag'] = $_POST['tag'];
- $ent['fieldtype'] = $_POST['fieldtype'];
- $ent['fielddata'] = $_POST['fielddata'];
- $ent['fieldorder'] = $_POST['fieldorder'];
-
- if (isset($id) && $a_public_includes_details[$id]) {
- //update
- $a_public_includes_details[$id] = $ent;
- }
- else {
- //add
- $a_public_includes_details[] = $ent;
- }
-
- //touch($d_hostsdirty_path);
- write_config();
- sync_package_freeswitch_public_includes();
-
- header("Location: freeswitch_public_includes_edit.php?id=".$parentid);
- exit;
- }
-}
-
-include("head.inc");
-
-?>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">FreeSWITCH: Public: Details: Edit</p>
-
-<?php if ($input_errors) print_input_errors($input_errors); ?>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-display_top_tabs(build_menu());
-
-?>
-</td></tr>
-</table>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
- <br />
- <form action="freeswitch_public_includes_details_edit.php" method="post" name="iform" id="iform">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="22%" valign="top" class="vncellreq">Tag</td>
- <td width="78%" class="vtable">
- <script type="text/javascript">
- function public_include_details_tag_onchange() {
- var tag = document.getElementById("form_tag").value;
- if (tag == "condition") {
- document.getElementById("label_fieldtype").innerHTML = "Field";
- document.getElementById("label_fielddata").innerHTML = "Expression";
- }
- else if (tag == "action") {
- document.getElementById("label_fieldtype").innerHTML = "Application";
- document.getElementById("label_fielddata").innerHTML = "Data";
- }
- else if (tag == "anti-action") {
- document.getElementById("label_fieldtype").innerHTML = "Application";
- document.getElementById("label_fielddata").innerHTML = "Data";
- }
- else if (tag == "param") {
- document.getElementById("label_fieldtype").innerHTML = "Name";
- document.getElementById("label_fielddata").innerHTML = "Value";
- }
- if (tag == "") {
- document.getElementById("label_fieldtype").innerHTML = "Type";
- document.getElementById("label_fielddata").innerHTML = "Data";
- }
- }
- </script>
- <?php
- echo " <select name='tag' class='formfld' id='form_tag' onchange='public_include_details_tag_onchange();'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['tag'])) {
- case "condition":
- echo " <option selected='yes'>condition</option>\n";
- echo " <option>action</option>\n";
- echo " <option>anti-action</option>\n";
- //echo " <option>param</option>\n";
- break;
- case "action":
- echo " <option>condition</option>\n";
- echo " <option selected='yes'>action</option>\n";
- echo " <option>anti-action</option>\n";
- //echo " <option>param</option>\n";
- break;
- case "anti-action":
- echo " <option>condition</option>\n";
- echo " <option>action</option>\n";
- echo " <option selected='yes'>anti-action</option>\n";
- //echo " <option>param</option>\n";
- break;
- case "param":
- echo " <option>condition</option>\n";
- echo " <option>action</option>\n";
- echo " <option>anti-action</option>\n";
- //echo " <option selected='yes'>param</option>\n";
- break;
- default:
- echo " <option>condition</option>\n";
- echo " <option>action</option>\n";
- echo " <option>anti-action</option>\n";
- //echo " <option>param</option>\n";
- }
- echo " </select>\n";
-
- //condition
- //field expression
- //action
- //application
- //data
- //antiaction
- //application
- //data
- //param
- //name
- //value
-
- ?>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq" id="label_fieldtype">Type</td>
- <td width="78%" class="vtable">
- <input name="fieldtype" type="text" class="formfld" id="fieldtype" size="40" value="<?=htmlspecialchars($pconfig['fieldtype']);?>">
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq" id="label_fielddata">Data</td>
- <td width="78%" class="vtable">
- <input name="fielddata" type="text" class="formfld" id="fielddata" size="40" value="<?=htmlspecialchars($pconfig['fielddata']);?>">
- <br> <span class="vexpl"></span></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq" id="label_fieldtype">Order</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='fieldorder' class='formfld'>\n";
- //echo " <option></option>\n";
- if (strlen(htmlspecialchars($pconfig['fieldorder']))> 0) {
- echo " <option selected='yes' value='".htmlspecialchars($pconfig['fieldorder'])."'>".htmlspecialchars($pconfig['fieldorder'])."</option>\n";
- }
- $i=0;
- while($i<=999) {
- if (strlen($i) == 1) {
- echo " <option value='00$i'>00$i</option>\n";
- }
- if (strlen($i) == 2) {
- echo " <option value='0$i'>0$i</option>\n";
- }
- if (strlen($i) == 3) {
- echo " <option value='$i'>$i</option>\n";
- }
-
- $i++;
- }
- echo " </select>\n";
- ?>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="publicincludeid" type="hidden" value="<?=$publicincludeid;?>">
- <input name="parentid" type="hidden" value="<?=$parentid;?>">
- <?php if (isset($id) && $a_public_includes_details[$id]): ?>
- <input name="id" type="hidden" value="<?=$id;?>">
- <?php endif; ?>
- <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()">
- </td>
- </tr>
- </table>
- </form>
-
-
- <br />
- <br />
- <b>Example</b>
- <br />
- <br />
- If the inbound call matches the DID 12085551234 then proceed to the action.
- <br />
- <br />
- <table cellpadding='3'>
- <tr><th class="vncellreq" width='75' align="left">Tag:</th><td class="vtable">condition</td></tr>
- <tr><th class="vncellreq" align="left">Type:</th><td class="vtable">destination_number</td></tr>
- <tr><th class="vncellreq" align="left">Data:</th><td class="vtable">^(12085551234)$</td></tr>
- </table>
-
- <br />
- <br />
-
- Transfer the inbound call to an IVR with extension of 5000.
- <br />
- <br />
- <table cellpadding='3'>
- <tr><th class="vncellreq" width='75' align="left">Tag:</th><td class="vtable">action</td></tr>
- <tr><th class="vncellreq" align="left">Application:</th><td class="vtable">transfer</td></tr>
- <tr><th class="vncellreq" align="left">Data:</th><td class="vtable">5000 XML default</td></tr>
- </table>
-
- <br />
- <br />
-
- Or transfer the inbound call to extension 1001.
- <br />
- <br />
- <table cellpadding='3'>
- <tr><th class="vncellreq" width='75' align="left">Tag:</th><td class="vtable">action</td></tr>
- <tr><th class="vncellreq" align="left">Application:</th><td class="vtable">transfer</td></tr>
- <tr><th class="vncellreq" align="left">Data:</th><td class="vtable">1001 XML default</td></tr>
- </table>
-
-
- <br />
- <br />
- <br />
- <br />
-
-
- <b>Conditions</b>
- <br />
- <br />
- Conditions are pattern matching tags that help FreeSwitch decide if the current call should be processed in this extension or not. When matching conditions against the current call you have several <b>fields</b> that you can compare against.
- <ul>
- <li><b>context</b></li>
- <li><b>rdnis</b> Redirected Number, the directory number to which the call was last presented.</li>
- <li><b>destination_number</b> Called Number, the number this call is trying to reach (within a given context)</li>
- <li><b>public</b> Name of the public module that are used, the name is provided by each public module. Example: XML</li>
- <li><b>caller_id_name</b> Name of the caller (provided by the User Agent that has called us).</li>
- <li><b>caller_id_number</b> Directory Number of the party who called (callee) -- can be masked (hidden)</li>
- <li><b>ani</b> Automatic Number Identification, the number of the calling party (callee) -- cannot be masked</li>
- <li><b>ani2</b> The type of device placing the call [1]</li>
- <li><b>uuid</b> Unique identifier of the current call? (looks like a GUID)</li>
- <li><b>source</b> Name of the FreeSwitch module that received the call (e.g. PortAudio)</li>
- <li><b>chan_name</b> Name of the current channel (Example: PortAudio/1234). Give us examples when this one can be used.</li>
- <li><b>network_addr</b> IP address of the signalling source for a VoIP call.</li>
- </ul>
- In addition to the above you can also do variables using the syntax ${variable} or api functions using the syntax %{api} {args}
- <br />
- <br />
- Variables may be used in either the field or the expression, as follows
-
- <br />
- <br />
- <br />
- <br />
-
- <b>Action and Anti-Actions</b>
- <br />
- <br />
- Actions are executed when the <b>condition matches</b>. Anti-Actions are executed when the <b>condition does NOT match</b>.
- Additional information on applications for Actions and Anti-Actions.<br />
- <a href='http://wiki.freeswitch.org/wiki/Modules#Applications' target='_blank'>http://wiki.freeswitch.org/wiki/Modules#Applications</a>
- <br />
- <a href='http://wiki.freeswitch.org/wiki/public_Functions' target='_blank'>http://wiki.freeswitch.org/wiki/public_Functions</a>
- <br />
- <br />
- <br />
- The following is a partial list of <b>applications</b>.
- <ul>
- <li><b>answer</b> answer the call</li>
- <li><b>bridge</b> bridge the call<li>
- <li><b>cond</b></li>
- <li><b>db</b> is a a runtime database either sqlite by default or odbc</li>
- <li><b>global_set</b> allows setting of global vars similar to the ones found in vars.xml</li>
- <li><b>group</b> allows grouping of several extensions for things like ring groups</li>
- <li><b>expr</b></li>
- <li><b>hangup</b> hangs up the call</li>
- <li><b>info</b> sends call info to the console</li>
- <li><b>javascript</b> run javascript .js files</li>
- <li><b>playback</b></li>
- <li><b>reject</b> reject the call</li>
- <li><b>respond</b></li>
- <li><b>ring_ready</b></li>
- <li><b>set</b> set a variable</li>
- <li><b>set_user</b></li>
- <li><b>sleep</b></li>
- <li><b>sofia_contact</b></li>
- <li><b>transfer</b> transfer the call to another extension or number<li>
- <li><b>voicemail</b> send the call to voicemail</li>
- </ul>
-
-
- <br />
- <br />
-
- <!--
- <b>Param</b>
- Example parameters by name and value
- <br />
- <a href='http://wiki.freeswitch.org/wiki/Special:Search?search=param&go=Go' target='_blank'>http://wiki.freeswitch.org/wiki/Special:Search?search=param&go=Go</a>
- <ul>
- <li><b>codec-ms</b> 20</li>
- <li><b>codec-prefs</b> PCMU@20i</li>
- <li><b>debug</b> 1</li>
- <li><b>public</b> XML</li>
- <li><b>dtmf-duration</b> 100</li>
- <li><b>rfc2833-pt</b>" 101</li>
- <li><b>sip-port</b> 5060</li>
- <li><b>use-rtp-timer</b> true</li>
- </ul>
- <br />
- <br />
- -->
-
-
- <br />
- <br />
- <br />
- <br />
- <br />
-
- </td>
- </tr>
-</table>
-
-</div>
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch/freeswitch_public_includes_edit.tmp b/config/freeswitch/freeswitch_public_includes_edit.tmp
deleted file mode 100644
index e98dedeb..00000000
--- a/config/freeswitch/freeswitch_public_includes_edit.tmp
+++ /dev/null
@@ -1,543 +0,0 @@
-<?php
-/* $Id$ */
-/*
- freeswitch_public_includes_edit.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/freeswitch.inc");
-
-
-
-//freeswitchpublicincludes
- //publicincludeid
- //extensionname
- //context
- //default
- //enabled
- //descr
-
-//
-
-
-
-$a_public_includes = &$config['installedpackages']['freeswitchpublicincludes']['config'];
-$a_public_include_details = &$config['installedpackages']['freeswitchpublicincludedetails']['config'];
-
-$id = $_GET['id'];
-if (isset($_POST['id'])) {
- $id = $_POST['id'];
-}
-$parentid = $id;
-
-
-
-if (isset($id) && $a_public_includes[$id]) {
- $pconfig['publicincludeid'] = $a_public_includes[$id]['publicincludeid'];
- $publicincludeid = $a_public_includes[$id]['publicincludeid'];
- $pconfig['extensionname'] = $a_public_includes[$id]['extensionname'];
- $pconfig['order'] = $a_public_includes[$id]['order'];
- $pconfig['context'] = $a_public_includes[$id]['context'];
- $pconfig['enabled'] = $a_public_includes[$id]['enabled'];
- $pconfig['descr'] = $a_public_includes[$id]['descr'];
- $pconfig['opt1name'] = $a_public_includes[$id]['opt1name'];
- $pconfig['opt1value'] = $a_public_includes[$id]['opt1value'];
-}
-
-if ($_POST) {
-
- unset($input_errors);
- $pconfig = $_POST;
-
- if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'publicincludedetails') {
- if ($a_public_include_details[$_GET['id']]) {
- unset($a_public_include_details[$_GET['id']]);
- write_config();
- sync_package_freeswitch_public_includes();
- header("Location: freeswitch_public_include_edit.php?id=".$_GET['id']);
- exit;
- }
- }
- }
-
-
- if (!$input_errors) {
-
- $ent = array();
- if (strlen($_POST['publicincludeid']) > 0) {
- //update
- $ent['publicincludeid'] = $_POST['publicincludeid'];
- }
- else {
- //add
- $ent['publicincludeid'] = guid();
- }
- $ent['extensionname'] = $_POST['extensionname'];
- $ent['order'] = $_POST['order'];
- //$ent['context'] = $_POST['context'];
- $ent['context'] = 'default';
- $ent['enabled'] = $_POST['enabled'];
- $ent['descr'] = $_POST['descr'];
- $ent['opt1name'] = $_POST['opt1name'];
- $ent['opt1value'] = $_POST['opt1value'];
-
-
-
- if (isset($id) && $a_public_includes[$id]) {
- $a_public_includes = $config['installedpackages']['freeswitchpublicincludes']['config'];
- if (count($a_public_includes) > 0) {
- foreach($a_public_includes as $rowhelper) {
-
- //$rowhelper['publicincludeid'];
- //$rowhelper['extensionname'];
- //$rowhelper['context'];
- //$rowhelper['enabled'];
-
- $filenamechanged = false;
- if ($rowhelper['publicincludeid'] == $_POST['publicincludeid']) {
-
- if ($rowhelper['extensionname'] != $_POST['extensionname']) {
- //if the extension name has changed then remove the current public xml file
- //to prepare for the new file
- $filenamechanged = true;
- }
- if ($rowhelper['order'] != $_POST['order']) {
- //if the order has changed then remove the current public xml file
- //to prepare for the new file
- $filenamechanged = true;
- }
- if ($_POST['enabled'] == "false") {
- //if the extension name is disabled then remove the public xml file
- $filenamechanged = true;
- }
- if ($filenamechanged){
- $publicincludefilename = $rowhelper['order']."_".$rowhelper['extensionname'].".xml";
- if (file_exists("/usr/local/freeswitch/conf/dialplan/public/".$publicincludefilename)) {
- unlink("/usr/local/freeswitch/conf/dialplan/public/".$publicincludefilename);
- }
- unset($publicincludefilename);
- }
-
- }
- unset($filenamechanged);
-
- } //end foreach
- } //end if count
-
- //update the config
- $a_public_includes[$id] = $ent;
- }
- else {
- //add to the config
- $a_public_includes[] = $ent;
- }
-
-
- write_config();
- sync_package_freeswitch_public_includes();
-
- header("Location: freeswitch_public_includes.php");
- exit;
- }
-}
-
-include("head.inc");
-
-?>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">FreeSWITCH: Public: Edit</p>
-<?php if ($input_errors) print_input_errors($input_errors); ?>
-
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-display_top_tabs(build_menu());
-
-?>
-</td></tr>
-</table>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Public:<br>
- </strong></span>
- Public Include general settings.
- </span></p></td>
- </tr>
- </table>
- <br />
-
- <form action="freeswitch_public_includes_edit.php" method="post" name="iform" id="iform">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="22%" valign="top" class="vncellreq">Extension Name</td>
- <td width="78%" class="vtable">
- <input name="extensionname" type="text" class="formfld" id="extensionname" size="40" value="<?=htmlspecialchars($pconfig['extensionname']);?>">
- <br />
- Supported characters are 'a-z', 'A-Z', '0-9', underscore '_', and period '.'.
- </td>
- </tr>
- <!--
- <tr>
- <td width="22%" valign="top" class="vncellreq">Context</td>
- <td width="78%" class="vtable">
- <input name="context" type="text" class="formfld" id="context" size="40" value="<?=htmlspecialchars($pconfig['context']);?>">
- <br />
- e.g. default
- </td>
- </tr>
- -->
-
- <tr>
- <td width="22%" valign="top" class="vncellreq">Enabled</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='enabled' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['enabled'])) {
- case "true":
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- break;
- case "false":
- echo " <option value='true'>true</option>\n";
- echo " <option value='false' selected='yes'>false</option>\n";
-
- break;
- default:
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- }
- echo " </select>\n";
- ?>
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncellreq">Order</td>
- <td width="78%" class="vtable">
- <?php
-
- echo " <select name='order' class='formfld'>\n";
- echo " <option></option>\n";
- if (strlen(htmlspecialchars($pconfig['order']))> 0) {
- echo " <option selected='yes' value='".htmlspecialchars($pconfig['order'])."'>".htmlspecialchars($pconfig['order'])."</option>\n";
- }
- $i=0;
- while($i<=999) {
- if (strlen($i) == 1) {
- echo " <option value='00$i'>00$i</option>\n";
- }
- if (strlen($i) == 2) {
- echo " <option value='0$i'>0$i</option>\n";
- }
- if (strlen($i) == 3) {
- echo " <option value='$i'>$i</option>\n";
- }
-
- $i++;
- }
- echo " </select>\n";
- ?>
- <br />
- Processing of each public include is determined by this order.
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncell">Description</td>
- <td width="78%" class="vtable">
- <input name="descr" type="text" class="formfld" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>">
- <br> <span class="vexpl">You may enter a description here
- for your reference (not parsed).</span></td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="publicincludeid" type="hidden" value="<?=htmlspecialchars($pconfig['publicincludeid']);?>">
- <?php
- if (strlen($id) > 0 && $a_public_includes[$id]) {
- echo "\n";
- echo " <input name=\"id\" type=\"hidden\" value=\"$id\">\n";
- echo " <input name=\"opt1name\" type=\"hidden\" value=\"".htmlspecialchars($pconfig['opt1name'])."\">\n";
- echo " <input name=\"opt1value\" type=\"hidden\" value=\"".htmlspecialchars($pconfig['opt1value'])."\">\n";
- }
- ?>
- <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()">
- </td>
- </tr>
- </table>
- </form>
-
- <br>
- <br>
-
- <form action="freeswitch_public_includes_edit.php" method="post" name="iform2" id="iform2">
- <?php
-
- //echo "<pre>";
- //print_r ($a_public_includes);
- //echo "</pre>";
-
- //if ($savemsg) print_info_box($savemsg);
- //if (file_exists($d_hostsdirty_path)): echo"<p>";
- //print_info_box_np("The FreeSWITCH recordings have been changed.<br>You must apply the changes in order for them to take effect.");
- //echo"<br />";
- //endif;
-
- //create a temporary id for the array
- $i = 0;
- if (count($a_public_include_details) > 0) {
- foreach ($a_public_include_details as $ent) {
- $a_public_include_details[$i]['id'] = $i;
- $i++;
- }
- }
-
- //order the array
- function cmp_number_public_details($a, $b) {
- if ($a["fieldorder"] > $b["fieldorder"]) {
- return 1;
- }
- else {
- return 0;
- }
- }
- if (count($a_public_include_details) > 0) { usort($a_public_include_details, "cmp_number_public_details"); }
-
- ?>
-
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Conditions and Actions<br />
- </strong></span>
- The following conditions, actions and anti-actions are used in the public to direct call flow. Each is processed in order until you reach the action tag which tells FreeSWITCH what action to perform. You are not limited to only one condition or action tag for a given extension.
- </span></p></td>
- </tr>
- </table>
- <br />
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="40" class="listhdrr">Tag</td>
- <td width="40" class="listhdrr">Type</td>
- <td width="50%" class="listhdrr">Data</td>
- <td width="40" class="listhdrr">Order</td>
- <td width="40" class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="freeswitch_public_includes_details_edit.php?parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>&a=action"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
-
- <?php
-
- $i = 0;
- if (count($a_public_include_details) > 0) {
-
- foreach ($a_public_include_details as $ent) {
- if ($ent['tag'] == "condition" && $publicincludeid == $ent['publicincludeid']) {
- ?>
- <tr>
- <td class="listlr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>'">
- <?=$ent['tag']?>
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';">
- <?=$ent['fieldtype'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';">
- <?=$ent['fielddata'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';">
- <?=$ent['fieldorder'];?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="freeswitch_public_includes_details.php?type=publicincludedetails&act=del&id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
- }
- $i++;
- }
- }
-
- $i = 0;
- if (count($a_public_include_details) > 0) {
-
- foreach ($a_public_include_details as $ent) {
- if ($ent['tag'] == "action" && $publicincludeid == $ent['publicincludeid']) {
- ?>
- <tr>
- <td class="listlr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>'">
- <?=$ent['tag']?>
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';">
- <?=$ent['fieldtype'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';">
- <?=$ent['fielddata'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';">
- <?=$ent['fieldorder'];?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="freeswitch_public_includes_details.php?type=publicincludedetails&act=del&id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
- }
- $i++;
- }
- }
-
- $i = 0;
- if (count($a_public_include_details) > 0) {
-
- foreach ($a_public_include_details as $ent) {
- if ($ent['tag'] == "anti-action" && $publicincludeid == $ent['publicincludeid']) {
- ?>
- <tr>
- <td class="listlr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>'">
- <?=$ent['tag']?>
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';">
- <?=$ent['fieldtype'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';">
- <?=$ent['fielddata'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';">
- <?=$ent['fieldorder'];?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="freeswitch_public_includes_details.php?type=publicincludedetails&act=del&id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
- }
- $i++;
- }
- }
-
- $i = 0;
- if (count($a_public_include_details) > 0) {
-
- foreach ($a_public_include_details as $ent) {
- if ($ent['tag'] == "param" && $publicincludeid == $ent['publicincludeid']) {
- ?>
- <tr>
- <td class="listlr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>'">
- <?=$ent['tag']?>
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';">
- <?=$ent['fieldtype'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';">
- <?=$ent['fielddata'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';">
- <?=$ent['fieldorder'];?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="freeswitch_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="freeswitch_public_includes_details.php?type=publicincludedetails&act=del&id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
- }
- $i++;
- }
- }
- ?>
- <tr>
- <td class="list" colspan="4"></td>
- <td class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="freeswitch_public_includes_details_edit.php?parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>&a=action"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
-
-
- <tr>
- <td class="list" colspan="4"></td>
- <td class="list"></td>
- </tr>
- </table>
-
- </form>
-
-
- <br>
- <br>
-
- </td>
- </tr>
-</table>
-
-</div>
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch/freeswitch_recordings.tmp b/config/freeswitch/freeswitch_recordings.tmp
deleted file mode 100644
index 7d504d15..00000000
--- a/config/freeswitch/freeswitch_recordings.tmp
+++ /dev/null
@@ -1,494 +0,0 @@
-<?php
-/* $Id$ */
-/*
- freeswitch_recordings.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/freeswitch.inc");
-
-$a_recordings = &$config['installedpackages']['freeswitchrecordings']['config'];
-$dir_recordings = '/usr/local/freeswitch/recordings/';
-$dir_music_on_hold_8000 = '/usr/local/freeswitch/sounds/music/8000/';
-
-if ($_GET['a'] == "download") {
-
- session_cache_limiter('public');
-
- if ($_GET['type'] = "rec") {
- if (file_exists($dir_recordings.$_GET['filename'])) {
- $fd = fopen($dir_recordings.$_GET['filename'], "rb");
- if ($_GET['t'] == "bin") {
- header("Content-Type: application/force-download");
- header("Content-Type: application/octet-stream");
- header("Content-Type: application/download");
- header("Content-Description: File Transfer");
- header('Content-Disposition: attachment; filename="'.$_GET['filename'].'"');
- }
- else {
- $file_ext = substr($_GET['filename'], -3);
- if ($file_ext == "wav") {
- header("Content-Type: audio/x-wav");
- }
- if ($file_ext == "mp3") {
- header("Content-Type: audio/mp3");
- }
- }
- header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
- header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
- header("Content-Length: " . filesize($dir_recordings.$_GET['filename']));
- fpassthru($fd);
- }
- }
-
- if ($_GET['type'] = "moh") {
- if (file_exists($dir_music_on_hold_8000.$_GET['filename'])) {
- $fd = fopen($dir_music_on_hold_8000.$_GET['filename'], "rb");
- if ($_GET['t'] == "bin") {
- header("Content-Type: application/force-download");
- header("Content-Type: application/octet-stream");
- header("Content-Type: application/download");
- header("Content-Description: File Transfer");
- header('Content-Disposition: attachment; filename="'.$_GET['filename'].'"');
- }
- else {
- $file_ext = substr($_GET['filename'], -3);
- if ($file_ext == "wav") {
- header("Content-Type: audio/x-wav");
- }
- if ($file_ext == "mp3") {
- header("Content-Type: audio/mp3");
- }
- }
- header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
- header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
- header("Content-Length: " . filesize($dir_music_on_hold_8000.$_GET['filename']));
- fpassthru($fd);
- }
- }
-
- exit;
-}
-else {
- //echo $dir_recordings.$_GET['filename'];
-}
-
-if (($_POST['submit'] == "Upload") && is_uploaded_file($_FILES['ulfile']['tmp_name'])) {
-
- if ($_POST['type'] == 'moh') {
- move_uploaded_file($_FILES['ulfile']['tmp_name'], $dir_music_on_hold_8000 . $_FILES['ulfile']['name']);
- $savemsg = "Uploaded file to $dir_music_on_hold_8000" . htmlentities($_FILES['ulfile']['name']);
- //system('chmod -R 744 $dir_music_on_hold_8000*');
- unset($_POST['txtCommand']);
- }
- if ($_POST['type'] == 'rec') {
- move_uploaded_file($_FILES['ulfile']['tmp_name'], $dir_recordings . $_FILES['ulfile']['name']);
- $savemsg = "Uploaded file to $dir_recordings" . htmlentities($_FILES['ulfile']['name']);
- //system('chmod -R 744 $dir_recordings*');
- unset($_POST['txtCommand']);
- }
-}
-
-
-
-
-if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'rec') {
- if ($a_recordings[$_GET['id']]) {
- unlink_if_exists('/usr/local/freeswitch/recordings/'.$a_recordings[$_GET['id']]['filename']);
- unset($a_recordings[$_GET['id']]);
- write_config();
- header("Location: freeswitch_recordings.php");
- exit;
- }
- }
-
- if ($_GET['type'] == 'moh') {
- unlink_if_exists($dir_music_on_hold_8000.$_GET['filename']);
- header("Location: freeswitch_recordings.php");
- exit;
- }
-
-}
-
-
-
-include("head.inc");
-
-?>
-
-<script>
-function EvalSound(soundobj) {
- var thissound= eval("document."+soundobj);
- thissound.Play();
-}
-</script>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">FreeSWITCH: Recordings</p>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-display_top_tabs(build_menu());
-
-?>
-</td></tr>
-</table>
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
-<?php
-
-
-//build a list of recordings from the config.xml
-$config_recording_list = '';
-$i = 0;
-if (count($a_recordings) > 0) {
- foreach ($a_recordings as $recordingent) {
- $config_recording_list .= $recordingent['filename']."|";
- $i++;
- }
-}
-
-
-
-$config_change = 0;
-if (is_dir($dir_recordings)) {
- if ($dh = opendir($dir_recordings)) {
- while (($file = readdir($dh)) !== false) {
- if (filetype($dir_recordings . $file) == "file") {
-
- if (strpos($config_recording_list, $file) === false) {
-
- //$handle = fopen($dir_recordings.$file,'rb');
- //$file_content = fread($handle,filesize($dir_recordings.$file));
- //fclose($handle);
-
- $a_file = split("\.", $file);
-
- $recordingent = array();
- $recordingent['filename'] = $file;
- $recordingent['recordingname'] = $a_file[0];
- $recordingent['recordingid'] = guid();
- //$recordingent['filecontent'] = base64_encode($file_content);
- $recordingent['descr'] = 'Auto';
-
- $a_recordings[] = $recordingent;
- write_config();
-
- unset($file_content);
-
- }
- else {
- //echo "The file was found.<br/>";
- }
-
- }
- }
- closedir($dh);
- }
-}
-
-
-
-//saved for future use if and when config.xml scales well
- //enough to save the files inside it
-//$i = 0;
-//if (count($a_recordings) > 0) {
-// foreach ($a_recordings as $recordingent) {
-
-// if (!is_file($dir_recordings.$recordingent['filename'])) {
- //echo "not found: ".$recordingent['filename']."<br />";
-
- //recording not found restore the file from the config.xml
- //$file_content = $recordingent['filecontent'];
- //$handle = fopen($dir_recordings.$recordingent['filename'],'w');
- //fwrite ($handle, base64_decode($file_content));
- //unset($file_content);
- //fclose($handle);
- //$recordingent['filecontent'] = base64_encode($file_content);
-
- // loop through recordings in the config.xml
- // if the file does not exist remove it from the file system.
- //unset($a_recordings[$i]);
-
-// $config_change = 1;
-// }
-// else {
- //echo "found: ".$recordingent['filename']."<br />";
-// }
-
-// $i++;
-// }
-//}
-
-if ($config_change == 1) {
- write_config();
- $config_change = 0;
-}
-
-//if ($savemsg) print_info_box($savemsg);
-//if (file_exists($d_hostsdirty_path)): echo"<p>";
-//print_info_box_np("The FreeSWITCH recordings have been changed.<br>You must apply the changes in order for them to take effect.");
-//echo"<br />";
-//endif;
-
-?>
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Recordings:<br>
- </strong></span>
- To make a recording dial *732673 (record) or you can make a
- 16bit 8khz/16khz Mono WAV file then copy it to the
- following directory then refresh the page to play it back.
- Click on the 'Filename' to download it or the 'Recording Name' to
- play the audio.
- </span></p></td>
- </tr>
- </table>
-
- <br />
-
- <div id="niftyOutter">
- <form action="" method="POST" enctype="multipart/form-data" name="frmUpload" onSubmit="">
- <table border='0'>
- <tr>
- <td width='50%'><b>location:</b> <?php echo $dir_recordings; ?></td>
- <td valign="top" class="label">
- <input name="type" type="hidden" value="rec">
- </td>
- <td align="right">File to upload:</td>
- <td valign="top" class="label">
- <input name="ulfile" type="file" class="button" id="ulfile">
- <input name="submit" type="submit" class="button" id="upload" value="Upload">
- </td>
- </tr>
- </table>
- </div>
- </form>
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="30%" class="listhdrr">Filename (download)</td>
- <td width="30%" class="listhdrr">Recording Name (play)</td>
- <td width="30%" class="listhdr">Description</td>
- <td width="10%" class="list">
- <!--
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="freeswitch_recordings_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- -->
- </td>
- </tr>
-
- <?php
- $i = 0;
- if (count($a_recordings) > 0) {
- foreach ($a_recordings as $recordingent) {
- if (strlen($recordingent['filename']) > 0) {
- ?>
- <tr>
- <td class="listlr" ondblclick="document.location='freeswitch_recordings_edit.php?id=<?=$i;?>'">
- <a href="freeswitch_recordings.php?a=download&type=rec&t=bin&filename=<?=$recordingent['filename'];?>">
- <?=$recordingent['filename']?>
- </a>
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_recordings_edit.php?id=<?=$i;?>';">
- <a href="javascript:void(0);" onclick="window.open('freeswitch_recordings_play.php?a=download&type=rec&filename=<?=$recordingent['filename'];?>', 'play',' width=420,height=40,menubar=no,status=no,toolbar=no')">
- <?=$recordingent['recordingname'];?>&nbsp;
- </a>
- </td>
- <td class="listbg" ondblclick="document.location='freeswitch_recordings_edit.php?id=<?=$i;?>';">
- <font color="#FFFFFF"><?=htmlspecialchars($recordingent['descr']);?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="freeswitch_recordings_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="freeswitch_recordings.php?type=rec&act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
- }
- else {
- //clean up blank entries
- unset($a_recordings[$i]);
- write_config();
- }
-
- $i++;
- } //end for each
- } //end count
- ?>
-
- <!--
- <tr>
- <td class="list" colspan="3"></td>
- <td class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="freeswitch_recordings_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- -->
-
- <tr>
- <td class="list" colspan="3"></td>
- <td class="list"></td>
- </tr>
- </table>
-
-
-
- <br />
- <br />
- <br />
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Music on Hold:<br>
- </strong></span>
- Music on hold can be in WAV or MP3 format. To play an MP3 file you must have
- mod_shout enabled on the 'Modules' tab. You can adjust the volume of the MP3
- audio from the 'Settings' tab. For best performance upload 16bit 8khz/16khz Mono WAV files.
- <!--Click on the 'Filename' to download it or the 'Recording Name' to
- play the audio.-->
- </span></p></td>
- </tr>
- </table>
-
- <br />
-
- <div id="niftyOutter">
- <form action="" method="POST" enctype="multipart/form-data" name="frmUpload" onSubmit="">
- <table border='0'>
- <tr>
- <td width='50%'><b>location:</b> <?php echo $dir_music_on_hold_8000; ?></td>
- <td valign="top" class="label">
- <input name="type" type="hidden" value="moh">
- </td>
- <td align="right">File to upload:</td>
- <td valign="top" class="label">
- <input name="ulfile" type="file" class="button" id="ulfile">
- <input name="submit" type="submit" class="button" id="upload" value="Upload">
- </td>
- </tr>
- </table>
- </div>
- </form>
-
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="28%" class="listhdrr">File Name (download)</td>
- <td width="28%" class="listhdrr">Name (play)</td>
- <td width="25%" class="listhdr">Last Modified</td>
- <td width="10%" class="listhdr" nowrap>Size</td>
- </tr>
-
- <?php
-
- if ($handle = opendir($dir_music_on_hold_8000)) {
- while (false !== ($file = readdir($handle))) {
- if ($file != "." && $file != ".." && is_file($dir_music_on_hold_8000.$file)) {
-
- $tmp_filesize = filesize($dir_music_on_hold_8000.$file);
- $tmp_filesize = byte_convert($tmp_filesize);
-
- echo "<tr>\n";
- echo " <td class=\"listlr\" ondblclick=\"\">\n";
- echo " <a href=\"freeswitch_recordings.php?a=download&type=moh&t=bin&filename=".$file."\">\n";
- echo " $file";
- echo " </a>";
- echo " </td>\n";
- echo " <td class=\"listlr\" ondblclick=\"\">\n";
- echo " <a href=\"javascript:void(0);\" onclick=\"window.open('freeswitch_recordings_play.php?a=download&type=moh&filename=".$file."', 'play',' width=420,height=40,menubar=no,status=no,toolbar=no')\">\n";
- $tmp_file_array = split("\.",$file);
- echo " ".$tmp_file_array[0];
- echo " </a>";
- echo " </td>\n";
- echo " <td class=\"listlr\" ondblclick=\"\">\n";
- echo date ("F d Y H:i:s", filemtime($dir_music_on_hold_8000.$file));
- echo " </td>\n";
- echo " <td class=\"listlr\" ondblclick=\"\">\n";
- echo " ".$tmp_filesize;
- echo " </td>\n";
- echo " <td valign=\"middle\" nowrap class=\"list\">\n";
- echo " <table border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n";
- echo " <tr>\n";
- //echo " <td valign=\"middle\"><a href=\"freeswitch_recordings.php?id=$i\"><img src=\"/themes/".$g['theme']."/images/icons/icon_e.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n";
- echo " <td><a href=\"freeswitch_recordings.php?type=moh&act=del&filename=".$file."\" onclick=\"return confirm('Do you really want to delete this file?')\"><img src=\"/themes/". $g['theme']."/images/icons/icon_x.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n";
- echo " </tr>\n";
- echo " </table>\n";
- echo " </td>\n";
- echo "</tr>\n";
-
- }
- }
- closedir($handle);
- }
- ?>
-
- <tr>
- <td class="list" colspan="3"></td>
- <td class="list"></td>
- </tr>
- </table>
-
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-
-</td>
-</tr>
-</table>
-
-</div>
-
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch/freeswitch_recordings_edit.tmp b/config/freeswitch/freeswitch_recordings_edit.tmp
deleted file mode 100644
index e53c44fc..00000000
--- a/config/freeswitch/freeswitch_recordings_edit.tmp
+++ /dev/null
@@ -1,172 +0,0 @@
-<?php
-/* $Id$ */
-/*
- freeswitch_recordings_edit.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/freeswitch.inc");
-
-
-$a_recordings = &$config['installedpackages']['freeswitchrecordings']['config'];
-
-
-$id = $_GET['id'];
-if (isset($_POST['id'])) {
- $id = $_POST['id'];
-}
-
-if (isset($id) && $a_recordings[$id]) {
- $pconfig['filename'] = $a_recordings[$id]['filename'];
- $pconfig['recordingname'] = $a_recordings[$id]['recordingname'];
- $pconfig['recordingid'] = $a_recordings[$id]['recordingid'];
- $pconfig['descr'] = $a_recordings[$id]['descr'];
-}
-
-if ($_POST) {
-
- unset($input_errors);
- $pconfig = $_POST;
-
-
- if (!$input_errors) {
-
-
- $recordingent = array();
- $recordingent['recordingname'] = $_POST['recordingname'];
- $recordingent['descr'] = $_POST['descr'];
-
-
- if (isset($id) && $a_recordings[$id]) {
- //update
- if (strlen($_POST['recordingid']) > 0) {
- $recordingent['recordingid'] = $_POST['recordingid'];
- }
- else {
- $recordingent['recordingid'] = guid();
- }
-
- $recordingent['filename'] = $_POST['filename'];
-
- //if file name is not the same then rename the file
- if ($_POST['filename'] != $_POST['filename_orig']) {
- rename('/usr/local/freeswitch/recordings/'.$_POST['filename_orig'], '/usr/local/freeswitch/recordings/'.$_POST['filename']);
- }
- $a_recordings[$id] = $recordingent;
- }
- else {
- //add
- $recordingent['filename'] = $_POST['filename'];
- $a_recordings[] = $recordingent;
- }
-
- write_config();
-
- header("Location: freeswitch_recordings.php");
- exit;
- }
-}
-
-include("head.inc");
-
-?>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">FreeSWITCH: Recordings: Edit</p>
-<?php if ($input_errors) print_input_errors($input_errors); ?>
-
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-display_top_tabs(build_menu());
-
-?>
-</td></tr>
-</table>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
- <br />
- <form action="freeswitch_recordings_edit.php" method="post" name="iform" id="iform">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="22%" valign="top" class="vncellreq">Filename</td>
- <td width="78%" class="vtable">
- <input name="filename" type="text" class="formfld" id="filename" size="40" value="<?=htmlspecialchars($pconfig['filename']);?>">
- <br> <span class="vexpl">Name of the file<br>
- e.g. <em>example.wav</em></span></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Recording Name</td>
- <td width="78%" class="vtable">
- <input name="recordingname" type="text" class="formfld" id="recordingname" size="40" value="<?=htmlspecialchars($pconfig['recordingname']);?>">
- <br> <span class="vexpl">Recording Name<br>
- e.g. <em>recordingx</em></span></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Description</td>
- <td width="78%" class="vtable">
- <input name="descr" type="text" class="formfld" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>">
- <br> <span class="vexpl">You may enter a description here
- for your reference (not parsed).</span></td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()">
- <?php if (isset($id) && $a_recordings[$id]): ?>
- <input name="filename_orig" type="hidden" value="<?=htmlspecialchars($pconfig['filename']);?>">
- <input name="id" type="hidden" value="<?=$id;?>">
- <input name="recordingid" type="hidden" value="<?=htmlspecialchars($pconfig['recordingid']);?>">
- <?php endif; ?>
- </td>
- </tr>
- </table>
- </form>
-
- <br>
- <br>
- <br>
- <br>
- <br>
- <br>
-
- </td>
- </tr>
-</table>
-
-</div>
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch/freeswitch_recordings_play.tmp b/config/freeswitch/freeswitch_recordings_play.tmp
deleted file mode 100755
index 1c63b592..00000000
--- a/config/freeswitch/freeswitch_recordings_play.tmp
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-/* $Id$ */
-/*
- freeswitch_recordings_play.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-$filename = $_GET['filename'];
-$type = $_GET['type']; //moh //rec
-
-?>
-<html>
-<head>
-</head>
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td align='center'>
- <b>file: <?=$filename?></b>
- </td>
- </tr>
- <tr>
- <td align='center'>
- <?php
-
- $file_ext = substr($_GET['filename'], -3);
- if ($file_ext == "wav") {
- echo "<embed src=\"freeswitch_recordings.php?a=download&type=".$type."&filename=".$filename."\" autostart=true width=200 height=40 name=\"sound".$$filename."\" enablejavascript=\"true\">\n";
- }
- if ($file_ext == "mp3") {
- echo "<object type=\"application/x-shockwave-flash\" width=\"400\" height=\"17\" data=\"slim.swf?autoplay=true&song_title=".urlencode($filename)."&song_url=".urlencode("/freeswitch/freeswitch_recordings.php?a=download&type=".$type."&filename=".$filename)."\">\n";
- echo "<param name=\"movie\" value=\"slim.swf?autoplay=true&song_url=".urlencode("/freeswitch/freeswitch_recordings.php?a=download&type=".$type."&filename=".$filename)."\" />\n";
- echo "<param name=\"quality\" value=\"high\"/>\n";
- echo "<param name=\"bgcolor\" value=\"#E6E6E6\"/>\n";
- echo "</object>\n";
- }
-
- ?>
- </td>
- </tr>
-</table>
-
-</body>
-</html>
diff --git a/config/freeswitch/freeswitch_status.tmp b/config/freeswitch/freeswitch_status.tmp
deleted file mode 100644
index 4fa4181a..00000000
--- a/config/freeswitch/freeswitch_status.tmp
+++ /dev/null
@@ -1,339 +0,0 @@
-<?php
-/* $Id$ */
-/*
- freeswitch_status.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
-
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/freeswitch.inc");
-
-
-if ($_GET['a'] == "download") {
- if ($_GET['t'] == "logs") {
- $tmp = '/usr/local/freeswitch/log/';
- $filename = 'freeswitch.log';
- }
- if ($_GET['t'] == "cdrcsv") {
- $tmp = '/usr/local/freeswitch/log/cdr-csv/';
- $filename = 'Master.csv';
- }
- if ($_GET['t'] == "backup") {
- $tmp = '/root/backup/';
- $filename = 'freeswitch.bak.tgz';
- if (!is_dir('/root/backup/')) {
- exec("mkdir /root/backup/");
- }
- system('cd /usr/local/;tar cvzf /root/backup/freeswitch.bak.tgz freeswitch');
- }
- session_cache_limiter('public');
- $fd = fopen($tmp.$filename, "rb");
- header("Content-Type: binary/octet-stream");
- header("Content-Length: " . filesize($tmp.$filename));
- header('Content-Disposition: attachment; filename="'.$filename.'"');
- fpassthru($fd);
- exit;
-}
-
-if ($_GET['a'] == "other") {
- if ($_GET['t'] == "restore") {
- $tmp = '/root/backup/';
- $filename = 'freeswitch.bak.tgz';
-
- //extract a specific directory to /usr/local/freeswitch
- if (file_exists('/root/backup/'.$filename)) {
- //echo "The file $filename exists";
-
- //Recommended
- system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/db/');
- system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/log/');
- system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/recordings/');
- system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/scripts/');
- system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/storage/');
- system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/sounds/custom/8000/');
- system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/sounds/music/8000/');
- system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/conf/ssl');
- system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/conf/sip_profiles/');
- system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/conf/vars.xml');
- system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/conf/dialplan/default.xml');
- system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/conf/dialplan/public.xml');
-
- //Optional
- //system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/conf/');
- //system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/grammar/');
- //system('cd /usr/local; tar xvpfz /root/backup/'.$filename.' freeswitch/htdocs/');
-
- header( 'Location: freeswitch_status.php?savemsg=Backup+has+been+restored.' ) ;
- }
- else {
- header( 'Location: freeswitch_status.php?savemsg=Restore+failed.+Backup+file+not+found.' ) ;
- }
-
- exit;
- }
-}
-
-include("head.inc");
-
-$password = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password'];
-$port = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port'];
-$host = $config['interfaces']['lan']['ipaddr'];
-
-$savemsg = $_GET["savemsg"];
-
-//if freeswitch is not running then start it
-if (!pkg_is_service_running('freeswitch')) {
- $handle = popen("/usr/local/etc/rc.d/freeswitch.sh start", "r");
- pclose($handle);
- //give freeswitch time to load
- sleep(7);
-}
-?>
-
-<script language="Javascript" type="text/javascript" src="/edit_area/edit_area_full.js"></script>
-<script language="Javascript" type="text/javascript">
- // initialisation
- editAreaLoader.init({
- id: "log" // id of the textarea to transform
- ,start_highlight: false
- ,allow_toggle: true
- ,display: "later"
- ,language: "en"
- ,syntax: "html"
- ,toolbar: "search, go_to_line,|, fullscreen, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help"
- ,syntax_selection_allow: "css,html,js,php,xml,c,cpp,sql"
- ,show_line_colors: true
- });
-</script>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-
-<p class="pgtitle">FreeSWITCH: Status</font></p>
-
-<?php
-if ($savemsg) {
- print_info_box($savemsg);
-}
-?>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-display_top_tabs(build_menu());
-
-?>
-</td></tr>
-</table>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
-<?php
-
-echo "<br /><br />\n\n";
-
-
-$fp = event_socket_create($host, $port, $password);
-$cmd = "api sofia status";
-$response = event_socket_request($fp, $cmd);
-echo "<table width='690' cellpadding='0' cellspacing='0' border='0'>\n";
-echo "<tr>\n";
-echo "<td width='50%'>\n";
-echo " <b>sofia status</b> \n";
-echo "</td>\n";
-echo "<td width='50%' align='right'>\n";
-echo " <input type='button' value='reloadxml' onclick=\"document.location.href='/packages/freeswitch/freeswitch_cmd.php?cmd=api+reloadxml';\" />\n";
-echo "</td>\n";
-echo "</tr>\n";
-echo "</table>\n";
-echo "<pre style=\"font-size: 9pt;\">\n";
-echo $response;
-echo "</pre>\n";
-fclose($fp);
-echo "<br /><br />\n\n";
-
-foreach (ListFiles('/usr/local/freeswitch/conf/sip_profiles') as $key=>$sip_profile_file){
-
- $sip_profile_name = str_replace(".xml", "", $sip_profile_file);
- $fp = event_socket_create($host, $port, $password);
- $cmd = "api sofia status profile ".$sip_profile_name;
- $response = event_socket_request($fp, $cmd);
- echo "<table width='690' cellpadding='0' cellspacing='0' border='0'>\n";
- echo "<tr>\n";
- echo "<td width='50%'>\n";
- echo " <b>sofia status profile $sip_profile_name</b> \n";
- echo "</td>\n";
- echo "<td width='50%' align='right'>\n";
- echo " <input type='button' value='start' onclick=\"document.location.href='/packages/freeswitch/freeswitch_cmd.php?cmd=api+sofia+profile+".$sip_profile_name."+start';\" />\n";
- echo " <input type='button' value='stop' onclick=\"document.location.href='/packages/freeswitch/freeswitch_cmd.php?cmd=api+sofia+profile+".$sip_profile_name."+stop';\" />\n";
- echo " <input type='button' value='restart' onclick=\"document.location.href='/packages/freeswitch/freeswitch_cmd.php?cmd=api+sofia+profile+".$sip_profile_name."+restart';\" />\n";
- if ($sip_profile_name == "external") {
- echo " <input type='button' value='rescan' onclick=\"document.location.href='/packages/freeswitch/freeswitch_cmd.php?cmd=api+sofia+profile+".$sip_profile_name."+rescan';\" />\n";
- }
- else {
- echo " <input type='button' value='flush_inbound_reg' onclick=\"document.location.href='/packages/freeswitch/freeswitch_cmd.php?cmd=api+sofia+profile+".$sip_profile_name."+flush_inbound_reg';\" />\n";
- }
- echo "</td>\n";
- echo "</tr>\n";
- echo "</table>\n";
- echo "<pre style=\"font-size: 9pt;\">\n";
- echo $response;
- echo "</pre>\n";
- fclose($fp);
- echo "<br /><br />\n\n";
-
-}
-
-
-$fp = event_socket_create($host, $port, $password);
-$cmd = "api status";
-$response = event_socket_request($fp, $cmd);
-echo "<b>status</b><br />\n";
-echo "<pre style=\"font-size: 9pt;\">\n";
-echo $response;
-echo "</pre>\n";
-fclose($fp);
-echo "<br /><br />\n\n";
-
-
-$fp = event_socket_create($host, $port, $password);
-$cmd = "api show channels";
-$response = event_socket_request($fp, $cmd);
-echo "<b>show channels</b><br />\n";
-if (strlen($response) > 40) {
- echo "<textarea cols='85' rows='10' wrap='off'>\n";
- echo $response;
- echo "</textarea>\n";
-}
-else {
- echo "<pre style=\"font-size: 9pt;\">\n";
- echo $response;
- echo "</pre>\n";
-}
-fclose($fp);
-echo "<br /><br />\n\n";
-echo "<br /><br />\n\n";
-
-
-$fp = event_socket_create($host, $port, $password);
-$cmd = "api show calls";
-$response = event_socket_request($fp, $cmd);
-echo "<b>show calls</b><br />\n";
-if (strlen($response) > 40) {
- echo "<textarea cols='85' rows='10' wrap='off'>\n";
- echo $response;
- echo "</textarea>\n";
-}
-else {
- echo "<pre style=\"font-size: 9pt;\">\n";
- echo $response;
- echo "</pre>\n";
-}
-fclose($fp);
-echo "<br /><br />\n\n";
-echo "<br /><br />\n\n";
-
-
-echo "<table width='690' cellpadding='0' cellspacing='0' border='0'>\n";
-echo "<tr>\n";
-echo "<td width='80%'>\n";
-echo "<b>Backup / Restore</b><br />\n";
-echo "The 'backup' button will tar gzip /usr/local/freeswitch/ to /root/backup/freeswitch.bak.tgz it then presents a file to download. \n";
-echo "If the backup file does not exist in /root/backup/freeswitch.bak.tgz then the 'restore' button will be hidden. \n";
-echo "Use Diagnostics->Command->File to upload: to browse to the file and then click on upload it now ready to be restored. \n";
-echo "<br /><br />\n";
-echo "</td>\n";
-echo "<td width='20%' valign='middle' align='right'>\n";
-echo " <input type='button' value='backup' onclick=\"document.location.href='/packages/freeswitch/freeswitch_status.php?a=download&t=backup';\" />\n";
-if (file_exists('/root/backup/freeswitch.bak.tgz')) {
- echo " <input type='button' value='restore' onclick=\"document.location.href='/packages/freeswitch/freeswitch_status.php?a=other&t=restore';\" />\n";
-}
-echo "</td>\n";
-echo "</tr>\n";
-echo "</table>\n";
-echo "<br /><br />\n\n";
-
-
-echo "<table width='690' cellpadding='0' cellspacing='0' border='0'>\n";
-echo "<tr>\n";
-echo "<td width='50%'>\n";
-echo "<b>Call Detail Records</b><br />\n";
-echo "/usr/local/freeswitch/log/cdr-csv/Master.csv<br /><br />\n";
-echo "</td>\n";
-echo "<td width='50%' align='right'>\n";
-echo " <input type='button' value='download cdr csv' onclick=\"document.location.href='/packages/freeswitch/freeswitch_status.php?a=download&t=cdrcsv';\" />\n";echo "</td>\n";
-echo "</tr>\n";
-echo "</table>\n";
-echo "<br /><br />\n\n";
-
-
-echo "<table width='690' cellpadding='0' cellspacing='0' border='0'>\n";
-echo "<tr>\n";
-echo "<td width='50%'>\n";
-echo "<b>Logs</b><br />\n";
-echo "/usr/local/freeswitch/log/cdr-csv/freeswitch.log<br /><br />\n";
-echo "</td>\n";
-echo "<td width='50%' align='right'>\n";
-echo " <input type='button' value='download logs' onclick=\"document.location.href='/packages/freeswitch/freeswitch_status.php?a=download&t=logs';\" />\n";
-echo "</tr>\n";
-echo "</table>\n";
-echo "<br /><br />\n\n";
-
-
-echo "<b>tail -n 500 /usr/local/freeswitch/log/freeswitch.log</b><br />\n";
-echo "<textarea id='log' name='log' cols='93' rows='30' wrap='off'>\n";
-echo system("tail -n 500 /usr/local/freeswitch/log/freeswitch.log");
-echo "</textarea>\n";
-echo "<br /><br />\n\n";
-
-
-//$fp = event_socket_create($host, $port, $password);
-//$cmd = "api sofia ";
-//$response = event_socket_request($fp, $cmd);
-//echo "<b>api sofia</b><br />\n";
-//echo "<pre style=\"font-size: 9pt;\">\n";
-//echo $response;
-//echo "</pre>\n";
-//fclose($fp);
-//echo "<br /><br />\n\n";
-
-?>
-
- </td>
- </tr>
-</table>
-
-</div>
-<?php include("fend.inc"); ?>
-
-</body>
-</html>
diff --git a/config/freeswitch/freeswitch_time_conditions.tmp b/config/freeswitch/freeswitch_time_conditions.tmp
deleted file mode 100644
index 17787ad3..00000000
--- a/config/freeswitch/freeswitch_time_conditions.tmp
+++ /dev/null
@@ -1,178 +0,0 @@
-<?php
-/* $Id$ */
-/*
- freeswitch_time_conditions.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/freeswitch.inc");
-
-
-$a_ivr_options = &$config['installedpackages']['freeswitchivroptions']['config'];
-
-
-if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'ivroptions') {
- if ($a_ivr_options[$_GET['id']]) {
- unset($a_ivr_options[$_GET['id']]);
- write_config();
- //touch($d_hostsdirty_path);
- header("Location: freeswitch_ivr_edit.php?id=".$_GET['parentid']);
- exit;
- }
- }
-}
-
-
-include("head.inc");
-
-?>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">FreeSWITCH: IVR: Options</p>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-display_top_tabs(build_menu());
-
-?>
-</td></tr>
-</table>
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
-<form action="freeswitch_ivr_options.php" method="post" name="iform" id="iform">
-<?php
-
-
-//echo "<pre>";
-//print_r ($a_ivr);
-//echo "</pre>";
-
-//if ($savemsg) print_info_box($savemsg);
-//if (file_exists($d_hostsdirty_path)): echo"<p>";
-//print_info_box_np("The FreeSWITCH recordings have been changed.<br>You must apply the changes in order for them to take effect.");
-//echo"<br />";
-//endif;
-
-?>
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Note:<br>
- </strong></span>
- To make a recording dial extension 700 or you can make a
- 16bit 8khz/16khz Mono WAV file then copy it to the
- following directory then refresh the page to play it back.
- </span></p></td>
- </tr>
- </table>
- <br />
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="20%" class="listhdrr">Filename</td>
- <td width="25%" class="listhdrr">Name</td>
- <td width="25%" class="listhdr">Description</td>
- <td width="10%" class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="freeswitch_ivr_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
-
- <?php $i = 0; foreach ($a_ivr as $ivrent): ?>
- <tr>
- <td class="listlr" ondblclick="document.location='freeswitch_ivr_edit.php?id=<?=$i;?>'">
- <a href="javascript:void(0)" onclick="window.open('freeswitch_recordings_play.php?a=download&filename=<?=$recordingent['filename'];?>', 'play',' width=300,height=40,menubar=no,status=no,toolbar=no')">
- <?=$ivrent['filename']?>
- </a>
- </td>
- <td class="listr" ondblclick="document.location='freeswitch_ivr_edit.php?id=<?=$i;?>';">
- <?=$ivrent['recordingname'];?>&nbsp;
- </td>
- <td class="listbg" ondblclick="document.location='freeswitch_ivr_edit.php?id=<?=$i;?>';">
- <font color="#FFFFFF"><?=htmlspecialchars($recordingent['descr']);?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="freeswitch_ivr_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="freeswitch_ivr_options.php?type=ivroption&act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php $i++; endforeach; ?>
- <tr>
- <td class="list" colspan="3"></td>
- <td class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="freeswitch_ivr_options_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
-
-
- <tr>
- <td class="list" colspan="3"></td>
- <td class="list"></td>
- </tr>
- </table>
-
-</form>
-
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-
-</td>
-</tr>
-</table>
-
-</div>
-
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch/freeswitch_time_conditions_edit.tmp b/config/freeswitch/freeswitch_time_conditions_edit.tmp
deleted file mode 100644
index 45631929..00000000
--- a/config/freeswitch/freeswitch_time_conditions_edit.tmp
+++ /dev/null
@@ -1,201 +0,0 @@
-<?php
-/* $Id$ */
-/*
- freeswitch_time_conditions_edit.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/freeswitch.inc");
-
-
-$a_ivr_options = &$config['installedpackages']['freeswitchtimeconditions']['config'];
-
-$id = $_GET['id'];
-if (isset($_POST['id'])) {
- $id = $_POST['id'];
-}
-
-//$parentid = $_GET['parentid'];
-//if (isset($_POST['parentid'])) {
-// $parentid = $_POST['parentid'];
-//}
-
-//$ivrid = $_GET['ivrid'];
-//if (isset($_POST['ivrid'])) {
-// $ivrid = $_POST['ivrid'];
-//}
-
-if (isset($id) && $a_ivr_options[$id]) {
- $pconfig['conditionname'] = $a_ivr_options[$id]['conditionname'];
- $pconfig['conditionstartday'] = $a_ivr_options[$id]['conditionstartday'];
- $pconfig['conditionstarthrs'] = $a_ivr_options[$id]['conditionstarthrs'];
- $pconfig['conditionstartmin'] = $a_ivr_options[$id]['conditionstartmin'];
-
- $pconfig['conditionendday'] = $a_ivr_options[$id]['conditionendday'];
- $pconfig['conditionendhrs'] = $a_ivr_options[$id]['conditionstarthrs'];
- $pconfig['conditionendmin'] = $a_ivr_options[$id]['conditionendmin'];
-
- $pconfig['conditionaction'] = $a_ivr_options[$id]['conditionaction'];
- $pconfig['conditionantiaction'] = $a_ivr_options[$id]['conditionantiaction'];
- $pconfig['conditionjavascript'] = $a_ivr_options[$id]['conditionjavascript'];
- $pconfig['conditiondescr'] = $a_ivr_options[$id]['conditiondescr'];
-}
-
-
-
-if ($_POST) {
-
- unset($input_errors);
- $pconfig = $_POST;
-
- if (!$input_errors) {
-
- $ivroptionent = array();
- $ivroptionent['ivrid'] = $_POST['ivrid'];
- $ivroptionent['optionnumber'] = $_POST['optionnumber'];
- $ivroptionent['optiontype'] = $_POST['optiontype'];
- $ivroptionent['optiondest'] = $_POST['optiondest'];
- $ivroptionent['optiondescr'] = $_POST['optiondescr'];
-
- if (isset($id) && $a_ivr_options[$id]) {
- //update
- $a_ivr_options[$id] = $ivroptionent;
- }
- else {
- //add
- $a_ivr_options[] = $ivroptionent;
- }
-
- //touch($d_hostsdirty_path);
- write_config();
-
- header("Location: freeswitch_ivr_edit.php?id=".$parentid);
- exit;
- }
-}
-
-$pgtitle = "FreeSWITCH: IVR: Options: Edit";
-include("head.inc");
-
-?>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle"><?=$pgtitle?></p>
-<?php if ($input_errors) print_input_errors($input_errors); ?>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-display_top_tabs(build_menu());
-
-?>
-</td></tr>
-</table>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
- <form action="freeswitch_ivr_options_edit.php" method="post" name="iform" id="iform">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="22%" valign="top" class="vncellreq">Option Number</td>
- <td width="78%" class="vtable">
- <input name="optionnumber" type="text" class="formfld" id="optionnumber" size="40" value="<?=htmlspecialchars($pconfig['optionnumber']);?>">
- <br> <span class="vexpl">Option Number<br>
- e.g. <em>1</em></span></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Type</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='optiontype' class='formfld'>\n";
- echo " <option></option>\n";
- if (htmlspecialchars($pconfig['optiontype']) == "extension") {
- echo " <option selected='yes'>extension</option>\n";
- }
- else {
- echo " <option>extension</option>\n";
- }
- if (htmlspecialchars($pconfig['optiontype']) == "voicemail") {
- echo " <option selected='yes'>voicemail</option>\n";
- }
- else {
- echo " <option>voicemail</option>\n";
- }
- echo " </select>\n";
- ?>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Destination</td>
- <td width="78%" class="vtable">
- <input name="optiondest" type="text" class="formfld" id="optiondest" size="40" value="<?=htmlspecialchars($pconfig['optiondest']);?>">
- <br> <span class="vexpl">Destination<br>
- e.g. <em>1001</em></span></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Description</td>
- <td width="78%" class="vtable">
- <input name="optiondescr" type="text" class="formfld" id="optiondescr" size="40" value="<?=htmlspecialchars($pconfig['optiondescr']);?>">
- <br> <span class="vexpl">You may enter a description here
- for your reference (not parsed).</span></td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="ivrid" type="hidden" value="<?=$ivrid;?>">
- <input name="parentid" type="hidden" value="<?=$parentid;?>">
- <?php if (isset($id) && $a_ivr_options[$id]): ?>
- <input name="id" type="hidden" value="<?=$id;?>">
- <?php endif; ?>
- <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()">
- </td>
- </tr>
- </table>
- </form>
-
- <br>
- <br>
- <br>
- <br>
- <br>
- <br>
-
- </td>
- </tr>
-</table>
-
-</div>
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch/freeswitch_vars.tmp b/config/freeswitch/freeswitch_vars.tmp
deleted file mode 100644
index 5e7a5744..00000000
--- a/config/freeswitch/freeswitch_vars.tmp
+++ /dev/null
@@ -1,162 +0,0 @@
-<?php
-/* $Id$ */
-/*
- freeswitch_vars.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/freeswitch.inc");
-
-//$a_extensions = &$config['installedpackages']['freeswitchprofiles']['config'];
-
-if ($_GET['a'] == "default") {
- conf_mount_rw();
- exec("cp /usr/local/freeswitch/conf.orig/vars.xml /usr/local/freeswitch/conf/vars.xml");
- $savemsg = "Default Restored";
- conf_mount_ro();
-}
-
-if ($_POST['a'] == "save") {
- conf_mount_rw();
- $content = ereg_replace("\r","",$_POST['code']);
- $fd = fopen("/usr/local/freeswitch/conf/vars.xml", "w");
- fwrite($fd, $content);
- fclose($fd);
- $savemsg = "Saved";
- conf_mount_ro();
-}
-
-
-$fd = fopen("/usr/local/freeswitch/conf/vars.xml", "r");
-$content = fread($fd, filesize("/usr/local/freeswitch/conf/vars.xml"));
-fclose($fd);
-
-include("head.inc");
-
-?>
-
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-
-<script language="Javascript">
-function sf() { document.forms[0].savetopath.focus(); }
-</script>
-<script language="Javascript" type="text/javascript" src="/edit_area/edit_area_full.js"></script>
-<script language="Javascript" type="text/javascript">
- // initialisation
- editAreaLoader.init({
- id: "code" // id of the textarea to transform
- ,start_highlight: false
- ,allow_toggle: false
- ,language: "en"
- ,syntax: "html"
- ,toolbar: "search, go_to_line,|, fullscreen, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help"
- ,syntax_selection_allow: "css,html,js,php,xml,c,cpp,sql"
- ,show_line_colors: true
- });
-</script>
-
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">FreeSWITCH: Variables</p>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-display_top_tabs(build_menu());
-
-?>
-</td></tr>
-</table>
-
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
-<form action="freeswitch_vars.php" method="post" name="iform" id="iform">
-<?php
-
-?>
- <table width="98%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width='90%'><p><span class="vexpl"><span class="red"><strong>Variables<br>
- </strong></span>
- Define preprocessor variables here. Can be accessed in the xml configation with $${var_name}.
- </p>
- </td>
- <td width='10%' align='right' valign='middle'><input type="submit" value="save" /></td>
- </tr>
- </table>
- <br />
- <br />
-
- <textarea style="width:98%" id="code" name="code" rows="30" cols="<?php echo $cols; ?>" name="content"><?php echo htmlentities($content); ?></textarea>
- <br />
- <br />
-
- <table width="98%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td>/usr/local/freeswitch/conf/vars.xml</td>
- <td align='right'>
- <input type="hidden" name="f" value="<?php echo $_GET['f']; ?>" />
- <input type="hidden" name="a" value="save" />
- <?php
- echo "<input type='button' value='Restore Default' onclick=\"document.location.href='/packages/freeswitch/freeswitch_vars.php?a=default&f=vars.xml';\" />";
- ?>
- </td>
- </tr>
- </table>
-
-</form>
-
-<br>
-<br>
-
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-
-</td>
-</tr>
-</table>
-
-</div>
-
-
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch/index.tmp b/config/freeswitch/index.tmp
deleted file mode 100644
index 68984113..00000000
--- a/config/freeswitch/index.tmp
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
-
-header( 'Location: /' );
-
-?> \ No newline at end of file
diff --git a/config/freeswitch/libcurl.so.5 b/config/freeswitch/libcurl.so.5
deleted file mode 100755
index 3d57856f..00000000
--- a/config/freeswitch/libcurl.so.5
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch/libiconv.so.3 b/config/freeswitch/libiconv.so.3
deleted file mode 100755
index f207e92c..00000000
--- a/config/freeswitch/libiconv.so.3
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch/libncurses.so.5.6 b/config/freeswitch/libncurses.so.5.6
deleted file mode 100755
index 3b40374c..00000000
--- a/config/freeswitch/libncurses.so.5.6
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch/libncurses.so.5.7 b/config/freeswitch/libncurses.so.5.7
deleted file mode 100755
index 3b40374c..00000000
--- a/config/freeswitch/libncurses.so.5.7
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch/libodbc.so.1 b/config/freeswitch/libodbc.so.1
deleted file mode 100755
index eb7cb3af..00000000
--- a/config/freeswitch/libodbc.so.1
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch/libogg.so.5.3 b/config/freeswitch/libogg.so.5.3
deleted file mode 100755
index d230b68e..00000000
--- a/config/freeswitch/libogg.so.5.3
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch/libspandsp.so.1 b/config/freeswitch/libspandsp.so.1
deleted file mode 100755
index 177b8c22..00000000
--- a/config/freeswitch/libspandsp.so.1
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch/libtinfo.so.5.6 b/config/freeswitch/libtinfo.so.5.6
deleted file mode 100755
index 1263ec79..00000000
--- a/config/freeswitch/libtinfo.so.5.6
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch/libvorbis.so.4 b/config/freeswitch/libvorbis.so.4
deleted file mode 100755
index ec91ac85..00000000
--- a/config/freeswitch/libvorbis.so.4
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch/originate.js b/config/freeswitch/originate.js
deleted file mode 100644
index a7c6fa2e..00000000
--- a/config/freeswitch/originate.js
+++ /dev/null
@@ -1,84 +0,0 @@
-var uuid = argv[0];
-var sipuri = argv[1];
-var extension = argv[2];
-var caller_announce = argv[3];
-var caller_id_name = argv[4];
-var caller_id_number = argv[5];
-var tmp_sipuri;
-
-caller_id_name = caller_id_name.replace("+", " ");
-//console_log( "info", "caller_announce: "+caller_announce+"\n" );
-
-function originate (session, sipuri, extension, caller_announce, caller_id_name, caller_id_number) {
-
- var dtmf = new Object();
- var cid;
- dtmf.digits = "";
- cid = ",origination_caller_id_name="+caller_id_name+",origination_caller_id_number="+caller_id_number;
-
- new_session = new Session("{ignore_early_media=true"+cid+"}"+sipuri);
- new_session.execute("set", "call_timeout=30");
-
- if ( new_session.ready() ) {
-
- console_log( "info", "followme: new_session uuid "+new_session.uuid+"\n" );
- console_log( "info", "followme: no dtmf detected\n" );
-
- digitmaxlength = 1;
- while (new_session.ready()) {
-
- if (caller_announce.length > 0) {
- new_session.streamFile( "/tmp/"+caller_announce);
- }
- new_session.streamFile( "/usr/local/freeswitch/sounds/custom/8000/press_1_to_accept_2_to_reject_or_3_for_voicemail.wav");
- if (new_session.ready()) {
- if (dtmf.digits.length == 0) {
- dtmf.digits += new_session.getDigits(1, "#", 10000); // 10 seconds
- if (dtmf.digits.length == 0) {
-
- }
- else {
- break; //dtmf found end the while loop
- }
- }
- }
- }
-
- if ( dtmf.digits.length > "0" ) {
- if ( dtmf.digits == "1" ) {
- console_log( "info", "followme: call accepted\n" ); //accept
- new_session.execute("fifo", extension+"@${domain_name} out nowait");
- return true;
- }
- else if ( dtmf.digits == "2" ) {
- console_log( "info", "followme: call rejected\n" ); //reject
- new_session.hangup;
- return false;
- }
- else if ( dtmf.digits == "3" ) {
- console_log( "info", "followme: call sent to voicemail\n" ); //reject
- new_session.hangup;
- exit;
- return true;
- }
-
- }
- else {
- console_log( "info", "followme: no dtmf detected\n" ); //reject
- new_session.hangup;
- return false;
- }
-
- }
-}
-
-sipuri_array = sipuri.split(",");
-for (i = 0; i < sipuri_array.length; i++){
- tmp_sipuri = sipuri_array[i];
- console_log("info", "tmp_sipuri: "+tmp_sipuri);
- result = originate (session, tmp_sipuri, extension, caller_announce, caller_id_name, caller_id_number);
- if (result) {
- break;
- exit;
- }
-} \ No newline at end of file
diff --git a/config/freeswitch/please_enter_the_extension_number.wav b/config/freeswitch/please_enter_the_extension_number.wav
deleted file mode 100644
index d9384b0f..00000000
--- a/config/freeswitch/please_enter_the_extension_number.wav
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch/please_enter_the_phone_number.wav b/config/freeswitch/please_enter_the_phone_number.wav
deleted file mode 100644
index 9cb4057b..00000000
--- a/config/freeswitch/please_enter_the_phone_number.wav
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch/please_enter_the_pin_number.wav b/config/freeswitch/please_enter_the_pin_number.wav
deleted file mode 100644
index 107728a5..00000000
--- a/config/freeswitch/please_enter_the_pin_number.wav
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch/please_enter_your_pin_number.wav b/config/freeswitch/please_enter_your_pin_number.wav
deleted file mode 100755
index 46263917..00000000
--- a/config/freeswitch/please_enter_your_pin_number.wav
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch/please_say_your_name_and_reason_for_calling.wav b/config/freeswitch/please_say_your_name_and_reason_for_calling.wav
deleted file mode 100644
index 325a879d..00000000
--- a/config/freeswitch/please_say_your_name_and_reason_for_calling.wav
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch/press_1_to_accept_2_to_reject_or_3_for_voicemail.wav b/config/freeswitch/press_1_to_accept_2_to_reject_or_3_for_voicemail.wav
deleted file mode 100644
index 9c01616a..00000000
--- a/config/freeswitch/press_1_to_accept_2_to_reject_or_3_for_voicemail.wav
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch/your_pin_number_is_incorect_goodbye.wav b/config/freeswitch/your_pin_number_is_incorect_goodbye.wav
deleted file mode 100755
index 5683bb8e..00000000
--- a/config/freeswitch/your_pin_number_is_incorect_goodbye.wav
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch_dev/begin_recording.wav b/config/freeswitch_dev/begin_recording.wav
deleted file mode 100755
index 9e4992ca..00000000
--- a/config/freeswitch_dev/begin_recording.wav
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch_dev/call_forward_has_been_deleted.wav b/config/freeswitch_dev/call_forward_has_been_deleted.wav
deleted file mode 100644
index ebe6ed36..00000000
--- a/config/freeswitch_dev/call_forward_has_been_deleted.wav
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch_dev/call_forward_has_been_set.wav b/config/freeswitch_dev/call_forward_has_been_set.wav
deleted file mode 100644
index 58262852..00000000
--- a/config/freeswitch_dev/call_forward_has_been_set.wav
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch_dev/class.phpmailer.tmp b/config/freeswitch_dev/class.phpmailer.tmp
deleted file mode 100755
index 2ddc30fd..00000000
--- a/config/freeswitch_dev/class.phpmailer.tmp
+++ /dev/null
@@ -1,1896 +0,0 @@
-<?php
-/*~ class.phpmailer.php
-.---------------------------------------------------------------------------.
-| Software: PHPMailer - PHP email class |
-| Version: 2.0.2 |
-| Contact: via sourceforge.net support pages (also www.codeworxtech.com) |
-| Info: http://phpmailer.sourceforge.net |
-| Support: http://sourceforge.net/projects/phpmailer/ |
-| ------------------------------------------------------------------------- |
-| Author: Andy Prevost (project admininistrator) |
-| Author: Brent R. Matzelle (original founder) |
-| Copyright (c) 2004-2007, Andy Prevost. All Rights Reserved. |
-| Copyright (c) 2001-2003, Brent R. Matzelle |
-| ------------------------------------------------------------------------- |
-| License: Distributed under the Lesser General Public License (LGPL) |
-| http://www.gnu.org/copyleft/lesser.html |
-| This program is distributed in the hope that it will be useful - WITHOUT |
-| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
-| FITNESS FOR A PARTICULAR PURPOSE. |
-| ------------------------------------------------------------------------- |
-| We offer a number of paid services (www.codeworxtech.com): |
-| - Web Hosting on highly optimized fast and secure servers |
-| - Technology Consulting |
-| - Oursourcing (highly qualified programmers and graphic designers) |
-'---------------------------------------------------------------------------'
-
-/**
- * PHPMailer - PHP email transport class
- * @package PHPMailer
- * @author Andy Prevost
- * @copyright 2004 - 2008 Andy Prevost
- */
-
-class PHPMailer {
-
- /////////////////////////////////////////////////
- // PROPERTIES, PUBLIC
- /////////////////////////////////////////////////
-
- /**
- * Email priority (1 = High, 3 = Normal, 5 = low).
- * @var int
- */
- var $Priority = 3;
-
- /**
- * Sets the CharSet of the message.
- * @var string
- */
- var $CharSet = 'iso-8859-1';
-
- /**
- * Sets the Content-type of the message.
- * @var string
- */
- var $ContentType = 'text/plain';
-
- /**
- * Sets the Encoding of the message. Options for this are "8bit",
- * "7bit", "binary", "base64", and "quoted-printable".
- * @var string
- */
- var $Encoding = '8bit';
-
- /**
- * Holds the most recent mailer error message.
- * @var string
- */
- var $ErrorInfo = '';
-
- /**
- * Sets the From email address for the message.
- * @var string
- */
- var $From = 'root@localhost';
-
- /**
- * Sets the From name of the message.
- * @var string
- */
- var $FromName = 'Root User';
-
- /**
- * Sets the Sender email (Return-Path) of the message. If not empty,
- * will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
- * @var string
- */
- var $Sender = '';
-
- /**
- * Sets the Subject of the message.
- * @var string
- */
- var $Subject = '';
-
- /**
- * Sets the Body of the message. This can be either an HTML or text body.
- * If HTML then run IsHTML(true).
- * @var string
- */
- var $Body = '';
-
- /**
- * Sets the text-only body of the message. This automatically sets the
- * email to multipart/alternative. This body can be read by mail
- * clients that do not have HTML email capability such as mutt. Clients
- * that can read HTML will view the normal Body.
- * @var string
- */
- var $AltBody = '';
-
- /**
- * Sets word wrapping on the body of the message to a given number of
- * characters.
- * @var int
- */
- var $WordWrap = 0;
-
- /**
- * Method to send mail: ("mail", "sendmail", or "smtp").
- * @var string
- */
- var $Mailer = 'mail';
-
- /**
- * Sets the path of the sendmail program.
- * @var string
- */
- var $Sendmail = '/usr/sbin/sendmail';
-
- /**
- * Path to PHPMailer plugins. This is now only useful if the SMTP class
- * is in a different directory than the PHP include path.
- * @var string
- */
- var $PluginDir = '';
-
- /**
- * Holds PHPMailer version.
- * @var string
- */
- var $Version = "2.0.2";
-
- /**
- * Sets the email address that a reading confirmation will be sent.
- * @var string
- */
- var $ConfirmReadingTo = '';
-
- /**
- * Sets the hostname to use in Message-Id and Received headers
- * and as default HELO string. If empty, the value returned
- * by SERVER_NAME is used or 'localhost.localdomain'.
- * @var string
- */
- var $Hostname = '';
-
- /**
- * Sets the message ID to be used in the Message-Id header.
- * If empty, a unique id will be generated.
- * @var string
- */
- var $MessageID = '';
-
- /////////////////////////////////////////////////
- // PROPERTIES FOR SMTP
- /////////////////////////////////////////////////
-
- /**
- * Sets the SMTP hosts. All hosts must be separated by a
- * semicolon. You can also specify a different port
- * for each host by using this format: [hostname:port]
- * (e.g. "smtp1.example.com:25;smtp2.example.com").
- * Hosts will be tried in order.
- * @var string
- */
- var $Host = 'localhost';
-
- /**
- * Sets the default SMTP server port.
- * @var int
- */
- var $Port = 25;
-
- /**
- * Sets the SMTP HELO of the message (Default is $Hostname).
- * @var string
- */
- var $Helo = '';
-
- /**
- * Sets connection prefix.
- * Options are "", "ssl" or "tls"
- * @var string
- */
- var $SMTPSecure = "";
-
- /**
- * Sets SMTP authentication. Utilizes the Username and Password variables.
- * @var bool
- */
- var $SMTPAuth = false;
-
- /**
- * Sets SMTP username.
- * @var string
- */
- var $Username = '';
-
- /**
- * Sets SMTP password.
- * @var string
- */
- var $Password = '';
-
- /**
- * Sets the SMTP server timeout in seconds. This function will not
- * work with the win32 version.
- * @var int
- */
- var $Timeout = 10;
-
- /**
- * Sets SMTP class debugging on or off.
- * @var bool
- */
- var $SMTPDebug = false;
-
- /**
- * Prevents the SMTP connection from being closed after each mail
- * sending. If this is set to true then to close the connection
- * requires an explicit call to SmtpClose().
- * @var bool
- */
- var $SMTPKeepAlive = false;
-
- /**
- * Provides the ability to have the TO field process individual
- * emails, instead of sending to entire TO addresses
- * @var bool
- */
- var $SingleTo = false;
-
- /////////////////////////////////////////////////
- // PROPERTIES, PRIVATE
- /////////////////////////////////////////////////
-
- var $smtp = NULL;
- var $to = array();
- var $cc = array();
- var $bcc = array();
- var $ReplyTo = array();
- var $attachment = array();
- var $CustomHeader = array();
- var $message_type = '';
- var $boundary = array();
- var $language = array();
- var $error_count = 0;
- var $LE = "\n";
- var $sign_key_file = "";
- var $sign_key_pass = "";
-
- /////////////////////////////////////////////////
- // METHODS, VARIABLES
- /////////////////////////////////////////////////
-
- /**
- * Sets message type to HTML.
- * @param bool $bool
- * @return void
- */
- function IsHTML($bool) {
- if($bool == true) {
- $this->ContentType = 'text/html';
- } else {
- $this->ContentType = 'text/plain';
- }
- }
-
- /**
- * Sets Mailer to send message using SMTP.
- * @return void
- */
- function IsSMTP() {
- $this->Mailer = 'smtp';
- }
-
- /**
- * Sets Mailer to send message using PHP mail() function.
- * @return void
- */
- function IsMail() {
- $this->Mailer = 'mail';
- }
-
- /**
- * Sets Mailer to send message using the $Sendmail program.
- * @return void
- */
- function IsSendmail() {
- $this->Mailer = 'sendmail';
- }
-
- /**
- * Sets Mailer to send message using the qmail MTA.
- * @return void
- */
- function IsQmail() {
- $this->Sendmail = '/var/qmail/bin/sendmail';
- $this->Mailer = 'sendmail';
- }
-
- /////////////////////////////////////////////////
- // METHODS, RECIPIENTS
- /////////////////////////////////////////////////
-
- /**
- * Adds a "To" address.
- * @param string $address
- * @param string $name
- * @return void
- */
- function AddAddress($address, $name = '') {
- $cur = count($this->to);
- $this->to[$cur][0] = trim($address);
- $this->to[$cur][1] = $name;
- }
-
- /**
- * Adds a "Cc" address. Note: this function works
- * with the SMTP mailer on win32, not with the "mail"
- * mailer.
- * @param string $address
- * @param string $name
- * @return void
- */
- function AddCC($address, $name = '') {
- $cur = count($this->cc);
- $this->cc[$cur][0] = trim($address);
- $this->cc[$cur][1] = $name;
- }
-
- /**
- * Adds a "Bcc" address. Note: this function works
- * with the SMTP mailer on win32, not with the "mail"
- * mailer.
- * @param string $address
- * @param string $name
- * @return void
- */
- function AddBCC($address, $name = '') {
- $cur = count($this->bcc);
- $this->bcc[$cur][0] = trim($address);
- $this->bcc[$cur][1] = $name;
- }
-
- /**
- * Adds a "Reply-To" address.
- * @param string $address
- * @param string $name
- * @return void
- */
- function AddReplyTo($address, $name = '') {
- $cur = count($this->ReplyTo);
- $this->ReplyTo[$cur][0] = trim($address);
- $this->ReplyTo[$cur][1] = $name;
- }
-
- /////////////////////////////////////////////////
- // METHODS, MAIL SENDING
- /////////////////////////////////////////////////
-
- /**
- * Creates message and assigns Mailer. If the message is
- * not sent successfully then it returns false. Use the ErrorInfo
- * variable to view description of the error.
- * @return bool
- */
- function Send() {
- $header = '';
- $body = '';
- $result = true;
-
- if((count($this->to) + count($this->cc) + count($this->bcc)) < 1) {
- $this->SetError($this->Lang('provide_address'));
- return false;
- }
-
- /* Set whether the message is multipart/alternative */
- if(!empty($this->AltBody)) {
- $this->ContentType = 'multipart/alternative';
- }
-
- $this->error_count = 0; // reset errors
- $this->SetMessageType();
- $header .= $this->CreateHeader();
- $body = $this->CreateBody();
-
- if($body == '') {
- return false;
- }
-
- /* Choose the mailer */
- switch($this->Mailer) {
- case 'sendmail':
- $result = $this->SendmailSend($header, $body);
- break;
- case 'smtp':
- $result = $this->SmtpSend($header, $body);
- break;
- case 'mail':
- $result = $this->MailSend($header, $body);
- break;
- default:
- $result = $this->MailSend($header, $body);
- break;
- //$this->SetError($this->Mailer . $this->Lang('mailer_not_supported'));
- //$result = false;
- //break;
- }
-
- return $result;
- }
-
- /**
- * Sends mail using the $Sendmail program.
- * @access private
- * @return bool
- */
- function SendmailSend($header, $body) {
- if ($this->Sender != '') {
- $sendmail = sprintf("%s -oi -f %s -t", escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
- } else {
- $sendmail = sprintf("%s -oi -t", escapeshellcmd($this->Sendmail));
- }
-
- if(!@$mail = popen($sendmail, 'w')) {
- $this->SetError($this->Lang('execute') . $this->Sendmail);
- return false;
- }
-
- fputs($mail, $header);
- fputs($mail, $body);
-
- $result = pclose($mail);
- if (version_compare(phpversion(), '4.2.3') == -1) {
- $result = $result >> 8 & 0xFF;
- }
- if($result != 0) {
- $this->SetError($this->Lang('execute') . $this->Sendmail);
- return false;
- }
- return true;
- }
-
- /**
- * Sends mail using the PHP mail() function.
- * @access private
- * @return bool
- */
- function MailSend($header, $body) {
-
- $to = '';
- for($i = 0; $i < count($this->to); $i++) {
- if($i != 0) { $to .= ', '; }
- $to .= $this->AddrFormat($this->to[$i]);
- }
-
- $toArr = split(',', $to);
-
- $params = sprintf("-oi -f %s", $this->Sender);
- if ($this->Sender != '' && strlen(ini_get('safe_mode')) < 1) {
- $old_from = ini_get('sendmail_from');
- ini_set('sendmail_from', $this->Sender);
- if ($this->SingleTo === true && count($toArr) > 1) {
- foreach ($toArr as $key => $val) {
- $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
- }
- } else {
- $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
- }
- } else {
- if ($this->SingleTo === true && count($toArr) > 1) {
- foreach ($toArr as $key => $val) {
- $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
- }
- } else {
- $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header);
- }
- }
-
- if (isset($old_from)) {
- ini_set('sendmail_from', $old_from);
- }
-
- if(!$rt) {
- $this->SetError($this->Lang('instantiate'));
- return false;
- }
-
- return true;
- }
-
- /**
- * Sends mail via SMTP using PhpSMTP (Author:
- * Chris Ryan). Returns bool. Returns false if there is a
- * bad MAIL FROM, RCPT, or DATA input.
- * @access private
- * @return bool
- */
- function SmtpSend($header, $body) {
- include_once($this->PluginDir . 'class.smtp.php');
- $error = '';
- $bad_rcpt = array();
-
- if(!$this->SmtpConnect()) {
- return false;
- }
-
- $smtp_from = ($this->Sender == '') ? $this->From : $this->Sender;
- if(!$this->smtp->Mail($smtp_from)) {
- $error = $this->Lang('from_failed') . $smtp_from;
- $this->SetError($error);
- $this->smtp->Reset();
- return false;
- }
-
- /* Attempt to send attach all recipients */
- for($i = 0; $i < count($this->to); $i++) {
- if(!$this->smtp->Recipient($this->to[$i][0])) {
- $bad_rcpt[] = $this->to[$i][0];
- }
- }
- for($i = 0; $i < count($this->cc); $i++) {
- if(!$this->smtp->Recipient($this->cc[$i][0])) {
- $bad_rcpt[] = $this->cc[$i][0];
- }
- }
- for($i = 0; $i < count($this->bcc); $i++) {
- if(!$this->smtp->Recipient($this->bcc[$i][0])) {
- $bad_rcpt[] = $this->bcc[$i][0];
- }
- }
-
- if(count($bad_rcpt) > 0) { // Create error message
- for($i = 0; $i < count($bad_rcpt); $i++) {
- if($i != 0) {
- $error .= ', ';
- }
- $error .= $bad_rcpt[$i];
- }
- $error = $this->Lang('recipients_failed') . $error;
- $this->SetError($error);
- $this->smtp->Reset();
- return false;
- }
-
- if(!$this->smtp->Data($header . $body)) {
- $this->SetError($this->Lang('data_not_accepted'));
- $this->smtp->Reset();
- return false;
- }
- if($this->SMTPKeepAlive == true) {
- $this->smtp->Reset();
- } else {
- $this->SmtpClose();
- }
-
- return true;
- }
-
- /**
- * Initiates a connection to an SMTP server. Returns false if the
- * operation failed.
- * @access private
- * @return bool
- */
- function SmtpConnect() {
- if($this->smtp == NULL) {
- $this->smtp = new SMTP();
- }
-
- $this->smtp->do_debug = $this->SMTPDebug;
- $hosts = explode(';', $this->Host);
- $index = 0;
- $connection = ($this->smtp->Connected());
-
- /* Retry while there is no connection */
- while($index < count($hosts) && $connection == false) {
- $hostinfo = array();
- if(eregi('^(.+):([0-9]+)$', $hosts[$index], $hostinfo)) {
- $host = $hostinfo[1];
- $port = $hostinfo[2];
- } else {
- $host = $hosts[$index];
- $port = $this->Port;
- }
-
- if($this->smtp->Connect(((!empty($this->SMTPSecure))?$this->SMTPSecure.'://':'').$host, $port, $this->Timeout)) {
- if ($this->Helo != '') {
- $this->smtp->Hello($this->Helo);
- } else {
- $this->smtp->Hello($this->ServerHostname());
- }
-
- $connection = true;
- if($this->SMTPAuth) {
- if(!$this->smtp->Authenticate($this->Username, $this->Password)) {
- $this->SetError($this->Lang('authenticate'));
- $this->smtp->Reset();
- $connection = false;
- }
- }
- }
- $index++;
- }
- if(!$connection) {
- $this->SetError($this->Lang('connect_host'));
- }
-
- return $connection;
- }
-
- /**
- * Closes the active SMTP session if one exists.
- * @return void
- */
- function SmtpClose() {
- if($this->smtp != NULL) {
- if($this->smtp->Connected()) {
- $this->smtp->Quit();
- $this->smtp->Close();
- }
- }
- }
-
- /**
- * Sets the language for all class error messages. Returns false
- * if it cannot load the language file. The default language type
- * is English.
- * @param string $lang_type Type of language (e.g. Portuguese: "br")
- * @param string $lang_path Path to the language file directory
- * @access public
- * @return bool
- */
- function SetLanguage($lang_type, $lang_path = 'language/') {
- if(file_exists($lang_path.'phpmailer.lang-'.$lang_type.'.php')) {
- include($lang_path.'phpmailer.lang-'.$lang_type.'.php');
- } elseif (file_exists($lang_path.'phpmailer.lang-en.php')) {
- include($lang_path.'phpmailer.lang-en.php');
- } else {
- $this->SetError('Could not load language file');
- return false;
- }
- $this->language = $PHPMAILER_LANG;
-
- return true;
- }
-
- /////////////////////////////////////////////////
- // METHODS, MESSAGE CREATION
- /////////////////////////////////////////////////
-
- /**
- * Creates recipient headers.
- * @access private
- * @return string
- */
- function AddrAppend($type, $addr) {
- $addr_str = $type . ': ';
- $addr_str .= $this->AddrFormat($addr[0]);
- if(count($addr) > 1) {
- for($i = 1; $i < count($addr); $i++) {
- $addr_str .= ', ' . $this->AddrFormat($addr[$i]);
- }
- }
- $addr_str .= $this->LE;
-
- return $addr_str;
- }
-
- /**
- * Formats an address correctly.
- * @access private
- * @return string
- */
- function AddrFormat($addr) {
- if(empty($addr[1])) {
- $formatted = $this->SecureHeader($addr[0]);
- } else {
- $formatted = $this->EncodeHeader($this->SecureHeader($addr[1]), 'phrase') . " <" . $this->SecureHeader($addr[0]) . ">";
- }
-
- return $formatted;
- }
-
- /**
- * Wraps message for use with mailers that do not
- * automatically perform wrapping and for quoted-printable.
- * Original written by philippe.
- * @access private
- * @return string
- */
- function WrapText($message, $length, $qp_mode = false) {
- $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE;
- // If utf-8 encoding is used, we will need to make sure we don't
- // split multibyte characters when we wrap
- $is_utf8 = (strtolower($this->CharSet) == "utf-8");
-
- $message = $this->FixEOL($message);
- if (substr($message, -1) == $this->LE) {
- $message = substr($message, 0, -1);
- }
-
- $line = explode($this->LE, $message);
- $message = '';
- for ($i=0 ;$i < count($line); $i++) {
- $line_part = explode(' ', $line[$i]);
- $buf = '';
- for ($e = 0; $e<count($line_part); $e++) {
- $word = $line_part[$e];
- if ($qp_mode and (strlen($word) > $length)) {
- $space_left = $length - strlen($buf) - 1;
- if ($e != 0) {
- if ($space_left > 20) {
- $len = $space_left;
- if ($is_utf8) {
- $len = $this->UTF8CharBoundary($word, $len);
- } elseif (substr($word, $len - 1, 1) == "=") {
- $len--;
- } elseif (substr($word, $len - 2, 1) == "=") {
- $len -= 2;
- }
- $part = substr($word, 0, $len);
- $word = substr($word, $len);
- $buf .= ' ' . $part;
- $message .= $buf . sprintf("=%s", $this->LE);
- } else {
- $message .= $buf . $soft_break;
- }
- $buf = '';
- }
- while (strlen($word) > 0) {
- $len = $length;
- if ($is_utf8) {
- $len = $this->UTF8CharBoundary($word, $len);
- } elseif (substr($word, $len - 1, 1) == "=") {
- $len--;
- } elseif (substr($word, $len - 2, 1) == "=") {
- $len -= 2;
- }
- $part = substr($word, 0, $len);
- $word = substr($word, $len);
-
- if (strlen($word) > 0) {
- $message .= $part . sprintf("=%s", $this->LE);
- } else {
- $buf = $part;
- }
- }
- } else {
- $buf_o = $buf;
- $buf .= ($e == 0) ? $word : (' ' . $word);
-
- if (strlen($buf) > $length and $buf_o != '') {
- $message .= $buf_o . $soft_break;
- $buf = $word;
- }
- }
- }
- $message .= $buf . $this->LE;
- }
-
- return $message;
- }
-
- /**
- * Finds last character boundary prior to maxLength in a utf-8
- * quoted (printable) encoded string.
- * Original written by Colin Brown.
- * @access private
- * @param string $encodedText utf-8 QP text
- * @param int $maxLength find last character boundary prior to this length
- * @return int
- */
- function UTF8CharBoundary($encodedText, $maxLength) {
- $foundSplitPos = false;
- $lookBack = 3;
- while (!$foundSplitPos) {
- $lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack);
- $encodedCharPos = strpos($lastChunk, "=");
- if ($encodedCharPos !== false) {
- // Found start of encoded character byte within $lookBack block.
- // Check the encoded byte value (the 2 chars after the '=')
- $hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2);
- $dec = hexdec($hex);
- if ($dec < 128) { // Single byte character.
- // If the encoded char was found at pos 0, it will fit
- // otherwise reduce maxLength to start of the encoded char
- $maxLength = ($encodedCharPos == 0) ? $maxLength :
- $maxLength - ($lookBack - $encodedCharPos);
- $foundSplitPos = true;
- } elseif ($dec >= 192) { // First byte of a multi byte character
- // Reduce maxLength to split at start of character
- $maxLength = $maxLength - ($lookBack - $encodedCharPos);
- $foundSplitPos = true;
- } elseif ($dec < 192) { // Middle byte of a multi byte character, look further back
- $lookBack += 3;
- }
- } else {
- // No encoded character found
- $foundSplitPos = true;
- }
- }
- return $maxLength;
- }
-
- /**
- * Set the body wrapping.
- * @access private
- * @return void
- */
- function SetWordWrap() {
- if($this->WordWrap < 1) {
- return;
- }
-
- switch($this->message_type) {
- case 'alt':
- /* fall through */
- case 'alt_attachments':
- $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap);
- break;
- default:
- $this->Body = $this->WrapText($this->Body, $this->WordWrap);
- break;
- }
- }
-
- /**
- * Assembles message header.
- * @access private
- * @return string
- */
- function CreateHeader() {
- $result = '';
-
- /* Set the boundaries */
- $uniq_id = md5(uniqid(time()));
- $this->boundary[1] = 'b1_' . $uniq_id;
- $this->boundary[2] = 'b2_' . $uniq_id;
-
- $result .= $this->HeaderLine('Date', $this->RFCDate());
- if($this->Sender == '') {
- $result .= $this->HeaderLine('Return-Path', trim($this->From));
- } else {
- $result .= $this->HeaderLine('Return-Path', trim($this->Sender));
- }
-
- /* To be created automatically by mail() */
- if($this->Mailer != 'mail') {
- if(count($this->to) > 0) {
- $result .= $this->AddrAppend('To', $this->to);
- } elseif (count($this->cc) == 0) {
- $result .= $this->HeaderLine('To', 'undisclosed-recipients:;');
- }
- if(count($this->cc) > 0) {
- $result .= $this->AddrAppend('Cc', $this->cc);
- }
- }
-
- $from = array();
- $from[0][0] = trim($this->From);
- $from[0][1] = $this->FromName;
- $result .= $this->AddrAppend('From', $from);
-
- /* sendmail and mail() extract Cc from the header before sending */
- if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->cc) > 0)) {
- $result .= $this->AddrAppend('Cc', $this->cc);
- }
-
- /* sendmail and mail() extract Bcc from the header before sending */
- if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->bcc) > 0)) {
- $result .= $this->AddrAppend('Bcc', $this->bcc);
- }
-
- if(count($this->ReplyTo) > 0) {
- $result .= $this->AddrAppend('Reply-To', $this->ReplyTo);
- }
-
- /* mail() sets the subject itself */
- if($this->Mailer != 'mail') {
- $result .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader($this->Subject)));
- }
-
- if($this->MessageID != '') {
- $result .= $this->HeaderLine('Message-ID',$this->MessageID);
- } else {
- $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE);
- }
- $result .= $this->HeaderLine('X-Priority', $this->Priority);
- $result .= $this->HeaderLine('X-Mailer', 'PHPMailer (phpmailer.sourceforge.net) [version ' . $this->Version . ']');
-
- if($this->ConfirmReadingTo != '') {
- $result .= $this->HeaderLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>');
- }
-
- // Add custom headers
- for($index = 0; $index < count($this->CustomHeader); $index++) {
- $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), $this->EncodeHeader(trim($this->CustomHeader[$index][1])));
- }
- if (!$this->sign_key_file) {
- $result .= $this->HeaderLine('MIME-Version', '1.0');
- $result .= $this->GetMailMIME();
- }
-
- return $result;
- }
-
- /**
- * Returns the message MIME.
- * @access private
- * @return string
- */
- function GetMailMIME() {
- $result = '';
- switch($this->message_type) {
- case 'plain':
- $result .= $this->HeaderLine('Content-Transfer-Encoding', $this->Encoding);
- $result .= sprintf("Content-Type: %s; charset=\"%s\"", $this->ContentType, $this->CharSet);
- break;
- case 'attachments':
- /* fall through */
- case 'alt_attachments':
- if($this->InlineImageExists()){
- $result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", 'multipart/related', $this->LE, $this->LE, $this->boundary[1], $this->LE);
- } else {
- $result .= $this->HeaderLine('Content-Type', 'multipart/mixed;');
- $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
- }
- break;
- case 'alt':
- $result .= $this->HeaderLine('Content-Type', 'multipart/alternative;');
- $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
- break;
- }
-
- if($this->Mailer != 'mail') {
- $result .= $this->LE.$this->LE;
- }
-
- return $result;
- }
-
- /**
- * Assembles the message body. Returns an empty string on failure.
- * @access private
- * @return string
- */
- function CreateBody() {
- $result = '';
- if ($this->sign_key_file) {
- $result .= $this->GetMailMIME();
- }
-
- $this->SetWordWrap();
-
- switch($this->message_type) {
- case 'alt':
- $result .= $this->GetBoundary($this->boundary[1], '', 'text/plain', '');
- $result .= $this->EncodeString($this->AltBody, $this->Encoding);
- $result .= $this->LE.$this->LE;
- $result .= $this->GetBoundary($this->boundary[1], '', 'text/html', '');
- $result .= $this->EncodeString($this->Body, $this->Encoding);
- $result .= $this->LE.$this->LE;
- $result .= $this->EndBoundary($this->boundary[1]);
- break;
- case 'plain':
- $result .= $this->EncodeString($this->Body, $this->Encoding);
- break;
- case 'attachments':
- $result .= $this->GetBoundary($this->boundary[1], '', '', '');
- $result .= $this->EncodeString($this->Body, $this->Encoding);
- $result .= $this->LE;
- $result .= $this->AttachAll();
- break;
- case 'alt_attachments':
- $result .= sprintf("--%s%s", $this->boundary[1], $this->LE);
- $result .= sprintf("Content-Type: %s;%s" . "\tboundary=\"%s\"%s", 'multipart/alternative', $this->LE, $this->boundary[2], $this->LE.$this->LE);
- $result .= $this->GetBoundary($this->boundary[2], '', 'text/plain', '') . $this->LE; // Create text body
- $result .= $this->EncodeString($this->AltBody, $this->Encoding);
- $result .= $this->LE.$this->LE;
- $result .= $this->GetBoundary($this->boundary[2], '', 'text/html', '') . $this->LE; // Create the HTML body
- $result .= $this->EncodeString($this->Body, $this->Encoding);
- $result .= $this->LE.$this->LE;
- $result .= $this->EndBoundary($this->boundary[2]);
- $result .= $this->AttachAll();
- break;
- }
-
- if($this->IsError()) {
- $result = '';
- } else if ($this->sign_key_file) {
- $file = tempnam("", "mail");
- $fp = fopen($file, "w");
- fwrite($fp, $result);
- fclose($fp);
- $signed = tempnam("", "signed");
-
- if (@openssl_pkcs7_sign($file, $signed, "file://".$this->sign_key_file, array("file://".$this->sign_key_file, $this->sign_key_pass), null)) {
- $fp = fopen($signed, "r");
- $result = fread($fp, filesize($this->sign_key_file));
- fclose($fp);
- } else {
- $this->SetError($this->Lang("signing").openssl_error_string());
- $result = '';
- }
-
- unlink($file);
- unlink($signed);
- }
-
- return $result;
- }
-
- /**
- * Returns the start of a message boundary.
- * @access private
- */
- function GetBoundary($boundary, $charSet, $contentType, $encoding) {
- $result = '';
- if($charSet == '') {
- $charSet = $this->CharSet;
- }
- if($contentType == '') {
- $contentType = $this->ContentType;
- }
- if($encoding == '') {
- $encoding = $this->Encoding;
- }
- $result .= $this->TextLine('--' . $boundary);
- $result .= sprintf("Content-Type: %s; charset = \"%s\"", $contentType, $charSet);
- $result .= $this->LE;
- $result .= $this->HeaderLine('Content-Transfer-Encoding', $encoding);
- $result .= $this->LE;
-
- return $result;
- }
-
- /**
- * Returns the end of a message boundary.
- * @access private
- */
- function EndBoundary($boundary) {
- return $this->LE . '--' . $boundary . '--' . $this->LE;
- }
-
- /**
- * Sets the message type.
- * @access private
- * @return void
- */
- function SetMessageType() {
- if(count($this->attachment) < 1 && strlen($this->AltBody) < 1) {
- $this->message_type = 'plain';
- } else {
- if(count($this->attachment) > 0) {
- $this->message_type = 'attachments';
- }
- if(strlen($this->AltBody) > 0 && count($this->attachment) < 1) {
- $this->message_type = 'alt';
- }
- if(strlen($this->AltBody) > 0 && count($this->attachment) > 0) {
- $this->message_type = 'alt_attachments';
- }
- }
- }
-
- /* Returns a formatted header line.
- * @access private
- * @return string
- */
- function HeaderLine($name, $value) {
- return $name . ': ' . $value . $this->LE;
- }
-
- /**
- * Returns a formatted mail line.
- * @access private
- * @return string
- */
- function TextLine($value) {
- return $value . $this->LE;
- }
-
- /////////////////////////////////////////////////
- // CLASS METHODS, ATTACHMENTS
- /////////////////////////////////////////////////
-
- /**
- * Adds an attachment from a path on the filesystem.
- * Returns false if the file could not be found
- * or accessed.
- * @param string $path Path to the attachment.
- * @param string $name Overrides the attachment name.
- * @param string $encoding File encoding (see $Encoding).
- * @param string $type File extension (MIME) type.
- * @return bool
- */
- function AddAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
- if(!@is_file($path)) {
- $this->SetError($this->Lang('file_access') . $path);
- return false;
- }
-
- $filename = basename($path);
- if($name == '') {
- $name = $filename;
- }
-
- $cur = count($this->attachment);
- $this->attachment[$cur][0] = $path;
- $this->attachment[$cur][1] = $filename;
- $this->attachment[$cur][2] = $name;
- $this->attachment[$cur][3] = $encoding;
- $this->attachment[$cur][4] = $type;
- $this->attachment[$cur][5] = false; // isStringAttachment
- $this->attachment[$cur][6] = 'attachment';
- $this->attachment[$cur][7] = 0;
-
- return true;
- }
-
- /**
- * Attaches all fs, string, and binary attachments to the message.
- * Returns an empty string on failure.
- * @access private
- * @return string
- */
- function AttachAll() {
- /* Return text of body */
- $mime = array();
-
- /* Add all attachments */
- for($i = 0; $i < count($this->attachment); $i++) {
- /* Check for string attachment */
- $bString = $this->attachment[$i][5];
- if ($bString) {
- $string = $this->attachment[$i][0];
- } else {
- $path = $this->attachment[$i][0];
- }
-
- $filename = $this->attachment[$i][1];
- $name = $this->attachment[$i][2];
- $encoding = $this->attachment[$i][3];
- $type = $this->attachment[$i][4];
- $disposition = $this->attachment[$i][6];
- $cid = $this->attachment[$i][7];
-
- $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE);
- $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $name, $this->LE);
- $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE);
-
- if($disposition == 'inline') {
- $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE);
- }
-
- $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $name, $this->LE.$this->LE);
-
- /* Encode as string attachment */
- if($bString) {
- $mime[] = $this->EncodeString($string, $encoding);
- if($this->IsError()) {
- return '';
- }
- $mime[] = $this->LE.$this->LE;
- } else {
- $mime[] = $this->EncodeFile($path, $encoding);
- if($this->IsError()) {
- return '';
- }
- $mime[] = $this->LE.$this->LE;
- }
- }
-
- $mime[] = sprintf("--%s--%s", $this->boundary[1], $this->LE);
-
- return join('', $mime);
- }
-
- /**
- * Encodes attachment in requested format. Returns an
- * empty string on failure.
- * @access private
- * @return string
- */
- function EncodeFile ($path, $encoding = 'base64') {
- if(!@$fd = fopen($path, 'rb')) {
- $this->SetError($this->Lang('file_open') . $path);
- return '';
- }
- $magic_quotes = get_magic_quotes_runtime();
- set_magic_quotes_runtime(0);
- $file_buffer = fread($fd, filesize($path));
- $file_buffer = $this->EncodeString($file_buffer, $encoding);
- fclose($fd);
- set_magic_quotes_runtime($magic_quotes);
-
- return $file_buffer;
- }
-
- /**
- * Encodes string to requested format. Returns an
- * empty string on failure.
- * @access private
- * @return string
- */
- function EncodeString ($str, $encoding = 'base64') {
- $encoded = '';
- switch(strtolower($encoding)) {
- case 'base64':
- /* chunk_split is found in PHP >= 3.0.6 */
- $encoded = chunk_split(base64_encode($str), 76, $this->LE);
- break;
- case '7bit':
- case '8bit':
- $encoded = $this->FixEOL($str);
- if (substr($encoded, -(strlen($this->LE))) != $this->LE)
- $encoded .= $this->LE;
- break;
- case 'binary':
- $encoded = $str;
- break;
- case 'quoted-printable':
- $encoded = $this->EncodeQP($str);
- break;
- default:
- $this->SetError($this->Lang('encoding') . $encoding);
- break;
- }
- return $encoded;
- }
-
- /**
- * Encode a header string to best of Q, B, quoted or none.
- * @access private
- * @return string
- */
- function EncodeHeader ($str, $position = 'text') {
- $x = 0;
-
- switch (strtolower($position)) {
- case 'phrase':
- if (!preg_match('/[\200-\377]/', $str)) {
- /* Can't use addslashes as we don't know what value has magic_quotes_sybase. */
- $encoded = addcslashes($str, "\0..\37\177\\\"");
- if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) {
- return ($encoded);
- } else {
- return ("\"$encoded\"");
- }
- }
- $x = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches);
- break;
- case 'comment':
- $x = preg_match_all('/[()"]/', $str, $matches);
- /* Fall-through */
- case 'text':
- default:
- $x += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
- break;
- }
-
- if ($x == 0) {
- return ($str);
- }
-
- $maxlen = 75 - 7 - strlen($this->CharSet);
- /* Try to select the encoding which should produce the shortest output */
- if (strlen($str)/3 < $x) {
- $encoding = 'B';
- if (function_exists('mb_strlen') && $this->HasMultiBytes($str)) {
- // Use a custom function which correctly encodes and wraps long
- // multibyte strings without breaking lines within a character
- $encoded = $this->Base64EncodeWrapMB($str);
- } else {
- $encoded = base64_encode($str);
- $maxlen -= $maxlen % 4;
- $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
- }
- } else {
- $encoding = 'Q';
- $encoded = $this->EncodeQ($str, $position);
- $encoded = $this->WrapText($encoded, $maxlen, true);
- $encoded = str_replace('='.$this->LE, "\n", trim($encoded));
- }
-
- $encoded = preg_replace('/^(.*)$/m', " =?".$this->CharSet."?$encoding?\\1?=", $encoded);
- $encoded = trim(str_replace("\n", $this->LE, $encoded));
-
- return $encoded;
- }
-
- /**
- * Checks if a string contains multibyte characters.
- * @access private
- * @param string $str multi-byte text to wrap encode
- * @return bool
- */
- function HasMultiBytes($str) {
- if (function_exists('mb_strlen')) {
- return (strlen($str) > mb_strlen($str, $this->CharSet));
- } else { // Assume no multibytes (we can't handle without mbstring functions anyway)
- return False;
- }
- }
-
- /**
- * Correctly encodes and wraps long multibyte strings for mail headers
- * without breaking lines within a character.
- * Adapted from a function by paravoid at http://uk.php.net/manual/en/function.mb-encode-mimeheader.php
- * @access private
- * @param string $str multi-byte text to wrap encode
- * @return string
- */
- function Base64EncodeWrapMB($str) {
- $start = "=?".$this->CharSet."?B?";
- $end = "?=";
- $encoded = "";
-
- $mb_length = mb_strlen($str, $this->CharSet);
- // Each line must have length <= 75, including $start and $end
- $length = 75 - strlen($start) - strlen($end);
- // Average multi-byte ratio
- $ratio = $mb_length / strlen($str);
- // Base64 has a 4:3 ratio
- $offset = $avgLength = floor($length * $ratio * .75);
-
- for ($i = 0; $i < $mb_length; $i += $offset) {
- $lookBack = 0;
-
- do {
- $offset = $avgLength - $lookBack;
- $chunk = mb_substr($str, $i, $offset, $this->CharSet);
- $chunk = base64_encode($chunk);
- $lookBack++;
- }
- while (strlen($chunk) > $length);
-
- $encoded .= $chunk . $this->LE;
- }
-
- // Chomp the last linefeed
- $encoded = substr($encoded, 0, -strlen($this->LE));
- return $encoded;
- }
-
- /**
- * Encode string to quoted-printable.
- * @access private
- * @return string
- */
- function EncodeQP( $input = '', $line_max = 76, $space_conv = false ) {
- $hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
- $lines = preg_split('/(?:\r\n|\r|\n)/', $input);
- $eol = "\r\n";
- $escape = '=';
- $output = '';
- while( list(, $line) = each($lines) ) {
- $linlen = strlen($line);
- $newline = '';
- for($i = 0; $i < $linlen; $i++) {
- $c = substr( $line, $i, 1 );
- $dec = ord( $c );
- if ( ( $i == 0 ) && ( $dec == 46 ) ) { // convert first point in the line into =2E
- $c = '=2E';
- }
- if ( $dec == 32 ) {
- if ( $i == ( $linlen - 1 ) ) { // convert space at eol only
- $c = '=20';
- } else if ( $space_conv ) {
- $c = '=20';
- }
- } elseif ( ($dec == 61) || ($dec < 32 ) || ($dec > 126) ) { // always encode "\t", which is *not* required
- $h2 = floor($dec/16);
- $h1 = floor($dec%16);
- $c = $escape.$hex[$h2].$hex[$h1];
- }
- if ( (strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted
- $output .= $newline.$escape.$eol; // soft line break; " =\r\n" is okay
- $newline = '';
- // check if newline first character will be point or not
- if ( $dec == 46 ) {
- $c = '=2E';
- }
- }
- $newline .= $c;
- } // end of for
- $output .= $newline.$eol;
- } // end of while
- return trim($output);
- }
-
- /**
- * Encode string to q encoding.
- * @access private
- * @return string
- */
- function EncodeQ ($str, $position = 'text') {
- /* There should not be any EOL in the string */
- $encoded = preg_replace("[\r\n]", '', $str);
-
- switch (strtolower($position)) {
- case 'phrase':
- $encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
- break;
- case 'comment':
- $encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
- case 'text':
- default:
- /* Replace every high ascii, control =, ? and _ characters */
- $encoded = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e',
- "'='.sprintf('%02X', ord('\\1'))", $encoded);
- break;
- }
-
- /* Replace every spaces to _ (more readable than =20) */
- $encoded = str_replace(' ', '_', $encoded);
-
- return $encoded;
- }
-
- /**
- * Adds a string or binary attachment (non-filesystem) to the list.
- * This method can be used to attach ascii or binary data,
- * such as a BLOB record from a database.
- * @param string $string String attachment data.
- * @param string $filename Name of the attachment.
- * @param string $encoding File encoding (see $Encoding).
- * @param string $type File extension (MIME) type.
- * @return void
- */
- function AddStringAttachment($string, $filename, $encoding = 'base64', $type = 'application/octet-stream') {
- /* Append to $attachment array */
- $cur = count($this->attachment);
- $this->attachment[$cur][0] = $string;
- $this->attachment[$cur][1] = $filename;
- $this->attachment[$cur][2] = $filename;
- $this->attachment[$cur][3] = $encoding;
- $this->attachment[$cur][4] = $type;
- $this->attachment[$cur][5] = true; // isString
- $this->attachment[$cur][6] = 'attachment';
- $this->attachment[$cur][7] = 0;
- }
-
- /**
- * Adds an embedded attachment. This can include images, sounds, and
- * just about any other document. Make sure to set the $type to an
- * image type. For JPEG images use "image/jpeg" and for GIF images
- * use "image/gif".
- * @param string $path Path to the attachment.
- * @param string $cid Content ID of the attachment. Use this to identify
- * the Id for accessing the image in an HTML form.
- * @param string $name Overrides the attachment name.
- * @param string $encoding File encoding (see $Encoding).
- * @param string $type File extension (MIME) type.
- * @return bool
- */
- function AddEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
-
- if(!@is_file($path)) {
- $this->SetError($this->Lang('file_access') . $path);
- return false;
- }
-
- $filename = basename($path);
- if($name == '') {
- $name = $filename;
- }
-
- /* Append to $attachment array */
- $cur = count($this->attachment);
- $this->attachment[$cur][0] = $path;
- $this->attachment[$cur][1] = $filename;
- $this->attachment[$cur][2] = $name;
- $this->attachment[$cur][3] = $encoding;
- $this->attachment[$cur][4] = $type;
- $this->attachment[$cur][5] = false;
- $this->attachment[$cur][6] = 'inline';
- $this->attachment[$cur][7] = $cid;
-
- return true;
- }
-
- /**
- * Returns true if an inline attachment is present.
- * @access private
- * @return bool
- */
- function InlineImageExists() {
- $result = false;
- for($i = 0; $i < count($this->attachment); $i++) {
- if($this->attachment[$i][6] == 'inline') {
- $result = true;
- break;
- }
- }
-
- return $result;
- }
-
- /////////////////////////////////////////////////
- // CLASS METHODS, MESSAGE RESET
- /////////////////////////////////////////////////
-
- /**
- * Clears all recipients assigned in the TO array. Returns void.
- * @return void
- */
- function ClearAddresses() {
- $this->to = array();
- }
-
- /**
- * Clears all recipients assigned in the CC array. Returns void.
- * @return void
- */
- function ClearCCs() {
- $this->cc = array();
- }
-
- /**
- * Clears all recipients assigned in the BCC array. Returns void.
- * @return void
- */
- function ClearBCCs() {
- $this->bcc = array();
- }
-
- /**
- * Clears all recipients assigned in the ReplyTo array. Returns void.
- * @return void
- */
- function ClearReplyTos() {
- $this->ReplyTo = array();
- }
-
- /**
- * Clears all recipients assigned in the TO, CC and BCC
- * array. Returns void.
- * @return void
- */
- function ClearAllRecipients() {
- $this->to = array();
- $this->cc = array();
- $this->bcc = array();
- }
-
- /**
- * Clears all previously set filesystem, string, and binary
- * attachments. Returns void.
- * @return void
- */
- function ClearAttachments() {
- $this->attachment = array();
- }
-
- /**
- * Clears all custom headers. Returns void.
- * @return void
- */
- function ClearCustomHeaders() {
- $this->CustomHeader = array();
- }
-
- /////////////////////////////////////////////////
- // CLASS METHODS, MISCELLANEOUS
- /////////////////////////////////////////////////
-
- /**
- * Adds the error message to the error container.
- * Returns void.
- * @access private
- * @return void
- */
- function SetError($msg) {
- $this->error_count++;
- $this->ErrorInfo = $msg;
- }
-
- /**
- * Returns the proper RFC 822 formatted date.
- * @access private
- * @return string
- */
- function RFCDate() {
- $tz = date('Z');
- $tzs = ($tz < 0) ? '-' : '+';
- $tz = abs($tz);
- $tz = (int)($tz/3600)*100 + ($tz%3600)/60;
- $result = sprintf("%s %s%04d", date('D, j M Y H:i:s'), $tzs, $tz);
-
- return $result;
- }
-
- /**
- * Returns the appropriate server variable. Should work with both
- * PHP 4.1.0+ as well as older versions. Returns an empty string
- * if nothing is found.
- * @access private
- * @return mixed
- */
- function ServerVar($varName) {
- global $HTTP_SERVER_VARS;
- global $HTTP_ENV_VARS;
-
- if(!isset($_SERVER)) {
- $_SERVER = $HTTP_SERVER_VARS;
- if(!isset($_SERVER['REMOTE_ADDR'])) {
- $_SERVER = $HTTP_ENV_VARS; // must be Apache
- }
- }
-
- if(isset($_SERVER[$varName])) {
- return $_SERVER[$varName];
- } else {
- return '';
- }
- }
-
- /**
- * Returns the server hostname or 'localhost.localdomain' if unknown.
- * @access private
- * @return string
- */
- function ServerHostname() {
- if ($this->Hostname != '') {
- $result = $this->Hostname;
- } elseif ($this->ServerVar('SERVER_NAME') != '') {
- $result = $this->ServerVar('SERVER_NAME');
- } else {
- $result = 'localhost.localdomain';
- }
-
- return $result;
- }
-
- /**
- * Returns a message in the appropriate language.
- * @access private
- * @return string
- */
- function Lang($key) {
- if(count($this->language) < 1) {
- $this->SetLanguage('en'); // set the default language
- }
-
- if(isset($this->language[$key])) {
- return $this->language[$key];
- } else {
- return 'Language string failed to load: ' . $key;
- }
- }
-
- /**
- * Returns true if an error occurred.
- * @return bool
- */
- function IsError() {
- return ($this->error_count > 0);
- }
-
- /**
- * Changes every end of line from CR or LF to CRLF.
- * @access private
- * @return string
- */
- function FixEOL($str) {
- $str = str_replace("\r\n", "\n", $str);
- $str = str_replace("\r", "\n", $str);
- $str = str_replace("\n", $this->LE, $str);
- return $str;
- }
-
- /**
- * Adds a custom header.
- * @return void
- */
- function AddCustomHeader($custom_header) {
- $this->CustomHeader[] = explode(':', $custom_header, 2);
- }
-
- /**
- * Evaluates the message and returns modifications for inline images and backgrounds
- * @access public
- * @return $message
- */
- function MsgHTML($message,$basedir='') {
- preg_match_all("/(src|background)=\"(.*)\"/Ui", $message, $images);
- if(isset($images[2])) {
- foreach($images[2] as $i => $url) {
- // do not change urls for absolute images (thanks to corvuscorax)
- if (!preg_match('/^[A-z][A-z]*:\/\//',$url)) {
- $filename = basename($url);
- $directory = dirname($url);
- ($directory == '.')?$directory='':'';
- $cid = 'cid:' . md5($filename);
- $fileParts = split("\.", $filename);
- $ext = $fileParts[1];
- $mimeType = $this->_mime_types($ext);
- if ( strlen($basedir) > 1 && substr($basedir,-1) != '/') { $basedir .= '/'; }
- if ( strlen($directory) > 1 && substr($basedir,-1) != '/') { $directory .= '/'; }
- $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64', $mimeType);
- if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType) ) {
- $message = preg_replace("/".$images[1][$i]."=\"".preg_quote($url, '/')."\"/Ui", $images[1][$i]."=\"".$cid."\"", $message);
- }
- }
- }
- }
- $this->IsHTML(true);
- $this->Body = $message;
- $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s','',$message)));
- if ( !empty($textMsg) && empty($this->AltBody) ) {
- $this->AltBody = $textMsg;
- }
- if ( empty($this->AltBody) ) {
- $this->AltBody = 'To view this email message, open the email in with HTML compatibility!' . "\n\n";
- }
- }
-
- /**
- * Gets the mime type of the embedded or inline image
- * @access private
- * @return mime type of ext
- */
- function _mime_types($ext = '') {
- $mimes = array(
- 'hqx' => 'application/mac-binhex40',
- 'cpt' => 'application/mac-compactpro',
- 'doc' => 'application/msword',
- 'bin' => 'application/macbinary',
- 'dms' => 'application/octet-stream',
- 'lha' => 'application/octet-stream',
- 'lzh' => 'application/octet-stream',
- 'exe' => 'application/octet-stream',
- 'class' => 'application/octet-stream',
- 'psd' => 'application/octet-stream',
- 'so' => 'application/octet-stream',
- 'sea' => 'application/octet-stream',
- 'dll' => 'application/octet-stream',
- 'oda' => 'application/oda',
- 'pdf' => 'application/pdf',
- 'ai' => 'application/postscript',
- 'eps' => 'application/postscript',
- 'ps' => 'application/postscript',
- 'smi' => 'application/smil',
- 'smil' => 'application/smil',
- 'mif' => 'application/vnd.mif',
- 'xls' => 'application/vnd.ms-excel',
- 'ppt' => 'application/vnd.ms-powerpoint',
- 'wbxml' => 'application/vnd.wap.wbxml',
- 'wmlc' => 'application/vnd.wap.wmlc',
- 'dcr' => 'application/x-director',
- 'dir' => 'application/x-director',
- 'dxr' => 'application/x-director',
- 'dvi' => 'application/x-dvi',
- 'gtar' => 'application/x-gtar',
- 'php' => 'application/x-httpd-php',
- 'php4' => 'application/x-httpd-php',
- 'php3' => 'application/x-httpd-php',
- 'phtml' => 'application/x-httpd-php',
- 'phps' => 'application/x-httpd-php-source',
- 'js' => 'application/x-javascript',
- 'swf' => 'application/x-shockwave-flash',
- 'sit' => 'application/x-stuffit',
- 'tar' => 'application/x-tar',
- 'tgz' => 'application/x-tar',
- 'xhtml' => 'application/xhtml+xml',
- 'xht' => 'application/xhtml+xml',
- 'zip' => 'application/zip',
- 'mid' => 'audio/midi',
- 'midi' => 'audio/midi',
- 'mpga' => 'audio/mpeg',
- 'mp2' => 'audio/mpeg',
- 'mp3' => 'audio/mpeg',
- 'aif' => 'audio/x-aiff',
- 'aiff' => 'audio/x-aiff',
- 'aifc' => 'audio/x-aiff',
- 'ram' => 'audio/x-pn-realaudio',
- 'rm' => 'audio/x-pn-realaudio',
- 'rpm' => 'audio/x-pn-realaudio-plugin',
- 'ra' => 'audio/x-realaudio',
- 'rv' => 'video/vnd.rn-realvideo',
- 'wav' => 'audio/x-wav',
- 'bmp' => 'image/bmp',
- 'gif' => 'image/gif',
- 'jpeg' => 'image/jpeg',
- 'jpg' => 'image/jpeg',
- 'jpe' => 'image/jpeg',
- 'png' => 'image/png',
- 'tiff' => 'image/tiff',
- 'tif' => 'image/tiff',
- 'css' => 'text/css',
- 'html' => 'text/html',
- 'htm' => 'text/html',
- 'shtml' => 'text/html',
- 'txt' => 'text/plain',
- 'text' => 'text/plain',
- 'log' => 'text/plain',
- 'rtx' => 'text/richtext',
- 'rtf' => 'text/rtf',
- 'xml' => 'text/xml',
- 'xsl' => 'text/xml',
- 'mpeg' => 'video/mpeg',
- 'mpg' => 'video/mpeg',
- 'mpe' => 'video/mpeg',
- 'qt' => 'video/quicktime',
- 'mov' => 'video/quicktime',
- 'avi' => 'video/x-msvideo',
- 'movie' => 'video/x-sgi-movie',
- 'doc' => 'application/msword',
- 'word' => 'application/msword',
- 'xl' => 'application/excel',
- 'eml' => 'message/rfc822'
- );
- return ( ! isset($mimes[strtolower($ext)])) ? 'application/octet-stream' : $mimes[strtolower($ext)];
- }
-
- /**
- * Set (or reset) Class Objects (variables)
- *
- * Usage Example:
- * $page->set('X-Priority', '3');
- *
- * @access public
- * @param string $name Parameter Name
- * @param mixed $value Parameter Value
- * NOTE: will not work with arrays, there are no arrays to set/reset
- */
- function set ( $name, $value = '' ) {
- if ( isset($this->$name) ) {
- $this->$name = $value;
- } else {
- $this->SetError('Cannot set or reset variable ' . $name);
- return false;
- }
- }
-
- /**
- * Read a file from a supplied filename and return it.
- *
- * @access public
- * @param string $filename Parameter File Name
- */
- function getFile($filename) {
- $return = '';
- if ($fp = fopen($filename, 'rb')) {
- while (!feof($fp)) {
- $return .= fread($fp, 1024);
- }
- fclose($fp);
- return $return;
- } else {
- return false;
- }
- }
-
- /**
- * Strips newlines to prevent header injection.
- * @access private
- * @param string $str String
- * @return string
- */
- function SecureHeader($str) {
- $str = trim($str);
- $str = str_replace("\r", "", $str);
- $str = str_replace("\n", "", $str);
- return $str;
- }
-
- /**
- * Set the private key file and password to sign the message.
- *
- * @access public
- * @param string $key_filename Parameter File Name
- * @param string $key_pass Password for private key
- */
- function Sign($key_filename, $key_pass) {
- $this->sign_key_file = $key_filename;
- $this->sign_key_pass = $key_pass;
- }
-
-}
-
-?>
diff --git a/config/freeswitch_dev/class.smtp.tmp b/config/freeswitch_dev/class.smtp.tmp
deleted file mode 100755
index 398c3ffb..00000000
--- a/config/freeswitch_dev/class.smtp.tmp
+++ /dev/null
@@ -1,1062 +0,0 @@
-<?php
-/*~ class.smtp.php
-.---------------------------------------------------------------------------.
-| Software: PHPMailer - PHP email class |
-| Version: 2.0.2 |
-| Contact: via sourceforge.net support pages (also www.codeworxtech.com) |
-| Info: http://phpmailer.sourceforge.net |
-| Support: http://sourceforge.net/projects/phpmailer/ |
-| ------------------------------------------------------------------------- |
-| Author: Andy Prevost (project admininistrator) |
-| Author: Brent R. Matzelle (original founder) |
-| Copyright (c) 2004-2007, Andy Prevost. All Rights Reserved. |
-| Copyright (c) 2001-2003, Brent R. Matzelle |
-| ------------------------------------------------------------------------- |
-| License: Distributed under the Lesser General Public License (LGPL) |
-| http://www.gnu.org/copyleft/lesser.html |
-| This program is distributed in the hope that it will be useful - WITHOUT |
-| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
-| FITNESS FOR A PARTICULAR PURPOSE. |
-| ------------------------------------------------------------------------- |
-| We offer a number of paid services (www.codeworxtech.com): |
-| - Web Hosting on highly optimized fast and secure servers |
-| - Technology Consulting |
-| - Oursourcing (highly qualified programmers and graphic designers) |
-'---------------------------------------------------------------------------'
-
-/**
- * SMTP is rfc 821 compliant and implements all the rfc 821 SMTP
- * commands except TURN which will always return a not implemented
- * error. SMTP also provides some utility methods for sending mail
- * to an SMTP server.
- * @package PHPMailer
- * @author Chris Ryan
- */
-
-class SMTP
-{
- /**
- * SMTP server port
- * @var int
- */
- var $SMTP_PORT = 25;
-
- /**
- * SMTP reply line ending
- * @var string
- */
- var $CRLF = "\r\n";
-
- /**
- * Sets whether debugging is turned on
- * @var bool
- */
- var $do_debug; # the level of debug to perform
-
- /**
- * Sets VERP use on/off (default is off)
- * @var bool
- */
- var $do_verp = false;
-
- /**#@+
- * @access private
- */
- var $smtp_conn; # the socket to the server
- var $error; # error if any on the last call
- var $helo_rply; # the reply the server sent to us for HELO
- /**#@-*/
-
- /**
- * Initialize the class so that the data is in a known state.
- * @access public
- * @return void
- */
- function SMTP() {
- $this->smtp_conn = 0;
- $this->error = null;
- $this->helo_rply = null;
-
- $this->do_debug = 0;
- }
-
- /*************************************************************
- * CONNECTION FUNCTIONS *
- ***********************************************************/
-
- /**
- * Connect to the server specified on the port specified.
- * If the port is not specified use the default SMTP_PORT.
- * If tval is specified then a connection will try and be
- * established with the server for that number of seconds.
- * If tval is not specified the default is 30 seconds to
- * try on the connection.
- *
- * SMTP CODE SUCCESS: 220
- * SMTP CODE FAILURE: 421
- * @access public
- * @return bool
- */
- function Connect($host,$port=0,$tval=30) {
- # set the error val to null so there is no confusion
- $this->error = null;
-
- # make sure we are __not__ connected
- if($this->connected()) {
- # ok we are connected! what should we do?
- # for now we will just give an error saying we
- # are already connected
- $this->error = array("error" => "Already connected to a server");
- return false;
- }
-
- if(empty($port)) {
- $port = $this->SMTP_PORT;
- }
-
- #connect to the smtp server
- $this->smtp_conn = fsockopen($host, # the host of the server
- $port, # the port to use
- $errno, # error number if any
- $errstr, # error message if any
- $tval); # give up after ? secs
- # verify we connected properly
- if(empty($this->smtp_conn)) {
- $this->error = array("error" => "Failed to connect to server",
- "errno" => $errno,
- "errstr" => $errstr);
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": $errstr ($errno)" . $this->CRLF;
- }
- return false;
- }
-
- # sometimes the SMTP server takes a little longer to respond
- # so we will give it a longer timeout for the first read
- // Windows still does not have support for this timeout function
- if(substr(PHP_OS, 0, 3) != "WIN")
- socket_set_timeout($this->smtp_conn, $tval, 0);
-
- # get any announcement stuff
- $announce = $this->get_lines();
-
- # set the timeout of any socket functions at 1/10 of a second
- //if(function_exists("socket_set_timeout"))
- // socket_set_timeout($this->smtp_conn, 0, 100000);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $announce;
- }
-
- return true;
- }
-
- /**
- * Performs SMTP authentication. Must be run after running the
- * Hello() method. Returns true if successfully authenticated.
- * @access public
- * @return bool
- */
- function Authenticate($username, $password) {
- // Start authentication
- fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($code != 334) {
- $this->error =
- array("error" => "AUTH not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
-
- // Send encoded username
- fputs($this->smtp_conn, base64_encode($username) . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($code != 334) {
- $this->error =
- array("error" => "Username not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
-
- // Send encoded password
- fputs($this->smtp_conn, base64_encode($password) . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($code != 235) {
- $this->error =
- array("error" => "Password not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
-
- return true;
- }
-
- /**
- * Returns true if connected to a server otherwise false
- * @access private
- * @return bool
- */
- function Connected() {
- if(!empty($this->smtp_conn)) {
- $sock_status = socket_get_status($this->smtp_conn);
- if($sock_status["eof"]) {
- # hmm this is an odd situation... the socket is
- # valid but we are not connected anymore
- if($this->do_debug >= 1) {
- echo "SMTP -> NOTICE:" . $this->CRLF .
- "EOF caught while checking if connected";
- }
- $this->Close();
- return false;
- }
- return true; # everything looks good
- }
- return false;
- }
-
- /**
- * Closes the socket and cleans up the state of the class.
- * It is not considered good to use this function without
- * first trying to use QUIT.
- * @access public
- * @return void
- */
- function Close() {
- $this->error = null; # so there is no confusion
- $this->helo_rply = null;
- if(!empty($this->smtp_conn)) {
- # close the connection and cleanup
- fclose($this->smtp_conn);
- $this->smtp_conn = 0;
- }
- }
-
- /***************************************************************
- * SMTP COMMANDS *
- *************************************************************/
-
- /**
- * Issues a data command and sends the msg_data to the server
- * finializing the mail transaction. $msg_data is the message
- * that is to be send with the headers. Each header needs to be
- * on a single line followed by a <CRLF> with the message headers
- * and the message body being seperated by and additional <CRLF>.
- *
- * Implements rfc 821: DATA <CRLF>
- *
- * SMTP CODE INTERMEDIATE: 354
- * [data]
- * <CRLF>.<CRLF>
- * SMTP CODE SUCCESS: 250
- * SMTP CODE FAILURE: 552,554,451,452
- * SMTP CODE FAILURE: 451,554
- * SMTP CODE ERROR : 500,501,503,421
- * @access public
- * @return bool
- */
- function Data($msg_data) {
- $this->error = null; # so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Data() without being connected");
- return false;
- }
-
- fputs($this->smtp_conn,"DATA" . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 354) {
- $this->error =
- array("error" => "DATA command not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
-
- # the server is ready to accept data!
- # according to rfc 821 we should not send more than 1000
- # including the CRLF
- # characters on a single line so we will break the data up
- # into lines by \r and/or \n then if needed we will break
- # each of those into smaller lines to fit within the limit.
- # in addition we will be looking for lines that start with
- # a period '.' and append and additional period '.' to that
- # line. NOTE: this does not count towards are limit.
-
- # normalize the line breaks so we know the explode works
- $msg_data = str_replace("\r\n","\n",$msg_data);
- $msg_data = str_replace("\r","\n",$msg_data);
- $lines = explode("\n",$msg_data);
-
- # we need to find a good way to determine is headers are
- # in the msg_data or if it is a straight msg body
- # currently I am assuming rfc 822 definitions of msg headers
- # and if the first field of the first line (':' sperated)
- # does not contain a space then it _should_ be a header
- # and we can process all lines before a blank "" line as
- # headers.
- $field = substr($lines[0],0,strpos($lines[0],":"));
- $in_headers = false;
- if(!empty($field) && !strstr($field," ")) {
- $in_headers = true;
- }
-
- $max_line_length = 998; # used below; set here for ease in change
-
- while(list(,$line) = @each($lines)) {
- $lines_out = null;
- if($line == "" && $in_headers) {
- $in_headers = false;
- }
- # ok we need to break this line up into several
- # smaller lines
- while(strlen($line) > $max_line_length) {
- $pos = strrpos(substr($line,0,$max_line_length)," ");
-
- # Patch to fix DOS attack
- if(!$pos) {
- $pos = $max_line_length - 1;
- }
-
- $lines_out[] = substr($line,0,$pos);
- $line = substr($line,$pos + 1);
- # if we are processing headers we need to
- # add a LWSP-char to the front of the new line
- # rfc 822 on long msg headers
- if($in_headers) {
- $line = "\t" . $line;
- }
- }
- $lines_out[] = $line;
-
- # now send the lines to the server
- while(list(,$line_out) = @each($lines_out)) {
- if(strlen($line_out) > 0)
- {
- if(substr($line_out, 0, 1) == ".") {
- $line_out = "." . $line_out;
- }
- }
- fputs($this->smtp_conn,$line_out . $this->CRLF);
- }
- }
-
- # ok all the message data has been sent so lets get this
- # over with aleady
- fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 250) {
- $this->error =
- array("error" => "DATA not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
- return true;
- }
-
- /**
- * Expand takes the name and asks the server to list all the
- * people who are members of the _list_. Expand will return
- * back and array of the result or false if an error occurs.
- * Each value in the array returned has the format of:
- * [ <full-name> <sp> ] <path>
- * The definition of <path> is defined in rfc 821
- *
- * Implements rfc 821: EXPN <SP> <string> <CRLF>
- *
- * SMTP CODE SUCCESS: 250
- * SMTP CODE FAILURE: 550
- * SMTP CODE ERROR : 500,501,502,504,421
- * @access public
- * @return string array
- */
- function Expand($name) {
- $this->error = null; # so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Expand() without being connected");
- return false;
- }
-
- fputs($this->smtp_conn,"EXPN " . $name . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 250) {
- $this->error =
- array("error" => "EXPN not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
-
- # parse the reply and place in our array to return to user
- $entries = explode($this->CRLF,$rply);
- while(list(,$l) = @each($entries)) {
- $list[] = substr($l,4);
- }
-
- return $list;
- }
-
- /**
- * Sends the HELO command to the smtp server.
- * This makes sure that we and the server are in
- * the same known state.
- *
- * Implements from rfc 821: HELO <SP> <domain> <CRLF>
- *
- * SMTP CODE SUCCESS: 250
- * SMTP CODE ERROR : 500, 501, 504, 421
- * @access public
- * @return bool
- */
- function Hello($host="") {
- $this->error = null; # so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Hello() without being connected");
- return false;
- }
-
- # if a hostname for the HELO was not specified determine
- # a suitable one to send
- if(empty($host)) {
- # we need to determine some sort of appopiate default
- # to send to the server
- $host = "localhost";
- }
-
- // Send extended hello first (RFC 2821)
- if(!$this->SendHello("EHLO", $host))
- {
- if(!$this->SendHello("HELO", $host))
- return false;
- }
-
- return true;
- }
-
- /**
- * Sends a HELO/EHLO command.
- * @access private
- * @return bool
- */
- function SendHello($hello, $host) {
- fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER: " . $this->CRLF . $rply;
- }
-
- if($code != 250) {
- $this->error =
- array("error" => $hello . " not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
-
- $this->helo_rply = $rply;
-
- return true;
- }
-
- /**
- * Gets help information on the keyword specified. If the keyword
- * is not specified then returns generic help, ussually contianing
- * A list of keywords that help is available on. This function
- * returns the results back to the user. It is up to the user to
- * handle the returned data. If an error occurs then false is
- * returned with $this->error set appropiately.
- *
- * Implements rfc 821: HELP [ <SP> <string> ] <CRLF>
- *
- * SMTP CODE SUCCESS: 211,214
- * SMTP CODE ERROR : 500,501,502,504,421
- * @access public
- * @return string
- */
- function Help($keyword="") {
- $this->error = null; # to avoid confusion
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Help() without being connected");
- return false;
- }
-
- $extra = "";
- if(!empty($keyword)) {
- $extra = " " . $keyword;
- }
-
- fputs($this->smtp_conn,"HELP" . $extra . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 211 && $code != 214) {
- $this->error =
- array("error" => "HELP not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
-
- return $rply;
- }
-
- /**
- * Starts a mail transaction from the email address specified in
- * $from. Returns true if successful or false otherwise. If True
- * the mail transaction is started and then one or more Recipient
- * commands may be called followed by a Data command.
- *
- * Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF>
- *
- * SMTP CODE SUCCESS: 250
- * SMTP CODE SUCCESS: 552,451,452
- * SMTP CODE SUCCESS: 500,501,421
- * @access public
- * @return bool
- */
- function Mail($from) {
- $this->error = null; # so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Mail() without being connected");
- return false;
- }
-
- $useVerp = ($this->do_verp ? "XVERP" : "");
- fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $useVerp . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 250) {
- $this->error =
- array("error" => "MAIL not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
- return true;
- }
-
- /**
- * Sends the command NOOP to the SMTP server.
- *
- * Implements from rfc 821: NOOP <CRLF>
- *
- * SMTP CODE SUCCESS: 250
- * SMTP CODE ERROR : 500, 421
- * @access public
- * @return bool
- */
- function Noop() {
- $this->error = null; # so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Noop() without being connected");
- return false;
- }
-
- fputs($this->smtp_conn,"NOOP" . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 250) {
- $this->error =
- array("error" => "NOOP not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
- return true;
- }
-
- /**
- * Sends the quit command to the server and then closes the socket
- * if there is no error or the $close_on_error argument is true.
- *
- * Implements from rfc 821: QUIT <CRLF>
- *
- * SMTP CODE SUCCESS: 221
- * SMTP CODE ERROR : 500
- * @access public
- * @return bool
- */
- function Quit($close_on_error=true) {
- $this->error = null; # so there is no confusion
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Quit() without being connected");
- return false;
- }
-
- # send the quit command to the server
- fputs($this->smtp_conn,"quit" . $this->CRLF);
-
- # get any good-bye messages
- $byemsg = $this->get_lines();
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $byemsg;
- }
-
- $rval = true;
- $e = null;
-
- $code = substr($byemsg,0,3);
- if($code != 221) {
- # use e as a tmp var cause Close will overwrite $this->error
- $e = array("error" => "SMTP server rejected quit command",
- "smtp_code" => $code,
- "smtp_rply" => substr($byemsg,4));
- $rval = false;
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $e["error"] . ": " .
- $byemsg . $this->CRLF;
- }
- }
-
- if(empty($e) || $close_on_error) {
- $this->Close();
- }
-
- return $rval;
- }
-
- /**
- * Sends the command RCPT to the SMTP server with the TO: argument of $to.
- * Returns true if the recipient was accepted false if it was rejected.
- *
- * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
- *
- * SMTP CODE SUCCESS: 250,251
- * SMTP CODE FAILURE: 550,551,552,553,450,451,452
- * SMTP CODE ERROR : 500,501,503,421
- * @access public
- * @return bool
- */
- function Recipient($to) {
- $this->error = null; # so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Recipient() without being connected");
- return false;
- }
-
- fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 250 && $code != 251) {
- $this->error =
- array("error" => "RCPT not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
- return true;
- }
-
- /**
- * Sends the RSET command to abort and transaction that is
- * currently in progress. Returns true if successful false
- * otherwise.
- *
- * Implements rfc 821: RSET <CRLF>
- *
- * SMTP CODE SUCCESS: 250
- * SMTP CODE ERROR : 500,501,504,421
- * @access public
- * @return bool
- */
- function Reset() {
- $this->error = null; # so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Reset() without being connected");
- return false;
- }
-
- fputs($this->smtp_conn,"RSET" . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 250) {
- $this->error =
- array("error" => "RSET failed",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
-
- return true;
- }
-
- /**
- * Starts a mail transaction from the email address specified in
- * $from. Returns true if successful or false otherwise. If True
- * the mail transaction is started and then one or more Recipient
- * commands may be called followed by a Data command. This command
- * will send the message to the users terminal if they are logged
- * in.
- *
- * Implements rfc 821: SEND <SP> FROM:<reverse-path> <CRLF>
- *
- * SMTP CODE SUCCESS: 250
- * SMTP CODE SUCCESS: 552,451,452
- * SMTP CODE SUCCESS: 500,501,502,421
- * @access public
- * @return bool
- */
- function Send($from) {
- $this->error = null; # so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Send() without being connected");
- return false;
- }
-
- fputs($this->smtp_conn,"SEND FROM:" . $from . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 250) {
- $this->error =
- array("error" => "SEND not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
- return true;
- }
-
- /**
- * Starts a mail transaction from the email address specified in
- * $from. Returns true if successful or false otherwise. If True
- * the mail transaction is started and then one or more Recipient
- * commands may be called followed by a Data command. This command
- * will send the message to the users terminal if they are logged
- * in and send them an email.
- *
- * Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF>
- *
- * SMTP CODE SUCCESS: 250
- * SMTP CODE SUCCESS: 552,451,452
- * SMTP CODE SUCCESS: 500,501,502,421
- * @access public
- * @return bool
- */
- function SendAndMail($from) {
- $this->error = null; # so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called SendAndMail() without being connected");
- return false;
- }
-
- fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 250) {
- $this->error =
- array("error" => "SAML not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
- return true;
- }
-
- /**
- * Starts a mail transaction from the email address specified in
- * $from. Returns true if successful or false otherwise. If True
- * the mail transaction is started and then one or more Recipient
- * commands may be called followed by a Data command. This command
- * will send the message to the users terminal if they are logged
- * in or mail it to them if they are not.
- *
- * Implements rfc 821: SOML <SP> FROM:<reverse-path> <CRLF>
- *
- * SMTP CODE SUCCESS: 250
- * SMTP CODE SUCCESS: 552,451,452
- * SMTP CODE SUCCESS: 500,501,502,421
- * @access public
- * @return bool
- */
- function SendOrMail($from) {
- $this->error = null; # so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called SendOrMail() without being connected");
- return false;
- }
-
- fputs($this->smtp_conn,"SOML FROM:" . $from . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 250) {
- $this->error =
- array("error" => "SOML not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
- return true;
- }
-
- /**
- * This is an optional command for SMTP that this class does not
- * support. This method is here to make the RFC821 Definition
- * complete for this class and __may__ be implimented in the future
- *
- * Implements from rfc 821: TURN <CRLF>
- *
- * SMTP CODE SUCCESS: 250
- * SMTP CODE FAILURE: 502
- * SMTP CODE ERROR : 500, 503
- * @access public
- * @return bool
- */
- function Turn() {
- $this->error = array("error" => "This method, TURN, of the SMTP ".
- "is not implemented");
- if($this->do_debug >= 1) {
- echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF;
- }
- return false;
- }
-
- /**
- * Verifies that the name is recognized by the server.
- * Returns false if the name could not be verified otherwise
- * the response from the server is returned.
- *
- * Implements rfc 821: VRFY <SP> <string> <CRLF>
- *
- * SMTP CODE SUCCESS: 250,251
- * SMTP CODE FAILURE: 550,551,553
- * SMTP CODE ERROR : 500,501,502,421
- * @access public
- * @return int
- */
- function Verify($name) {
- $this->error = null; # so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Verify() without being connected");
- return false;
- }
-
- fputs($this->smtp_conn,"VRFY " . $name . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
- }
-
- if($code != 250 && $code != 251) {
- $this->error =
- array("error" => "VRFY failed on name '$name'",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] .
- ": " . $rply . $this->CRLF;
- }
- return false;
- }
- return $rply;
- }
-
- /*******************************************************************
- * INTERNAL FUNCTIONS *
- ******************************************************************/
-
- /**
- * Read in as many lines as possible
- * either before eof or socket timeout occurs on the operation.
- * With SMTP we can tell if we have more lines to read if the
- * 4th character is '-' symbol. If it is a space then we don't
- * need to read anything else.
- * @access private
- * @return string
- */
- function get_lines() {
- $data = "";
- while($str = @fgets($this->smtp_conn,515)) {
- if($this->do_debug >= 4) {
- echo "SMTP -> get_lines(): \$data was \"$data\"" .
- $this->CRLF;
- echo "SMTP -> get_lines(): \$str is \"$str\"" .
- $this->CRLF;
- }
- $data .= $str;
- if($this->do_debug >= 4) {
- echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF;
- }
- # if the 4th character is a space then we are done reading
- # so just break the loop
- if(substr($str,3,1) == " ") { break; }
- }
- return $data;
- }
-
-}
-
-
- ?>
diff --git a/config/freeswitch_dev/dialplan.default.xml b/config/freeswitch_dev/dialplan.default.xml
deleted file mode 100644
index 5fe1d4a4..00000000
--- a/config/freeswitch_dev/dialplan.default.xml
+++ /dev/null
@@ -1,717 +0,0 @@
-<!--
- NOTICE:
-
- This context is usually accessed via authenticated callers on the sip profile on port 5060
- or transfered callers from the public context which arrived via the sip profile on port 5080.
-
- Authenticated users will use the user_context variable on the user to determine what context
- they can access. You can also add a user in the directory with the cidr= attribute acl.conf.xml
- will build the domains acl using this value.
--->
-
-<?xml version="1.0" encoding="utf-8"?>
-<!-- http://wiki.freeswitch.org/wiki/Dialplan_XML -->
-<include>
- <context name="default">
-
- <extension name="unloop">
- <condition field="${unroll_loops}" expression="^true$"/>
- <condition field="${sip_looped_call}" expression="^true$">
- <action application="deflect" data="${destination_number}"/>
- </condition>
- </extension>
-
- <!-- Example of doing things based on time of day. -->
- <extension name="tod_example" continue="true">
- <!-- man strftime - M-F, 9AM to 6PM -->
- <condition field="${strftime(%w)}" expression="^([1-5])$"/>
- <condition field="${strftime(%H%M)}" expression="^((09|1[0-7])[0-5][0-9]|1800)$">
- <action application="set" data="open=true"/>
- </condition>
- </extension>
-
- <extension name="global-intercept">
- <condition field="destination_number" expression="^\*886$">
- <action application="answer"/>
- <action application="intercept" data="${db(select/${domain_name}-last_dial/global)}"/>
- <action application="sleep" data="2000"/>
- </condition>
- </extension>
-
- <extension name="group-intercept">
- <condition field="destination_number" expression="^\*8$">
- <action application="answer"/>
- <action application="intercept" data="${db(select/${domain_name}-last_dial/${callgroup})}"/>
- <action application="sleep" data="2000"/>
- </condition>
- </extension>
-
- <extension name="intercept-ext">
- <condition field="destination_number" expression="^\*\*(\d+)$">
- <action application="answer"/>
- <action application="intercept" data="${db(select/${domain_name}-last_dial_ext/$1)}"/>
- <action application="sleep" data="2000"/>
- </condition>
- </extension>
-
- <extension name="redial">
- <condition field="destination_number" expression="^\*870$">
- <action application="transfer" data="${db(select/${domain_name}-last_dial/${caller_id_number})}"/>
- </condition>
- </extension>
-
- <extension name="global" continue="true">
- <condition field="${network_addr}" expression="^$" break="never">
- <action application="set" data="use_profile=${cond(${acl($${local_ip_v4} rfc1918)} == true ? nat : default)}"/>
- <anti-action application="set" data="use_profile=${cond(${acl(${network_addr} rfc1918)} == true ? nat : default)}"/>
- </condition>
- <!-- This will setup some variables if the user isn't authenticated. -->
- <condition field="${numbering_plan}" expression="^$" break="never">
- <action application="set_user" data="default@${domain_name}"/>
- </condition>
- <condition field="${call_debug}" expression="^true$" break="never">
- <action application="info"/>
- </condition>
- <!--
- This is an example of how to auto detect if telephone-event is missing and activate inband detection
- -->
- <!--
- <condition field="${switch_r_sdp}" expression="a=rtpmap:(\d+)\stelephone-event/8000" break="never">
- <action application="set" data="rtp_payload_number=$1"/>
- <anti-action application="start_dtmf"/>
- </condition>
- -->
- <condition field="${sip_has_crypto}" expression="^(AES_CM_128_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_80)$" break="never">
- <action application="set" data="sip_secure_media=true"/>
- <!-- Offer SRTP on outbound legs if we have it on inbound. -->
- <!-- <action application="export" data="sip_secure_media=true"/> -->
- </condition>
- <condition>
- <action application="db" data="insert/${domain_name}-spymap/${caller_id_number}/${uuid}"/>
- <action application="db" data="insert/${domain_name}-last_dial/${caller_id_number}/${destination_number}"/>
- <action application="db" data="insert/${domain_name}-last_dial/global/${uuid}"/>
- </condition>
- </extension>
-
- <!-- If sip_req_host is not a local domain then this has to be an external sip uri -->
- <!--
- <extension name="external_sip_uri" continue="true">
- <condition field="source" expression="mod_sofia"/>
- <condition field="${outside_call}" expression="^$"/>
- <condition field="${domain_exists(${sip_req_host})}" expression="true">
- <anti-action application="bridge" data="sofia/${use_profile}/${sip_to_uri}"/>
- </condition>
- </extension>
- -->
- <!--
- snom button demo, call 9000 to make button 2 mapped to transfer the current call to a conference
- -->
-
- <extension name="snom-demo-2">
- <condition field="destination_number" expression="^\*9001$">
- <action application="eval" data="${snom_bind_key(2 off DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message notused)}"/>
- <action application="transfer" data="3000"/>
- </condition>
- </extension>
-
- <extension name="snom-demo-1">
- <condition field="destination_number" expression="^\*9000$">
- <!--<key> <light> <label> <user> <host> <profile> <action_name> <action>-->
- <action application="eval" data="${snom_bind_key(2 on DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message api+uuid_transfer ${uuid} 9001)}"/>
- <action application="playback" data="$${hold_music}"/>
- </condition>
- </extension>
-
- <extension name="eavesdrop">
- <condition field="destination_number" expression="^\*88(.*)$|^\*0(.*)$">
- <action application="answer"/>
- <action application="eavesdrop" data="${db(select/${domain_name}-spymap/$1)}"/>
- </condition>
- </extension>
-
- <extension name="eavesdrop">
- <condition field="destination_number" expression="^\*779$">
- <action application="answer"/>
- <action application="set" data="eavesdrop_indicate_failed=tone_stream://%(500, 0, 320)"/>
- <action application="set" data="eavesdrop_indicate_new=tone_stream://%(500, 0, 620)"/>
- <action application="set" data="eavesdrop_indicate_idle=tone_stream://%(250, 0, 920)"/>
- <action application="eavesdrop" data="all"/>
- </condition>
- </extension>
-
- <extension name="call_return">
- <condition field="destination_number" expression="^\*69$|^869$|^lcr$">
- <action application="transfer" data="${db(select/${domain_name}-call_return/${caller_id_number})}"/>
- </condition>
- </extension>
-
- <extension name="del-group">
- <condition field="destination_number" expression="^\*80(\d{2})$">
- <action application="answer"/>
- <action application="group" data="delete:$1@${domain_name}:${sofia_contact(${sip_from_user}@${domain_name})}"/>
- <action application="gentones" data="%(1000, 0, 320)"/>
- </condition>
- </extension>
-
- <extension name="add-group">
- <condition field="destination_number" expression="^\*81(\d{2})$">
- <action application="answer"/>
- <action application="group" data="insert:$1@${domain_name}:${sofia_contact(${sip_from_user}@${domain_name})}"/>
- <action application="gentones" data="%(1000, 0, 640)"/>
- </condition>
- </extension>
-
- <extension name="call-group-simo">
- <condition field="destination_number" expression="^\*82(\d{2})$">
- <action application="bridge" data="{ignore_early_media=true}${group(call:$1@${domain_name})}"/>
- </condition>
- </extension>
-
- <extension name="call-group-order">
- <condition field="destination_number" expression="^\*83(\d{2})$">
- <action application="set" data="call_timeout=10"/>
- <action application="bridge" data="{ignore_early_media=true}${group(call:$1@${domain_name}:order)}"/>
- </condition>
- </extension>
-
- <extension name="extension-intercom">
- <condition field="destination_number" expression="^\*8(10[01][0-9])$">
- <action application="set" data="dialed_extension=$1"/>
- <action application="export" data="sip_auto_answer=true"/>
- <action application="bridge" data="user/${dialed_extension}@${domain_name}"/>
- </condition>
- </extension>
-
- <X-PRE-PROCESS cmd="include" data="default/*.xml"/>
-
- <!--
- dial the extension 3, 4, or 5 digit extensions for 30 seconds and go to voicemail if the
- call fails (continue_on_fail=true), otherwise hang up after a successful
- bridge (hangup_after-bridge=true)
- -->
- <extension name="Local_Extension">
- <condition field="destination_number" expression="(^\d{5}$|^\d{4}$|^\d{3}$)">
- <action application="set" data="dialed_extension=$1"/>
- <action application="export" data="dialed_extension=$1"/>
- <!-- bind_meta_app can have these args <key> [a|b|ab] [a|b|o|s] <app> -->
- <action application="bind_meta_app" data="1 b s execute_extension::dx XML features"/>
- <action application="bind_meta_app" data="2 b s record_session::$${base_dir}/recordings/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>
- <action application="bind_meta_app" data="3 b s execute_extension::cf XML features"/>
- <action application="set" data="ringback=${us-ring}"/>
- <action application="set" data="transfer_ringback=$${hold_music}"/>
- <action application="set" data="call_timeout=30"/>
- <!-- <action application="set" data="sip_exclude_contact=${network_addr}"/> -->
- <action application="set" data="hangup_after_bridge=true"/>
- <!--<action application="set" data="continue_on_fail=NORMAL_TEMPORARY_FAILURE,USER_BUSY,NO_ANSWER,TIMEOUT,NO_ROUTE_DESTINATION"/> -->
- <action application="set" data="continue_on_fail=true"/>
- <action application="db" data="insert/${domain_name}-call_return/${dialed_extension}/${caller_id_number}"/>
- <action application="db" data="insert/${domain_name}-last_dial_ext/${dialed_extension}/${uuid}"/>
- <action application="set" data="called_party_callgroup=${user_data(${dialed_extension}@${domain_name} var callgroup)}"/>
- <!--<action application="export" data="nolocal:sip_secure_media=${user_data(${dialed_extension}@${domain_name} var sip_secure_media)}"/>-->
- <action application="db" data="insert/${domain_name}-last_dial/${called_party_callgroup}/${uuid}"/>
- <action application="bridge" data="user/${dialed_extension}@${domain_name}"/>
- <action application="answer"/>
- <action application="sleep" data="1000"/>
- <action application="voicemail" data="default ${domain_name} ${dialed_extension}"/>
- </condition>
- </extension>
-
- <extension name="group_dial_sales">
- <condition field="destination_number" expression="^\*2000$">
- <action application="bridge" data="${group_call(sales@${domain_name})}"/>
- </condition>
- </extension>
-
- <extension name="group_dial_support">
- <condition field="destination_number" expression="^\*2001$">
- <action application="bridge" data="group/support@${domain_name}"/>
- </condition>
- </extension>
-
- <extension name="group_dial_billing">
- <condition field="destination_number" expression="^\*2002$">
- <action application="bridge" data="group/billing@${domain_name}"/>
- </condition>
- </extension>
-
- <!-- voicemail operator extension -->
- <extension name="operator">
- <condition field="destination_number" expression="^operator$|^0$">
- <action application="set" data="transfer_ringback=$${hold_music}"/>
- <action application="transfer" data="1000 XML features"/>
- </condition>
- </extension>
-
- <!-- voicemail main2 extension -->
- <extension name="vmain2">
- <condition field="destination_number" expression="^vmain2$|^\*97$|^\*4000$">
- <action application="answer"/>
- <action application="sleep" data="1000"/>
- <action application="voicemail" data="check default ${domain_name}"/>
- </condition>
- </extension>
-
- <!-- voicemail main extension -->
- <extension name="vmain">
- <condition field="destination_number" expression="^vmain$|^\*98$">
- <action application="answer"/>
- <action application="sleep" data="1000"/>
- <action application="voicemail" data="check default ${domain_name} ${sip_from_user}"/>
- </condition>
- </extension>
-
- <extension name="send_to_voicemail_5digits">
- <condition field="destination_number" expression="^\*99(\d{5})$">
- <action application="answer"/>
- <action application="sleep" data="1000"/>
- <action application="set" data="dialed_extension=$1"/>
- <action application="export" data="dialed_extension=$1"/>
- <action application="voicemail" data="default ${domain_name} ${dialed_extension}"/>
- </condition>
- </extension>
-
- <extension name="send_to_voicemail_4digits">
- <condition field="destination_number" expression="^\*99(\d{4})$">
- <action application="answer"/>
- <action application="sleep" data="1000"/>
- <action application="set" data="dialed_extension=$1"/>
- <action application="export" data="dialed_extension=$1"/>
- <action application="voicemail" data="default ${domain_name} ${dialed_extension}"/>
- </condition>
- </extension>
-
- <extension name="send_to_voicemail_3digits">
- <condition field="destination_number" expression="^\*99(\d{3})$">
- <action application="answer"/>
- <action application="sleep" data="1000"/>
- <action application="set" data="dialed_extension=$1"/>
- <action application="export" data="dialed_extension=$1"/>
- <action application="voicemail" data="default ${domain_name} ${dialed_extension}"/>
- </condition>
- </extension>
-
- <!-- dial via SIP uri -->
- <extension name="sip_uri">
- <condition field="destination_number" expression="^sip:(.*)$">
- <action application="bridge" data="sofia/${use_profile}/$1"/>
- </condition>
- </extension>
-
- <!--
- start a dynamic conference with the settings of the "default" conference profile in conference.conf.xml
- -->
- <extension name="nb_conferences">
- <condition field="destination_number" expression="^\*(30\d{2})$">
- <action application="answer"/>
- <action application="conference" data="$1-${domain_name}@default"/>
- </condition>
- </extension>
-
- <extension name="wb_conferences">
- <condition field="destination_number" expression="^\*(31\d{2})$">
- <action application="answer"/>
- <action application="conference" data="$1-${domain_name}@wideband"/>
- </condition>
- </extension>
-
- <extension name="uwb_conferences">
- <condition field="destination_number" expression="^\*(32\d{2})$">
- <action application="answer"/>
- <action application="conference" data="$1-${domain_name}@ultrawideband"/>
- </condition>
- </extension>
- <!-- MONO 48kHz conferences -->
- <extension name="cdquality_conferences">
- <condition field="destination_number" expression="^\*(33\d{2})$">
- <action application="answer"/>
- <action application="conference" data="$1-${domain_name}@cdquality"/>
- </condition>
- </extension>
-
- <!-- dial the freeswitch conference via SIP-->
- <extension name="freeswitch_public_conf_via_sip">
- <condition field="destination_number" expression="^\*9(888|1616|3232)$">
- <action application="export" data="hold_music=silence"/>
- <action application="bridge" data="sofia/${use_profile}/$1@conference.freeswitch.org"/>
- </condition>
- </extension>
-
- <!--
- This extension will start a conference and invite a group.
- At anytime the participant can dial *2 to bridge directly to the boss.
- All other callers are then hung up on.
- -->
- <extension name="mad_boss_intercom">
- <condition field="destination_number" expression="^\*0911$">
- <action application="set" data="conference_auto_outcall_caller_id_name=Mad Boss1"/>
- <action application="set" data="conference_auto_outcall_caller_id_number=0911"/>
- <action application="set" data="conference_auto_outcall_timeout=60"/>
- <action application="set" data="conference_auto_outcall_flags=mute"/>
- <action application="set" data="conference_auto_outcall_prefix={sip_auto_answer=true,execute_on_answer='bind_meta_app 2 a s1 transfer::intercept:${uuid} inline'}"/>
- <action application="set" data="sip_exclude_contact=${network_addr}"/>
- <action application="conference_set_auto_outcall" data="${group_call(sales)}"/>
- <action application="conference" data="madboss_intercom1@default+flags{endconf|deaf}"/>
- </condition>
- </extension>
-
- <!--
- This extension will start a conference and invite a few of people.
- At anytime the participant can dial *2 to bridge directly to the boss.
- All other callers are then hung up on.
- -->
- <extension name="mad_boss_intercom">
- <condition field="destination_number" expression="^\*0912$">
- <action application="set" data="conference_auto_outcall_caller_id_name=Mad Boss2"/>
- <action application="set" data="conference_auto_outcall_caller_id_number=0912"/>
- <action application="set" data="conference_auto_outcall_timeout=60"/>
- <action application="set" data="conference_auto_outcall_flags=mute"/>
- <action application="set" data="conference_auto_outcall_prefix={sip_auto_answer=true,execute_on_answer='bind_meta_app 2 a s1 transfer::intercept:${uuid} inline'}"/>
- <action application="set" data="sip_exclude_contact=${network_addr}"/>
- <action application="conference_set_auto_outcall" data="loopback/9999"/>
- <action application="conference" data="madboss_intercom2@default+flags{endconf|deaf}"/>
- </condition>
- </extension>
-
- <!--This extension will start a conference and invite several people upon entering -->
- <extension name="mad_boss">
- <condition field="destination_number" expression="^\*0913$">
- <!--These params effect the outcalls made once you join-->
- <action application="set" data="conference_auto_outcall_caller_id_name=Mad Boss"/>
- <action application="set" data="conference_auto_outcall_caller_id_number=0911"/>
- <action application="set" data="conference_auto_outcall_timeout=60"/>
- <action application="set" data="conference_auto_outcall_flags=none"/>
- <!--<action application="set" data="conference_auto_outcall_announce=say:You have been called into an emergency conference"/>-->
- <!--Add as many of these as you need, These are the people you are going to call-->
- <action application="conference_set_auto_outcall" data="loopback/9999"/>
- <action application="conference" data="madboss3@default"/>
- </condition>
- </extension>
-
- <!-- a sample IVR -->
- <extension name="ivr_demo">
- <condition field="destination_number" expression="^\*5000$">
- <action application="answer"/>
- <action application="sleep" data="2000"/>
- <action application="ivr" data="demo_ivr"/>
- </condition>
- </extension>
-
- <!-- Create a conference on the fly and pull someone in at the same time. -->
- <extension name="dynamic_conference">
- <condition field="destination_number" expression="^\*5001$">
- <action application="conference" data="bridge:mydynaconf:sofia/${use_profile}/1234@conference.freeswitch.org"/>
- </condition>
- </extension>
-
- <extension name="rtp_multicast_page">
- <condition field="destination_number" expression="^\*pagegroup$|^\*7243">
- <action application="answer"/>
- <action application="esf_page_group"/>
- </condition>
- </extension>
-
- <!--
- Parking extensions... transferring calls to 5900 will park them in a queue.
- -->
- <extension name="park">
- <condition field="destination_number" expression="^\*5900$">
- <action application="set" data="fifo_music=$${hold_music}"/>
- <action application="fifo" data="5900@${domain_name} in"/>
- </condition>
- </extension>
-
- <!--
- Parking pickup extension. Calling 5901 will pickup the call.
- -->
- <extension name="unpark">
- <condition field="destination_number" expression="^\*5901$">
- <action application="answer"/>
- <action application="fifo" data="5900@${domain_name} out nowait"/>
- </condition>
- </extension>
-
- <!--
- This extension is used with snom phones.
-
- Set a function key to park+lot (lot being a number or name.)
- Set type to Park+Orbit. You can then park and pickup using
- the softkey on the phone. Should work with other phones.
- -->
- <extension name="park">
- <condition field="source" expression="mod_sofia"/>
- <condition field="destination_number" expression="park\+(\d+)">
- <action application="fifo" data="$1@${domain_name} in undef $${hold_music}"/>
- </condition>
- </extension>
- <!--
- The extension is parking pickup with a to param of the fifo we are calling
- Some phones send things like orbit= and you can extract that info.
- -->
- <extension name="unpark">
- <condition field="source" expression="mod_sofia"/>
- <condition field="destination_number" expression="^parking$"/>
- <condition field="${sip_to_params}" expression="fifo\=(\d+)">
- <action application="answer"/>
- <action application="fifo" data="$1@${domain_name} out nowait"/>
- </condition>
- </extension>
-
- <!--
- This extension is used with linksys phones.
-
- Set a Phone tab option Call Park Serv to yes. You can park and
- pickup using soft keys "park" and "unpark" found during
- active call when moving navigation button. The other option
- is to use phone's star codes (defaults to *38 and *39).
- -->
- <extension name="park">
- <condition field="source" expression="mod_sofia"/>
- <condition field="destination_number" expression="callpark"/>
- <condition field="${sip_refer_to}">
- <expression><![CDATA[<sip:callpark@${domain_name};orbit=(\d+)>]]></expression>
- <action application="fifo" data="$1@${domain_name} in undef $${hold_music}"/>
- </condition>
- </extension>
-
- <!--
- This extension is used with linksys phones.
-
- The extension is parking pickup with a to param of the fifo
- we are calling. Linksys sends orbit=<parkingslotnumber>
- and we extract that info.
- -->
- <extension name="unpark">
- <condition field="source" expression="mod_sofia"/>
- <condition field="destination_number" expression="pickup"/>
- <condition field="${sip_to_params}" expression="orbit\=(\d+)">
- <action application="answer"/>
- <action application="fifo" data="$1@${domain_name} out nowait"/>
- </condition>
- </extension>
-
- <!--
- Here are some examples of how to override the ringback heard by the
- far end. You have two variables that you can use to override this.
-
- ringback - used when a call isn't answered. (early media)
- transfer_ringback - used when the call is already answered. (post answer)
- -->
-
- <!-- Demonstration of how to override the ringback in various situations -->
- <extension name="wait">
- <condition field="destination_number" expression="^wait$">
- <action application="pre_answer"/>
- <action application="sleep" data="20000"/>
- <action application="answer"/>
- <action application="sleep" data="1000"/>
- <action application="playback" data="voicemail/vm-goodbye.wav"/>
- <action application="hangup"/>
- </condition>
- </extension>
-
- <extension name="fax_receive">
- <condition field="destination_number" expression="^\*9978$">
- <action application="answer" />
- <action application="playback" data="silence_stream://2000"/>
- <action application="rxfax" data="/tmp/rxfax.tif"/>
- <action application="hangup"/>
- </condition>
- </extension>
-
- <extension name="fax_transmit">
- <condition field="destination_number" expression="^\*9979$">
- <action application="txfax" data="/tmp/txfax.tif"/>
- <action application="hangup"/>
- </condition>
- </extension>
-
- <!-- Send a 180 and let the far end generate ringback. -->
- <extension name="ringback_180">
- <condition field="destination_number" expression="^\*9980$">
- <action application="ring_ready"/>
- <action application="sleep" data="20000"/>
- <action application="answer"/>
- <action application="sleep" data="1000"/>
- <action application="playback" data="voicemail/vm-goodbye.wav"/>
- <action application="hangup"/>
- </condition>
- </extension>
-
- <!-- Send a 183 and send uk-ring as the ringtone. (early media) -->
- <extension name="ringback_183_uk_ring">
- <condition field="destination_number" expression="^\*9981$">
- <action application="set" data="ringback=$${uk-ring}"/>
- <action application="bridge" data="loopback/wait"/>
- </condition>
- </extension>
-
- <!-- Send a 183 and use music as the ringtone. (early media) -->
- <extension name="ringback_183_music_ring">
- <condition field="destination_number" expression="^\*9982$">
- <action application="set" data="ringback=$${hold_music}"/>
- <action application="bridge" data="loopback/wait"/>
- </condition>
- </extension>
-
- <!-- Answer the call and use music as the ringtone. (post answer) -->
- <extension name="ringback_post_answer_uk_ring">
- <condition field="destination_number" expression="^\*9983$">
- <action application="set" data="transfer_ringback=$${uk-ring}"/>
- <action application="answer"/>
- <action application="bridge" data="loopback/wait"/>
- </condition>
- </extension>
-
- <!-- Answer the call and use music as the ringtone. (post answer) -->
- <extension name="ringback_post_answer_music">
- <condition field="destination_number" expression="^\*9984$">
- <action application="set" data="transfer_ringback=$${hold_music}"/>
- <action application="answer"/>
- <action application="bridge" data="loopback/wait"/>
- </condition>
- </extension>
-
- <extension name="ClueCon">
- <condition field="destination_number" expression="^\*9991$">
- <action application="set" data="effective_caller_id_name=ClueCon"/>
- <action application="bridge" data="sofia/$${domain}/brian@bkw.org"/>
- </condition>
- </extension>
-
- <extension name="show_info">
- <condition field="destination_number" expression="^\*9992$">
- <action application="answer"/>
- <action application="info"/>
- <action application="sleep" data="250"/>
- <action application="hangup"/>
- </condition>
- </extension>
-
- <extension name="video_record">
- <condition field="destination_number" expression="^\*9993$">
- <action application="answer"/>
- <action application="record_fsv" data="/tmp/testrecord.fsv"/>
- </condition>
- </extension>
-
- <extension name="video_playback">
- <condition field="destination_number" expression="^\*9994$">
- <action application="answer"/>
- <action application="play_fsv" data="/tmp/testrecord.fsv"/>
- </condition>
- </extension>
-
- <extension name="delay_echo">
- <condition field="destination_number" expression="^\*9995$">
- <action application="answer"/>
- <action application="delay_echo" data="5000"/>
- </condition>
- </extension>
-
- <extension name="echo">
- <condition field="destination_number" expression="^\*9996$">
- <action application="answer"/>
- <action application="echo"/>
- </condition>
- </extension>
-
- <extension name="milliwatt">
- <condition field="destination_number" expression="^\*9997$">
- <action application="answer"/>
- <action application="playback" data="tone_stream://%(10000,0,1004);loops=-1"/>
- </condition>
- </extension>
-
- <extension name="tone_stream">
- <condition field="destination_number" expression="^\*9998$">
- <action application="answer"/>
- <action application="playback" data="tone_stream://path=${base_dir}/conf/tetris.ttml;loops=10"/>
- </condition>
- </extension>
-
- <!-- install zrtp_agent.lua into scripts (ZRTP == 9787) -->
- <extension name="zrtp_enrollement">
- <condition field="destination_number" expression="^9787$">
- <action application="answer"/>
- <action application="lua" data="zrtp_agent.lua"/>
- </condition>
- </extension>
-
- <!--
- You will no longer hear the bong tone. The wav file is playing stating the call is secure.
- The file will not play unless you have both TLS and SRTP active.
- -->
-
- <extension name="hold_music">
- <condition field="destination_number" expression="^\*9999$"/>
- <condition field="${sip_has_crypto}" expression="^(AES_CM_128_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_80)$">
- <action application="answer"/>
- <action application="execute_extension" data="is_secure XML features"/>
- <action application="playback" data="$${hold_music}"/>
- <anti-action application="set" data="zrtp_secure_media=true"/>
- <anti-action application="answer"/>
- <anti-action application="playback" data="silence_stream://2000"/>
- <anti-action application="execute_extension" data="is_zrtp_secure XML features"/>
- <anti-action application="playback" data="$${hold_music}"/>
- </condition>
- </extension>
-
- <!--
- You can place files in the default directory to get included.
- -->
- <!--<X-PRE-PROCESS cmd="include" data="default/*.xml"/>-->
-
- <!--
- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
-
- Anything you put below this line will usually get ignored due to the file in
- default/99999_enum.xml as it will transfer the call to the enum dialplan.
-
- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
- -->
-
- <extension name="enum">
- <condition field="${module_exists(mod_enum)}" expression="true"/>
- <condition field="destination_number" expression="^(.*)$">
- <action application="transfer" data="$1 enum"/>
- </condition>
- </extension>
-
- <!--
- <extension name="refer">
- <condition field="${sip_refer_to}">
- <expression><![CDATA[<sip:${destination_number}@${domain_name}>]]></expression>
- </condition>
- <condition field="${sip_refer_to}">
- <expression><![CDATA[<sip:(.*)@(.*)>]]></expression>
- <action application="set" data="refer_user=$1"/>
- <action application="set" data="refer_domain=$2"/>
- <action application="info"/>
- <action application="bridge" data="sofia/${use_profile}/${refer_user}@${refer_domain}"/>
- </condition>
- </extension>
- -->
- <!--
- This is an example of how to override the RURI on an outgoing invite to a registered contact.
- -->
- <!--
- <extension name="ruri">
- <condition field="destination_number" expression="^ruri$">
- <action application="bridge" data="sofia/${ruri_profile}/${ruri_user}${regex(${sofia_contact(${ruri_contact})}|^[^\@]+(.*)|%1)}"/>
- </condition>
- </extension>
-
- <extension name="7004">
- <condition field="destination_number" expression="^\*7004$">
- <action application="set" data="ruri_profile=default"/>
- <action application="set" data="ruri_user=2000"/>
- <action application="set" data="ruri_contact=1001@${domain_name}"/>
- <action application="execute_extension" data="ruri"/>
- </condition>
- </extension>
- -->
-
- <!-- SEE WARNING ABOVE IF YOU ARE TRYING TO ADD EXTENSIONS HERE! -->
-
- </context>
-</include>
diff --git a/config/freeswitch_dev/dialplan.public.xml b/config/freeswitch_dev/dialplan.public.xml
deleted file mode 100644
index f30227e0..00000000
--- a/config/freeswitch_dev/dialplan.public.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<!--
- NOTICE:
-
- This context is usually accessed via the external sip profile sitting on port 5080.
-
- It is recommended to have separate inbound and outbound contexts. Not only for security
- but clearing up why you would need to do such a thing. You don't want outside un-authenticated
- callers hitting your default context which allows dialing calls thru your providers and results
- in Toll Fraud.
--->
-
-<!-- http://wiki.freeswitch.org/wiki/Dialplan_XML -->
-<include>
- <context name="public">
-
- <extension name="unloop">
- <condition field="${unroll_loops}" expression="^true$"/>
- <condition field="${sip_looped_call}" expression="^true$">
- <action application="deflect" data="${destination_number}"/>
- </condition>
- </extension>
- <!--
- Tag anything pass thru here as an outside_call so you can make sure not
- to create any routing loops based on the conditions that it came from
- the outside of the switch.
- -->
- <extension name="outside_call" continue="true">
- <condition>
- <action application="set" data="outside_call=true"/>
- </condition>
- </extension>
-
- <extension name="call_debug" continue="true">
- <condition field="${call_debug}" expression="^true$" break="never">
- <action application="info"/>
- </condition>
- </extension>
-
- <!--
- <extension name="public_extensions">
- <condition field="destination_number" expression="^(10[01][0-9])$">
- <action application="transfer" data="$1 XML default"/>
- </condition>
- </extension>
- -->
-
- <!--
- You can place files in the public directory to get included.
- -->
- <X-PRE-PROCESS cmd="include" data="public/*.xml"/>
- <!--
- If you have made it this far lets challenge the caller and if they authenticate
- lets try what they dialed in the default context. (commented out by default)
- -->
- <!--
- <extension name="check_auth" continue="true">
- <condition field="${sip_authorized}" expression="^true$" break="never">
- <anti-action application="respond" data="407"/>
- </condition>
- </extension>
-
- <extension name="transfer_to_default">
- <condition>
- <action application="transfer" data="${destination_number} XML default"/>
- </condition>
- </extension>
- -->
- </context>
-</include>
diff --git a/config/freeswitch_dev/disa.js b/config/freeswitch_dev/disa.js
deleted file mode 100644
index f705b79c..00000000
--- a/config/freeswitch_dev/disa.js
+++ /dev/null
@@ -1,78 +0,0 @@
-include("/usr/local/freeswitch/scripts/config.js");
-
- //var admin_pin = ""; //don't require a pin
- //if you choose not to require a pin then then you may want to add a dialplan condition for a specific caller id
- var predefined_destination = ""; //example: 9999
- //predefined_destination leave empty in most cases
- //Use this to define a single destination
- var digitmaxlength = 0;
- var timeoutpin = 7500;
- var timeouttransfer = 7500;
-
- function mycb( session, type, obj, arg ) {
- try {
- if ( type == "dtmf" ) {
- console_log( "info", "digit: "+obj.digit+"\n" );
- if ( obj.digit == "#" ) {
- //console_log( "info", "detected pound sign.\n" );
- exit = true;
- return( false );
- }
-
- dtmf.digits += obj.digit;
-
- if ( dtmf.digits.length >= digitmaxlength ) {
- exit = true;
- return( false );
- }
- }
- } catch (e) {
- console_log( "err", e+"\n" );
- }
- return( true );
- } //end function mycb
-
-
- //console_log( "info", "DISA Request\n" );
-
- var dtmf = new Object( );
- dtmf.digits = "";
-
- if ( session.ready( ) ) {
- session.answer( );
-
- if (admin_pin.length > 0) {
- digitmaxlength = 6;
- session.streamFile( "/usr/local/freeswitch/sounds/custom/8000/please_enter_the_pin_number.wav", mycb, "dtmf");
- session.collectInput( mycb, dtmf, timeoutpin );
- //console_log( "info", "DISA pin: " + dtmf.digits + "\n" );
- }
-
- if (dtmf.digits == admin_pin || admin_pin.length == 0) {
-
- //console_log( "info", "DISA pin is correct\n" );
-
- us_ring = session.getVariable("us-ring");
- session.execute("set", "ringback="+us_ring); //set to ringtone
- session.execute("set", "transfer_ringback="+us_ring); //set to ringtone
- session.execute("set", "hangup_after_bridge=true");
-
- if (predefined_destination.length == 0) {
- dtmf.digits = ""; //clear dtmf digits to prepare for next dtmf request
- digitmaxlength = 11;
- session.streamFile( "/usr/local/freeswitch/sounds/custom/8000/please_enter_the_phone_number.wav", mycb, "dtmf");
- session.collectInput( mycb, dtmf, timeouttransfer );
- console_log( "info", "DISA Transfer: " + dtmf.digits + "\n" );
- session.execute("transfer", dtmf.digits + " XML default");
- }
- else {
- session.execute("transfer", predefined_destination + " XML default");
- }
-
- }
- else {
- session.streamFile( "/usr/local/freeswitch/sounds/custom/8000/your_pin_number_is_incorect_goodbye.wav", mycb, "dtmf");
- console_log( "info", "DISA Pin: " + dtmf.digits + " is incorrect\n" );
- }
-
- }
diff --git a/config/freeswitch_dev/fax_to_email.tmp b/config/freeswitch_dev/fax_to_email.tmp
deleted file mode 100644
index fcd6af06..00000000
--- a/config/freeswitch_dev/fax_to_email.tmp
+++ /dev/null
@@ -1,182 +0,0 @@
-<?php
-/* $Id$ */
-/*
- fax_to_email.php
- Copyright (C) 2008 Mark J Crane
- All rights reserved.
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-
- 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.
-*/
-
-require_once("/etc/inc/config.inc");
-require_once("/usr/local/pkg/freeswitch.inc");
-global $config;
-
-ob_end_clean();
-ob_start();
-
-echo "\n---------------------------------\n";
-
-
-$phpversion = substr(phpversion(), 0, 1);
-if ($phpversion == '4') {
- $faxemail = $_REQUEST["email"];
- $faxextension = $_REQUEST["extension"];
- $faxname = $_REQUEST["name"];
-}
-else {
- $tmparray = explode("=", $_SERVER["argv"][1]);
- $faxemail = $tmparray[1];
- unset($tmparray);
-
- $tmparray = explode("=", $_SERVER["argv"][2]);
- $faxextension = $tmparray[1];
- unset($tmparray);
-
- $tmparray = explode("=", $_SERVER["argv"][3]);
- $faxname = $tmparray[1];
- unset($tmparray);
-}
-
-//echo "faxemail $faxemail\n";
-//echo "faxextension $faxextension\n";
-//echo "faxname $faxname\n";
-//echo "cd $dir_fax; /usr/local/bin/tiff2png ".$dir_fax.$faxname.".png\n";
-
-
-$dir_fax = '/usr/local/freeswitch/storage/fax/'.$faxextension.'/inbox/';
-
-
-if (!file_exists($dir_fax.$faxname.".png")) {
- //cd /usr/local/freeswitch/storage/fax/9975/inbox/;/usr/local/bin/tiff2png /usr/local/freeswitch/storage/fax/9975/inbox/1001-2009-06-06-01-15-11.tif
- //echo "cd $dir_fax; /usr/local/bin/tiff2png ".$dir_fax.$faxname.".tif\n";
- exec("cd $dir_fax; /usr/local/bin/tiff2png ".$dir_fax.$faxname.".tif");
-}
-
-if (!file_exists($dir_fax.$faxname.".pdf")) {
- //echo "cd $dir_fax; /usr/local/bin/tiff2pdf -f -o ".$faxname.".pdf ".$dir_fax.$faxname.".tif\n";
- exec("cd $dir_fax; /usr/local/bin/tiff2pdf -f -o ".$faxname.".pdf ".$dir_fax.$faxname.".tif");
-}
-
-
-$tmp_subject = "Fax Received: ".$faxname;
-$tmp_textplain = "\nFax Received:\n";
-$tmp_textplain .= "Name: ".$faxname."\n";
-$tmp_textplain .= "Extension: ".$faxextension."\n";
-$tmp_texthtml = $tmp_textplain;
-
-
-$tmp_smtphost = $config['installedpackages']['freeswitchsettings']['config'][0]['smtphost'];
-$tmp_smtpsecure = $config['installedpackages']['freeswitchsettings']['config'][0]['smtpsecure']; //options "", "TLS", "SSL"
-$tmp_smtpsecure = strtolower($tmp_smtpsecure);
-$tmp_smtpauth = $config['installedpackages']['freeswitchsettings']['config'][0]['smtpauth']; // SMTP authentication: true or false
-$tmp_smtpusername = $config['installedpackages']['freeswitchsettings']['config'][0]['smtpusername'];
-$tmp_smtppassword = $config['installedpackages']['freeswitchsettings']['config'][0]['smtppassword'];
-$tmp_smtpfrom = $config['installedpackages']['freeswitchsettings']['config'][0]['smtpfrom'];
-$tmp_smtpfromname = $config['installedpackages']['freeswitchsettings']['config'][0]['smtpfromname'];
-
-ini_set(max_execution_time,900); //15 minutes
-ini_set('memory_limit', '96M');
-$fd = fopen("php://stdin", "r");
-
-$email = file_get_contents ("php://stdin");
-
-fclose($fd);
-
-if($fd){
- $fp = fopen("/tmp/faxtoemail.txt", "w");
-}
-
-
-
-
-
-
-
-//send the email
-
- include "/usr/local/www/packages/freeswitch/class.phpmailer.php";
- include "/usr/local/www/packages/freeswitch/class.smtp.php"; // optional, gets called from within class.phpmailer.php if not already loaded
-
- $mail = new PHPMailer();
-
- $mail->IsSMTP(); // set mailer to use SMTP
- if ($tmp_smtpauth == "true") {
- $mail->SMTPAuth = $tmp_smtpauth; // turn on/off SMTP authentication
- }
- $mail->Host = $tmp_smtphost;
- if (strlen($tmp_smtpsecure)>0) {
- $mail->SMTPSecure = $tmp_smtpsecure;
- }
- if ($tmp_smtpusername) {
- $mail->Username = $tmp_smtpusername;
- $mail->Password = $tmp_smtppassword;
- }
- $mail->SMTPDebug = 2;
-
- echo "tmp_smtpfrom: $tmp_smtpfrom\n";
- echo "tmp_smtpfromname: $tmp_smtpfromname\n";
- echo "tmp_subject: $tmp_subject\n";
-
- $mail->From = $tmp_smtpfrom;
- $mail->FromName = $tmp_smtpfromname;
- $mail->Subject = $tmp_subject;
- $mail->AltBody = $tmp_textplain; // optional, comment out and test
- $mail->MsgHTML($tmp_texthtml);
-
-
- $tmp_to = $faxemail;
- $tmp_to = str_replace(";", ",", $tmp_to);
- $tmp_to_array = split(",", $tmp_to);
- foreach($tmp_to_array as $tmp_to_row) {
- if (strlen($tmp_to_row) > 0) {
- echo "tmp_to_row: $tmp_to_row\n";
- $mail->AddAddress($tmp_to_row);
- }
- }
-
- if (strlen($faxname) > 0) {
- $mail->AddAttachment($dir_fax.$faxname.'.tif'); // tif attachment
- $mail->AddAttachment($dir_fax.$faxname.'.pdf'); // pdf attachment
- $mail->AddAttachment($dir_fax.$faxname.'.png'); // png attachment
- //$filename='fax.tif'; $encoding = "base64"; $type = "image/tif";
- //$mail->AddStringAttachment(base64_decode($strfax),$filename,$encoding,$type);
- }
-
- if(!$mail->Send()) {
- echo "Mailer Error: " . $mail->ErrorInfo;
- }
- else {
- echo "Message sent!";
- }
-
-
-$content = ob_get_contents(); //get the output from the buffer
-ob_end_clean(); //clean the buffer
-
-fwrite($fp, $content);
-fclose($fp);
-
-?> \ No newline at end of file
diff --git a/config/freeswitch_dev/freeswitch.xml b/config/freeswitch_dev/freeswitch.xml
deleted file mode 100644
index ed6f2320..00000000
--- a/config/freeswitch_dev/freeswitch.xml
+++ /dev/null
@@ -1,262 +0,0 @@
-<?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$ */
-/* ========================================================================== */
-/*
- freeswitch.xml
- Copyright (C) 2008 Mark J Crane
- All rights reserved
-
- FreeSWITCH (TM)
- http://www.freeswitch.org/
-*/
-/* ========================================================================== */
-/*
- 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>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow.</description>
- <requirements>Describe your package requirements here</requirements>
- <faq>Currently there are no FAQ items provided.</faq>
- <name>Settings</name>
- <version>0.9.7.25</version>
- <title>Settings</title>
- <include_file>/usr/local/pkg/v_config.inc</include_file>
- <menu>
- <name>FreeSWITCH</name>
- <tooltiptext>Modify FreeSWITCH settings.</tooltiptext>
- <section>Services</section>
- <configfile>freeswitch.xml</configfile>
- <url>/packages/freeswitch/v_settings.php</url>
- </menu>
- <service>
- <name>freeswitch</name>
- <rcfile>freeswitch.sh</rcfile>
- <executable>freeswitch</executable>
- <description>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow. </description>
- </service>
- <tabs>
- <tab>
- <text>Settings</text>
- <url>/packages/freeswitch/v_settings.php</url>
- <active/>
- </tab>
- <tab>
- <text>Dialplan</text>
- <url>/packages/freeswitch/v_dialplan_includes.php</url>
- </tab>
- <tab>
- <text>Extensions</text>
- <url>/packages/freeswitch/v_extensions.php</url>
- </tab>
- <tab>
- <text>Features</text>
- <url>/packages/freeswitch/v_features.php</url>
- </tab>
- <tab>
- <text>Gateways</text>
- <url>/packages/freeswitch/v_gateways.php</url>
- </tab>
- <tab>
- <text>Profiles</text>
- <url>/packages/freeswitch/v_profiles.php</url>
- </tab>
- <tab>
- <text>Public</text>
- <url>/packages/freeswitch/v_public_includes.php</url>
- </tab>
- <tab>
- <text>Status</text>
- <url>/packages/freeswitch/v_status.php</url>
- </tab>
- <tab>
- <text>Vars</text>
- <url>/packages/freeswitch/v_vars.php</url>
- </tab>
- </tabs>
- <configpath>installedpackages->package->$packagename->configuration->freeswitchsettings</configpath>
- <additional_files_needed>
- <prefix>/usr/local/pkg/</prefix>
- <chmod>0755</chmod>
- <item>https://packages.pfsense.org/packages/config/freeswitch_dev/v_config.inc</item>
- </additional_files_needed>
- <fields>
- <field>
- <fielddescr>Numbering Plan</fielddescr>
- <fieldname>numbering_plan</fieldname>
- <description>Enter the numbering plan here. example: US</description>
- <type>input</type>
- </field>
- <field>
- <fielddescr>Default Gateway</fielddescr>
- <fieldname>default_gateway</fieldname>
- <description>Enter the default gateway name here.</description>
- <type>input</type>
- </field>
- <field>
- <fielddescr>Default Area Code</fielddescr>
- <fieldname>default_area_code</fieldname>
- <description>Enter the area code here. example: 918</description>
- <type>input</type>
- </field>
- <field>
- <fielddescr>Event Socket Port</fielddescr>
- <fieldname>event_socket_port</fieldname>
- <description>Enter the event socket port here. default: 8021</description>
- <type>input</type>
- </field>
- <field>
- <fielddescr>Event Socket Password</fielddescr>
- <fieldname>event_socket_password</fieldname>
- <description>Enter the event socket password here. default: ClueCon</description>
- <type>password</type>
- </field>
- <field>
- <fielddescr>XML RPC HTTP Port</fielddescr>
- <fieldname>xml_rpc_http_port</fieldname>
- <description>Enter the XML RPC HTTP Port here. default: 8787</description>
- <type>input</type>
- </field>
- <field>
- <fielddescr>XML RPC Auth Realm</fielddescr>
- <fieldname>xml_rpc_auth_realm</fieldname>
- <description>Enter the XML RPC Auth Realm here. default: freeswitch</description>
- <type>input</type>
- </field>
- <field>
- <fielddescr>XML RPC Auth User</fielddescr>
- <fieldname>xml_rpc_auth_user</fieldname>
- <description>Enter the XML RPC Auth User here. default: freeswitch</description>
- <type>input</type>
- </field>
- <field>
- <fielddescr>XML RPC Auth Password</fielddescr>
- <fieldname>xml_rpc_auth_pass</fieldname>
- <description>Enter the XML RPC Auth Password here. default: works</description>
- <type>password</type>
- </field>
- <field>
- <fielddescr>Admin PIN Number</fielddescr>
- <fieldname>admin_pin</fieldname>
- <description>Enter a admin pin number. Used to authenticate the admin from the phone.</description>
- <type>password</type>
- </field>
- <field>
- <fielddescr>SMTP Host</fielddescr>
- <fieldname>smtphost</fieldname>
- <description>Enter the SMTP host address. If you using a different port append it on the end with a colon. e.g. smtp.gmail.com:465</description>
- <type>input</type>
- </field>
- <field>
- <fielddescr>SMTP Secure</fielddescr>
- <fieldname>smtpsecure</fieldname>
- <description>Select the SMTP security. None, TLS, SSL</description>
- <type>select</type>
- <options>
- <option>
- <name>none</name>
- <value></value>
- </option>
- <option>
- <name>tls</name>
- <value>tls</value>
- </option>
- <option>
- <name>ssl</name>
- <value>ssl</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>SMTP Auth</fielddescr>
- <fieldname>smtpauth</fieldname>
- <description>Use SMTP Authentication true or false.</description>
- <type>select</type>
- <options>
- <option>
- <name>true</name>
- <value>true</value>
- </option>
- <option>
- <name>false</name>
- <value>false</value>
- </option>
- </options>
- </field>
- <field>
- <fielddescr>SMTP Username</fielddescr>
- <fieldname>smtpusername</fieldname>
- <description>Enter the SMTP authentication username.</description>
- <type>input</type>
- </field>
- <field>
- <fielddescr>SMTP Password</fielddescr>
- <fieldname>smtppassword</fieldname>
- <description>Enter the SMTP authentication password.</description>
- <type>password</type>
- </field>
- <field>
- <fielddescr>SMTP From</fielddescr>
- <fieldname>smtpfrom</fieldname>
- <description>Enter the SMTP From email address.</description>
- <type>input</type>
- </field>
- <field>
- <fielddescr>SMTP From Name</fielddescr>
- <fieldname>smtpfromname</fieldname>
- <description>Enter the SMTP From Name.</description>
- <type>input</type>
- </field>
- <field>
- <fielddescr>Mod Shout Decoder</fielddescr>
- <fieldname>mod_shout_decoder</fieldname>
- <description>Enter the Decoder. default: i386</description>
- <type>input</type>
- </field>
- <field>
- <fielddescr>Mod Shout Volume</fielddescr>
- <fieldname>mod_shout_volume</fieldname>
- <description>Enter the Volume. default: 0.3</description>
- <type>input</type>
- </field>
- </fields>
- <custom_add_php_command>
- </custom_add_php_command>
- <custom_php_resync_config_command>
- sync_package_v_settings();
- </custom_php_resync_config_command>
- <custom_delete_php_command>
- sync_package_v_settings();
- </custom_delete_php_command>
- <custom_php_install_command>
- v_install_phase_1();
- </custom_php_install_command>
- <custom_php_deinstall_command>
- v_deinstall_command();
- </custom_php_deinstall_command>
-</packagegui>
diff --git a/config/freeswitch_dev/index.tmp b/config/freeswitch_dev/index.tmp
deleted file mode 100644
index 68984113..00000000
--- a/config/freeswitch_dev/index.tmp
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
-
-header( 'Location: /' );
-
-?> \ No newline at end of file
diff --git a/config/freeswitch_dev/libcurl.so.5 b/config/freeswitch_dev/libcurl.so.5
deleted file mode 100755
index 3d57856f..00000000
--- a/config/freeswitch_dev/libcurl.so.5
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch_dev/libiconv.so.3 b/config/freeswitch_dev/libiconv.so.3
deleted file mode 100755
index f207e92c..00000000
--- a/config/freeswitch_dev/libiconv.so.3
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch_dev/libncurses.so.5.6 b/config/freeswitch_dev/libncurses.so.5.6
deleted file mode 100755
index 3b40374c..00000000
--- a/config/freeswitch_dev/libncurses.so.5.6
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch_dev/libncurses.so.5.7 b/config/freeswitch_dev/libncurses.so.5.7
deleted file mode 100755
index 3b40374c..00000000
--- a/config/freeswitch_dev/libncurses.so.5.7
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch_dev/libodbc.so.1 b/config/freeswitch_dev/libodbc.so.1
deleted file mode 100755
index eb7cb3af..00000000
--- a/config/freeswitch_dev/libodbc.so.1
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch_dev/libogg.so.5.3 b/config/freeswitch_dev/libogg.so.5.3
deleted file mode 100755
index d230b68e..00000000
--- a/config/freeswitch_dev/libogg.so.5.3
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch_dev/libspandsp.so.1 b/config/freeswitch_dev/libspandsp.so.1
deleted file mode 100755
index 177b8c22..00000000
--- a/config/freeswitch_dev/libspandsp.so.1
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch_dev/libtinfo.so.5.6 b/config/freeswitch_dev/libtinfo.so.5.6
deleted file mode 100755
index 1263ec79..00000000
--- a/config/freeswitch_dev/libtinfo.so.5.6
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch_dev/libvorbis.so.4 b/config/freeswitch_dev/libvorbis.so.4
deleted file mode 100755
index ec91ac85..00000000
--- a/config/freeswitch_dev/libvorbis.so.4
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch_dev/originate.js b/config/freeswitch_dev/originate.js
deleted file mode 100644
index a7c6fa2e..00000000
--- a/config/freeswitch_dev/originate.js
+++ /dev/null
@@ -1,84 +0,0 @@
-var uuid = argv[0];
-var sipuri = argv[1];
-var extension = argv[2];
-var caller_announce = argv[3];
-var caller_id_name = argv[4];
-var caller_id_number = argv[5];
-var tmp_sipuri;
-
-caller_id_name = caller_id_name.replace("+", " ");
-//console_log( "info", "caller_announce: "+caller_announce+"\n" );
-
-function originate (session, sipuri, extension, caller_announce, caller_id_name, caller_id_number) {
-
- var dtmf = new Object();
- var cid;
- dtmf.digits = "";
- cid = ",origination_caller_id_name="+caller_id_name+",origination_caller_id_number="+caller_id_number;
-
- new_session = new Session("{ignore_early_media=true"+cid+"}"+sipuri);
- new_session.execute("set", "call_timeout=30");
-
- if ( new_session.ready() ) {
-
- console_log( "info", "followme: new_session uuid "+new_session.uuid+"\n" );
- console_log( "info", "followme: no dtmf detected\n" );
-
- digitmaxlength = 1;
- while (new_session.ready()) {
-
- if (caller_announce.length > 0) {
- new_session.streamFile( "/tmp/"+caller_announce);
- }
- new_session.streamFile( "/usr/local/freeswitch/sounds/custom/8000/press_1_to_accept_2_to_reject_or_3_for_voicemail.wav");
- if (new_session.ready()) {
- if (dtmf.digits.length == 0) {
- dtmf.digits += new_session.getDigits(1, "#", 10000); // 10 seconds
- if (dtmf.digits.length == 0) {
-
- }
- else {
- break; //dtmf found end the while loop
- }
- }
- }
- }
-
- if ( dtmf.digits.length > "0" ) {
- if ( dtmf.digits == "1" ) {
- console_log( "info", "followme: call accepted\n" ); //accept
- new_session.execute("fifo", extension+"@${domain_name} out nowait");
- return true;
- }
- else if ( dtmf.digits == "2" ) {
- console_log( "info", "followme: call rejected\n" ); //reject
- new_session.hangup;
- return false;
- }
- else if ( dtmf.digits == "3" ) {
- console_log( "info", "followme: call sent to voicemail\n" ); //reject
- new_session.hangup;
- exit;
- return true;
- }
-
- }
- else {
- console_log( "info", "followme: no dtmf detected\n" ); //reject
- new_session.hangup;
- return false;
- }
-
- }
-}
-
-sipuri_array = sipuri.split(",");
-for (i = 0; i < sipuri_array.length; i++){
- tmp_sipuri = sipuri_array[i];
- console_log("info", "tmp_sipuri: "+tmp_sipuri);
- result = originate (session, tmp_sipuri, extension, caller_announce, caller_id_name, caller_id_number);
- if (result) {
- break;
- exit;
- }
-} \ No newline at end of file
diff --git a/config/freeswitch_dev/please_enter_the_extension_number.wav b/config/freeswitch_dev/please_enter_the_extension_number.wav
deleted file mode 100644
index d9384b0f..00000000
--- a/config/freeswitch_dev/please_enter_the_extension_number.wav
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch_dev/please_enter_the_phone_number.wav b/config/freeswitch_dev/please_enter_the_phone_number.wav
deleted file mode 100644
index 9cb4057b..00000000
--- a/config/freeswitch_dev/please_enter_the_phone_number.wav
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch_dev/please_enter_the_pin_number.wav b/config/freeswitch_dev/please_enter_the_pin_number.wav
deleted file mode 100644
index 107728a5..00000000
--- a/config/freeswitch_dev/please_enter_the_pin_number.wav
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch_dev/please_enter_your_pin_number.wav b/config/freeswitch_dev/please_enter_your_pin_number.wav
deleted file mode 100755
index 46263917..00000000
--- a/config/freeswitch_dev/please_enter_your_pin_number.wav
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch_dev/please_say_your_name_and_reason_for_calling.wav b/config/freeswitch_dev/please_say_your_name_and_reason_for_calling.wav
deleted file mode 100644
index 325a879d..00000000
--- a/config/freeswitch_dev/please_say_your_name_and_reason_for_calling.wav
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch_dev/press_1_to_accept_2_to_reject_or_3_for_voicemail.wav b/config/freeswitch_dev/press_1_to_accept_2_to_reject_or_3_for_voicemail.wav
deleted file mode 100644
index 9c01616a..00000000
--- a/config/freeswitch_dev/press_1_to_accept_2_to_reject_or_3_for_voicemail.wav
+++ /dev/null
Binary files differ
diff --git a/config/freeswitch_dev/v_auto_attendant.tmp b/config/freeswitch_dev/v_auto_attendant.tmp
deleted file mode 100644
index 63e79978..00000000
--- a/config/freeswitch_dev/v_auto_attendant.tmp
+++ /dev/null
@@ -1,183 +0,0 @@
-<?php
-/* $Id$ */
-/*
- v_auto_attendant.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/v_config.inc");
-
-
-$a_ivr = &$config['installedpackages']['freeswitchivr']['config'];
-
-
-if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'ivr') {
- if ($a_ivr[$_GET['id']]) {
- unlink($v_scripts_dir."/ivr_".$_GET['ivrid'].".js");
- unset($a_ivr[$_GET['id']]);
- write_config();
- sync_package_v_ivr();
- header("Location: v_auto_attendant.php");
- exit;
- }
- }
-}
-
-include("head.inc");
-
-?>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-
-<?php
-include("fbegin.inc");
-if ($v_label_show) {
- echo "<p class=\"pgtitle\">$v_label: Auto Attendant</p>\n";
-}
-?>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-build_menu();
-
-?>
-</td></tr>
-</table>
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
-<form action="v_auto_attendant.php" method="post" name="iform" id="iform">
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Auto Attendant<br />
- </strong></span>
- Auto Attendant provides callers the ability to choose between multiple options that direct
- calls to extensions, voicemail, conferences, queues, other auto attendants, and external phone numbers.
- </span></p></td>
- </tr>
- </table>
- <br />
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="20%" class="listhdrr">Extension</td>
- <td width="25%" class="listhdrr">Name</td>
- <td width="50%" class="listhdr">Description</td>
- <td width="10%" class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="v_auto_attendant_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
-
- <?php
- $i = 0;
- if (count($a_ivr) > 0) {
- foreach ($a_ivr as $ent) {
- if (strlen($ent['ivrid']) > 0) {
-
- $ivrid = str_replace(array("{", "}"), "", $ent['ivrid']);
-
- ?>
- <tr>
- <td class="listlr" ondblclick="document.location='v_auto_attendant_edit.php?id=<?=$i;?>'">
- <?=$ent['ivrextension']?>
- </td>
- <td class="listr" ondblclick="document.location='v_auto_attendant_edit.php?id=<?=$i;?>';">
- <?=$ent['ivrname'];?>&nbsp;
- </td>
- <td class="listbg" ondblclick="document.location='v_auto_attendant_edit.php?id=<?=$i;?>';">
- <font color="#FFFFFF"><?=htmlspecialchars($ent['ivrdescr']);?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="v_auto_attendant_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="v_auto_attendant.php?type=ivr&act=del&id=<?=$i;?>&ivrid=<?php echo $ivrid; ?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
- }
- $i++;
- }
- }
- ?>
- <tr>
- <td class="list" colspan="3"></td>
- <td class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="v_auto_attendant_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
-
- <tr>
- <td class="list" colspan="3"></td>
- <td class="list"></td>
- </tr>
- </table>
-
-</form>
-
-<br>
-<br>
-
-<?php
-if ($v_path_show) {
- echo $v_scripts_dir."\n";
-}
-?>
-
-<br>
-<br>
-<br>
-<br>
-
-</td>
-</tr>
-</table>
-
-</div>
-
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch_dev/v_auto_attendant_edit.tmp b/config/freeswitch_dev/v_auto_attendant_edit.tmp
deleted file mode 100644
index 3dfaa628..00000000
--- a/config/freeswitch_dev/v_auto_attendant_edit.tmp
+++ /dev/null
@@ -1,701 +0,0 @@
-<?php
-/* $Id$ */
-/*
-
- v_auto_attendant_edit.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/v_config.inc");
-
-
-$a_ivr = &$config['installedpackages']['freeswitchivr']['config'];
-$a_ivr_options = &$config['installedpackages']['freeswitchivroptions']['config'];
-
-
-$id = $_GET['id'];
-if (isset($_POST['id'])) {
- $id = $_POST['id'];
-}
-$parentid = $id;
-
-//set default $ivrconditionjs
- $ivrconditionjs = "function isholiday( Month, Date ) {\n";
- $ivrconditionjs .= " var Holiday = 0; //default false\n";
- $ivrconditionjs .= " if (Month == \"12\" && Date == \"25\") {\n";
- $ivrconditionjs .= " Holiday = 1; //true\n";
- $ivrconditionjs .= " }\n";
- $ivrconditionjs .= " if (Month == \"7\" && Date == \"4\") {\n";
- $ivrconditionjs .= " Holiday = 1; //true\n";
- $ivrconditionjs .= " }\n";
- $ivrconditionjs .= " if (Month == \"1\" && Date == \"1\") {\n";
- $ivrconditionjs .= " Holiday = 1; //true\n";
- $ivrconditionjs .= " }\n";
- $ivrconditionjs .= " if (Holiday == 1) {\n";
- $ivrconditionjs .= " return true;\n";
- $ivrconditionjs .= " }\n";
- $ivrconditionjs .= " else {\n";
- $ivrconditionjs .= " return false;\n";
- $ivrconditionjs .= " }\n";
- $ivrconditionjs .= "}\n";
- $ivrconditionjs .= "\n";
- $ivrconditionjs .= "function isweekday( Day ) {\n";
- $ivrconditionjs .= " if (Day > 1 && Day < 7) {\n";
- $ivrconditionjs .= " return true;\n";
- $ivrconditionjs .= " }\n";
- $ivrconditionjs .= " else {\n";
- $ivrconditionjs .= " return false;\n";
- $ivrconditionjs .= " }\n";
- $ivrconditionjs .= "}\n";
- $ivrconditionjs .= "\n";
- $ivrconditionjs .= "function isweekend( Day ) {\n";
- $ivrconditionjs .= " if (Day > 1 && Day < 7) {\n";
- $ivrconditionjs .= " return false;\n";
- $ivrconditionjs .= " }\n";
- $ivrconditionjs .= " else {\n";
- $ivrconditionjs .= " return true;\n";
- $ivrconditionjs .= " }\n";
- $ivrconditionjs .= "}\n";
- $ivrconditionjs .= "\n";
- $ivrconditionjs .= "function isofficehours( Hours ) {\n";
- $ivrconditionjs .= " if (Hours >= 9 && Hours < 17) {\n";
- $ivrconditionjs .= " return true;\n";
- $ivrconditionjs .= " }\n";
- $ivrconditionjs .= " else {\n";
- $ivrconditionjs .= " return false;\n";
- $ivrconditionjs .= " }\n";
- $ivrconditionjs .= "}\n";
- $ivrconditionjs .= "\n";
- $ivrconditionjs .= "function isafterhours( Hours ) {\n";
- $ivrconditionjs .= " if (Hours >= 9 && Hours < 17) {\n";
- $ivrconditionjs .= " return false;\n";
- $ivrconditionjs .= " }\n";
- $ivrconditionjs .= " else {\n";
- $ivrconditionjs .= " return true;\n";
- $ivrconditionjs .= " }\n";
- $ivrconditionjs .= "}\n";
- $ivrconditionjs .= "\n";
- $ivrconditionjs .= "//set default\n";
- $ivrconditionjs .= "condition = true;\n";
- $ivrconditionjs .= "\n";
- $ivrconditionjs .= "//Holiday?\n";
- $ivrconditionjs .= "if (isholiday( Month, Date )) {\n";
- $ivrconditionjs .= " console_log( \"info\", \"holiday\\n\" );\n";
- $ivrconditionjs .= " condition = false;\n";
- $ivrconditionjs .= "}\n";
- $ivrconditionjs .= "\n";
- $ivrconditionjs .= "//Weekend?\n";
- $ivrconditionjs .= "if (isweekend( Day )) {\n";
- $ivrconditionjs .= " console_log( \"info\", \"weekend\\n\" );\n";
- $ivrconditionjs .= " condition = false;\n";
- $ivrconditionjs .= "}\n";
- $ivrconditionjs .= "\n";
- $ivrconditionjs .= "// After Hours?\n";
- $ivrconditionjs .= "if (isafterhours( Hours )) {\n";
- $ivrconditionjs .= " console_log( \"info\", \"after hours\\n\" );\n";
- $ivrconditionjs .= " condition = false;\n";
- $ivrconditionjs .= "}\n";
- $ivrconditionjs .= "\n";
-
-
-if (isset($id) && $a_ivr[$id]) {
- $pconfig['ivrid'] = $a_ivr[$id]['ivrid'];
- $ivrid = $a_ivr[$id]['ivrid'];
- $pconfig['ivrextension'] = $a_ivr[$id]['ivrextension'];
- $pconfig['ivrname'] = $a_ivr[$id]['ivrname'];
- $pconfig['recordingidaction'] = $a_ivr[$id]['recordingidaction'];
- $pconfig['recordingidantiaction'] = $a_ivr[$id]['recordingidantiaction'];
- $pconfig['ivrtimeout'] = $a_ivr[$id]['ivrtimeout'];
- $pconfig['ivrcalltimeout'] = $a_ivr[$id]['ivrcalltimeout'];
- $pconfig['ivrcontext'] = $a_ivr[$id]['ivrcontext'];
- $pconfig['ivrdirectdial'] = $a_ivr[$id]['ivrdirectdial'];
- $pconfig['ivrringback'] = $a_ivr[$id]['ivrringback'];
- $pconfig['ivrcidnameprefix'] = $a_ivr[$id]['ivrcidnameprefix'];
- $pconfig['ivrconditionjs'] = ($a_ivr[$id]['ivrconditionjs']);
- $pconfig['ivrdescr'] = $a_ivr[$id]['ivrdescr'];
-}
-
-if ($_POST) {
-
- unset($input_errors);
- $pconfig = $_POST;
-
-
- if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'options') {
- if ($a_ivroptions[$_GET['optionid']]) {
- unset($a_ivr_options[$_GET['optionid']]);
- write_config();
- sync_package_v_ivr();
- header("Location: v_auto_attendant_edit.php?id=".$_GET['id']);
- exit;
- }
- }
- }
-
-
- if (!$input_errors) {
-
- $ivrent = array();
- if (strlen($_POST['ivrid']) > 0) {
- $ivrent['ivrid'] = $_POST['ivrid'];
- }
- else {
- $ivrent['ivrid'] = guid();
- }
- $ivrent['ivrextension'] = $_POST['ivrextension'];
- $ivrent['ivrname'] = $_POST['ivrname'];
- $ivrent['recordingidaction'] = $_POST['recordingidaction'];
- $ivrent['recordingidantiaction'] = $_POST['recordingidantiaction'];
- $ivrent['ivrtimeout'] = $_POST['ivrtimeout'];
- $ivrent['ivrcalltimeout'] = $_POST['ivrcalltimeout'];
- $ivrent['ivrcontext'] = $_POST['ivrcontext'];
- $ivrent['ivrdirectdial'] = $_POST['ivrdirectdial'];
- $ivrent['ivrringback'] = $_POST['ivrringback'];
- $ivrent['ivrcidnameprefix'] = $_POST['ivrcidnameprefix'];
- $ivrent['ivrconditionjs'] = base64_encode($_POST['ivrconditionjs']);
- $ivrent['ivrdescr'] = $_POST['ivrdescr'];
-
- if (isset($id) && $a_ivr[$id]) {
- //update
- $a_ivr[$id] = $ivrent;
- }
- else {
- //add
- $a_ivr[] = $ivrent;
- }
-
- //touch($d_hostsdirty_path);
- write_config();
- sync_package_v_ivr();
-
- header("Location: v_auto_attendant.php");
- exit;
- }
-}
-
-include("head.inc");
-
-?>
-<script language="Javascript">
-function sf() { document.forms[0].savetopath.focus(); }
-</script>
-<script language="Javascript" type="text/javascript" src="/edit_area/edit_area_full.js"></script>
-<script language="Javascript" type="text/javascript">
- // initialisation
- editAreaLoader.init({
- id: "ivrconditionjs" // id of the textarea to transform
- ,start_highlight: true
- ,allow_toggle: false
- ,language: "en"
- ,syntax: "js"
- ,toolbar: "search, go_to_line,|, fullscreen, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help"
- ,syntax_selection_allow: "css,html,js,php,xml,c,cpp,sql"
- ,show_line_colors: true
- });
-</script>
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-
-<?php
-
-include("fbegin.inc");
-if ($v_label_show) {
- echo "<p class=\"pgtitle\">$v_label: Auto Attendant: Edit</p>\n";
-}
-
-if ($input_errors) print_input_errors($input_errors);
-
-?>
-
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-build_menu();
-
-?>
-</td></tr>
-</table>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Settings:<br>
- </strong></span>
- Auto Attendant general settings.
- </span></p></td>
- </tr>
- </table>
- <br />
-
- <form action="v_auto_attendant_edit.php" method="post" name="iform" id="iform">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="22%" valign="top" class="vncellreq">Extension</td>
- <td width="78%" class="vtable">
- <input name="ivrextension" type="text" class="formfld" id="ivrextension" size="40" value="<?=htmlspecialchars($pconfig['ivrextension']);?>">
- <br> <span class="vexpl">e.g. <em>5002</em></span></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">IVR Name</td>
- <td width="78%" class="vtable">
- <input name="ivrname" type="text" class="formfld" id="ivrname" size="40" value="<?=htmlspecialchars($pconfig['ivrname']);?>">
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Recording Action</td>
- <td width="78%" class="vtable">
- <?php
- $a_recordings = &$config['installedpackages']['freeswitchrecordings']['config'];
- echo " <select name='recordingidaction' class='formfld'>\n";
- echo " <option></option>\n";
- if (count($a_recordings) > 0) {
- foreach ($a_recordings as $ent) {
- if (htmlspecialchars($pconfig['recordingidaction']) == $ent['recordingid']) {
- echo " <option value='".$ent['recordingid']."' selected='yes'>".$ent['recordingname']."</option>\n";
- }
- else {
- echo " <option value='".$ent['recordingid']."'>".$ent['recordingname']."</option>\n";
- }
- }
- }
- echo " </select>\n";
- ?>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Recording Anti-Action</td>
- <td width="78%" class="vtable">
- <?php
- //$a_recordings = &$config['installedpackages']['freeswitchrecordings']['config'];
- echo " <select name='recordingidantiaction' class='formfld'>\n";
- echo " <option></option>\n";
- if (count($a_recordings) > 0) {
- foreach ($a_recordings as $ent) {
- if (htmlspecialchars($pconfig['recordingidantiaction']) == $ent['recordingid']) {
- echo " <option value='".$ent['recordingid']."' selected='yes'>".$ent['recordingname']."</option>\n";
- }
- else {
- echo " <option value='".$ent['recordingid']."'>".$ent['recordingname']."</option>\n";
- }
- }
- }
- echo " </select>\n";
- ?>
- </td>
- </tr>
- <?php
- if (strlen($pconfig['ivrtimeout']) == 0) {
- $pconfig['ivrtimeout'] = 10; //set a default timeout
- }
- ?>
- <tr>
- <td width="22%" valign="top" class="vncellreq">IVR Timeout</td>
- <td width="78%" class="vtable">
- <input name="ivrtimeout" type="text" class="formfld" id="ivrtimeout" size="40" value="<?=htmlspecialchars($pconfig['ivrtimeout']);?>">
- <br>
- <span class="vexpl">After the recording concludes the
- timeout sets the time in seconds to continue to wait for DTMF.
- If the DTMF is <br />not detected during that time the 't'
- timeout option is executed.
- </span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Call Timeout</td>
- <td width="78%" class="vtable">
- <input name="ivrcalltimeout" type="text" class="formfld" id="ivrcalltimeout" size="40" value="<?=htmlspecialchars($pconfig['ivrcalltimeout']);?>">
- <br>
- <span class="vexpl">
- Call timeout is the time in seconds to ring the destination. After this time is exceeded calls
- to extensions will be sent to voicemail. default: 30 seconds
- </span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Context</td>
- <td width="78%" class="vtable">
- <input name="ivrcontext" type="text" class="formfld" id="ivrextension" size="40" value="<?=htmlspecialchars($pconfig['ivrcontext']);?>">
- <br> <span class="vexpl">e.g. <em>default</em></span></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Direct Dial</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='ivrdirectdial' class='formfld'>\n";
- echo " <option></option>\n";
- if (strlen($pconfig['ivrdirectdial']) == 0) { //set default
- echo " <option value='true'>enable</option>\n";
- echo " <option selected='yes' value='false'>disabled</option>\n";
- }
- else {
- if (htmlspecialchars($pconfig['ivrdirectdial']) == "true") {
- echo " <option selected='yes' value='true'>enabled</option>\n";
- }
- else {
- echo " <option value='true'>enable</option>\n";
- }
- if (htmlspecialchars($pconfig['ivrdirectdial']) == "false") {
- echo " <option selected='yes' value='false'>disabled</option>\n";
- }
- else {
- echo " <option value='false'>disable</option>\n";
- }
- }
-
- echo " </select>\n";
- ?>
- <br><span class="vexpl">Allows callers to dial directly to extensions and feature codes that are up to 5 digits in length.</span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Ring Back</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='ivrringback' class='formfld'>\n";
- echo " <option></option>\n";
- if (htmlspecialchars($pconfig['ivrringback']) == "ring") {
- echo " <option selected='yes'>ring</option>\n";
- }
- else {
- echo " <option>ring</option>\n";
- }
- if (htmlspecialchars($pconfig['ivrringback']) == "music") {
- echo " <option selected='yes'>music</option>\n";
- }
- else {
- echo " <option>music</option>\n";
- }
- echo " </select>\n";
- ?>
- <br>
- <span class="vexpl">
- Defines what the caller will hear while destination is being called. The choices are music
- (music on hold) ring (ring tone.) default: music
- </span>
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncellreq">CID Prefix</td>
- <td width="78%" class="vtable">
- <input name="ivrcidnameprefix" type="text" class="formfld" id="ivrcidnameprefix" size="40" value="<?=htmlspecialchars($pconfig['ivrcidnameprefix']);?>">
- <br> <span class="vexpl">Set a prefix on the caller ID name. (optional)</span></td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncellreq">Description</td>
- <td width="78%" class="vtable">
- <input name="ivrdescr" type="text" class="formfld" id="descr" size="40" value="<?=htmlspecialchars($pconfig['ivrdescr']);?>">
- <br>
- <span class="vexpl">
- You may enter a description here for your reference (not parsed).
- </span>
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncellreq">Javascript Condition</td>
- <td width="78%" class="vtable">
- <?php
- if (strlen(htmlspecialchars(base64_decode($pconfig['ivrconditionjs']))) == 0) {
- echo "<textarea name=\"ivrconditionjs\" id=\"ivrconditionjs\" cols=\"75\" rows=\"10\" wrap=\"off\">".$ivrconditionjs."</textarea>\n";
- }
- else {
- echo "<textarea name=\"ivrconditionjs\" id=\"ivrconditionjs\" cols=\"75\" rows=\"10\" wrap=\"off\">".htmlspecialchars(base64_decode($pconfig['ivrconditionjs']))."</textarea>\n";
- }
- ?>
- <br> <span class="vexpl">A simple valid condition is:
- condition=true; To re-populate the default simply empty the
- textarea and click on save. The following javascript variables
- have been defined: Hours, Mins, Seconds, Month, Date, Year,
- and Day.</span></td>
- </tr>
-
-
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()">
- <input name="ivrid" type="hidden" value="<?=htmlspecialchars($pconfig['ivrid']);?>">
- <?php if (isset($id) && $a_ivr[$id]): ?>
- <input name="id" type="hidden" value="<?=$id;?>">
- <?php endif; ?>
- </td>
- </tr>
- </table>
- </form>
-
- <br>
- <br>
-
- <form action="v_auto_attendant_edit.php" method="post" name="iform2" id="iform2">
- <?php
-
-
- //echo "<pre>";
- //print_r ($a_ivr);
- //echo "</pre>";
-
- //if ($savemsg) print_info_box($savemsg);
- //if (file_exists($d_hostsdirty_path)): echo"<p>";
- //print_info_box_np("The FreeSWITCH recordings have been changed.<br>You must apply the changes in order for them to take effect.");
- //echo"<br />";
- //endif;
-
- ?>
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong><br>
- </strong></span>
- Options are the choices that are available to the caller when they
- are calling the auto attendant. If the caller presses 2 then the call
- is directed to the corresponding destination.
- </span></p></td>
- </tr>
- </table>
-
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Action<br />
- </strong></span>
- The options that are executed when the <b>condition matches.</b>
- </span></p></td>
- </tr>
- </table>
- <br />
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="30" class="listhdrr">Option</td>
- <td width="30" class="listhdrr">Type</td>
- <td width="30" class="listhdrr">Profile</td>
- <td width="150" class="listhdrr">Destination</td>
- <td width="30%" class="listhdr">Description</td>
- <td width="40" class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle">
- <?php if (strlen($ivrid) > 1) { ?>
- <a href="v_auto_attendant_options_edit.php?parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>&a=action"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a>
- <?php } ?>
- </td>
- </tr>
- </table>
- </td>
- </tr>
-
- <?php
- $i = 0;
- if (count($a_ivr_options) > 0) {
- foreach ($a_ivr_options as $ent) {
- if ($ent['optionaction'] == "action" && $ivrid == $ent['ivrid']) {
- ?>
- <tr>
- <td class="listlr" ondblclick="document.location='v_auto_attendant_options_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>'">
- <?=$ent['optionnumber']?>
- </td>
- <td class="listr" ondblclick="document.location='v_auto_attendant_options_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>';">
- <?=$ent['optiontype'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='v_auto_attendant_options_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>';">
- <?=$ent['optionprofile'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='v_auto_attendant_options_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>';">
- <?=$ent['optiondest'];?>&nbsp;
- </td>
- <td class="listbg" ondblclick="document.location='v_auto_attendant_options_edit.php?id=<?=$id;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>';">
- <font color="#FFFFFF"><?=htmlspecialchars($ent['optiondescr']);?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="v_auto_attendant_options_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="v_auto_attendant_options.php?type=ivroptions&act=del&id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>" onclick="return confirm('Do you really want to delete this recording?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
- }
- $i++;
- }
- }
- ?>
- <tr>
- <td class="list" colspan="5"></td>
- <td class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle">
- <?php if (strlen($ivrid) > 1) { ?>
- <a href="v_auto_attendant_options_edit.php?parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>&a=action"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a>
- <?php } ?>
- </td>
- </tr>
- </table>
- </td>
- </tr>
-
-
- <tr>
- <td class="list" colspan="5"></td>
- <td class="list"></td>
- </tr>
- </table>
-
- </form>
-
-
-
- <form action="v_auto_attendant_edit.php" method="post" name="iform2" id="iform2">
- <?php
-
-
- //echo "<pre>";
- //print_r ($a_ivr);
- //echo "</pre>";
-
- //if ($savemsg) print_info_box($savemsg);
- //if (file_exists($d_hostsdirty_path)): echo"<p>";
- //print_info_box_np("The FreeSWITCH recordings have been changed.<br>You must apply the changes in order for them to take effect.");
- //echo"<br />";
- //endif;
-
- ?>
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Anti-Action<br />
- </strong></span>
- The options that are executed when the <b>condition does NOT match.</b>
- </span></p></td>
- </tr>
- </table>
- <br />
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="30" class="listhdrr">Option</td>
- <td width="30" class="listhdrr">Type</td>
- <td width="30" class="listhdrr">Profile</td>
- <td width="150" class="listhdrr">Destination</td>
- <td width="30%" class="listhdr">Description</td>
- <td width="40" class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle">
- <?php if (strlen($ivrid) > 1) { ?>
- <a href="v_auto_attendant_options_edit.php?parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>&a=antiaction"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a>
- <?php } ?>
- </td>
- </tr>
- </table>
- </td>
- </tr>
-
- <?php
- $i = 0;
- if (count($a_ivr_options) > 0) {
- foreach ($a_ivr_options as $ent) {
- if ($ent['optionaction'] == "anti-action" && $ivrid == $ent['ivrid']) {
- ?>
- <tr>
- <td class="listlr" ondblclick="document.location='v_auto_attendant_options_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>'">
- <?=$ent['optionnumber']?>
- </td>
- <td class="listr" ondblclick="document.location='v_auto_attendant_options_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>';">
- <?=$ent['optiontype'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='v_auto_attendant_options_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>';">
- <?=$ent['optionprofile'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='v_auto_attendant_options_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>';">
- <?=$ent['optiondest'];?>&nbsp;
- </td>
- <td class="listbg" ondblclick="document.location='v_auto_attendant_options_edit.php?id=<?=$id;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>';">
- <font color="#FFFFFF"><?=htmlspecialchars($ent['optiondescr']);?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="v_auto_attendant_options_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="v_auto_attendant_options.php?type=ivroptions&act=del&id=<?=$i;?>&parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>" onclick="return confirm('Do you really want to delete this recording?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
- }
- $i++;
- }
- }
- ?>
- <tr>
- <td class="list" colspan="5"></td>
- <td class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle">
- <?php if (strlen($ivrid) > 1) { ?>
- <a href="v_auto_attendant_options_edit.php?parentid=<?=$parentid;?>&ivrid=<?=$ivrid;?>&a=antiaction"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a>
- <? } ?>
- </td>
- </tr>
- </table>
- </td>
- </tr>
-
-
- <tr>
- <td class="list" colspan="5"></td>
- <td class="list"></td>
- </tr>
- </table>
-
- </form>
-
- <br>
- <br>
-
- </td>
- </tr>
-</table>
-
-</div>
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch_dev/v_auto_attendant_options.tmp b/config/freeswitch_dev/v_auto_attendant_options.tmp
deleted file mode 100755
index f92a59d5..00000000
--- a/config/freeswitch_dev/v_auto_attendant_options.tmp
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-/* $Id$ */
-/*
- v_auto_attendant_options.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/v_config.inc");
-
-
-$a_ivr_options = &$config['installedpackages']['freeswitchivroptions']['config'];
-
-
-if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'ivroptions') {
- if ($a_ivr_options[$_GET['id']]) {
- unset($a_ivr_options[$_GET['id']]);
- write_config();
- sync_package_v_ivr();
- header("Location: v_auto_attendant_edit.php?id=".$_GET['parentid']);
- exit;
- }
- }
-}
-
-?> \ No newline at end of file
diff --git a/config/freeswitch_dev/v_auto_attendant_options_edit.tmp b/config/freeswitch_dev/v_auto_attendant_options_edit.tmp
deleted file mode 100644
index d91a077b..00000000
--- a/config/freeswitch_dev/v_auto_attendant_options_edit.tmp
+++ /dev/null
@@ -1,252 +0,0 @@
-<?php
-/* $Id$ */
-/*
-
- v_auto_attendant_options_edit.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/v_config.inc");
-
-
-$a_ivr_options = &$config['installedpackages']['freeswitchivroptions']['config'];
-
-$id = $_GET['id'];
-if (isset($_POST['id'])) {
- $id = $_POST['id'];
-}
-
-$parentid = $_GET['parentid'];
-if (isset($_POST['parentid'])) {
- $parentid = $_POST['parentid'];
-}
-
-$ivrid = $_GET['ivrid'];
-if (isset($_POST['ivrid'])) {
- $ivrid = $_POST['ivrid'];
-}
-
-
-if (isset($id) && $a_ivr_options[$id]) {
- $pconfig['optionaction'] = $a_ivr_options[$id]['optionaction'];
- $pconfig['optionnumber'] = $a_ivr_options[$id]['optionnumber'];
- $pconfig['optiontype'] = $a_ivr_options[$id]['optiontype'];
- $pconfig['optionprofile'] = $a_ivr_options[$id]['optionprofile'];
- $pconfig['optiondest'] = $a_ivr_options[$id]['optiondest'];
- $pconfig['optiondescr'] = $a_ivr_options[$id]['optiondescr'];
-}
-else {
- if (isset($_GET['a'])) {
- if ($_GET['a'] == "action"){ $pconfig['optionaction'] = "action"; }
- if ($_GET['a'] == "antiaction"){ $pconfig['optionaction'] = "anti-action"; }
- }
-}
-
-
-if ($_POST) {
-
- unset($input_errors);
- $pconfig = $_POST;
-
-
- if (!$input_errors) {
-
- $ivroptionent = array();
- $ivroptionent['ivrid'] = $_POST['ivrid'];
- $ivroptionent['optionnumber'] = $_POST['optionnumber'];
- $ivroptionent['optiontype'] = $_POST['optiontype'];
- $ivroptionent['optionprofile'] = $_POST['optionprofile'];
- $ivroptionent['optionaction'] = $_POST['optionaction'];
- $ivroptionent['optiondest'] = $_POST['optiondest'];
- $ivroptionent['optiondescr'] = $_POST['optiondescr'];
-
- if (isset($id) && $a_ivr_options[$id]) {
- //update
- $a_ivr_options[$id] = $ivroptionent;
- }
- else {
- //add
- $a_ivr_options[] = $ivroptionent;
- }
-
-
- write_config();
- sync_package_v_ivr();
-
- header("Location: v_auto_attendant_edit.php?id=".$parentid);
- exit;
- }
-}
-
-include("head.inc");
-
-?>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php
-include("fbegin.inc");
-if ($v_label_show) {
- echo "<p class=\"pgtitle\">$v_label: Auto Attendant: Options: Edit</p>\n";
-}
-if ($input_errors) print_input_errors($input_errors);
-
-?>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-build_menu();
-
-?>
-</td></tr>
-</table>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
- <br />
- <form action="v_auto_attendant_options_edit.php" method="post" name="iform" id="iform">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="22%" valign="top" class="vncellreq">Option Number</td>
- <td width="78%" class="vtable">
- <input name="optionnumber" type="text" class="formfld" id="optionnumber" size="40" value="<?=htmlspecialchars($pconfig['optionnumber']);?>">
- <br> <span class="vexpl">Option Number<br>
- e.g. <em>1</em></span></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Type</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='optiontype' class='formfld'>\n";
- echo " <option></option>\n";
- if (htmlspecialchars($pconfig['optiontype']) == "extension") {
- echo " <option selected='yes'>extension</option>\n";
- }
- else {
- echo " <option>extension</option>\n";
- }
- if (htmlspecialchars($pconfig['optiontype']) == "voicemail") {
- echo " <option selected='yes'>voicemail</option>\n";
- }
- else {
- echo " <option>voicemail</option>\n";
- }
- if (htmlspecialchars($pconfig['optiontype']) == "sip uri") {
- echo " <option selected='yes'>sip uri</option>\n";
- }
- else {
- echo " <option>sip uri</option>\n";
- }
- echo " </select>\n";
- ?>
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncellreq">Profile</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='optionprofile' class='formfld'>\n";
- echo " <option></option>\n";
- if (htmlspecialchars($pconfig['optionprofile']) == "auto") {
- echo " <option selected='yes'>auto</option>\n";
- }
- else {
- echo " <option>auto</option>\n";
- }
-
- foreach (ListFiles($v_conf_dir.'/sip_profiles') as $key=>$sip_profile_file){
- $sip_profile_name = str_replace(".xml", "", $sip_profile_file);
-
- if (htmlspecialchars($pconfig['optionprofile']) == $sip_profile_name) {
- echo " <option selected='yes'>$sip_profile_name</option>\n";
- }
- else {
- echo " <option>$sip_profile_name</option>\n";
- }
- }
- echo " </select>\n";
-
- ?>
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncellreq">Destination</td>
- <td width="78%" class="vtable">
- <input name="optiondest" type="text" class="formfld" id="optiondest" size="40" value="<?=htmlspecialchars($pconfig['optiondest']);?>">
- <br>
- <span class="vexpl">
- <!--<b>examples:</b><br />-->
- extension: 1001<br />
- voicemail: 1001<br />
- sip uri (voicemail): sofia/internal/*98@${domain}<br />
- sip uri (external number): sofia/gateway/gatewayname/12081231234<br />
- sip uri (auto attendant): sofia/internal/5002@${domain}<br />
- sip uri (user): /user/1001@${domain}<br />
- </span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Description</td>
- <td width="78%" class="vtable">
- <input name="optiondescr" type="text" class="formfld" id="optiondescr" size="40" value="<?=htmlspecialchars($pconfig['optiondescr']);?>">
- <br> <span class="vexpl">You may enter a description here
- for your reference (not parsed).</span></td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="ivrid" type="hidden" value="<?=$ivrid;?>">
- <input name="parentid" type="hidden" value="<?=$parentid;?>">
- <input name="optionaction" type="hidden" value="<?=$pconfig['optionaction'];?>">
- <?php if (isset($id) && $a_ivr_options[$id]): ?>
- <input name="id" type="hidden" value="<?=$id;?>">
- <?php endif; ?>
- <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()">
- </td>
- </tr>
- </table>
- </form>
-
- <br>
- <br>
- <br>
- <br>
- <br>
- <br>
-
- </td>
- </tr>
-</table>
-
-</div>
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch_dev/v_cmd.tmp b/config/freeswitch_dev/v_cmd.tmp
deleted file mode 100644
index 2c84a8d9..00000000
--- a/config/freeswitch_dev/v_cmd.tmp
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-/* $Id$ */
-/*
- v_cmd.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/v_config.inc");
-$cmd = $_GET['cmd'];
-
-
-$password = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password'];
-$port = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port'];
-$host = '';
-
-$fp = event_socket_create($host, $port, $password);
-$response = event_socket_request($fp, $cmd);
-fclose($fp);
-
-header("Location: /packages/freeswitch/v_status.php?savemsg=".urlencode($response));
-
-?> \ No newline at end of file
diff --git a/config/freeswitch_dev/v_config.inc b/config/freeswitch_dev/v_config.inc
deleted file mode 100644
index 67c9fce9..00000000
--- a/config/freeswitch_dev/v_config.inc
+++ /dev/null
@@ -1,3974 +0,0 @@
-<?php
-/* $Id$ */
-/*
-/* ========================================================================== */
-/*
- v_config.inc
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require_once('config.inc');
-require_once('globals.inc');
-require_once('service-utils.inc');
-
-
-
-//preferences
- $v_label_show = true;
- $v_path_show = true;
- $v_menu_tab_show = true;
- $v_fax_show = true;
-
-
-function v_settings()
-{
- global $config;
- $config['installedpackages']['freeswitchsettings']['config'][0]['php_dir'] = '/usr/local/bin/php';
- $config['installedpackages']['freeswitchsettings']['config'][0]['tmp_dir'] = '/tmp';
- $config['installedpackages']['freeswitchsettings']['config'][0]['bin_dir'] = '/usr/local/bin';
- $config['installedpackages']['freeswitchsettings']['config'][0]['v_startup_script_dir'] = '/usr/local/etc/rc.d';
- $config['installedpackages']['freeswitchsettings']['config'][0]['v_package_version'] = "0.9.7.26";
- $config['installedpackages']['freeswitchsettings']['config'][0]['v_build_version'] = "1.0.4";
- $config['installedpackages']['freeswitchsettings']['config'][0]['v_build_revision'] = "Release";
- $config['installedpackages']['freeswitchsettings']['config'][0]['v_label'] = 'FreeSWITCH'; //FreeSWITCH (TM) http://www.freeswitch.org/
- $config['installedpackages']['freeswitchsettings']['config'][0]['v_name'] = 'freeswitch';
- $config['installedpackages']['freeswitchsettings']['config'][0]['v_dir'] = '/usr/local/freeswitch';
- $config['installedpackages']['freeswitchsettings']['config'][0]['v_parent_dir'] = '/usr/local/';
- $config['installedpackages']['freeswitchsettings']['config'][0]['v_backup_dir'] = '/root/backup';
- $config['installedpackages']['freeswitchsettings']['config'][0]['v_web_dir'] = '/usr/local/www/packages/freeswitch';
- $config['installedpackages']['freeswitchsettings']['config'][0]['v_web_root'] = '/usr/local/www/';
- $config['installedpackages']['freeswitchsettings']['config'][0]['v_relative_url'] = '/packages/freeswitch';
- $config['installedpackages']['freeswitchsettings']['config'][0]['v_conf_dir'] = '/usr/local/freeswitch/conf';
- $config['installedpackages']['freeswitchsettings']['config'][0]['v_db_dir'] = '/usr/local/freeswitch/db';
- $config['installedpackages']['freeswitchsettings']['config'][0]['v_htdocs_dir'] = '/usr/local/freeswitch/htdocs';
- $config['installedpackages']['freeswitchsettings']['config'][0]['v_log_dir'] = '/usr/local/freeswitch/log';
- $config['installedpackages']['freeswitchsettings']['config'][0]['v_mod_dir'] = '/usr/local/freeswitch/mod';
- $config['installedpackages']['freeswitchsettings']['config'][0]['v_scripts_dir'] = '/usr/local/freeswitch/scripts';
- $config['installedpackages']['freeswitchsettings']['config'][0]['v_storage_dir'] = '/usr/local/freeswitch/storage';
- $config['installedpackages']['freeswitchsettings']['config'][0]['v_recordings_dir'] = '/usr/local/freeswitch/recordings';
- $config['installedpackages']['freeswitchsettings']['config'][0]['v_download_path'] = 'https://packages.pfsense.org/packages/config/freeswitch_dev';
-
-}
-//Update the settings
-// v_settings();
-// write_config();
-
-$v_settings_array = $config['installedpackages']['freeswitchsettings']['config'][0];
-foreach($v_settings_array as $name => $value) {
- $$name = $value;
-}
-
-function build_menu() {
-
- global $v_menu_tab_show;
-
- if ($v_menu_tab_show) {
- global $config;
- $v_relative_url = $config['installedpackages']['freeswitchsettings']['config'][0]['v_relative_url'];
-
- //$script_name_array = split ("/", $_SERVER["SCRIPT_NAME"]);
- //$script_name = $script_name_array[count($script_name_array)-1];
- //echo "script_name: ".$script_name."<br />";
-
- $tab_array = array();
- $menu_selected = false;
- if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_settings.php") { $menu_selected = true; }
- $tab_array[] = array(gettext("Settings"), $menu_selected, $v_relative_url."/v_settings.php");
- unset($menu_selected);
-
- $menu_selected = false;
- if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_dialplan_includes.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_dialplan.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_dialplan_includes_edit.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_dialplan_includes_details_edit.php") { $menu_selected = true; }
- $tab_array[] = array(gettext("Dialplan"), $menu_selected, $v_relative_url."/v_dialplan_includes.php");
- unset($menu_selected);
-
- $menu_selected = false;
- if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_extensions.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_extensions_edit.php") { $menu_selected = true; }
- $tab_array[] = array(gettext("Extensions"), $menu_selected, $v_relative_url."/v_extensions.php");
- unset($menu_selected);
-
- $menu_selected = false;
- if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_features.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_fax.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_fax_edit.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_hunt_group.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_hunt_group_edit.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_hunt_group_destinations.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_hunt_group_destinations_edit.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_auto_attendant.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_auto_attendant_edit.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_auto_attendant_options_edit.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_modules.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_recordings.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_recordings_edit.php") { $menu_selected = true; }
- $tab_array[] = array(gettext("Features"), $menu_selected, $v_relative_url."/v_features.php");
- unset($menu_selected);
-
- $menu_selected = false;
- if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_gateways.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_gateways_edit.php") { $menu_selected = true; }
- $tab_array[] = array(gettext("Gateways"), $menu_selected, $v_relative_url."/v_gateways.php");
- unset($menu_selected);
-
- $menu_selected = false;
- if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_profiles.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_profile_edit.php") { $menu_selected = true; }
- $tab_array[] = array(gettext("Profiles"), $menu_selected, $v_relative_url."/v_profiles.php");
- unset($menu_selected);
-
- $menu_selected = false;
- if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_public.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_public_includes.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_public_includes_edit.php") { $menu_selected = true; }
- if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_public_includes_details_edit.php") { $menu_selected = true; }
- $tab_array[] = array(gettext("Public"), $menu_selected, $v_relative_url."/v_public_includes.php");
- unset($menu_selected);
-
- $menu_selected = false;
- if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_status.php") { $menu_selected = true; }
- $tab_array[] = array(gettext("Status"), $menu_selected, $v_relative_url."/v_status.php");
- unset($menu_selected);
-
- $menu_selected = false;
- if ($_SERVER["SCRIPT_NAME"] == $v_relative_url."/v_vars.php") { $menu_selected = true; }
- $tab_array[] = array(gettext("Vars"), $menu_selected, $v_relative_url."/v_vars.php");
- unset($menu_selected);
-
- display_top_tabs($tab_array);
- }
-
-}
-
-
-function guid()
-{
- if (function_exists('com_create_guid')){
- return com_create_guid();
- }else{
- mt_srand((double)microtime()*10000);//optional for php 4.2.0 and up.
- $charid = strtoupper(md5(uniqid(rand(), true)));
- $hyphen = chr(45);// "-"
- $uuid = chr(123)// "{"
- .substr($charid, 0, 8).$hyphen
- .substr($charid, 8, 4).$hyphen
- .substr($charid,12, 4).$hyphen
- .substr($charid,16, 4).$hyphen
- .substr($charid,20,12)
- .chr(125);// "}"
- return $uuid;
- }
-}
-//echo guid();
-
-
-if (!function_exists("pkg_is_service_running")) {
- function pkg_is_service_running($servicename)
- {
- //exec("/bin/ps ax | awk '{ print $5 }'", $psout);
- //array_shift($psout);
- //foreach($psout as $line) {
- // $ps[] = trim(array_pop(explode(' ', array_pop(explode('/', $line)))));
- //}
- //if(pkg_is_service_running($servicename, $ps) or is_process_running($servicename) ) {
- return true;
- //}
- //else {
- // return false;
- //}
- }
-}
-
-
-function event_socket_create($host, $port, $password)
-{
- //$host has been deprecated
-
- //build the interface list
- $i = 0; $ifdescrs = array('wan' => 'WAN', 'lan' => 'LAN');
- for ($j = 1; isset($config['interfaces']['opt' . $j]); $j++) {
- $ifdescrs['opt' . $j] = $config['interfaces']['opt' . $j]['descr'];
- }
-
- //get the interface ip addresses and try to connect to them
- foreach ($ifdescrs as $ifdescr => $ifname){
- $ifinfo = get_interface_info($ifdescr);
- $interface_ip_address = $ifinfo['ipaddr'];
-
- if (strlen($interface_ip_address) > 0) {
-
- $fp = fsockopen($interface_ip_address, $port, $errno, $errdesc, 3);
- socket_set_blocking($fp,false);
-
- if (!$fp) {
- //connection failed continue through the loop testing other addresses
- //invalid handle
- }
- else {
- //connected to the socket return the handle
-
- while (!feof($fp)) {
- $buffer = fgets($fp, 1024);
- usleep(100); //allow time for reponse
- if (trim($buffer) == "Content-Type: auth/request") {
- fputs($fp, "auth $password\n\n");
- break;
- }
- }
- return $fp;
- }
-
- } //end if interface_ip_address
- } //end foreach
-} //end function
-
-
-function event_socket_request($fp, $cmd)
-{
- if ($fp) {
- fputs($fp, $cmd."\n\n");
- usleep(100); //allow time for reponse
-
- $response = "";
- $i = 0;
- $contentlength = 0;
- while (!feof($fp)) {
- $buffer = fgets($fp, 4096);
- if ($contentlength > 0) {
- $response .= $buffer;
- }
-
- if ($contentlength == 0) { //if contentlenght is already don't process again
- if (strlen(trim($buffer)) > 0) { //run only if buffer has content
- $temparray = split(":", trim($buffer));
- if ($temparray[0] == "Content-Length") {
- $contentlength = trim($temparray[1]);
- }
- }
- }
-
- usleep(100); //allow time for reponse
-
- //optional because of script timeout //don't let while loop become endless
- if ($i > 1000) { break; }
-
- if ($contentlength > 0) { //is contentlength set
- //stop reading if all content has been read.
- if (strlen($response) >= $contentlength) {
- break;
- }
- }
- $i++;
- }
-
- return $response;
- }
- else {
- echo "no handle";
- }
-}
-
-
-function event_socket_request_cmd($cmd)
-{
- global $config;
- $password = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password'];
- $port = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port'];
- $host = $config['interfaces']['lan']['ipaddr'];
-
- if (pkg_is_service_running('freeswitch')) {
- $fp = event_socket_create($host, $port, $password);
- $response = event_socket_request($fp, $cmd);
- fclose($fp);
- }
- unset($host, $port, $password);
-
-}
-
-function byte_convert( $bytes ) {
-
- if ($bytes<=0)
- return '0 Byte';
-
- $convention=1000; //[1000->10^x|1024->2^x]
- $s=array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB');
- $e=floor(log($bytes,$convention));
- $e=floor(log($bytes,$convention));
- return round($bytes/pow($convention,$e),2).' '.$s[$e];
-}
-
-function ListFiles($dir) {
-
- if($dh = opendir($dir)) {
-
- $files = Array();
- $inner_files = Array();
-
- while($file = readdir($dh)) {
- if($file != "." && $file != ".." && $file[0] != '.') {
- if(is_dir($dir . "/" . $file)) {
- //$inner_files = ListFiles($dir . "/" . $file); //recursive
- if(is_array($inner_files)) $files = array_merge($files, $inner_files);
- } else {
- array_push($files, $file);
- //array_push($files, $dir . "/" . $file);
- }
- }
- }
-
- closedir($dh);
- return $files;
- }
-}
-
-
-function recording_js()
-{
-
- global $config;
- $v_settings_array = $config['installedpackages']['freeswitchsettings']['config'][0];
- foreach($v_settings_array as $name => $value) {
- $$name = $value;
- }
-
- $admin_pin = $config['installedpackages']['freeswitchsettings']['config'][0]['admin_pin'];
-
- $fout = fopen($v_scripts_dir."/recordings.js","w");
- $tmp = " var pin = \"".$admin_pin."\";\n";
- $tmp .= " //var pin = \"\"; //don't require a pin\n";
- $tmp .= " //if you choose not to require a pin then then you may want to add a dialplan condition for a specific caller id\n";
- $tmp .= "\n";
- $tmp .= " var digitmaxlength = 0;\n";
- $tmp .= " var timeoutpin = 7500;\n";
- $tmp .= " var timeouttransfer = 7500;\n";
- $tmp .= " var objdate = new Date();\n";
- $tmp .= "\n";
- $tmp .= " var adjusthours = 0; //Adjust Server time that is set to GMT 7 hours\n";
- $tmp .= " var adjustoperator = \"-\"; //+ or -\n";
- $tmp .= "\n";
- $tmp .= " if (adjustoperator == \"-\") {\n";
- $tmp .= " var objdate2 = new Date(objdate.getFullYear(),objdate.getMonth(),objdate.getDate(),(objdate.getHours() - adjusthours),objdate.getMinutes(),objdate.getSeconds());\n";
- $tmp .= " }\n";
- $tmp .= " if (adjustoperator == \"+\") {\n";
- $tmp .= " var objdate2 = new Date(objdate.getFullYear(),objdate.getMonth(),objdate.getDate(),(objdate.getHours() + adjusthours),objdate.getMinutes(),objdate.getSeconds());\n";
- $tmp .= " }\n";
- $tmp .= "\n";
- $tmp .= " var Hours = objdate2.getHours();\n";
- $tmp .= " var Mins = objdate2.getMinutes();\n";
- $tmp .= " var Seconds = objdate2.getSeconds();\n";
- $tmp .= " var Month = objdate2.getMonth() + 1;\n";
- $tmp .= " var Date = objdate2.getDate();\n";
- $tmp .= " var Year = objdate2.getYear()\n";
- $tmp .= " var Day = objdate2.getDay()+1;\n";
- $tmp .= " var exit = false;\n";
- $tmp .= "\n";
- $tmp .= "\n";
- $tmp .= " function mycb( session, type, data, arg ) {\n";
- $tmp .= " if ( type == \"dtmf\" ) {\n";
- $tmp .= " //console_log( \"info\", \"digit: \"+data.digit+\"\\n\" );\n";
- $tmp .= " if ( data.digit == \"#\" ) {\n";
- $tmp .= " //console_log( \"info\", \"detected pound sign.\\n\" );\n";
- $tmp .= " return( true );\n";
- $tmp .= " }\n";
- $tmp .= " dtmf.digits += data.digit;\n";
- $tmp .= "\n";
- $tmp .= " if ( dtmf.digits.length < digitmaxlength ) {\n";
- $tmp .= " return( true );\n";
- $tmp .= " }\n";
- $tmp .= " }\n";
- $tmp .= " return( false );\n";
- $tmp .= " }\n";
- $tmp .= "\n";
- $tmp .= " //console_log( \"info\", \"Recording Request\\n\" );\n";
- $tmp .= "\n";
- $tmp .= " var dtmf = new Object( );\n";
- $tmp .= " dtmf.digits = \"\";\n";
- $tmp .= "\n";
- $tmp .= " if ( session.ready( ) ) {\n";
- $tmp .= " session.answer( );\n";
- $tmp .= "\n";
-
- $tmp .= "\n";
- $tmp .= " if (pin.length > 0) {\n";
- //$tmp .= " session.execute(\"set\", \"tts_engine=flite\");\n";
- //$tmp .= " session.execute(\"set\", \"tts_voice=kal\");\n";
- //$tmp .= " session.execute(\"speak\", \"Please enter your pin number now.\");\n";
- $tmp .= " digitmaxlength = 6;\n";
- $tmp .= " session.execute(\"set\", \"playback_terminators=#\");\n";
- $tmp .= " session.streamFile( \"".$v_dir."/sounds/custom/8000/please_enter_the_pin_number.wav\", mycb, \"dtmf\");\n";
- $tmp .= " session.collectInput( mycb, dtmf, timeoutpin );\n";
- $tmp .= " }\n";
- $tmp .= "\n";
- $tmp .= " if (dtmf.digits == pin || pin.length == 0) {\n";
- //$tmp .= " //console_log( \"info\", \"Recordings pin is correct\\n\" );\n";
- //$tmp .= " session.execute(\"set\", \"tts_engine=flite\");\n";
- //$tmp .= " session.execute(\"set\", \"tts_voice=kal\");\n";
- //$tmp .= " session.execute(\"speak\", \"Begin recording.\");\n";
- $tmp .= " session.streamFile( \"".$v_dir."/sounds/custom/8000/begin_recording.wav\", mycb, \"dtmf\");\n";
- $tmp .= " session.execute(\"set\", \"playback_terminators=#\");\n";
- $tmp .= " session.execute(\"record\", \"".$v_recordings_dir."/temp\"+Year+Month+Day+Hours+Mins+Seconds+\".wav 180 200\");\n";
- $tmp .= " }\n";
- $tmp .= " else {\n";
- $tmp .= " console_log( \"info\", \"Pin: \" + dtmf.digits + \" is incorrect\\n\" );\n";
- //$tmp .= " session.execute(\"set\", \"tts_engine=flite\");\n";
- //$tmp .= " session.execute(\"set\", \"tts_voice=kal\");\n";
- //$tmp .= " session.execute(\"speak\", \"Your pin number is incorect, goodbye.\");\n";
- $tmp .= " session.streamFile( \"".$v_dir."/sounds/custom/8000/your_pin_number_is_incorect_goodbye.wav\", mycb, \"dtmf\");\n";
- $tmp .= " }\n";
- $tmp .= " session.hangup();\n";
- $tmp .= "\n";
- $tmp .= " }";
- fwrite($fout, $tmp);
- unset($tmp);
- fclose($fout);
-
-}
-
-
-function sync_package_v_settings()
-{
-
- global $config;
- $v_settings_array = $config['installedpackages']['freeswitchsettings']['config'][0];
- foreach($v_settings_array as $name => $value) {
- $$name = $value;
- }
-
- if($config['installedpackages']['freeswitchsettings']['config'] != "") {
-
- foreach($config['installedpackages']['freeswitchsettings']['config'] as $rowhelper) {
-
- $fout = fopen($v_conf_dir."/directory/default/default.xml","w");
- $tmpxml = "<include>\n";
- $tmpxml .= " <user id=\"default\"> <!--if id is numeric mailbox param is not necessary-->\n";
- $tmpxml .= " <variables>\n";
- $tmpxml .= " <!--all variables here will be set on all inbound calls that originate from this user -->\n";
- $tmpxml .= " <!-- set these to take advantage of a dialplan localized to this user -->\n";
- $tmpxml .= " <variable name=\"numbering_plan\" value=\"" . $rowhelper['numbering_plan'] . "\"/>\n";
- $tmpxml .= " <variable name=\"default_gateway\" value=\"" . $rowhelper['default_gateway'] . "\"/>\n";
- $tmpxml .= " <variable name=\"default_area_code\" value=\"" . $rowhelper['default_area_code'] . "\"/>\n";
- $tmpxml .= " </variables>\n";
- $tmpxml .= " </user>\n";
- $tmpxml .= "</include>\n";
- fwrite($fout, $tmpxml);
- unset($tmpxml);
- fclose($fout);
-
- $fout = fopen($v_conf_dir."/autoload_configs/event_socket.conf.xml","w");
- $tmpxml = "<configuration name=\"event_socket.conf\" description=\"Socket Client\">\n";
- $tmpxml .= " <settings>\n";
- $tmpxml .= " <param name=\"listen-ip\" value=\"0.0.0.0\"/>\n";
- $tmpxml .= " <param name=\"listen-port\" value=\"" . $rowhelper['event_socket_port'] . "\"/>\n";
- $tmpxml .= " <param name=\"password\" value=\"" . $rowhelper['event_socket_password'] . "\"/>\n";
- $tmpxml .= " <!--<param name=\"apply-inbound-acl\" value=\"lan\"/>-->\n";
- $tmpxml .= " </settings>\n";
- $tmpxml .= "</configuration>";
- fwrite($fout, $tmpxml);
- unset($tmpxml, $event_socket_password);
- fclose($fout);
-
- $fout = fopen($v_conf_dir."/autoload_configs/xml_rpc.conf.xml","w");
- $tmpxml = "<configuration name=\"xml_rpc.conf\" description=\"XML RPC\">\n";
- $tmpxml .= " <settings>\n";
- $tmpxml .= " <!-- The port where you want to run the http service (default 8080) -->\n";
- $tmpxml .= " <param name=\"http-port\" value=\"" . $rowhelper['xml_rpc_http_port'] . "\"/>\n";
- $tmpxml .= " <!-- if all 3 of the following params exist all http traffic will require auth -->\n";
- $tmpxml .= " <param name=\"auth-realm\" value=\"" . $rowhelper['xml_rpc_auth_realm'] . "\"/>\n";
- $tmpxml .= " <param name=\"auth-user\" value=\"" . $rowhelper['xml_rpc_auth_user'] . "\"/>\n";
- $tmpxml .= " <param name=\"auth-pass\" value=\"" . $rowhelper['xml_rpc_auth_pass'] . "\"/>\n";
- $tmpxml .= " </settings>\n";
- $tmpxml .= "</configuration>\n";
- fwrite($fout, $tmpxml);
- unset($tmpxml);
- fclose($fout);
-
- recording_js();
-
- //shout.conf.xml
- $fout = fopen($v_conf_dir."/autoload_configs/shout.conf.xml","w");
- $tmpxml = "<configuration name=\"shout.conf\" description=\"mod shout config\">\n";
- $tmpxml .= " <settings>\n";
- $tmpxml .= " <!-- Don't change these unless you are insane -->\n";
- $tmpxml .= " <param name=\"decoder\" value=\"" . $rowhelper['mod_shout_decoder'] . "\"/>\n";
- $tmpxml .= " <param name=\"volume\" value=\"" . $rowhelper['mod_shout_volume'] . "\"/>\n";
- $tmpxml .= " <!--<param name=\"outscale\" value=\"8192\"/>-->\n";
- $tmpxml .= " </settings>\n";
- $tmpxml .= "</configuration>";
- fwrite($fout, $tmpxml);
- unset($tmpxml);
- fclose($fout);
-
- //config.js
- $admin_pin = $config['installedpackages']['freeswitchsettings']['config'][0]['admin_pin'];
- $fout = fopen($v_scripts_dir."/config.js","w");
- $tmp = "//javascript include\n\n";
- $tmp .= "var admin_pin = \"" . $admin_pin . "\";\n";
- fwrite($fout, $tmp);
- unset($tmp);
- fclose($fout);
-
- }
-
- $cmd = "api reloadxml";
- //event_socket_request_cmd($cmd);
- unset($cmd);
- }
-}
-
-
-function sync_package_v_dialplan()
-{
-
- global $config;
- $v_settings_array = $config['installedpackages']['freeswitchsettings']['config'][0];
- foreach($v_settings_array as $name => $value) {
- $$name = $value;
- }
-
- //using backup files rather than pfsense config.xml for this file
- $config['installedpackages']['freeswitchpublic']['config'][0]['dialplan_default_xml'] = "";
-
- //if(strlen($config['installedpackages']['freeswitchdialplan']['config'][0]['dialplan_default_xml']) == 0) {
- /* dialplan not found in the pfsense config.xml get the default dialplan and save to config.xml. */
- //$filename = $v_conf_dir."/dialplan/default.xml";
- //$fout = fopen($filename,"r");
- //$tmpxml = fread($fout, filesize($filename));
- //$config['installedpackages']['freeswitchdialplan']['config'][0]['dialplan_default_xml'] = base64_encode($tmpxml);
- //unset($filename, $dialplan);
- //fclose($fout);
- //}
- //else {
- /* found the dialplan in the pfsense config.xml save it to default.xml. */
- //$fout = fopen($v_conf_dir."/dialplan/default.xml","w");
- //$tmpxml = $config['installedpackages']['freeswitchdialplan']['config'][0]['dialplan_default_xml'];
- //fwrite($fout, base64_decode($tmpxml));
- //fclose($fout);
- //unset($tmpxml);
- //}
-
- //$cmd = "api reloadxml";
- //event_socket_request_cmd($cmd);
- //unset($cmd);
-
-}
-
-
-function sync_package_v_extensions()
-{
-
- global $config;
- $v_settings_array = $config['installedpackages']['freeswitchsettings']['config'][0];
- foreach($v_settings_array as $name => $value) {
- $$name = $value;
- }
-
- if($config['installedpackages']['freeswitchextensions']['config'] != "") {
-
- /* delete all old extensions to prepare for new ones */
- unlink_if_exists($v_conf_dir."/directory/default/1*.xml");
- unlink_if_exists($v_conf_dir."/directory/default/2*.xml");
- unlink_if_exists($v_conf_dir."/directory/default/3*.xml");
- unlink_if_exists($v_conf_dir."/directory/default/4*.xml");
- unlink_if_exists($v_conf_dir."/directory/default/5*.xml");
- unlink_if_exists($v_conf_dir."/directory/default/6*.xml");
- unlink_if_exists($v_conf_dir."/directory/default/7*.xml");
- unlink_if_exists($v_conf_dir."/directory/default/8*.xml");
- unlink_if_exists($v_conf_dir."/directory/default/9*.xml");
-
- foreach($config['installedpackages']['freeswitchextensions']['config'] as $rowhelper) {
- if ($rowhelper['enabled'] != "false") {
- $fout = fopen($v_conf_dir."/directory/default/".$rowhelper['extension'].".xml","w");
-
- $tmpxml = "<include>\n";
- if (strlen($rowhelper['cidr']) == 0) {
- $tmpxml .= " <user id=\"" . $rowhelper['extension'] . "\" mailbox=\"" . $rowhelper['mailbox'] . "\">\n";
- }
- else {
- $tmpxml .= " <user id=\"" . $rowhelper['extension'] . "\" mailbox=\"" . $rowhelper['mailbox'] . "\" cidr=\"" . $rowhelper['cidr'] . "\">\n";
- }
- $tmpxml .= " <params>\n";
- $tmpxml .= " <param name=\"password\" value=\"" . $rowhelper['password'] . "\"/>\n";
- $tmpxml .= " <param name=\"vm-password\" value=\"" . $rowhelper['vm-password'] . "\"/>\n";
- if (strlen($rowhelper['vm-mailto']) > 0) {
- $tmpxml .= " <param name=\"vm-email-all-messages\" value=\"true\"/>\n";
-
- switch ($rowhelper['vm-attach-file']) {
- case "true":
- $tmpxml .= " <param name=\"vm-attach-file\" value=\"true\"/>\n";
- break;
- case "false":
- $tmpxml .= " <param name=\"vm-attach-file\" value=\"false\"/>\n";
- break;
- default:
- $tmpxml .= " <param name=\"vm-attach-file\" value=\"true\"/>\n";
- }
- switch ($rowhelper['vm-keep-local-after-email']) {
- case "true":
- $tmpxml .= " <param name=\"vm-keep-local-after-email\" value=\"true\"/>\n";
- break;
- case "false":
- $tmpxml .= " <param name=\"vm-keep-local-after-email\" value=\"false\"/>\n";
- break;
- default:
- $tmpxml .= " <param name=\"vm-keep-local-after-email\" value=\"true\"/>\n";
- }
- $tmpxml .= " <param name=\"vm-mailto\" value=\"" . $rowhelper['vm-mailto'] . "\"/>\n";
- }
- if (strlen($rowhelper['auth-acl']) > 0) {
- $tmpxml .= " <param name=\"auth-acl\" value=\"" . $rowhelper['auth-acl'] . "\"/>\n";
- }
- $tmpxml .= " </params>\n";
- $tmpxml .= " <variables>\n";
- $tmpxml .= " <variable name=\"toll_allow\" value=\"domestic,international,local\"/>\n";
- $tmpxml .= " <variable name=\"accountcode\" value=\"" . $rowhelper['accountcode'] . "\"/>\n";
- $tmpxml .= " <variable name=\"user_context\" value=\"" . $rowhelper['user_context'] . "\"/>\n";
- if (strlen($rowhelper['effective_caller_id_number']) > 0) {
- $tmpxml .= " <variable name=\"effective_caller_id_name\" value=\"" . $rowhelper['effective_caller_id_name'] . "\"/>\n";
- $tmpxml .= " <variable name=\"effective_caller_id_number\" value=\"" . $rowhelper['effective_caller_id_number'] . "\"/>\n";
- }
- if (strlen($rowhelper['outbound_caller_id_number']) > 0) {
- $tmpxml .= " <variable name=\"outbound_caller_id_name\" value=\"" . $rowhelper['outbound_caller_id_name'] . "\"/>\n";
- $tmpxml .= " <variable name=\"outbound_caller_id_number\" value=\"" . $rowhelper['outbound_caller_id_number'] . "\"/>\n";
- }
- if (strlen($rowhelper['sip-force-contact']) > 0) {
- $tmpxml .= " <variable name=\"sip-force-contact\" value=\"" . $rowhelper['sip-force-contact'] . "\"/>\n";
- }
- $tmpxml .= " </variables>\n";
- $tmpxml .= " </user>\n";
- $tmpxml .= "</include>\n";
- fwrite($fout, $tmpxml);
- unset($tmpxml);
- fclose($fout);
- }
- }
-
- $cmd = "api reloadxml";
- //event_socket_request_cmd($cmd);
- unset($cmd);
-
- }
-}
-
-
-function sync_package_v_gateways()
-{
-
- global $config;
- $v_settings_array = $config['installedpackages']['freeswitchsettings']['config'][0];
- foreach($v_settings_array as $name => $value) {
- $$name = $value;
- }
-
- if($config['installedpackages']['freeswitchgateways']['config'] != "") {
-
- /* delete all old gateways to prepare for new ones */
- unlink_if_exists($v_conf_dir."/sip_profiles/external/*.xml");
-
- foreach($config['installedpackages']['freeswitchgateways']['config'] as $rowhelper) {
-
- if ($rowhelper['enabled'] != "false") {
- $fout = fopen($v_conf_dir."/sip_profiles/external/".$rowhelper['gateway'].".xml","w");
-
- $tmpxml .= "<include>\n";
- $tmpxml .= " <gateway name=\"" . $rowhelper['gateway'] . "\">\n";
- if (strlen($rowhelper['username']) > 0) {
- $tmpxml .= " <param name=\"username\" value=\"" . $rowhelper['username'] . "\"/>\n";
- }
- if (strlen($rowhelper['auth-username']) > 0) {
- $tmpxml .= " <param name=\"auth-username\" value=\"" . $rowhelper['auth-username'] . "\"/>\n";
- }
- if (strlen($rowhelper['password']) > 0) {
- $tmpxml .= " <param name=\"password\" value=\"" . $rowhelper['password'] . "\"/>\n";
- }
- if (strlen($rowhelper['realm']) > 0) {
- $tmpxml .= " <param name=\"realm\" value=\"" . $rowhelper['realm'] . "\"/>\n";
- }
- if (strlen($rowhelper['from-user']) > 0) {
- $tmpxml .= " <param name=\"from-user\" value=\"" . $rowhelper['from-user'] . "\"/>\n";
- }
- if (strlen($rowhelper['from-domain']) > 0) {
- $tmpxml .= " <param name=\"from-domain\" value=\"" . $rowhelper['from-domain'] . "\"/>\n";
- }
- if (strlen($rowhelper['proxy']) > 0) {
- $tmpxml .= " <param name=\"proxy\" value=\"" . $rowhelper['proxy'] . "\"/>\n";
- }
- if (strlen($rowhelper['expire-seconds']) > 0) {
- $tmpxml .= " <param name=\"expire-seconds\" value=\"" . $rowhelper['expire-seconds'] . "\"/>\n";
- }
- if (strlen($rowhelper['register']) > 0) {
- $tmpxml .= " <param name=\"register\" value=\"" . $rowhelper['register'] . "\"/>\n";
- }
-
- if (strlen($rowhelper['register-transport']) > 0) {
- switch ($rowhelper['register-transport']) {
- case "udp":
- $tmpxml .= " <param name=\"register-transport\" value=\"udp\"/>\n";
- break;
- case "tcp":
- $tmpxml .= " <param name=\"register-transport\" value=\"tcp\"/>\n";
- break;
- case "tls":
- $tmpxml .= " <param name=\"register-transport\" value=\"tls\"/>\n";
- $tmpxml .= " <param name=\"contact-params\" value=\"transport=tls\"/>\n";
- break;
- default:
- $tmpxml .= " <param name=\"register-transport\" value=\"" . $rowhelper['register-transport'] . "\"/>\n";
- }
- }
-
- if (strlen($rowhelper['retry-seconds']) > 0) {
- $tmpxml .= " <param name=\"retry-seconds\" value=\"" . $rowhelper['retry-seconds'] . "\"/>\n";
- }
- if (strlen($rowhelper['extension']) > 0) {
- $tmpxml .= " <param name=\"extension\" value=\"" . $rowhelper['extension'] . "\"/>\n";
- }
- if (strlen($rowhelper['ping']) > 0) {
- $tmpxml .= " <param name=\"ping\" value=\"" . $rowhelper['ping'] . "\"/>\n";
- }
- if (strlen($rowhelper['context']) > 0) {
- $tmpxml .= " <param name=\"context\" value=\"" . $rowhelper['context'] . "\"/>\n";
- }
- if (strlen($rowhelper['caller-id-in-from']) > 0) {
- $tmpxml .= " <param name=\"caller-id-in-from\" value=\"" . $rowhelper['caller-id-in-from'] . "\"/>\n";
- }
- if (strlen($rowhelper['supress-cng']) > 0) {
- $tmpxml .= " <param name=\"supress-cng\" value=\"" . $rowhelper['supress-cng'] . "\"/>\n";
- }
-
- $tmpxml .= " </gateway>\n";
- $tmpxml .= "</include>";
-
- fwrite($fout, $tmpxml);
- unset($tmpxml);
- fclose($fout);
- }
-
- }
-
- $cmd = "api sofia profile external restart reloadxml";
- //event_socket_request_cmd($cmd);
- unset($cmd);
-
- }
-
-}
-
-
-function sync_package_v_modules()
-{
-
- global $config;
- $v_settings_array = $config['installedpackages']['freeswitchsettings']['config'][0];
- foreach($v_settings_array as $name => $value) {
- $$name = $value;
- }
-
- foreach($config['installedpackages']['freeswitchmodules']['config'] as $rowhelper) {
- $fout = fopen($v_conf_dir."/autoload_configs/modules.conf.xml","w");
-
- $tmpxml ="";
- $tmpxml .= "<configuration name=\"modules.conf\" description=\"Modules\">\n";
- $tmpxml .= " <modules>\n";
- $tmpxml .= "\n";
- $tmpxml .= " <!-- Loggers (I'd load these first) -->\n";
- if ($rowhelper['mod_console'] == "enable"){ $tmpxml .= " <load module=\"mod_console\"/>\n"; }
- if ($rowhelper['mod_logfile'] == "enable"){ $tmpxml .= " <load module=\"mod_logfile\"/>\n"; }
- if ($rowhelper['mod_syslog'] == "enable"){ $tmpxml .= " <load module=\"mod_syslog\"/>\n"; }
- $tmpxml .= "\n";
- if ($rowhelper['mod_yaml'] == "enable"){ $tmpxml .= " <load module=\"mod_yaml\"/>\n"; }
- $tmpxml .= "\n";
- $tmpxml .= " <!-- Multi-Faceted -->\n";
- $tmpxml .= " <!-- mod_enum is a dialplan interface, an application interface and an api command interface -->\n";
- if ($rowhelper['mod_enum'] == "enable"){ $tmpxml .= " <load module=\"mod_enum\"/>\n"; }
- $tmpxml .= "\n";
- $tmpxml .= " <!-- XML Interfaces -->\n";
- if ($rowhelper['mod_xml_rpc'] == "enable"){ $tmpxml .= " <load module=\"mod_xml_rpc\"/>\n"; }
- if ($rowhelper['mod_xml_curl'] == "enable"){ $tmpxml .= " <load module=\"mod_xml_curl\"/>\n"; }
- if ($rowhelper['mod_xml_cdr'] == "enable"){ $tmpxml .= " <load module=\"mod_xml_cdr\"/>\n"; }
- $tmpxml .= "\n";
- $tmpxml .= " <!-- Event Handlers -->\n";
- if ($rowhelper['mod_cdr_csv'] == "enable"){ $tmpxml .= " <load module=\"mod_cdr_csv\"/>\n"; }
- if ($rowhelper['mod_event_multicast'] == "enable"){ $tmpxml .= " <load module=\"mod_event_multicast\"/>\n"; }
- if ($rowhelper['mod_event_socket'] == "enable"){ $tmpxml .= " <load module=\"mod_event_socket\"/>\n"; }
- if ($rowhelper['mod_zeroconf'] == "enable"){ $tmpxml .= " <load module=\"mod_zeroconf\"/>\n"; }
- $tmpxml .= "\n";
- $tmpxml .= " <!-- Directory Interfaces -->\n";
- if ($rowhelper['mod_ldap'] == "enable"){ $tmpxml .= " <load module=\"mod_ldap\"/>\n"; }
- $tmpxml .= "\n";
- $tmpxml .= " <!-- Endpoints -->\n";
- if ($rowhelper['mod_dingaling'] == "enable"){ $tmpxml .= " <load module=\"mod_dingaling\"/>\n"; }
- if ($rowhelper['mod_iax'] == "enable"){ $tmpxml .= " <load module=\"mod_iax\"/>\n"; }
- if ($rowhelper['mod_portaudio'] == "enable"){ $tmpxml .= " <load module=\"mod_portaudio\"/>\n"; }
- if ($rowhelper['mod_alsa'] == "enable"){ $tmpxml .= " <load module=\"mod_alsa\"/>\n"; }
- if ($rowhelper['mod_sofia'] == "enable"){ $tmpxml .= " <load module=\"mod_sofia\"/>\n"; }
- if ($rowhelper['mod_loopback'] == "enable"){ $tmpxml .= " <load module=\"mod_loopback\"/>\n"; }
- if ($rowhelper['mod_wanpipe'] == "enable"){ $tmpxml .= " <load module=\"mod_wanpipe\"/>\n"; }
- if ($rowhelper['mod_woomera'] == "enable"){ $tmpxml .= " <load module=\"mod_woomera\"/>\n"; }
- if ($rowhelper['mod_openzap'] == "enable"){ $tmpxml .= " <load module=\"mod_openzap\"/>\n"; }
- $tmpxml .= "\n";
- $tmpxml .= " <!-- Applications -->\n";
- if ($rowhelper['mod_cidlookup'] == "enable"){ $tmpxml .= " <load module=\"mod_cidlookup\"/>\n"; }
- if ($rowhelper['mod_dptools'] == "enable"){ $tmpxml .= " <load module=\"mod_dptools\"/>\n"; }
- if ($rowhelper['mod_commands'] == "enable"){ $tmpxml .= " <load module=\"mod_commands\"/>\n"; }
- if ($rowhelper['mod_conference'] == "enable"){ $tmpxml .= " <load module=\"mod_conference\"/>\n"; }
- if ($rowhelper['mod_easyroute'] == "enable"){ $tmpxml .= " <load module=\"mod_easyroute\"/>\n"; }
- if ($rowhelper['mod_esf'] == "enable"){ $tmpxml .= " <load module=\"mod_esf\"/>\n"; }
- if ($rowhelper['mod_expr'] == "enable"){ $tmpxml .= " <load module=\"mod_expr\"/>\n"; }
- if ($rowhelper['mod_fax'] == "enable"){ $tmpxml .= " <load module=\"mod_fax\"/>\n"; }
- if ($rowhelper['mod_fifo'] == "enable"){ $tmpxml .= " <load module=\"mod_fifo\"/>\n"; }
- if ($rowhelper['mod_file_string'] == "enable"){ $tmpxml .= " <load module=\"mod_file_string\"/>\n"; }
- if ($rowhelper['mod_fsv'] == "enable"){ $tmpxml .= " <load module=\"mod_fsv\"/>\n"; }
- if ($rowhelper['mod_lcr'] == "enable"){ $tmpxml .= " <load module=\"mod_lcr\"/>\n"; }
- if ($rowhelper['mod_limit'] == "enable"){ $tmpxml .= " <load module=\"mod_limit\"/>\n"; }
- if ($rowhelper['mod_soundtouch'] == "enable"){ $tmpxml .= " <load module=\"mod_soundtouch\"/>\n"; }
- if ($rowhelper['mod_spy'] == "enable"){ $tmpxml .= " <load module=\"mod_spy\"/>\n"; }
- if ($rowhelper['mod_vmd'] == "enable"){ $tmpxml .= " <load module=\"mod_vmd\"/>\n"; }
- if ($rowhelper['mod_voicemail'] == "enable"){ $tmpxml .= " <load module=\"mod_voicemail\"/>\n"; }
- $tmpxml .= "\n";
- $tmpxml .= " <!-- SNOM Module -->\n";
- if ($rowhelper['mod_snom'] == "enable"){ $tmpxml .= " <load module=\"mod_snom\"/>\n"; }
- $tmpxml .= "\n";
- $tmpxml .= " <!-- Dialplan Interfaces -->\n";
- if ($rowhelper['mod_dialplan_directory'] == "enable"){ $tmpxml .= " <load module=\"mod_dialplan_directory\"/>\n"; }
- if ($rowhelper['mod_dialplan_xml'] == "enable"){ $tmpxml .= " <load module=\"mod_dialplan_xml\"/>\n"; }
- if ($rowhelper['mod_dialplan_asterisk'] == "enable"){ $tmpxml .= " <load module=\"mod_dialplan_asterisk\"/>\n"; }
- $tmpxml .= "\n";
- $tmpxml .= " <!-- Codec Interfaces -->\n";
- if ($rowhelper['mod_voipcodecs'] == "enable"){ $tmpxml .= " <load module=\"mod_voipcodecs\"/>\n"; }
- if ($rowhelper['mod_g723_1'] == "enable"){ $tmpxml .= " <load module=\"mod_g723_1\"/>\n"; }
- if ($rowhelper['mod_g729'] == "enable"){ $tmpxml .= " <load module=\"mod_g729\"/>\n"; }
- if ($rowhelper['mod_amr'] == "enable"){ $tmpxml .= " <load module=\"mod_amr\"/>\n"; }
- if ($rowhelper['mod_amrwb'] == "enable"){ $tmpxml .= " <load module=\"mod_amrwb\"/>\n"; }
- if ($rowhelper['mod_ilbc'] == "enable"){ $tmpxml .= " <load module=\"mod_ilbc\"/>\n"; }
- if ($rowhelper['mod_speex'] == "enable"){ $tmpxml .= " <load module=\"mod_speex\"/>\n"; }
- if ($rowhelper['mod_siren'] == "enable"){ $tmpxml .= " <load module=\"mod_siren\"/>\n"; }
- if ($rowhelper['mod_celt'] == "enable"){ $tmpxml .= " <load module=\"mod_celt\"/>\n"; }
- if ($rowhelper['mod_h26x'] == "enable"){ $tmpxml .= " <load module=\"mod_h26x\"/>\n"; }
- $tmpxml .= "\n";
- $tmpxml .= " <!-- File Format Interfaces -->\n";
- if ($rowhelper['mod_sndfile'] == "enable"){ $tmpxml .= " <load module=\"mod_sndfile\"/>\n"; }
- if ($rowhelper['mod_native_file'] == "enable"){ $tmpxml .= " <load module=\"mod_native_file\"/>\n"; }
- $tmpxml .= " <!--For icecast/mp3 streams/files-->\n";
- if ($rowhelper['mod_shout'] == "enable"){ $tmpxml .= " <load module=\"mod_shout\"/>\n"; }
- $tmpxml .= " <!--For local streams (play all the files in a directory)-->\n";
- if ($rowhelper['mod_local_stream'] == "enable"){ $tmpxml .= " <load module=\"mod_local_stream\"/>\n"; }
- if ($rowhelper['mod_tone_stream'] == "enable"){ $tmpxml .= " <load module=\"mod_tone_stream\"/>\n"; }
- $tmpxml .= "\n";
- $tmpxml .= " <!-- Timers -->\n";
- $tmpxml .= "\n";
- $tmpxml .= " <!-- Languages -->\n";
- if ($rowhelper['mod_spidermonkey'] == "enable"){ $tmpxml .= " <load module=\"mod_spidermonkey\"/>\n"; }
- if ($rowhelper['mod_spidermonkey_core_db'] == "enable"){ $tmpxml .= " <load module=\"mod_spidermonkey_core_db\"/>\n"; }
- if ($rowhelper['mod_spidermonkey_curl'] == "enable"){ $tmpxml .= " <load module=\"mod_spidermonkey_curl\"/>\n"; }
- if ($rowhelper['mod_spidermonkey_odbc'] == "enable"){ $tmpxml .= " <load module=\"mod_spidermonkey_odbc\"/>\n"; }
- if ($rowhelper['mod_spidermonkey_socket'] == "enable"){ $tmpxml .= " <load module=\"mod_spidermonkey_socket\"/>\n"; }
- if ($rowhelper['mod_spidermonkey_teletone'] == "enable"){ $tmpxml .= " <load module=\"mod_spidermonkey_teletone\"/>\n"; }
- if ($rowhelper['mod_perl'] == "enable"){ $tmpxml .= " <load module=\"mod_perl\"/>\n"; }
- if ($rowhelper['mod_python'] == "enable"){ $tmpxml .= " <load module=\"mod_python\"/>\n"; }
- if ($rowhelper['mod_java'] == "enable"){ $tmpxml .= " <load module=\"mod_java\"/>\n"; }
- if ($rowhelper['mod_lua'] == "enable"){ $tmpxml .= " <load module=\"mod_lua\"/>\n"; }
- $tmpxml .= "\n";
- $tmpxml .= " <!-- ASR /TTS -->\n";
- if ($rowhelper['mod_flite'] == "enable"){ $tmpxml .= " <load module=\"mod_flite\"/>\n"; }
- if ($rowhelper['mod_pocketsphinx'] == "enable"){ $tmpxml .= " <load module=\"mod_pocketsphinx\"/>\n"; }
- if ($rowhelper['mod_cepstral'] == "enable"){ $tmpxml .= " <load module=\"mod_cepstral\"/>\n"; }
- if ($rowhelper['mod_openmrcp'] == "enable"){ $tmpxml .= " <load module=\"mod_openmrcp\"/>\n"; }
- if ($rowhelper['mod_rss'] == "enable"){ $tmpxml .= " <load module=\"mod_rss\"/>\n"; }
- $tmpxml .= "\n";
- $tmpxml .= " <!-- Say -->\n";
- if ($rowhelper['mod_say_de'] == "enable"){ $tmpxml .= " <load module=\"mod_say_de\"/>\n"; }
- if ($rowhelper['mod_say_en'] == "enable"){ $tmpxml .= " <load module=\"mod_say_en\"/>\n"; }
- if ($rowhelper['mod_say_es'] == "enable"){ $tmpxml .= " <load module=\"mod_say_es\"/>\n"; }
- if ($rowhelper['mod_say_fr'] == "enable"){ $tmpxml .= " <load module=\"mod_say_fr\"/>\n"; }
- if ($rowhelper['mod_say_it'] == "enable"){ $tmpxml .= " <load module=\"mod_say_it\"/>\n"; }
- if ($rowhelper['mod_say_nl'] == "enable"){ $tmpxml .= " <load module=\"mod_say_nl\"/>\n"; }
- if ($rowhelper['mod_say_ru'] == "enable"){ $tmpxml .= " <load module=\"mod_say_ru\"/>\n"; }
- if ($rowhelper['mod_say_zh'] == "enable"){ $tmpxml .= " <load module=\"mod_say_zh\"/>\n"; }
- $tmpxml .= " </modules>\n";
- $tmpxml .= "</configuration>";
-
- fwrite($fout, $tmpxml);
- unset($tmpxml);
- fclose($fout);
- }
-
- $cmd = "api reloadxml";
- //event_socket_request_cmd($cmd);
- unset($cmd);
-
-}
-
-
-function sync_package_v_public()
-{
-
- global $config;
- $v_settings_array = $config['installedpackages']['freeswitchsettings']['config'][0];
- foreach($v_settings_array as $name => $value) {
- $$name = $value;
- }
-
- //using backup files rather than pfsense config.xml for this file
- $config['installedpackages']['freeswitchpublic']['config'][0]['public_xml'] = "";
-
- //if(strlen($config['installedpackages']['freeswitchpublic']['config'][0]['public_xml']) == 0) {
- // /* dialplan_public_xml not found in the pfsense config.xml get the default public.xml and save to config.xml. */
- // $filename = $v_conf_dir."/dialplan/public.xml";
- // $fout = fopen($filename,"r");
- // $tmpxml = fread($fout, filesize($filename));
- // $tmpxml = str_replace("<anti-action application=\"export\" data=\"domain_name=\${sip_req_host}\"/>", "<!--<anti-action application=\"export\" data=\"domain_name=\${sip_req_host}\"/>-->", $tmpxml);
- // $config['installedpackages']['freeswitchpublic']['config'][0]['public_xml'] = base64_encode($tmpxml);
-
- // unset($filename, $tmpxml);
- // fclose($fout);
- //}
- //else {
- // /* found dialplan_public_xml in the pfsense config.xml save it to public.xml. */
- // $fout = fopen($v_conf_dir."/dialplan/public.xml","w");
- // $tmpxml = $config['installedpackages']['freeswitchpublic']['config'][0]['public_xml'];
- // fwrite($fout, base64_decode($tmpxml));
- // fclose($fout);
- // unset($tmpxml);
- //}
-
- //$cmd = "api reloadxml";
- ////event_socket_request_cmd($cmd);
- //unset($cmd);
-
-}
-
-
-function sync_package_v_vars()
-{
-
- global $config;
- $v_settings_array = $config['installedpackages']['freeswitchsettings']['config'][0];
- foreach($v_settings_array as $name => $value) {
- $$name = $value;
- }
-
- //using backup files rather than pfsense config.xml for this file
- $config['installedpackages']['freeswitchpublic']['config'][0]['vars_xml'] = "";
-
- //if(strlen($config['installedpackages']['freeswitchvars']['config'][0]['vars_xml']) == 0) {
- // /* dialplan not found in the pfsense config.xml get the default dialplan and save to config.xml. */
- // $filename = $v_conf_dir."/vars.xml";
- // $fout = fopen($filename,"r");
- // $tmpxml = fread($fout, filesize($filename));
- // $config['installedpackages']['freeswitchvars']['config'][0]['vars_xml'] = base64_encode($tmpxml);
- // unset($filename, $dialplan);
- // fclose($fout);
- //}
- //else {
- // /* found the dialplan in the pfsense config.xml save it to default.xml. */
- // $fout = fopen($v_conf_dir."/vars.xml","w");
- // $tmpxml = $config['installedpackages']['freeswitchvars']['config'][0]['vars_xml'];
- // fwrite($fout, base64_decode($tmpxml));
- // fclose($fout);
- // unset($tmpxml);
- //}
-
- //$cmd = "api reloadxml";
- ////event_socket_request_cmd($cmd);
- //unset($cmd);
-
-}
-
-
-function sync_package_v_internal()
-{
- global $config;
- $v_settings_array = $config['installedpackages']['freeswitchsettings']['config'][0];
- foreach($v_settings_array as $name => $value) {
- $$name = $value;
- }
-
- if(strlen($config['installedpackages']['freeswitchinternal']['config'][0]['internal_xml']) == 0) {
- /* internal_xml not found in the pfsense config.xml get the internal.xml and save to config.xml. */
- $filename = $v_conf_dir."/sip_profiles/internal.xml";
- $fout = fopen($filename,"r");
- $tmpxml = fread($fout, filesize($filename));
- $config['installedpackages']['freeswitchinternal']['config'][0]['internal_xml'] = base64_encode($tmpxml);
- unset($filename, $dialplan);
- fclose($fout);
- }
- else {
- /* found the internal_xml in the pfsense config.xml save it to internal.xml. */
- $fout = fopen($v_conf_dir."/sip_profiles/internal.xml","w");
- $tmpxml = $config['installedpackages']['freeswitchinternal']['config'][0]['internal_xml'];
- fwrite($fout, base64_decode($tmpxml));
- fclose($fout);
- unset($tmpxml);
- }
-
- $cmd = "api reloadxml";
- //event_socket_request_cmd($cmd);
- unset($cmd);
-
-}
-
-
-function sync_package_v_external()
-{
- global $config;
- $v_settings_array = $config['installedpackages']['freeswitchsettings']['config'][0];
- foreach($v_settings_array as $name => $value) {
- $$name = $value;
- }
-
- if(strlen($config['installedpackages']['freeswitchexternal']['config'][0]['external_xml']) == 0) {
- /* external_xml not found in the pfsense config.xml get the external.xml and save to config.xml. */
- $filename = $v_conf_dir."/sip_profiles/external.xml";
- $fout = fopen($filename,"r");
- $tmpxml = fread($fout, filesize($filename));
- $config['installedpackages']['freeswitchexternal']['config'][0]['external_xml'] = base64_encode($tmpxml);
- unset($filename, $dialplan);
- fclose($fout);
- }
- else {
- /* found the external_xml in the pfsense config.xml save it to external.xml. */
- $fout = fopen($v_conf_dir."/sip_profiles/external.xml","w");
- $tmpxml = $config['installedpackages']['freeswitchexternal']['config'][0]['external_xml'];
- fwrite($fout, base64_decode($tmpxml));
- fclose($fout);
- unset($tmpxml);
- }
-
- $cmd = "api reloadxml";
- //event_socket_request_cmd($cmd);
- unset($cmd);
-
-}
-
-
-function sync_package_v_hunt_group()
-{
-
- //Hunt Group Javascript Notes:
- //get the domain
- //loop through all Hunt Groups
- //get the Hunt Group information such as the name and description
- //add each Hunt Group to the dialplan
- //get the list of destinations then build the Hunt Group javascript
-
-
- global $config;
- $v_settings_array = $config['installedpackages']['freeswitchsettings']['config'][0];
- foreach($v_settings_array as $name => $value) {
- $$name = $value;
- }
-
- //get the domain
- $password = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password'];
- $host = $config['interfaces']['lan']['ipaddr'];
- $port = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port'];
-
- if (pkg_is_service_running('freeswitch')) {
- $fp = event_socket_create($host, $port, $password);
- $cmd = "api global_getvar domain";
- $domain = trim(event_socket_request($fp, $cmd));
- }
-
- $tmp = "";
- $tmp .= "\n";
- $tmp .= " var domain = \"".$domain."\"; //by default this is the ipv4 address of FreeSWITCH used for transfer to voicemail\n";
- //$tmp .= " var exit = false;\n";
- $tmp .= "\n";
- $tmp .= "\n";
-
- //loop through all Hunt Groups
- $x = 0;
- $a_hunt_group = &$config['installedpackages']['freeswitchhuntgroup']['config'];
- if (count($a_hunt_group) > 0) {
- foreach($a_hunt_group as $rowhelper) {
-
- //get the Hunt Group information such as the name and description
- //$rowhelper['huntgroupid']
- //$rowhelper['huntgroupextension']
- //$rowhelper['huntgroupname']
- //$rowhelper['huntgrouptype']
- //$rowhelper['huntgrouptimeout']
- //$rowhelper['huntgroupcontext']
- //$rowhelper['huntgroupringback']
- //$rowhelper['huntgroupcidnameprefix']
- //$rowhelper['huntgrouppin']
- //$rowhelper['huntgroupcallerannounce']
- //$rowhelper['huntgroupdescr']
-
- //add each Hunt Group to the dialplan
- $a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config'];
- $a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config'];
-
- if (strlen($rowhelper['huntgroupid']) > 0) {
- $action = 'add'; //set default action to add
- $i = 0;
- if (count($a_dialplan_includes) > 0) {
-
- foreach($a_dialplan_includes as $row) {
-
- //$row['dialplanincludeid'];
- //$row['extensionname'];
- //$row['context'];
- //$row['enabled'];
-
- if ($row['opt1name'] == "huntgroupid" && $row['opt1value'] == $rowhelper['huntgroupid']) {
- $action = 'update';
- $dialplanincludeid = $row['dialplanincludeid'];
- $extensionname = $row['extensionname'];
- $order = $row['order'];
- $context = $row['context'];
- $enabled = $row['enabled'];
- $descr = $row['descr'];
- $opt1name = $row['opt1name'];
- $opt1value = $row['opt1value'];
- $id = $i;
- }
- $i++;
- }
- unset($i);
- }
-
-
- $ent = array();
- if ($action == 'add') {
- //create huntgroup extension in the dialplan
- $ent = array();
- $dialplanincludeid = guid();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['extensionname'] = $rowhelper['huntgroupname'];
- $ent['order'] = '9001'; //if update use the existing order number and extension name and desc
- $ent['context'] = $rowhelper['huntgroupcontext'];
- $ent['enabled'] = 'true';
- $ent['descr'] = 'huntgroup';
- $ent['opt1name'] = 'huntgroupid';
- $ent['opt1value'] = $rowhelper['huntgroupid'];
-
- $a_dialplan_includes[] = $ent; //add to the config
- unset($ent);
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'condition'; //condition, action, antiaction
- $ent['fieldtype'] = 'destination_number';
- $ent['fielddata'] = '^'.$rowhelper['huntgroupextension'].'$';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
-
- $huntgroupid = str_replace(array("{", "}"), "", $rowhelper['huntgroupid']);
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldtype'] = 'javascript';
- $ent['fielddata'] = 'huntgroup_'.$huntgroupid.'.js';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
-
- unset($huntgroupid);
-
- }
- if ($action == 'update') {
- //update the huntgroup
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['extensionname'] = $rowhelper['huntgroupname'];
- $ent['order'] = $order;
- $ent['context'] = $context;
- $ent['enabled'] = $enabled;
- $ent['descr'] = $descr;
- $ent['opt1name'] = $opt1name;
- $ent['opt1value'] = $opt1value;
-
- //update the config
- $a_dialplan_includes[$id] = $ent;
-
- unset($ent);
- unset($extensionname);
- unset($order);
- unset($context);
- unset($enabled);
- unset($descr);
- unset($opt1name);
- unset($opt1value);
- unset($id);
- }
- unset($action);
- unset($dialplanincludeid);
-
- //check whether the fifo queue exists already
- $action = 'add'; //set default action to add
- $i = 0;
- if (count($a_dialplan_includes) > 0) {
-
- foreach($a_dialplan_includes as $row) {
-
- //$row['dialplanincludeid'];
- //$row['extensionname'];
- //$row['context'];
- //$row['enabled'];
-
- if ($row['opt1name'] == "huntgroupfifoid" && $row['opt1value'] == $rowhelper['huntgroupid']) {
- $action = 'update';
- $dialplanincludeid = $row['dialplanincludeid'];
- $extensionname = $row['extensionname'];
- $order = $row['order'];
- $context = $row['context'];
- $enabled = $row['enabled'];
- $descr = $row['descr'];
- $opt1name = $row['opt1name'];
- $opt1value = $row['opt1value'];
- $id = $i;
- }
- $i++;
- }
- unset($i);
- }
-
- if ($action == 'add') {
-
- //create a fifo queue for each huntgroup
- $ent = array();
- $dialplanincludeid = guid();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['extensionname'] = $rowhelper['huntgroupname'].'.park';
- $ent['order'] = '9999'; //if update use the existing order number and extension name and desc
- $ent['context'] = $rowhelper['huntgroupcontext'];
- $ent['enabled'] = 'true';
- $ent['descr'] = 'fifo '.$rowhelper['huntgroupextension'];
- $ent['opt1name'] = 'huntgroupfifoid';
- $ent['opt1value'] = $rowhelper['huntgroupid'];
- $a_dialplan_includes[] = $ent; //add to the config
- unset($ent);
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'condition'; //condition, action, antiaction
- $ent['fieldtype'] = 'destination_number';
- $ent['fielddata'] = '^\*'.$rowhelper['huntgroupextension'].'$';
- $ent['fieldorder'] = '000';
- $a_dialplan_include_details[] = $ent; //add to the config
- unset($ent);
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldtype'] = 'set';
- $ent['fielddata'] = 'fifo_music=$${hold_music}';
- $ent['fieldorder'] = '001';
- $a_dialplan_include_details[] = $ent; //add to the config
- unset($ent);
-
- $huntgrouptimeouttype = $rowhelper['huntgrouptimeouttype'];
- $huntgrouptimeoutdestination = $rowhelper['huntgrouptimeoutdestination'];
- if ($huntgrouptimeouttype == "voicemail") { $huntgrouptimeoutdestination = '***'.$huntgrouptimeoutdestination; }
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldtype'] = 'set';
- $ent['fielddata'] = 'fifo_orbit_exten='.$huntgrouptimeoutdestination.':'.$rowhelper['huntgrouptimeout'];
- $ent['fieldorder'] = '002';
- $a_dialplan_include_details[] = $ent;
- unset($ent); //add to the config
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldtype'] = 'fifo';
- $ent['fielddata'] = $rowhelper['huntgroupextension'].'@${domain_name} in';
- $ent['fieldorder'] = '003';
- $a_dialplan_include_details[] = $ent; //add to the config
- unset($ent);
- }
- if ($action == 'update') {
- //update the huntgroup
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['extensionname'] = $rowhelper['huntgroupname'].'.park';
- $ent['order'] = $order;
- $ent['context'] = $rowhelper['huntgroupcontext'];
- $ent['enabled'] = $enabled;
- $ent['descr'] = 'fifo '.$rowhelper['huntgroupextension'];
- $ent['opt1name'] = $opt1name;
- $ent['opt1value'] = $opt1value;
-
- //update the config
- $a_dialplan_includes[$id] = $ent;
-
- unset($ent);
- unset($extensionname);
- unset($order);
- unset($context);
- unset($enabled);
- unset($descr);
- unset($opt1name);
- unset($opt1value);
- unset($id);
-
- //delete dialplan include details
- if (count($a_dialplan_include_details) > 0) {
- foreach($a_dialplan_include_details as $row) {
- if ($row['dialplanincludeid'] == $dialplanincludeid) {
- $id = $i;
- unset($a_dialplan_include_details[$id]);
- }
- $i++;
- }
- unset($i);
- }
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'condition'; //condition, action, antiaction
- $ent['fieldtype'] = 'destination_number';
- $ent['fielddata'] = '^\*'.$rowhelper['huntgroupextension'].'$';
- $ent['fieldorder'] = '000';
- $a_dialplan_include_details[] = $ent; //add to the config
- unset($ent);
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldtype'] = 'set';
- $ent['fielddata'] = 'fifo_music=$${hold_music}';
- $ent['fieldorder'] = '001';
- $a_dialplan_include_details[] = $ent; //add to the config
- unset($ent);
-
- $huntgrouptimeouttype = $rowhelper['huntgrouptimeouttype'];
- $huntgrouptimeoutdestination = $rowhelper['huntgrouptimeoutdestination'];
- if ($huntgrouptimeouttype == "voicemail") { $huntgrouptimeoutdestination = '***'.$huntgrouptimeoutdestination; }
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldtype'] = 'set';
- $ent['fielddata'] = 'fifo_orbit_exten='.$huntgrouptimeoutdestination.':'.$rowhelper['huntgrouptimeout'];
- $ent['fieldorder'] = '002';
- $a_dialplan_include_details[] = $ent;
- unset($ent); //add to the config
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldtype'] = 'fifo';
- $ent['fielddata'] = $rowhelper['huntgroupextension'].'@${domain_name} in';
- $ent['fieldorder'] = '003';
- $a_dialplan_include_details[] = $ent; //add to the config
- unset($ent);
- }
-
- write_config();
- sync_package_v_dialplan_includes();
- unset($dialplanincludeid);
-
- } //end if strlen huntgroupid; add the Hunt Group to the dialplan
-
-
-
- //Get the list of destinations then build the Hunt Group javascript
- $tmp = "";
- $tmp .= "\n";
- $tmp .= "session.answer();\n";
- $tmp .= "var domain_name = session.getVariable(\"domain_name\");\n";
- $tmp .= "var extension = '".$rowhelper['huntgroupextension']."';\n";
- $tmp .= "var result;\n";
- $tmp .= "var timeoutpin = 7500;\n";
- $tmp .= "\n";
- $tmp .= "var objdate = new Date();\n";
- $tmp .= "var adjusthours = 0; //Adjust Server time that is set to GMT 7 hours\n";
- $tmp .= "var adjustoperator = \"-\"; //+ or -\n";
- $tmp .= "if (adjustoperator == \"-\") {\n";
- $tmp .= "var objdate2 = new Date(objdate.getFullYear(),objdate.getMonth(),objdate.getDate(),(objdate.getHours() - adjusthours),objdate.getMinutes(),objdate.getSeconds());\n";
- $tmp .= "}\n";
- $tmp .= "if (adjustoperator == \"+\") {\n";
- $tmp .= "var objdate2 = new Date(objdate.getFullYear(),objdate.getMonth(),objdate.getDate(),(objdate.getHours() + adjusthours),objdate.getMinutes(),objdate.getSeconds());\n";
- $tmp .= "}\n";
- $tmp .= "var Hours = objdate2.getHours();\n";
- $tmp .= "var Mins = objdate2.getMinutes();\n";
- $tmp .= "var Seconds = objdate2.getSeconds();\n";
- $tmp .= "var Month = objdate2.getMonth() + 1;\n";
- $tmp .= "var Date = objdate2.getDate();\n";
- $tmp .= "var Year = objdate2.getYear()\n";
- $tmp .= "var Day = objdate2.getDay()+1;\n";
- $tmp .= "var exit = false;\n";
- $tmp .= "\n";
-
- $tmp .= " function get_sofia_contact(extension,domain_name, profile){\n";
- $tmp .= " if (profile == \"auto\") {\n";
- $i = 0;
- foreach (ListFiles($v_conf_dir.'/sip_profiles') as $key=>$sip_profile_file){
- $sip_profile_name = str_replace(".xml", "", $sip_profile_file);
- if ($i == 0) {
- $tmp .= " profile = \"".$sip_profile_name."\";\n";
- $tmp .= " session.execute(\"set\", \"sofia_contact_\"+extension+\"=\${sofia_contact(\"+profile+\"/\"+extension+\"@\"+domain_name+\")}\");\n";
- $tmp .= " sofia_contact = session.getVariable(\"sofia_contact_\"+extension);\n";
- }
- else {
- $tmp .= "\n";
- $tmp .= " if (sofia_contact == \"error/user_not_registered\") {\n";
- $tmp .= " profile = \"".$sip_profile_name."\";\n";
- $tmp .= " session.execute(\"set\", \"sofia_contact_\"+extension+\"=\${sofia_contact(\"+profile+\"/\"+extension+\"@\"+domain_name+\")}\");\n";
- $tmp .= " sofia_contact = session.getVariable(\"sofia_contact_\"+extension);\n";
- $tmp .= " }\n";
- }
- $i++;
- }
- unset ($i);
- $tmp .= " }\n";
- $tmp .= " else {\n";
- $tmp .= " session.execute(\"set\", \"sofia_contact_\"+extension+\"=\${sofia_contact(\"+profile+\"/\"+extension+\"@\"+domain_name+\")}\");\n";
- $tmp .= " sofia_contact = session.getVariable(\"sofia_contact_\"+extension);\n";
- $tmp .= " }\n";
- $tmp .= " console_log( \"info\", \"sofia_contact \"+profile+\": \"+sofia_contact+\".\\n\" );\n";
- $tmp .= " return sofia_contact;\n";
- $tmp .= " }\n";
- $tmp .= "\n";
-
- $tmp .= "\n";
- $tmp .= " function mycb( session, type, obj, arg ) {\n";
- $tmp .= " try {\n";
- $tmp .= " if ( type == \"dtmf\" ) {\n";
- $tmp .= " console_log( \"info\", \"digit: \"+obj.digit+\"\\n\" );\n";
- $tmp .= " if ( obj.digit == \"#\" ) {\n";
- $tmp .= " //console_log( \"info\", \"detected pound sign.\\n\" );\n";
- $tmp .= " exit = true;\n";
- $tmp .= " return( false );\n";
- $tmp .= " }\n";
- $tmp .= "\n";
- $tmp .= " dtmf.digits += obj.digit;\n";
- $tmp .= "\n";
- $tmp .= " if ( dtmf.digits.length >= digitmaxlength ) {\n";
- $tmp .= " exit = true;\n";
- $tmp .= " return( false );\n";
- $tmp .= " }\n";
- $tmp .= " }\n";
- $tmp .= " } catch (e) {\n";
- $tmp .= " console_log( \"err\", e+\"\\n\" );\n";
- $tmp .= " }\n";
- $tmp .= " return( true );\n";
- $tmp .= " } //end function mycb\n";
- $tmp .= "\n";
-
- $tmp .= "\n";
- $tmp .= "dialed_extension = session.getVariable(\"dialed_extension\");\n";
- $tmp .= "domain_name = session.getVariable(\"domain_name\");\n";
- $tmp .= "domain = session.getVariable(\"domain\");\n";
- $tmp .= "us_ring = session.getVariable(\"us-ring\");\n";
- $tmp .= "caller_id_name = session.getVariable(\"caller_id_name\");\n";
- $tmp .= "caller_id_number = session.getVariable(\"caller_id_number\");\n";
- $tmp .= "effective_caller_id_name = session.getVariable(\"effective_caller_id_name\");\n";
- $tmp .= "effective_caller_id_number = session.getVariable(\"effective_caller_id_number\");\n";
- $tmp .= "outbound_caller_id_name = session.getVariable(\"outbound_caller_id_name\");\n";
- $tmp .= "outbound_caller_id_number = session.getVariable(\"outbound_caller_id_number\");\n";
- $tmp .= "\n";
-
-
- //pin number requested from caller if provided
- if (strlen($rowhelper['huntgrouppin']) > 0) {
- $tmp .= "var pin = '".$rowhelper['huntgrouppin']."';\n";
- $tmp .= "if (pin.length > 0) {\n";
- $tmp .= " var dtmf = new Object();\n";
- $tmp .= " dtmf.digits = \"\";\n";
- $tmp .= " digitmaxlength = 6;\n";
- $tmp .= " session.execute(\"set\", \"playback_terminators=#\");\n";
- $tmp .= " session.streamFile( \"".$v_dir."/sounds/custom/8000/please_enter_the_pin_number.wav\", mycb, \"dtmf\");\n";
- $tmp .= " session.collectInput( mycb, dtmf, timeoutpin );\n";
- $tmp .= "\n";
- $tmp .= " if (dtmf.digits == pin || pin.length == 0) {\n";
- $tmp .= " //continue\n";
- $tmp .= " }\n";
- $tmp .= " else {\n";
- $tmp .= " console_log( \"info\", \"Pin: \" + dtmf.digits + \" is incorrect\\n\" );\n";
- $tmp .= " session.streamFile( \"".$v_conf_dir."/sounds/custom/8000/your_pin_number_is_incorect_goodbye.wav\", mycb, \"dtmf\");\n";
- $tmp .= " session.hangup();\n";
- $tmp .= " }\n";
- $tmp .= "}\n";
- $tmp .= "\n";
- }
-
- //caller announce requested from caller if provided
- if ($rowhelper['huntgroupcallerannounce'] == "true") {
- $tmp .= "function originate(session, sipuri, extension, caller_announce, caller_id_name, caller_id_number) {\n";
- $tmp .= " caller_id_name = caller_id_name.replace(\" \", \"+\");\n";
- $tmp .= " apiExecute(\"jsrun\", \"originate.js \"+session.uuid+\" \"+sipuri+\" \"+extension+\" \"+caller_announce+\" \"+caller_id_name+\" \"+caller_id_number);\n";
- $tmp .= "}";
- $tmp .= "\n";
- $tmp .= "var caller_announce = extension+\"_\"+Year+Month+Day+Hours+Mins+Seconds+\".wav\";\n";
- $tmp .= "session.streamFile( \"".$v_dir."/sounds/custom/8000/please_say_your_name_and_reason_for_calling.wav\");\n";
- $tmp .= "session.execute(\"gentones\", \"%(1000, 0, 640)\");\n";
- $tmp .= "session.execute(\"set\", \"playback_terminators=#\");\n";
- $tmp .= "session.execute(\"record\", \"".$tmp_dir."/\"+caller_announce+\" 180 200\");\n";
- $tmp .= "\n";
- $tmp .= "result = session.setAutoHangup(false);\n";
- $tmp .= "session.execute(\"transfer\", \"*\"+extension+\" XML default\");\n";
- $tmp .= "\n";
- }
-
- //set caller id prefix
- if (strlen($rowhelper['huntgroupcidnameprefix'])> 0) {
- $tmp .= "session.execute(\"set\", \"caller_id_name=".$rowhelper['huntgroupcidnameprefix']."\"+caller_id_name);\n";
- $tmp .= "session.execute(\"set\", \"effective_caller_id_name=".$rowhelper['huntgroupcidnameprefix']."\"+effective_caller_id_name);\n";
- $tmp .= "session.execute(\"set\", \"outbound_caller_id_name=".$rowhelper['huntgroupcidnameprefix']."\"+outbound_caller_id_name);\n";
- }
-
- //set ring back
- if (isset($rowhelper['huntgroupringback'])){
- if ($rowhelper['huntgroupringback'] == "ring"){
- $tmp .= "session.execute(\"set\", \"ringback=\"+us_ring); //set to ringtone\n";
- $tmp .= "session.execute(\"set\", \"transfer_ringback=\"+us_ring); //set to ringtone\n";
- }
- if ($rowhelper['huntgroupringback'] == "music"){
- $tmp .= "session.execute(\"set\", \"ringback=\${hold_music}\"); //set to ringtone\n";
- $tmp .= "session.execute(\"set\", \"transfer_ringback=\${hold_music}\"); //set to ringtone\n";
- }
- }
- else {
- $tmp .= "session.execute(\"set\", \"ringback=\${hold_music}\"); //set to ringtone\n";
- $tmp .= "session.execute(\"set\", \"transfer_ringback=\${hold_music}\"); //set to ringtone\n";
- }
-
- if ($rowhelper['huntgrouptimeout'] > 0) {
- $tmp .= "session.execute(\"set\", \"call_timeout=".$rowhelper['huntgrouptimeout']."\");\n";
- $tmp .= "session.execute(\"set\", \"continue_on_fail=true\");\n";
- }
- $tmp .= "session.execute(\"set\", \"hangup_after_bridge=true\");\n";
- $tmp .= "\n";
- $tmp .= "//console_log( \"info\", \"dialed extension:\"+dialed_extension+\".\\n\" );\n";
- $tmp .= "//console_log( \"info\", \"domain: \"+domain+\".\\n\" );\n";
- $tmp .= "//console_log( \"info\", \"us_ring: \"+us_ring+\".\\n\" );\n";
- $tmp .= "//console_log( \"info\", \"domain: \"+domain+\".\\n\" );\n";
- $tmp .= "//console_log( \"info\", \"domain_name: \"+domain_name+\".\\n\" );\n";
- $tmp .= "\n";
-
- $tmp .= "//console_log( \"info\", \"action call now don't wait for dtmf\\n\" );\n";
- if ($rowhelper['huntgroupcallerannounce'] == "true") {
- //do nothing
- }
- else {
- $tmp .= "if ( session.ready() ) {\n";
- $tmp .= " session.answer();\n";
- }
- $tmp .= "\n";
-
- $a_hunt_group = &$config['installedpackages']['freeswitchhuntgroup']['config'];
- if (isset($id) && $a_hunt_group[0]) {
- $huntgrouptimeout = $a_hunt_group[$id]['huntgrouptimeout'];
- $huntgrouptimeoutdestination = $a_hunt_group[$id]['huntgrouptimeoutdestination'];
- }
-
- //order the array
- if (!function_exists(cmp_hunt_group_order)) {
- function cmp_hunt_group_order($a, $b) {
- if ($a["destinationorder"] > $b["destinationorder"]) {
- return 1;
- }
- else {
- return 0;
- }
- }
- }
-
-
- $a_hunt_group_destinations = &$config['installedpackages']['freeswitchhuntgroupdestinations']['config'];
- if (count($a_hunt_group_destinations) > 0) { usort($a_hunt_group_destinations, "cmp_hunt_group_order"); }
- if (count($a_hunt_group_destinations) > 0) {
-
- $i = 0;
- foreach($a_hunt_group_destinations as $row) {
-
- /*
- $row['huntgroupid']
- $row['destinationnumber']
- $row['destinationtype']
- $row['destinationprofile']
- $row['destinationorder']
- $row['destinationdescr']
- */
-
- if ($row['huntgroupid'] == $rowhelper['huntgroupid']) {
-
- //set the default profile
- if (strlen($row['destinationnumber']) == 0) { $row['destinationnumber'] = "internal"; }
-
- if ($row['destinationtype'] == "extension") {
- $tmp .= "sofia_contact_".$row['destinationnumber']." = get_sofia_contact(\"".$row['destinationnumber']."\",domain_name, \"".$row['destinationprofile']."\");\n";
- $tmp_sub_array["application"] = "bridge";
- $tmp_sub_array["data"] = "sofia_contact_".$row['destinationnumber'];
- $tmp_array[$i] = $tmp_sub_array;
- unset($tmp_sub_array);
- }
- if ($row['destinationtype'] == "voicemail") {
- $tmp_sub_array["application"] = "voicemail";
- $tmp .= "session.execute(\"voicemail\", \"default \${domain} ".$row['destinationnumber']."\");\n";
- //$tmp_sub_array["application"] = "voicemail";
- //$tmp_sub_array["data"] = "default \${domain} ".$row['destinationnumber'];
- //$tmp_array[$i] = $tmp_sub_array;
- unset($tmp_sub_array);
- }
- if ($row['destinationtype'] == "sip uri") {
- $tmp_sub_array["application"] = "bridge";
- $tmp_sub_array["data"] = "\"".$row['destinationnumber']."\"";
- $tmp_array[$i] = $tmp_sub_array;
- unset($tmp_sub_array);
- }
- $i++;
-
- } //end huntgroupid
-
- } //end for each
- unset($i);
- } //if count
-
- $i = 0;
- if(count($tmp_array) > 0) {
- foreach ($tmp_array as $row) {
- $tmpdata = $row["data"];
- if ($row["application"] == "voicemail") { $tmpdata = "***".$tmpdata; }
- if ($i < 1) {
- $tmp_buffer = $tmpdata;
- }
- else {
- $tmp_buffer .= "+\",\"+".$tmpdata;
- }
- $i++;
- }
- }
- unset($i);
- $delimiter = ",";
- $tmp_application = $tmp_array[0]["application"];
-
- switch ($rowhelper['huntgrouptype']) {
- case "simultaneous":
- //print_r($tmp_array);
- if ($rowhelper['huntgroupcallerannounce'] == "true") {
- $i = 0;
- if (count($tmp_array) > 0) {
- foreach ($tmp_array as $row) {
- $tmpdata = $row["data"];
- if ($row["application"] == "voicemail") { $tmpdata = "***".$tmpdata; }
- $tmp .= " result = originate (session, ".$tmpdata.", extension, caller_announce, caller_id_name, caller_id_number);\n";
- }
- }
- }
- else {
- $tmp .= "\n";
- $tmp .= " session.execute(\"".$tmp_application."\", $tmp_buffer);\n";
- //$tmp .= " session.execute(\"bridge\", sofia_contact_100+\",\"+sofia_contact_101+\",\"+sofia_contact_102+\",\"+sofia_contact_103+\",\"+sofia_contact_104);\n";
- //$tmp .= " //session.execute(\"bridge\", \"sofia/gateway/flowroute.com/12081231234,\"+sofia_contact_101);\n";
- }
- unset($tmp_array);
- break;
- case "sequentially":
-
- $tmp .= "\n";
- //print_r($tmp_array);
- $i = 0;
- if (count($tmp_array) > 0) {
- if ($rowhelper['huntgroupcallerannounce'] == "true") {
- $i = 0;
- if (count($tmp_array) > 0) {
- //foreach ($tmp_array as $row) {
- //$tmpdata = $row["data"];
- //if ($row["application"] == "voicemail") { $tmpdata = "***".$tmpdata; }
- $tmp .= " result = originate (session, ".$tmp_buffer.", extension, caller_announce, caller_id_name, caller_id_number);\n";
- //}
- }
- }
- else {
- foreach ($tmp_array as $row) {
- $tmp .= " session.execute(\"".$row["application"]."\", ".$row["data"].");\n";
- }
- }
- unset($tmp_array);
- }
-
- break;
- }
-
- //set the timeout destination
- $huntgrouptimeoutdestination = $a_hunt_group[$x]['huntgrouptimeoutdestination'];
- $huntgrouptimeouttype = $a_hunt_group[$x]['huntgrouptimeouttype'];
- if ($huntgrouptimeouttype == "extension") { $huntgrouptimeouttype = "bridge"; }
- if ($huntgrouptimeouttype == "voicemail") { $huntgrouptimeouttype = "transfer"; $huntgrouptimeoutdestination = "*99".$huntgrouptimeoutdestination; }
- if ($huntgrouptimeouttype == "sip uri") { $huntgrouptimeouttype = "bridge"; }
- $tmp .= "\n";
- if ($row['huntgroupcallerannounce'] == "true") {
- //do nothing
- }
- else {
- $tmp .= " //timeout\n";
- $tmp .= " session.execute(\"".$huntgrouptimeouttype."\", \"".$huntgrouptimeoutdestination."\");\n";
- }
-
- $tmp .= "\n";
- $tmp .= " //clear variables\n";
- $tmp .= " dialed_extension = \"\";\n";
- $tmp .= " new_extension = \"\";\n";
- $tmp .= " domain_name = \"\";\n";
- $tmp .= " domain = \"\";";
-
- $tmp .= "\n";
- if ($rowhelper['huntgroupcallerannounce'] == "true") {
- //do nothing
- }
- else {
- $tmp .= "} //end if session.ready\n";
- }
- $tmp .= "\n";
-
- if (strlen($rowhelper['huntgroupid']) > 0) {
- $huntgroupfilename = "huntgroup_".str_replace(array("{", "}"), "", $rowhelper['huntgroupid']).".js";
- $fout = fopen($v_scripts_dir."/".$huntgroupfilename,"w");
- fwrite($fout, $tmp);
- unset($huntgroupfilename);
- fclose($fout);
- }
-
- $x++;
- } //end foreach
- } //end if count
-
-} //end function
-
-
-function sync_package_v_fax()
-{
-
- global $config;
- $v_settings_array = $config['installedpackages']['freeswitchsettings']['config'][0];
- foreach($v_settings_array as $name => $value) {
- $$name = $value;
- }
-
- //loop through all faxes
- $a_fax = &$config['installedpackages']['freeswitchfax']['config'];
- if (count($a_fax) > 0) {
- foreach($a_fax as $rowhelper) {
-
- //get the fax information such as the name and description
- //$rowhelper['faxid']
- //$rowhelper['faxextension']
- //$rowhelper['faxname']
- //$rowhelper['faxemail']
- //$rowhelper['faxdomain']
- //$rowhelper['faxdescription']
-
- //add each fax extension to the dialplan
- $a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config'];
- $a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config'];
-
- //determine if the entry should be an add, or update to the dialplan
- if (strlen($rowhelper['faxid']) > 0) {
- $action = 'add'; //set default action to add
- $i = 0;
- if (count($a_dialplan_includes) > 0) {
-
- foreach($a_dialplan_includes as $row) {
-
- //$row['faxid'];
- //$row['faxname'];
- //$row['context'];
- //$row['enabled'];
-
- if ($row['opt1name'] == "faxid" && $row['opt1value'] == $rowhelper['faxid']) {
- //update
- $action = 'update';
-
- $dialplanincludeid = $rowhelper['dialplanincludeid'];
- $extensionname = $row['extensionname'];
- $order = $row['order'];
- $context = $row['context'];
- $enabled = $row['enabled'];
- $descr = $row['descr'];
- $opt1name = $row['opt1name'];
- $opt1value = $row['opt1value'];
- $id = $i;
- //echo "update".$i."<br />\n";
-
- if (file_exists($v_conf_dir."/dialplan/default/".$order."_".$extensionname.".xml")){
- unlink($v_conf_dir."/dialplan/default/".$order."_".$extensionname.".xml");
- }
- }
- $i++;
-
- }
- }
-
- $ent = array();
- if ($action == 'add') {
- $faxid = $rowhelper['faxid'];
- if (strlen($rowhelper['faxname']) > 0) {
- $ent['dialplanincludeid'] = $faxid;
- $ent['extensionname'] = $rowhelper['faxname'];
- $ent['order'] = '9001'; //if update use the existing order number and extension name and desc
- $ent['context'] = "default";
- //$ent['context'] = $rowhelper['huntgroupcontext'];
- $ent['enabled'] = 'true';
- $ent['descr'] = 'fax';
- $ent['opt1name'] = 'faxid';
- $ent['opt1value'] = $rowhelper['faxid'];
-
- //add to the config
- $a_dialplan_includes[] = $ent;
- unset($ent);
-
- //<!-- default ${domain_name} -->
- //<condition field="destination_number" expression="^\*9978$">
- $ent = array();
- $ent['dialplanincludeid'] = $faxid;
- $ent['tag'] = 'condition'; //condition, action, antiaction
- $ent['fieldorder'] = '000';
- $ent['fieldtype'] = 'destination_number';
- $ent['fielddata'] = '^'.$rowhelper['faxextension'].'$';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
-
- //<action application="answer" />
- $ent = array();
- $ent['dialplanincludeid'] = $faxid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldorder'] = '001';
- $ent['fieldtype'] = 'answer';
- $ent['fielddata'] = '';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
-
- //<action application="playback" data="silence_stream://2000"/>
- $ent = array();
- $ent['dialplanincludeid'] = $faxid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldorder'] = '002';
- $ent['fieldtype'] = 'playback';
- $ent['fielddata'] = 'silence_stream://2000';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
-
- //<action application="set" data="last_fax=${caller_id_number}-${strftime(%Y-%m-%d-%H-%M-%S)}"/>
- $ent = array();
- $ent['dialplanincludeid'] = $faxid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldorder'] = '003';
- $ent['fieldtype'] = 'set';
- $ent['fielddata'] = 'last_fax=${caller_id_number}-${strftime(%Y-%m-%d-%H-%M-%S)}';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
-
- //<action application="rxfax" data="$v_storage_dir/fax/inbox/${last_fax}.tif"/>
- $ent = array();
- $ent['dialplanincludeid'] = $faxid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldorder'] = '004';
- $ent['fieldtype'] = 'rxfax';
- $ent['fielddata'] = $v_storage_dir.'/fax/'.$rowhelper['faxextension'].'/inbox/${last_fax}.tif';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
-
- //<action application="system" data="$v_scripts_dir/emailfax.sh USER DOMAIN $v_storage_dir/fax/inbox/9872/${last_fax}.tif"/>
- $ent = array();
- $ent['dialplanincludeid'] = $faxid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldorder'] = '005';
- $ent['fieldtype'] = 'system';
- $ent['fielddata'] = $php_dir.' '.$v_web_dir.'/fax_to_email.php email='.$rowhelper['faxemail'].' extension='.$rowhelper['faxextension'].' name=${last_fax} >> '.$tmp_dir.'/fax.txt';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
-
- //<action application="hangup"/>
- $ent = array();
- $ent['dialplanincludeid'] = $faxid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldorder'] = '006';
- $ent['fieldtype'] = 'hangup';
- $ent['fielddata'] = '';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
- }
-
- unset($faxid);
-
- }
- if ($action == 'update') {
-
- $ent['dialplanincludeid'] = $rowhelper['faxid'];
- $ent['extensionname'] = $rowhelper['faxname'];
- $ent['order'] = $order;
- $ent['context'] = $context;
- $ent['enabled'] = $enabled;
- $ent['descr'] = $faxdescription;
- $ent['opt1name'] = $opt1name;
- $ent['opt1value'] = $opt1value;
-
- //update the config
- $a_dialplan_includes[$id] = $ent;
-
- unset($ent);
- unset($extensionname);
- unset($order);
- unset($context);
- unset($enabled);
- unset($descr);
- unset($opt1name);
- unset($opt1value);
- unset($id);
- }
- write_config();
-
- sync_package_v_dialplan_includes();
- unset($dialplanincludeid);
-
- } //end if strlen faxid; add the fax to the dialplan
-
- } //end foreach
- } //end if count
-
-} //end function
-
-
-function get_recording_filename($id)
-{
- global $config;
- $a_recordings = &$config['installedpackages']['freeswitchrecordings']['config'];
- if (count($a_recordings) > 0) {
- foreach($a_recordings as $rowhelper) {
- if ($rowhelper['recordingid'] == $id) {
- return $rowhelper['filename'];
- }
- }
- }
-}
-
-
-function sync_package_v_ivr()
-{
-
- global $config;
- $v_settings_array = $config['installedpackages']['freeswitchsettings']['config'][0];
- foreach($v_settings_array as $name => $value) {
- $$name = $value;
- }
-
- $a_ivr = &$config['installedpackages']['freeswitchivr']['config'];
- if (count($a_ivr) > 0) {
- foreach($a_ivr as $rowhelper) {
-
- /*
- $rowhelper['ivrid']
- $rowhelper['ivrextension']
- $rowhelper['ivrname']
- $rowhelper['recordingid']
- $rowhelper['ivrtimeout']
- $rowhelper['ivrcalltimeout']
- $rowhelper['ivrcontext']
- $rowhelper['ivrdirectdial']
- $rowhelper['ivrconditionjs']
- $rowhelper['ivrringback']
- $rowhelper['ivrcidnameprefix']
- $rowhelper['ivrdescr']
- */
-
- $a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config'];
- $a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config'];
-
-
- //add the IVR to the dialplan
- if (strlen($rowhelper['ivrid']) > 0) {
- $action = 'add'; //set default action to add
- $i = 0;
- if (count($a_dialplan_includes) > 0) {
- foreach($a_dialplan_includes as $row) {
-
- //$row['dialplanincludeid'];
- //$row['extensionname'];
- //$row['context'];
- //$row['enabled'];
- //echo "if (".$row['opt1name']." == \"ivrid\" && ".$row['opt1value']." == ".$rowhelper['ivrid'].") \n";
-
- if ($row['opt1name'] == "ivrid" && $row['opt1value'] == $rowhelper['ivrid']) {
- //update
- $action = 'update';
- $dialplanincludeid = $row['dialplanincludeid'];
- $extensionname = $row['extensionname'];
- $order = $row['order'];
- $context = $row['context'];
- $enabled = $row['enabled'];
- $descr = $row['descr'];
- $opt1name = $row['opt1name'];
- $opt1value = $row['opt1value'];
- $id = $i;
- //echo "update".$i."<br />\n";
-
- }
- $i++;
-
- } //end foreach
- } //if count
-
-
- $ent = array();
- if ($action == 'add') {
-
- $dialplanincludeid = guid();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['extensionname'] = $rowhelper['ivrextension'];
- $ent['order'] = '9001'; //if update use the existing order number and extension name and desc
- $ent['context'] = $rowhelper['ivrcontext'];
- $ent['enabled'] = 'true';
- $ent['descr'] = 'IVR';
- $ent['opt1name'] = 'ivrid';
- $ent['opt1value'] = $rowhelper['ivrid'];
-
- //add to the config
- $a_dialplan_includes[] = $ent;
- unset($ent);
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'condition'; //condition, action, antiaction
- $ent['fieldtype'] = 'destination_number';
- $ent['fielddata'] = '^'.$rowhelper['ivrextension'].'$';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
-
- $ivrid = str_replace(array("{", "}"), "", $rowhelper['ivrid']);
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldtype'] = 'javascript';
- $ent['fielddata'] = 'ivr_'.$ivrid.'.js';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
-
- unset($ivrid);
-
- }
- if ($action == 'update') {
-
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['extensionname'] = $rowhelper['ivrextension'];
- $ent['order'] = $order;
- $ent['context'] = $context;
- $ent['enabled'] = $enabled;
- $ent['descr'] = $descr;
- $ent['opt1name'] = $opt1name;
- $ent['opt1value'] = $opt1value;
-
- //update the config
- $a_dialplan_includes[$id] = $ent;
-
- unset($ent);
- unset($extensionname);
- unset($order);
- unset($context);
- unset($enabled);
- unset($descr);
- unset($opt1name);
- unset($opt1value);
- unset($id);
- }
- write_config();
-
- sync_package_v_dialplan_includes();
- unset($dialplanincludeid);
-
- } //end if strlen ivrid; add the IVR to the dialplan
-
- // Build the IVR javascript
- $recording_action_filename = get_recording_filename($rowhelper['recordingidaction']);
- $recording_antiaction_filename = get_recording_filename($rowhelper['recordingidantiaction']);
-
- $password = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password'];
- $port = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port'];
- $host = $config['interfaces']['lan']['ipaddr'];
-
- if (pkg_is_service_running('freeswitch')) {
- $fp = event_socket_create($host, $port, $password);
- $cmd = "api global_getvar domain";
- $domain = trim(event_socket_request($fp, $cmd));
- }
-
-
- $tmp = ""; //make sure the variable starts with no value
- $tmp .= "\n";
- $tmp .= " var condition = true;\n";
- $tmp .= "\n";
- $tmp .= " var domain = \"".$domain."\"; //by default this is the ipv4 address of FreeSWITCH used for transfer to voicemail\n";
- $tmp .= " var digitmaxlength = 0;\n";
- $tmp .= " var objdate = new Date();\n";
- $tmp .= "\n";
- $tmp .= " var adjusthours = 0; //Adjust Server time that is set to GMT 7 hours\n";
- $tmp .= " var adjustoperator = \"-\"; //+ or -\n";
- $tmp .= "\n";
- $tmp .= " if (adjustoperator == \"-\") {\n";
- $tmp .= " var objdate2 = new Date(objdate.getFullYear(),objdate.getMonth(),objdate.getDate(),(objdate.getHours() - adjusthours),objdate.getMinutes(),objdate.getSeconds());\n";
- $tmp .= " }\n";
- $tmp .= " if (adjustoperator == \"+\") {\n";
- $tmp .= " var objdate2 = new Date(objdate.getFullYear(),objdate.getMonth(),objdate.getDate(),(objdate.getHours() + adjusthours),objdate.getMinutes(),objdate.getSeconds());\n";
- $tmp .= " }\n";
- $tmp .= "\n";
- $tmp .= " var Hours = objdate2.getHours();\n";
- $tmp .= " var Mins = objdate2.getMinutes();\n";
- $tmp .= " var Seconds = objdate2.getSeconds();\n";
- $tmp .= " var Month = objdate2.getMonth() + 1;\n";
- $tmp .= " var Date = objdate2.getDate();\n";
- $tmp .= " var Year = objdate2.getYear()\n";
- $tmp .= " var Day = objdate2.getDay()+1;\n";
- $tmp .= " var exit = false;\n";
- $tmp .= "\n";
- $tmp .= " dialed_extension = session.getVariable(\"dialed_extension\");\n";
- $tmp .= " domain_name = session.getVariable(\"domain_name\");\n";
- $tmp .= " domain = session.getVariable(\"domain\");\n";
- $tmp .= " us_ring = session.getVariable(\"us-ring\");\n";
- $tmp .= " caller_id_name = session.getVariable(\"caller_id_name\");\n";
- $tmp .= " caller_id_number = session.getVariable(\"caller_id_number\");\n";
- $tmp .= " effective_caller_id_name = session.getVariable(\"effective_caller_id_name\");\n";
- $tmp .= " effective_caller_id_number = session.getVariable(\"effective_caller_id_number\");\n";
- $tmp .= " outbound_caller_id_name = session.getVariable(\"outbound_caller_id_name\");\n";
- $tmp .= " outbound_caller_id_number = session.getVariable(\"outbound_caller_id_number\");\n";
- $tmp .= "\n";
-
- //set caller id prefix
- if (strlen($rowhelper['ivrcidnameprefix'])> 0) {
- $tmp .= "session.execute(\"set\", \"caller_id_name=".$rowhelper['ivrcidnameprefix']."\"+caller_id_name);\n";
- $tmp .= "session.execute(\"set\", \"effective_caller_id_name=".$rowhelper['ivrcidnameprefix']."\"+effective_caller_id_name);\n";
- $tmp .= "session.execute(\"set\", \"outbound_caller_id_name=".$rowhelper['ivrcidnameprefix']."\"+outbound_caller_id_name);\n";
- }
-
- $tmp .= "\n";
-
- $tmp .= " session.execute(\"set\", \"continue_on_fail=true\");\n";
- if (strlen($rowhelper['ivrcalltimeout']) == 0){
- $tmp .= " session.execute(\"set\", \"call_timeout=30\");\n"; //ivrcalltimeout
- }
- else {
- $tmp .= " session.execute(\"set\", \"call_timeout=".$rowhelper['ivrcalltimeout']."\");\n"; //ivrcalltimeout
- }
-
- if (isset($rowhelper['ivrringback'])){
- if ($rowhelper['ivrringback'] == "ring"){
- $tmp .= " session.execute(\"set\", \"ringback=\"+us_ring); //set to ringtone\n";
- $tmp .= " session.execute(\"set\", \"transfer_ringback=\"+us_ring); //set to ringtone\n";
- }
- if ($rowhelper['ivrringback'] == "music"){
- $tmp .= " session.execute(\"set\", \"ringback=\${hold_music}\"); //set to ringtone\n";
- $tmp .= " session.execute(\"set\", \"transfer_ringback=\${hold_music}\"); //set to ringtone\n";
- }
- }
- else {
- $tmp .= " session.execute(\"set\", \"ringback=\${hold_music}\"); //set to ringtone\n";
- $tmp .= " session.execute(\"set\", \"transfer_ringback=\${hold_music}\"); //set to ringtone\n";
- }
- $tmp .= "\n";
- $tmp .= "//console_log( \"info\", \"IVR Server Time is: \"+Hours+\":\"+Mins+\" \\n\" );\n";
- $tmp .= "\n";
-
- $tmp .= " function get_sofia_contact(extension,domain_name, profile){\n";
- $tmp .= " if (profile == \"auto\") {\n";
- $i = 0;
- foreach (ListFiles($v_conf_dir.'/sip_profiles') as $key=>$sip_profile_file){
- $sip_profile_name = str_replace(".xml", "", $sip_profile_file);
- if ($i == 0) {
- $tmp .= " profile = \"".$sip_profile_name."\";\n";
- $tmp .= " session.execute(\"set\", \"sofia_contact_\"+extension+\"=\${sofia_contact(\"+profile+\"/\"+extension+\"@\"+domain_name+\")}\");\n";
- $tmp .= " sofia_contact = session.getVariable(\"sofia_contact_\"+extension);\n";
- }
- else {
- $tmp .= "\n";
- $tmp .= " if (sofia_contact == \"error/user_not_registered\") {\n";
- $tmp .= " profile = \"".$sip_profile_name."\";\n";
- $tmp .= " session.execute(\"set\", \"sofia_contact_\"+extension+\"=\${sofia_contact(\"+profile+\"/\"+extension+\"@\"+domain_name+\")}\");\n";
- $tmp .= " sofia_contact = session.getVariable(\"sofia_contact_\"+extension);\n";
- $tmp .= " }\n";
- }
- $i++;
- }
- unset ($i);
- $tmp .= " }\n";
- $tmp .= " else {\n";
- $tmp .= " session.execute(\"set\", \"sofia_contact_\"+extension+\"=\${sofia_contact(\"+profile+\"/\"+extension+\"@\"+domain_name+\")}\");\n";
- $tmp .= " sofia_contact = session.getVariable(\"sofia_contact_\"+extension);\n";
- $tmp .= " }\n";
- $tmp .= " console_log( \"info\", \"sofia_contact \"+profile+\": \"+sofia_contact+\".\\n\" );\n";
- $tmp .= " return sofia_contact;\n";
- $tmp .= " }\n";
- $tmp .= "\n";
-
- $tmp .= " function mycb( session, type, obj, arg ) {\n";
- $tmp .= " try {\n";
- $tmp .= " if ( type == \"dtmf\" ) {\n";
- $tmp .= " console_log( \"info\", \"digit: \"+obj.digit+\"\\n\" );\n";
- $tmp .= " if ( obj.digit == \"#\" ) {\n";
- $tmp .= " //console_log( \"info\", \"detected pound sign.\\n\" );\n";
- $tmp .= " exit = true;\n";
- $tmp .= " return( false );\n";
- $tmp .= " }\n";
- $tmp .= "\n";
- $tmp .= " dtmf.digits += obj.digit;\n";
- $tmp .= "\n";
- $tmp .= " if ( dtmf.digits.length >= digitmaxlength ) {\n";
- $tmp .= " exit = true;\n";
- $tmp .= " return( false );\n";
- $tmp .= " }\n";
- $tmp .= " }\n";
- $tmp .= " } catch (e) {\n";
- $tmp .= " console_log( \"err\", e+\"\\n\" );\n";
- $tmp .= " }\n";
- $tmp .= " return( true );\n";
- $tmp .= " } //end function mycb\n";
-
- $tmp .= "\n";
- $tmp .= base64_decode($rowhelper['ivrconditionjs']);
- $tmp .= "\n";
- $tmp .= "\n";
-
- //$tmp .= " //condition = true; //debugging\n";
-
- $actiondirect = false;
- $actiondefault = false;
- $actioncount = 0;
- foreach($config['installedpackages']['freeswitchivroptions']['config'] as $row) {
- //find the correct IVR options with the correct action
- if ($row['ivrid'] == $rowhelper['ivrid']) {
-
- if ($row['optionaction'] == "action") {
- $actioncount++;
- if (strtolower($row['optionnumber']) == "n") { //direct the call now don't wait for dtmf
- //echo "now found\n";
- $actiondirect = true;
- $actiondirecttype = $row['optiontype'];
- $actiondirectprofile = $row['optionprofile'];
- $actiondirectdest = $row['optiondest'];
- }
- if (strtolower($row['optionnumber']) == "d") { //default option used when dtmf doesn't match any other option
- //echo "default found\n";
- $actiondefault = true;
- $actiondefaulttype = $row['optiontype'];
- $actiondefaultprofile = $row['optionprofile'];
- $actiondefaultdest = $row['optiondest'];
- }
- }
- }
- }
- //$tmp .= "action count: ".$actioncount."<br />\n";
- if ($actioncount > 0) {
- if ($actiondirect) {
- $tmp .= " if (condition) {\n";
- $tmp .= " //direct\n";
- $tmp .= " //console_log( \"info\", \"action direct\\n\" );\n";
- if ($actiondirecttype == "extension") {
- $tmp .= " sofia_contact_".$actiondirectdest." = get_sofia_contact(\"".$actiondirectdest."\",domain_name, \"".$actiondirectprofile."\");\n";
- $tmp .= " session.execute(\"bridge\", sofia_contact_".$actiondirectdest."); //".$actiondirectdest."\n";
- if ($actiondirectprofile == "auto") {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$actiondirectdest."\");\n";
- }
- else {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$actiondirectdest."\");\n";
- }
- }
- if ($actiondirecttype == "voicemail") {
- if ($actiondirectprofile == "auto") {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$actiondirectdest."\");\n";
- }
- else {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$actiondirectdest."\");\n";
- }
- }
- if ($actiondirecttype == "sip uri") {
- $tmp .= " session.execute(\"bridge\", \"".$actiondirectdest."\"); //".$actiondirectdest."\n";
-
- }
-
- $tmp .= "}\n";
-
- }
- else {
- $tmp .= " if (condition) {\n";
- $tmp .= " //action\n";
- $tmp .= "\n";
- $tmp .= " //console_log( \"info\", \"action call now don't wait for dtmf\\n\" );\n";
- $tmp .= " var dtmf = new Object( );\n";
- $tmp .= " dtmf.digits = \"\";\n";
- $tmp .= " if ( session.ready( ) ) {\n";
- $tmp .= " session.answer( );\n";
- $tmp .= "\n";
- $tmp .= " digitmaxlength = 1;\n";
- $tmp .= " while (session.ready() && ! exit ) {\n";
- $tmp .= " //session.streamFile( \"".$v_dir."/sounds/".$recording_action_filename."\", mycb, \"dtmf ".$rowhelper['ivrtimeout']."\" );\n";
- $tmp .= " session.streamFile( \"".$v_recordings_dir."/".$recording_action_filename."\", mycb, \"dtmf ".$rowhelper['ivrtimeout']."\" );\n";
- $tmp .= " if (session.ready()) {\n";
- $tmp .= " if (dtmf.digits.length == 0) {\n";
- $tmp .= " dtmf.digits += session.getDigits(1, \"#\", ".($rowhelper['ivrtimeout']*1000)."); // ".$rowhelper['ivrtimeout']." seconds\n";
- $tmp .= " if (dtmf.digits.length == 0) {\n";
- //$tmp .= " console_log( "info", "time out option: " + dtmf.digits + "\n" );\n";
-
- $a_ivr_options = &$config['installedpackages']['freeswitchivroptions']['config'];
- //find the timeout IVR options with the correct action
- if (count($a_ivr_options) > 0) {
- foreach($a_ivr_options as $row) {
-
- if ($row['ivrid'] == $rowhelper['ivrid']) {
-
- if ($row['optionaction'] == "action") {
- if (strtolower($row['optionnumber']) == "t") {
- if ($row['optiontype'] == "extension") {
- $tmp .= " sofia_contact_".$row['optiondest']." = get_sofia_contact(\"".$row['optiondest']."\",domain_name, \"".$row['optionprofile']."\");\n";
- $tmp .= " session.execute(\"bridge\", sofia_contact_".$row['optiondest']."); //".$row['optiondescr']."\n";
- if ($row['optionprofile'] == "auto") {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\");\n";
- }
- else {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\");\n";
- }
- }
- if ($row['optiontype'] == "voicemail") {
- if ($row['optionprofile'] == "auto") {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\"); //".$row['optiondescr']."\n";
- }
- else {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\"); //".$row['optiondescr']."\n";
- }
- }
- if ($row['optiontype'] == "sip uri") {
- $tmp .= " session.execute(\"bridge\", \"".$row['optiondest']."\"); //".$row['optiondescr']."\n";
- }
- }
- } //end anti-action
-
- } //end ivrid
-
- } //end for each
- } //if count
-
- $tmp .= " }\n";
- $tmp .= " else {\n";
- $tmp .= " break; //dtmf found end the while loop\n";
- $tmp .= " }\n";
- $tmp .= " }\n";
- $tmp .= " }\n";
- $tmp .= " }\n";
- $tmp .= "\n";
- $tmp .= " //pickup the remaining digits\n";
- //$tmp .= " //http://wiki.freeswitch.org/wiki/Session_getDigits\n";
- //$tmp .= " //getDigits(length, terminators, timeout, digit_timeout, abs_timeout)\n";
- //$tmp .= " //dtmf.digits += session.getDigits(2, \"#\", 3000); //allow up to 3 digits\n";
- $tmp .= " dtmf.digits += session.getDigits(4, \"#\", 3000); //allow up to 5 digits\n";
- $tmp .= "\n";
- $tmp .= "\n";
- //$tmp .= " console_log( \"info\", \"IVR Digit Pressed: \" + dtmf.digits + \"\\n\" );\n";
-
-
- //action
- $tmpaction = "";
-
- $tmp .= " if ( dtmf.digits.length > \"0\" ) {\n";
- $x = 0;
- $a_ivr_options = &$config['installedpackages']['freeswitchivroptions']['config'];
- if (count($a_ivr_options) > 0) {
- foreach($a_ivr_options as $row) {
-
- /*
- $row['ivrid']
- $row['optionnumber']
- $row['optiontype']
- $row['optionaction']
- $row['optiondest']
- $row['optiondescr']
- */
-
- $tmpactiondefault = "";
-
- //find the correct IVR options with the correct action
- if ($row['ivrid'] == $rowhelper['ivrid']){
-
- if ($row['optionaction'] == "action") {
- //$tmpaction .= "\n";
-
- switch ($row['optionnumber']) {
- //case "t":
- // break;
- //case "d":
- // break;
- default:
- //$tmpaction .= " //console_log( \"info\", \"IVR Detected 1 digit \\n\" );\n";
- if ($x == 0) {
- $tmpaction .= " if ( dtmf.digits == \"".$row['optionnumber']."\" ) { //".$row['optiondescr']."\n";
- }
- else {
- $tmpaction .= " else if ( dtmf.digits == \"".$row['optionnumber']."\" ) { //".$row['optiondescr']."\n";
- }
- if ($row['optiontype'] == "extension") {
- $tmpaction .= " sofia_contact_".$row['optiondest']." = get_sofia_contact(\"".$row['optiondest']."\",domain_name, \"".$row['optionprofile']."\");\n";
- $tmpaction .= " session.execute(\"bridge\", sofia_contact_".$row['optiondest']."); //".$row['optiondescr']."\n";
- if ($row['optionprofile'] == "auto") {
- $tmpaction .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\");\n";
- }
- else {
- $tmpaction .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\"); //".$row['optiondescr']."\n";
- }
- }
- if ($row['optiontype'] == "voicemail") {
- if ($row['optionprofile'] == "auto") {
- $tmpaction .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\"); //".$row['optiondescr']."\n";
- }
- else {
- $tmpaction .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\"); //".$row['optiondescr']."\n";
- }
- }
- if ($row['optiontype'] == "sip uri") {
- $tmpaction .= " session.execute(\"bridge\", \"".$row['optiondest']."\"); //".$row['optiondescr']."\n";
- }
-
- $tmpaction .= " }\n";
-
- }
-
- $x++;
- } //end if action
-
- } //end ivrid
-
-
- } //end foreach
- } //end if count
-
- $tmp .= $tmpaction;
- if ($rowhelper['ivrdirectdial'] == "true") {
- $tmp .= " else {\n";
- $tmp .= " session.execute(\"transfer\", dtmf.digits+\" XML default\");\n";
- //$tmp .= $tmpactiondefault;
- $tmp .= " }\n";
- }
- else {
- if ($actiondefault) {
- $tmp .= " else {\n";
- $tmp .= " //console_log( \"info\", \"default option when there is no matching dtmf found\\n\" );\n";
- if ($actiondefaulttype == "extension") {
- $tmp .= " sofia_contact_".$actiondefaultdest." = get_sofia_contact(\"".$actiondefaultdest."\",domain_name, \"".$actiondirectprofile."\");\n";
- $tmp .= " session.execute(\"bridge\", sofia_contact_".$actiondefaultdest."); //".$actiondefaultdest."\n";
- if ($actiondirectprofile == "auto") {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$actiondefaultdest."\");\n";
- }
- else {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$actiondefaultdest."\");\n";
- }
- }
- if ($actiondefaulttype == "voicemail") {
- if ($actiondirectprofile == "auto") {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$actiondefaultdest."\");\n";
- }
- else {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$actiondefaultdest."\");\n";
- }
- }
- if ($actiondefaulttype == "sip uri") {
- $tmp .= " session.execute(\"bridge\", \"".$actiondefaultdest."\"); //".$actiondefaultdest."\n";
- }
- $tmp .= " }\n";
-
- }
- }
-
- $tmp .= "\n";
- unset($tmpaction);
-
-
- $tmp .= " } \n";
- //$tmp .= " else if ( dtmf.digits.length == \"4\" ) {\n";
- //$tmp .= " //Transfer to the extension the caller\n";
- //$tmp .= " session.execute(\"transfer\", dtmf.digits+\" XML default\");\n";
- //$tmp .= " } else {\n";
- //$tmp .= $tmpactiondefault;
- //$tmp .= " }\n";
- $tmp .= "\n";
- $tmp .= " } //end if session.ready\n";
- $tmp .= "\n";
- $tmp .= " }\n"; //end if condition
-
- } //if ($actiondirect)
- } //actioncount
-
- $antiactiondirect = false;
- $antiactiondefault = false;
- $antiactioncount = 0;
- foreach($config['installedpackages']['freeswitchivroptions']['config'] as $row) {
- //find the correct IVR options with the correct action
- if ($row['ivrid'] == $rowhelper['ivrid']) {
- if ($row['optionaction'] == "anti-action") {
- $antiactioncount++;
- if (strtolower($row['optionnumber']) == "n") { //direct the call now don't wait for dtmf
- $antiactiondirect = true;
- $antiactiondirecttype = $row['optiontype'];
- $antiactiondirectdest = $row['optiondest'];
- $antiactiondirectprofile = $row['optionprofile'];
- }
- if (strtolower($row['optionnumber']) == "d") { //default option used when an dtmf doesn't match any option
- $antiactiondefault = true;
- $antiactiondefaulttype = $row['optiontype'];
- $antiactiondefaultdest = $row['optiondest'];
- $antiactiondefaultprofile = $row['optionprofile'];
- }
- }
- }
- }
- //$tmp .= "anti-action count: ".$antiactioncount."<br />\n";
-
-
- if ($antiactioncount > 0) {
- if ($antiactiondirect) {
- $tmp .= " else {\n";
- $tmp .= " //console_log( \"info\", \"anti-action call now don't wait for dtmf\\n\" );\n";
-
- if ($antiactiondirecttype == "extension") {
- $tmp .= " sofia_contact_".$antiactiondirectdest." = get_sofia_contact(\"".$antiactiondirectdest."\",domain_name, \"".$antiactiondirectprofile."\");\n";
- $tmp .= " session.execute(\"bridge\", sofia_contact_".$antiactiondirectdest."); //".$antiactiondirectdest."\n";
- if ($antiactiondirectprofile == "auto") {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$antiactiondirectdest."\");\n";
- }
- else {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$antiactiondirectdest."\");\n";
- }
- }
- if ($antiactiondirecttype == "voicemail") {
- if ($antiactiondirectprofile == "auto") {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$antiactiondirectdest."\");\n";
- }
- else {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$antiactiondirectdest."\");\n";
- }
- }
- if ($antiactiondirecttype == "sip uri") {
- $tmp .= " session.execute(\"bridge\", \"".$antiactiondirectdest."\"); //".$antiactiondirectdest."\n";
- }
- $tmp .= "}\n";
- }
- else {
- $tmp .= " else {\n";
- $tmp .= " //anti-action\n";
- $tmp .= " //console_log( \"info\", \"anti-action options\\n\" );\n";
- $tmp .= "\n";
- $tmp .= " var dtmf = new Object( );\n";
- $tmp .= " dtmf.digits = \"\";\n";
- $tmp .= " if ( session.ready( ) ) {\n";
- $tmp .= " session.answer( );\n";
- $tmp .= "\n";
- $tmp .= " digitmaxlength = 1;\n";
- $tmp .= " while (session.ready() && ! exit ) {\n";
- $tmp .= " session.streamFile( \"".$v_recordings_dir."/".$recording_antiaction_filename."\", mycb, \"dtmf ".$rowhelper['ivrtimeout']."\" );\n";
- $tmp .= " if (session.ready()) {\n";
- $tmp .= " if (dtmf.digits.length == 0) {\n";
- $tmp .= " dtmf.digits += session.getDigits(1, \"#\", ".($rowhelper['ivrtimeout']*1000)."); // ".$rowhelper['ivrtimeout']." seconds\n";
- $tmp .= " if (dtmf.digits.length == 0) {\n";
- //$tmp .= " console_log( "info", "time out option: " + dtmf.digits + "\n" );\n";
-
-
- //find the timeout IVR options with the correct action
- if (count($a_ivr_options) > 0) {
- foreach($a_ivr_options as $row) {
-
- if ($row['ivrid'] == $rowhelper['ivrid']) {
-
- if ($row['optionaction'] == "anti-action") {
- if (strtolower($row['optionnumber']) == "t") {
- if ($row['optiontype'] == "extension") {
- $tmp .= " sofia_contact_".$row['optiondest']." = get_sofia_contact(\"".$row['optiondest']."\",domain_name, \"".$row['optionprofile']."\");\n";
- $tmp .= " session.execute(\"bridge\", sofia_contact_".$row['optiondest']."); //".$row['optiondescr']."\n";
- if ($row['optionprofile'] == "auto") {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\");\n";
- }
- else {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\");\n";
- }
- }
- if ($row['optiontype'] == "voicemail") {
- if ($row['optionprofile'] == "auto") {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\"); //".$row['optiondescr']."\n";
- }
- else {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\"); //".$row['optiondescr']."\n";
- }
- }
- if ($row['optiontype'] == "sip uri") {
- $tmp .= " session.execute(\"bridge\", \"".$row['optiondest']."\"); //".$row['optiondescr']."\n";
- }
- }
-
- } //end anti-action
-
- } //end ivrid
-
- } //end for each
- } //if count
-
-
- $tmp .= " }\n";
- $tmp .= " else {\n";
- $tmp .= " break; //dtmf found end the while loop\n";
- $tmp .= " }\n";
-
- $tmp .= " }\n";
- $tmp .= " }\n";
- $tmp .= " }\n";
- $tmp .= "\n";
- $tmp .= " //pickup the remaining digits\n";
- $tmp .= " //http://wiki.freeswitch.org/wiki/Session_getDigits\n";
- $tmp .= " //getDigits(length, terminators, timeout, digit_timeout, abs_timeout)\n";
- $tmp .= " dtmf.digits += session.getDigits(4, \"#\", 3000);\n";
- $tmp .= "\n";
- $tmp .= " console_log( \"info\", \"IVR Digit Pressed: \" + dtmf.digits + \"\\n\" );\n";
- $tmp .= "\n";
-
-
- $tmpantiaction = "";
- $tmp .= " if ( dtmf.digits.length > \"0\" ) {\n";
-
- $x = 0;
- if (count($a_ivr_options) > 0) {
- foreach($a_ivr_options as $row) {
-
- /*
- $row['ivrid']
- $row['optionnumber']
- $row['optiontype']
- $row['optionaction']
- $row['optiondest']
- $row['optiondescr']
- */
- //$tmpantiactiondefault = "";
-
- //find the correct IVR options with the correct action
- if ($row['ivrid'] == $rowhelper['ivrid']) {
-
- if ($row['optionaction'] == "anti-action") {
-
- switch ($row['optionnumber']) {
- //case "t":
- // //break;
- //case "d":
- // //break;
- default:
- //$tmpantiaction .= " //console_log( \"info\", \"IVR Detected 1 digit \\n\" );\n";
-
- if ($x == 0) {
- $tmpantiaction .= " if ( dtmf.digits == \"".$row['optionnumber']."\" ) { //".$row['optiondescr']."\n";
- }
- else {
- $tmpantiaction .= " else if ( dtmf.digits == \"".$row['optionnumber']."\" ) { //".$row['optiondescr']."\n";
- }
-
- if ($row['optiontype'] == "extension") {
- $tmpantiaction .= " sofia_contact_".$row['optiondest']." = get_sofia_contact(\"".$row['optiondest']."\",domain_name, \"".$row['optionprofile']."\");\n";
- $tmpantiaction .= " session.execute(\"bridge\", sofia_contact_".$row['optiondest']."); //".$row['optiondescr']."\n";
- if ($row['optionprofile'] == "auto") {
- $tmpantiaction .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\");\n";
- }
- else {
- $tmpantiaction .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\");\n";
- }
- }
- if ($row['optiontype'] == "voicemail") {
- if ($row['optionprofile'] == "auto") {
- $tmpantiaction .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\"); //".$row['optiondescr']."\n";
- }
- else {
- $tmpantiaction .= " session.execute(\"voicemail\", \"default \${domain} ".$row['optiondest']."\"); //".$row['optiondescr']."\n";
- }
- }
- if ($row['optiontype'] == "sip uri") {
- $tmpantiaction .= " session.execute(\"bridge\", \"".$row['optiondest']."\"); //".$row['optiondescr']."\n";
- }
- $tmpantiaction .= " }\n";
-
- } //end switch
-
- $x++;
- } //end anti-action
-
- } //end ivrid
-
-
- } //end for each
- } //if count
-
- $tmp .= $tmpantiaction;
- if ($rowhelper['ivrdirectdial'] == "true") {
- $tmp .= " else {\n";
- $tmp .= " session.execute(\"transfer\", dtmf.digits+\" XML default\");\n";
- //$tmp .= $tmpantiactiondefault;
- $tmp .= " }\n";
- }
- else {
- if ($antiactiondefault) {
- $tmp .= " else {\n";
- $tmp .= " //console_log( \"info\", \"default option used when dtmf doesn't match any other option\\n\" );\n";
-
- if ($antiactiondefaulttype == "extension") {
- $tmp .= " sofia_contact_".$antiactiondefaultdest." = get_sofia_contact(\"".$antiactiondefaultdest."\",domain_name, \"".$actiondirectprofile."\");\n";
- $tmp .= " session.execute(\"bridge\", sofia_contact_".$antiactiondefaultdest."); //".$antiactiondefaultdest."\n";
- if ($actiondirectprofile == "auto") {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$antiactiondefaultdest."\");\n";
- }
- else {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$antiactiondefaultdest."\");\n";
- }
- }
- if ($antiactiondefaulttype == "voicemail") {
- if ($actiondirectprofile == "auto") {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$antiactiondefaultdest."\");\n";
- }
- else {
- $tmp .= " session.execute(\"voicemail\", \"default \${domain} ".$antiactiondefaultdest."\");\n";
- }
- }
- if ($antiactiondefaulttype == "sip uri") {
- $tmp .= " session.execute(\"bridge\", \"".$antiactiondefaultdest."\"); //".$antiactiondefaultdest."\n";
- }
- $tmp .= " }\n";
- }
- }
- $tmp .= "\n";
- unset($tmpantiaction);
-
- $tmp .= " } \n";
- //$tmp .= " else if ( dtmf.digits.length == \"3\" ) {\n";
- //$tmp .= " //Transfer to the extension the caller chose\n";
- //$tmp .= " session.execute(\"transfer\", dtmf.digits+\" XML default\"); \n";
- //$tmp .= " }\n";
- //$tmp .= " else {\n";
- //$tmp .= $tmpantiactiondefault;
- //$tmp .= " }\n";
- $tmp .= "\n";
- $tmp .= " } //end if session.ready\n";
- $tmp .= "\n";
- $tmp .= " } //end if condition";
-
- } //if ($antiactiondirect)
- } //antiactioncount
- unset($tmpactiondefault);
- unset($tmpantiactiondefault);
-
- if (strlen($rowhelper['ivrid']) > 0) {
- $ivrfilename = "ivr_".str_replace(array("{", "}"), "", $rowhelper['ivrid']).".js";
- $fout = fopen($v_scripts_dir."/".$ivrfilename,"w");
- fwrite($fout, $tmp);
- unset($ivrfilename);
- fclose($fout);
- }
-
- } //end foreach
- } //end if count
-
-} //end function
-
-
-
-function sync_package_v_dialplan_includes()
-{
-
- global $config;
- $v_settings_array = $config['installedpackages']['freeswitchsettings']['config'][0];
- foreach($v_settings_array as $name => $value) {
- $$name = $value;
- }
-
- $a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config'];
- $a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config'];
-
- //order the array
- if (!function_exists('cmp_number_dialplan_details')) {
- function cmp_number_dialplan_details($a, $b) {
- if ($a["fieldorder"] > $b["fieldorder"]) {
- return 1;
- }
- else {
- return 0;
- }
- }
- }
-
- if (count($a_dialplan_includes) > 0) {
- foreach($config['installedpackages']['freeswitchdialplanincludes']['config'] as $rowhelper) {
- $tmp = "";
- $tmp .= "\n";
-
- //$rowhelper['dialplanincludeid'];
- //$rowhelper['extensionname'];
- //$rowhelper['context'];
- //$rowhelper['enabled'];
-
- $tmp = "<extension name=\"".$rowhelper['extensionname']."\">\n";
-
- if (count($a_dialplan_include_details) > 0) {
-
- if (count($a_dialplan_include_details) > 0) { usort($a_dialplan_include_details, "cmp_number_dialplan_details"); }
-
- $conditioncount = 0;
- $i = 0;
- foreach ($a_dialplan_include_details as $ent) {
- if ($ent['tag'] == "condition" && $rowhelper['dialplanincludeid'] == $ent['dialplanincludeid']) {
- $conditioncount++;
- $i++;
- }
- }
-
- $i = 1;
- foreach ($a_dialplan_include_details as $ent) {
- if ($ent['tag'] == "condition" && $rowhelper['dialplanincludeid'] == $ent['dialplanincludeid']) {
- if ($conditioncount == 1) { //single condition
- //start tag
- $tmp .= " <condition field=\"".$ent['fieldtype']."\" expression=\"".$ent['fielddata']."\">\n";
- }
- else { //more than one condition
- if ($i < $conditioncount) {
- //all tags should be self-closing except the last one
- $tmp .= " <condition field=\"".$ent['fieldtype']."\" expression=\"".$ent['fielddata']."\"/>\n";
- }
- else {
- //for the last tag use the start tag
- $tmp .= " <condition field=\"".$ent['fieldtype']."\" expression=\"".$ent['fielddata']."\">\n";
- }
- }
- $i++;
- }
- } //end for each
-
- } //end if count
-
- if (count($a_dialplan_include_details) > 0) {
- $i = 0;
- foreach ($a_dialplan_include_details as $ent) {
- if ($ent['tag'] == "action" && $rowhelper['dialplanincludeid'] == $ent['dialplanincludeid']) {
- $tmp .= " <action application=\"".$ent['fieldtype']."\" data=\"".$ent['fielddata']."\"/>\n";
- }
- $i++;
- }
- }
-
- if (count($a_dialplan_include_details) > 0) {
- $i = 0;
- foreach ($a_dialplan_include_details as $ent) {
- if ($ent['tag'] == "anti-action" && $rowhelper['dialplanincludeid'] == $ent['dialplanincludeid']) {
- $tmp .= " <anti-action application=\"".$ent['fieldtype']."\" data=\"".$ent['fielddata']."\"/>\n";
- }
- $i++;
- }
- }
-
- //if (count($a_dialplan_include_details) > 0) {
- //foreach ($a_dialplan_include_details as $ent) {
- // $i = 0;
- // if ($ent['tag'] == "param" && $rowhelper['dialplanincludeid'] == $ent['dialplanincludeid']) {
- //$ent['tag']
- //$ent['fieldtype']
- //$ent['fielddata']
- // }
- // $i++;
- // }
- //}
-
- if ($conditioncount > 0) {
- $tmp .= " </condition>\n";
- }
- unset ($conditioncount);
- $tmp .= "</extension>\n";
-
-
- if ($rowhelper['enabled'] == "true") {
- $dialplanincludefilename = $rowhelper['order']."_".$rowhelper['extensionname'].".xml";
- $fout = fopen($v_conf_dir."/dialplan/default/".$dialplanincludefilename,"w");
- fwrite($fout, $tmp);
- fclose($fout);
- }
- unset($dialplanincludefilename);
- unset($tmp);
-
-
- } //end foreach
- } //if array count
-
-}
-
-
-function sync_package_v_public_includes()
-{
-
- global $config;
- $v_settings_array = $config['installedpackages']['freeswitchsettings']['config'][0];
- foreach($v_settings_array as $name => $value) {
- $$name = $value;
- }
-
- $a_public_includes = &$config['installedpackages']['freeswitchpublicincludes']['config'];
- $a_public_include_details = &$config['installedpackages']['freeswitchpublicincludedetails']['config'];
-
- if (count($a_public_includes) > 0) {
-
- //order the array
- function cmp_number_public_include_details($a, $b) {
- if ($a["fieldorder"] > $b["fieldorder"]) {
- return 1;
- }
- else {
- return 0;
- }
- }
-
-
- foreach($a_public_includes as $rowhelper) {
- $tmp = "";
- $tmp .= "\n";
-
- //$rowhelper['publicincludeid'];
- //$rowhelper['extensionname'];
- //$rowhelper['context'];
- //$rowhelper['enabled'];
-
- $tmp = "<extension name=\"".$rowhelper['extensionname']."\">\n";
-
- if (count($a_public_include_details) > 0) {
-
- if (count($a_public_include_details) > 0) { usort($a_public_include_details, "cmp_number_public_include_details"); }
-
- $conditioncount = 0;
- $i = 0;
- foreach ($a_public_include_details as $ent) {
- if ($ent['tag'] == "condition" && $rowhelper['publicincludeid'] == $ent['publicincludeid']) {
- $conditioncount++;
- $i++;
- }
- }
-
- $i = 1;
- foreach ($a_public_include_details as $ent) {
- if ($ent['tag'] == "condition" && $rowhelper['publicincludeid'] == $ent['publicincludeid']) {
- if ($conditioncount == 1) { //single condition
- //start tag
- $tmp .= " <condition field=\"".$ent['fieldtype']."\" expression=\"".$ent['fielddata']."\">\n";
- }
- else { //more than one condition
- if ($i < $conditioncount) {
- //all tags should be self-closing except the last one
- $tmp .= " <condition field=\"".$ent['fieldtype']."\" expression=\"".$ent['fielddata']."\"/>\n";
- }
- else {
- //for the last tag use the start tag
- $tmp .= " <condition field=\"".$ent['fieldtype']."\" expression=\"".$ent['fielddata']."\">\n";
- }
- }
- $i++;
- }
- } //end for each
-
- } //end if count
-
-
- if (count($a_public_include_details) > 0) {
- $i = 0;
- foreach ($a_public_include_details as $ent) {
- if ($ent['tag'] == "action" && $rowhelper['publicincludeid'] == $ent['publicincludeid']) {
- $tmp .= " <action application=\"".$ent['fieldtype']."\" data=\"".$ent['fielddata']."\"/>\n";
- }
- $i++;
- }
- }
-
- if (count($a_public_include_details) > 0) {
- $i = 0;
- foreach ($a_public_include_details as $ent) {
- if ($ent['tag'] == "anti-action" && $rowhelper['publicincludeid'] == $ent['publicincludeid']) {
- $tmp .= " <anti-action application=\"".$ent['fieldtype']."\" data=\"".$ent['fielddata']."\"/>\n";
- }
- $i++;
- }
- }
-
- //if (count($a_public_include_details) > 0) {
- //foreach ($a_public_include_details as $ent) {
- // $i = 0;
- // if ($ent['tag'] == "param" && $rowhelper['publicincludeid'] == $ent['publicincludeid']) {
- //$ent['tag']
- //$ent['fieldtype']
- //$ent['fielddata']
- // }
- // $i++;
- // }
- //}
-
- if ($conditioncount > 0) {
- $tmp .= " </condition>\n";
- }
- unset ($conditioncount);
- $tmp .= "</extension>\n";
-
-
- if ($rowhelper['enabled'] == "true") {
- $publicincludefilename = $rowhelper['order']."_".$rowhelper['extensionname'].".xml";
- $fout = fopen($v_conf_dir."/dialplan/public/".$publicincludefilename,"w");
- fwrite($fout, $tmp);
- fclose($fout);
- }
- unset($publicincludefilename);
- unset($tmp);
-
- } //end foreach
- } //end count
-
-}
-
-
-function sync_package_freeswitch()
-{
- global $config;
- sync_package_v_settings();
- sync_package_v_dialplan();
- sync_package_v_dialplan_includes();
- sync_package_v_extensions();
- sync_package_v_gateways();
- sync_package_v_modules();
- sync_package_v_public();
- sync_package_v_public_includes();
- sync_package_v_vars();
- sync_package_v_internal();
- sync_package_v_external();
- //sync_package_v_recordings();
- if (pkg_is_service_running('freeswitch')) {
- sync_package_v_ivr();
- }
-
-}
-
-function pkg_add($pkg_download_path, $pkg_name)
-{
-
- if (!is_dir('/usr/pkgs/')) {
- exec("mkdir /usr/pkgs/");
- }
-
- $pkg_array = split("\.", $pkg_name);
- //if the package is not installed then download and install it
- if (!strlen(exec('pkg_info | grep '.$pkg_array[0])) > 0) {
- chdir('/usr/pkgs/');
- exec("fetch ".$pkg_download_path.'/'.$pkg_name);
- exec("pkg_add -F ".$pkg_name);
- exec("rm ".$pkg_name);
- }
-
-}
-
-function v_install_phase_2() {
-
- global $config;
- $v_settings_array = $config['installedpackages']['freeswitchsettings']['config'][0];
- foreach($v_settings_array as $name => $value) {
- $$name = $value;
- }
-
- $handle = fopen($tmp_dir.'/freeswitch_pkg.txt', "a");
-
-// $static_output = 'Downloading Package Files';
-// update_output_window($static_output);
-
- clearstatcache(); //clear file status cache
- fwrite($handle, "v_web_root: ".$v_web_root."/packages/\n");
- if (!is_dir($v_web_root.'/packages/')) {
- exec("mkdir ".$v_web_root."/packages/");
- }
- fwrite($handle, "v_web_dir: ".$v_web_dir."\n");
- if (!is_dir($v_web_dir)) {
- exec("mkdir ".$v_web_dir);
- }
-
- if (!is_dir($v_dir.'/sounds/custom/')) {
- exec("mkdir ".$v_dir."/sounds/custom/");
- }
-
- if (!is_dir($v_dir.'/sounds/custom/8000/')) {
- exec("mkdir ".$v_dir."/sounds/custom/8000/");
- }
-
- if (!is_dir($v_storage_dir.'/fax/')) {
- exec("mkdir -p ".$v_storage_dir."/fax/");
- }
-
- //download the dialplan default.xml
- chdir($tmp_dir.'/');
- exec("cd ".$tmp_dir."/;fetch ".$v_download_path."dialplan.default.xml");
- exec("cp ".$tmp_dir."/dialplan.default.xml ".$v_conf_dir."/dialplan/default.xml");
- unlink_if_exists($tmp_dir."/dialplan.default.xml");
-
- //download the dialplan public.xml
- chdir($tmp_dir.'/');
- exec("fetch ".$v_download_path."dialplan.public.xml");
- exec("cp ".$tmp_dir."/dialplan.public.xml ".$v_conf_dir."/dialplan/public.xml");
- unlink_if_exists($tmp_dir."/dialplan.public.xml");
-
- //misc files
- if (!is_dir($v_web_root.'/edit_area/')) {
- chdir($tmp_dir);
- exec("fetch ".$v_download_path."edit_area.tgz");
- chdir($v_web_root);
- system('tar xvpfz ".tmp_dir."/edit_area.tgz edit_area');
- unlink_if_exists($tmp_dir."/edit_area.tgz");
- }
-
- fwrite($handle, 'tmp_dir: '.$tmp_dir."\n");
- fwrite($handle, "fetch ".$v_download_path."/v_dialplan.tmp\n");
- fwrite($handle, "cp ".$tmp_dir."/v_dialplan.tmp ".$v_web_dir."/v_dialplan.php\n");
- fwrite($handle, $tmp_dir."/v_dialplan.tmp\n");
-
- //rename PHP files from .tmp to .php
- chdir($tmp_dir.'/');
- exec("fetch ".$v_download_path."/index.tmp");
- exec("cp ".$tmp_dir."/index.tmp ".$v_web_dir."/index.php");
- unlink_if_exists($tmp_dir."/index.tmp");
-
- exec("fetch ".$v_download_path."/class.smtp.tmp");
- exec("cp ".$tmp_dir."/class.smtp.tmp ".$v_web_dir."/class.smtp.php");
- unlink_if_exists($tmp_dir."/class.smtp.tmp");
-
- exec("fetch ".$v_download_path."/class.phpmailer.tmp");
- exec("cp ".$tmp_dir."/class.phpmailer.tmp ".$v_web_dir."/class.phpmailer.php");
- unlink_if_exists($tmp_dir."/class.phpmailer.tmp");
-
- exec("fetch ".$v_download_path."/v_cmd.tmp");
- exec("cp ".$tmp_dir."/v_cmd.tmp ".$v_web_dir."/v_cmd.php");
- unlink_if_exists($tmp_dir."/v_cmd.tmp");
-
- exec("fetch ".$v_download_path."/v_dialplan.tmp");
- exec("cp ".$tmp_dir."/v_dialplan.tmp ".$v_web_dir."/v_dialplan.php");
- unlink_if_exists($tmp_dir."/v_dialplan.tmp");
-
- exec("fetch ".$v_download_path."/v_dialplan_includes_details.tmp");
- exec("cp ".$tmp_dir."/v_dialplan_includes_details.tmp ".$v_web_dir."/v_dialplan_includes_details.php");
- unlink_if_exists($tmp_dir."/v_dialplan_includes_details.tmp");
-
- exec("fetch ".$v_download_path."/v_dialplan_includes_details_edit.tmp");
- exec("cp ".$tmp_dir."/v_dialplan_includes_details_edit.tmp ".$v_web_dir."/v_dialplan_includes_details_edit.php");
- unlink_if_exists($tmp_dir."/v_dialplan_includes_details_edit.tmp");
-
- exec("fetch ".$v_download_path."/v_dialplan_includes.tmp");
- exec("cp ".$tmp_dir."/v_dialplan_includes.tmp ".$v_web_dir."/v_dialplan_includes.php");
- unlink_if_exists($tmp_dir."/v_dialplan_includes.tmp");
-
- exec("fetch ".$v_download_path."/v_dialplan_includes_edit.tmp");
- exec("cp ".$tmp_dir."/v_dialplan_includes_edit.tmp ".$v_web_dir."/v_dialplan_includes_edit.php");
- unlink_if_exists($tmp_dir."/v_dialplan_includes_edit.tmp");
-
- exec("fetch ".$v_download_path."/v_extensions.tmp");
- exec("cp ".$tmp_dir."/v_extensions.tmp ".$v_web_dir."/v_extensions.php");
- unlink_if_exists($tmp_dir."/v_extensions.tmp");
-
- exec("fetch ".$v_download_path."/v_extensions_edit.tmp");
- exec("cp ".$tmp_dir."/v_extensions_edit.tmp ".$v_web_dir."/v_extensions_edit.php");
- unlink_if_exists($tmp_dir."/v_extensions_edit.tmp");
-
- exec("fetch ".$v_download_path."/v_fax.tmp");
- exec("cp ".$tmp_dir."/v_fax.tmp ".$v_web_dir."/v_fax.php");
- unlink_if_exists($tmp_dir."/v_fax.tmp");
-
- exec("fetch ".$v_download_path."/v_fax_edit.tmp");
- exec("cp ".$tmp_dir."/v_fax_edit.tmp ".$v_web_dir."/v_fax_edit.php");
- unlink_if_exists($tmp_dir."/v_fax_edit.tmp");
-
- exec("fetch ".$v_download_path."/fax_to_email.tmp");
- exec("cp ".$tmp_dir."/fax_to_email.tmp ".$v_web_dir."/fax_to_email.php");
- unlink_if_exists($tmp_dir."/fax_to_email.tmp");
-
- exec("fetch ".$v_download_path."/v_features.tmp");
- exec("cp ".$tmp_dir."/v_features.tmp ".$v_web_dir."/v_features.php");
- unlink_if_exists($tmp_dir."/v_features.tmp");
-
- exec("fetch ".$v_download_path."/v_gateways.tmp");
- exec("cp ".$tmp_dir."/v_gateways.tmp ".$v_web_dir."/v_gateways.php");
- unlink_if_exists($tmp_dir."/v_gateways.tmp");
-
- exec("fetch ".$v_download_path."/v_gateways_edit.tmp");
- exec("cp ".$tmp_dir."/v_gateways_edit.tmp ".$v_web_dir."/v_gateways_edit.php");
- unlink_if_exists($tmp_dir."/v_gateways_edit.tmp");
-
- exec("fetch ".$v_download_path."/v_hunt_group.tmp");
- exec("cp ".$tmp_dir."/v_hunt_group.tmp ".$v_web_dir."/v_hunt_group.php");
- unlink_if_exists($tmp_dir."/v_hunt_group.tmp");
-
- exec("fetch ".$v_download_path."/v_hunt_group_edit.tmp");
- exec("cp ".$tmp_dir."/v_hunt_group_edit.tmp ".$v_web_dir."/v_hunt_group_edit.php");
- unlink_if_exists($tmp_dir."/v_hunt_group_edit.tmp");
-
- exec("fetch ".$v_download_path."/v_hunt_group_destinations.tmp");
- exec("cp ".$tmp_dir."/v_hunt_group_destinations.tmp ".$v_web_dir."/v_hunt_group_destinations.php");
- unlink_if_exists($tmp_dir."/v_hunt_group_destinations.tmp");
-
- exec("fetch ".$v_download_path."/v_hunt_group_destinations_edit.tmp");
- exec("cp ".$tmp_dir."/v_hunt_group_destinations_edit.tmp ".$v_web_dir."/v_hunt_group_destinations_edit.php");
- unlink_if_exists($tmp_dir."/v_hunt_group_destinations_edit.tmp");
-
- exec("fetch ".$v_download_path."/v_auto_attendant.tmp");
- exec("cp ".$tmp_dir."/v_auto_attendant.tmp ".$v_web_dir."/v_auto_attendant.php");
- unlink_if_exists($tmp_dir."/v_auto_attendant.tmp");
-
- exec("fetch ".$v_download_path."/v_auto_attendant_edit.tmp");
- exec("cp ".$tmp_dir."/v_auto_attendant_edit.tmp ".$v_web_dir."/v_auto_attendant_edit.php");
- unlink_if_exists($tmp_dir."/v_auto_attendant_edit.tmp");
-
- exec("fetch ".$v_download_path."/v_auto_attendant_options.tmp");
- exec("cp ".$tmp_dir."/v_auto_attendant_options.tmp ".$v_web_dir."/v_auto_attendant_options.php");
- unlink_if_exists($tmp_dir."/v_auto_attendant_options.tmp");
-
- exec("fetch ".$v_download_path."/v_auto_attendant_options_edit.tmp");
- exec("cp ".$tmp_dir."/v_auto_attendant_options_edit.tmp ".$v_web_dir."/v_auto_attendant_options_edit.php");
- unlink_if_exists($tmp_dir."/v_auto_attendant_options_edit.tmp");
-
- exec("fetch ".$v_download_path."/v_profiles.tmp");
- exec("cp ".$tmp_dir."/v_profiles.tmp ".$v_web_dir."/v_profiles.php");
- unlink_if_exists($tmp_dir."/v_profiles.tmp");
-
- exec("fetch ".$v_download_path."/v_profile_edit.tmp");
- exec("cp ".$tmp_dir."/v_profile_edit.tmp ".$v_web_dir."/v_profile_edit.php");
- unlink_if_exists($tmp_dir."/v_profile_edit.tmp");
-
- exec("fetch ".$v_download_path."/v_public.tmp");
- exec("cp ".$tmp_dir."/v_public.tmp ".$v_web_dir."/v_public.php");
- unlink_if_exists($tmp_dir."/v_public.tmp");
-
- exec("fetch ".$v_download_path."/v_public_includes.tmp");
- exec("cp ".$tmp_dir."/v_public_includes.tmp ".$v_web_dir."/v_public_includes.php");
- unlink_if_exists($tmp_dir."/v_public_includes.tmp");
-
- exec("fetch ".$v_download_path."/v_public_includes_edit.tmp");
- exec("cp ".$tmp_dir."/v_public_includes_edit.tmp ".$v_web_dir."/v_public_includes_edit.php");
- unlink_if_exists($tmp_dir."/v_public_includes_edit.tmp");
-
- exec("fetch ".$v_download_path."/v_public_includes_details.tmp");
- exec("cp ".$tmp_dir."/v_public_includes_details.tmp ".$v_web_dir."/v_public_includes_details.php");
- unlink_if_exists($tmp_dir."/v_public_includes_details.tmp");
-
- exec("fetch ".$v_download_path."/v_public_includes_details_edit.tmp");
- exec("cp ".$tmp_dir."/v_public_includes_details_edit.tmp ".$v_web_dir."/v_public_includes_details_edit.php");
- unlink_if_exists($tmp_dir."/v_public_includes_details_edit.tmp");
-
- exec("fetch ".$v_download_path."/v_mailto.tmp");
- exec("cp ".$tmp_dir."/v_mailto.tmp ".$v_web_dir."/v_mailto.php");
- unlink_if_exists($tmp_dir."/v_mailto.tmp");
-
- exec("fetch ".$v_download_path."/v_modules.tmp");
- exec("cp ".$tmp_dir."/v_modules.tmp ".$v_web_dir."/v_modules.php");
- unlink_if_exists($tmp_dir."/v_modules.tmp");
-
- exec("fetch ".$v_download_path."/v_recordings.tmp");
- exec("cp ".$tmp_dir."/v_recordings.tmp ".$v_web_dir."/v_recordings.php");
- unlink_if_exists($tmp_dir."/v_recordings.tmp");
-
- exec("fetch ".$v_download_path."/v_recordings_edit.tmp");
- exec("cp ".$tmp_dir."/v_recordings_edit.tmp ".$v_web_dir."/v_recordings_edit.php");
- unlink_if_exists($tmp_dir."/v_recordings_edit.tmp");
-
- exec("fetch ".$v_download_path."/v_recordings_play.tmp");
- exec("cp ".$tmp_dir."/v_recordings_play.tmp ".$v_web_dir."/v_recordings_play.php");
- unlink_if_exists($tmp_dir."/v_recordings_play.tmp");
-
- exec("fetch ".$v_download_path."/v_settings.tmp");
- exec("cp ".$tmp_dir."/v_settings.tmp ".$v_web_dir."/v_settings.php");
- unlink_if_exists($tmp_dir."/v_settings.tmp");
-
- exec("fetch ".$v_download_path."/v_status.tmp");
- exec("cp ".$tmp_dir."/v_status.tmp ".$v_web_dir."/v_status.php");
- unlink_if_exists($tmp_dir."/v_status.tmp");
-
- exec("fetch ".$v_download_path."/v_vars.tmp");
- exec("cp ".$tmp_dir."/v_vars.tmp ".$v_web_dir."/v_vars.php");
- unlink_if_exists($tmp_dir."/v_vars.tmp");
-
- chdir($v_scripts_dir);
- exec("fetch ".$v_download_path."disa.js");
- exec("fetch ".$v_download_path."originate.js");
- exec("cp ".$v_htdocs_dir."/slim.swf ".$v_web_dir."/slim.swf");
-
-
- fclose($handle);
-}
-
-
-function v_install_phase_1()
-{
-
- conf_mount_rw();
- config_lock();
-
- global $config;
- v_settings();
- $v_settings_array = $config['installedpackages']['freeswitchsettings']['config'][0];
- foreach($v_settings_array as $name => $value) {
- $$name = $value;
- }
-
- $handle = fopen($tmp_dir.'/freeswitch_pkg.txt', "a");
-
-
- //set script execution time limit to 24 hours
- set_time_limit (86400);
- ini_set(max_execution_time,86400);
-
-
- //hide errors
- ini_set('display_errors', '0');
-
- clearstatcache(); //clear file status cache
-
-
- //$struname = exec('uname -v');
- //if (stristr($struname, 'FreeBSD 7.2')) {
- // $freebsd_version = "7.2";
- //}
-
-// $static_output = 'Extracting';
-// update_output_window($static_output);
-
-
- //exec("fetch ".$download_path."freeswitch.tgz"); //handled by freeswitch.xml
- //exec("tar zxvf ".$tmp_dir."/freeswitch.tgz -C ".$v_parent_dir);
- //unlink_if_exists($tmp_dir."/freeswitch.tgz");
-
-
-// $static_output = 'Downloading Files';
-// update_output_window($static_output);
-
-
- //download and install the packages
- $pkg_download_path = $v_download_path."/freebsd7.2/1_0_4";
-
- //if the package is not installed then install it
- if(stristr(exec('pkg_info | grep freeswitch'), 'freeswitch') === FALSE) {
- pkg_add($pkg_download_path, "libpri-1.4.1.tbz");
- pkg_add($pkg_download_path, "png-1.2.37.tbz");
- pkg_add($pkg_download_path, "pcre-7.9.tbz");
- pkg_add($pkg_download_path, "libiconv-1.13.1.tbz");
- pkg_add($pkg_download_path, "libslang2-2.1.4_1.tbz");
- pkg_add($pkg_download_path, "gettext-0.17_1.tbz");
- pkg_add($pkg_download_path, "popt-1.14.tbz");
- pkg_add($pkg_download_path, "newt-0.51.0_8.tbz");
- pkg_add($pkg_download_path, "zaptel-1.4.11_1.tbz");
- pkg_add($pkg_download_path, "libogg-1.1.4,4.tbz");
- pkg_add($pkg_download_path, "libvorbis-1.2.3,3.tbz");
- pkg_add($pkg_download_path, "bash-4.0.24.tbz");
- pkg_add($pkg_download_path, "unixODBC-2.2.14_1.tbz");
- pkg_add($pkg_download_path, "db42-4.2.52_5.tbz");
- pkg_add($pkg_download_path, "gdbm-1.8.3_3.tbz");
- pkg_add($pkg_download_path, "ncurses-5.7.tbz");
- pkg_add($pkg_download_path, "pkg-config-0.23_1.tbz");
- pkg_add($pkg_download_path, "ca_root_nss-3.11.9_2.tbz");
- pkg_add($pkg_download_path, "curl-7.19.5_1.tbz");
- pkg_add($pkg_download_path, "jpeg-7.tbz");
- pkg_add($pkg_download_path, "tiff-3.8.2_4.tbz");
- pkg_add($pkg_download_path, "tiff2png-0.91_1,1.tbz");
- pkg_add($pkg_download_path, "libgpg-error-1.7.tbz");
- pkg_add($pkg_download_path, "libgcrypt-1.4.4.tbz");
- pkg_add($pkg_download_path, "gnutls-2.6.5.tbz");
- pkg_add($pkg_download_path, "freeswitch-1.0.4.tbz");
- //pkg_add($pkg_download_path, "p5-gettext-1.05_2.tbz"); //requirement for perl
- //pkg_add($pkg_download_path, "perl-5.8.9_3.tbz");
- fwrite($handle, 'packages have been installed');
- }
-
- //add sqlite package
- //exec("pkg_add -r sqlite34");
-
-
- //make a backup copy of the default config used with the 'Restore Default' buttons on the text areas.
- exec("cp -R ".$v_conf_dir." ".$v_conf_dir.".orig");
-
- //remove some default config files that are not needed
- unlink_if_exists($v_conf_dir."/dialplan/default/01_example.com.xml");
- unlink_if_exists($v_conf_dir."/dialplan/public/00_inbound_did.xml");
-
- //mod_fax
- //chdir($v_mod_dir.'/mod/');
- //exec("fetch ".$download_path."mod_fax.so");
-
- //download and install additional files
- fwrite($handle, "starting phase 2\n");
- fclose($handle);
-
- v_install_phase_2();
- $handle = fopen($tmp_dir.'/freeswitch_pkg.txt', "a");
-
- fwrite($handle, "starting phase 3\n");
- fwrite($handle, "downloading audio files\n");
- $static_output = "Downloading Audio Files\n";
- update_output_window($static_output);
-
- //copy audio files
- chdir($v_dir.'/sounds/custom/8000/');
- exec("cd ".$v_dir."/sounds/custom/8000/;fetch ".$download_path."please_enter_your_pin_number.wav");
- exec("cd ".$v_dir."/sounds/custom/8000/;fetch ".$download_path."please_enter_the_pin_number.wav");
- exec("cd ".$v_dir."/sounds/custom/8000/;fetch ".$download_path."please_enter_the_extension_number.wav");
- exec("cd ".$v_dir."/sounds/custom/8000/;fetch ".$download_path."please_enter_the_phone_number.wav");
- exec("cd ".$v_dir."/sounds/custom/8000/;fetch ".$download_path."call_forward_has_been_set.wav");
- exec("cd ".$v_dir."/sounds/custom/8000/;fetch ".$download_path."call_forward_has_been_deleted.wav");
- exec("cd ".$v_dir."/sounds/custom/8000/;fetch ".$download_path."begin_recording.wav");
- exec("cd ".$v_dir."/sounds/custom/8000/;fetch ".$download_path."your_pin_number_is_incorect_goodbye.wav");
- exec("cd ".$v_dir."/sounds/custom/8000/;fetch ".$download_path."please_say_your_name_and_reason_for_calling.wav");
- exec("cd ".$v_dir."/sounds/custom/8000/;fetch ".$download_path."press_1_to_accept_2_to_reject_or_3_for_voicemail.wav");
-
-
- /* freeswitch settings defaults */
- if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['numbering_plan']) == 0) {
- $config['installedpackages']['freeswitchsettings']['config'][0]['numbering_plan'] = "US";
- }
- if(strlen($config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password']) == 0) {
- $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password'] = "7e4d3i";
- }
- if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port']) == 0) {
- $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port'] = "8021";
- }
- if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_http_port']) == 0) {
- $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_http_port'] = "8787";
- }
- if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_realm']) == 0) {
- $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_realm'] = $v_name;
- }
- if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_user']) == 0) {
- $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_user'] = "xmlrpc";
- }
- if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_pass']) == 0) {
- $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_pass'] = "7e4d3i";
- }
- if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['admin_pin']) == 0) {
- $config['installedpackages']['freeswitchsettings']['config'][0]['admin_pin'] = "7575";
- }
- if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['mod_shout_decoder']) == 0) {
- $config['installedpackages']['freeswitchsettings']['config'][0]['mod_shout_decoder'] = "i386";
- }
- if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['mod_shout_volume']) == 0) {
- $config['installedpackages']['freeswitchsettings']['config'][0]['mod_shout_volume'] = "0.3";
- }
-
- v_settings();
-
- $numbering_plan = $config['installedpackages']['freeswitchsettings']['config'][0]['numbering_plan'];
- $event_socket_password = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password'];
- $event_socket_port = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port'];
- $xml_rpc_http_port = $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_http_port'];
- $xml_rpc_auth_realm = $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_realm'];
- $xml_rpc_auth_user = $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_user'];
- $xml_rpc_auth_pass = $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_pass'];
- $admin_pin = $config['installedpackages']['freeswitchsettings']['config'][0]['admin_pin'];
-
- //write the recording.js script
- recording_js();
-
- //add recording.js to the dialplan
- $a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config'];
- $a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config'];
-
- //delete dialplan recording from the previous install
- if (count($a_dialplan_includes) > 0) {
- $i = 0;
- foreach ($a_dialplan_includes as $ent) {
- if ($ent['extensionname'] == "Recordings") {
- unset($a_dialplan_includes[$i]);
- }
- $i++;
- }
- }
-
- //delete the recording dialplan details
- if (count($a_dialplan_include_details) > 0) {
- $i = 0;
- foreach ($a_dialplan_include_details as $ent) {
- if ($ent['fielddata'] == "^732673$") {
- unset($a_dialplan_include_details[$i]);
- }
- if ($ent['fielddata'] == "recordings.js") {
- unset($a_dialplan_include_details[$i]);
- }
- $i++;
- }
- }
-
- //add recording to the dialplan
- $dialplanincludeid = guid();
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['extensionname'] = 'Recordings';
- $ent['order'] = '9000';
- $ent['context'] = 'default';
- $ent['enabled'] = 'true';
- $ent['descr'] = '*732673 Default system recordings tool';
- $a_dialplan_includes[] = $ent;
- unset($ent);
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'condition'; //condition, action, antiaction
- $ent['fieldtype'] = 'destination_number';
- $ent['fielddata'] = '^\*(732673)$';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldtype'] = 'javascript';
- $ent['fielddata'] = 'recordings.js';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
-
-
- //delete dialplan DISA from the previous install
- $disa_enabled = 'false';
- if (count($a_dialplan_includes) > 0) {
- $i = 0;
- foreach ($a_dialplan_includes as $ent) {
- if ($ent['extensionname'] == "DISA") {
- $disa_enabled = $ent['enabled'];
- unset($a_dialplan_includes[$i]);
- }
- $i++;
- }
- }
-
- //add the DISA to the dialplan
- $dialplanincludeid = guid();
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['extensionname'] = 'DISA';
- $ent['order'] = '000';
- $ent['context'] = 'default';
- $ent['enabled'] = $disa_enabled;
- $ent['descr'] = '*3472 Direct Inward System Access';
- $a_dialplan_includes[] = $ent;
- unset($ent);
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'condition'; //condition, action, antiaction, set
- $ent['fieldtype'] = 'destination_number';
- $ent['fielddata'] = '^\*(3472)$';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'action'; //condition, action, antiaction, set
- $ent['fieldtype'] = 'javascript';
- $ent['fielddata'] = 'disa.js';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
-
- write_config();
-
- //prepare switch.conf.xml for voicemail to email
- $filename = $v_conf_dir."/autoload_configs/switch.conf.xml";
- $handle = fopen($filename,"rb");
- $contents = fread($handle, filesize($filename));
- fclose($handle);
-
- $handle = fopen($filename,"w");
- $contents = str_replace("<param name=\"mailer-app\" value=\"sendmail\"/>", "<param name=\"mailer-app\" value=\"".$php_dir."\"/>", $contents);
- $contents = str_replace("<param name=\"mailer-app-args\" value=\"-t\"/>", "<param name=\"mailer-app-args\" value=\"".$v_web_dir."/v_mailto.php\"/>", $contents);
- fwrite($handle, $contents);
- unset($contents);
- fclose($handle);
- unset($filename);
-
- //prepare shout.conf.xml for mod_shout
- $fout = fopen($v_conf_dir."/autoload_configs/shout.conf.xml","w");
- $tmpxml = "<configuration name=\"shout.conf\" description=\"mod shout config\">\n";
- $tmpxml .= " <settings>\n";
- $tmpxml .= " <!-- Don't change these unless you are insane -->\n";
- $tmpxml .= " <param name=\"decoder\" value=\"i586\"/>\n";
- $tmpxml .= " <!--<param name=\"volume\" value=\".1\"/>-->\n";
- $tmpxml .= " <!--<param name=\"outscale\" value=\"8192\"/>-->\n";
- $tmpxml .= " </settings>\n";
- $tmpxml .= "</configuration>";
- fwrite($fout, $tmpxml);
- unset($tmpxml);
- fclose($fout);
-
- $fout = fopen($v_conf_dir."/autoload_configs/event_socket.conf.xml","w");
- $tmpxml = "<configuration name=\"event_socket.conf\" description=\"Socket Client\">\n";
- $tmpxml .= " <settings>\n";
- $tmpxml .= " <param name=\"listen-ip\" value=\"". $config['interfaces']['lan']['ipaddr'] ."\"/>\n";
- $tmpxml .= " <param name=\"listen-port\" value=\"". $event_socket_port ."\"/>\n";
- $tmpxml .= " <param name=\"password\" value=\"". $event_socket_password ."\"/>\n";
- $tmpxml .= " <!--<param name=\"apply-inbound-acl\" value=\"lan\"/>-->\n";
- $tmpxml .= " </settings>\n";
- $tmpxml .= "</configuration>";
- fwrite($fout, $tmpxml);
- unset($tmpxml);
- fclose($fout);
-
- /* freeswitch modules defaults */
- /* freeswitch modules defaults */
-
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_console']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_console'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_logfile']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_logfile'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_syslog']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_syslog'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_yaml']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_yaml'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_enum']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_enum'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_xml_rpc']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_xml_rpc'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_xml_curl']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_xml_curl'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_xml_cdr']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_xml_cdr'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_cdr_csv']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_cdr_csv'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_event_multicast']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_event_multicast'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_event_socket']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_event_socket'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_zeroconf']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_zeroconf'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_ldap']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_ldap'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_dingaling']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_dingaling'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_iax']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_iax'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_portaudio']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_portaudio'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_alsa']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_alsa'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_sofia']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_sofia'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_loopback']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_loopback'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_wanpipe']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_wanpipe'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_woomera']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_woomera'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_openzap']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_openzap'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_commands']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_commands'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_conference']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_conference'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_dptools']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_dptools'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_expr']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_expr'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_fax']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_fax'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_fifo']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_fifo'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_voicemail']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_voicemail'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_limit']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_limit'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_esf']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_esf'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_fsv']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_fsv'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_snom']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_snom'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_dialplan_directory']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_dialplan_directory'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_dialplan_xml']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_dialplan_xml'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_dialplan_asterisk']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_dialplan_asterisk'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_voipcodecs']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_voipcodecs'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_g723_1']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_g723_1'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_g729']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_g729'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_amr']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_amr'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_ilbc']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_ilbc'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_speex']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_speex'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_siren']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_siren'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_celt']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_celt'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_h26x']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_h26x'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_sndfile']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_sndfile'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_native_file']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_native_file'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_shout']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_shout'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_local_stream']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_local_stream'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_tone_stream']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_tone_stream'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_spidermonkey']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_spidermonkey'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_spidermonkey_odbc']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_spidermonkey_odbc'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_perl']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_perl'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_python']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_python'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_java']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_java'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_lua']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_lua'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_flite']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_flite'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_pocketsphinx']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_pocketsphinx'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_cepstral']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_cepstral'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_openmrcp']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_openmrcp'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_rss']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_rss'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_en']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_en'] = "enable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_de']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_de'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_es']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_es'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_fr']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_fr'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_it']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_it'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_nl']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_nl'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_ru']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_ru'] = "disable";
- }
- if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_zh']) == 0) {
- $config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_zh'] = "disable";
- }
-
-
- //create the backup directory
- if (!is_dir($v_backup_dir.'/')) {
- exec("mkdir ".$v_backup_dir."/");
- }
-
- //extract a specific directory
- $filename = $v_name.'.bak.tgz';
- if (file_exists($v_backup_dir.$filename)) {
- $static_output = 'Restore the Backup';
- update_output_window($static_output);
-
- //echo "The file $filename exists";
-
- exec("rm -R ".$v_conf_dir."/sip_profiles/");
- exec("rm -R ".$v_dir."/sounds/music/");
-
- //Recommended
- chdir($v_parent_dir);
- system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/db/');
- system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/log/');
- system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/recordings/');
- system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/scripts/');
- system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/storage/');
- system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/sounds/custom/8000/');
- system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/sounds/music/8000/');
- system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/conf/ssl');
- system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/conf/sip_profiles/');
- system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/conf/vars.xml');
- system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/conf/dialplan/default.xml');
- system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/conf/dialplan/public.xml');
-
- //Optional
- //system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/conf/');
- //system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/grammar/');
- //system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/htdocs/');
-
- unset($filename);
-
- if (!is_dir($v_storage_dir.'/fax/')) {
- exec("mkdir -p ".$v_storage_dir."/fax/");
- }
- }
-
-
- exec("rm -R /freeswitch");
- exec("cp ".$v_conf_dir."/directory/default/brian.xml ".$v_conf_dir."/directory/default/brian.xml.noload");
- unlink_if_exists($v_conf_dir."/directory/default/brian.xml");
- unlink_if_exists($v_conf_dir."/directory/default/example.com.xml");
- unlink_if_exists($v_conf_dir."/dialplan/default/99999_enum.xml");
-
- write_rcfile(array(
- "file" => $v_name.".sh",
- "start" => $v_dir."/bin/./".$v_name." -nc",
- "stop" => $v_dir."/bin/./".$v_name." -stop"
- )
- );
-
-
- $static_output = 'Synchronize the config';
- update_output_window($static_output);
-
- sync_package_freeswitch();
-
- $static_output = 'Start the Service';
- update_output_window($static_output);
- $handle = popen($v_startup_script_dir."/freeswitch.sh start", "r");
- pclose($handle);
-
- //if (pkg_is_service_running('freeswitch')) {
- // sync_package_v_ivr();
- //}
-
- conf_mount_ro();
- config_unlock();
-
-}
-
-
-function v_deinstall_command()
-{
-
- conf_mount_rw();
- config_lock();
-
- global $config;
- $v_settings_array = $config['installedpackages']['freeswitchsettings']['config'][0];
- foreach($v_settings_array as $name => $value) {
- $$name = $value;
- }
-
- exec("killall -9 freeswitch");
-
- exec("pkg_delete freeswitch-1.0.4");
- exec("pkg_delete gnutls-2.6.5");
- exec("pkg_delete libgcrypt-1.4.4");
- exec("pkg_delete libgpg-error-1.7");
- exec("pkg_delete tiff2png-0.91_1,1");
- exec("pkg_delete tiff-3.8.2_4");
- exec("pkg_delete jpeg-7");
- //exec("pkg_delete curl-7.19.5_1"); //do not remove required for pfsense
- //exec("pkg_delete ca_root_nss-3.11.9_2"); //do not remove required for pfsense
- exec("pkg_delete pkg-config-0.23_1");
- //exec("pkg_delete ncurses-5.7"); //do not remove required for pfsense
- exec("pkg_delete gdbm-1.8.3_3");
- exec("pkg_delete db42-4.2.52_5");
- exec("pkg_delete unixODBC-2.2.14_1");
- exec("pkg_delete bash-4.0.24");
- exec("pkg_delete libvorbis-1.2.3,3");
- exec("pkg_delete libogg-1.1.4,4");
- exec("pkg_delete zaptel-1.4.11_1");
- exec("pkg_delete newt-0.51.0_8");
- exec("pkg_delete popt-1.14");
- //exec("pkg_delete gettext-0.17_1"); //do not remove required for pfsense
- exec("pkg_delete libslang2-2.1.4_1");
- //exec("pkg_delete libiconv-1.13.1"); //do not remove required for pfsense
- //exec("pkg_delete pcre-7.9"); //do not remove required for pfsense
- //exec("pkg_delete png-1.2.37");
- exec("pkg_delete libpri-1.4.1");
-
- exec("pkg_delete sqlite34");
-
- unlink_if_exists($v_parent_dir."/pkg/".$v_name.".xml");
- unlink_if_exists($v_parent_dir."/pkg/v_config.inc");
-
- exec("rm -R ".$v_dir);
- exec("rm -R ".$v_web_dir);
- unlink_if_exists($v_startup_script_dir."/".$v_name.".sh");
- //unlink_if_exists($tmp_dir."/".$v_name.".tar.gz");
- unlink_if_exists($tmp_dir."/pkg_mgr_".$v_label.".log");
-
- conf_mount_ro();
- config_unlock();
-
-}
-
-?>
diff --git a/config/freeswitch_dev/v_dialplan.tmp b/config/freeswitch_dev/v_dialplan.tmp
deleted file mode 100644
index e15108e3..00000000
--- a/config/freeswitch_dev/v_dialplan.tmp
+++ /dev/null
@@ -1,171 +0,0 @@
-<?php
-/* $Id$ */
-/*
- v_dialplan.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/v_config.inc");
-
-//$a_extensions = $config['installedpackages']['freeswitchprofiles']['config'];
-
-
-if ($_GET['a'] == "default") {
- conf_mount_rw();
- exec("cp ".$v_conf_dir.".orig/dialplan/default.xml ".$v_conf_dir."/dialplan/default.xml");
- $savemsg = "Default Restored";
- conf_mount_ro();
-}
-
-if ($_POST['a'] == "save") {
- conf_mount_rw();
- $content = ereg_replace("\r","",$_POST['code']);
- $fd = fopen($v_conf_dir."/dialplan/default.xml", "w");
- fwrite($fd, $content);
- fclose($fd);
- $savemsg = "Saved";
- conf_mount_ro();
-}
-
-
-$fd = fopen($v_conf_dir."/dialplan/default.xml", "r");
-$content = fread($fd, filesize($v_conf_dir."/dialplan/default.xml"));
-fclose($fd);
-
-include("head.inc");
-
-?>
-
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-
-<script language="Javascript">
-function sf() { document.forms[0].savetopath.focus(); }
-</script>
-<script language="Javascript" type="text/javascript" src="/edit_area/edit_area_full.js"></script>
-<script language="Javascript" type="text/javascript">
- // initialisation
- editAreaLoader.init({
- id: "code" // id of the textarea to transform
- ,start_highlight: false
- ,allow_toggle: false
- ,language: "en"
- ,syntax: "html"
- ,toolbar: "search, go_to_line,|, fullscreen, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help"
- ,syntax_selection_allow: "css,html,js,php,xml,c,cpp,sql"
- ,show_line_colors: true
- });
-</script>
-
-<?php
-include("fbegin.inc");
-if ($v_label_show) {
- echo "<p class=\"pgtitle\">$v_label: Dialplan</p>\n";
-}
-?>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-build_menu();
-
-?>
-</td></tr>
-</table>
-
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
-<form action="v_dialplan.php" method="post" name="iform" id="iform">
-<?php
-
-?>
- <table width="98%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width='90%'><p><span class="vexpl"><span class="red"><strong>Default Dialplan<br>
- </strong></span>
- The default dialplan is used to setup call destinations based on conditions and context.
- You can use the dialplan to send calls to gateways, auto attendants, external numbers, to scripts, or any destination.
- </p>
- </td>
- <td width='10%' align='right' valign='middle'><input type="submit" value="save" /></td>
- </tr>
- </table>
- <br />
- <br />
-
- <textarea style="width:98%" id="code" name="code" rows="30" cols="<?php echo $cols; ?>" name="content"><?php echo htmlentities($content); ?></textarea>
- <br />
- <br />
-
- <table width="98%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td>
- <?php
- if ($v_path_show) {
- echo $v_conf_dir."/dialplan/default.xml\n";
- }
- ?>
- </td>
- <td align='right'>
- <input type="hidden" name="f" value="<?php echo $_GET['f']; ?>" />
- <input type="hidden" name="a" value="save" />
- <?php
- echo "<input type='button' value='Restore Default' onclick=\"document.location.href='v_dialplan.php?a=default&f=default.xml';\" />";
- ?>
- </td>
- </tr>
- </table>
-
-</form>
-
-<br>
-<br>
-
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-
-</td>
-</tr>
-</table>
-
-</div>
-
-
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch_dev/v_dialplan_includes.tmp b/config/freeswitch_dev/v_dialplan_includes.tmp
deleted file mode 100644
index 0377d148..00000000
--- a/config/freeswitch_dev/v_dialplan_includes.tmp
+++ /dev/null
@@ -1,287 +0,0 @@
-<?php
-/* $Id$ */
-/*
- v_dialplan_includes.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/v_config.inc");
-
-
-//freeswitchdialplanincludes
- //dialplanincludeid
- //extensionname
- //context
- //default
- //enabled
- //descr
-
-//freeswitchdialplanincludedetails
-
- //dialplanincludeid
- //tag
- //condition
- //action
- //antiaction
- //param
- //tagorder
- //1-20
- //fieldtype
-
- //fielddata
-
-
-$a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config'];
-$a_dialplan_includes_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config'];
-
-
-if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'dialplanincludes') {
-
- if ($a_dialplan_includes[$_GET['id']]) {
-
- $dialplanincludeid = $a_dialplan_includes[$_GET['id']][dialplanincludeid];
-
- $extensionname = $a_dialplan_includes[$_GET['id']][extensionname];
- $order = $a_dialplan_includes[$_GET['id']][order];
- $dialplanincludefilename = $order."_".$extensionname.".xml";
-
- //delete the dialplan include details. aka. child data
- if (count($a_dialplan_includes_details) > 0) {
- $i=0;
- foreach($a_dialplan_includes_details as $row) {
- if ($row["dialplanincludeid"] == $dialplanincludeid) {
- //echo "child id: ".$i."<br />\n";
- unset($a_dialplan_includes_details[$i]);
- }
- $i++;
- }
- }
-
- //if the dialplan include xml file exists then delete it
- if (file_exists($v_conf_dir."/dialplan/default/".$dialplanincludefilename)) {
- unlink($v_conf_dir."/dialplan/default/".$dialplanincludefilename);
- }
-
- unset($dialplanincludefilename);
- unset($a_dialplan_includes[$_GET['id']]);
- write_config();
- sync_package_v_dialplan_includes();
- header("Location: v_dialplan_includes.php");
- exit;
- }
- }
-}
-
-include("head.inc");
-
-?>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-
-<?php
-include("fbegin.inc");
-if ($v_label_show) {
- echo "<p class=\"pgtitle\">$v_label: Dialplan</p>\n";
-}
-?>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-build_menu();
-
-?>
-</td></tr>
-</table>
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
-<form action="v_dialplan_includes.php" method="post" name="iform" id="iform">
-<?php
-
-
-//echo "<pre>";
-//print_r ($a_dialplan_includes);
-//echo "</pre>";
-
-
-//if ($config_change == 1) {
-// write_config();
-// $config_change = 0;
-//}
-
-//if ($savemsg) print_info_box($savemsg);
-//if (file_exists($d_hostsdirty_path)): echo"<p>";
-//print_info_box_np("This has been changed.<br>You must apply the changes in order for them to take effect.");
-//echo"<br />";
-//endif;
-
-?>
-
- <br />
- <br />
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td><span class="vexpl"><span class="red"><strong>Dialplan
- </strong></span></span>
- </td>
- <td align='right'>
- <input type='button' value='default.xml' onclick="document.location.href='v_dialplan.php';">
- </td>
- </tr>
- <tr>
- <td colspan='2'>
- <span class="vexpl">
- The dialplan is used to setup call destinations based on conditions and context.
- You can use the dialplan to send calls to gateways, auto attendants, external numbers,
- to scripts, or any destination.
- </span>
- </td>
-
- </tr>
- </table>
-
- <br />
- <br />
- <br />
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="20%" class="listhdrr">Extension Name</td>
- <td width="25%" class="listhdrr">Order</td>
- <td width="25%" class="listhdrr">Enabled</td>
- <td width="50%" class="listhdr">Description</td>
- <td width="10%" class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="v_dialplan_includes_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
-
- <?php
- //create a temporary id for the array
- $i = 0;
- if (count($a_dialplan_includes) > 0) {
- foreach ($a_dialplan_includes as $ent) {
- $a_dialplan_includes[$i]['id'] = $i;
- $i++;
- }
- }
-
- //order the array
- function cmp_number($a, $b) {
- if ($a["order"] > $b["order"]) {
- return 1;
- }
- else {
- return 0;
- }
- }
- if (count($a_public_includes) > 0) { usort($a_dialplan_includes, "cmp_number"); }
-
- $i = 0;
- if (count($a_dialplan_includes) > 0) {
- foreach ($a_dialplan_includes as $ent) {
- ?>
- <tr>
- <td class="listlr" ondblclick="document.location='v_dialplan_includes_edit.php?id=<?=$ent['id'];?>'">
- <?=$ent['extensionname']?>
- </td>
- <td class="listlr" ondblclick="document.location='v_dialplan_includes_edit.php?id=<?=$ent['id'];?>'">
- <?=$ent['order']?>
- </td>
- <td class="listr" ondblclick="document.location='v_dialplan_includes_edit.php?id=<?=$ent['id'];?>';">
- <?=$ent['enabled'];?>&nbsp;
- </td>
- <td class="listbg" ondblclick="document.location='v_dialplan_includes_edit.php?id=<?=$ent['id'];?>';">
- <font color="#FFFFFF"><?=htmlspecialchars($ent['descr']);?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="v_dialplan_includes_edit.php?id=<?=$ent['id'];?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="v_dialplan_includes.php?type=dialplanincludes&act=del&id=<?=$ent['id'];?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
- $i++;
- }
- }
- ?>
- <tr>
- <td class="list" colspan="4"></td>
- <td class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="v_dialplan_includes_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
-
- <tr>
- <td class="list" colspan="4"></td>
- <td class="list"></td>
- </tr>
- </table>
-
-</form>
-
-<?php
-if ($v_path_show) {
- echo $v_conf_dir."/dialplan/default/\n";
-}
-?>
-
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-
-</td>
-</tr>
-</table>
-
-</div>
-
-
-<?php include("fend.inc"); ?>
-</body>
-</html> \ No newline at end of file
diff --git a/config/freeswitch_dev/v_dialplan_includes_details.tmp b/config/freeswitch_dev/v_dialplan_includes_details.tmp
deleted file mode 100755
index 6cfb3753..00000000
--- a/config/freeswitch_dev/v_dialplan_includes_details.tmp
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-/* $Id$ */
-/*
- v_dialplan_includes_details.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/v_config.inc");
-
-
-$a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config'];
-
-
-if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'dialplanincludedetails') {
- if ($a_dialplan_include_details[$_GET['id']]) {
- unset($a_dialplan_include_details[$_GET['id']]);
- write_config();
- sync_package_v_dialplan_includes();
- //touch($d_hostsdirty_path);
- header("Location: v_dialplan_includes_edit.php?id=".$_GET['parentid']);
- exit;
- }
- }
-}
-
-?> \ No newline at end of file
diff --git a/config/freeswitch_dev/v_dialplan_includes_details_edit.tmp b/config/freeswitch_dev/v_dialplan_includes_details_edit.tmp
deleted file mode 100644
index d3c3aeba..00000000
--- a/config/freeswitch_dev/v_dialplan_includes_details_edit.tmp
+++ /dev/null
@@ -1,403 +0,0 @@
-<?php
-/* $Id$ */
-/*
-
- v_dialplan_includes_details_edit.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/v_config.inc");
-
-
-$a_dialplan_includes_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config'];
-
-$id = $_GET['id'];
-if (isset($_POST['id'])) {
- $id = $_POST['id'];
-}
-
-$parentid = $_GET['parentid'];
-if (isset($_POST['parentid'])) {
- $parentid = $_POST['parentid'];
-}
-
-$dialplanincludeid = $_GET['dialplanincludeid'];
-if (isset($_POST['dialplanincludeid'])) {
- $dialplanincludeid = $_POST['dialplanincludeid'];
-}
-
-
- //dialplanincludeid
- //tag
- //condition
- //action
- //antiaction
- //param
- //fieldorder
- //1-20
- //fieldtype
-
- //fielddata
-
-
-if (isset($id) && $a_dialplan_includes_details[$id]) {
- $pconfig['dialplanincludeid'] = $a_dialplan_includes_details[$id]['dialplanincludeid'];
- $pconfig['tag'] = $a_dialplan_includes_details[$id]['tag'];
- $pconfig['fieldorder'] = $a_dialplan_includes_details[$id]['fieldorder'];
- $pconfig['fieldtype'] = $a_dialplan_includes_details[$id]['fieldtype'];
- $pconfig['fielddata'] = $a_dialplan_includes_details[$id]['fielddata'];
-}
-//else {
-// if (isset($_GET['a'])) {
-// if ($_GET['a'] == "action"){ $pconfig['optionaction'] = "action"; }
-// if ($_GET['a'] == "antiaction"){ $pconfig['optionaction'] = "anti-action"; }
-// }
-//}
-
-
-
-if ($_POST) {
-
- unset($input_errors);
- $pconfig = $_POST;
-
-
- if (!$input_errors) {
-
- $ent = array();
- $ent['dialplanincludeid'] = $_POST['dialplanincludeid'];
- $ent['tag'] = $_POST['tag'];
- $ent['fieldorder'] = $_POST['fieldorder'];
- $ent['fieldtype'] = $_POST['fieldtype'];
- $ent['fielddata'] = $_POST['fielddata'];
-
-
- if (isset($id) && $a_dialplan_includes_details[$id]) {
- //update
- $a_dialplan_includes_details[$id] = $ent;
- }
- else {
- //add
- $a_dialplan_includes_details[] = $ent;
- }
-
- write_config();
- sync_package_v_dialplan_includes();
-
- header("Location: v_dialplan_includes_edit.php?id=".$parentid);
- exit;
- }
-}
-
-include("head.inc");
-
-?>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-
-<?php
-include("fbegin.inc");
-if ($v_label_show) {
- echo "<p class=\"pgtitle\">$v_label: Dialplan: Details: Edit</p>\n";
-}
-?>
-
-<?php if ($input_errors) print_input_errors($input_errors); ?>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-build_menu();
-
-?>
-</td></tr>
-</table>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
- <br />
- <form action="v_dialplan_includes_details_edit.php" method="post" name="iform" id="iform">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="22%" valign="top" class="vncellreq">Tag</td>
- <td width="78%" class="vtable">
- <script type="text/javascript">
- function dialplan_include_details_tag_onchange() {
- var tag = document.getElementById("form_tag").value;
- if (tag == "condition") {
- document.getElementById("label_fieldtype").innerHTML = "Field";
- document.getElementById("label_fielddata").innerHTML = "Expression";
- }
- else if (tag == "action") {
- document.getElementById("label_fieldtype").innerHTML = "Application";
- document.getElementById("label_fielddata").innerHTML = "Data";
- }
- else if (tag == "anti-action") {
- document.getElementById("label_fieldtype").innerHTML = "Application";
- document.getElementById("label_fielddata").innerHTML = "Data";
- }
- else if (tag == "param") {
- document.getElementById("label_fieldtype").innerHTML = "Name";
- document.getElementById("label_fielddata").innerHTML = "Value";
- }
- if (tag == "") {
- document.getElementById("label_fieldtype").innerHTML = "Type";
- document.getElementById("label_fielddata").innerHTML = "Data";
- }
- }
- </script>
- <?php
- echo " <select name='tag' class='formfld' id='form_tag' onchange='dialplan_include_details_tag_onchange();'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['tag'])) {
- case "condition":
- echo " <option selected='yes'>condition</option>\n";
- echo " <option>action</option>\n";
- echo " <option>anti-action</option>\n";
- //echo " <option>param</option>\n";
- break;
- case "action":
- echo " <option>condition</option>\n";
- echo " <option selected='yes'>action</option>\n";
- echo " <option>anti-action</option>\n";
- //echo " <option>param</option>\n";
- break;
- case "anti-action":
- echo " <option>condition</option>\n";
- echo " <option>action</option>\n";
- echo " <option selected='yes'>anti-action</option>\n";
- //echo " <option>param</option>\n";
- break;
- case "param":
- echo " <option>condition</option>\n";
- echo " <option>action</option>\n";
- echo " <option>anti-action</option>\n";
- //echo " <option selected='yes'>param</option>\n";
- break;
- default:
- echo " <option>condition</option>\n";
- echo " <option>action</option>\n";
- echo " <option>anti-action</option>\n";
- //echo " <option>param</option>\n";
- }
- echo " </select>\n";
-
- //condition
- //field expression
- //action
- //application
- //data
- //antiaction
- //application
- //data
- //param
- //name
- //value
-
- ?>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq" id="label_fieldtype">Type</td>
- <td width="78%" class="vtable">
- <input name="fieldtype" type="text" class="formfld" id="fieldtype" size="40" value="<?=htmlspecialchars($pconfig['fieldtype']);?>">
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq" id="label_fielddata">Data</td>
- <td width="78%" class="vtable">
- <input name="fielddata" type="text" class="formfld" id="fielddata" size="40" value="<?=htmlspecialchars($pconfig['fielddata']);?>">
- <br> <span class="vexpl"></span></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq" id="label_fieldtype">Order</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='fieldorder' class='formfld'>\n";
- //echo " <option></option>\n";
- if (strlen(htmlspecialchars($pconfig['fieldorder']))> 0) {
- echo " <option selected='yes' value='".htmlspecialchars($pconfig['fieldorder'])."'>".htmlspecialchars($pconfig['fieldorder'])."</option>\n";
- }
- $i=0;
- while($i<=999) {
- if (strlen($i) == 1) {
- echo " <option value='00$i'>00$i</option>\n";
- }
- if (strlen($i) == 2) {
- echo " <option value='0$i'>0$i</option>\n";
- }
- if (strlen($i) == 3) {
- echo " <option value='$i'>$i</option>\n";
- }
-
- $i++;
- }
- echo " </select>\n";
- ?>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="dialplanincludeid" type="hidden" value="<?=$dialplanincludeid;?>">
- <input name="parentid" type="hidden" value="<?=$parentid;?>">
- <?php if (isset($id) && $a_dialplan_includes_details[$id]): ?>
- <input name="id" type="hidden" value="<?=$id;?>">
- <?php endif; ?>
- <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()">
- </td>
- </tr>
- </table>
- </form>
-
-
- <?php
- if ($v_path_show) {
- echo "<br />\n";
- echo "<br />\n";
- echo "<b>Additional Information</b>\n";
- echo "<br />\n";
- echo "<br />\n";
- echo "<a href='http://wiki.freeswitch.org/wiki/Dialplan_XML' target='_blank'>http://wiki.freeswitch.org/wiki/Dialplan_XML</a>";
- }
- ?>
- <br />
- <br />
- <br />
- <br />
-
- <b>Conditions</b>
- <br />
- <br />
- Conditions are pattern matching tags that help decide if the current call should be processed in this extension or not. When matching conditions against the current call you have several <b>fields</b> that you can compare against.
- <ul>
- <li><b>context</b></li>
- <li><b>rdnis</b> Redirected Number, the directory number to which the call was last presented.</li>
- <li><b>destination_number</b> Called Number, the number this call is trying to reach (within a given context)</li>
- <li><b>dialplan</b> Name of the dialplan module that are used, the name is provided by each dialplan module. Example: XML</li>
- <li><b>caller_id_name</b> Name of the caller (provided by the User Agent that has called us).</li>
- <li><b>caller_id_number</b> Directory Number of the party who called (callee) -- can be masked (hidden)</li>
- <li><b>ani</b> Automatic Number Identification, the number of the calling party (callee) -- cannot be masked</li>
- <li><b>ani2</b> The type of device placing the call [1]</li>
- <li><b>uuid</b> Unique identifier of the current call? (looks like a GUID)</li>
- <li><b>source</b> Name of the module that received the call (e.g. PortAudio)</li>
- <li><b>chan_name</b> Name of the current channel (Example: PortAudio/1234). Give us examples when this one can be used.</li>
- <li><b>network_addr</b> IP address of the signalling source for a VoIP call.</li>
- </ul>
- In addition to the above you can also do variables using the syntax ${variable} or api functions using the syntax %{api} {args}
- <br />
- <br />
- Variables may be used in either the field or the expression, as follows
-
- <br />
- <br />
- <br />
- <br />
-
- <b>Action and Anti-Actions</b>
- <br />
- <br />
- Actions are executed when the <b>condition matches</b>. Anti-Actions are executed when the <b>condition does NOT match</b>.
- <?php
- if ($v_path_show) {
- echo "Additional information on applications for Actions and Anti-Actions.<br />\n";
- echo "<a href='http://wiki.freeswitch.org/wiki/Modules#Applications' target='_blank'>http://wiki.freeswitch.org/wiki/Modules#Applications</a>\n";
- echo "<br />\n";
- echo "<a href='http://wiki.freeswitch.org/wiki/Dialplan_Functions' target='_blank'>http://wiki.freeswitch.org/wiki/Dialplan_Functions</a>\n";
- }
- ?>
- <br />
- <br />
- <br />
- The following is a partial list of <b>applications</b>.
- <ul>
- <li><b>answer</b> answer the call</li>
- <li><b>bridge</b> bridge the call<li>
- <li><b>cond</b></li>
- <li><b>db</b> is a a runtime database either sqlite by default or odbc</li>
- <li><b>global_set</b> allows setting of global vars similar to the ones found in vars.xml</li>
- <li><b>group</b> allows grouping of several extensions for things like ring groups</li>
- <li><b>expr</b></li>
- <li><b>hangup</b> hangs up the call</li>
- <li><b>info</b> sends call info to the console</li>
- <li><b>javascript</b> run javascript .js files</li>
- <li><b>playback</b></li>
- <li><b>reject</b> reject the call</li>
- <li><b>respond</b></li>
- <li><b>ring_ready</b></li>
- <li><b>set</b> set a variable</li>
- <li><b>set_user</b></li>
- <li><b>sleep</b></li>
- <li><b>sofia_contact</b></li>
- <li><b>transfer</b> transfer the call to another extension or number<li>
- <li><b>voicemail</b> send the call to voicemail</li>
- </ul>
-
-
- <br />
- <br />
-
- <!--
- <b>Param</b>
- Example parameters by name and value
- <br />
- <?php
- if ($v_path_show) {
- echo "<a href='http://wiki.freeswitch.org/wiki/Special:Search?search=param&go=Go' target='_blank'>http://wiki.freeswitch.org/wiki/Special:Search?search=param&go=Go</a>\n";
- }
- ?>
- <ul>
- <li><b>codec-ms</b> 20</li>
- <li><b>codec-prefs</b> PCMU@20i</li>
- <li><b>debug</b> 1</li>
- <li><b>dialplan</b> XML</li>
- <li><b>dtmf-duration</b> 100</li>
- <li><b>rfc2833-pt</b>" 101</li>
- <li><b>sip-port</b> 5060</li>
- <li><b>use-rtp-timer</b> true</li>
- </ul>
- <br />
- <br />
- -->
-
-
- <br />
- <br />
- <br />
- <br />
- <br />
-
- </td>
- </tr>
-</table>
-
-</div>
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch_dev/v_dialplan_includes_edit.tmp b/config/freeswitch_dev/v_dialplan_includes_edit.tmp
deleted file mode 100644
index 1355c412..00000000
--- a/config/freeswitch_dev/v_dialplan_includes_edit.tmp
+++ /dev/null
@@ -1,545 +0,0 @@
-<?php
-/* $Id$ */
-/*
- v_dialplan_includes_edit.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/v_config.inc");
-
-
-//freeswitchdialplanincludes
- //dialplanincludeid
- //extensionname
- //context
- //default
- //enabled
- //descr
-
-//
-
-
-
-$a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config'];
-$a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config'];
-
-$id = $_GET['id'];
-if (isset($_POST['id'])) {
- $id = $_POST['id'];
-}
-$parentid = $id;
-
-
-if (isset($id) && $a_dialplan_includes[$id]) {
- $pconfig['dialplanincludeid'] = $a_dialplan_includes[$id]['dialplanincludeid'];
- $dialplanincludeid = $a_dialplan_includes[$id]['dialplanincludeid'];
- $pconfig['extensionname'] = $a_dialplan_includes[$id]['extensionname'];
- $pconfig['order'] = $a_dialplan_includes[$id]['order'];
- $pconfig['context'] = $a_dialplan_includes[$id]['context'];
- $pconfig['enabled'] = $a_dialplan_includes[$id]['enabled'];
- $pconfig['descr'] = $a_dialplan_includes[$id]['descr'];
- $pconfig['opt1name'] = $a_dialplan_includes[$id]['opt1name'];
- $pconfig['opt1value'] = $a_dialplan_includes[$id]['opt1value'];
-}
-
-if ($_POST) {
-
- unset($input_errors);
- $pconfig = $_POST;
-
- if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'dialplanincludedetails') {
- if ($a_dialplan_include_details[$_GET['id']]) {
- unset($a_dialplan_include_details[$_GET['id']]);
- write_config();
- sync_package_v_dialplan_includes();
- header("Location: v_dialplan_include_edit.php?id=".$_GET['id']);
- exit;
- }
- }
- }
-
-
- if (!$input_errors) {
-
- $ent = array();
- if (strlen($_POST['dialplanincludeid']) > 0) {
- //update
- $ent['dialplanincludeid'] = $_POST['dialplanincludeid'];
- }
- else {
- //add
- $ent['dialplanincludeid'] = guid();
- }
- $ent['extensionname'] = $_POST['extensionname'];
- $ent['order'] = $_POST['order'];
- //$ent['context'] = $_POST['context'];
- $ent['context'] = 'default';
- $ent['enabled'] = $_POST['enabled'];
- $ent['descr'] = $_POST['descr'];
- $ent['opt1name'] = $_POST['opt1name'];
- $ent['opt1value'] = $_POST['opt1value'];
-
-
- if (isset($id) && $a_dialplan_includes[$id]) {
-
- if (count($a_dialplan_includes)>0) {
- foreach($a_dialplan_includes as $rowhelper) {
-
- //$rowhelper['dialplanincludeid'];
- //$rowhelper['extensionname'];
- //$rowhelper['context'];
- //$rowhelper['enabled'];
-
- $filenamechanged = false;
- if ($rowhelper['dialplanincludeid'] == $_POST['dialplanincludeid']) {
-
- if ($rowhelper['extensionname'] != $_POST['extensionname']) {
- //if the extension name has changed then remove the current dialplan xml file
- //to prepare for the new file
- $filenamechanged = true;
- }
- if ($rowhelper['order'] != $_POST['order']) {
- //if the order has changed then remove the current dialplan xml file
- //to prepare for the new file
- $filenamechanged = true;
- }
- if ($_POST['enabled'] == "false") {
- //if the extension name is disabled then remove the dialplan xml file
- $filenamechanged = true;
- }
- if ($filenamechanged){
- $dialplanincludefilename = $rowhelper['order']."_".$rowhelper['extensionname'].".xml";
- if (file_exists($v_conf_dir."/dialplan/default/".$dialplanincludefilename)) {
- unlink($v_conf_dir."/dialplan/default/".$dialplanincludefilename);
- }
- unset($dialplanincludefilename);
- }
-
- }
- unset($filenamechanged);
-
- } //end foreach
- } //end count
-
- //update the config
- $a_dialplan_includes[$id] = $ent;
- }
- else {
- //add to the config
- $a_dialplan_includes[] = $ent;
- }
-
-
- write_config();
- sync_package_v_dialplan_includes();
-
- header("Location: v_dialplan_includes.php");
- exit;
- }
-}
-
-include("head.inc");
-
-?>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-
-<?php
-include("fbegin.inc");
-if ($v_label_show) {
- echo "<p class=\"pgtitle\">$v_label: Dialplan: Edit</p>\n";
-}
-?>
-
-<?php if ($input_errors) print_input_errors($input_errors); ?>
-
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-build_menu();
-
-?>
-</td></tr>
-</table>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Dialplan:<br>
- </strong></span>
- Dialplan Include general settings.
- </span></p></td>
- </tr>
- </table>
- <br />
-
- <form action="v_dialplan_includes_edit.php" method="post" name="iform" id="iform">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="22%" valign="top" class="vncellreq">Extension Name</td>
- <td width="78%" class="vtable">
- <input name="extensionname" type="text" class="formfld" id="extensionname" size="40" value="<?=htmlspecialchars($pconfig['extensionname']);?>">
- <br />
- Supported characters are 'a-z', 'A-Z', '0-9', underscore '_', and period '.'.
- </td>
- </tr>
- <!--
- <tr>
- <td width="22%" valign="top" class="vncellreq">Context</td>
- <td width="78%" class="vtable">
- <input name="context" type="text" class="formfld" id="context" size="40" value="<?=htmlspecialchars($pconfig['context']);?>">
- <br />
- e.g. default
- </td>
- </tr>
- -->
-
- <tr>
- <td width="22%" valign="top" class="vncellreq">Enabled</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='enabled' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['enabled'])) {
- case "true":
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- break;
- case "false":
- echo " <option value='true'>true</option>\n";
- echo " <option value='false' selected='yes'>false</option>\n";
-
- break;
- default:
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- }
- echo " </select>\n";
- ?>
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncellreq">Order</td>
- <td width="78%" class="vtable">
- <?php
-
- echo " <select name='order' class='formfld'>\n";
- //echo " <option></option>\n";
- if (strlen(htmlspecialchars($pconfig['order']))> 0) {
- echo " <option selected='yes' value='".htmlspecialchars($pconfig['order'])."'>".htmlspecialchars($pconfig['order'])."</option>\n";
- }
- $i=0;
- while($i<=999) {
- if (strlen($i) == 1) {
- echo " <option value='00$i'>00$i</option>\n";
- }
- if (strlen($i) == 2) {
- echo " <option value='0$i'>0$i</option>\n";
- }
- if (strlen($i) == 3) {
- echo " <option value='$i'>$i</option>\n";
- }
-
- $i++;
- }
- echo " </select>\n";
- ?>
- <br />
- Processing of each dialplan include is determined by this order.
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncell">Description</td>
- <td width="78%" class="vtable">
- <input name="descr" type="text" class="formfld" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>">
- <br> <span class="vexpl">You may enter a description here
- for your reference (not parsed).</span></td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="dialplanincludeid" type="hidden" value="<?=htmlspecialchars($pconfig['dialplanincludeid']);?>">
- <?php
- if (strlen($id) > 0 && $a_dialplan_includes[$id]) {
- echo "\n";
- echo " <input name=\"id\" type=\"hidden\" value=\"$id\">\n";
- echo " <input name=\"opt1name\" type=\"hidden\" value=\"".htmlspecialchars($pconfig['opt1name'])."\">\n";
- echo " <input name=\"opt1value\" type=\"hidden\" value=\"".htmlspecialchars($pconfig['opt1value'])."\">\n";
- }
- ?>
- <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()">
- </td>
- </tr>
- </table>
- </form>
-
- <br>
- <br>
-
- <form action="v_dialplan_includes_edit.php" method="post" name="iform2" id="iform2">
- <?php
-
- //echo "<pre>";
- //print_r ($a_dialplan_includes);
- //echo "</pre>";
-
- //if ($savemsg) print_info_box($savemsg);
- //if (file_exists($d_hostsdirty_path)): echo"<p>";
- //print_info_box_np("The FreeSWITCH recordings have been changed.<br>You must apply the changes in order for them to take effect.");
- //echo"<br />";
- //endif;
-
- //create a temporary id for the array
- $i = 0;
- if (count($a_dialplan_include_details) > 0) {
- foreach ($a_dialplan_include_details as $ent) {
- $a_dialplan_include_details[$i]['id'] = $i;
- $i++;
- }
- }
-
- //order the array
- function cmp_number($a, $b) {
- if ($a["fieldorder"] > $b["fieldorder"]) {
- return 1;
- }
- else {
- return 0;
- }
- }
- if (count($a_dialplan_include_details) > 0) { usort($a_dialplan_include_details, "cmp_number"); }
-
- ?>
-
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Conditions and Actions<br />
- </strong></span>
- The following conditions, actions and anti-actions are used in the dialplan to direct call flow. Each is processed in order until you reach the action tag which tells FreeSWITCH what action to perform. You are not limited to only one condition or action tag for a given extension.
- </span></p></td>
- </tr>
- </table>
- <br />
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="40" class="listhdrr">Tag</td>
- <td width="40" class="listhdrr">Type</td>
- <td width="50%" class="listhdrr">Data</td>
- <td width="40" class="listhdrr">Order</td>
- <td width="40" class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="v_dialplan_includes_details_edit.php?parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>&a=action"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
-
- <?php
-
- $i = 0;
- if (count($a_dialplan_include_details) > 0) {
-
- foreach ($a_dialplan_include_details as $ent) {
- if ($ent['tag'] == "condition" && $dialplanincludeid == $ent['dialplanincludeid']) {
- ?>
- <tr>
- <td class="listlr" ondblclick="document.location='v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>'">
- <?=$ent['tag']?>
- </td>
- <td class="listr" ondblclick="document.location='v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';">
- <?=$ent['fieldtype'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';">
- <?=$ent['fielddata'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';">
- <?=$ent['fieldorder'];?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="v_dialplan_includes_details.php?type=dialplanincludedetails&act=del&id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
- }
- $i++;
- }
- }
-
- $i = 0;
- if (count($a_dialplan_include_details) > 0) {
-
- foreach ($a_dialplan_include_details as $ent) {
- if ($ent['tag'] == "action" && $dialplanincludeid == $ent['dialplanincludeid']) {
- ?>
- <tr>
- <td class="listlr" ondblclick="document.location='v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>'">
- <?=$ent['tag']?>
- </td>
- <td class="listr" ondblclick="document.location='v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';">
- <?=$ent['fieldtype'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';">
- <?=$ent['fielddata'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';">
- <?=$ent['fieldorder'];?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="v_dialplan_includes_details.php?type=dialplanincludedetails&act=del&id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
- }
- $i++;
- }
- }
-
- $i = 0;
- if (count($a_dialplan_include_details) > 0) {
-
- foreach ($a_dialplan_include_details as $ent) {
- if ($ent['tag'] == "anti-action" && $dialplanincludeid == $ent['dialplanincludeid']) {
- ?>
- <tr>
- <td class="listlr" ondblclick="document.location='v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>'">
- <?=$ent['tag']?>
- </td>
- <td class="listr" ondblclick="document.location='v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';">
- <?=$ent['fieldtype'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';">
- <?=$ent['fielddata'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';">
- <?=$ent['fieldorder'];?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="v_dialplan_includes_details.php?type=dialplanincludedetails&act=del&id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
- }
- $i++;
- }
- }
-
- $i = 0;
- if (count($a_dialplan_include_details) > 0) {
-
- foreach ($a_dialplan_include_details as $ent) {
- if ($ent['tag'] == "param" && $dialplanincludeid == $ent['dialplanincludeid']) {
- ?>
- <tr>
- <td class="listlr" ondblclick="document.location='v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>'">
- <?=$ent['tag']?>
- </td>
- <td class="listr" ondblclick="document.location='v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';">
- <?=$ent['fieldtype'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';">
- <?=$ent['fielddata'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';">
- <?=$ent['fieldorder'];?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="v_dialplan_includes_details.php?type=dialplanincludedetails&act=del&id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
- }
- $i++;
- }
- }
- ?>
- <tr>
- <td class="list" colspan="4"></td>
- <td class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="v_dialplan_includes_details_edit.php?parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>&a=action"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
-
-
- <tr>
- <td class="list" colspan="4"></td>
- <td class="list"></td>
- </tr>
- </table>
-
- </form>
-
-
-
-
- <br>
- <br>
-
- </td>
- </tr>
-</table>
-
-</div>
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch_dev/v_extensions.tmp b/config/freeswitch_dev/v_extensions.tmp
deleted file mode 100644
index 2eb5a554..00000000
--- a/config/freeswitch_dev/v_extensions.tmp
+++ /dev/null
@@ -1,226 +0,0 @@
-<?php
-/* $Id$ */
-/*
- v_extensions.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/v_config.inc");
-
-$a_extensions = &$config['installedpackages']['freeswitchextensions']['config'];
-
-
-if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'extensions') {
- if ($a_extensions[$_GET['id']]) {
- $tmp_file_name = $v_conf_dir."/directory/default/".$_GET['extension'].".xml";
- if (file_exists($tmp_file_name)) {
- unlink($tmp_file_name);
- }
- unset($a_extensions[$_GET['id']]);
- write_config();
- header("Location: v_extensions.php");
- exit;
- }
- }
-}
-
-include("head.inc");
-
-?>
-
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-
-<?php
-include("fbegin.inc");
-if ($v_label_show) {
- echo "<p class=\"pgtitle\">$v_label: Extensions</p>\n";
-}
-?>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-build_menu();
-
-?>
-</td></tr>
-</table>
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
-<form action="v_extensions.php" method="post" name="iform" id="iform">
-<?php
-
-if ($config_change == 1) {
- write_config();
- $config_change = 0;
-}
-
-//if ($savemsg) print_info_box($savemsg);
-//if (file_exists($d_hostsdirty_path)): echo"<p>";
-//print_info_box_np("The FreeSWITCH extensions have been changed.<br>You must apply the changes in order for them to take effect.");
-//echo"<br />";
-//endif;
-
-?>
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Extensions<br>
- </strong></span>
- Use this to configure your SIP extensions.
- </p></td>
- </tr>
- </table>
- <br />
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="20%" class="listhdrr">Extension</td>
- <td width="25%" class="listhdrr">Mail To</td>
- <td width="25%" class="listhdrr">Call Group</td>
- <td width="25%" class="listhdr">Description</td>
- <td width="10%" class="list">
-
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="v_extensions_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
-
- </td>
- </tr>
-
-
- <?php
-
- //create a temporary id for the array
- $i = 0;
- if (count($a_extensions) > 0) {
- foreach ($a_extensions as $ent) {
- $a_extensions[$i]['id'] = $i;
- $i++;
- }
- }
-
- //order the array
- function cmp_number($a, $b) {
- if ($a["extension"] > $b["extension"]) {
- return 1;
- }
- else {
- return 0;
- }
- }
- if (count($a_extensions) > 0) { usort($a_extensions, "cmp_number"); }
-
- $i = 0;
- if (count($a_extensions) > 0) {
-
- foreach ($a_extensions as $ent) {
-
- ?>
- <tr>
- <td class="listr" ondblclick="document.location='v_extensions_edit.php?id=<?=$ent['id'];?>';">
- <?=$ent['extension'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='v_extensions_edit.php?id=<?=$ent['id'];?>';">
- <?=$ent['vm-mailto'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='v_extensions_edit.php?id=<?=$ent['id'];?>';">
- <?=$ent['callgroup'];?>&nbsp;
- </td>
- <td class="listbg" ondblclick="document.location='v_extensions_edit.php?id=<?=$ent['id'];?>';">
- <font color="#FFFFFF"><?=htmlspecialchars($ent['description']);?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="v_extensions_edit.php?id=<?=$ent['id'];?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="v_extensions.php?type=extensions&act=del&id=<?=$ent['id'];?>&extension=<?=$ent['extension'];?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
-
- $i++;
- }
- }
- ?>
-
- <tr>
- <td class="list" colspan="4"></td>
- <td class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="v_extensions_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
-
-
- <tr>
- <td class="list" colspan="4"></td>
- <td class="list"></td>
- </tr>
- </table>
-
-</form>
-
-<?php
-if ($v_path_show) {
- echo $v_conf_dir."/directory/default/\n";
-}
-?>
-
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-
-</td>
-</tr>
-</table>
-
-</div>
-
-
-<?php include("fend.inc"); ?>
-</body>
-</html> \ No newline at end of file
diff --git a/config/freeswitch_dev/v_extensions_edit.tmp b/config/freeswitch_dev/v_extensions_edit.tmp
deleted file mode 100644
index 490a96db..00000000
--- a/config/freeswitch_dev/v_extensions_edit.tmp
+++ /dev/null
@@ -1,424 +0,0 @@
-<?php
-/* $Id$ */
-/*
- v_extensions_edit.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/v_config.inc");
-
-
-$a_extensions = &$config['installedpackages']['freeswitchextensions']['config'];
-
-$id = $_GET['id'];
-if (isset($_POST['id'])) {
- $id = $_POST['id'];
-}
-
-if (isset($id) && $a_extensions[$id]) {
-
- $pconfig['extension'] = $a_extensions[$id]['extension'];
- $pconfig['password'] = $a_extensions[$id]['password'];
- $pconfig['mailbox'] = $a_extensions[$id]['mailbox'];
- $pconfig['vm-password'] = $a_extensions[$id]['vm-password'];
- $pconfig['accountcode'] = $a_extensions[$id]['accountcode'];
- $pconfig['effective_caller_id_name'] = $a_extensions[$id]['effective_caller_id_name'];
- $pconfig['effective_caller_id_number'] = $a_extensions[$id]['effective_caller_id_number'];
- $pconfig['effective_caller_id_number'] = $a_extensions[$id]['effective_caller_id_number'];
- $pconfig['outbound_caller_id_name'] = $a_extensions[$id]['outbound_caller_id_name'];
- $pconfig['outbound_caller_id_number'] = $a_extensions[$id]['outbound_caller_id_number'];
- $pconfig['vm-mailto'] = $a_extensions[$id]['vm-mailto'];
- $pconfig['vm-attach-file'] = $a_extensions[$id]['vm-attach-file'];
- $pconfig['vm-keep-local-after-email'] = $a_extensions[$id]['vm-keep-local-after-email'];
- $pconfig['user_context'] = $a_extensions[$id]['user_context'];
- $pconfig['callgroup'] = $a_extensions[$id]['callgroup'];
- $pconfig['auth-acl'] = $a_extensions[$id]['auth-acl'];
- $pconfig['cidr'] = $a_extensions[$id]['cidr'];
- $pconfig['sip-force-contact'] = $a_extensions[$id]['sip-force-contact'];
- $pconfig['enabled'] = $a_extensions[$id]['enabled'];
- $pconfig['description'] = $a_extensions[$id]['description'];
-
-}
-
-if ($_POST) {
-
- unset($input_errors);
- $pconfig = $_POST;
-
-
- if (!$input_errors) {
-
- $effective_caller_id_number = $_POST['effective_caller_id_number'];
- $outbound_caller_id_number = $_POST['outbound_caller_id_number'];
- $replace_array = array("(", ")", " ", "-");
- $effective_caller_id_number = str_replace($replace_array, "", $effective_caller_id_number);
- $outbound_caller_id_number = str_replace($replace_array, "", $outbound_caller_id_number);
-
- $ent = array();
- $ent['extension'] = $_POST['extension'];
- $ent['password'] = $_POST['password'];
- $ent['mailbox'] = $_POST['mailbox'];
- $ent['vm-password'] = $_POST['vm-password'];
- $ent['accountcode'] = $_POST['accountcode'];
- $ent['effective_caller_id_name'] = $_POST['effective_caller_id_name'];
- $ent['effective_caller_id_number'] = $effective_caller_id_number;
- $ent['outbound_caller_id_name'] = $_POST['outbound_caller_id_name'];
- $ent['outbound_caller_id_number'] = $outbound_caller_id_number;
- $ent['vm-mailto'] = $_POST['vm-mailto'];
- $ent['vm-attach-file'] = $_POST['vm-attach-file'];
- $ent['vm-keep-local-after-email'] = $_POST['vm-keep-local-after-email'];
- $ent['user_context'] = $_POST['user_context'];
- $ent['callgroup'] = $_POST['callgroup'];
- $ent['auth-acl'] = $_POST['auth-acl'];
- $ent['cidr'] = $_POST['cidr'];
- $ent['sip-force-contact'] = $_POST['sip-force-contact'];
- $ent['enabled'] = $_POST['enabled'];
- $ent['description'] = $_POST['description'];
-
- if (isset($id) && $a_extensions[$id]) {
- //update
- $a_extensions[$id] = $ent;
- }
- else {
- //add
- $a_extensions[] = $ent;
- }
-
- write_config();
- sync_package_v_extensions();
-
- header("Location: v_extensions.php");
- exit;
- }
-}
-
-include("head.inc");
-
-?>
-
-<script type="text/javascript" language="JavaScript">
-
-function show_advanced_config() {
- document.getElementById("showadvancedbox").innerHTML='';
- aodiv = document.getElementById('showadvanced');
- aodiv.style.display = "block";
-}
-
-</script>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-
-<?php
-include("fbegin.inc");
-if ($v_label_show) {
- echo "<p class=\"pgtitle\">$v_label: Extensions: Edit</p>\n";
-}
-?>
-
-<?php if ($input_errors) print_input_errors($input_errors); ?>
-
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-build_menu();
-
-?>
-</td></tr>
-</table>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Extension Setup<br>
- </strong></span>
- <?php
- if ($v_path_show) {
- echo $v_conf_dir."/directory/default/\n";
- }
- ?>
- </p></td>
- </tr>
- </table>
- <br />
-
- <form action="v_extensions_edit.php" method="post" name="iform" id="iform">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
-
- <tr>
- <td width="25%" valign="top" class="vncellreq">Extension</td>
- <td width="75%" class="vtable">
- <input name="extension" type="text" class="formfld" id="extension" size="40" value="<?=htmlspecialchars($pconfig['extension']);?>">
- <br><span class="vexpl">Enter the extension here. The default configuration allows 3, 4, or 5 digit extensions.<br></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncellreq">Password</td>
- <td width="75%" class="vtable">
- <input name="password" type="password" class="formfld" id="password" size="40" value="<?=htmlspecialchars($pconfig['password']);?>">
- <br><span class="vexpl">Enter the password here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncellreq">Mailbox</td>
- <td width="75%" class="vtable">
- <input name="mailbox" type="text" class="formfld" id="mailbox" size="40" value="<?=htmlspecialchars($pconfig['mailbox']);?>">
- <br><span class="vexpl">Enter the mailbox here. Example: extension 1001 then mailbox 1001<br></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncellreq">Voicemail Password</td>
- <td width="75%" class="vtable">
- <input name="vm-password" type="password" class="formfld" id="vm-password" size="40" value="<?=htmlspecialchars($pconfig['vm-password']);?>">
- <br><span class="vexpl">Enter the voicemail password here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncellreq">Account Code</td>
- <td width="75%" class="vtable">
- <input name="accountcode" type="text" class="formfld" id="accountcode" size="40" value="<?=htmlspecialchars($pconfig['accountcode']);?>">
- <br><span class="vexpl">Enter the account code here. Example: extension 1001 then accountcode 1001<br></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncellreq" nowrap>Effective Caller ID Name</td>
- <td width="75%" class="vtable">
- <input name="effective_caller_id_name" type="text" class="formfld" id="effective_caller_id_name" size="40" value="<?=htmlspecialchars($pconfig['effective_caller_id_name']);?>">
- <br><span class="vexpl">Enter the effective caller id name here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncellreq" nowrap>Effective Caller ID Number</td>
- <td width="75%" class="vtable">
- <input name="effective_caller_id_number" type="text" class="formfld" id="effective_caller_id_number" size="40" value="<?=htmlspecialchars($pconfig['effective_caller_id_number']);?>">
- <br><span class="vexpl">Enter the effective caller id number here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncellreq" nowrap>Voicemail Mail To</td>
- <td width="75%" class="vtable">
- <input name="vm-mailto" type="text" class="formfld" id="vm-mailto" size="40" value="<?=htmlspecialchars($pconfig['vm-mailto']);?>">
- <br><span class="vexpl">Optional: Enter the email address to send voicemail to.<br></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncellreq" nowrap>Voicemail Attach File</td>
- <td width="75%" class="vtable">
- <?php
- echo " <select name='vm-attach-file' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['vm-attach-file'])) {
- case "true":
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- break;
- case "false":
- echo " <option value='true'>true</option>\n";
- echo " <option value='false' selected='yes'>false</option>\n";
-
- break;
- default:
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- }
- echo " </select>\n";
- ?>
- Choose whether to attach the file to the email.
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncellreq" nowrap>VM Keep Local After Email</td>
- <td width="75%" class="vtable">
- <?php
- echo " <select name='vm-keep-local-after-email' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['vm-keep-local-after-email'])) {
- case "true":
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- break;
- case "false":
- echo " <option value='true'>true</option>\n";
- echo " <option value='false' selected='yes'>false</option>\n";
-
- break;
- default:
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- }
- echo " </select>\n";
- ?>
- Keep local file after sending the email.
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncellreq">User Context</td>
- <td width="75%" class="vtable">
- <input name="user_context" type="text" class="formfld" id="user_context" size="40" value="<?=htmlspecialchars($pconfig['user_context']);?>">
- <br><span class="vexpl">Enter the user context here. Example: default<br></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncellreq">Call Group</td>
- <td width="75%" class="vtable">
- <input name="callgroup" type="text" class="formfld" id="callgroup" size="40" value="<?=htmlspecialchars($pconfig['callgroup']);?>">
- <br><span class="vexpl">Enter the user call group here. Example: sales, support<br></span>
- </td>
- </tr>
- </table>
-
- <div id="showadvancedbox">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="25%" valign="top" class="vncell">Show Advanced</td>
- <td width="75%" class="vtable">
- <input type="button" onClick="show_advanced_config()" value="Advanced"></input></a>
- </td>
- </tr>
- </table>
- </div>
- <div id="showadvanced" style="display:none">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="25%" valign="top" class="vncell">Auth-ACL</td>
- <td width="75%" class="vtable">
- <input name="auth-acl" type="text" class="formfld" id="auth-acl" size="40" value="<?=htmlspecialchars($pconfig['auth-acl']);?>">
- <br> <span class="vexpl">Enter the auth acl here.<br></span>
- </td>
- </tr>
- <tr>
- <td valign="top" class="vncell">CIDR</td>
- <td class="vtable">
- <input name="cidr" type="text" class="formfld" id="cidr" size="40" value="<?=htmlspecialchars($pconfig['cidr']);?>">
- <br> <span class="vexpl">Enter the cidr here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncell" nowrap>Outbound Caller ID Name</td>
- <td width="75%" class="vtable">
- <input name="outbound_caller_id_name" type="text" class="formfld" id="outbound_caller_id_name" size="40" value="<?=htmlspecialchars($pconfig['outbound_caller_id_name']);?>">
- <br><span class="vexpl">Enter the outbound caller id name here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncell" nowrap>Outbound Caller ID Number</td>
- <td width="75%" class="vtable">
- <input name="outbound_caller_id_number" type="text" class="formfld" id="outbound_caller_id_number" size="40" value="<?=htmlspecialchars($pconfig['outbound_caller_id_number']);?>">
- <br><span class="vexpl">Enter the outbound caller id number here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">SIP-Force-Contact</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='sip-force-contact' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['sip-force-contact'])) {
- case "NDLB-connectile-dysfunction":
- echo " <option value='NDLB-connectile-dysfunction' selected='yes'>Rewrite contact IP and port</option>\n";
- echo " <option value='NDLB-tls-connectile-dysfunction'>Rewrite contact port</option>\n";
- break;
- case "NDLB-tls-connectile-dysfunction":
- echo " <option value='NDLB-connectile-dysfunction'>Rewrite contact IP and port</option>\n";
- echo " <option value='NDLB-tls-connectile-dysfunction' selected='yes'>Rewrite contact port</option>\n";
- default:
- echo " <option value='NDLB-connectile-dysfunction'>Rewrite contact IP and port</option>\n";
- echo " <option value='NDLB-tls-connectile-dysfunction'>Rewrite contact port</option>\n";
- }
- echo " </select>\n";
- ?>
- <br />
- Choose sip-force-contact can be used to NDLB-connectile-dysfunction rewrites contact IP and port, <br />and NDLB-tls-connectile-dysfunction rewrites the contact port.<br />
- </td>
- </tr>
- </table>
- </div>
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="22%" valign="top" class="vncellreq">Enabled</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='enabled' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['enabled'])) {
- case "true":
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- break;
- case "false":
- echo " <option value='true'>true</option>\n";
- echo " <option value='false' selected='yes'>false</option>\n";
-
- break;
- default:
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- }
- echo " </select>\n";
- ?>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncellreq">Extension Description</td>
- <td width="75%" class="vtable">
- <input name="description" type="text" class="formfld" id="description" size="40" value="<?=htmlspecialchars($pconfig['description']);?>">
- <br><span class="vexpl">Enter the description of the extension here.<br></span>
- </td>
- </tr>
- <tr>
- <td valign="top">&nbsp;</td>
- <td>
- <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()">
- <?php if (isset($id) && $a_extensions[$id]): ?>
- <input name="id" type="hidden" value="<?=$id;?>">
- <?php endif; ?>
- </td>
- </tr>
- </table>
- </form>
-
- <br>
- <br>
- <br>
- <br>
- <br>
- <br>
-
- </td>
- </tr>
-</table>
-
-</div>
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch_dev/v_fax.tmp b/config/freeswitch_dev/v_fax.tmp
deleted file mode 100644
index 5085614f..00000000
--- a/config/freeswitch_dev/v_fax.tmp
+++ /dev/null
@@ -1,316 +0,0 @@
-<?php
-/* $Id$ */
-/*
- v_fax.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/v_config.inc");
-
-$a_fax = &$config['installedpackages']['freeswitchfax']['config'];
-$dir_fax = $v_storage_dir.'/fax/inbox/';
-
-if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'fax') {
- if ($a_fax[$_GET['id']]) {
-
- $faxid = $a_fax[$_GET['id']][faxid];
- $faxname = $a_fax[$_GET['id']][faxname];
-
- $a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config'];
- $a_dialplan_includes_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config'];
-
- //delete the dialplan include
- if (count($a_dialplan_includes) > 0) {
- $i=0;
- foreach($a_dialplan_includes as $row) {
- if ($row["dialplanincludeid"] == $faxid) {
- $order = $row['order'];
- unset($a_dialplan_includes[$i]);
- }
- $i++;
- }
- }
-
- //delete the dialplan include details. aka. child data
- if (count($a_dialplan_includes_details) > 0) {
- $i=0;
- foreach($a_dialplan_includes_details as $row) {
- if ($row["dialplanincludeid"] == $faxid) {
- unset($a_dialplan_includes_details[$i]);
- }
- $i++;
- }
- }
-
- if (file_exists($v_conf_dir."/dialplan/default/".$order."_".$faxname.".xml")){
- unlink($v_conf_dir."/dialplan/default/".$order."_".$faxname.".xml");
- }
-
- //remove fax entries
- unset($a_fax[$_GET['id']]);
-
- write_config();
- header("Location: v_fax.php");
- exit;
- }
- }
-}
-
-if ($_GET['a'] == "download") {
-
- session_cache_limiter('public');
-
- if ($_GET['type'] = "fax_file") {
- if (file_exists($dir_fax.$_GET['filename'])) {
- $fd = fopen($dir_fax.$_GET['filename'], "rb");
- if ($_GET['t'] == "bin") {
- header("Content-Type: application/force-download");
- header("Content-Type: application/octet-stream");
- header("Content-Type: application/download");
- header("Content-Description: File Transfer");
- header('Content-Disposition: attachment; filename="'.$_GET['filename'].'"');
- }
- else {
- $file_ext = substr($_GET['filename'], -3);
- if ($file_ext == "png") {
- header("Content-Type: image/png");
- }
- }
- header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
- header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
- header("Content-Length: " . filesize($dir_fax.$_GET['filename']));
- fpassthru($fd);
- }
- }
-
- exit;
-}
-else {
- //echo $dir_fax.$_GET['filename'];
-}
-
-
-if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'fax_file') {
- //if ($a_fax[$_GET['id']]) {
- $tmp_file_array = split("\.",$_GET['filename']);
- $file_name = $tmp_file_array[0];
- $file_ext = $tmp_file_array[1];
- unlink_if_exists($dir_fax.$file_name.".pdf");
- unlink_if_exists($dir_fax.$file_name.".png");
- unlink_if_exists($dir_fax.$file_name.".tif");
- //unset($a_fax[$_GET['id']]);
- write_config();
- header("Location: v_fax.php");
- exit;
- //}
- }
-
-}
-
-include("head.inc");
-
-?>
-
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-
-<?php
-include("fbegin.inc");
-if ($v_label_show) {
- echo "<p class=\"pgtitle\">$v_label: FAX</p>\n";
-}
-?>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-build_menu();
-
-?>
-</td></tr>
-</table>
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
-<form action="v_fax.php" method="post" name="iform" id="iform">
-<?php
-
-if ($config_change == 1) {
- write_config();
- $config_change = 0;
-}
-
-//if ($savemsg) print_info_box($savemsg);
-//if (file_exists($d_hostsdirty_path)): echo"<p>";
-//print_info_box_np("The FreeSWITCH fax have been changed.<br>You must apply the changes in order for them to take effect.");
-//echo"<br />";
-//endif;
-
-?>
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>FAX<br>
- </strong></span>
- To receive a FAX setup a fax extension and then direct the incoming FAX with a dedicated number or you can detect the FAX tone by using
- <?php
- if ($v_path_show) {
- echo "<a href='http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_tone_detect' target='_blank'>tone detection</a>\n";
- }
- else {
- echo "tone detection\n";
- }
- ?>
- on the Public tab.
- </p></td>
- </tr>
- </table>
- <br />
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="40" class="listhdrr">Extension</td>
- <td width="40" class="listhdrr" nowrap>Name</td>
- <td width="40%" class="listhdrr" nowrap>Email</td>
- <td width="40" class="listhdrr">Domain</td>
- <td width="50%" class="listhdr">Description</td>
- <td width="40" class="list">
-
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="v_fax_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
-
- </td>
- </tr>
-
-
- <?php
-
- //create a temporary id for the array
- $i = 0;
- if (count($a_fax) > 0) {
- foreach ($a_fax as $ent) {
- $a_fax[$i]['id'] = $i;
- $i++;
- }
- }
-
- //order the array
- function cmp_number($a, $b) {
- if ($a["faxextension"] > $b["faxextension"]) {
- return 1;
- }
- else {
- return 0;
- }
- }
- if (count($a_fax) > 0) { usort($a_fax, "cmp_number"); }
-
- $i = 0;
- if (count($a_fax) > 0) {
-
- foreach ($a_fax as $ent) {
- if (strlen($ent['faxextension']) > 0) {
- ?>
- <tr>
- <td class="listr" ondblclick="document.location='v_fax_edit.php?id=<?=$ent['id'];?>';">
- <?=$ent['faxextension'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='v_fax_edit.php?id=<?=$ent['id'];?>';">
- <?=$ent['faxname'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='v_fax_edit.php?id=<?=$ent['id'];?>';">
- <?=$ent['faxemail'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='v_fax_edit.php?id=<?=$ent['id'];?>';">
- <?=$ent['faxdomain'];?>&nbsp;
- </td>
- <td class="listbg" ondblclick="document.location='v_fax_edit.php?id=<?=$ent['id'];?>';">
- <font color="#FFFFFF"><?=htmlspecialchars($ent['faxdescription']);?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="v_fax_edit.php?id=<?=$ent['id'];?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="v_fax.php?type=fax&act=del&id=<?=$ent['id'];?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
- }
-
- $i++;
- }
- }
- ?>
-
- <tr>
- <td class="list" colspan="5"></td>
- <td class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="v_fax_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
-
-
- <tr>
- <td class="list" colspan="5"></td>
- <td class="list"></td>
- </tr>
- </table>
-
-</form>
-
-
-<br />
-<br />
-<br />
-<br />
-
-
-</td>
-</tr>
-</table>
-
-</div>
-
-
-<?php include("fend.inc"); ?>
-</body>
-</html> \ No newline at end of file
diff --git a/config/freeswitch_dev/v_fax_edit.tmp b/config/freeswitch_dev/v_fax_edit.tmp
deleted file mode 100644
index 603e72c4..00000000
--- a/config/freeswitch_dev/v_fax_edit.tmp
+++ /dev/null
@@ -1,760 +0,0 @@
-<?php
-/* $Id$ */
-/*
- v_fax_edit.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/v_config.inc");
-
-$a_fax = &$config['installedpackages']['freeswitchfax']['config'];
-
-$id = $_GET['id'];
-if (strlen($id) == 0) {
- $id = $_POST['id'];
-}
-$parentid = $id;
-
-if (isset($id) && $a_fax[$id]) {
- $pconfig['faxid'] = $a_fax[$id]['faxid'];
- $faxid = $a_fax[$id]['faxid'];
- $pconfig['faxextension'] = $a_fax[$id]['faxextension'];
- $pconfig['faxname'] = $a_fax[$id]['faxname'];
- $pconfig['faxemail'] = $a_fax[$id]['faxemail'];
- $pconfig['faxdomain'] = $a_fax[$id]['faxdomain'];
- $pconfig['faxdescription'] = $a_fax[$id]['faxdescription'];
-
- if (!is_dir($v_storage_dir)) {
- exec("mkdir ".$v_storage_dir);
- }
-
- if (!is_dir($v_storage_dir.'/fax/')) {
- exec("mkdir ".$v_storage_dir."/fax/");
- }
-
- $faxfolder = $v_storage_dir.'/fax/'.$a_fax[$id]['faxextension'];
- if (!is_dir($faxfolder)) {
- exec('mkdir '.$faxfolder);
- }
- if (!is_dir($faxfolder.'/inbox/')) {
- exec('mkdir '.$faxfolder.'/inbox/');
- }
- if (!is_dir($faxfolder.'/sent/')) {
- exec('mkdir '.$faxfolder.'/sent/');
- }
- if (!is_dir($faxfolder.'/temp/')) {
- exec('mkdir '.$faxfolder.'/temp/');
- }
-}
-
-clearstatcache(); //clear file status cache
-$dir_fax_inbox = $v_storage_dir.'/fax/'.$pconfig['faxextension'].'/inbox/';
-$dir_fax_sent = $v_storage_dir.'/fax/'.$pconfig['faxextension'].'/sent/';
-$dir_fax_temp = $v_storage_dir.'/fax/'.$pconfig['faxextension'].'/temp/';
-
-if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'fax') {
- if ($a_fax[$_GET['id']]) {
-
- $faxid = $a_fax[$_GET['id']][faxid];
- $faxname = $a_fax[$_GET['id']][faxname];
-
- $a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config'];
- $a_dialplan_includes_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config'];
-
- //delete the dialplan include
- if (count($a_dialplan_includes) > 0) {
- $i=0;
- foreach($a_dialplan_includes as $row) {
- if ($row["dialplanincludeid"] == $faxid) {
- $order = $row['order'];
- unset($a_dialplan_includes[$i]);
- }
- $i++;
- }
- }
-
- //delete the dialplan include details. aka. child data
- if (count($a_dialplan_includes_details) > 0) {
- $i=0;
- foreach($a_dialplan_includes_details as $row) {
- if ($row["dialplanincludeid"] == $faxid) {
- unset($a_dialplan_includes_details[$i]);
- }
- $i++;
- }
- }
-
- if (file_exists($v_conf_dir."/dialplan/default/".$order."_".$faxname.".xml")){
- unlink($v_conf_dir."/dialplan/default/".$order."_".$faxname.".xml");
- }
-
- //remove fax entries
- unset($a_fax[$_GET['id']]);
-
- write_config();
- header("Location: v_fax.php");
- exit;
- }
- }
-}
-
-if (($_POST['type'] == "fax_send") && is_uploaded_file($_FILES['fax_file']['tmp_name'])) {
-
- $fax_number = $_POST['fax_number'];
- $fax_name = $_FILES['fax_file']['name'];
- $fax_name = str_replace(".tif", "", $fax_name);
- $fax_name = str_replace(".tiff", "", $fax_name);
- $fax_name = str_replace(".pdf", "", $fax_name);
- $fax_gateway = $_POST['fax_gateway'];
-
- $password = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password'];
- $port = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port'];
- $host = $config['interfaces']['lan']['ipaddr'];
-
- //upload the file
- move_uploaded_file($_FILES['fax_file']['tmp_name'], $dir_fax_temp.$_FILES['fax_file']['name']);
-
- $fax_file_extension = substr($dir_fax_temp.$_FILES['fax_file']['name'], -4);
- if ($fax_file_extension == ".pdf") {
- exec("cd ".$dir_fax_temp.";gs -q -sDEVICE=tiffg3 -r204x98 -dNOPAUSE -sOutputFile=".$fax_name.".tif -- ".$fax_name.".pdf -c quit");
- //exec("rm ".$dir_fax_temp.$fax_name.".pdf");
- }
- if ($fax_file_extension == ".tiff") {
- exec("cp ".$dir_fax_temp.$fax_name.".tiff ".$dir_fax_temp.$fax_name.".tif");
- exec("rm ".$dir_fax_temp.$fax_name.".tiff");
- }
-
- //send the fax
- $fp = event_socket_create($host, $port, $password);
- $cmd = "api originate [absolute_codec_string=PCMU]sofia/gateway/".$fax_gateway."/".$fax_number." &txfax(".$dir_fax_temp.$fax_name.".tif)";
- $response = event_socket_request($fp, $cmd);
- $response = str_replace("\n", "", $response);
- $uuid = str_replace("+OK ", "", $response);
- fclose($fp);
-
- //if ($response >= 1) {
- // $fp = event_socket_create($host, $port, $password);
- // $cmd = "api uuid_getvar ".$uuid." fax_result_text";
- // echo $cmd."\n";
- // $response = event_socket_request($fp, $cmd);
- // $response = trim($response);
- // fclose($fp);
- //}
-
- sleep(5);
-
- //copy the .tif to the sent directory
- exec("cp ".$dir_fax_temp.$fax_name.".tif ".$dir_fax_sent.$fax_name.".tif");
-
- //delete the .tif from the temp directory
- //exec("rm ".$dir_fax_temp.$fax_name.".tif");
-
- //convert the tif to pdf and png
- exec("cd $dir_fax_sent; ".bin_dir."/tiff2png ".$dir_fax_sent.$fax_name.".tif");
- exec("cd $dir_fax_sent; ".bin_dir."/tiff2pdf -f -o ".$fax_name.".pdf ".$dir_fax_sent.$fax_name.".tif");
-
- header("Location: v_fax_edit.php?id=".$id."&msg=".$response);
- exit;
-}
-
-if ($_GET['a'] == "download") {
-
- session_cache_limiter('public');
-
- if ($_GET['type'] == "fax_inbox") {
-
- if (file_exists($dir_fax_inbox.$_GET['filename'])) {
-
- $fd = fopen($dir_fax_inbox.$_GET['filename'], "rb");
- if ($_GET['t'] == "bin") {
- header("Content-Type: application/force-download");
- header("Content-Type: application/octet-stream");
- header("Content-Type: application/download");
- header("Content-Description: File Transfer");
- header('Content-Disposition: attachment; filename="'.$_GET['filename'].'"');
- }
- else {
- $file_ext = substr($_GET['filename'], -3);
- if ($file_ext == "png") {
- header("Content-Type: image/png");
- }
- }
- header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
- header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
- header("Content-Length: " . filesize($dir_fax_inbox.$_GET['filename']));
- fpassthru($fd);
- }
- else {
- echo "not found";
- }
- exit;
- }
-
-}
-else {
- //echo $dir_fax_inbox.$_GET['filename'];
-}
-
-
-if ($_GET['a'] == "download") {
-
- session_cache_limiter('public');
-
- if ($_GET['type'] == "fax_sent") {
- if (file_exists($dir_fax_sent.$_GET['filename'])) {
- $fd = fopen($dir_fax_sent.$_GET['filename'], "rb");
- if ($_GET['t'] == "bin") {
- header("Content-Type: application/force-download");
- header("Content-Type: application/octet-stream");
- header("Content-Type: application/download");
- header("Content-Description: File Transfer");
- header('Content-Disposition: attachment; filename="'.$_GET['filename'].'"');
- }
- else {
- $file_ext = substr($_GET['filename'], -3);
- if ($file_ext == "png") {
- header("Content-Type: image/png");
- }
- }
- header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
- header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
- header("Content-Length: " . filesize($dir_fax_sent.$_GET['filename']));
- fpassthru($fd);
- }
-
- }
-
- exit;
-}
-else {
- //echo $dir_fax_inbox.$_GET['filename'];
-}
-
-
-if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'fax_inbox') {
- //if ($a_fax[$_GET['id']]) {
- $tmp_file_array = split("\.",$_GET['filename']);
- $file_name = $tmp_file_array[0];
- $file_ext = $tmp_file_array[1];
- unlink_if_exists($dir_fax_inbox.$file_name.".pdf");
- unlink_if_exists($dir_fax_inbox.$file_name.".png");
- unlink_if_exists($dir_fax_inbox.$file_name.".tif");
- //unset($a_fax[$_GET['id']]);
- write_config();
- header("Location: v_fax.php");
- exit;
- //}
- }
-}
-
-
-if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'fax_sent') {
- //if ($a_fax[$_GET['id']]) {
- $tmp_file_array = split("\.",$_GET['filename']);
- $file_name = $tmp_file_array[0];
- $file_ext = $tmp_file_array[1];
- unlink_if_exists($dir_fax_sent.$file_name.".pdf");
- unlink_if_exists($dir_fax_sent.$file_name.".png");
- unlink_if_exists($dir_fax_sent.$file_name.".tif");
- //unset($a_fax[$_GET['id']]);
- write_config();
- header("Location: v_fax.php");
- exit;
- //}
- }
-}
-
-
-if ($_POST) {
-
- unset($input_errors);
- $pconfig = $_POST;
-
- if (!$input_errors) {
-
- $ent = array();
- if (strlen($_POST['faxid']) > 0) {
- $ent['faxid'] = $_POST['faxid'];
- }
- else {
- $ent['faxid'] = guid();
- }
- $ent['faxextension'] = $_POST['faxextension'];
- $ent['faxname'] = $_POST['faxname'];
- $ent['faxemail'] = $_POST['faxemail'];
- $ent['faxdomain'] = $_POST['faxdomain'];
- $ent['faxdescription'] = $_POST['faxdescription'];
-
- if (isset($id) && $a_fax[$id]) {
- //update
- $a_fax[$id] = $ent;
- }
- else {
- //add
- $a_fax[] = $ent;
- }
-
- if (!is_dir($v_storage_dir)) {
- exec("mkdir ".$v_storage_dir);
- }
-
- if (!is_dir($v_storage_dir.'/fax/')) {
- exec("mkdir ".$v_storage_dir."/fax/");
- }
-
- $faxfolder = $v_storage_dir.'/fax/'.$_POST['faxextension'];
- if (!is_dir($faxfolder)) {
- exec('mkdir '.$faxfolder);
- }
- if (!is_dir($faxfolder.'/inbox/')) {
- exec('mkdir '.$faxfolder.'/inbox/');
- }
- if (!is_dir($faxfolder.'/sent/')) {
- exec('mkdir '.$faxfolder.'/sent/');
- }
- if (!is_dir($faxfolder.'/temp/')) {
- exec('mkdir '.$faxfolder.'/temp/');
- }
- write_config();
- sync_package_v_fax();
-
- header("Location: v_fax.php");
- exit;
- }
-}
-
-include("head.inc");
-
-?>
-
-<script type="text/javascript" language="JavaScript">
-
-function show_advanced_config() {
- document.getElementById("showadvancedbox").innerHTML='';
- aodiv = document.getElementById('showadvanced');
- aodiv.style.display = "block";
-}
-
-</script>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php
-include("fbegin.inc");
-if ($v_label_show) {
- echo "<p class=\"pgtitle\">$v_label: FAX: Edit</p>\n";
-}
-if ($input_errors) print_input_errors($input_errors);
-?>
-
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-build_menu();
-
-?>
-</td></tr>
-</table>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>FAX Setup<br>
- </strong></span>
- </p></td>
- </tr>
- </table>
- <br />
-
- <form action="v_fax_edit.php" method="post" name="iform" id="iform">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="25%" valign="top" class="vncellreq">Extension</td>
- <td width="75%" class="vtable">
- <input name="faxextension" type="text" class="formfld unknown" id="faxextension" size="40" value="<?=htmlspecialchars($pconfig['faxextension']);?>">
- <br><span class="vexpl">Enter the fax extension here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncellreq">Name</td>
- <td width="75%" class="vtable">
- <input name="faxname" type="text" class="formfld unknown" id="faxname" size="40" value="<?=htmlspecialchars($pconfig['faxname']);?>">
- <br><span class="vexpl">Enter the name here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncellreq">Email</td>
- <td width="75%" class="vtable">
- <input name="faxemail" type="text" class="formfld unknown" id="faxemail" size="40" value="<?=htmlspecialchars($pconfig['faxemail']);?>">
- <br><span class="vexpl">Optional: Enter the email address to send the FAX to.<br></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncellreq">Domain</td>
- <td width="75%" class="vtable">
- <input name="faxdomain" type="text" class="formfld unknown" id="faxdomain" size="40" value="<?=htmlspecialchars($pconfig['faxdomain']);?>">
- <br><span class="vexpl">Enter the domain here.<br></span>
- </td>
- </tr>
- <!--
- <tr>
- <td width="25%" valign="top" class="vncellreq" nowrap>Attach File</td>
- <td width="75%" class="vtable">
- <?php
- /*
- echo " <select name='vm-attach-file' class='formfld unknown'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['vm-attach-file'])) {
- case "true":
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- break;
- case "false":
- echo " <option value='true'>true</option>\n";
- echo " <option value='false' selected='yes'>false</option>\n";
-
- break;
- default:
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- }
- echo " </select>\n";
- */
- ?>
- Choose whether to attach the file to the email.
- </td>
- </tr>
- -->
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="25%" valign="top" class="vncellreq">Description</td>
- <td width="75%" class="vtable">
- <input name="faxdescription" type="text" class="formfld unknown" id="faxdescription" size="40" value="<?=htmlspecialchars($pconfig['faxdescription']);?>">
- <br><span class="vexpl">Enter the description here.<br></span>
- </td>
- </tr>
- <tr>
- <td valign="top">&nbsp;</td>
- <td>
- <input name="faxid" type="hidden" value="<?=htmlspecialchars($pconfig['faxid']);?>">
- <?php if (isset($id) && $a_fax[$id]): ?>
- <input name="id" type="hidden" value="<?=$id;?>">
- <?php endif; ?>
- <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()">
- </td>
- </tr>
- </table>
- </form>
-
- <br />
- <br />
- <br />
- <br />
-
-
- <table width="100%" border="0" cellpadding="3" cellspacing="0">
- <tr>
- <td width='30%'>
- <span class="vexpl"><span class="red"><strong>Send</strong></span>
- </td>
- </tr>
- <tr>
- <td>
- To send a fax you can upload a .tif file or if ghost script has been installed then you can also send a fax by uploading a PDF. (pkg_add -r ghostscript8-nox11; rehash)
- When sending a fax you can view status of the transmission by viewing the logs from the Status tab or by watching the response from the FreeSWITCH console.
- </td>
- </tr>
- <tr>
- <td align='right' nowrap>
- <form action="" method="POST" enctype="multipart/form-data" name="frmUpload" onSubmit="">
- <table border='0' cellpadding='3' cellspacing='0' width='100%'>
- <tr>
- <td valign="middle" class="label">
- Fax Number
- </td>
- <td valign="top" class="label">
- <input type="text" name="fax_number" value="">
- </td>
- <td align="left">Upload:</td>
- <td valign="top" class="label">
- <input name="id" type="hidden" value="$id">
- <input name="type" type="hidden" value="fax_send">
- <input name="fax_file" type="file" class="button" id="fax_file">
- </td>
- <td valign="middle" class="label">
- Gateway
- </td>
- <td valign="top" class="label">
-
- <?php
- //create a temporary id for the array
- $a_gateways = &$config['installedpackages']['freeswitchgateways']['config'];
-
- $i = 0;
- if (count($a_gateways) > 0) {
- foreach ($a_gateways as $ent) {
- $a_gateways[$i]['id'] = $i;
- $i++;
- }
- }
-
- //order the array
- function cmp_string($a, $b) {
- return strcmp($a["gateway"], $b["gateway"]);
- }
- if (count($a_gateways) > 0) { usort($a_gateways, "cmp_string"); }
-
- echo "<select name='fax_gateway' class='formfld'>";
- $i = 0;
- if (count($a_gateways) > 0) {
-
- foreach ($a_gateways as $ent) {
- echo "<option>".$ent['gateway']."</option>\n";
- }
- }
- echo "</select>\n";
-
- ?>
- </td>
- <td>
- <input name="submit" type="submit" class="button" id="upload" value="Send FAX">
- </td>
- </tr>
- </table>
- </div>
- </form>
- </td>
- </tr>
- </table>
-
-
-
- <br />
- <br />
- <br />
- <br />
-
- <table width="100%" border="0" cellpadding="5" cellspacing="0">
- <tr>
- <td>
- <span class="vexpl"><span class="red"><strong>Inbox</strong></span>
- </td>
- <td align='right'>
- <?php
- if ($v_path_show) {
- echo "<b>location:</b> ";
- echo $dir_fax_inbox;
- }
- ?>
- </td>
- </tr>
- </table>
-
- <div id="niftyOutter">
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="50%" class="listhdrr">File Name (download)</td>
- <td width="10%" class="listhdrr">Download</td>
- <td width="10%" class="listhdrr">View</td>
- <td width="20%" class="listhdr">Last Modified</td>
- <td width="10%" class="listhdr" nowrap>Size</td>
- </tr>
-
- <?php
-
- if ($handle = opendir($dir_fax_inbox)) {
- while (false !== ($file = readdir($handle))) {
- if ($file != "." && $file != ".." && is_file($dir_fax_inbox.$file)) {
-
- $tmp_filesize = filesize($dir_fax_inbox.$file);
- $tmp_filesize = byte_convert($tmp_filesize);
-
- $tmp_file_array = split("\.",$file);
- $file_name = $tmp_file_array[0];
- $file_ext = $tmp_file_array[1];
-
- if ($file_ext == "tif") {
-
- echo "<tr>\n";
- echo " <td class=\"listlr\" ondblclick=\"\">\n";
- echo " <a href=\"v_fax_edit.php?id=".$id."&a=download&type=fax_inbox&t=bin&filename=".$file."\">\n";
- echo " $file";
- echo " </a>";
- echo " </td>\n";
- echo " <td class=\"listlr\" ondblclick=\"\">\n";
- echo " <a href=\"v_fax_edit.php?id=".$id."&a=download&type=fax_inbox&t=bin&filename=".$file_name.".pdf\">\n";
- echo " pdf";
- echo " </a>";
- echo " </td>\n";
- echo " <td class=\"listlr\" ondblclick=\"\">\n";
- echo " <a href=\"v_fax_edit.php?id=".$id."&a=download&type=fax_inbox&t=png&filename=".$file_name.".png\" target=\"_blank\">\n";
- echo " png";
- echo " </a>";
- echo " </td>\n";
- echo " <td class=\"listlr\" ondblclick=\"\">\n";
- echo date ("F d Y H:i:s", filemtime($dir_fax_inbox.$file));
- echo " </td>\n";
- echo " <td class=\"listlr\" ondblclick=\"\">\n";
- echo " ".$tmp_filesize;
- echo " </td>\n";
- echo " <td valign=\"middle\" nowrap class=\"list\">\n";
- echo " <table border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n";
- echo " <tr>\n";
- //echo " <td valign=\"middle\"><a href=\"v_fax_edit.php?id=$i\"><img src=\"/themes/".$g['theme']."/images/icons/icon_e.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n";
- echo " <td><a href=\"v_fax_edit.php?id=".$id."&type=fax_inbox&act=del&filename=".$file."\" onclick=\"return confirm('Do you really want to delete this file?')\"><img src=\"/themes/". $g['theme']."/images/icons/icon_x.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n";
- echo " </tr>\n";
- echo " </table>\n";
- echo " </td>\n";
- echo "</tr>\n";
- }
-
- }
- }
- closedir($handle);
- }
- ?>
-
- <tr>
- <td class="list" colspan="3"></td>
- <td class="list"></td>
- </tr>
- </table>
-
- <br />
- <br />
- <br />
- <br />
-
- <table width="100%" border="0" cellpadding="5" cellspacing="0">
- <tr>
- <td>
- <span class="vexpl"><span class="red"><strong>Sent</strong></span>
- </td>
- <td align='right'>
- <?php
- if ($v_path_show) {
- echo "<b>location:</b> ";
- echo $dir_fax_sent;
- }
- ?>
- </td>
- </tr>
- </table>
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="50%" class="listhdrr">File Name (download)</td>
- <td width="10%" class="listhdrr">Download</td>
- <td width="10%" class="listhdrr">View</td>
- <td width="20%" class="listhdr">Last Modified</td>
- <td width="10%" class="listhdr" nowrap>Size</td>
- </tr>
-
- <?php
-
- if ($handle = opendir($dir_fax_sent)) {
- while (false !== ($file = readdir($handle))) {
- if ($file != "." && $file != ".." && is_file($dir_fax_sent.$file)) {
-
- $tmp_filesize = filesize($dir_fax_sent.$file);
- $tmp_filesize = byte_convert($tmp_filesize);
-
- $tmp_file_array = split("\.",$file);
- $file_name = $tmp_file_array[0];
- $file_ext = $tmp_file_array[1];
-
- if ($file_ext == "tif") {
-
- echo "<tr>\n";
- echo " <td class=\"listlr\" ondblclick=\"\">\n";
- echo " <a href=\"v_fax_edit.php?id=".$id."&a=download&type=fax_sent&t=bin&filename=".$file."\">\n";
- echo " $file";
- echo " </a>";
- echo " </td>\n";
- echo " <td class=\"listlr\" ondblclick=\"\">\n";
- echo " <a href=\"v_fax_edit.php?id=".$id."&a=download&type=fax_sent&t=bin&filename=".$file_name.".pdf\">\n";
- echo " pdf";
- echo " </a>";
- echo " </td>\n";
- echo " <td class=\"listlr\" ondblclick=\"\">\n";
- echo " <a href=\"v_fax_edit.php?id=".$id."&a=download&type=fax_sent&t=png&filename=".$file_name.".png\" target=\"_blank\">\n";
- echo " png";
- echo " </a>";
- echo " </td>\n";
- echo " <td class=\"listlr\" ondblclick=\"\">\n";
- echo date ("F d Y H:i:s", filemtime($dir_fax_sent.$file));
- echo " </td>\n";
- echo " <td class=\"listlr\" ondblclick=\"\">\n";
- echo " ".$tmp_filesize;
- echo " </td>\n";
- echo " <td valign=\"middle\" nowrap class=\"list\">\n";
- echo " <table border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n";
- echo " <tr>\n";
- //echo " <td valign=\"middle\"><a href=\"v_fax_edit.php?id=$i\"><img src=\"/themes/".$g['theme']."/images/icons/icon_e.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n";
- echo " <td><a href=\"v_fax_edit.php?id=".$id."&type=fax_sent&act=del&filename=".$file."\" onclick=\"return confirm('Do you really want to delete this file?')\"><img src=\"/themes/". $g['theme']."/images/icons/icon_x.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n";
- echo " </tr>\n";
- echo " </table>\n";
- echo " </td>\n";
- echo "</tr>\n";
- }
-
- }
- }
- closedir($handle);
- }
- ?>
-
- <tr>
- <td class="list" colspan="3"></td>
- <td class="list"></td>
- </tr>
- </table>
-
-
- <br />
- <br />
- <br />
- <br />
-
-
- </td>
- </tr>
-</table>
-
-</div>
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch_dev/v_features.tmp b/config/freeswitch_dev/v_features.tmp
deleted file mode 100644
index d9ecf48f..00000000
--- a/config/freeswitch_dev/v_features.tmp
+++ /dev/null
@@ -1,223 +0,0 @@
-<?php
-/* $Id$ */
-/*
- v_features.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/v_config.inc");
-
-//$a_extensions = &$config['installedpackages']['freeswitchextensions']['config'];
-
-
-//if ($_GET['act'] == "del") {
-// if ($_GET['type'] == 'extensions') {
-// if ($a_extensions[$_GET['id']]) {
-// unset($a_extensions[$_GET['id']]);
-// write_config();
-// header("Location: v_extensions.php");
-// exit;
-// }
-// }
-//}
-
-
-include("head.inc");
-
-?>
-
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-
-<?php
-include("fbegin.inc");
-if ($v_label_show) {
- echo "<p class=\"pgtitle\">$v_label: Features</p>\n";
-}
-?>
-
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-build_menu();
-
-?>
-</td></tr>
-</table>
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
- <!--
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Features<br>
- </strong></span>
- List of a few of the features.
- </p></td>
- </tr>
- </table>
- <br />-->
-
- <br />
- <br />
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td class="listtopic" colspan='2'>Auto Attendant</td>
- </tr>
- <tr>
- <td width='10%' class="vncell"><a href='v_auto_attendant.php'>Open</a></td>
- <td class="vtable">
- Auto Attendant provides callers the ability to choose between multiple options that direct calls to extensions,
- voicemail, conferences, queues, other auto attendants, and external phone numbers.
- </td>
- </tr>
- </table>
-
- <br />
- <br />
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td class="listtopic" colspan='2'>Direct Inward System Access</td>
- </tr>
- <tr>
- <td width='10%' class="vncell"></td>
- <td class="vtable">
- Direct Inward System Access (DISA) allows inbound callers to make internal or external calls. For security reasons
- it is disabled by default. To enable it first set a secure pin number from the Settings->Admin PIN Number.
- Then go to Dialplan tab and find the DISA entry and edit it to set 'Enabled' to 'true'.
- To use DISA dial *3472 (disa) enter the admin pin code and the extension or phone number you wish to call.
- </td>
- </tr>
- </table>
-
- <br />
- <br />
- <?php
- if ($v_fax_show) {
- ?>
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td class="listtopic" colspan='2'>FAX</td>
- </tr>
- <tr>
- <td width='10%' class="vncell"><a href='v_fax.php'>Open</a></td>
- <td class="vtable">
- Transmit and View Received Faxes.
- </td>
- </tr>
- </table>
-
- <br />
- <br />
- <?php
- }
- ?>
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td class="listtopic" colspan='2'>Hunt Group</td>
- </tr>
- <tr>
- <td width='10%' class="vncell"><a href='v_hunt_group.php'>Open</a></td>
- <td class="vtable">
- Hunt Group is a group of destinations to call at once or in succession.
- </td>
- </tr>
- </table>
-
- <br />
- <br />
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td class="listtopic" colspan='2'>Modules</td>
- </tr>
- <tr>
- <td width='10%' class="vncell"><a href='v_modules.php'>Open</a></td>
- <td class="vtable">
- Modules add additional features and can be enabled or disabled to provide the desired features.
- </td>
- </tr>
- </table>
-
- <br />
- <br />
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td class="listtopic" colspan='2'>Music on Hold</td>
- </tr>
- <tr>
- <td width='10%' class="vncell"><a href='v_recordings.php'>Open</a></td>
- <td class="vtable">
- Music on hold can be in WAV or MP3 format. To play an MP3 files you must have mod_shout enabled on the 'Modules' tab.
- For best performance upload 16bit 8khz/16khz Mono WAV files.
- </td>
- </tr>
- </table>
-
- <br />
- <br />
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td class="listtopic" colspan='2'>Recordings</td>
- </tr>
- <tr>
- <td width='10%' class="vncell"><a href='v_recordings.php'>Open</a></td>
- <td class="vtable">
- To make a recording dial *732673 (record) or you can make a 16bit 8khz/16khz
- Mono WAV file then copy it to the following directory then refresh the page to play
- it back. Click on the 'Filename' to download it or the 'Recording Name' to play the audio.
- </td>
- </tr>
- </table>
-
-<br />
-<br />
-<br />
-<br />
-<br />
-<br />
-<br />
-<br />
-
-</td>
-</tr>
-</table>
-
-</div>
-
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch_dev/v_gateways.tmp b/config/freeswitch_dev/v_gateways.tmp
deleted file mode 100644
index b47f5b89..00000000
--- a/config/freeswitch_dev/v_gateways.tmp
+++ /dev/null
@@ -1,220 +0,0 @@
-<?php
-/* $Id$ */
-/*
- v_gateways.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/v_config.inc");
-
-$a_gateways = $config['installedpackages']['freeswitchgateways']['config'];
-
-
-if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'gateways') {
- if ($a_gateways[$_GET['id']]) {
- $tmp_file_name = $v_conf_dir."/sip_profiles/external/".$_GET['gateway'].".xml";
- if (file_exists($tmp_file_name)) {
- unlink($tmp_file_name);
- }
- unset($a_gateways[$_GET['id']]);
- write_config();
- header("Location: v_gateways.php");
- exit;
- }
- }
-}
-
-include("head.inc");
-
-?>
-
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-
-<?php
-include("fbegin.inc");
-if ($v_label_show) {
- echo "<p class=\"pgtitle\">$v_label: Gateways</p>\n";
-}
-?>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-build_menu();
-
-?>
-</td></tr>
-</table>
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
-<form action="v_gateways.php" method="post" name="iform" id="iform">
-<?php
-
-if ($config_change == 1) {
- write_config();
- $config_change = 0;
-}
-
-//if ($savemsg) print_info_box($savemsg);
-//if (file_exists($d_hostsdirty_path)): echo"<p>";
-//print_info_box_np("The gateways have been changed.<br>You must apply the changes in order for them to take effect.");
-//echo"<br />";
-//endif;
-
-?>
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Gateways<br>
- </strong></span>
- Gateways provide access into other voice networks. These can be voice providers or other systems that require SIP registration.
- </p></td>
- </tr>
- </table>
- <br />
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="20%" class="listhdrr">Gateway</td>
- <td width="25%" class="listhdrr">Context</td>
- <td width="25%" class="listhdrr">Enabled</td>
- <td width="25%" class="listhdr">Description</td>
- <td width="10%" class="list">
-
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="v_gateways_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
-
- </td>
- </tr>
-
-
- <?php
- //create a temporary id for the array
- $i = 0;
- if (count($a_gateways) > 0) {
- foreach ($a_gateways as $ent) {
- $a_gateways[$i]['id'] = $i;
- $i++;
- }
- }
-
- //order the array
- function cmp_string($a, $b) {
- return strcmp($a["gateway"], $b["gateway"]);
- }
- if (count($a_gateways) > 0) { usort($a_gateways, "cmp_string"); }
-
- $i = 0;
- if (count($a_gateways) > 0) {
-
- foreach ($a_gateways as $ent) {
-
- ?>
- <tr>
- <td class="listr" ondblclick="document.location='v_gateways_edit.php?id=<?=$ent['id'];?>';">
- <?=$ent['gateway'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='v_gateways_edit.php?id=<?=$ent['id'];?>';">
- <?=$ent['context'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='v_gateways_edit.php?id=<?=$ent['id'];?>';">
- <?=$ent['enabled'];?>&nbsp;
- </td>
- <td class="listbg" ondblclick="document.location='v_gateways_edit.php?id=<?=$ent['id'];?>';">
- <font color="#FFFFFF"><?=htmlspecialchars($ent['description']);?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="v_gateways_edit.php?id=<?=$ent['id'];?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="v_gateways.php?type=gateways&act=del&id=<?=$ent['id'];?>&gateway=<?=$ent['gateway'];?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
-
- $i++;
- }
- }
- ?>
-
- <tr>
- <td class="list" colspan="4"></td>
- <td class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="v_gateways_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
-
-
- <tr>
- <td class="list" colspan="4"></td>
- <td class="list"></td>
- </tr>
- </table>
-
-</form>
-
-<?php
-if ($v_path_show) {
- echo $v_conf_dir."/sip_profiles/external/\n";
-}
-?>
-
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-
-</td>
-</tr>
-</table>
-
-</div>
-
-
-<?php include("fend.inc"); ?>
-</body>
-</html> \ No newline at end of file
diff --git a/config/freeswitch_dev/v_gateways_edit.tmp b/config/freeswitch_dev/v_gateways_edit.tmp
deleted file mode 100644
index 5444d7e8..00000000
--- a/config/freeswitch_dev/v_gateways_edit.tmp
+++ /dev/null
@@ -1,700 +0,0 @@
-<?php
-/* $Id$ */
-/*
-
- v_gateways_edit.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/v_config.inc");
-
-
-$a_gateways = &$config['installedpackages']['freeswitchgateways']['config'];
-
-$id = $_GET['id'];
-if (isset($_POST['id'])) {
- $id = $_POST['id'];
-}
-
-if (isset($id) && $a_gateways[$id]) {
-
- $pconfig['gatewayid'] = $a_gateways[$id]['gatewayid'];
- $gatewayid = $a_gateways[$id]['gatewayid'];
- $pconfig['gateway'] = $a_gateways[$id]['gateway'];
- $pconfig['username'] = $a_gateways[$id]['username'];
- $pconfig['auth-username'] = $a_gateways[$id]['auth-username'];
- $pconfig['password'] = $a_gateways[$id]['password'];
- $pconfig['realm'] = $a_gateways[$id]['realm'];
- $pconfig['from-user'] = $a_gateways[$id]['from-user'];
- $pconfig['from-domain'] = $a_gateways[$id]['from-domain'];
- $pconfig['proxy'] = $a_gateways[$id]['proxy'];
- $pconfig['expire-seconds'] = $a_gateways[$id]['expire-seconds'];
- $pconfig['register'] = $a_gateways[$id]['register'];
- $pconfig['register-transport'] = $a_gateways[$id]['register-transport'];
- $pconfig['retry-seconds'] = $a_gateways[$id]['retry-seconds'];
- $pconfig['extension'] = $a_gateways[$id]['extension'];
- $pconfig['ping'] = $a_gateways[$id]['ping'];
- $pconfig['caller-id-in-from'] = $a_gateways[$id]['caller-id-in-from'];
- $pconfig['supress-cng'] = $a_gateways[$id]['supress-cng'];
-
- $pconfig['effective_caller_id_name'] = $a_gateways[$id]['effective_caller_id_name'];
- $pconfig['effective_caller_id_number'] = $a_gateways[$id]['effective_caller_id_number'];
- $pconfig['outbound_caller_id_name'] = $a_gateways[$id]['outbound_caller_id_name'];
- $pconfig['outbound_caller_id_number'] = $a_gateways[$id]['outbound_caller_id_number'];
-
- $pconfig['context'] = $a_gateways[$id]['context'];
- $pconfig['enabled'] = $a_gateways[$id]['enabled'];
- $pconfig['description'] = $a_gateways[$id]['description'];
-}
-
-if ($_POST) {
-
- unset($input_errors);
- $pconfig = $_POST;
-
- if (!$input_errors) {
-
- $effective_caller_id_number = $_POST['effective_caller_id_number'];
- $outbound_caller_id_number = $_POST['outbound_caller_id_number'];
- $replace_array = array("(", ")", " ", "-");
- $effective_caller_id_number = str_replace($replace_array, "", $effective_caller_id_number);
- $outbound_caller_id_number = str_replace($replace_array, "", $outbound_caller_id_number);
-
- $ent = array();
- if (strlen($_POST['ivrid']) > 0) {
- $ent['gatewayid'] = $_POST['ivrid'];
- }
- else {
- $ent['gatewayid'] = guid();
- }
- $ent['gateway'] = $_POST['gateway'];
- $ent['username'] = $_POST['username'];
- $ent['auth-username'] = $_POST['auth-username'];
- $ent['password'] = $_POST['password'];
- $ent['realm'] = $_POST['realm'];
- $ent['from-user'] = $_POST['from-user'];
- $ent['from-domain'] = $_POST['from-domain'];
- $ent['proxy'] = $_POST['proxy'];
- $ent['expire-seconds'] = $_POST['expire-seconds'];
- $ent['register'] = $_POST['register'];
- $ent['register-transport'] = $_POST['register-transport'];
- $ent['retry-seconds'] = $_POST['retry-seconds'];
- $ent['extension'] = $_POST['extension'];
- $ent['ping'] = $_POST['ping'];
- $ent['caller-id-in-from'] = $_POST['caller-id-in-from'];
- $ent['supress-cng'] = $_POST['supress-cng'];
-
- $ent['effective_caller_id_name'] = $_POST['effective_caller_id_name'];
- $ent['effective_caller_id_number'] = $effective_caller_id_number;
- $ent['outbound_caller_id_name'] = $_POST['outbound_caller_id_name'];
- $ent['outbound_caller_id_number'] = $outbound_caller_id_number;
-
- $ent['context'] = $_POST['context'];
- $ent['enabled'] = $_POST['enabled'];
- $ent['description'] = $_POST['description'];
-
- if (isset($id) && $a_gateways[$id]) {
- //update
- $a_gateways[$id] = $ent;
- }
- else {
- //add
- $a_gateways[] = $ent;
- }
-
-
- if (strlen(trim($_POST['dialplan_expression']))> 0) {
-
- $gatewayid = $_POST['gatewayid'];
- $gateway = $_POST['gateway'];
- $context = $_POST['context'];
-
- $default_area_code = &$config['installedpackages']['freeswitchsettings']['config'][0]['default_area_code'];
- $a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config'];
- $a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config'];
-
-
- $tmp_array = split("\\\n", $_POST['dialplan_expression']);
-
- foreach($tmp_array as $dialplan_expression) {
-
- $dialplan_expression = trim($dialplan_expression);
- if (strlen($dialplan_expression)>0) {
-
- switch ($dialplan_expression) {
- case "^(\d{7})$":
- $action_data = "sofia/gateway/".$gateway."/1".$default_area_code."\$1";
- $label = "7 digits";
- $abbrv = "7d";
- break;
- case "^(\d{10})$":
- $action_data = "sofia/gateway/".$gateway."/1\$1";
- $label = "10 digits";
- $abbrv = "10d";
- break;
- case "^(\d{11})$":
- $action_data = "sofia/gateway/".$gateway."/\$1";
- $label = "11 digits";
- $abbrv = "11d";
- break;
- case "^(311)$":
- $action_data = "sofia/gateway/".$gateway."/\$1";
- $label = "311";
- $abbrv = "311";
- break;
- case "^(411)$":
- $action_data = "sofia/gateway/".$gateway."/\$1";
- $label = "411";
- $abbrv = "411";
- break;
- case "^(911)$":
- $action_data = "sofia/gateway/".$gateway."/\$1";
- $label = "911";
- $abbrv = "911";
- break;
- case "^9(\d{3})$":
- $action_data = "sofia/gateway/".$gateway."/1".$default_area_code."\$1";
- $label = "dial 9, 3 digits";
- $abbrv = "9.3d";
- break;
- case "^9(\d{4})$":
- $action_data = "sofia/gateway/".$gateway."/1".$default_area_code."\$1";
- $label = "dial 9, 4 digits";
- $abbrv = "9.4d";
- break;
- case "^9(\d{7})$":
- $action_data = "sofia/gateway/".$gateway."/1".$default_area_code."\$1";
- $label = "dial 9, 7 digits";
- $abbrv = "9.7d";
- break;
- case "^9(\d{10})$":
- $action_data = "sofia/gateway/".$gateway."/\$1";
- $label = "dial 9, 10 digits";
- $abbrv = "9.10d";
- break;
- case "^9(\d{11})$":
- $action_data = "sofia/gateway/".$gateway."/\$1";
- $label = "dial 9, 11 digits";
- $abbrv = "9.11d";
- break;
- case "^1?(8(00|55|66|77|88)[2-9]\d{6})$":
- $action_data = "sofia/gateway/".$gateway."/\$1";
- $label = "toll free";
- $abbrv = "tollfree";
- break;
- default:
- $action_data = "sofia/gateway/".$gateway."/\$1";
- $label = $dialplan_expression;
- $abbrv = $dialplan_expression;
- }
-
- $dialplanincludeid = guid();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['extensionname'] = $gateway.".".$abbrv;
- $ent['order'] = '9002'; //if update use the existing order number and extension name and desc
- $ent['context'] = $context;
- $ent['enabled'] = 'true';
- $ent['descr'] = $label.' '.$gateway;
- $ent['opt1name'] = 'gatewayid';
- $ent['opt1value'] = $gatewayid;
- $a_dialplan_includes[] = $ent;
- unset($ent);
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'condition'; //condition, action, antiaction
- $ent['fieldtype'] = 'destination_number';
- $ent['fielddata'] = $dialplan_expression;
- $ent['fieldorder'] = '000';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
-
- if (strlen($effective_caller_id_name) > 0) {
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldtype'] = 'set';
- $ent['fielddata'] = 'effective_caller_id_name='.$effective_caller_id_name;
- $ent['fieldorder'] = '001';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
- }
- if (strlen($effective_caller_id_number) > 0) {
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldtype'] = 'set';
- $ent['fielddata'] = 'effective_caller_id_number='.$effective_caller_id_number;
- $ent['fieldorder'] = '001';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
- }
- if (strlen($outbound_caller_id_name) > 0) {
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldtype'] = 'set';
- $ent['fielddata'] = 'outbound_caller_id_name='.$outbound_caller_id_name;
- $ent['fieldorder'] = '001';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
- }
- if (strlen($outbound_caller_id_number) > 0) {
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldtype'] = 'set';
- $ent['fielddata'] = 'outbound_caller_id_number='.$outbound_caller_id_number;
- $ent['fieldorder'] = '001';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
- }
-
- $ent = array();
- $ent['dialplanincludeid'] = $dialplanincludeid;
- $ent['tag'] = 'action'; //condition, action, antiaction
- $ent['fieldtype'] = 'bridge';
- $ent['fielddata'] = $action_data;
- $ent['fieldorder'] = '001';
- $a_dialplan_include_details[] = $ent;
- unset($ent);
-
- unset($label);
- unset($abbrv);
- unset($dialplan_expression);
- unset($action_data);
- } //if strlen
- } //end for each
- }
-
- write_config();
- sync_package_v_gateways();
- sync_package_v_dialplan_includes();
-
- header("Location: v_gateways.php");
- exit;
- }
-}
-
-include("head.inc");
-
-?>
-
-
-<script type="text/javascript" language="JavaScript">
-
-function enable_change(enable_over) {
- var endis;
- endis = !(document.iform.enable.checked || enable_over);
- document.iform.range_from.disabled = endis;
- document.iform.range_to.disabled = endis;
-}
-
-function show_advanced_config() {
- document.getElementById("showadvancedbox").innerHTML='';
- aodiv = document.getElementById('showadvanced');
- aodiv.style.display = "block";
-}
-
-</script>
-
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php
-include("fbegin.inc");
-if ($v_label_show) {
- echo "<p class=\"pgtitle\">$v_label: Gateways: Edit</p>\n";
-}
-
-if ($input_errors) print_input_errors($input_errors);
-?>
-
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-build_menu();
-
-?>
-</td></tr>
-</table>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Gateway Setup<br>
- </strong></span>
- <?php
- if ($v_path_show) {
- echo "The 'SIP Provider Examples' from the FreeSWITCH wiki can be used as reference to get started. <br />\n";
- echo "<a href='http://wiki.freeswitch.org/wiki/SIP_Provider_Examples' target='_blank'>http://wiki.freeswitch.org/wiki/SIP_Provider_Examples</a>\n";
- }
- ?>
- </p></td>
- </tr>
- </table>
- <br />
-
- <form action="v_gateways_edit.php" method="post" name="iform" id="iform">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="22%" valign="top" class="vncellreq">Gateway</td>
- <td width="78%" class="vtable">
- <input name="gateway" type="text" class="formfld" id="gateway" size="40" value="<?=htmlspecialchars($pconfig['gateway']);?>">
- <br><span class="vexpl">Enter the gateway name here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Username</td>
- <td width="78%" class="vtable">
- <input name="username" type="text" class="formfld" id="username" size="40" value="<?=htmlspecialchars($pconfig['username']);?>">
- <br><span class="vexpl">Enter the username here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Password</td>
- <td width="78%" class="vtable">
- <input name="password" type="password" class="formfld" id="password" size="40" value="<?=htmlspecialchars($pconfig['password']);?>">
- <br><span class="vexpl">Enter the password here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">From-user</td>
- <td width="78%" class="vtable">
- <input name="from-user" type="text" class="formfld" id="from-user" size="40" value="<?=htmlspecialchars($pconfig['from-user']);?>">
- <br><span class="vexpl">Enter the from-user here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">From-domain</td>
- <td width="78%" class="vtable">
- <input name="from-domain" type="text" class="formfld" id="from-domain" size="40" value="<?=htmlspecialchars($pconfig['from-domain']);?>">
- <br><span class="vexpl">Enter the from-domain here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Proxy</td>
- <td width="78%" class="vtable">
- <input name="proxy" type="text" class="formfld" id="proxy" size="40" value="<?=htmlspecialchars($pconfig['proxy']);?>">
- <br><span class="vexpl">Enter the proxy here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Realm</td>
- <td width="78%" class="vtable">
- <input name="realm" type="text" class="formfld" id="realm" size="40" value="<?=htmlspecialchars($pconfig['realm']);?>">
- <br><span class="vexpl">Enter the realm here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Expire-seconds</td>
- <td width="78%" class="vtable">
- <input name="expire-seconds" type="text" class="formfld" id="expire-seconds" size="40" value="<?=htmlspecialchars($pconfig['expire-seconds']);?>">
- <br><span class="vexpl">Enter the expire-seconds here. Example: 600<br></span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Register</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='register' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['register'])) {
- case "true":
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- break;
- case "false":
- echo " <option value='true'>true</option>\n";
- echo " <option value='false' selected='yes'>false</option>\n";
-
- break;
- default:
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- }
- echo " </select>\n";
- ?>
- Choose whether to register.
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncellreq">Retry-seconds</td>
- <td width="78%" class="vtable">
- <input name="retry-seconds" type="text" class="formfld" id="retry-seconds" size="40" value="<?=htmlspecialchars($pconfig['retry-seconds']);?>">
- <br> <span class="vexpl">Enter the retry_seconds here. Example: 30<br></span>
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncell">Effective Caller ID Name</td>
- <td width="78%" class="vtable">
- <input name="effective_caller_id_name" type="text" class="formfld" id="effective_caller_id_name" size="40" value="<?=htmlspecialchars($pconfig['effective_caller_id_name']);?>">
- <br> <span class="vexpl">Enter the effective caller ID name here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Effective Caller ID Number</td>
- <td width="78%" class="vtable">
- <input name="effective_caller_id_number" type="text" class="formfld" id="effective_caller_id_number" size="40" value="<?=htmlspecialchars($pconfig['effective_caller_id_number']);?>">
- <br> <span class="vexpl">Enter the effective caller ID number here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Outbound Caller ID Name</td>
- <td width="78%" class="vtable">
- <input name="outbound_caller_id_name" type="text" class="formfld" id="outbound_caller_id_name" size="40" value="<?=htmlspecialchars($pconfig['outbound_caller_id_name']);?>">
- <br> <span class="vexpl">Enter the outbound caller ID name here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Outbound Caller ID Number</td>
- <td width="78%" class="vtable">
- <input name="outbound_caller_id_number" type="text" class="formfld" id="outbound_caller_id_number" size="40" value="<?=htmlspecialchars($pconfig['outbound_caller_id_number']);?>">
- <br> <span class="vexpl">Enter the outbound caller ID number here.<br></span>
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncellreq">Context</td>
- <td width="78%" class="vtable">
- <input name="context" type="text" class="formfld" id="context" size="40" value="<?=htmlspecialchars($pconfig['context']);?>">
- <br> <span class="vexpl">Enter the context here. Example: public<br></span>
- </td>
- </tr>
- </table>
- <div id="showadvancedbox">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="22%" valign="top" class="vncell">Show Advanced</td>
- <td width="78%" class="vtable">
- <input type="button" onClick="show_advanced_config()" value="Advanced"></input></a>
- </td>
- </tr>
- </table>
- </div>
- <div id="showadvanced" style="display:none">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="22%" valign="top" class="vncell">Auth-username</td>
- <td width="78%" class="vtable">
- <input name="auth-username" type="text" class="formfld" id="auth-username" size="40" value="<?=htmlspecialchars($pconfig['auth-username']);?>">
- <br> <span class="vexpl">Enter the auth-username here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Register-transport</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='register-transport' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['register-transport'])) {
- case "udp":
- echo " <option value='udp' selected='yes'>udp</option>\n";
- echo " <option value='tcp'>tcp</option>\n";
- echo " <option value='tls'>tls</option>\n";
- break;
- case "tcp":
- echo " <option value='udp'>udp</option>\n";
- echo " <option value='tcp' selected='yes'>tcp</option>\n";
- echo " <option value='tls'>tls</option>\n";
- case "tls":
- echo " <option value='udp'>udp</option>\n";
- echo " <option value='tcp'>tcp</option>\n";
- echo " <option value='tls' selected='yes'>tls</option>\n";
- break;
- default:
- echo " <option value='udp'>udp</option>\n";
- echo " <option value='tcp'>tcp</option>\n";
- echo " <option value='tls'>tls</option>\n";
- }
- echo " </select>\n";
- ?>
- Choose whether to register-transport.
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Extension</td>
- <td width="78%" class="vtable">
- <input name="extension" type="text" class="formfld" id="extension" size="40" value="<?=htmlspecialchars($pconfig['extension']);?>">
- <br> <span class="vexpl">Enter the extension here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Ping</td>
- <td width="78%" class="vtable">
- <input name="ping" type="text" class="formfld" id="ping" size="40" value="<?=htmlspecialchars($pconfig['ping']);?>">
- <br> <span class="vexpl">Enter the ping interval here in seconds.<br></span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Caller-id-in-from</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='caller-id-in-from' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['caller-id-in-from'])) {
- case "true":
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- break;
- case "false":
- echo " <option value='true'>true</option>\n";
- echo " <option value='false' selected='yes'>false</option>\n";
-
- break;
- default:
- echo " <option value='true'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- }
- echo " </select>\n";
- ?>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Supress-cng</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='supress-cng' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['supress-cng'])) {
- case "true":
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- break;
- case "false":
- echo " <option value='true'>true</option>\n";
- echo " <option value='false' selected='yes'>false</option>\n";
-
- break;
- default:
- echo " <option value='true'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- }
- echo " </select>\n";
- ?>
- </td>
- </tr>
- </table>
-
- </div>
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="22%" valign="top" class="vncellreq">Enabled</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='enabled' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['enabled'])) {
- case "true":
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- break;
- case "false":
- echo " <option value='true'>true</option>\n";
- echo " <option value='false' selected='yes'>false</option>\n";
-
- break;
- default:
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- }
- echo " </select>\n";
- ?>
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncell">Dialplan Expression</td>
- <td width="78%" class="vtable">
- <?php
- echo "<textarea name=\"dialplan_expression\" id=\"dialplan_expression\" cols=\"30\" rows=\"4\" wrap=\"off\"></textarea>\n";
- ?>
- <br>
- <select name='dialplan_expression_select' id='dialplan_expression_select' onchange="document.getElementById('dialplan_expression').value += document.getElementById('dialplan_expression_select').value + '\n';" class='formfld'>
- <option></option>
- <option value='^(\d{7})$'>7 digits local</option>
- <option value='^(\d{10})$'>10 digits long distance</option>
- <option value='^(\d{11})$'>11 digits long distance</option>
- <option value='^011(.*)$'>011 International</option>
- <option value='^311$'>311 information</option>
- <option value='^411$'>411 information</option>
- <option value='^911$'>911 emergency</option>
- <option value='^1?(8(00|55|66|77|88)[2-9]\d{6})$'>toll free</option>
- <option value='^9(\d{3})$'>Dial 9 then 3 digits</option>
- <option value='^9(\d{4})$'>Dial 9 then 4 digits</option>
- <option value='^9(\d{7})$'>Dial 9 then 7 digits</option>
- <option value='^9(\d{10})$'>Dial 9 then 10 digits</option>
- <option value='^9(\d{11})$'>Dial 9 then 11 digits</option>
- </select>
- <span class="vexpl">
- <br />
- Shortcut to create the outbound dialplan entries for this Gateway. The entries are saved to and edited from the 'Dialplan' tab.
- </span></td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncell">Gateway Description</td>
- <td width="78%" class="vtable">
- <input name="description" type="text" class="formfld" id="description" size="40" value="<?=htmlspecialchars($pconfig['description']);?>">
- <br> <span class="vexpl">Enter the description of the gateway here.</span></td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()">
- <?php if (isset($id) && $a_gateways[$id]): ?>
- <input name="id" type="hidden" value="<?=$id;?>">
- <input name="gatewayid" type="hidden" value="<?=htmlspecialchars($pconfig['gatewayid']);?>">
- <?php endif; ?>
- </td>
- </tr>
- </table>
- </form>
-
- <br>
- <br>
- <br>
- <br>
- <br>
- <br>
-
- </td>
- </tr>
-</table>
-
-</div>
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch_dev/v_hunt_group.tmp b/config/freeswitch_dev/v_hunt_group.tmp
deleted file mode 100644
index 6441ea12..00000000
--- a/config/freeswitch_dev/v_hunt_group.tmp
+++ /dev/null
@@ -1,213 +0,0 @@
-<?php
-/* $Id$ */
-/*
- v_hunt_group.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/v_config.inc");
-
-
-$a_hunt_group = &$config['installedpackages']['freeswitchhuntgroup']['config'];
-$a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config'];
-$a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config'];
-
-if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'huntgroup') {
- if ($a_hunt_group[$_GET['id']]) {
- if (file_exists($v_scripts_dir."/huntgroup_".$_GET['huntgroupid'].".js")) {
- unlink($v_scripts_dir."/huntgroup_".$_GET['huntgroupid'].".js");
- }
- /*
- //delete dialplan include details
- if (count($a_dialplan_includes) > 0) {
- $i = 0;
- foreach($a_dialplan_includes as $row) {
- echo $row['opt1value']." == {".$_GET['huntgroupid']."}<br />\n";
- if ($row['opt1value'] == '{'.$_GET['huntgroupid'].'}') {
- $dialplanincludeid = $row['dialplanincludeid'];
- $id = $i;
- unset($a_dialplan_include_details[$id]);
- }
- $i++;
- }
- unset($i);
- }
-
- //delete dialplan include details
- if (count($a_dialplan_include_details) > 0) {
- $i = 0;
- foreach($a_dialplan_include_details as $row) {
- if ($row['dialplanincludeid'] == $dialplanincludeid) {
- $id = $i;
- unset($a_dialplan_include_details[$id]);
- }
- $i++;
- }
- unset($i);
- }
- */
- unset($a_hunt_group[$_GET['id']]);
- write_config();
- sync_package_v_hunt_group();
- header("Location: v_hunt_group.php");
- exit;
- }
- }
-}
-
-include("head.inc");
-
-?>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-
-<?php
-include("fbegin.inc");
-if ($v_label_show) {
- echo "<p class=\"pgtitle\">$v_label: Hunt Group</p>\n";
-}
-?>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-build_menu();
-
-?>
-</td></tr>
-</table>
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
-<form action="v_hunt_group.php" method="post" name="iform" id="iform">
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Hunt Group<br />
- </strong></span>
- Hunt Group is a group of destinations to call at once or in succession.
- </span></p></td>
- </tr>
- </table>
- <br />
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="20%" class="listhdrr">Extension</td>
- <td width="25%" class="listhdrr">Name</td>
- <td width="50%" class="listhdr">Description</td>
- <td width="10%" class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="v_hunt_group_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
-
- <?php
- $i = 0;
- if (count($a_hunt_group) > 0) {
- foreach ($a_hunt_group as $ent) {
- if (strlen($ent['huntgroupid']) > 0) {
-
- $huntgroupid = str_replace(array("{", "}"), "", $ent['huntgroupid']);
-
- ?>
- <tr>
- <td class="listlr" ondblclick="document.location='v_hunt_group_edit.php?id=<?=$i;?>'">
- <?=$ent['huntgroupextension']?>
- </td>
- <td class="listr" ondblclick="document.location='v_hunt_group_edit.php?id=<?=$i;?>';">
- <?=$ent['huntgroupname'];?>&nbsp;
- </td>
- <td class="listbg" ondblclick="document.location='v_hunt_group_edit.php?id=<?=$i;?>';">
- <font color="#FFFFFF"><?=htmlspecialchars($ent['huntgroupdescr']);?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="v_hunt_group_edit.php?id=<?=$i;?>&huntgroupid=<?php echo $ent['huntgroupid'];?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="v_hunt_group.php?type=huntgroup&act=del&id=<?=$i;?>&huntgroupid=<?php echo $huntgroupid; ?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
- }
- $i++;
- }
- }
- ?>
- <tr>
- <td class="list" colspan="3"></td>
- <td class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="v_hunt_group_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
-
- <tr>
- <td class="list" colspan="3"></td>
- <td class="list"></td>
- </tr>
- </table>
-
-</form>
-
-<br>
-<br>
-<?php
-if ($v_path_show) {
- echo $v_scripts_dir."\n";
-}
-?>
-
-<br>
-<br>
-<br>
-<br>
-
-</td>
-</tr>
-</table>
-
-</div>
-
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch_dev/v_hunt_group_destinations.tmp b/config/freeswitch_dev/v_hunt_group_destinations.tmp
deleted file mode 100644
index 9d953147..00000000
--- a/config/freeswitch_dev/v_hunt_group_destinations.tmp
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-/* $Id$ */
-/*
- v_hunt_group_destinations.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/v_config.inc");
-
-
-$a_hunt_group_destinations = &$config['installedpackages']['freeswitchhuntgroupdestinations']['config'];
-
-
-if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'huntgroupdestinations') {
- if ($a_hunt_group_destinations[$_GET['id']]) {
- unset($a_hunt_group_destinations[$_GET['id']]);
- write_config();
- sync_package_v_hunt_group();
- header("Location: v_hunt_group_edit.php?id=".$_GET['parentid']);
- exit;
- }
- }
-}
-
-?> \ No newline at end of file
diff --git a/config/freeswitch_dev/v_hunt_group_destinations_edit.tmp b/config/freeswitch_dev/v_hunt_group_destinations_edit.tmp
deleted file mode 100644
index 6c02a898..00000000
--- a/config/freeswitch_dev/v_hunt_group_destinations_edit.tmp
+++ /dev/null
@@ -1,272 +0,0 @@
-<?php
-/* $Id$ */
-/*
-
- v_hunt_group_destinations_edit.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/v_config.inc");
-
-
-$a_hunt_group_destinations = &$config['installedpackages']['freeswitchhuntgroupdestinations']['config'];
-
-
-$id = $_GET['id'];
-if (isset($_POST['id'])) {
- $id = $_POST['id'];
-}
-
-$parentid = $_GET['parentid'];
-if (isset($_POST['parentid'])) {
- $parentid = $_POST['parentid'];
-}
-
-$huntgroupid = $_GET['huntgroupid'];
-if (isset($_POST['huntgroupid'])) {
- $huntgroupid = $_POST['huntgroupid'];
-}
-
-
-if (isset($id) && $a_hunt_group_destinations[$id]) {
- $pconfig['destinationnumber'] = $a_hunt_group_destinations[$id]['destinationnumber'];
- $pconfig['destinationtype'] = $a_hunt_group_destinations[$id]['destinationtype'];
- $pconfig['destinationprofile'] = $a_hunt_group_destinations[$id]['destinationprofile'];
- $pconfig['destinationorder'] = $a_hunt_group_destinations[$id]['destinationorder'];
- $pconfig['destinationdescr'] = $a_hunt_group_destinations[$id]['destinationdescr'];
-}
-else {
- if (isset($_GET['a'])) {
- //if ($_GET['a'] == "action"){ $pconfig['destinationaction'] = "action"; }
- //if ($_GET['a'] == "antiaction"){ $pconfig['destinationaction'] = "anti-action"; }
- }
-}
-
-
-if ($_POST) {
-
- unset($input_errors);
- $pconfig = $_POST;
-
-
- if (!$input_errors) {
-
- $huntgroupdestinationent = array();
- $huntgroupdestinationent['huntgroupid'] = $_POST['huntgroupid'];
- $huntgroupdestinationent['destinationnumber'] = $_POST['destinationnumber'];
- $huntgroupdestinationent['destinationtype'] = $_POST['destinationtype'];
- $huntgroupdestinationent['destinationprofile'] = $_POST['destinationprofile'];
- $huntgroupdestinationent['destinationorder'] = $_POST['destinationorder'];
- $huntgroupdestinationent['destinationdescr'] = $_POST['destinationdescr'];
-
- if (isset($id) && $a_hunt_group_destinations[$id]) {
- //update
- $a_hunt_group_destinations[$id] = $huntgroupdestinationent;
- }
- else {
- //add
- $a_hunt_group_destinations[] = $huntgroupdestinationent;
- }
-
-
- write_config();
- sync_package_v_hunt_group();
-
- header("Location: v_hunt_group_edit.php?id=".$parentid);
- exit;
- }
-}
-
-include("head.inc");
-
-?>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-
-<?php
-include("fbegin.inc");
-if ($v_label_show) {
- echo "<p class=\"pgtitle\">$v_label: Hunt Group: Destinations: Edit</p>\n";
-}
-if ($input_errors) print_input_errors($input_errors);
-?>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-build_menu();
-
-?>
-</td></tr>
-</table>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
- <br />
- <form action="v_hunt_group_destinations_edit.php" method="post" name="iform" id="iform">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="22%" valign="top" class="vncellreq">Destination</td>
- <td width="78%" class="vtable">
- <input name="destinationnumber" type="text" class="formfld" id="destinationnumber" size="40" value="<?=htmlspecialchars($pconfig['destinationnumber']);?>">
- <br>
- <span class="vexpl">
- <!--<b>examples:</b><br />-->
- extension: 1001<br />
- voicemail: 1001<br />
- sip uri (voicemail): sofia/internal/*98@${domain}<br />
- sip uri (external number): sofia/gateway/gatewayname/12081231234<br />
- sip uri (auto attendant): sofia/internal/5002@${domain}<br />
- sip uri (user): /user/1001@${domain}<br />
- </span>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Type</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='destinationtype' class='formfld'>\n";
- echo " <option></option>\n";
- if (htmlspecialchars($pconfig['destinationtype']) == "extension") {
- echo " <option selected='yes'>extension</option>\n";
- }
- else {
- echo " <option>extension</option>\n";
- }
- if (htmlspecialchars($pconfig['destinationtype']) == "voicemail") {
- echo " <option selected='yes'>voicemail</option>\n";
- }
- else {
- echo " <option>voicemail</option>\n";
- }
- if (htmlspecialchars($pconfig['destinationtype']) == "sip uri") {
- echo " <option selected='yes'>sip uri</option>\n";
- }
- else {
- echo " <option>sip uri</option>\n";
- }
- echo " </select>\n";
- ?>
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncellreq">Profile</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='destinationprofile' class='formfld'>\n";
- echo " <option></option>\n";
- if (htmlspecialchars($pconfig['destinationprofile']) == "auto") {
- echo " <option selected='yes'>auto</option>\n";
- }
- else {
- echo " <option>auto</option>\n";
- }
- foreach (ListFiles($v_conf_dir.'/sip_profiles') as $key=>$sip_profile_file){
- $sip_profile_name = str_replace(".xml", "", $sip_profile_file);
-
- if (htmlspecialchars($pconfig['destinationprofile']) == $sip_profile_name) {
- echo " <option selected='yes'>$sip_profile_name</option>\n";
- }
- else {
- echo " <option>$sip_profile_name</option>\n";
- }
- }
- echo " </select>\n";
-
-
- ?>
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncell">Order</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='destinationorder' class='formfld'>\n";
- //echo " <option></option>\n";
- if (strlen(htmlspecialchars($pconfig['destinationorder']))> 0) {
- echo " <option selected='yes' value='".htmlspecialchars($pconfig['destinationorder'])."'>".htmlspecialchars($pconfig['destinationorder'])."</option>\n";
- }
- $i=0;
- while($i<=999) {
- if (strlen($i) == 1) {
- echo " <option value='00$i'>00$i</option>\n";
- }
- if (strlen($i) == 2) {
- echo " <option value='0$i'>0$i</option>\n";
- }
- if (strlen($i) == 3) {
- echo " <option value='$i'>$i</option>\n";
- }
-
- $i++;
- }
- echo " </select>\n";
- ?>
- <br />
- Processing of each destination is determined by this order.
-
- <br> <span class="vexpl"></span></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Description</td>
- <td width="78%" class="vtable">
- <input name="destinationdescr" type="text" class="formfld" id="destinationdescr" size="40" value="<?=htmlspecialchars($pconfig['destinationdescr']);?>">
- <br> <span class="vexpl">You may enter a description here
- for your reference (not parsed).</span></td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="huntgroupid" type="hidden" value="<?=$huntgroupid;?>">
- <input name="parentid" type="hidden" value="<?=$parentid;?>">
- <?php if (isset($id) && $a_hunt_group_destinations[$id]): ?>
- <input name="id" type="hidden" value="<?=$id;?>">
- <?php endif; ?>
- <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()">
- </td>
- </tr>
- </table>
- </form>
-
- <br>
- <br>
- <br>
- <br>
- <br>
- <br>
-
- </td>
- </tr>
-</table>
-
-</div>
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch_dev/v_hunt_group_edit.tmp b/config/freeswitch_dev/v_hunt_group_edit.tmp
deleted file mode 100644
index f72769bb..00000000
--- a/config/freeswitch_dev/v_hunt_group_edit.tmp
+++ /dev/null
@@ -1,512 +0,0 @@
-<?php
-/* $Id$ */
-/*
-
- v_hunt_group_edit.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/v_config.inc");;
-
-
-$a_hunt_group = &$config['installedpackages']['freeswitchhuntgroup']['config'];
-$a_hunt_group_destinations = &$config['installedpackages']['freeswitchhuntgroupdestinations']['config'];
-
-
-$id = $_GET['id'];
-if (isset($_POST['id'])) {
- $id = $_POST['id'];
-}
-$parentid = $id;
-
-
-
-if (isset($id) && $a_hunt_group[$id]) {
- $pconfig['huntgroupid'] = $a_hunt_group[$id]['huntgroupid'];
- $huntgroupid = $a_hunt_group[$id]['huntgroupid'];
- $pconfig['huntgroupextension'] = $a_hunt_group[$id]['huntgroupextension'];
- $pconfig['huntgroupname'] = $a_hunt_group[$id]['huntgroupname'];
- $pconfig['huntgrouptype'] = $a_hunt_group[$id]['huntgrouptype'];
- $pconfig['huntgroupcontext'] = $a_hunt_group[$id]['huntgroupcontext'];
- $pconfig['huntgrouptimeout'] = $a_hunt_group[$id]['huntgrouptimeout'];
- $pconfig['huntgrouptimeoutdestination'] = $a_hunt_group[$id]['huntgrouptimeoutdestination'];
- $pconfig['huntgrouptimeouttype'] = $a_hunt_group[$id]['huntgrouptimeouttype'];
- $pconfig['huntgroupringback'] = $a_hunt_group[$id]['huntgroupringback'];
- $pconfig['huntgroupcidnameprefix'] = $a_hunt_group[$id]['huntgroupcidnameprefix'];
- $pconfig['huntgrouppin'] = $a_hunt_group[$id]['huntgrouppin'];
- $pconfig['huntgroupcallerannounce'] = $a_hunt_group[$id]['huntgroupcallerannounce'];
- $pconfig['huntgroupdescr'] = $a_hunt_group[$id]['huntgroupdescr'];
-}
-
-if ($_POST) {
-
- unset($input_errors);
- $pconfig = $_POST;
-
- if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'destinations') {
- if ($a_hunt_group_destinations[$_GET['optionid']]) {
- unset($a_hunt_group_destinations[$_GET['optionid']]);
- write_config();
- sync_package_v_hunt_group();
- header("Location: v_hunt_group_edit.php?id=".$_GET['id']);
- exit;
- }
- }
- }
-
-
- if (!$input_errors) {
-
- $huntgroupent = array();
- if (strlen($_POST['huntgroupid']) > 0) {
- $huntgroupent['huntgroupid'] = $_POST['huntgroupid'];
- }
- else {
- $huntgroupent['huntgroupid'] = guid();
- }
- $huntgroupent['huntgroupextension'] = $_POST['huntgroupextension'];
- $huntgroupent['huntgroupname'] = $_POST['huntgroupname'];
- $huntgroupent['huntgrouptype'] = $_POST['huntgrouptype'];
- $huntgroupent['huntgroupcontext'] = $_POST['huntgroupcontext'];
- $huntgroupent['huntgrouptimeout'] = $_POST['huntgrouptimeout'];
- $huntgroupent['huntgrouptimeoutdestination'] = $_POST['huntgrouptimeoutdestination'];
- $huntgroupent['huntgrouptimeouttype'] = $_POST['huntgrouptimeouttype'];
- $huntgroupent['huntgroupringback'] = $_POST['huntgroupringback'];
- $huntgroupent['huntgroupcidnameprefix'] = $_POST['huntgroupcidnameprefix'];
- $huntgroupent['huntgrouppin'] = $_POST['huntgrouppin'];
- $huntgroupent['huntgroupcallerannounce'] = $_POST['huntgroupcallerannounce'];
- $huntgroupent['huntgroupdescr'] = $_POST['huntgroupdescr'];
-
- if (isset($id) && $a_hunt_group[$id]) {
- //update
- $a_hunt_group[$id] = $huntgroupent;
- }
- else {
- //add
- $a_hunt_group[] = $huntgroupent;
- }
-
- //touch($d_hostsdirty_path);
- write_config();
- sync_package_v_hunt_group();
-
- header("Location: v_hunt_group.php");
- exit;
- }
-}
-
-include("head.inc");
-
-?>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-
-<?php
-include("fbegin.inc");
-if ($v_label_show) {
- echo "<p class=\"pgtitle\">$v_label: Hunt Group: Edit</p>\n";
-}
-if ($input_errors) print_input_errors($input_errors);
-
-?>
-
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-build_menu();
-
-?>
-</td></tr>
-</table>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>General Settings:<br>
- </strong></span>
- Hunt Group general settings.
- </span></p></td>
- </tr>
- </table>
- <br />
-
- <form action="v_hunt_group_edit.php" method="post" name="iform" id="iform">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="22%" valign="top" class="vncellreq">Extension</td>
- <td width="78%" class="vtable">
- <input name="huntgroupextension" type="text" class="formfld" id="huntgroupextension" size="40" value="<?=htmlspecialchars($pconfig['huntgroupextension']);?>">
- <br> <span class="vexpl">e.g. <em>7002</em></span></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Hunt Group Name</td>
- <td width="78%" class="vtable">
- <input name="huntgroupname" type="text" class="formfld" id="huntgroupname" size="40" value="<?=htmlspecialchars($pconfig['huntgroupname']);?>">
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncellreq">Type</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='huntgrouptype' class='formfld'>\n";
- echo " <option></option>\n";
- if (htmlspecialchars($pconfig['huntgrouptype']) == "simultaneous") {
- echo " <option selected='yes'>simultaneous</option>\n";
- }
- else {
- echo " <option>simultaneous</option>\n";
- }
- if (htmlspecialchars($pconfig['huntgrouptype']) == "sequentially") {
- echo " <option selected='yes'>sequentially</option>\n";
- }
- else {
- echo " <option>sequentially</option>\n";
- }
- echo " </select>\n";
- ?>
- </td>
- </tr>
-
- <?php
- if (strlen($pconfig['huntgrouptimeout']) == 0) {
- $pconfig['huntgrouptimeout'] = 30; //set a default timeout
- }
- ?>
- <tr>
- <td width="22%" valign="top" class="vncell">Context</td>
- <td width="78%" class="vtable">
- <input name="huntgroupcontext" type="text" class="formfld" id="huntgroupextension" size="40" value="<?=htmlspecialchars($pconfig['huntgroupcontext']);?>">
- <br> <span class="vexpl">e.g. <em>default</em></span></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Timeout</td>
- <td width="78%" class="vtable">
- <input name="huntgrouptimeout" type="text" class="formfld" id="huntgrouptimeout" size="40" value="<?=htmlspecialchars($pconfig['huntgrouptimeout']);?>">
- <br>
- <span class="vexpl">
- The timeout sets the time in seconds to continue to call before timing out.
- </span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Timeout Type</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='huntgrouptimeouttype' class='formfld'>\n";
- echo " <option></option>\n";
- if (htmlspecialchars($pconfig['huntgrouptimeouttype']) == "extension") {
- echo " <option selected='yes'>extension</option>\n";
- }
- else {
- echo " <option>extension</option>\n";
- }
- if (htmlspecialchars($pconfig['huntgrouptimeouttype']) == "voicemail") {
- echo " <option selected='yes'>voicemail</option>\n";
- }
- else {
- echo " <option>voicemail</option>\n";
- }
- if (htmlspecialchars($pconfig['huntgrouptimeouttype']) == "sip uri") {
- echo " <option selected='yes'>sip uri</option>\n";
- }
- else {
- echo " <option>sip uri</option>\n";
- }
- echo " </select>\n";
- ?>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Timeout Destination</td>
- <td width="78%" class="vtable">
- <input name="huntgrouptimeoutdestination" type="text" class="formfld" id="huntgrouptimeoutdestination" size="40" value="<?=htmlspecialchars($pconfig['huntgrouptimeoutdestination']);?>">
- <br> <span class="vexpl">Destination<br>
- e.g. <em>1001</em></span></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Ring Back</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='huntgroupringback' class='formfld'>\n";
- echo " <option></option>\n";
- if (htmlspecialchars($pconfig['huntgroupringback']) == "ring") {
- echo " <option selected='yes'>ring</option>\n";
- }
- else {
- echo " <option>ring</option>\n";
- }
- if (htmlspecialchars($pconfig['huntgroupringback']) == "music") {
- echo " <option selected='yes'>music</option>\n";
- }
- else {
- echo " <option>music</option>\n";
- }
- echo " </select>\n";
- ?>
- <br>
- <span class="vexpl">
- Defines what the caller will hear while destination is being called. The choices are music
- (music on hold) ring (ring tone.) default: music
- </span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">CID Prefix</td>
- <td width="78%" class="vtable">
- <input name="huntgroupcidnameprefix" type="text" class="formfld" id="huntgroupcidnameprefix" size="40" value="<?=htmlspecialchars($pconfig['huntgroupcidnameprefix']);?>">
- <br>
- <span class="vexpl">
- Set a prefix on the caller ID name. (optional)
- </span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">PIN</td>
- <td width="78%" class="vtable">
- <input name="huntgrouppin" type="text" class="formfld" id="huntgrouppin" size="40" value="<?=htmlspecialchars($pconfig['huntgrouppin']);?>">
- <br>
- <span class="vexpl">
- If this is provided then the caller will be required to enter the PIN number. (optional)
- </span>
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncell">Caller Announce</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='huntgroupcallerannounce' class='formfld'>\n";
- echo " <option></option>\n";
- if (htmlspecialchars($pconfig['huntgroupcallerannounce']) == "true") {
- echo " <option selected='yes'>true</option>\n";
- }
- else {
- echo " <option>true</option>\n";
- }
- if (htmlspecialchars($pconfig['huntgroupcallerannounce']) == "false") {
- echo " <option selected='yes'>false</option>\n";
- }
- else {
- echo " <option>false</option>\n";
- }
- echo " </select>\n";
- ?>
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncell">Description</td>
- <td width="78%" class="vtable">
- <input name="huntgroupdescr" type="text" class="formfld" id="descr" size="40" value="<?=htmlspecialchars($pconfig['huntgroupdescr']);?>">
- <br>
- <span class="vexpl">
- You may enter a description here for your reference (not parsed).
- </span>
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()">
- <input name="huntgroupid" type="hidden" value="<?=htmlspecialchars($pconfig['huntgroupid']);?>">
- <?php if (isset($id) && $a_hunt_group[$id]): ?>
- <input name="id" type="hidden" value="<?=$id;?>">
- <?php endif; ?>
- </td>
- </tr>
- </table>
- </form>
-
- <br>
- <br>
-
- <form action="v_hunt_group_edit.php" method="post" name="iform2" id="iform2">
- <?php
-
-
- //echo "<pre>";
- //print_r ($a_hunt_group);
- //echo "</pre>";
-
- //if ($savemsg) print_info_box($savemsg);
- //if (file_exists($d_hostsdirty_path)): echo"<p>";
- //print_info_box_np("The FreeSWITCH recordings have been changed.<br>You must apply the changes in order for them to take effect.");
- //echo"<br />";
- //endif;
-
- ?>
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Destinations<br />
- </strong></span>
- The following destinations will be called.
- </span></p></td>
- </tr>
- </table>
- <br />
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="40%" class="listhdrr">Destination</td>
- <td width="40" class="listhdrr">Type</td>
- <td width="40" class="listhdrr">Profile</td>
- <td width="40" class="listhdrr">Order</td>
- <td width="45%" class="listhdr">Description</td>
- <td width="30" class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle">
- <?php if (strlen($huntgroupid) > 1) { ?>
- <a href="v_hunt_group_destinations_edit.php?parentid=<?=$parentid;?>&huntgroupid=<?=$huntgroupid;?>&a=action"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- <?php } ?>
- </tr>
- </table>
- </td>
- </tr>
-
- <?php
- //create a temporary id for the array
- $i = 0;
- if (count($a_hunt_group_destinations) > 0) {
- foreach ($a_hunt_group_destinations as $ent) {
- $a_hunt_group_destinations[$i]['id'] = $i;
- $i++;
- }
- }
-
- //order the array
- function cmp_number($a, $b) {
- if ($a["destinationorder"] > $b["destinationorder"]) {
- return 1;
- }
- else {
- return 0;
- }
- }
- if (count($a_hunt_group_destinations) > 0) { usort($a_hunt_group_destinations, "cmp_number"); }
-
- $i = 0;
- if (count($a_hunt_group_destinations) > 0) {
- foreach ($a_hunt_group_destinations as $ent) {
- if ($huntgroupid == $ent['huntgroupid']) {
- ?>
- <tr>
- <td class="listlr" ondblclick="document.location='v_hunt_group_destinations_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&huntgroupid=<?=$huntgroupid;?>'">
- <?=$ent['destinationnumber']?>
- </td>
- <td class="listr" ondblclick="document.location='v_hunt_group_destinations_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&huntgroupid=<?=$huntgroupid;?>';">
- <?=$ent['destinationtype'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='v_hunt_group_destinations_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&huntgroupid=<?=$huntgroupid;?>';">
- <?=$ent['destinationprofile'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='v_hunt_group_destinations_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&huntgroupid=<?=$huntgroupid;?>';">
- <?=$ent['destinationorder'];?>&nbsp;
- </td>
- <td class="listbg" ondblclick="document.location='v_hunt_group_destinations_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&huntgroupid=<?=$huntgroupid;?>';">
- <font color="#FFFFFF"><?=htmlspecialchars($ent['destinationdescr']);?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <?php
- if (strlen($huntgroupid) > 1) {
- echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n";
- echo " <tr>\n";
- echo " <td valign=\"middle\"><a href=\"v_hunt_group_destinations_edit.php?id=".$ent['id']."&parentid=".$parentid."&huntgroupid=".$huntgroupid."\"><img src=\"/themes/".$g['theme']."/images/icons/icon_e.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n";
- echo " <td><a href=\"v_hunt_group_destinations.php?type=huntgroupdestinations&act=del&id=".$ent['id']."&parentid=".$parentid."&huntgroupid=".$huntgroupid."\" onclick=\"return confirm('Do you really want to delete this recording?')\"><img src=\"/themes/".$g['theme']."/images/icons/icon_x.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n";
- echo " </tr>\n";
- echo "</table>\n";
- }
- ?>
- </td>
- </tr>
- <?php
- }
- $i++;
- }
- }
- ?>
- <tr>
- <td class="list" colspan="5"></td>
- <td class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle">
- <?php if (strlen($huntgroupid) > 1) { ?>
- <a href="v_hunt_group_destinations_edit.php?parentid=<?=$parentid;?>&huntgroupid=<?=$huntgroupid;?>&a=action"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a>
- <?php } ?>
- </td>
- </tr>
- </table>
- </td>
- </tr>
-
-
- <tr>
- <td class="list" colspan="5"></td>
- <td class="list"></td>
- </tr>
- </table>
-
- </form>
-
-
-
-
- </td>
- </tr>
-
-
- <tr>
- <td class="list" colspan="4"></td>
- <td class="list"></td>
- </tr>
- </table>
-
-
-
- <br>
- <br>
-
- </td>
- </tr>
-</table>
-
-</div>
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch_dev/v_mailto.tmp b/config/freeswitch_dev/v_mailto.tmp
deleted file mode 100644
index 407123aa..00000000
--- a/config/freeswitch_dev/v_mailto.tmp
+++ /dev/null
@@ -1,240 +0,0 @@
-<?php
-/* $Id$ */
-/*
- v_mailto.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require_once("/etc/inc/config.inc");
-require("/usr/local/pkg/v_config.inc");
-global $config;
-
-$tmp_smtphost = $config['installedpackages']['freeswitchsettings']['config'][0]['smtphost'];
-$tmp_smtpsecure = $config['installedpackages']['freeswitchsettings']['config'][0]['smtpsecure']; //options "", "TLS", "SSL"
-$tmp_smtpsecure = strtolower($tmp_smtpsecure);
-$tmp_smtpauth = $config['installedpackages']['freeswitchsettings']['config'][0]['smtpauth']; // SMTP authentication: true or false
-$tmp_smtpusername = $config['installedpackages']['freeswitchsettings']['config'][0]['smtpusername'];
-$tmp_smtppassword = $config['installedpackages']['freeswitchsettings']['config'][0]['smtppassword'];
-$tmp_smtpfrom = $config['installedpackages']['freeswitchsettings']['config'][0]['smtpfrom'];
-$tmp_smtpfromname = $config['installedpackages']['freeswitchsettings']['config'][0]['smtpfromname'];
-
-
-ini_set(max_execution_time,900); //15 minutes
-ini_set('memory_limit', '96M');
-$fd = fopen("php://stdin", "r");
-
-$email = file_get_contents ("php://stdin");
-
-fclose($fd);
-
-if($fd){
- $fp = fopen($tmp_dir."/voicemailtoemail.txt", "w");
-}
-
-
-ob_end_clean();
-ob_start();
-
-
-//get main header and body
- $tmparray = split("\n\n", $email);
- $mainheader = $tmparray[0];
- $maincontent = substr($email, strlen($mainheader), strlen($email));
-
-//get the boundary
- $tmparray = split("\n", $mainheader);
- $contenttmp = $tmparray[1]; //Content-Type: multipart/mixed; boundary="XXXX_boundary_XXXX"
- $tmparray = split('; ', $contenttmp); //boundary="XXXX_boundary_XXXX"
- $contenttmp = $tmparray[1];
- $tmparray = split('=', $contenttmp); //"XXXX_boundary_XXXX"
- $boundary = $tmparray[1];
- $boundary = trim($boundary,'"');
- //echo "boundary: $boundary\n";
-
-//put the main headers into an array
- $mainheaderarray = split("\n", $mainheader);
- //print_r($mainheaderarray);
- foreach ($mainheaderarray as $val) {
- $tmparray = split(': ', $val);
- //print_r($tmparray);
- $var[$tmparray[0]] = trim($tmparray[1]);
- }
-
- $var['To'] = str_replace("<", "", $var['To']);
- $var['To'] = str_replace(">", "", $var['To']);
-
- echo "To: ".$var['To']."\n";
- echo "From: ".$var['From']."\n";
- echo "Subject: ".$var['Subject']."\n";
- //print_r($var);
- echo "\n\n";
-
-
-// split mime type multi-part into each part
- $maincontent = str_replace($boundary."--", $boundary, $maincontent);
- $tmparray = split("--".$boundary, $maincontent);
-
-// loop through each mime part
- $i=0;
- foreach ($tmparray as $mimepart) {
-
- $mimearray = split("\n\n", $mimepart);
- $subheader = $mimearray[0];
- $headermimearray = split("\n", trim($subheader));
-
- $x=0;
- foreach ($headermimearray as $val) {
- if(stristr($val, ':') === FALSE) {
- $tmparray = split('=', $val); //':' not found
- if (trim($tmparray[0]) == "boundary") {
- $subboundary = $tmparray[1];
- $subboundary = trim($subboundary,'"');
- //echo "subboundary: ".$subboundary."\n";
- }
- }
- else {
- $tmparray = split(':', $val); //':' found
- }
-
- //print_r($tmparray);
- $var[trim($tmparray[0])] = trim($tmparray[1]);
- }
- //print_r($var);
-
-
- $contenttypearray = split(' ', $headermimearray[0]);
-
- if ($contenttypearray[0] == "Content-Type:") {
- $contenttype = trim($contenttypearray[1]);
-
- switch ($contenttype) {
- case "multipart/alternative;":
-
- //echo "type: ".$contenttype."\n";
- $content = trim(substr($mimepart, strlen($subheader), strlen($mimepart)));
-
- $content = str_replace($subboundary."--", $subboundary, $content);
- $tmpsubarray = split("--".$subboundary, $content);
- foreach ($tmpsubarray as $mimesubsubpart) {
-
- $mimesubsubarray = split("\n\n", $mimesubsubpart);
- $subsubheader = $mimesubsubarray[0];
-
- $headersubsubmimeearray = split("\n", trim($subsubheader));
- $subsubcontenttypearray = split(' ', $headersubsubmimeearray[0]);
- //echo "subsubcontenttypearray[0] ".$subsubcontenttypearray[0]."\n";
-
- if ($subsubcontenttypearray[0] == "Content-Type:") {
- $subsubcontenttype = trim($subsubcontenttypearray[1]);
- switch ($subsubcontenttype) {
- case "text/plain;":
- $textplain = trim(substr($mimesubsubpart, strlen($subsubheader), strlen($mimesubsubpart)));
- //echo "text/plain: $textplain\n";
- break;
- case "text/html;":
- $texthtml = trim(substr($mimesubsubpart, strlen($subsubheader), strlen($mimesubsubpart)));
- //echo "text/html: $texthtml\n";
- break;
- }
- } //end if
-
-
- } //end foreach
-
- break;
- case "audio/wav;":
- //echo "type: ".$contenttype."\n";
- $strwav = trim(substr($mimepart, strlen($subheader), strlen($mimepart)));
- //echo "\n*** begin wav ***\n".$strwav."\n*** end wav ***\n";
- break;
-
- }//end switch
- } //end if
-
- $i++;
-
- } //end foreach
-
-
-//send the email
-
- include $v_web_dir."/class.phpmailer.php";
- include $v_web_dir."/class.smtp.php"; // optional, gets called from within class.phpmailer.php if not already loaded
-
- $mail = new PHPMailer();
-
- $mail->IsSMTP(); // set mailer to use SMTP
- if ($tmp_smtpauth == "true") {
- $mail->SMTPAuth = $tmp_smtpauth; // turn on/off SMTP authentication
- }
- $mail->Host = $tmp_smtphost;
- if (strlen($tmp_smtpsecure)>0) {
- $mail->SMTPSecure = $tmp_smtpsecure;
- }
- if ($tmp_smtpusername) {
- $mail->Username = $tmp_smtpusername;
- $mail->Password = $tmp_smtppassword;
- }
- $mail->SMTPDebug = 2;
-
-
- $mail->From = $tmp_smtpfrom;
- $mail->FromName = $tmp_smtpfromname;
- $mail->Subject = $var['Subject'];
- $mail->AltBody = $textplain; // optional, comment out and test
- $mail->MsgHTML($texthtml);
-
-
- $tmp_to = $var['To'];
- $tmp_to = str_replace(";", ",", $tmp_to);
- $tmp_to_array = split(",", $tmp_to);
- foreach($tmp_to_array as $tmp_to_row) {
- if (strlen($tmp_to_row) > 0) {
- $mail->AddAddress($tmp_to_row);
- }
- }
-
- if (strlen($strwav) > 0) {
- //$mail->AddAttachment($v_dir."/data/domain/example.wav"); // attachment
- $filename='voicemail.wav'; $encoding = "base64"; $type = "audio/wav";
- $mail->AddStringAttachment(base64_decode($strwav),$filename,$encoding,$type);
- }
- unset($strwav);
-
- if(!$mail->Send()) {
- echo "Mailer Error: " . $mail->ErrorInfo;
- }
- else {
- echo "Message sent!";
- }
-
-
-$content = ob_get_contents(); //get the output from the buffer
-ob_end_clean(); //clean the buffer
-
-fwrite($fp, $content);
-fclose($fp);
-
-?> \ No newline at end of file
diff --git a/config/freeswitch_dev/v_modules.tmp b/config/freeswitch_dev/v_modules.tmp
deleted file mode 100644
index b640a2cc..00000000
--- a/config/freeswitch_dev/v_modules.tmp
+++ /dev/null
@@ -1,2384 +0,0 @@
-<?php
-/* $Id$ */
-/*
- v_modules.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/v_config.inc");
-$config['installedpackages']['freeswitchmodules']['config'][$id]['mod_console'];
-
-$a_modules = &$config['installedpackages']['freeswitchmodules']['config'];
-
-//$id = $_GET['id'];
-//if (isset($_POST['id'])) {
-// $id = $_POST['id'];
-//}
-$id = 0;
-
-
-if (isset($id) && $a_modules[$id]) {
-
- //Loggers
- $pconfig['mod_console'] = $a_modules[$id]['mod_console'];
- $pconfig['mod_logfile'] = $a_modules[$id]['mod_logfile'];
- $pconfig['mod_syslog'] = $a_modules[$id]['mod_syslog'];
-
- //Multi-Faceted
- $pconfig['mod_enum'] = $a_modules[$id]['mod_enum'];
-
- //XML Interfaces
- $pconfig['mod_xml_rpc'] = $a_modules[$id]['mod_xml_rpc'];
- $pconfig['mod_xml_curl'] = $a_modules[$id]['mod_xml_curl'];
- $pconfig['mod_xml_cdr'] = $a_modules[$id]['mod_xml_cdr'];
-
- //Event Handlers
- $pconfig['mod_cdr_csv'] = $a_modules[$id]['mod_cdr_csv'];
- $pconfig['mod_event_multicast'] = $a_modules[$id]['mod_event_multicast'];
- $pconfig['mod_event_socket'] = $a_modules[$id]['mod_event_socket'];
- $pconfig['mod_zeroconf'] = $a_modules[$id]['mod_zeroconf'];
-
- //Directory Interfaces
- $pconfig['mod_ldap'] = $a_modules[$id]['mod_ldap'];
-
- //Endpoints
- //$pconfig['mod_dingaling'] = $a_modules[$id]['mod_dingaling'];
- $pconfig['mod_iax'] = $a_modules[$id]['mod_iax'];
- $pconfig['mod_portaudio'] = $a_modules[$id]['mod_portaudio'];
- $pconfig['mod_alsa'] = $a_modules[$id]['mod_alsa'];
- $pconfig['mod_sofia'] = $a_modules[$id]['mod_sofia'];
- $pconfig['mod_loopback'] = $a_modules[$id]['mod_loopback'];
- $pconfig['mod_wanpipe'] = $a_modules[$id]['mod_wanpipe'];
- $pconfig['mod_woomera'] = $a_modules[$id]['mod_woomera'];
- $pconfig['mod_openzap'] = $a_modules[$id]['mod_openzap'];
-
- //Applications
- $pconfig['mod_cidlookup'] = $a_modules[$id]['mod_cidlookup'];
- $pconfig['mod_commands'] = $a_modules[$id]['mod_commands'];
- $pconfig['mod_conference'] = $a_modules[$id]['mod_conference'];
- $pconfig['mod_dptools'] = $a_modules[$id]['mod_dptools'];
- $pconfig['mod_easyroute'] = $a_modules[$id]['mod_easyroute'];
- $pconfig['mod_esf'] = $a_modules[$id]['mod_esf'];
- $pconfig['mod_expr'] = $a_modules[$id]['mod_expr'];
- $pconfig['mod_fax'] = $a_modules[$id]['mod_fax'];
- $pconfig['mod_fifo'] = $a_modules[$id]['mod_fifo'];
- $pconfig['mod_file_string'] = $a_modules[$id]['mod_file_string'];
- $pconfig['mod_fsv'] = $a_modules[$id]['mod_fsv'];
- $pconfig['mod_voicemail'] = $a_modules[$id]['mod_voicemail'];
- $pconfig['mod_lcr'] = $a_modules[$id]['mod_lcr'];
- $pconfig['mod_limit'] = $a_modules[$id]['mod_limit'];
- $pconfig['mod_soundtouch'] = $a_modules[$id]['mod_soundtouch'];
- $pconfig['mod_spy'] = $a_modules[$id]['mod_spy'];
- $pconfig['mod_vmd'] = $a_modules[$id]['mod_vmd'];
-
- //Snom
- $pconfig['mod_snom'] = $a_modules[$id]['mod_snom'];
-
- //Dialplan Interfaces
- $pconfig['mod_dialplan_directory'] = $a_modules[$id]['mod_dialplan_directory'];
- $pconfig['mod_dialplan_xml'] = $a_modules[$id]['mod_dialplan_xml'];
- $pconfig['mod_dialplan_asterisk'] = $a_modules[$id]['mod_dialplan_asterisk'];
- $pconfig['mod_yaml'] = $a_modules[$id]['mod_yaml'];
-
- //Codec Interfaces
- $pconfig['mod_voipcodecs'] = $a_modules[$id]['mod_voipcodecs'];
- $pconfig['mod_g723_1'] = $a_modules[$id]['mod_g723_1'];
- $pconfig['mod_g729'] = $a_modules[$id]['mod_g729'];
- $pconfig['mod_amr'] = $a_modules[$id]['mod_amr'];
- $pconfig['mod_amrwb'] = $a_modules[$id]['mod_amrwb'];
- $pconfig['mod_ilbc'] = $a_modules[$id]['mod_ilbc'];
- $pconfig['mod_speex'] = $a_modules[$id]['mod_speex'];
- $pconfig['mod_siren'] = $a_modules[$id]['mod_siren'];
- $pconfig['mod_celt'] = $a_modules[$id]['mod_celt'];
- $pconfig['mod_h26x'] = $a_modules[$id]['mod_h26x'];
-
- //File Format Interfaces
- $pconfig['mod_sndfile'] = $a_modules[$id]['mod_sndfile'];
- $pconfig['mod_native_file'] = $a_modules[$id]['mod_native_file'];
-
- //Streams / Files
- $pconfig['mod_shout'] = $a_modules[$id]['mod_shout'];
- $pconfig['mod_local_stream'] = $a_modules[$id]['mod_local_stream'];
- $pconfig['mod_tone_stream'] = $a_modules[$id]['mod_tone_stream'];
-
- //Languages
- $pconfig['mod_spidermonkey'] = $a_modules[$id]['mod_spidermonkey'];
- $pconfig['mod_spidermonkey_core_db'] = $a_modules[$id]['mod_spidermonkey_core_db'];
- $pconfig['mod_spidermonkey_curl'] = $a_modules[$id]['mod_spidermonkey_curl'];
- $pconfig['mod_spidermonkey_odbc'] = $a_modules[$id]['mod_spidermonkey_odbc'];
- $pconfig['mod_spidermonkey_socket'] = $a_modules[$id]['mod_spidermonkey_socket'];
- $pconfig['mod_spidermonkey_teletone'] = $a_modules[$id]['mod_spidermonkey_teletone'];
- $pconfig['mod_perl'] = $a_modules[$id]['mod_perl'];
- $pconfig['mod_python'] = $a_modules[$id]['mod_python'];
- $pconfig['mod_java'] = $a_modules[$id]['mod_java'];
- $pconfig['mod_lua'] = $a_modules[$id]['mod_lua'];
-
- //ASR / TTS
- $pconfig['mod_flite'] = $a_modules[$id]['mod_flite'];
- $pconfig['mod_pocketsphinx'] = $a_modules[$id]['mod_pocketsphinx'];
- $pconfig['mod_cepstral'] = $a_modules[$id]['mod_cepstral'];
- $pconfig['mod_openmrcp'] = $a_modules[$id]['mod_openmrcp'];
- $pconfig['mod_rss'] = $a_modules[$id]['mod_rss'];
-
- //Say
- $pconfig['mod_say_de'] = $a_modules[$id]['mod_say_de'];
- $pconfig['mod_say_en'] = $a_modules[$id]['mod_say_en'];
- $pconfig['mod_say_es'] = $a_modules[$id]['mod_say_es'];
- $pconfig['mod_say_fr'] = $a_modules[$id]['mod_say_fr'];
- $pconfig['mod_say_it'] = $a_modules[$id]['mod_say_it'];
- $pconfig['mod_say_nl'] = $a_modules[$id]['mod_say_nl'];
- $pconfig['mod_say_ru'] = $a_modules[$id]['mod_say_ru'];
- $pconfig['mod_say_zh'] = $a_modules[$id]['mod_say_zh'];
-
-}
-
-if ($_POST) {
-
- unset($input_errors);
- $pconfig = $_POST;
-
- if (!$input_errors) {
-
- $ent = array();
- //$ent['zzz'] = $_POST['zzz'];
-
- //Loggers
- $ent['mod_console'] = $_POST['mod_console'];
- $ent['mod_logfile'] = $_POST['mod_logfile'];
- $ent['mod_syslog'] = $_POST['mod_syslog'];
-
- //Multi-Faceted
- $ent['mod_enum'] = $_POST['mod_enum'];
-
- //XML Interfaces
- $ent['mod_xml_rpc'] = $_POST['mod_xml_rpc'];
- $ent['mod_xml_curl'] = $_POST['mod_xml_curl'];
- $ent['mod_xml_cdr'] = $_POST['mod_xml_cdr'];
- $ent['mod_cdr_csv'] = $_POST['mod_cdr_csv'];
-
- //Event Handlers
- $ent['mod_event_multicast'] = $_POST['mod_event_multicast'];
- $ent['mod_event_socket'] = $_POST['mod_event_socket'];
- $ent['mod_zeroconf'] = $_POST['mod_zeroconf'];
-
- //Directory Interfaces
- $ent['mod_ldap'] = $_POST['mod_ldap'];
-
- //Endpoints
- $ent['mod_dingaling'] = $_POST['mod_dingaling'];
- $ent['mod_iax'] = $_POST['mod_iax'];
- $ent['mod_portaudio'] = $_POST['mod_portaudio'];
- $ent['mod_alsa'] = $_POST['mod_alsa'];
- $ent['mod_sofia'] = $_POST['mod_sofia'];
- $ent['mod_loopback'] = $_POST['mod_loopback'];
- $ent['mod_wanpipe'] = $_POST['mod_wanpipe'];
- $ent['mod_woomera'] = $_POST['mod_woomera'];
- $ent['mod_openzap'] = $_POST['mod_openzap'];
-
- //Applications
- $ent['mod_cidlookup'] = $_POST['mod_cidlookup'];
- $ent['mod_commands'] = $_POST['mod_commands'];
- $ent['mod_conference'] = $_POST['mod_conference'];
- $ent['mod_dptools'] = $_POST['mod_dptools'];
- $ent['mod_esf'] = $_POST['mod_esf'];
- $ent['mod_easyroute'] = $_POST['mod_easyroute'];
- $ent['mod_expr'] = $_POST['mod_expr'];
- $ent['mod_fax'] = $_POST['mod_fax'];
- $ent['mod_fsv'] = $_POST['mod_fsv'];
- $ent['mod_fifo'] = $_POST['mod_fifo'];
- $ent['mod_file_string'] = $_POST['mod_file_string'];
- $ent['mod_lcr'] = $_POST['mod_lcr'];
- $ent['mod_limit'] = $_POST['mod_limit'];
- $ent['mod_soundtouch'] = $_POST['mod_soundtouch'];
- $ent['mod_spy'] = $_POST['mod_spy'];
- $ent['mod_vmd'] = $_POST['mod_vmd'];
- $ent['mod_voicemail'] = $_POST['mod_voicemail'];
-
- //SNOM
- $ent['mod_snom'] = $_POST['mod_snom'];
-
- //Dialplan Interfaces
- $ent['mod_dialplan_directory'] = $_POST['mod_dialplan_directory'];
- $ent['mod_dialplan_xml'] = $_POST['mod_dialplan_xml'];
- $ent['mod_dialplan_asterisk'] = $_POST['mod_dialplan_asterisk'];
- $ent['mod_yaml'] = $_POST['mod_yaml'];
-
- //Codec Interfaces
- $ent['mod_voipcodecs'] = $_POST['mod_voipcodecs'];
- $ent['mod_g723_1'] = $_POST['mod_g723_1'];
- $ent['mod_g729'] = $_POST['mod_g729'];
- $ent['mod_amr'] = $_POST['mod_amr'];
- $ent['mod_amrwb'] = $_POST['mod_amrwb'];
- $ent['mod_ilbc'] = $_POST['mod_ilbc'];
- $ent['mod_speex'] = $_POST['mod_speex'];
- $ent['mod_siren'] = $_POST['mod_siren'];
- $ent['mod_celt'] = $_POST['mod_celt'];
- $ent['mod_h26x'] = $_POST['mod_h26x'];
-
- //File Format Interfaces
- $ent['mod_sndfile'] = $_POST['mod_sndfile'];
- $ent['mod_native_file'] = $_POST['mod_native_file'];
-
- //Streams / Files
- $ent['mod_shout'] = $_POST['mod_shout'];
- $ent['mod_local_stream'] = $_POST['mod_local_stream'];
- $ent['mod_tone_stream'] = $_POST['mod_tone_stream'];
-
- //Languages
- $ent['mod_spidermonkey'] = $_POST['mod_spidermonkey'];
- $ent['mod_spidermonkey_core_db'] = $_POST['mod_spidermonkey_core_db'];
- $ent['mod_spidermonkey_curl'] = $_POST['mod_spidermonkey_curl'];
- $ent['mod_spidermonkey_odbc'] = $_POST['mod_spidermonkey_odbc'];
- $ent['mod_spidermonkey_socket'] = $_POST['mod_spidermonkey_socket'];
- $ent['mod_spidermonkey_teletone'] = $_POST['mod_spidermonkey_teletone'];
- $ent['mod_perl'] = $_POST['mod_perl'];
- $ent['mod_python'] = $_POST['mod_python'];
- $ent['mod_java'] = $_POST['mod_java'];
- $ent['mod_lua'] = $_POST['mod_lua'];
-
- //ASR / TTS
- $ent['mod_flite'] = $_POST['mod_flite'];
- $ent['mod_pocketsphinx'] = $_POST['mod_pocketsphinx'];
- $ent['mod_cepstral'] = $_POST['mod_cepstral'];
- $ent['mod_openmrcp'] = $_POST['mod_openmrcp'];
- $ent['mod_rss'] = $_POST['mod_rss'];
-
- //Say
- $ent['mod_say_de'] = $_POST['mod_say_de'];
- $ent['mod_say_en'] = $_POST['mod_say_en'];
- $ent['mod_say_es'] = $_POST['mod_say_es'];
- $ent['mod_say_fr'] = $_POST['mod_say_fr'];
- $ent['mod_say_it'] = $_POST['mod_say_it'];
- $ent['mod_say_nl'] = $_POST['mod_say_nl'];
- $ent['mod_say_ru'] = $_POST['mod_say_ru'];
- $ent['mod_say_zh'] = $_POST['mod_say_zh'];
-
- if (isset($id) && $a_modules[$id]) {
- //update
- $a_modules[$id] = $ent;
- }
- else {
- //add
- $a_modules[] = $ent;
- }
-
- write_config();
- sync_package_v_modules();
-
- //header("Location: v_zzz.php");
- //exit;
- }
-}
-
-include("head.inc");
-
-?>
-
-<script type="text/javascript" language="JavaScript">
-
-function show_advanced_config() {
- document.getElementById("showadvancedbox").innerHTML='';
- aodiv = document.getElementById('showadvanced');
- aodiv.style.display = "block";
-}
-
-</script>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php
-include("fbegin.inc");
-if ($v_label_show) {
- echo "<p class=\"pgtitle\">$v_label: Modules</p>\n";
-}
-?>
-<?php if ($input_errors) print_input_errors($input_errors); ?>
-
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-build_menu();
-
-?>
-</td></tr>
-</table>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
- <!--
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Modules<br />
- </strong></span>
- <?php
- if ($v_path_show) {
- echo $v_mod_dir."\n";
- }
- ?>
- </p></td>
- </tr>
- </table>
- -->
- <br />
-
- <form action="v_modules.php" method="post" name="iform" id="iform">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
-
-<?php
- echo " <tr><td>&nbsp;</td></tr><tr><td class='listtopic' colspan='2'>Loggers</td></tr>\n";
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>console</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_console' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_console'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Send logs to the console. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>logfile</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_logfile' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_logfile'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Send logs to the local file system. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>syslog</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_syslog' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_syslog'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Send logs to a remote syslog server. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
- echo " <tr><td>&nbsp;</td></tr><tr><td class='listtopic' colspan='2'>Multi-Faceted</td></tr>\n";
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>enum</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_enum' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_enum'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Route PSTN numbers over internet according to ENUM servers, such as e164.org. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
- echo " <tr><td>&nbsp;</td></tr><tr><td class='listtopic' colspan='2'>XML Interfaces</td></tr>\n";
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>xml rpc</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_xml_rpc' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_xml_rpc'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "XML Remote Procedure Calls. Issue commands from your web application. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>xml curl</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_xml_curl' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_xml_curl'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "XML Gateway Code. Configure FreeSWITCH from a web server on boot and on the fly. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>xml cdr</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_xml_cdr' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_xml_cdr'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "XML based call detail record handler. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
- echo " <tr><td>&nbsp;</td></tr><tr><td class='listtopic' colspan='2'>Event Handlers</td></tr>\n";
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>cdr csv</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_cdr_csv' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_cdr_csv'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "CSV call detail record handler. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>event multicast</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_event_multicast' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_event_multicast'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Broadcasts events to netmask. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>event socket</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_event_socket' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_event_socket'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Sends events via a single socket. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>zeroconf</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_zeroconf' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_zeroconf'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Support for zeroconf. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
- echo " <tr><td>&nbsp;</td></tr><tr><td class='listtopic' colspan='2'>Directory Interfaces</td></tr>\n";
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>ldap</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_ldap' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_ldap'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "LDAP module made to obtain dialplans, user accounts, etc. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
- echo " <tr><td>&nbsp;</td></tr><tr><td class='listtopic' colspan='2'>Endpoints</td></tr>\n";
-
- /*
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>dingaling</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_dingaling' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_dingaling'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Jabber/GoogleTalk Talk integration module. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
- */
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>iax</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_iax' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_iax'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "IAX2. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>portaudio</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_portaudio' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_portaudio'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Voice through a local soundcard. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>alsa</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_alsa' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_alsa'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "<br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>sofia</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_sofia' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_sofia'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "SIP module. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>loopback</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_loopback' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_loopback'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "A loopback channel driver to make an outbound call as an inbound call. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
- /*
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>wanpipe</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_wanpipe' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_wanpipe'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "T1/E1 Sangoma Card module. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
- */
-
- /*
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>woomera</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_woomera' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_woomera'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "H.323/Woomera module. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
- */
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>openzap</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_openzap' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_openzap'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Interface to Zaptel hardware. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr><td>&nbsp;</td></tr><tr><td class='listtopic' colspan='2'>Applications</td></tr>\n";
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>cid lookup</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_cidlookup' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_cidlookup'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Lookup Caller ID. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>commands</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_commands' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_commands'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "A plethora of API interface commands. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>conference</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_conference' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_conference'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Conference room module. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>dptools</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_dptools' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_dptools'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Provides a number of apps and utilities for the dialplan. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>easyroute</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_easyroute' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_easyroute'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "DID routing engine that uses a database lookup to determine how to route an incoming call. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>esf</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_esf' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_esf'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Holds the multi cast paging application for SIP. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>exp</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_expr' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_expr'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Brian Allen Vanderburgs expression evaluation library. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>fax</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_fax' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_fax'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "FAX provides fax send and receive. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>fifo</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_fifo' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_fifo'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "FIFO provides custom call queues including call park. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>file string</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_file_string' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_file_string'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "<br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>fsv</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_fsv' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_fsv'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "FreeSWITCH Video application (Recording and playback). <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>lcr</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_lcr' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_lcr'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Least Cost Routing. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>limit</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_limit' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_limit'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Resource limitation module. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>soundtouch</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_soundtouch' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_soundtouch'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "modify pitch and other sound effects. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>spy</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_spy' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_spy'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "<br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>vmd</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_vmd' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_vmd'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Voicemail Beep Detection. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>voicemail</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_voicemail' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_voicemail'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Full featured voicemail module. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr><td>&nbsp;</td></tr><tr><td class='listtopic' colspan='2'>SNOM Module</td></tr>\n";
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>snom</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_snom' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_snom'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "<br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
- echo " <tr><td>&nbsp;</td></tr><tr><td class='listtopic' colspan='2'>Dialplan Interfaces</td></tr>\n";
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>dialplan directory</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_dialplan_directory' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_dialplan_directory'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Allows you to obtain a dialplan from a directory resource. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>dialplan xml</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_dialplan_xml' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_dialplan_xml'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Allows you to program dialplans in XML format. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>dialplan asterisk</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_dialplan_asterisk' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_dialplan_asterisk'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Allows you to create dialplans the old-fashioned way. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
- /*
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>yaml</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_yaml' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_yaml'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Allows you to program dialplans in YAML format. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
- */
-
- echo " <tr><td>&nbsp;</td></tr><tr><td class='listtopic' colspan='2'>Codec Interfaces</td></tr>\n";
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>voipcodecs</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_voipcodecs' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_voipcodecs'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "<br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>g723_1</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_g723_1' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_g723_1'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "G.723.1 codec. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>g729</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_g729' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_g729'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "G729 codec is only supported in passthrough mode. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>amr</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_amr' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_amr'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "amr codec. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>amrwb</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_amrwb' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_amrwb'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "amrwb codec. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>ilbc</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_ilbc' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_ilbc'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "ILBC codec. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>speex</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_speex' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_speex'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Speex codec. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>siren</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_siren' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_siren'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Siren codec.<br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>celt</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_celt' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_celt'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Celt codec. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>h26x</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_h26x' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_h26x'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "H26X signed linear codec. Video Pass-thru. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
- echo " <tr><td>&nbsp;</td></tr><tr><td class='listtopic' colspan='2'>File Format Interfaces</td></tr>\n";
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>sndfile</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_sndfile' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_sndfile'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Multi-format file format transcoder (WAV, etc). <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>native file</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_native_file' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_native_file'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "File interface for codec specific file formats. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
- echo " <tr><td>&nbsp;</td></tr><tr><td class='listtopic' colspan='2'>Streams / Files</td></tr>\n";
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>shout</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_shout' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_shout'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "mp3 files and shoutcast streams. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>local stream</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_local_stream' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_local_stream'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "For local streams (play all the files in a directory). <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>tone stream</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_tone_stream' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_tone_stream'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Generate tone streams. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
- echo " <tr><td>&nbsp;</td></tr><tr><td class='listtopic' colspan='2'>Languages</td></tr>\n";
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>spidermonkey</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_spidermonkey' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_spidermonkey'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "JavaScript support. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>spidermonkey core db</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_spidermonkey_core_db' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_spidermonkey_core_db'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "JavaScript SQLite support. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>spidermonkey curl</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_spidermonkey_curl' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_spidermonkey_curl'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "JavaScript CURL support. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>spidermonkey odbc</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_spidermonkey_odbc' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_spidermonkey_odbc'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "JavaScript ODBC support. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>spidermonkey socket</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_spidermonkey_socket' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_spidermonkey_socket'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "JavaScript SOCKET support. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>spidermonkey teletone</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_spidermonkey_teletone' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_spidermonkey_teletone'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "JavaScript Teletone support. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- /*
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>perl</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_perl' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_perl'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Perl support. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
- */
-
- /*
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>python</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_python' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_python'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Python support. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
- */
-
- /*
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>java</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_java' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_java'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Java support. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
- */
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>lua</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_lua' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_lua'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Lua support. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
- echo " <tr><td>&nbsp;</td></tr><tr><td class='listtopic' colspan='2'>ASR / TTS</td></tr>\n";
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>flite</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_flite' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_flite'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Free open source Text to Speech. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>pocketsphinx</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_pocketsphinx' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_pocketsphinx'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Free open source Speech Recognition. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
- /*
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>cepstral</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_cepstral' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_cepstral'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Links into Cepstral for dynamic sound output. Not available on this build. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
- */
-
- /*
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>openmrcp</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_openmrcp' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_openmrcp'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Module for an open MRCP implementation. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
- */
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>rss</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_rss' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_rss'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "Reads RSS feeds via a TTS engine. <br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
- echo " <tr><td>&nbsp;</td></tr><tr><td class='listtopic' colspan='2'>Say</td></tr>\n";
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>say de</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_say_de' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_say_de'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "<br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>say en</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_say_en' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_say_en'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "<br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>say es</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_say_es' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_say_es'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "<br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>say fr</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_say_fr' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_say_fr'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "<br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>say it</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_say_it' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_say_it'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "<br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>say nl</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_say_nl' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_say_nl'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "<br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>say ru</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_say_ru' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_say_ru'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "<br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-
- echo " <tr>\n";
- echo " <td width='22%' valign='top' class='vncell'>say zh</td>\n";
- echo " <td width='78%' class='vtable'>\n";
- echo " <select name='mod_say_zh' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['mod_say_zh'])) {
- case "enable":
- echo " <option value='enable' selected='yes'>enable</option>\n";
- echo " <option value='disable'>disable</option>\n";
- break;
- case "disable":
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- break;
- default:
- echo " <option value='enable'>enable</option>\n";
- echo " <option value='disable' selected='yes'>disable</option>\n";
- }
- echo " </select><br />\n";
- echo "<br />\n";
- echo " </td>\n";
- echo " </tr>\n";
-
-?>
-
- </table>
- <!--
- <div id="showadvancedbox">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="25%" valign="top" class="vncell">Show Advanced</td>
- <td width="75%" class="vtable">
- <input type="button" onClick="show_advanced_config()" value="Advanced"></input></a>
- </td>
- </tr>
- </table>
- </div>
- <div id="showadvanced" style="display:none">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="25%" valign="top" class="vncell">zzz</td>
- <td width="75%" class="vtable">
- <input name="zzz" type="text" class="formfld" id="zzz" size="40" value="<?=htmlspecialchars($pconfig['zzz']);?>">
- <br /> <span class="vexpl">zzz<br /></span>
- </td>
- </tr>
- </table>
- </div>
- -->
- <br /><br />
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="25%" valign="top">&nbsp;</td>
- <td>
- <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()">
- <?php
- $id = 0;
- if (isset($id) && $a_modules[$id]) {
- echo "<input name=\"id\" type=\"hidden\" value=\"".$id."\">\n";
- }
- ?>
- </td>
- </tr>
- </table>
- </form>
-
- <br />
- <br />
- <br />
- <br />
- <br />
- <br />
-
- </td>
- </tr>
-</table>
-
-</div>
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch_dev/v_profile_edit.tmp b/config/freeswitch_dev/v_profile_edit.tmp
deleted file mode 100644
index 8058dcab..00000000
--- a/config/freeswitch_dev/v_profile_edit.tmp
+++ /dev/null
@@ -1,149 +0,0 @@
-<?php
-/* $Id$ */
-/*
- v_profile_edit.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/v_config.inc");
-
-//$a_extensions = &$config['installedpackages']['freeswitchprofiles']['config'];
-
-$fd = fopen($v_conf_dir."/sip_profiles/".$_GET['f'], "r");
-$content = fread($fd, filesize($v_conf_dir."/sip_profiles/".$_GET['f']));
-fclose($fd);
-
-include("head.inc");
-
-?>
-
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-
-<script language="Javascript">
-function sf() { document.forms[0].savetopath.focus(); }
-</script>
-<script language="Javascript" type="text/javascript" src="/edit_area/edit_area_full.js"></script>
-<script language="Javascript" type="text/javascript">
- // initialisation
- editAreaLoader.init({
- id: "code" // id of the textarea to transform
- ,start_highlight: false
- ,allow_toggle: false
- ,language: "en"
- ,syntax: "html"
- ,toolbar: "search, go_to_line,|, fullscreen, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help"
- ,syntax_selection_allow: "css,html,js,php,xml,c,cpp,sql"
- ,show_line_colors: true
- });
-</script>
-
-<?php
-include("fbegin.inc");
-if ($v_label_show) {
- echo "<p class=\"pgtitle\">$v_label: Edit Profile</p>\n";
-}
-?>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-build_menu();
-
-?>
-</td></tr>
-</table>
-
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
-<form action="v_profiles.php" method="post" name="iform" id="iform">
-<?php
-
-?>
- <table width="98%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Edit Profile<br>
- </strong></span>
- Use this to configure your SIP profiles.
- </p>
- </td>
- <td align='right' valign='middle'>Filename: <input type="text" name="f" value="<?php echo $_GET['f']; ?>" /><input type="submit" value="save" /></td>
- </tr>
- </table>
- <br />
- <br />
-
- <textarea style="width:98%" id="code" name="code" rows="30" cols="<?php echo $cols; ?>" name="content"><?php echo htmlentities($content); ?></textarea>
- <br />
- <br />
-
- <table width="98%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td>
- <?php
- if ($v_path_show) {
- echo $v_conf_dir."/sip_profiles/".$_GET['f']."</td>";
- }
- ?>
- <td align='right'>
- <input type="hidden" name="a" value="save" />
- <?php
- echo "<input type='button' value='Restore Default' onclick=\"document.location.href='v_profiles.php?a=default&f=".$_GET['f']."';\" />";
- ?>
- </td>
- </tr>
- </table>
-
-</form>
-
-<br>
-<br>
-
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-
-</td>
-</tr>
-</table>
-
-</div>
-
-
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch_dev/v_profiles.tmp b/config/freeswitch_dev/v_profiles.tmp
deleted file mode 100644
index f3bdc873..00000000
--- a/config/freeswitch_dev/v_profiles.tmp
+++ /dev/null
@@ -1,221 +0,0 @@
-<?php
-/* $Id$ */
-/*
- v_profiles.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/v_config.inc");
-
-//$a_extensions = &$config['installedpackages']['freeswitchextensions']['config'];
-
-
-if ($_GET['a'] == "default") {
- conf_mount_rw();
- exec("cp ".$v_conf_dir.".orig/sip_profiles/".$_GET['f']." ".$v_conf_dir."/sip_profiles/".$_GET['f']);
- $savemsg = "Restore Default";
- conf_mount_ro();
-}
-
-if ($_POST['a'] == "save") {
- conf_mount_rw();
- $content = ereg_replace("\r","",$_POST['code']);
- $fd = fopen($v_conf_dir."/sip_profiles/".$_POST['f'], "w");
- fwrite($fd, $content);
- fclose($fd);
- $savemsg = "Saved";
- conf_mount_ro();
-}
-
-
-if ($_GET['a'] == "del") {
- if ($_GET['type'] == 'profile') {
- //if ($a_profiles[$_GET['id']]) {
- //unset($a_extensions[$_GET['id']]);
- //write_config();
-
- exec("rm ".$v_conf_dir."/sip_profiles/".$_GET['f']);
- header("Location: v_profiles.php");
- exit;
- //}
- }
-}
-
-include("head.inc");
-
-?>
-
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-
-
-<?php
-include("fbegin.inc");
-if ($v_label_show) {
- echo "<p class=\"pgtitle\">$v_label: Profiles</p>\n";
-}
-?>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-build_menu();
-
-?>
-</td></tr>
-</table>
-
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
-<form action="v_profiles.php" method="post" name="iform" id="iform">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Profiles<br>
- </strong></span>
- Use this to configure your SIP profiles.
- </p></td>
- </tr>
- </table>
- <br />
-
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="25%" class="listhdrr">Name</td>
- <td width="70%" class="listhdr">Description</td>
- <td width="5%" class="list">
- </td>
- </tr>
-
-
- <?php
-
- foreach (ListFiles($v_conf_dir.'/sip_profiles') as $key=>$file){
- ?>
- <tr>
- <td class="listr" ondblclick="document.location='v_profile_edit.php?f=<?=$file;?>';" valign="middle">
- <?=$file;?>&nbsp;
- </td>
- <td class="listbg" ondblclick="document.location='v_profile_edit.php?f=<?=$file;?>';">
- <?php
-
- switch ($file) {
- case "internal.xml":
- echo "<font color='#FFFFFF'>";
- echo "The Internal profile by default requires registration which is most often used for extensions. ";
- echo "By default the Internal profile binds to the WAN IP which is accessible to the internal network. ";
- echo "A rule can be set from PFSense -> Firewall -> Rules -> WAN to the the WAN IP for port 5060 which ";
- echo "enables phones register from outside the network.";
- echo "";
- echo "</font>";
- echo "&nbsp;";
- break;
- case "internal-ipv6.xml":
- echo "<font color='#FFFFFF'>The Internal IPV6 profile binds to the IP version 6 address and is similar to the Internal profile.</font>&nbsp;";
- break;
- case "external.xml":
- echo "<font color='#FFFFFF'>";
- echo "The External profile handles outbound registrations to a SIP provider or other SIP Server. The SIP provider sends calls to you, and you ";
- echo "send calls to your provider, through the external profile. The external profile allows anonymous calling, which is ";
- echo "required as your provider will never authenticate with you to send you a call. Calls can be sent using a SIP URL \"my.domain.com:5080\" ";
- echo "</font>&nbsp;";
- break;
- case "lan.xml":
- echo "<font color='#FFFFFF'>The LAN profile is the same as the Internal profile except that it is bound to the LAN IP.</font>&nbsp;";
- break;
- default:
- echo "<font color='#FFFFFF'>default</font>&nbsp;";
- }
- ?>
- </td>
- <td valign="middle" nowrap class="list" valign="top">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="v_profile_edit.php?type=profile&f=<?=$file;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="v_profiles.php?type=profile&a=del&f=<?=$file;?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
- $i++;
- }
-
- ?>
-
- <tr>
- <td class="list" colspan="4"></td>
- <td class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"></td>
- </tr>
- </table>
- </td>
- </tr>
-
-
- <tr>
- <td class="list" colspan="4"></td>
- <td class="list"></td>
- </tr>
- </table>
-
-</form>
-
-<br>
-<br>
-<?php
-if ($v_path_show) {
- echo $v_conf_dir."/sip_profiles\n";
-}
-?>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-
-</td>
-</tr>
-</table>
-
-</div>
-
-
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch_dev/v_public.tmp b/config/freeswitch_dev/v_public.tmp
deleted file mode 100644
index 3399f974..00000000
--- a/config/freeswitch_dev/v_public.tmp
+++ /dev/null
@@ -1,170 +0,0 @@
-<?php
-/* $Id$ */
-/*
- v_public.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/v_config.inc");
-
-//$a_extensions = $config['installedpackages']['freeswitchprofiles']['config'];
-
-if ($_GET['a'] == "default") {
- conf_mount_rw();
- exec("cp ".$v_conf_dir.".orig/dialplan/public.xml ".$v_conf_dir."/dialplan/public.xml");
- $savemsg = "Default Restored";
- conf_mount_ro();
-}
-
-if ($_POST['a'] == "save") {
- conf_mount_rw();
- $content = ereg_replace("\r","",$_POST['code']);
- $fd = fopen($v_conf_dir."/dialplan/public.xml", "w");
- fwrite($fd, $content);
- fclose($fd);
- $savemsg = "Saved";
- conf_mount_ro();
-}
-
-
-$fd = fopen($v_conf_dir."/dialplan/public.xml", "r");
-$content = fread($fd, filesize($v_conf_dir."/dialplan/public.xml"));
-fclose($fd);
-
-include("head.inc");
-
-?>
-
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-
-<script language="Javascript">
-function sf() { document.forms[0].savetopath.focus(); }
-</script>
-<script language="Javascript" type="text/javascript" src="/edit_area/edit_area_full.js"></script>
-<script language="Javascript" type="text/javascript">
- // initialisation
- editAreaLoader.init({
- id: "code" // id of the textarea to transform
- ,start_highlight: false
- ,allow_toggle: false
- ,language: "en"
- ,syntax: "html"
- ,toolbar: "search, go_to_line,|, fullscreen, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help"
- ,syntax_selection_allow: "css,html,js,php,xml,c,cpp,sql"
- ,show_line_colors: true
- });
-</script>
-
-
-<?php
-include("fbegin.inc");
-if ($v_label_show) {
- echo "<p class=\"pgtitle\">$v_label: Public</p>\n";
-}
-?>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-build_menu();
-
-?>
-</td></tr>
-</table>
-
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
-<form action="v_public.php" method="post" name="iform" id="iform">
-<?php
-
-?>
- <table width="98%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width='90%'><p><span class="vexpl"><span class="red"><strong>Public<br>
- </strong></span>
- Directs inbound calls to extensions, auto attendants, hunt groups, external numbers, voicemail, and scripts.
- </p>
- </td>
- <td width='10%' align='right' valign='middle'><input type="submit" value="save" /></td>
- </tr>
- </table>
- <br />
- <br />
-
- <textarea style="width:98%" id="code" name="code" rows="30" cols="<?php echo $cols; ?>" name="content"><?php echo htmlentities($content); ?></textarea>
- <br />
- <br />
-
- <table width="98%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td>
- <?php
- if ($v_path_show) {
- echo $v_conf_dir."/dialplan/public.xml</td>";
- }
- ?>
- </td>
- <td align='right'>
- <input type="hidden" name="f" value="<?php echo $_GET['f']; ?>" />
- <input type="hidden" name="a" value="save" />
- <?php
- echo "<input type='button' value='Restore Default' onclick=\"document.location.href='v_public.php?a=default&f=public.xml';\" />";
- ?>
- </td>
- </tr>
- </table>
-
-</form>
-
-<br>
-<br>
-
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-
-</td>
-</tr>
-</table>
-
-</div>
-
-
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch_dev/v_public_includes.tmp b/config/freeswitch_dev/v_public_includes.tmp
deleted file mode 100644
index 8498329c..00000000
--- a/config/freeswitch_dev/v_public_includes.tmp
+++ /dev/null
@@ -1,289 +0,0 @@
-<?php
-/* $Id$ */
-/*
- v_public_includes.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/v_config.inc");
-
-
-//v_public_includes
- //publicincludeid
- //extensionname
- //context
- //default
- //enabled
- //descr
-
-//v_public_include_details
-
- //publicincludeid
- //tag
- //condition
- //action
- //antiaction
- //param
- //tagorder
- //1-20
- //fieldtype
-
- //fielddata
-
-
-$a_public_includes = &$config['installedpackages']['freeswitchpublicincludes']['config'];
-$a_public_includes_details = &$config['installedpackages']['freeswitchpublicincludedetails']['config'];
-
-
-if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'publicincludes') {
-
- if ($a_public_includes[$_GET['id']]) {
-
- $publicincludeid = $a_public_includes[$_GET['id']][publicincludeid];
-
- $extensionname = $a_public_includes[$_GET['id']][extensionname];
- $order = $a_public_includes[$_GET['id']][order];
- $publicincludefilename = $order."_".$extensionname.".xml";
-
- //delete the public include details. aka. child data
- if (count($a_public_includes_details) > 0) {
- $i=0;
- if (count($a_public_includes_details) > 0) {
- foreach($a_public_includes_details as $row) {
- if ($row["publicincludeid"] == $publicincludeid) {
- //echo "child id: ".$i."<br />\n";
- unset($a_public_includes_details[$i]);
- }
- $i++;
- }
- }
- }
-
- //if the public include xml file exists then delete it
- if (file_exists($v_conf_dir."/dialplan/public/".$publicincludefilename)) {
- unlink($v_conf_dir."/dialplan/public/".$publicincludefilename);
- }
-
- unset($publicincludefilename);
- unset($a_public_includes[$_GET['id']]);
- write_config();
- sync_package_v_public_includes();
- header("Location: v_public_includes.php");
- exit;
- }
- }
-}
-
-include("head.inc");
-
-?>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-
-<?php
-include("fbegin.inc");
-if ($v_label_show) {
- echo "<p class=\"pgtitle\">$v_label: Public</p>\n";
-}
-?>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-build_menu();
-
-?>
-</td></tr>
-</table>
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
-<form action="v_public_includes.php" method="post" name="iform" id="iform">
-<?php
-
-
-//echo "<pre>";
-//print_r ($a_public_includes);
-//echo "</pre>";
-
-
-//if ($config_change == 1) {
-// write_config();
-// $config_change = 0;
-//}
-
-//if ($savemsg) print_info_box($savemsg);
-//if (file_exists($d_hostsdirty_path)): echo"<p>";
-//print_info_box_np("The recordings have been changed.<br>You must apply the changes in order for them to take effect.");
-//echo"<br />";
-//endif;
-
-?>
-
- <br />
- <br />
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td><span class="vexpl"><span class="red"><strong>Public
- </strong></span></span>
- </td>
- <td align='right'>
- <?php
- echo "<input type='button' value='public.xml' alt='' onclick=\"document.location.href='".$v_relative_url."/v_public.php';\">\n";
- ?>
- </td>
- </tr>
- <tr>
- <td colspan='2'>
- <span class="vexpl">
- The public dialplan is used to route incoming calls to destinations based on conditions and context. It can send incoming calls to IVRs, extensions, external numbers, and scripts.
- </span>
- </td>
-
- </tr>
- </table>
-
- <br />
- <br />
- <br />
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="20%" class="listhdrr">Extension Name</td>
- <td width="25%" class="listhdrr">Order</td>
- <td width="25%" class="listhdrr">Enabled</td>
- <td width="50%" class="listhdr">Description</td>
- <td width="10%" class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="v_public_includes_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
-
- <?php
- //create a temporary id for the array
- $i = 0;
- if (count($a_public_includes) > 0) {
- foreach ($a_public_includes as $ent) {
- $a_public_includes[$i]['id'] = $i;
- $i++;
- }
- }
-
- //order the array
- function cmp_number($a, $b) {
- if ($a["order"] > $b["order"]) {
- return 1;
- }
- else {
- return 0;
- }
- }
- if (count($a_public_includes) > 0) { usort($a_public_includes, "cmp_number"); }
-
- $i = 0;
- if (count($a_public_includes) > 0) {
- foreach ($a_public_includes as $ent) {
- if (strlen($ent['extensionname'].$ent['enabled']) > 0) {
- ?>
- <tr>
- <td class="listlr" ondblclick="document.location='v_public_includes_edit.php?id=<?=$ent['id'];?>'">
- <?=$ent['extensionname']?>
- </td>
- <td class="listlr" ondblclick="document.location='v_public_includes_edit.php?id=<?=$ent['id'];?>'">
- <?=$ent['order']?>
- </td>
- <td class="listr" ondblclick="document.location='v_public_includes_edit.php?id=<?=$ent['id'];?>';">
- <?=$ent['enabled'];?>&nbsp;
- </td>
- <td class="listbg" ondblclick="document.location='v_public_includes_edit.php?id=<?=$ent['id'];?>';">
- <font color="#FFFFFF"><?=htmlspecialchars($ent['descr']);?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="v_public_includes_edit.php?id=<?=$ent['id'];?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="v_public_includes.php?type=publicincludes&act=del&id=<?=$ent['id'];?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
- } //end if strlen
- $i++;
- } //end for each
- } //end if count
- ?>
- <tr>
- <td class="list" colspan="4"></td>
- <td class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="v_public_includes_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
-
- <tr>
- <td class="list" colspan="4"></td>
- <td class="list"></td>
- </tr>
- </table>
-
-</form>
-<?php
-if ($v_path_show) {
- echo $v_conf_dir."/dialplan/public/";
-}
-?>
-<br />
-<br />
-<br />
-<br />
-<br />
-<br />
-
-</td>
-</tr>
-</table>
-
-</div>
-
-
-<?php include("fend.inc"); ?>
-</body>
-</html> \ No newline at end of file
diff --git a/config/freeswitch_dev/v_public_includes_details.tmp b/config/freeswitch_dev/v_public_includes_details.tmp
deleted file mode 100755
index 680832e6..00000000
--- a/config/freeswitch_dev/v_public_includes_details.tmp
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-/* $Id$ */
-/*
- v_public_includes_details.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/v_config.inc");
-
-
-$a_public_include_details = &$config['installedpackages']['freeswitchpublicincludedetails']['config'];
-
-
-if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'publicincludedetails') {
- if ($a_public_include_details[$_GET['id']]) {
- unset($a_public_include_details[$_GET['id']]);
- write_config();
- sync_package_v_public_includes();
- //touch($d_hostsdirty_path);
- header("Location: v_public_includes_edit.php?id=".$_GET['parentid']);
- exit;
- }
- }
-}
-
-?> \ No newline at end of file
diff --git a/config/freeswitch_dev/v_public_includes_details_edit.tmp b/config/freeswitch_dev/v_public_includes_details_edit.tmp
deleted file mode 100644
index af5d723f..00000000
--- a/config/freeswitch_dev/v_public_includes_details_edit.tmp
+++ /dev/null
@@ -1,454 +0,0 @@
-<?php
-/* $Id$ */
-/*
- v_public_includes_details_edit.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/v_config.inc");
-
-
-$a_public_includes_details = &$config['installedpackages']['freeswitchpublicincludedetails']['config'];
-
-$id = $_GET['id'];
-if (isset($_POST['id'])) {
- $id = $_POST['id'];
-}
-
-$parentid = $_GET['parentid'];
-if (isset($_POST['parentid'])) {
- $parentid = $_POST['parentid'];
-}
-
-$publicincludeid = $_GET['publicincludeid'];
-if (isset($_POST['publicincludeid'])) {
- $publicincludeid = $_POST['publicincludeid'];
-}
-
-
- //publicincludeid
- //tag
- //condition
- //action
- //antiaction
- //param
- //fieldtype
- //fielddata
- //fieldorder
- //000-999
-
-if (isset($id) && $a_public_includes_details[$id]) {
- $pconfig['publicincludeid'] = $a_public_includes_details[$id]['publicincludeid'];
- $pconfig['tag'] = $a_public_includes_details[$id]['tag'];
- $pconfig['fieldtype'] = $a_public_includes_details[$id]['fieldtype'];
- $pconfig['fielddata'] = $a_public_includes_details[$id]['fielddata'];
- $pconfig['fieldorder'] = $a_public_includes_details[$id]['fieldorder'];
-}
-//else {
-// if (isset($_GET['a'])) {
-// if ($_GET['a'] == "action"){ $pconfig['optionaction'] = "action"; }
-// if ($_GET['a'] == "antiaction"){ $pconfig['optionaction'] = "anti-action"; }
-// }
-//}
-
-
-
-if ($_POST) {
-
- unset($input_errors);
- $pconfig = $_POST;
-
- if (!$input_errors) {
-
- $ent = array();
- $ent['publicincludeid'] = $_POST['publicincludeid'];
- $ent['tag'] = $_POST['tag'];
- $ent['fieldtype'] = $_POST['fieldtype'];
- $ent['fielddata'] = $_POST['fielddata'];
- $ent['fieldorder'] = $_POST['fieldorder'];
-
- if (isset($id) && $a_public_includes_details[$id]) {
- //update
- $a_public_includes_details[$id] = $ent;
- }
- else {
- //add
- $a_public_includes_details[] = $ent;
- }
-
- //touch($d_hostsdirty_path);
- write_config();
- sync_package_v_public_includes();
-
- header("Location: v_public_includes_edit.php?id=".$parentid);
- exit;
- }
-}
-
-include("head.inc");
-
-?>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-
-
-<?php
-include("fbegin.inc");
-if ($v_label_show) {
- echo "<p class=\"pgtitle\">$v_label: Public: Details: Edit</p>\n";
-}
-
-if ($input_errors) { print_input_errors($input_errors); }
-
-?>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-build_menu();
-
-?>
-</td></tr>
-</table>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
- <br />
- <form action="v_public_includes_details_edit.php" method="post" name="iform" id="iform">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="22%" valign="top" class="vncellreq">Tag</td>
- <td width="78%" class="vtable">
- <script type="text/javascript">
- function public_include_details_tag_onchange() {
- var tag = document.getElementById("form_tag").value;
- if (tag == "condition") {
- document.getElementById("label_fieldtype").innerHTML = "Field";
- document.getElementById("label_fielddata").innerHTML = "Expression";
- }
- else if (tag == "action") {
- document.getElementById("label_fieldtype").innerHTML = "Application";
- document.getElementById("label_fielddata").innerHTML = "Data";
- }
- else if (tag == "anti-action") {
- document.getElementById("label_fieldtype").innerHTML = "Application";
- document.getElementById("label_fielddata").innerHTML = "Data";
- }
- else if (tag == "param") {
- document.getElementById("label_fieldtype").innerHTML = "Name";
- document.getElementById("label_fielddata").innerHTML = "Value";
- }
- if (tag == "") {
- document.getElementById("label_fieldtype").innerHTML = "Type";
- document.getElementById("label_fielddata").innerHTML = "Data";
- }
- }
- </script>
- <?php
- echo " <select name='tag' class='formfld' id='form_tag' onchange='public_include_details_tag_onchange();'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['tag'])) {
- case "condition":
- echo " <option selected='yes'>condition</option>\n";
- echo " <option>action</option>\n";
- echo " <option>anti-action</option>\n";
- //echo " <option>param</option>\n";
- break;
- case "action":
- echo " <option>condition</option>\n";
- echo " <option selected='yes'>action</option>\n";
- echo " <option>anti-action</option>\n";
- //echo " <option>param</option>\n";
- break;
- case "anti-action":
- echo " <option>condition</option>\n";
- echo " <option>action</option>\n";
- echo " <option selected='yes'>anti-action</option>\n";
- //echo " <option>param</option>\n";
- break;
- case "param":
- echo " <option>condition</option>\n";
- echo " <option>action</option>\n";
- echo " <option>anti-action</option>\n";
- //echo " <option selected='yes'>param</option>\n";
- break;
- default:
- echo " <option>condition</option>\n";
- echo " <option>action</option>\n";
- echo " <option>anti-action</option>\n";
- //echo " <option>param</option>\n";
- }
- echo " </select>\n";
-
- //condition
- //field expression
- //action
- //application
- //data
- //antiaction
- //application
- //data
- //param
- //name
- //value
-
- ?>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq" id="label_fieldtype">Type</td>
- <td width="78%" class="vtable">
- <input name="fieldtype" type="text" class="formfld" id="fieldtype" size="40" value="<?=htmlspecialchars($pconfig['fieldtype']);?>">
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq" id="label_fielddata">Data</td>
- <td width="78%" class="vtable">
- <input name="fielddata" type="text" class="formfld" id="fielddata" size="40" value="<?=htmlspecialchars($pconfig['fielddata']);?>">
- <br> <span class="vexpl"></span></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq" id="label_fieldtype">Order</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='fieldorder' class='formfld'>\n";
- //echo " <option></option>\n";
- if (strlen(htmlspecialchars($pconfig['fieldorder']))> 0) {
- echo " <option selected='yes' value='".htmlspecialchars($pconfig['fieldorder'])."'>".htmlspecialchars($pconfig['fieldorder'])."</option>\n";
- }
- $i=0;
- while($i<=999) {
- if (strlen($i) == 1) {
- echo " <option value='00$i'>00$i</option>\n";
- }
- if (strlen($i) == 2) {
- echo " <option value='0$i'>0$i</option>\n";
- }
- if (strlen($i) == 3) {
- echo " <option value='$i'>$i</option>\n";
- }
-
- $i++;
- }
- echo " </select>\n";
- ?>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="publicincludeid" type="hidden" value="<?=$publicincludeid;?>">
- <input name="parentid" type="hidden" value="<?=$parentid;?>">
- <?php if (isset($id) && $a_public_includes_details[$id]): ?>
- <input name="id" type="hidden" value="<?=$id;?>">
- <?php endif; ?>
- <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()">
- </td>
- </tr>
- </table>
- </form>
-
-
- <br />
- <br />
- <b>Example</b>
- <br />
- <br />
- If the inbound call matches the DID 12085551234 then proceed to the action.
- <br />
- <br />
- <table cellpadding='3'>
- <tr><th class="vncellreq" width='75' align="left">Tag:</th><td class="vtable">condition</td></tr>
- <tr><th class="vncellreq" align="left">Type:</th><td class="vtable">destination_number</td></tr>
- <tr><th class="vncellreq" align="left">Data:</th><td class="vtable">^(12085551234)$</td></tr>
- </table>
-
- <br />
- <br />
-
- Transfer the inbound call to an auto attendant with extension of 5000.
- <br />
- <br />
- <table cellpadding='3'>
- <tr><th class="vncellreq" width='75' align="left">Tag:</th><td class="vtable">action</td></tr>
- <tr><th class="vncellreq" align="left">Application:</th><td class="vtable">transfer</td></tr>
- <tr><th class="vncellreq" align="left">Data:</th><td class="vtable">5000 XML default</td></tr>
- </table>
-
- <br />
- <br />
-
- Or transfer the inbound call to extension 1001.
- <br />
- <br />
- <table cellpadding='3'>
- <tr><th class="vncellreq" width='75' align="left">Tag:</th><td class="vtable">action</td></tr>
- <tr><th class="vncellreq" align="left">Application:</th><td class="vtable">transfer</td></tr>
- <tr><th class="vncellreq" align="left">Data:</th><td class="vtable">1001 XML default</td></tr>
- </table>
-
- <br />
- <br />
-
- Or bridge the inbound call a SIP URI.
- <br />
- <br />
- <table cellpadding='3'>
- <tr><th class="vncellreq" width='75' align="left">Tag:</th><td class="vtable">action</td></tr>
- <tr><th class="vncellreq" align="left">Application:</th><td class="vtable">bridge</td></tr>
- <tr><th class="vncellreq" align="left">Data:</th><td class="vtable">sofia/internal/*98@${domain}</td></tr>
- </table>
-
- <br />
- <br />
- <br />
-
- <br />
- <b>SIP URI examples:</b>
- <br />
- <br />
- voicemail: sofia/internal/*98@${domain}<br />
- external number: sofia/gateway/gatewayname/12081231234<br />
- auto attendant: sofia/internal/5002@${domain}<br />
- user: /user/1001@${domain}<br />
- <br />
- <br />
- <br />
-
- <b>Conditions</b>
- <br />
- <br />
- Conditions are pattern matching tags that help FreeSwitch decide if the current call should be processed in this extension or not. When matching conditions against the current call you have several <b>fields</b> that you can compare against.
- <ul>
- <li><b>context</b></li>
- <li><b>rdnis</b> Redirected Number, the directory number to which the call was last presented.</li>
- <li><b>destination_number</b> Called Number, the number this call is trying to reach (within a given context)</li>
- <li><b>public</b> Name of the public module that are used, the name is provided by each public module. Example: XML</li>
- <li><b>caller_id_name</b> Name of the caller (provided by the User Agent that has called us).</li>
- <li><b>caller_id_number</b> Directory Number of the party who called (callee) -- can be masked (hidden)</li>
- <li><b>ani</b> Automatic Number Identification, the number of the calling party (callee) -- cannot be masked</li>
- <li><b>ani2</b> The type of device placing the call [1]</li>
- <li><b>uuid</b> Unique identifier of the current call? (looks like a GUID)</li>
- <li><b>source</b> Name of the FreeSwitch module that received the call (e.g. PortAudio)</li>
- <li><b>chan_name</b> Name of the current channel (Example: PortAudio/1234). Give us examples when this one can be used.</li>
- <li><b>network_addr</b> IP address of the signalling source for a VoIP call.</li>
- </ul>
- In addition to the above you can also do variables using the syntax ${variable} or api functions using the syntax %{api} {args}
- <br />
- <br />
- Variables may be used in either the field or the expression, as follows
-
- <br />
- <br />
- <br />
- <br />
-
- <b>Action and Anti-Actions</b>
- <br />
- <br />
- Actions are executed when the <b>condition matches</b>. Anti-Actions are executed when the <b>condition does NOT match</b>.
- <?php
- if ($v_path_show) {
- echo "Additional information on applications for Actions and Anti-Actions.<br />\n";
- echo "<a href='http://wiki.freeswitch.org/wiki/Modules#Applications' target='_blank'>http://wiki.freeswitch.org/wiki/Modules#Applications</a>\n";
- echo "<br />\n";
- echo "<a href='http://wiki.freeswitch.org/wiki/public_Functions' target='_blank'>http://wiki.freeswitch.org/wiki/public_Functions</a>\n";
- }
- ?>
-
-
- <br />
- <br />
- <br />
- The following is a partial list of <b>applications</b>.
- <ul>
- <li><b>answer</b> answer the call</li>
- <li><b>bridge</b> bridge the call<li>
- <li><b>cond</b></li>
- <li><b>db</b> is a a runtime database either sqlite by default or odbc</li>
- <li><b>global_set</b> allows setting of global vars similar to the ones found in vars.xml</li>
- <li><b>group</b> allows grouping of several extensions for things like ring groups</li>
- <li><b>expr</b></li>
- <li><b>hangup</b> hangs up the call</li>
- <li><b>info</b> sends call info to the console</li>
- <li><b>javascript</b> run javascript .js files</li>
- <li><b>playback</b></li>
- <li><b>reject</b> reject the call</li>
- <li><b>respond</b></li>
- <li><b>ring_ready</b></li>
- <li><b>set</b> set a variable</li>
- <li><b>set_user</b></li>
- <li><b>sleep</b></li>
- <li><b>sofia_contact</b></li>
- <li><b>transfer</b> transfer the call to another extension or number<li>
- <li><b>voicemail</b> send the call to voicemail</li>
- </ul>
-
-
- <br />
- <br />
-
- <!--
- <b>Param</b>
- Example parameters by name and value<br />
-
- <?php
- if ($v_path_show) {
- echo "<a href='http://wiki.freeswitch.org/wiki/Special:Search?search=param&go=Go' target='_blank'>http://wiki.freeswitch.org/wiki/Special:Search?search=param&go=Go</a>\n";
- }
- ?>
- <ul>
- <li><b>codec-ms</b> 20</li>
- <li><b>codec-prefs</b> PCMU@20i</li>
- <li><b>debug</b> 1</li>
- <li><b>public</b> XML</li>
- <li><b>dtmf-duration</b> 100</li>
- <li><b>rfc2833-pt</b>" 101</li>
- <li><b>sip-port</b> 5060</li>
- <li><b>use-rtp-timer</b> true</li>
- </ul>
- <br />
- <br />
- -->
-
-
- <br />
- <br />
- <br />
- <br />
- <br />
-
- </td>
- </tr>
-</table>
-
-</div>
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch_dev/v_public_includes_edit.tmp b/config/freeswitch_dev/v_public_includes_edit.tmp
deleted file mode 100644
index cf6bc88a..00000000
--- a/config/freeswitch_dev/v_public_includes_edit.tmp
+++ /dev/null
@@ -1,546 +0,0 @@
-<?php
-/* $Id$ */
-/*
- v_public_includes_edit.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/v_config.inc");
-
-
-
-//freeswitchpublicincludes
- //publicincludeid
- //extensionname
- //context
- //default
- //enabled
- //descr
-
-//
-
-
-
-$a_public_includes = &$config['installedpackages']['freeswitchpublicincludes']['config'];
-$a_public_include_details = &$config['installedpackages']['freeswitchpublicincludedetails']['config'];
-
-$id = $_GET['id'];
-if (isset($_POST['id'])) {
- $id = $_POST['id'];
-}
-$parentid = $id;
-
-
-
-if (isset($id) && $a_public_includes[$id]) {
- $pconfig['publicincludeid'] = $a_public_includes[$id]['publicincludeid'];
- $publicincludeid = $a_public_includes[$id]['publicincludeid'];
- $pconfig['extensionname'] = $a_public_includes[$id]['extensionname'];
- $pconfig['order'] = $a_public_includes[$id]['order'];
- $pconfig['context'] = $a_public_includes[$id]['context'];
- $pconfig['enabled'] = $a_public_includes[$id]['enabled'];
- $pconfig['descr'] = $a_public_includes[$id]['descr'];
- $pconfig['opt1name'] = $a_public_includes[$id]['opt1name'];
- $pconfig['opt1value'] = $a_public_includes[$id]['opt1value'];
-}
-
-if ($_POST) {
-
- unset($input_errors);
- $pconfig = $_POST;
-
- if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'publicincludedetails') {
- if ($a_public_include_details[$_GET['id']]) {
- unset($a_public_include_details[$_GET['id']]);
- write_config();
- sync_package_v_public_includes();
- header("Location: v_public_include_edit.php?id=".$_GET['id']);
- exit;
- }
- }
- }
-
-
- if (!$input_errors) {
-
- $ent = array();
- if (strlen($_POST['publicincludeid']) > 0) {
- //update
- $ent['publicincludeid'] = $_POST['publicincludeid'];
- }
- else {
- //add
- $ent['publicincludeid'] = guid();
- }
- $ent['extensionname'] = $_POST['extensionname'];
- $ent['order'] = $_POST['order'];
- //$ent['context'] = $_POST['context'];
- $ent['context'] = 'default';
- $ent['enabled'] = $_POST['enabled'];
- $ent['descr'] = $_POST['descr'];
- $ent['opt1name'] = $_POST['opt1name'];
- $ent['opt1value'] = $_POST['opt1value'];
-
-
-
- if (isset($id) && $a_public_includes[$id]) {
- $a_public_includes = $config['installedpackages']['freeswitchpublicincludes']['config'];
- if (count($a_public_includes) > 0) {
- foreach($a_public_includes as $rowhelper) {
-
- //$rowhelper['publicincludeid'];
- //$rowhelper['extensionname'];
- //$rowhelper['context'];
- //$rowhelper['enabled'];
-
- $filenamechanged = false;
- if ($rowhelper['publicincludeid'] == $_POST['publicincludeid']) {
-
- if ($rowhelper['extensionname'] != $_POST['extensionname']) {
- //if the extension name has changed then remove the current public xml file
- //to prepare for the new file
- $filenamechanged = true;
- }
- if ($rowhelper['order'] != $_POST['order']) {
- //if the order has changed then remove the current public xml file
- //to prepare for the new file
- $filenamechanged = true;
- }
- if ($_POST['enabled'] == "false") {
- //if the extension name is disabled then remove the public xml file
- $filenamechanged = true;
- }
- if ($filenamechanged){
- $publicincludefilename = $rowhelper['order']."_".$rowhelper['extensionname'].".xml";
- if (file_exists($v_conf_dir."/dialplan/public/".$publicincludefilename)) {
- unlink($v_conf_dir."/dialplan/public/".$publicincludefilename);
- }
- unset($publicincludefilename);
- }
-
- }
- unset($filenamechanged);
-
- } //end foreach
- } //end if count
-
- //update the config
- $a_public_includes[$id] = $ent;
- }
- else {
- //add to the config
- $a_public_includes[] = $ent;
- }
-
-
- write_config();
- sync_package_v_public_includes();
-
- header("Location: v_public_includes.php");
- exit;
- }
-}
-
-include("head.inc");
-
-?>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php
-include("fbegin.inc");
-if ($v_label_show) {
- echo "<p class=\"pgtitle\">$v_label: Public: Edit</p>\n";
-}
-
-if ($input_errors) print_input_errors($input_errors);
-
-?>
-
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-build_menu();
-
-?>
-</td></tr>
-</table>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Public:<br>
- </strong></span>
- Public Include general settings.
- </span></p></td>
- </tr>
- </table>
- <br />
-
- <form action="v_public_includes_edit.php" method="post" name="iform" id="iform">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="22%" valign="top" class="vncellreq">Extension Name</td>
- <td width="78%" class="vtable">
- <input name="extensionname" type="text" class="formfld" id="extensionname" size="40" value="<?=htmlspecialchars($pconfig['extensionname']);?>">
- <br />
- Supported characters are 'a-z', 'A-Z', '0-9', underscore '_', and period '.'.
- </td>
- </tr>
- <!--
- <tr>
- <td width="22%" valign="top" class="vncellreq">Context</td>
- <td width="78%" class="vtable">
- <input name="context" type="text" class="formfld" id="context" size="40" value="<?=htmlspecialchars($pconfig['context']);?>">
- <br />
- e.g. default
- </td>
- </tr>
- -->
-
- <tr>
- <td width="22%" valign="top" class="vncellreq">Enabled</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='enabled' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['enabled'])) {
- case "true":
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- break;
- case "false":
- echo " <option value='true'>true</option>\n";
- echo " <option value='false' selected='yes'>false</option>\n";
-
- break;
- default:
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- }
- echo " </select>\n";
- ?>
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncellreq">Order</td>
- <td width="78%" class="vtable">
- <?php
-
- echo " <select name='order' class='formfld'>\n";
- echo " <option></option>\n";
- if (strlen(htmlspecialchars($pconfig['order']))> 0) {
- echo " <option selected='yes' value='".htmlspecialchars($pconfig['order'])."'>".htmlspecialchars($pconfig['order'])."</option>\n";
- }
- $i=0;
- while($i<=999) {
- if (strlen($i) == 1) {
- echo " <option value='00$i'>00$i</option>\n";
- }
- if (strlen($i) == 2) {
- echo " <option value='0$i'>0$i</option>\n";
- }
- if (strlen($i) == 3) {
- echo " <option value='$i'>$i</option>\n";
- }
-
- $i++;
- }
- echo " </select>\n";
- ?>
- <br />
- Processing of each public include is determined by this order.
- </td>
- </tr>
-
- <tr>
- <td width="22%" valign="top" class="vncell">Description</td>
- <td width="78%" class="vtable">
- <input name="descr" type="text" class="formfld" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>">
- <br> <span class="vexpl">You may enter a description here
- for your reference (not parsed).</span></td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="publicincludeid" type="hidden" value="<?=htmlspecialchars($pconfig['publicincludeid']);?>">
- <?php
- if (strlen($id) > 0 && $a_public_includes[$id]) {
- echo "\n";
- echo " <input name=\"id\" type=\"hidden\" value=\"$id\">\n";
- echo " <input name=\"opt1name\" type=\"hidden\" value=\"".htmlspecialchars($pconfig['opt1name'])."\">\n";
- echo " <input name=\"opt1value\" type=\"hidden\" value=\"".htmlspecialchars($pconfig['opt1value'])."\">\n";
- }
- ?>
- <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()">
- </td>
- </tr>
- </table>
- </form>
-
- <br>
- <br>
-
- <form action="v_public_includes_edit.php" method="post" name="iform2" id="iform2">
- <?php
-
- //echo "<pre>";
- //print_r ($a_public_includes);
- //echo "</pre>";
-
- //if ($savemsg) print_info_box($savemsg);
- //if (file_exists($d_hostsdirty_path)): echo"<p>";
- //print_info_box_np("The FreeSWITCH recordings have been changed.<br>You must apply the changes in order for them to take effect.");
- //echo"<br />";
- //endif;
-
- //create a temporary id for the array
- $i = 0;
- if (count($a_public_include_details) > 0) {
- foreach ($a_public_include_details as $ent) {
- $a_public_include_details[$i]['id'] = $i;
- $i++;
- }
- }
-
- //order the array
- function cmp_number_public_details($a, $b) {
- if ($a["fieldorder"] > $b["fieldorder"]) {
- return 1;
- }
- else {
- return 0;
- }
- }
- if (count($a_public_include_details) > 0) { usort($a_public_include_details, "cmp_number_public_details"); }
-
- ?>
-
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Conditions and Actions<br />
- </strong></span>
- The following conditions, actions and anti-actions are used in the public to direct call flow. Each is processed in order until you reach the action tag which tells FreeSWITCH what action to perform. You are not limited to only one condition or action tag for a given extension.
- </span></p></td>
- </tr>
- </table>
- <br />
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="40" class="listhdrr">Tag</td>
- <td width="40" class="listhdrr">Type</td>
- <td width="50%" class="listhdrr">Data</td>
- <td width="40" class="listhdrr">Order</td>
- <td width="40" class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="v_public_includes_details_edit.php?parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>&a=action"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
-
- <?php
-
- $i = 0;
- if (count($a_public_include_details) > 0) {
-
- foreach ($a_public_include_details as $ent) {
- if ($ent['tag'] == "condition" && $publicincludeid == $ent['publicincludeid']) {
- ?>
- <tr>
- <td class="listlr" ondblclick="document.location='v_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>'">
- <?=$ent['tag']?>
- </td>
- <td class="listr" ondblclick="document.location='v_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';">
- <?=$ent['fieldtype'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='v_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';">
- <?=$ent['fielddata'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='v_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';">
- <?=$ent['fieldorder'];?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="v_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="v_public_includes_details.php?type=publicincludedetails&act=del&id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
- }
- $i++;
- }
- }
-
- $i = 0;
- if (count($a_public_include_details) > 0) {
-
- foreach ($a_public_include_details as $ent) {
- if ($ent['tag'] == "action" && $publicincludeid == $ent['publicincludeid']) {
- ?>
- <tr>
- <td class="listlr" ondblclick="document.location='v_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>'">
- <?=$ent['tag']?>
- </td>
- <td class="listr" ondblclick="document.location='v_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';">
- <?=$ent['fieldtype'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='v_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';">
- <?=$ent['fielddata'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='v_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';">
- <?=$ent['fieldorder'];?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="v_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="v_public_includes_details.php?type=publicincludedetails&act=del&id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
- }
- $i++;
- }
- }
-
- $i = 0;
- if (count($a_public_include_details) > 0) {
-
- foreach ($a_public_include_details as $ent) {
- if ($ent['tag'] == "anti-action" && $publicincludeid == $ent['publicincludeid']) {
- ?>
- <tr>
- <td class="listlr" ondblclick="document.location='v_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>'">
- <?=$ent['tag']?>
- </td>
- <td class="listr" ondblclick="document.location='v_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';">
- <?=$ent['fieldtype'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='v_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';">
- <?=$ent['fielddata'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='v_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';">
- <?=$ent['fieldorder'];?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="v_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="v_public_includes_details.php?type=publicincludedetails&act=del&id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
- }
- $i++;
- }
- }
-
- $i = 0;
- if (count($a_public_include_details) > 0) {
-
- foreach ($a_public_include_details as $ent) {
- if ($ent['tag'] == "param" && $publicincludeid == $ent['publicincludeid']) {
- ?>
- <tr>
- <td class="listlr" ondblclick="document.location='v_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>'">
- <?=$ent['tag']?>
- </td>
- <td class="listr" ondblclick="document.location='v_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';">
- <?=$ent['fieldtype'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='v_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';">
- <?=$ent['fielddata'];?>&nbsp;
- </td>
- <td class="listr" ondblclick="document.location='v_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>';">
- <?=$ent['fieldorder'];?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="v_public_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="v_public_includes_details.php?type=publicincludedetails&act=del&id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
- }
- $i++;
- }
- }
- ?>
- <tr>
- <td class="list" colspan="4"></td>
- <td class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="v_public_includes_details_edit.php?parentid=<?=$parentid;?>&publicincludeid=<?=$publicincludeid;?>&a=action"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
-
-
- <tr>
- <td class="list" colspan="4"></td>
- <td class="list"></td>
- </tr>
- </table>
-
- </form>
-
-
- <br>
- <br>
-
- </td>
- </tr>
-</table>
-
-</div>
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch_dev/v_recordings.tmp b/config/freeswitch_dev/v_recordings.tmp
deleted file mode 100644
index b8b58419..00000000
--- a/config/freeswitch_dev/v_recordings.tmp
+++ /dev/null
@@ -1,508 +0,0 @@
-<?php
-/* $Id$ */
-/*
- v_recordings.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/v_config.inc");
-
-$a_recordings = &$config['installedpackages']['freeswitchrecordings']['config'];
-$dir_music_on_hold_8000 = $v_dir.'/sounds/music/8000/';
-
-if ($_GET['a'] == "download") {
-
- session_cache_limiter('public');
-
- if ($_GET['type'] = "rec") {
- if (file_exists($v_recordings_dir.'/'.$_GET['filename'])) {
- $fd = fopen($v_recordings_dir.'/'.$_GET['filename'], "rb");
- if ($_GET['t'] == "bin") {
- header("Content-Type: application/force-download");
- header("Content-Type: application/octet-stream");
- header("Content-Type: application/download");
- header("Content-Description: File Transfer");
- header('Content-Disposition: attachment; filename="'.$_GET['filename'].'"');
- }
- else {
- $file_ext = substr($_GET['filename'], -3);
- if ($file_ext == "wav") {
- header("Content-Type: audio/x-wav");
- }
- if ($file_ext == "mp3") {
- header("Content-Type: audio/mp3");
- }
- }
- header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
- header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
- header("Content-Length: " . filesize($v_recordings_dir.'/'.$_GET['filename']));
- fpassthru($fd);
- }
- }
-
- if ($_GET['type'] = "moh") {
- if (file_exists($dir_music_on_hold_8000.$_GET['filename'])) {
- $fd = fopen($dir_music_on_hold_8000.$_GET['filename'], "rb");
- if ($_GET['t'] == "bin") {
- header("Content-Type: application/force-download");
- header("Content-Type: application/octet-stream");
- header("Content-Type: application/download");
- header("Content-Description: File Transfer");
- header('Content-Disposition: attachment; filename="'.$_GET['filename'].'"');
- }
- else {
- $file_ext = substr($_GET['filename'], -3);
- if ($file_ext == "wav") {
- header("Content-Type: audio/x-wav");
- }
- if ($file_ext == "mp3") {
- header("Content-Type: audio/mp3");
- }
- }
- header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
- header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
- header("Content-Length: " . filesize($dir_music_on_hold_8000.$_GET['filename']));
- fpassthru($fd);
- }
- }
-
- exit;
-}
-else {
- //echo $v_recordings_dir.'/'.$_GET['filename'];
-}
-
-if (($_POST['submit'] == "Upload") && is_uploaded_file($_FILES['ulfile']['tmp_name'])) {
-
- if ($_POST['type'] == 'moh') {
- move_uploaded_file($_FILES['ulfile']['tmp_name'], $dir_music_on_hold_8000 . $_FILES['ulfile']['name']);
- $savemsg = "Uploaded file to $dir_music_on_hold_8000" . htmlentities($_FILES['ulfile']['name']);
- //system('chmod -R 744 $dir_music_on_hold_8000*');
- unset($_POST['txtCommand']);
- }
- if ($_POST['type'] == 'rec') {
- move_uploaded_file($_FILES['ulfile']['tmp_name'], $v_recordings_dir.'/' . $_FILES['ulfile']['name']);
- $savemsg = "Uploaded file to ".$v_recordings_dir."/". htmlentities($_FILES['ulfile']['name']);
- //system('chmod -R 744 $v_recordings_dir*');
- unset($_POST['txtCommand']);
- }
-}
-
-
-
-
-if ($_GET['act'] == "del") {
- if ($_GET['type'] == 'rec') {
- if ($_GET['id']) {
- unlink_if_exists($v_recordings_dir."/".$_GET['filename']);
- unset($a_recordings[$_GET['id']]);
- write_config();
- header("Location: v_recordings.php");
- exit;
- }
- }
-
- if ($_GET['type'] == 'moh') {
- unlink_if_exists($dir_music_on_hold_8000.$_GET['filename']);
- header("Location: v_recordings.php");
- exit;
- }
-
-}
-
-
-
-include("head.inc");
-
-?>
-
-<script>
-function EvalSound(soundobj) {
- var thissound= eval("document."+soundobj);
- thissound.Play();
-}
-</script>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php
-include("fbegin.inc");
-if ($v_label_show) {
- echo "<p class=\"pgtitle\">$v_label: Recordings</p>\n";
-}
-?>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-build_menu();
-
-?>
-</td></tr>
-</table>
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
-<?php
-
-
-//build a list of recordings from the config.xml
-$config_recording_list = '';
-$i = 0;
-if (count($a_recordings) > 0) {
- foreach ($a_recordings as $recordingent) {
- $config_recording_list .= $recordingent['filename']."|";
- $i++;
- }
-}
-
-
-
-$config_change = 0;
-if (is_dir($v_recordings_dir.'/')) {
- if ($dh = opendir($v_recordings_dir.'/')) {
- while (($file = readdir($dh)) !== false) {
- if (filetype($v_recordings_dir.'/' . $file) == "file") {
-
- if (strpos($config_recording_list, $file) === false) {
-
- //$handle = fopen($v_recordings_dir.'/'.$file,'rb');
- //$file_content = fread($handle,filesize($v_recordings_dir.'/'.$file));
- //fclose($handle);
-
- $a_file = split("\.", $file);
-
- $recordingent = array();
- $recordingent['filename'] = $file;
- $recordingent['recordingname'] = $a_file[0];
- $recordingent['recordingid'] = guid();
- //$recordingent['filecontent'] = base64_encode($file_content);
- $recordingent['descr'] = 'Auto';
-
- $a_recordings[] = $recordingent;
- write_config();
-
- unset($file_content);
-
- }
- else {
- //echo "The file was found.<br/>";
- }
-
- }
- }
- closedir($dh);
- }
-}
-
-
-
-//saved for future use if and when config.xml scales well
- //enough to save the files inside it
-//$i = 0;
-//if (count($a_recordings) > 0) {
-// foreach ($a_recordings as $recordingent) {
-
-// if (!is_file($v_recordings_dir.'/'.$recordingent['filename'])) {
- //echo "not found: ".$recordingent['filename']."<br />";
-
- //recording not found restore the file from the config.xml
- //$file_content = $recordingent['filecontent'];
- //$handle = fopen($v_recordings_dir.'/'.$recordingent['filename'],'w');
- //fwrite ($handle, base64_decode($file_content));
- //unset($file_content);
- //fclose($handle);
- //$recordingent['filecontent'] = base64_encode($file_content);
-
- // loop through recordings in the config.xml
- // if the file does not exist remove it from the file system.
- //unset($a_recordings[$i]);
-
-// $config_change = 1;
-// }
-// else {
- //echo "found: ".$recordingent['filename']."<br />";
-// }
-
-// $i++;
-// }
-//}
-
-if ($config_change == 1) {
- write_config();
- $config_change = 0;
-}
-
-//if ($savemsg) print_info_box($savemsg);
-//if (file_exists($d_hostsdirty_path)): echo"<p>";
-//print_info_box_np("The FreeSWITCH recordings have been changed.<br>You must apply the changes in order for them to take effect.");
-//echo"<br />";
-//endif;
-
-?>
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Recordings:<br>
- </strong></span>
- To make a recording dial *732673 (record) or you can make a
- 16bit 8khz/16khz Mono WAV file then copy it to the
- following directory then refresh the page to play it back.
- Click on the 'Filename' to download it or the 'Recording Name' to
- play the audio.
- </span></p></td>
- </tr>
- </table>
-
- <br />
-
- <div id="niftyOutter">
- <form action="" method="POST" enctype="multipart/form-data" name="frmUpload" onSubmit="">
- <table border='0'>
- <tr>
- <td width='50%'>
- <?php
- if ($v_path_show) {
- echo "<b>location:</b>";
- echo $v_recordings_dir.'/';
- }
- ?>
- </td>
- <td valign="top" class="label">
- <input name="type" type="hidden" value="rec">
- </td>
- <td align="right">File to upload:</td>
- <td valign="top" class="label">
- <input name="ulfile" type="file" class="button" id="ulfile">
- <input name="submit" type="submit" class="button" id="upload" value="Upload">
- </td>
- </tr>
- </table>
- </div>
- </form>
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="30%" class="listhdrr">Filename (download)</td>
- <td width="30%" class="listhdrr">Recording Name (play)</td>
- <td width="30%" class="listhdr">Description</td>
- <td width="10%" class="list">
- <!--
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="v_recordings_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- -->
- </td>
- </tr>
-
- <?php
- $i = 0;
- if (count($a_recordings) > 0) {
- foreach ($a_recordings as $recordingent) {
- if (strlen($recordingent['filename']) > 0) {
- ?>
- <tr>
- <td class="listlr" ondblclick="document.location='v_recordings_edit.php?id=<?=$i;?>'">
- <a href="v_recordings.php?a=download&type=rec&t=bin&filename=<?=$recordingent['filename'];?>">
- <?=$recordingent['filename']?>
- </a>
- </td>
- <td class="listr" ondblclick="document.location='v_recordings_edit.php?id=<?=$i;?>';">
- <a href="javascript:void(0);" onclick="window.open('v_recordings_play.php?a=download&type=rec&filename=<?=$recordingent['filename'];?>', 'play',' width=420,height=40,menubar=no,status=no,toolbar=no')">
- <?=$recordingent['recordingname'];?>&nbsp;
- </a>
- </td>
- <td class="listbg" ondblclick="document.location='v_recordings_edit.php?id=<?=$i;?>';">
- <font color="#FFFFFF"><?=htmlspecialchars($recordingent['descr']);?>&nbsp;
- </td>
- <td valign="middle" nowrap class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td valign="middle"><a href="v_recordings_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
- <td><a href="v_recordings.php?type=rec&act=del&id=<?=$i;?>&filename=<?=$recordingent['filename'];?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- <?php
- }
- else {
- //clean up blank entries
- unset($a_recordings[$i]);
- write_config();
- }
-
- $i++;
- } //end for each
- } //end count
- ?>
-
- <!--
- <tr>
- <td class="list" colspan="3"></td>
- <td class="list">
- <table border="0" cellspacing="0" cellpadding="1">
- <tr>
- <td width="17"></td>
- <td valign="middle"><a href="v_recordings_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
- </tr>
- </table>
- </td>
- </tr>
- -->
-
- <tr>
- <td class="list" colspan="3"></td>
- <td class="list"></td>
- </tr>
- </table>
-
-
-
- <br />
- <br />
- <br />
-
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Music on Hold:<br>
- </strong></span>
- Music on hold can be in WAV or MP3 format. To play an MP3 file you must have
- mod_shout enabled on the 'Modules' tab. You can adjust the volume of the MP3
- audio from the 'Settings' tab. For best performance upload 16bit 8khz/16khz Mono WAV files.
- <!--Click on the 'Filename' to download it or the 'Recording Name' to
- play the audio.-->
- </span></p></td>
- </tr>
- </table>
-
- <br />
-
- <div id="niftyOutter">
- <form action="" method="POST" enctype="multipart/form-data" name="frmUpload" onSubmit="">
- <table border='0'>
- <tr>
- <td width='50%'>
- <?php
- if ($v_path_show) {
- echo "<b>location:</b>";
- echo $dir_music_on_hold_8000;
- }
- ?>
- </td>
- <td valign="top" class="label">
- <input name="type" type="hidden" value="moh">
- </td>
- <td align="right">File to upload:</td>
- <td valign="top" class="label">
- <input name="ulfile" type="file" class="button" id="ulfile">
- <input name="submit" type="submit" class="button" id="upload" value="Upload">
- </td>
- </tr>
- </table>
- </div>
- </form>
-
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="28%" class="listhdrr">File Name (download)</td>
- <td width="28%" class="listhdrr">Name (play)</td>
- <td width="25%" class="listhdr">Last Modified</td>
- <td width="10%" class="listhdr" nowrap>Size</td>
- </tr>
-
- <?php
-
- if ($handle = opendir($dir_music_on_hold_8000)) {
- while (false !== ($file = readdir($handle))) {
- if ($file != "." && $file != ".." && is_file($dir_music_on_hold_8000.$file)) {
-
- $tmp_filesize = filesize($dir_music_on_hold_8000.$file);
- $tmp_filesize = byte_convert($tmp_filesize);
-
- echo "<tr>\n";
- echo " <td class=\"listlr\" ondblclick=\"\">\n";
- echo " <a href=\"v_recordings.php?a=download&type=moh&t=bin&filename=".$file."\">\n";
- echo " $file";
- echo " </a>";
- echo " </td>\n";
- echo " <td class=\"listlr\" ondblclick=\"\">\n";
- echo " <a href=\"javascript:void(0);\" onclick=\"window.open('v_recordings_play.php?a=download&type=moh&filename=".$file."', 'play',' width=420,height=40,menubar=no,status=no,toolbar=no')\">\n";
- $tmp_file_array = split("\.",$file);
- echo " ".$tmp_file_array[0];
- echo " </a>";
- echo " </td>\n";
- echo " <td class=\"listlr\" ondblclick=\"\">\n";
- echo date ("F d Y H:i:s", filemtime($dir_music_on_hold_8000.$file));
- echo " </td>\n";
- echo " <td class=\"listlr\" ondblclick=\"\">\n";
- echo " ".$tmp_filesize;
- echo " </td>\n";
- echo " <td valign=\"middle\" nowrap class=\"list\">\n";
- echo " <table border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n";
- echo " <tr>\n";
- //echo " <td valign=\"middle\"><a href=\"v_recordings.php?id=$i\"><img src=\"/themes/".$g['theme']."/images/icons/icon_e.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n";
- echo " <td><a href=\"v_recordings.php?type=moh&act=del&filename=".$file."\" onclick=\"return confirm('Do you really want to delete this file?')\"><img src=\"/themes/". $g['theme']."/images/icons/icon_x.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n";
- echo " </tr>\n";
- echo " </table>\n";
- echo " </td>\n";
- echo "</tr>\n";
-
- }
- }
- closedir($handle);
- }
- ?>
-
- <tr>
- <td class="list" colspan="3"></td>
- <td class="list"></td>
- </tr>
- </table>
-
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-
-</td>
-</tr>
-</table>
-
-</div>
-
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch_dev/v_recordings_edit.tmp b/config/freeswitch_dev/v_recordings_edit.tmp
deleted file mode 100644
index f5547ba3..00000000
--- a/config/freeswitch_dev/v_recordings_edit.tmp
+++ /dev/null
@@ -1,174 +0,0 @@
-<?php
-/* $Id$ */
-/*
- v_recordings_edit.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/v_config.inc");
-
-$a_recordings = &$config['installedpackages']['freeswitchrecordings']['config'];
-
-
-$id = $_GET['id'];
-if (isset($_POST['id'])) {
- $id = $_POST['id'];
-}
-
-if (isset($id) && $a_recordings[$id]) {
- $pconfig['filename'] = $a_recordings[$id]['filename'];
- $pconfig['recordingname'] = $a_recordings[$id]['recordingname'];
- $pconfig['recordingid'] = $a_recordings[$id]['recordingid'];
- $pconfig['descr'] = $a_recordings[$id]['descr'];
-}
-
-if ($_POST) {
-
- unset($input_errors);
- $pconfig = $_POST;
-
-
- if (!$input_errors) {
-
-
- $recordingent = array();
- $recordingent['recordingname'] = $_POST['recordingname'];
- $recordingent['descr'] = $_POST['descr'];
-
-
- if (isset($id) && $a_recordings[$id]) {
- //update
- if (strlen($_POST['recordingid']) > 0) {
- $recordingent['recordingid'] = $_POST['recordingid'];
- }
- else {
- $recordingent['recordingid'] = guid();
- }
-
- $recordingent['filename'] = $_POST['filename'];
-
- //if file name is not the same then rename the file
- if ($_POST['filename'] != $_POST['filename_orig']) {
- rename($v_recordings_dir.$_POST['filename_orig'], $v_recordings_dir.$_POST['filename']);
- }
- $a_recordings[$id] = $recordingent;
- }
- else {
- //add
- $recordingent['filename'] = $_POST['filename'];
- $a_recordings[] = $recordingent;
- }
-
- write_config();
-
- header("Location: v_recordings.php");
- exit;
- }
-}
-
-include("head.inc");
-
-?>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-
-<?php
-include("fbegin.inc");
-if ($v_label_show) {
- echo "<p class=\"pgtitle\">$v_label: Recordings: Edit</p>\n";
-}
-?>
-
-<?php if ($input_errors) print_input_errors($input_errors); ?>
-
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-build_menu();
-
-?>
-</td></tr>
-</table>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
- <br />
- <form action="v_recordings_edit.php" method="post" name="iform" id="iform">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="22%" valign="top" class="vncellreq">Filename</td>
- <td width="78%" class="vtable">
- <input name="filename" type="text" class="formfld" id="filename" size="40" value="<?=htmlspecialchars($pconfig['filename']);?>">
- <br> <span class="vexpl">Name of the file<br>
- e.g. <em>example.wav</em></span></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Recording Name</td>
- <td width="78%" class="vtable">
- <input name="recordingname" type="text" class="formfld" id="recordingname" size="40" value="<?=htmlspecialchars($pconfig['recordingname']);?>">
- <br> <span class="vexpl">Recording Name<br>
- e.g. <em>recordingx</em></span></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">Description</td>
- <td width="78%" class="vtable">
- <input name="descr" type="text" class="formfld" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>">
- <br> <span class="vexpl">You may enter a description here
- for your reference (not parsed).</span></td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()">
- <?php if (isset($id) && $a_recordings[$id]): ?>
- <input name="filename_orig" type="hidden" value="<?=htmlspecialchars($pconfig['filename']);?>">
- <input name="id" type="hidden" value="<?=$id;?>">
- <input name="recordingid" type="hidden" value="<?=htmlspecialchars($pconfig['recordingid']);?>">
- <?php endif; ?>
- </td>
- </tr>
- </table>
- </form>
-
- <br>
- <br>
- <br>
- <br>
- <br>
- <br>
-
- </td>
- </tr>
-</table>
-
-</div>
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch_dev/v_recordings_play.tmp b/config/freeswitch_dev/v_recordings_play.tmp
deleted file mode 100644
index 1794b036..00000000
--- a/config/freeswitch_dev/v_recordings_play.tmp
+++ /dev/null
@@ -1,69 +0,0 @@
-<?php
-/* $Id$ */
-/*
- v_recordings_play.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require("/usr/local/pkg/v_config.inc");
-
-$filename = $_GET['filename'];
-$type = $_GET['type']; //moh //rec
-
-?>
-<html>
-<head>
-</head>
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td align='center'>
- <b>file: <?=$filename?></b>
- </td>
- </tr>
- <tr>
- <td align='center'>
- <?php
-
- $file_ext = substr($_GET['filename'], -3);
- if ($file_ext == "wav") {
- echo "<embed src=\"v_recordings.php?a=download&type=".$type."&filename=".$filename."\" autostart=true width=200 height=40 name=\"sound".$$filename."\" enablejavascript=\"true\">\n";
- }
- if ($file_ext == "mp3") {
- echo "<object type=\"application/x-shockwave-flash\" width=\"400\" height=\"17\" data=\"slim.swf?autoplay=true&song_title=".urlencode($filename)."&song_url=".urlencode($v_relative_url."/v_recordings.php?a=download&type=".$type."&filename=".$filename)."\">\n";
- echo "<param name=\"movie\" value=\"slim.swf?autoplay=true&song_url=".urlencode($v_relative_url."/v_recordings.php?a=download&type=".$type."&filename=".$filename)."\" />\n";
- echo "<param name=\"quality\" value=\"high\"/>\n";
- echo "<param name=\"bgcolor\" value=\"#E6E6E6\"/>\n";
- echo "</object>\n";
- }
-
- ?>
- </td>
- </tr>
-</table>
-
-</body>
-</html>
diff --git a/config/freeswitch_dev/v_settings.tmp b/config/freeswitch_dev/v_settings.tmp
deleted file mode 100644
index b9cad0e8..00000000
--- a/config/freeswitch_dev/v_settings.tmp
+++ /dev/null
@@ -1,396 +0,0 @@
-<?php
-/* $Id$ */
-/*
- v_settings.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/v_config.inc");
-
-
-$a_settings = &$config['installedpackages']['freeswitchsettings']['config'];
-
-//$id = $_GET['id'];
-//if (isset($_POST['id'])) {
-// $id = $_POST['id'];
-//}
-$id = 0;
-
-if (isset($id) && $a_settings[$id]) {
-
- $pconfig['numbering_plan'] = $a_settings[$id]['numbering_plan'];
- $pconfig['default_gateway'] = $a_settings[$id]['default_gateway'];
- $pconfig['default_area_code'] = $a_settings[$id]['default_area_code'];
- $pconfig['event_socket_port'] = $a_settings[$id]['event_socket_port'];
- $pconfig['event_socket_password'] = $a_settings[$id]['event_socket_password'];
- $pconfig['xml_rpc_http_port'] = $a_settings[$id]['xml_rpc_http_port'];
- $pconfig['xml_rpc_auth_realm'] = $a_settings[$id]['xml_rpc_auth_realm'];
- $pconfig['xml_rpc_auth_user'] = $a_settings[$id]['xml_rpc_auth_user'];
- $pconfig['xml_rpc_auth_pass'] = $a_settings[$id]['xml_rpc_auth_pass'];
- $pconfig['admin_pin'] = $a_settings[$id]['admin_pin'];
- $pconfig['smtphost'] = $a_settings[$id]['smtphost'];
- $pconfig['smtpsecure'] = $a_settings[$id]['smtpsecure'];
- $pconfig['smtpauth'] = $a_settings[$id]['smtpauth'];
- $pconfig['smtpusername'] = $a_settings[$id]['smtpusername'];
- $pconfig['smtppassword'] = $a_settings[$id]['smtppassword'];
- $pconfig['smtpfrom'] = $a_settings[$id]['smtpfrom'];
- $pconfig['smtpfromname'] = $a_settings[$id]['smtpfromname'];
- $pconfig['mod_shout_decoder'] = $a_settings[$id]['mod_shout_decoder'];
- $pconfig['mod_shout_volume'] = $a_settings[$id]['mod_shout_volume'];
-
-}
-
-if ($_POST) {
-
- unset($input_errors);
- $pconfig = $_POST;
-
-
- if (!$input_errors) {
-
- $ent = array();
- $ent['numbering_plan'] = $_POST['numbering_plan'];
- $ent['default_gateway'] = $_POST['default_gateway'];
- $ent['default_area_code'] = $_POST['default_area_code'];
- $ent['event_socket_port'] = $_POST['event_socket_port'];
- $ent['event_socket_password'] = $_POST['event_socket_password'];
- $ent['xml_rpc_http_port'] = $_POST['xml_rpc_http_port'];
- $ent['xml_rpc_auth_realm'] = $_POST['xml_rpc_auth_realm'];
- $ent['xml_rpc_auth_user'] = $_POST['xml_rpc_auth_user'];
- $ent['xml_rpc_auth_pass'] = $_POST['xml_rpc_auth_pass'];
- $ent['admin_pin'] = $_POST['admin_pin'];
- $ent['smtphost'] = $_POST['smtphost'];
- $ent['smtpsecure'] = $_POST['smtpsecure'];
- $ent['smtpauth'] = $_POST['smtpauth'];
- $ent['smtpusername'] = $_POST['smtpusername'];
- $ent['smtppassword'] = $_POST['smtppassword'];
- $ent['smtpfrom'] = $_POST['smtpfrom'];
- $ent['smtpfromname'] = $_POST['smtpfromname'];
- $ent['mod_shout_decoder'] = $_POST['mod_shout_decoder'];
- $ent['mod_shout_volume'] = $_POST['mod_shout_volume'];
-
-
- if (isset($id) && $a_settings[$id]) {
- //update
- $a_settings[$id] = $ent;
- }
- else {
- //add
- $a_settings[] = $ent;
- }
- v_settings(); //add the global variables
- write_config();
- sync_package_v_settings();
-
- //header("Location: v_extensions.php");
- //exit;
- }
-}
-
-include("head.inc");
-
-?>
-
-<script type="text/javascript" language="JavaScript">
-
-function show_advanced_config() {
- document.getElementById("showadvancedbox").innerHTML='';
- aodiv = document.getElementById('showadvanced');
- aodiv.style.display = "block";
-}
-
-</script>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php
-include("fbegin.inc");
-if ($v_label_show) {
- echo "<p class=\"pgtitle\">$v_label: Settings</p>\n";
-}
-?>
-<?php if ($input_errors) print_input_errors($input_errors); ?>
-
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-build_menu();
-
-?>
-</td></tr>
-</table>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
- <!--
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><p><span class="vexpl"><span class="red"><strong>Settings<br />
- </strong></span>
- <?php
- //if ($v_path_show) {
- // echo $v_conf_dir."/directory/default/\n";
- //}
- ?>
- </p></td>
- </tr>
- </table>
- -->
- <br />
-
- <form action="v_settings.php" method="post" name="iform" id="iform">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
-
- <tr>
- <td width="25%" valign="top" class="vncell">Numbering Plan</td>
- <td width="75%" class="vtable">
- <input name="numbering_plan" type="text" class="formfld" id="numbering_plan" size="40" value="<?=htmlspecialchars($pconfig['numbering_plan']);?>">
- <br /><span class="vexpl">Enter the numbering plan here. example: US<br /></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncell">Default Gateway</td>
- <td width="75%" class="vtable">
- <input name="default_gateway" type="text" class="formfld" id="default_gateway" size="40" value="<?=htmlspecialchars($pconfig['default_gateway']);?>">
- <br /><span class="vexpl">Enter the default gateway name here.<br /></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncell">Default Area Code</td>
- <td width="75%" class="vtable">
- <input name="default_area_code" type="text" class="formfld" id="default_area_code" size="40" value="<?=htmlspecialchars($pconfig['default_area_code']);?>">
- <br /><span class="vexpl">Enter the area code here. example: 208<br /></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncell">Event Socket Port</td>
- <td width="75%" class="vtable">
- <input name="event_socket_port" type="text" class="formfld" id="event_socket_port" size="40" value="<?=htmlspecialchars($pconfig['event_socket_port']);?>">
- <br /><span class="vexpl">Enter the event socket port here. default: 8021<br /></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncell">Event Socket Password</td>
- <td width="75%" class="vtable">
- <input name="event_socket_password" type="password" class="formfld" id="event_socket_password" size="40" value="<?=htmlspecialchars($pconfig['event_socket_password']);?>">
- <br /><span class="vexpl">Enter the event socket password here. default: 7e4d3i<br /></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncell">XML RPC HTTP Port</td>
- <td width="75%" class="vtable">
- <input name="xml_rpc_http_port" type="text" class="formfld" id="xml_rpc_http_port" size="40" value="<?=htmlspecialchars($pconfig['xml_rpc_http_port']);?>">
- <br /><span class="vexpl">Enter the XML RPC HTTP Port here. default: 8787<br /></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncell">XML RPC Auth Realm</td>
- <td width="75%" class="vtable">
- <input name="xml_rpc_auth_realm" type="text" class="formfld" id="xml_rpc_auth_realm" size="40" value="<?=htmlspecialchars($pconfig['xml_rpc_auth_realm']);?>">
- <br /><span class="vexpl">Enter the XML RPC Auth Realm here. default: <?php echo $v_name; ?><br /></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncell">XML RPC Auth User</td>
- <td width="75%" class="vtable">
- <input name="xml_rpc_auth_user" type="text" class="formfld" id="xml_rpc_auth_user" size="40" value="<?=htmlspecialchars($pconfig['xml_rpc_auth_user']);?>">
- <br /><span class="vexpl">Enter the XML RPC Auth User here. default: xmlrpc<br /></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncell">XML RPC Auth Password</td>
- <td width="75%" class="vtable">
- <input name="xml_rpc_auth_pass" type="password" class="formfld" id="xml_rpc_auth_pass" size="40" value="<?=htmlspecialchars($pconfig['xml_rpc_auth_pass']);?>">
- <br /><span class="vexpl">Enter the XML RPC Auth Password here. default: 7e4d3i<br /></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncell">Admin PIN Number</td>
- <td width="75%" class="vtable">
- <input name="admin_pin" type="password" class="formfld" id="admin_pin" size="40" value="<?=htmlspecialchars($pconfig['admin_pin']);?>">
- <br /><span class="vexpl">Enter a admin pin number. Used to authenticate the admin from the phone.<br /></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncell">SMTP Host</td>
- <td width="75%" class="vtable">
- <input name="smtphost" type="text" class="formfld2" id="smtphost" size="40" value="<?=htmlspecialchars($pconfig['smtphost']);?>">
- <br /><span class="vexpl">Enter the SMTP host address. example: smtp.gmail.com:465<br /></span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">SMTP Secure</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='smtpsecure' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['smtpsecure'])) {
- case "none":
- echo " <option value='none' selected='yes'>none</option>\n";
- echo " <option value='tls'>tls</option>\n";
- echo " <option value='ssl'>ssl</option>\n";
- break;
- case "tls":
- echo " <option value='none'>none</option>\n";
- echo " <option value='tls' selected='yes'>tls</option>\n";
- echo " <option value='ssl'>ssl</option>\n";
- break;
- case "ssl":
- echo " <option value='none'>none</option>\n";
- echo " <option value='tls'>tls</option>\n";
- echo " <option value='ssl' selected='yes'>ssl</option>\n";
- break;
- default:
- echo " <option value='' selected='yes'>none</option>\n";
- echo " <option value='tls'>tls</option>\n";
- echo " <option value='ssl'>ssl</option>\n";
- }
- echo " </select><br />\n";
- echo "Select the SMTP security. None, TLS, SSL<br />";
- ?>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell">SMTP Auth</td>
- <td width="78%" class="vtable">
- <?php
- echo " <select name='smtpauth' class='formfld'>\n";
- echo " <option></option>\n";
- switch (htmlspecialchars($pconfig['smtpauth'])) {
- case "true":
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- break;
- case "false":
- echo " <option value='true'>true</option>\n";
- echo " <option value='false' selected='yes'>false</option>\n";
-
- break;
- default:
- echo " <option value='true' selected='yes'>true</option>\n";
- echo " <option value='false'>false</option>\n";
- }
- echo " </select><br />\n";
- echo "Use SMTP Authentication true or false.<br />";
- ?>
- </td>
- </tr>
-
- <tr>
- <td width="25%" valign="top" class="vncell">SMTP Username</td>
- <td width="75%" class="vtable">
- <input name="smtpusername" type="text" class="formfld" id="smtpusername" size="40" value="<?=htmlspecialchars($pconfig['smtpusername']);?>">
- <br /><span class="vexpl">Enter the SMTP authentication username.<br /></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncell">SMTP Password</td>
- <td width="75%" class="vtable">
- <input name="smtppassword" type="password" class="formfld" id="smtppassword" size="40" value="<?=htmlspecialchars($pconfig['smtppassword']);?>">
- <br /><span class="vexpl">Enter the SMTP authentication password.<br /></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncell">SMTP From</td>
- <td width="75%" class="vtable">
- <input name="smtpfrom" type="text" class="formfld" id="smtpfrom" size="40" value="<?=htmlspecialchars($pconfig['smtpfrom']);?>">
- <br /><span class="vexpl">Enter the SMTP From email address.<br /></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncell">SMTP From Name</td>
- <td width="75%" class="vtable">
- <input name="smtpfromname" type="text" class="formfld" id="smtpfromname" size="40" value="<?=htmlspecialchars($pconfig['smtpfromname']);?>">
- <br /><span class="vexpl">Enter the SMTP From Name.<br /></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncell">Mod Shout Decoder</td>
- <td width="75%" class="vtable">
- <input name="mod_shout_decoder" type="text" class="formfld" id="mod_shout_decoder" size="40" value="<?=htmlspecialchars($pconfig['mod_shout_decoder']);?>">
- <br /><span class="vexpl">Enter the Decoder. default: i386<br /></span>
- </td>
- </tr>
- </table>
- <!--
- <div id="showadvancedbox">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="25%" valign="top" class="vncell">Show Advanced</td>
- <td width="75%" class="vtable">
- <input type="button" onClick="show_advanced_config()" value="Advanced"></input></a>
- </td>
- </tr>
- </table>
- </div>
- <div id="showadvanced" style="display:none">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="25%" valign="top" class="vncell">zzz</td>
- <td width="75%" class="vtable">
- <input name="zzz" type="text" class="formfld" id="zzz" size="40" value="<?=htmlspecialchars($pconfig['zzz']);?>">
- <br /> <span class="vexpl">zzz<br /></span>
- </td>
- </tr>
- </table>
- </div>
- -->
- <br /><br />
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="25%" valign="top">&nbsp;</td>
- <td>
- <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()">
- <?php
- $id = 0;
- if (isset($id) && $a_settings[$id]) {
- echo "<input name=\"id\" type=\"hidden\" value=\"".$id."\">\n";
- }
- ?>
- </td>
- </tr>
- </table>
- </form>
-
- <br />
- <br />
- <br />
- <br />
- <br />
- <br />
-
- </td>
- </tr>
-</table>
-
-</div>
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch_dev/v_status.tmp b/config/freeswitch_dev/v_status.tmp
deleted file mode 100644
index 3a3d6097..00000000
--- a/config/freeswitch_dev/v_status.tmp
+++ /dev/null
@@ -1,380 +0,0 @@
-<?php
-/* $Id$ */
-/*
- v_status.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/v_config.inc");
-
-
-if ($_GET['a'] == "download") {
- if ($_GET['t'] == "logs") {
- $tmp = $v_log_dir.'/';
- $filename = $v_name.'.log';
- }
- if ($_GET['t'] == "cdrcsv") {
- $tmp = $v_log_dir.'/cdr-csv/';
- $filename = 'Master.csv';
- }
- if ($_GET['t'] == "backup") {
- $tmp = $v_backup_dir.'/';
- $filename = $v_name.'.bak.tgz';
- if (!is_dir($v_backup_dir.'/')) {
- exec("mkdir ".$v_backup_dir."/");
- }
- chdir($v_parent_dir);
- system('tar cvzf '.$v_backup_dir.'/'.$v_name.'.bak.tgz '.$v_name);
- }
- session_cache_limiter('public');
- $fd = fopen($tmp.$filename, "rb");
- header("Content-Type: binary/octet-stream");
- header("Content-Length: " . filesize($tmp.$filename));
- header('Content-Disposition: attachment; filename="'.$filename.'"');
- fpassthru($fd);
- exit;
-}
-
-if ($_GET['a'] == "update") {
- if ($_GET['t'] == "gui_phase_1") {
-
- //chdir('/tmp/');
- chdir($v_parent_dir.'/pkg/');
- exec("fetch ".$v_download_path."v_config.inc");
- //exec("cp ".$tmp_dir."/v_config.tmp ".$v_parent_dir."/pkg/v_config.php");
- //unlink_if_exists($tmp_dir."/v_config.tmp");
-
- header( 'Location: v_status.php?a=update&t=gui_phase_2' ) ;
- exit;
- }
-}
-
-if ($_GET['a'] == "update") {
- if ($_GET['t'] == "gui_phase_2") {
- v_install_phase_2(); //needs to run on the new page so that it uses the new v_config.inc file
- header( 'Location: v_status.php?savemsg=Update+Completed.' ) ;
- exit;
- }
-}
-
-if ($_GET['a'] == "other") {
- if ($_GET['t'] == "restore") {
- $tmp = '/root/backup/';
- $filename = $v_name.'.bak.tgz';
-
- //extract a specific directory
- if (file_exists($v_backup_dir.'/'.$filename)) {
- //echo "The file $filename exists";
-
- //Clear the following directories to prepare for the Restore
- exec("rm -R ".$v_conf_dir."/sip_profiles/");
- exec("rm -R ".$v_dir."/sounds/music/");
-
- //Recommended
- system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/db/');
- system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/log/');
- system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/recordings/');
- system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/scripts/');
- system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/storage/');
- system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/sounds/custom/8000/');
- system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/sounds/music/8000/');
- system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/conf/ssl');
- system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/conf/sip_profiles/');
- system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/conf/vars.xml');
- system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/conf/dialplan/default.xml');
- system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/conf/dialplan/public.xml');
-
- //Optional
- //system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/conf/');
- //system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/grammar/');
- //system('cd /usr/local; tar xvpfz '.$v_backup_dir.'/'.$filename.' '.$v_name.'/htdocs/');
-
- //Synchronize Package
- sync_package_freeswitch();
-
- header( 'Location: v_status.php?savemsg=Backup+has+been+restored.' ) ;
- }
- else {
- header( 'Location: v_status.php?savemsg=Restore+failed.+Backup+file+not+found.' ) ;
- }
-
- exit;
- }
-}
-
-include("head.inc");
-
-$password = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password'];
-$port = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port'];
-$host = $config['interfaces']['lan']['ipaddr'];
-
-$savemsg = $_GET["savemsg"];
-
-//if service is not running then start it
-if (!pkg_is_service_running($v_name)) {
- $handle = popen($v_startup_script_dir."/".$v_name.".sh start", "r");
- pclose($handle);
- //give time for the service to load
- sleep(7);
-}
-?>
-
-<script language="Javascript" type="text/javascript" src="/edit_area/edit_area_full.js"></script>
-<script language="Javascript" type="text/javascript">
- // initialisation
- editAreaLoader.init({
- id: "log" // id of the textarea to transform
- ,start_highlight: false
- ,allow_toggle: true
- ,display: "later"
- ,language: "en"
- ,syntax: "html"
- ,toolbar: "search, go_to_line,|, fullscreen, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help"
- ,syntax_selection_allow: "css,html,js,php,xml,c,cpp,sql"
- ,show_line_colors: true
- });
-</script>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-
-<?php
-include("fbegin.inc");
-if ($v_label_show) {
- echo "<p class=\"pgtitle\">$v_label: Status</p>\n";
-}
-
-if ($savemsg) {
- print_info_box($savemsg);
-}
-?>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-build_menu();
-
-?>
-</td></tr>
-</table>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
-<?php
-
-echo "<br /><br />\n\n";
-
-
-$fp = event_socket_create($host, $port, $password);
-$cmd = "api sofia status";
-$response = event_socket_request($fp, $cmd);
-echo "<table width='690' cellpadding='0' cellspacing='0' border='0'>\n";
-echo "<tr>\n";
-echo "<td width='50%'>\n";
-echo " <b>sofia status</b> \n";
-echo "</td>\n";
-echo "<td width='50%' align='right'>\n";
-echo " <input type='button' value='reloadxml' onclick=\"document.location.href='v_cmd.php?cmd=api+reloadxml';\" />\n";
-echo "</td>\n";
-echo "</tr>\n";
-echo "</table>\n";
-echo "<pre style=\"font-size: 9pt;\">\n";
-echo $response;
-echo "</pre>\n";
-fclose($fp);
-echo "<br /><br />\n\n";
-
-foreach (ListFiles($v_conf_dir.'/sip_profiles') as $key=>$sip_profile_file){
-
- $sip_profile_name = str_replace(".xml", "", $sip_profile_file);
- $fp = event_socket_create($host, $port, $password);
- $cmd = "api sofia status profile ".$sip_profile_name;
- $response = event_socket_request($fp, $cmd);
- echo "<table width='690' cellpadding='0' cellspacing='0' border='0'>\n";
- echo "<tr>\n";
- echo "<td width='50%'>\n";
- echo " <b>sofia status profile $sip_profile_name</b> \n";
- echo "</td>\n";
- echo "<td width='50%' align='right'>\n";
- echo " <input type='button' value='start' onclick=\"document.location.href='v_cmd.php?cmd=api+sofia+profile+".$sip_profile_name."+start';\" />\n";
- echo " <input type='button' value='stop' onclick=\"document.location.href='v_cmd.php?cmd=api+sofia+profile+".$sip_profile_name."+stop';\" />\n";
- echo " <input type='button' value='restart' onclick=\"document.location.href='v_cmd.php?cmd=api+sofia+profile+".$sip_profile_name."+restart';\" />\n";
- if ($sip_profile_name == "external") {
- echo " <input type='button' value='rescan' onclick=\"document.location.href='v_cmd.php?cmd=api+sofia+profile+".$sip_profile_name."+rescan';\" />\n";
- }
- else {
- echo " <input type='button' value='flush_inbound_reg' onclick=\"document.location.href='v_cmd.php?cmd=api+sofia+profile+".$sip_profile_name."+flush_inbound_reg';\" />\n";
- }
- echo "</td>\n";
- echo "</tr>\n";
- echo "</table>\n";
- echo "<pre style=\"font-size: 9pt;\">\n";
- echo $response;
- echo "</pre>\n";
- fclose($fp);
- echo "<br /><br />\n\n";
-
-}
-
-
-$fp = event_socket_create($host, $port, $password);
-$cmd = "api status";
-$response = event_socket_request($fp, $cmd);
-echo "<b>status</b><br />\n";
-echo "<pre style=\"font-size: 9pt;\">\n";
-echo $response;
-echo "</pre>\n";
-fclose($fp);
-echo "<br /><br />\n\n";
-
-
-$fp = event_socket_create($host, $port, $password);
-$cmd = "api show channels";
-$response = event_socket_request($fp, $cmd);
-echo "<b>show channels</b><br />\n";
-if (strlen($response) > 40) {
- echo "<textarea cols='85' rows='10' wrap='off'>\n";
- echo $response;
- echo "</textarea>\n";
-}
-else {
- echo "<pre style=\"font-size: 9pt;\">\n";
- echo $response;
- echo "</pre>\n";
-}
-fclose($fp);
-echo "<br /><br />\n\n";
-echo "<br /><br />\n\n";
-
-
-$fp = event_socket_create($host, $port, $password);
-$cmd = "api show calls";
-$response = event_socket_request($fp, $cmd);
-echo "<b>show calls</b><br />\n";
-if (strlen($response) > 40) {
- echo "<textarea cols='85' rows='10' wrap='off'>\n";
- echo $response;
- echo "</textarea>\n";
-}
-else {
- echo "<pre style=\"font-size: 9pt;\">\n";
- echo $response;
- echo "</pre>\n";
-}
-fclose($fp);
-echo "<br /><br />\n\n";
-echo "<br /><br />\n\n";
-
-
-echo "<table width='690' cellpadding='0' cellspacing='0' border='0'>\n";
-echo "<tr>\n";
-echo "<td width='80%'>\n";
-echo "<b>Backup / Restore</b><br />\n";
-echo "The 'backup' button will tar gzip ".$v_dir." to ".$v_backup_dir."/".$v_name.".bak.tgz it then presents a file to download. \n";
-echo "If the backup file does not exist in ".$v_backup_dir."/".$v_name.".bak.tgz then the 'restore' button will be hidden. \n";
-echo "Use Diagnostics->Command->File to upload: to browse to the file and then click on upload it now ready to be restored. \n";
-echo "<br /><br />\n";
-echo "</td>\n";
-echo "<td width='20%' valign='middle' align='right'>\n";
-echo " <input type='button' value='backup' onclick=\"document.location.href='v_status.php?a=download&t=backup';\" />\n";
-if (file_exists($v_backup_dir.'/'.$v_name.'.bak.tgz')) {
- echo " <input type='button' value='restore' onclick=\"document.location.href='v_status.php?a=other&t=restore';\" />\n";
-}
-echo "</td>\n";
-echo "</tr>\n";
-echo "</table>\n";
-echo "<br /><br />\n\n";
-
-
-echo "<table width='690' cellpadding='0' cellspacing='0' border='0'>\n";
-echo "<tr>\n";
-echo "<td width='50%'>\n";
-echo "<b>Call Detail Records</b><br />\n";
-echo $v_log_dir."/cdr-csv/Master.csv<br /><br />\n";
-echo "</td>\n";
-echo "<td width='50%' align='right'>\n";
-echo " <input type='button' value='download cdr csv' onclick=\"document.location.href='v_status.php?a=download&t=cdrcsv';\" />\n";
-echo "</td>\n";
-echo "</tr>\n";
-echo "</table>\n";
-echo "<br /><br />\n\n";
-
-echo "<table width='690' cellpadding='0' cellspacing='0' border='0'>\n";
-echo "<tr>\n";
-echo "<td width='50%'>\n";
-echo "<b>Web Interface</b><br />\n";
-echo "Use the following button to update the web interface.<br /><br />\n";
-echo "</td>\n";
-echo "<td width='50%' align='right'>\n";
-echo " <input type='button' value='update' onclick=\"document.location.href='v_status.php?a=update&t=gui_phase_1';\" />\n";
-echo "</td>\n";
-echo "</tr>\n";
-echo "</table>\n";
-echo "<br /><br />\n\n";
-
-echo "<table width='690' cellpadding='0' cellspacing='0' border='0'>\n";
-echo "<tr>\n";
-echo "<td width='50%'>\n";
-echo "<b>Logs</b><br />\n";
-echo $v_log_dir."/cdr-csv/".$v_name.".log<br /><br />\n";
-echo "</td>\n";
-echo "<td width='50%' align='right'>\n";
-echo " <input type='button' value='download logs' onclick=\"document.location.href='v_status.php?a=download&t=logs';\" />\n";
-echo "</tr>\n";
-echo "</table>\n";
-echo "<br /><br />\n\n";
-
-
-echo "<b>tail -n 500 ".$v_log_dir."/".$v_name.".log</b><br />\n";
-echo "<textarea id='log' name='log' style='width:99%'; rows='30' wrap='off'>\n";
-echo system("tail -n 500 ".$v_log_dir."/".$v_name.".log");
-echo "</textarea>\n";
-echo "<br /><br />\n\n";
-
-
-//$fp = event_socket_create($host, $port, $password);
-//$cmd = "api sofia ";
-//$response = event_socket_request($fp, $cmd);
-//echo "<b>api sofia</b><br />\n";
-//echo "<pre style=\"font-size: 9pt;\">\n";
-//echo $response;
-//echo "</pre>\n";
-//fclose($fp);
-//echo "<br /><br />\n\n";
-
-?>
-
- </td>
- </tr>
-</table>
-
-</div>
-<?php include("fend.inc"); ?>
-
-</body>
-</html>
diff --git a/config/freeswitch_dev/v_vars.tmp b/config/freeswitch_dev/v_vars.tmp
deleted file mode 100644
index d713d9e3..00000000
--- a/config/freeswitch_dev/v_vars.tmp
+++ /dev/null
@@ -1,169 +0,0 @@
-<?php
-/* $Id$ */
-/*
- v_vars.php
- Copyright (C) 2008 Mark J Crane
- 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.
-*/
-
-require("guiconfig.inc");
-require("/usr/local/pkg/v_config.inc");
-
-//$a_extensions = &$config['installedpackages']['freeswitchprofiles']['config'];
-
-if ($_GET['a'] == "default") {
- conf_mount_rw();
- exec("cp ".$v_conf_dir.".orig/vars.xml ".$v_conf_dir."/vars.xml");
- $savemsg = "Default Restored";
- conf_mount_ro();
-}
-
-if ($_POST['a'] == "save") {
- conf_mount_rw();
- $content = ereg_replace("\r","",$_POST['code']);
- $fd = fopen($v_conf_dir."/vars.xml", "w");
- fwrite($fd, $content);
- fclose($fd);
- $savemsg = "Saved";
- conf_mount_ro();
-}
-
-
-$fd = fopen($v_conf_dir."/vars.xml", "r");
-$content = fread($fd, filesize($v_conf_dir."/vars.xml"));
-fclose($fd);
-
-include("head.inc");
-
-?>
-
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-
-<script language="Javascript">
-function sf() { document.forms[0].savetopath.focus(); }
-</script>
-<script language="Javascript" type="text/javascript" src="/edit_area/edit_area_full.js"></script>
-<script language="Javascript" type="text/javascript">
- // initialisation
- editAreaLoader.init({
- id: "code" // id of the textarea to transform
- ,start_highlight: false
- ,allow_toggle: false
- ,language: "en"
- ,syntax: "html"
- ,toolbar: "search, go_to_line,|, fullscreen, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help"
- ,syntax_selection_allow: "css,html,js,php,xml,c,cpp,sql"
- ,show_line_colors: true
- });
-</script>
-
-<?php
-include("fbegin.inc");
-if ($v_label_show) {
- echo "<p class=\"pgtitle\">$v_label: Variables</p>\n";
-}
-?>
-
-<div id="mainlevel">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr><td class="tabnavtbl">
-<?php
-
-build_menu();
-
-?>
-</td></tr>
-</table>
-
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="tabcont" >
-
-<form action="v_vars.php" method="post" name="iform" id="iform">
-<?php
-
-?>
- <table width="98%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width='90%'><p><span class="vexpl"><span class="red"><strong>Variables<br>
- </strong></span>
- Define preprocessor variables here. Can be accessed in the xml configation with $${var_name}.
- </p>
- </td>
- <td width='10%' align='right' valign='middle'><input type="submit" value="save" /></td>
- </tr>
- </table>
- <br />
- <br />
-
- <textarea style="width:98%" id="code" name="code" rows="30" cols="<?php echo $cols; ?>" name="content"><?php echo htmlentities($content); ?></textarea>
- <br />
- <br />
-
- <table width="98%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td>
- <?php
- if ($v_path_show) {
- echo $v_conf_dir."/vars.xml\n";
- }
- ?>
- </td>
- <td align='right'>
- <input type="hidden" name="f" value="<?php echo $_GET['f']; ?>" />
- <input type="hidden" name="a" value="save" />
- <?php
- echo "<input type='button' value='Restore Default' onclick=\"document.location.href='v_vars.php?a=default&f=vars.xml';\" />";
- ?>
- </td>
- </tr>
- </table>
-
-</form>
-
-<br>
-<br>
-
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-
-</td>
-</tr>
-</table>
-
-</div>
-
-
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/config/freeswitch_dev/your_pin_number_is_incorect_goodbye.wav b/config/freeswitch_dev/your_pin_number_is_incorect_goodbye.wav
deleted file mode 100755
index 5683bb8e..00000000
--- a/config/freeswitch_dev/your_pin_number_is_incorect_goodbye.wav
+++ /dev/null
Binary files differ
diff --git a/config/haproxy-devel/haproxy.inc b/config/haproxy-devel/haproxy.inc
index 1e403c48..6cfef4fe 100644
--- a/config/haproxy-devel/haproxy.inc
+++ b/config/haproxy-devel/haproxy.inc
@@ -32,6 +32,7 @@
require_once("functions.inc");
require_once("pkg-utils.inc");
require_once("notices.inc");
+require_once("filter.inc");
require_once("haproxy_utils.inc");
require_once("haproxy_xmlrpcsyncclient.inc");
@@ -39,33 +40,52 @@ $d_haproxyconfdirty_path = $g['varrun_path'] . "/haproxy.conf.dirty";
global $a_acltypes;
$a_acltypes = array();
-$a_acltypes["host_starts_with"] = array('name' => 'Host starts with',
+$a_acltypes["host_starts_with"] = array('name' => 'Host starts with:',
'mode' => 'http', 'syntax' => 'hdr_beg(host) -i %1$s');
-$a_acltypes["host_ends_with"] = array('name' => 'Host ends with',
+$a_acltypes["host_ends_with"] = array('name' => 'Host ends with:',
'mode' =>'http', 'syntax' => 'hdr_end(host) -i %1$s');
-$a_acltypes["host_matches"] = array('name' => 'Host matches',
+$a_acltypes["host_matches"] = array('name' => 'Host matches:',
'mode' =>'http', 'syntax' => 'hdr(host) -i %1$s');
-$a_acltypes["host_regex"] = array('name' => 'Host regex',
+$a_acltypes["host_regex"] = array('name' => 'Host regex:',
'mode' =>'http', 'syntax' => 'hdr_reg(host) -i %1$s');
-$a_acltypes["host_contains"] = array('name' => 'Host contains',
+$a_acltypes["host_contains"] = array('name' => 'Host contains:',
'mode' => 'http', 'syntax' => 'hdr_dir(host) -i %1$s');
-$a_acltypes["path_starts_with"] = array('name' => 'Path starts with',
+$a_acltypes["path_starts_with"] = array('name' => 'Path starts with:',
'mode' => 'http', 'syntax' => 'path_beg -i %1$s');
-$a_acltypes["path_ends_with"] = array('name' => 'Path ends with',
+$a_acltypes["path_ends_with"] = array('name' => 'Path ends with:',
'mode' => 'http', 'syntax' => 'path_end -i %1$s');
-$a_acltypes["path_matches"] = array('name' => 'Path matches',
+$a_acltypes["path_matches"] = array('name' => 'Path matches:',
'mode' => 'http', 'syntax' => 'path -i %1$s');
-$a_acltypes["path_regex"] = array('name' => 'Path regex',
+$a_acltypes["path_regex"] = array('name' => 'Path regex:',
'mode' => 'http', 'syntax' => 'path_reg -i %1$s');
-$a_acltypes["path_contains"] = array('name' => 'Path contains',
+$a_acltypes["path_contains"] = array('name' => 'Path contains:',
'mode' => 'http', 'syntax' => 'path_dir -i %1$s');
-$a_acltypes["source_ip"] = array('name' => 'Source IP',
+$a_acltypes["ssl_c_verify_code"] = array('name' => 'SSL Client certificate verify error result:',
+ 'mode' => 'http', 'syntax' => 'ssl_fc_has_crt ssl_c_verify %1$s');
+ // ssl_c_verify result codes: https://www.openssl.org/docs/apps/verify.html#DIAGNOSTICS
+$a_acltypes["ssl_c_verify"] = array('name' => 'SSL Client certificate valid.',
+ 'mode' => 'http', 'syntax' => 'ssl_fc_has_crt ssl_c_verify 0 ');
+$a_acltypes["ssl_c_ca_commonname"] = array('name' => 'SSL Client issued by CA common-name:',
+ 'mode' => 'http', 'syntax' => 'ssl_c_i_dn(CN) %1$s');
+$a_acltypes["source_ip"] = array('name' => 'Source IP matches IP or Alias:',
'mode' => '', 'syntax' => 'src %1$s');
-$a_acltypes["backendservercount"] = array('name' => 'Minimum count usable servers',
+$a_acltypes["backendservercount"] = array('name' => 'Minimum count usable servers:',
'mode' => '', 'syntax' => 'nbsrv(%2$s) ge %1$d', 'parameters' => 'value,backendname');
+$a_acltypes["traffic_is_http"] = array('name' => 'Traffic is http (no value needed):', 'inspect-delay' => '5',
+ 'mode' => 'tcp', 'syntax' => 'req.proto_http', 'advancedoptions' => "tcp-request content accept if { req.proto_http }");
+$a_acltypes["traffic_is_ssl"] = array('name' => 'Traffic is ssl (no value needed):', 'inspect-delay' => '5',
+ 'mode' => 'tcp', 'syntax' => 'req.ssl_ver gt 0', 'advancedoptions' => "tcp-request content accept if { req.ssl_ver gt 0 }");
// 'ssl_sni_matches' was added in HAProxy1.5dev17
-$a_acltypes["ssl_sni_matches"] = array('name' => 'Server Name Indication TLS extension matches',
- 'mode' => 'https', 'syntax' => 'req_ssl_sni -i %1$s', 'advancedoptions' => "tcp-request inspect-delay 5s\n\ttcp-request content accept if { req_ssl_hello_type 1 }");
+$a_acltypes["ssl_sni_matches"] = array('name' => 'Server Name Indication TLS extension matches:', 'inspect-delay' => '5',
+ 'mode' => 'https', 'syntax' => 'req.ssl_sni -i %1$s', 'advancedoptions' => "tcp-request content accept if { req.ssl_hello_type 1 }");
+$a_acltypes["ssl_sni_contains"] = array('name' => 'Server Name Indication TLS extension contains:', 'inspect-delay' => '5',
+ 'mode' => 'https', 'syntax' => 'req.ssl_sni -m sub -i %1$s', 'advancedoptions' => "tcp-request content accept if { req.ssl_hello_type 1 }");
+$a_acltypes["ssl_sni_starts_with"] = array('name' => 'Server Name Indication TLS extension starts with:', 'inspect-delay' => '5',
+ 'mode' => 'https', 'syntax' => 'req.ssl_sni -m beg -i %1$s', 'advancedoptions' => "tcp-request content accept if { req.ssl_hello_type 1 }");
+$a_acltypes["ssl_sni_ends_with"] = array('name' => 'Server Name Indication TLS extension ends with:', 'inspect-delay' => '5',
+ 'mode' => 'https', 'syntax' => 'req.ssl_sni -m end -i %1$s', 'advancedoptions' => "tcp-request content accept if { req.ssl_hello_type 1 }");
+$a_acltypes["custom"] = array('name' => 'Custom acl:',
+ 'mode' => '', 'syntax' => '%1$s');
global $a_checktypes;
$a_checktypes = array();
@@ -78,7 +98,7 @@ $a_checktypes['HTTP'] = array('name' => 'HTTP', 'syntax' => 'httpchk',
// 'Agent' was added in HAProxy1.5dev18, and removed in 1.5dev20, in favor of the seperate agent-check option.
$a_checktypes['Agent'] = array('name' => 'Agent', 'syntax' => 'lb-agent-chk', 'usedifferenport' => 'yes',
'descr' => 'Use a TCP connection to read an ASCII string of the form 100%,75%,drain,down (others in haproxy manual)',
- deprecated => true);
+ 'deprecated' => true);
$a_checktypes['LDAP'] = array('name' => 'LDAP', 'syntax' => 'ldap-check',
'descr' => 'Use LDAPv3 health checks for server testing');
$a_checktypes['MySQL'] = array('name' => 'MySQL', 'syntax' => 'mysql-check',
@@ -106,16 +126,18 @@ $a_httpcheck_method['TRACE'] = array('name' => 'TRACE', 'syntax' => 'TRACE');
global $a_closetypes;
$a_closetypes = array();
-$a_closetypes['none'] = array('name' => 'none', 'syntax' => '',
- 'descr' => 'No close headers will be changed.');
+//$a_closetypes['none'] = array('name' => 'none', 'syntax' => '',
+// 'descr' => 'No close headers will be changed.');
+$a_closetypes['http-keep-alive'] = array('name' => 'http-keep-alive (default)', 'syntax' => 'http-keep-alive',
+ 'descr' => 'By default HAProxy operates in keep-alive mode with regards to persistent connections: for each connection it processes each request and response, and leaves the connection idle on both sides between the end of a response and the start of a new request.');
+$a_closetypes['http-tunnel'] = array('name' => 'http-tunnel', 'syntax' => 'http-tunnel',
+ 'descr' => 'Option "http-tunnel" disables any HTTP processing past the first request and the first response. This is the mode which was used by default in versions 1.0 to 1.5-dev21. It is the mode with the lowest processing overhead, which is normally not needed anymore unless in very specific cases such as when using an in-house protocol that looks like HTTP but is not compatible, or just to log one request per client in order to reduce log size. Note that everything which works at the HTTP level, including header parsing/addition, cookie processing or content switching will only work for the first request and will be ignored after the first response.');
$a_closetypes['httpclose'] = array('name' => 'httpclose', 'syntax' => 'httpclose',
'descr' => 'The "httpclose" option removes any "Connection" header both ways, and adds a "Connection: close" header in each direction. This makes it easier to disable HTTP keep-alive than the previous 4-rules block.');
$a_closetypes['http-server-close'] = array('name' => 'http-server-close', 'syntax' => 'http-server-close',
'descr' => 'By default, when a client communicates with a server, HAProxy will only analyze, log, and process the first request of each connection. Setting "option http-server-close" enables HTTP connection-close mode on the server side while keeping the ability to support HTTP keep-alive and pipelining on the client side. This provides the lowest latency on the client side (slow network) and the fastest session reuse on the server side to save server resources.');
$a_closetypes['forceclose'] = array('name' => 'forceclose', 'syntax' => 'forceclose',
'descr' => 'Some HTTP servers do not necessarily close the connections when they receive the "Connection: close" set by "option httpclose", and if the client does not close either, then the connection remains open till the timeout expires. This causes high number of simultaneous connections on the servers and shows high global session times in the logs. Note that this option also enables the parsing of the full request and response, which means we can close the connection to the server very quickly, releasing some resources earlier than with httpclose.');
-$a_closetypes['http-keep-alive'] = array('name' => 'http-keep-alive', 'syntax' => 'http-keep-alive',
- 'descr' => 'By default, when a client communicates with a server, HAProxy will only analyze, log, and process the first request of each connection. Setting "option http-keep-alive" enables HTTP keep-alive mode on the client- and server- sides. This provides the lowest latency on the client side (slow network) and the fastest session reuse on the server side at the expense of maintaining idle connections to the servers. In general, it is possible with this option to achieve approximately twice the request rate that the "http-server-close" option achieves on small objects. There are mainly two situations where this option may be useful : - when the server is non-HTTP compliant and authenticates the connection instead of requests (eg: NTLM authentication) - when the cost of establishing the connection to the server is significant compared to the cost of retrieving the associated object from the server.');
global $a_servermodes;
$a_servermodes = array();
@@ -242,6 +264,16 @@ function haproxy_portoralias_to_list($port_or_alias) {
return null;
}
+function haproxy_hostoralias_to_list($host_or_alias) {
+ if (is_alias($host_or_alias)){
+ $result = filter_expand_alias_array($host_or_alias);
+ } else {
+ $result = array();
+ $result[] = $host_or_alias;
+ }
+ return $result;
+}
+
function haproxy_custom_php_deinstall_command() {
global $static_output;
$static_output .= "HAProxy, running haproxy_custom_php_deinstall_command()\n";
@@ -338,7 +370,10 @@ EOD;
$writeconfigupdate = false;
/* Do XML upgrade from haproxy 0.31 to haproxy-dev */
if (is_array($config['installedpackages']['haproxy']['ha_servers'])) {
- /* We have an old config */
+ $static_output .= "HAProxy, Do XML upgrade from haproxy 0.31 to haproxy-dev\n";
+ update_output_window($static_output);
+
+ /* We have an old config */
$config['installedpackages']['haproxy']['ha_pools']['item'] = array();
$a_global = &$config['installedpackages']['haproxy'];
$a_backends = &$config['installedpackages']['haproxy']['ha_backends']['item'];
@@ -383,8 +418,10 @@ EOD;
}
/* XML update to: pkg v1.3 and 'pool' changed to 'backend_serverpool' because 'pool' was added to listtags() in xmlparse.inc */
- if (is_array($config['installedpackages']['haproxy']['ha_backends']['item'][0]['pool']))
- {
+ if (is_array($config['installedpackages']['haproxy']['ha_backends']['item'][0]['pool'])) {
+ $static_output .= "HAProxy, Do XML upgrade, change to backend_serverpool from pool array\n";
+ update_output_window($static_output);
+
foreach($config['installedpackages']['haproxy']['ha_backends']['item'] as &$frontend)
{
$backend_serverpool = $frontend['pool'][0];
@@ -394,8 +431,9 @@ EOD;
$writeconfigupdate = true;
}
//also move setting for existing 2.0 installations as only the new variable is used
- if (isset($config['installedpackages']['haproxy']['ha_backends']['item'][0]['pool']))
- {
+ if (isset($config['installedpackages']['haproxy']['ha_backends']['item'][0]['pool'])) {
+ $static_output .= "HAProxy, Do XML upgrade, change to backend_serverpool from pool\n";
+ update_output_window($static_output);
foreach($config['installedpackages']['haproxy']['ha_backends']['item'] as &$frontend)
{
$backend_serverpool = $frontend['pool'];
@@ -406,6 +444,8 @@ EOD;
}
// update config to "haproxy-devel 1.5-dev19 pkg v0.5"
if(is_array($config['installedpackages']['haproxy']['ha_backends']['item'])) {
+ $static_output .= "HAProxy, Do XML upgrade, update frontend options\n";
+ update_output_window($static_output);
foreach ($config['installedpackages']['haproxy']['ha_backends']['item'] as &$bind) {
if($bind['httpclose'] && $bind['httpclose'] == "yes" ) {
$bind['httpclose'] = "httpclose";
@@ -498,7 +538,7 @@ function haproxy_find_acl($name) {
}
}
-function write_backend($fd, $name, $pool, $frontend) {
+function write_backend($configpath, $fd, $name, $pool, $frontend) {
if(!is_array($pool['ha_servers']['item']) && !$pool['stats_enabled']=='yes')
return;
global $a_checktypes, $a_cookiemode;
@@ -515,8 +555,11 @@ function write_backend($fd, $name, $pool, $frontend) {
$backend_mode = $frontendtype;
}
fwrite ($fd, "\tmode\t\t\t" . $backend_mode . "\n");
-
+ if ($pool['log-health-checks'] == 'yes')
+ fwrite ($fd, "\toption\t\t\tlog-health-checks\n");
+
if ($frontendtype == "http") {
+ // actions that read/write http headers only work when 'mode http' is used
if ($pool["persist_cookie_enabled"] == "yes") {
$cookie_mode = $pool["persist_cookie_mode"];
$cookie_cachable = $pool["persist_cookie_cachable"];
@@ -525,14 +568,52 @@ function write_backend($fd, $name, $pool, $frontend) {
$cookie .= $cookie_cachable == "yes" ? "" : " nocache";
fwrite ($fd, "\t" . $cookie . "\n");
}
- }
+
+ if ($pool["strict_transport_security"] && is_numeric($pool["strict_transport_security"])){
+ fwrite ($fd, "\trspadd Strict-Transport-Security:\\ max-age={$pool["strict_transport_security"]};\n");
+ }
+
+ if ($pool["cookie_attribute_secure"] == 'yes'){
+ fwrite ($fd, "\trspirep ^(Set-Cookie:((?!;\\ secure).)*)$ \\1;\ secure if { ssl_fc }\n");
+ }
+
+ if($pool['stats_enabled']=='yes') {
+ fwrite ($fd, "\tstats\t\t\tenable\n");
+ if($pool['stats_uri'])
+ fwrite ($fd, "\tstats\t\t\turi ".$pool['stats_uri']."\n");
+ if($pool['stats_realm'])
+ fwrite ($fd, "\tstats\t\t\trealm " . haproxy_escapestring($pool['stats_realm']) . "\n");
+ else
+ fwrite ($fd, "\tstats\t\t\trealm .\n");
+
+ if ($pool['stats_username'] && $pool['stats_password'])
+ fwrite ($fd, "\tstats\t\t\tauth " . haproxy_escapestring($pool['stats_username']).":". haproxy_escapestring($pool['stats_password'])."\n");
+
+ if($pool['stats_admin']=='yes')
+ fwrite ($fd, "\tstats\t\t\tadmin if TRUE" . "\n");
+
+ if($pool['stats_node'])
+ fwrite ($fd, "\tstats\t\t\tshow-node " . $pool['stats_node'] . "\n");
+ if($pool['stats_desc'])
+ fwrite ($fd, "\tstats\t\t\tshow-desc " . haproxy_escapestring($pool['stats_desc']) . "\n");
+ if($pool['stats_refresh'])
+ fwrite ($fd, "\tstats\t\t\trefresh " . $pool['stats_refresh'] . "\n");
+
+ if ($pool['stats_scope']) {
+ $scope_items = explode(",", $pool['stats_scope']);
+ foreach($scope_items as $scope_item)
+ fwrite ($fd, "\tstats\t\t\tscope " . $scope_item . "\n");
+ }
+ }
+ }
+
switch($pool["persist_sticky_type"]) {
case 'stick_sslsessionid':
if ($frontendtype == "https") {
fwrite ($fd, "\ttcp-request inspect-delay 5s\n");
fwrite ($fd, "\tstick-table type binary len 32 size ".$pool["persist_stick_tablesize"]." expire ".$pool["persist_stick_expire"]."\n");
- fwrite ($fd, "\tacl clienthello req_ssl_hello_type 1\n");
- fwrite ($fd, "\tacl serverhello rep_ssl_hello_type 2\n");
+ fwrite ($fd, "\tacl clienthello req.ssl_hello_type 1\n");
+ fwrite ($fd, "\tacl serverhello res.ssl_hello_type 2\n");
fwrite ($fd, "\ttcp-request content accept if clienthello\n");
fwrite ($fd, "\ttcp-response content accept if serverhello\n");
fwrite ($fd, "\tstick on payload_lv(43,1) if clienthello\n");
@@ -564,8 +645,7 @@ function write_backend($fd, $name, $pool, $frontend) {
unset($checkport);
$check_type = $pool['check_type'];
- if ($check_type != 'none')
- {
+ if ($check_type != 'none') {
$optioncheck = $a_checktypes[$check_type]['syntax'];
if ($check_type == "MySQL" || $check_type == "PostgreSQL")
$optioncheck .= " user " . $pool['monitor_username'];
@@ -599,36 +679,11 @@ function write_backend($fd, $name, $pool, $frontend) {
$pool['retries'] = 3;
fwrite ($fd, "\tretries\t\t\t" . $pool['retries'] . "\n");
- if ($pool['transparent_clientip'])
- fwrite ($fd, "\tsource 0.0.0.0 usesrc clientip\n");
-
- if($pool['stats_enabled']=='yes') {
- fwrite ($fd, "\tstats\t\t\tenable\n");
- if($pool['stats_uri'])
- fwrite ($fd, "\tstats\t\t\turi ".$pool['stats_uri']."\n");
- if($pool['stats_realm'])
- fwrite ($fd, "\tstats\t\t\trealm " . haproxy_escapestring($pool['stats_realm']) . "\n");
- else
- fwrite ($fd, "\tstats\t\t\trealm .\n");
-
- if ($pool['stats_username'] && $pool['stats_password'])
- fwrite ($fd, "\tstats\t\t\tauth " . haproxy_escapestring($pool['stats_username']).":". haproxy_escapestring($pool['stats_password'])."\n");
-
- if($pool['stats_admin']=='yes')
- fwrite ($fd, "\tstats\t\t\tadmin if TRUE" . "\n");
-
- if($pool['stats_node'])
- fwrite ($fd, "\tstats\t\t\tshow-node " . $pool['stats_node'] . "\n");
- if($pool['stats_desc'])
- fwrite ($fd, "\tstats\t\t\tshow-desc " . haproxy_escapestring($pool['stats_desc']) . "\n");
- if($pool['stats_refresh'])
- fwrite ($fd, "\tstats\t\t\trefresh " . $pool['stats_refresh'] . "\n");
-
- if ($pool['stats_scope']) {
- $scope_items = explode(",", $pool['stats_scope']);
- foreach($scope_items as $scope_item)
- fwrite ($fd, "\tstats\t\t\tscope " . $scope_item . "\n");
- }
+ if ($pool['transparent_clientip']) {
+ if (is_ipaddrv4($frontend_ip))
+ fwrite ($fd, "\tsource 0.0.0.0 usesrc clientip\n");
+ else
+ fwrite ($fd, "\tsource ipv6@ usesrc clientip\n");
}
$uri = $pool['monitor_uri'];
@@ -639,10 +694,6 @@ function write_backend($fd, $name, $pool, $frontend) {
if ($optioncheck)
fwrite ($fd, "\toption\t\t\t{$optioncheck}\n");
-
- if ($pool["strict_transport_security"] && is_numeric($pool["strict_transport_security"])){
- fwrite ($fd, "\trspadd Strict-Transport-Security:\ max-age={$pool["strict_transport_security"]};\n");
- }
if ($pool['advanced_backend']) {
$adv_be = explode("\n", base64_decode($pool['advanced_backend']));
@@ -690,15 +741,57 @@ function write_backend($fd, $name, $pool, $frontend) {
$isbackup = "";
}
$ssl = "";
+ $cafile = "";
+ $crlfile = "";
+ $crtfile = "";
+ $verifynone = "";
+ $verifyhost = "";
if ($be['ssl'] == 'yes')
{
$ssl = $frontendtype == "http" ? ' ssl' : ' check-ssl';
+
+ if ($be['sslserververify'] != 'yes') {
+ $verifynone = " verify none";
+ } else {
+ $verifyhost = isset($be['verifyhost']) && $be['verifyhost'] != "" ? " verifyhost {$be['verifyhost']}" : "";
+
+ $ca = $be['ssl-server-ca'];
+ $filename = "$configpath/ca_$ca.pem";
+ haproxy_write_certificate_crt($filename, $ca);
+ $cafile = " ca-file $filename";
+
+ $crl = $be['ssl-server-crl'];
+ if ($crl && $crl != "") {
+ $filename = "$configpath/crl_$crl.pem";
+ haproxy_write_certificate_crl($filename, $crl);
+ $crlfile = " crl-file $filename";
+ }
+ }
+
+ $server_clientcert = $be['ssl-server-clientcert'];
+ if ($server_clientcert && $server_clientcert != "") {
+ $filename = "$configpath/server_clientcert_$server_clientcert.pem";
+ haproxy_write_certificate_crt($filename, $server_clientcert, true);
+ $crtfile = " crt $filename";
+ }
+
}
$weight = "";
if (is_numeric($be['weight'])){
$weight = " weight " . $be['weight'];
}
- fwrite ($fd, "\tserver\t\t\t" . $be['name'] . " " . $be['address'].":" . $be['port'] . "$ssl$cookie$checkinter$checkport$agentcheck $isbackup$weight{$advanced_txt} {$be['advanced']}\n");
+ $maxconn = "";
+ if (is_numeric($be['maxconn'])){
+ $maxconn = " maxconn " . $be['maxconn'];
+ }
+
+ if ($be['forwardto'] && $be['forwardto'] != "") {
+ $server = "/{$be['forwardto']}.socket send-proxy-v2-ssl-cn";
+ } else
+ $server = $be['address'].":" . $be['port'];
+
+
+ fwrite ($fd, "\tserver\t\t\t" . $be['name'] . " " . $server . "$ssl$cookie$checkinter$checkport$agentcheck $isbackup$weight$maxconn$cafile$crlfile$verifynone$verifyhost$crtfile{$advanced_txt} {$be['advanced']}\n");
}
}
fwrite ($fd, "\n");
@@ -735,24 +828,56 @@ function haproxy_check_and_run(&$messages, $reload) {
}
return $ok;
}
-function haproxy_write_certificate_file($filename, $certid) {
- $cert = lookup_cert($certid);
+
+function haproxy_lookup_cert($certid) {
+ $res = lookup_ca($certid);
+ if (!$res)
+ $res = lookup_cert($certid);
+ return $res;
+}
+
+function haproxy_write_certificate_crt($filename, $certid, $include_psk = false, $append = false) {
+ $cert = haproxy_lookup_cert($certid);
+ $certcontent = base64_decode($cert['crt']);
+ if ($include_psk && isset($cert['prv']))
+ $certcontent .= "\r\n".base64_decode($cert['prv']);
+ $flags = $append ? FILE_APPEND : 0;
+ file_put_contents($filename, $certcontent, $flags);
+ unset($certcontent);
+ unset($cert);
+}
+
+function haproxy_write_certificate_crl($filename, $crlid, $append = false) {
+ $crl = lookup_crl($crlid);
+ $content = base64_decode($crl['text']);
+ $flags = $append ? FILE_APPEND : 0;
+ file_put_contents($filename, $content, $flags);
+ unset($content);
+ unset($crl);
+}
+
+function haproxy_write_certificate_fullchain($filename, $certid, $append = false) {
+ $cert = haproxy_lookup_cert($certid);
$certcontent = base64_decode($cert['crt']);
- $certcontent .= "\r\n".base64_decode($cert['prv']);
+ if (isset($cert['prv']))
+ $certcontent .= "\r\n".base64_decode($cert['prv']);
$certchaincontent = ca_chain($cert);
if ($certchaincontent != "") {
$certcontent .= "\r\n" . $certchaincontent;
}
unset($certchaincontent);
- file_put_contents($filename, $certcontent);
+ $flags = $append ? FILE_APPEND : 0;
+ file_put_contents($filename, $certcontent, $flags);
unset($certcontent);
unset($cert);
}
function haproxy_writeconf($configpath) {
global $config;
+ $chroot_dir = "/tmp/haproxy_chroot"; // can contain socket to forward connection from backend to frontend. "/var/empty"
+ make_dirs($chroot_dir);
$configfile = $configpath . "/haproxy.cfg";
@@ -782,10 +907,15 @@ function haproxy_writeconf($configpath) {
else
$numprocs ="1";
fwrite ($fd, "\tnbproc\t\t\t$numprocs\n");
- fwrite ($fd, "\tchroot\t\t\t/var/empty\n");
+ fwrite ($fd, "\tchroot\t\t\t$chroot_dir\n");
fwrite ($fd, "\tdaemon\n");
- fwrite ($fd, "\tssl-server-verify none\n");
+ //fwrite ($fd, "\tssl-server-verify none\n");
+ if($a_global['ssldefaultdhparam'])
+ fwrite ($fd, "\ttune.ssl.default-dh-param\t{$a_global['ssldefaultdhparam']}\n");
+ if($a_global['log-send-hostname'])
+ fwrite ($fd, "\tlog-send-hostname\t\t{$a_global['log-send-hostname']}\n");
+
// Keep the advanced options on the bottom of the global settings, to allow additional sections to be easely added
if($a_global['advanced']) {
$adv = explode("\n", base64_decode($a_global['advanced']));
@@ -823,45 +953,34 @@ function haproxy_writeconf($configpath) {
continue;
$primaryfrontend = get_primaryfrontend($frontend);
$bname = get_frontend_ipport($frontend);
+ if (!is_array($a_bind[$bname])) {
+ $a_bind[$bname] = array();
+ $a_bind[$bname] = $primaryfrontend;
+ $a_bind[$bname]['config'] = array();
+ }
//check ssl info
if (strtolower($primaryfrontend['type']) == "http" && $frontend['ssloffload']){
//ssl crt ./server.pem ca-file ./ca.crt verify optional crt-ignore-err all crl-file ./ca_crl.pem
$filename = "$configpath/{$frontend['name']}.{$frontend['port']}.pem";
$ssl_crt = " crt $filename";
- haproxy_write_certificate_file($filename, $frontend['ssloffloadcert']);
+ haproxy_write_certificate_fullchain($filename, $frontend['ssloffloadcert']);
$subfolder = "$configpath/{$frontend['name']}.{$frontend['port']}";
$certs = $frontend['ha_certificates']['item'];
if (is_array($certs)){
if (count($certs) > 0){
make_dirs($subfolder);
foreach($certs as $cert){
- haproxy_write_certificate_file("$subfolder/{$cert['ssl_certificate']}.pem", $cert['ssl_certificate']);
+ haproxy_write_certificate_fullchain("$subfolder/{$cert['ssl_certificate']}.pem", $cert['ssl_certificate']);
}
$ssl_crt .= " crt $subfolder";
}
}
}else{
$ssl_crt="";
- unlink_if_exists("var/etc/{$frontend['name']}.{$frontend['port']}.crt");
+ unlink_if_exists("var/etc/{$frontend['name']}.{$frontend['port']}.crt");//cleanup for possible old haproxy package version
}
- if (!is_array($a_bind[$bname])) {
- $a_bind[$bname] = array();
- $a_bind[$bname]['config'] = array();
- // Settings which are used only from the primary frontend
- $a_bind[$bname]['name'] = $primaryfrontend['name'];
- $a_bind[$bname]['extaddr'] = $primaryfrontend['extaddr'];
- $a_bind[$bname]['port'] = $primaryfrontend['port'];
- $a_bind[$bname]['type'] = $primaryfrontend['type'];
- $a_bind[$bname]['forwardfor'] = $primaryfrontend['forwardfor'];
- $a_bind[$bname]['httpclose'] = $primaryfrontend['httpclose'];
- $a_bind[$bname]['max_connections'] = $primaryfrontend['max_connections'];
- $a_bind[$bname]['client_timeout'] = $primaryfrontend['client_timeout'];
- $a_bind[$bname]['advanced'] = $primaryfrontend['advanced'];
- $a_bind[$bname]['ssloffload'] = $primaryfrontend['ssloffload'];
- $a_bind[$bname]['advanced_bind'] = $primaryfrontend['advanced_bind'];
- }
$b = &$a_bind[$bname];
if (($frontend['secondary'] != 'yes') && ($frontend['name'] != $b['name'])) {
@@ -892,13 +1011,34 @@ function haproxy_writeconf($configpath) {
$advancedextra = array();
+ $ca_file = "";
+ $first = true;
+ if (is_array($bind['clientcert_ca']['item'])){
+ foreach($bind['clientcert_ca']['item'] as $ca){
+ $filename = "$configpath/clientca_{$bind['name']}.pem";
+ haproxy_write_certificate_crt($filename, $ca['cert_ca'], false, !$first);
+ $first = false;
+ }
+ $ca_file = " ca-file $filename verify optional";
+ }
+ $crl_file = "";
+ $first = true;
+ if (is_array($bind['clientcert_crl']['item'])){
+ foreach($bind['clientcert_crl']['item'] as $ca){
+ $filename = "$configpath/clientcrl_{$bind['name']}.pem";
+ haproxy_write_certificate_crl($filename, $ca['cert_crl'], !$first);
+ $first = false;
+ }
+ $crl_file = " crl-file $filename";
+ }
+
// Prepare ports for processing by splitting
$portss = "{$bind['port']},";
$ports = split(",", $portss);
if($bind['type'] == "http") {
// ssl offloading is only possible in http mode.
- $ssl_info = $bind['ssl_info'];
+ $ssl_info = $bind['ssl_info'].$ca_file.$crl_file;
$advanced_bind = $bind['advanced_bind'];
} else {
$ssl_info = "";
@@ -923,6 +1063,9 @@ function haproxy_writeconf($configpath) {
fwrite ($fd, "{$frontendinfo}");
fwrite ($fd, "{$listenip}");
+ if (use_frontend_as_unixsocket($bind['name'])){
+ fwrite ($fd, "\tbind /tmp/haproxy_chroot/{$bind['name']}.socket accept-proxy {$ssl_info} {$advanced_bind}\n");
+ }
// Advanced pass thru
if($bind['advanced']) {
@@ -943,7 +1086,19 @@ function haproxy_writeconf($configpath) {
fwrite ($fd, "\tmode\t\t\t" . $backend_type . "\n");
fwrite ($fd, "\tlog\t\t\tglobal\n");
- fwrite ($fd, "\toption\t\t\tdontlognull\n");
+
+ if ($bind['dontlognull'] == 'yes')
+ fwrite ($fd, "\toption\t\t\tdontlognull\n");
+ if ($bind['dontlog-normal'] == 'yes')
+ fwrite ($fd, "\toption\t\t\tdontlog-normal\n");
+ if ($bind['log-separate-errors'] == 'yes')
+ fwrite ($fd, "\toption\t\t\tlog-separate-errors\n");
+ if ($bind['log-detailed'] == 'yes'){
+ if ($backend_type == 'http')
+ fwrite ($fd, "\toption\t\t\thttplog\n");
+ else
+ fwrite ($fd, "\toption\t\t\ttcplog\n");
+ }
if ($backend_type == 'http')
{
@@ -970,6 +1125,7 @@ function haproxy_writeconf($configpath) {
// Combine the rest of the frontend configs
$default_backend = "";
+ $inspectdelay = 0;
$i = 0;
foreach ($bind['config'] as $frontend) {
$a_acl = get_frontend_acls($frontend);
@@ -1005,13 +1161,24 @@ function haproxy_writeconf($configpath) {
// Filter out acls for different modes
if ($acl['mode'] != '' && $acl['mode'] != strtolower($bind['type']))
continue;
-
- $expr = sprintf($acl['syntax'],$entry['value'],$poolname);
+ if (($entry['expression'] == "source_ip") && is_alias($entry['value'])) {
+ $filename = "$configpath/ipalias_{$entry['value']}.lst";
+ $listitems = haproxy_hostoralias_to_list($entry['value']);
+ $fd_alias = fopen("$filename", "w");
+ foreach($listitems as $item)
+ fwrite($fd_alias, $item."\r\n");
+ fclose($fd_alias);
+ $expr = "src -f $filename";
+ } else
+ $expr = sprintf($acl['syntax'],$entry['value'],$poolname);
$aclname = $i . "_" . $entry['name'];
$aclnames .= $aclname." ";
fwrite ($fd, "\tacl\t\t\t" . $aclname . "\t" . $expr . "\n");
+ if ($acl['inspect-delay'] != '')
+ $inspectdelay = $acl['inspect-delay'];
+
if ($acl['advancedoptions'] != '')
$advancedextra[$acl['syntax']] = $acl['advancedoptions']."\n";
$i++;
@@ -1022,6 +1189,8 @@ function haproxy_writeconf($configpath) {
if ($default_backend)
fwrite ($fd, "\tdefault_backend\t\t" . $default_backend . "\n");
+ if ($inspectdelay > 0)
+ fwrite ($fd, "\ttcp-request inspect-delay\t" . $inspectdelay . "\n");
foreach($advancedextra as $extra)
fwrite ($fd, "\t".$extra."\n");
fwrite ($fd, "\n");
@@ -1032,7 +1201,7 @@ function haproxy_writeconf($configpath) {
foreach ($a_pendingpl as $pending) {
foreach ($a_backends as $pool) {
if ($pending['backend'] == $pool['name']) {
- write_backend($fd, $pending['name'], $pool, $pending['frontend']);
+ write_backend($configpath, $fd, $pending['name'], $pool, $pending['frontend']);
}
}
}
@@ -1065,17 +1234,21 @@ function haproxy_is_running() {
}
function haproxy_load_modules() {
- // On FreeBSD 8 ipfw is needed to allow 'transparent' proxying (getting reply's to a non-local ip to pass back to the client-socket)..
- // On FreeBSD 9 it is probably possible to do the same with the pf option "divert-reply"
+ // On FreeBSD 8 ipfw is needed to allow 'transparent' proxying (getting reply's to a non-local ip to pass back to the client-socket).
+ // On FreeBSD 9 and 10 it should have been possible to do the same with the pf(4) option "divert-reply" however that is not implemented.
+ // FreeBSD 10 patch proposal: http://lists.freebsd.org/pipermail/freebsd-bugs/2014-April/055823.html
+
mute_kernel_msgs();
- if (!is_module_loaded("ipfw.ko")) {
- mwexec("/sbin/kldload ipfw");
- /* make sure ipfw is not on pfil hooks */
- mwexec("/sbin/sysctl net.inet.ip.pfil.inbound=\"pf\" net.inet6.ip6.pfil.inbound=\"pf\"" .
- " net.inet.ip.pfil.outbound=\"pf\" net.inet6.ip6.pfil.outbound=\"pf\"");
- }
+ if (!is_module_loaded("ipfw.ko")) {
+ mwexec("/sbin/kldload ipfw");
+ /* make sure ipfw is not on pfil hooks */
+ mwexec("/sbin/sysctl net.inet.ip.pfil.inbound=\"pf\" net.inet6.ip6.pfil.inbound=\"pf\"" .
+ " net.inet.ip.pfil.outbound=\"pf\" net.inet6.ip6.pfil.outbound=\"pf\"");
+ }
+
/* Activate layer2 filtering */
- mwexec("/sbin/sysctl net.link.ether.ipfw=1");
+ mwexec("/sbin/sysctl net.link.ether.ipfw=1 /sbin/net.inet.ip.fw.one_pass=1");
+
unmute_kernel_msgs();
}
@@ -1102,21 +1275,19 @@ function haproxy_get_transparent_backends(){
continue;
$real_if = get_real_interface($backend["transparent_interface"]);
$a_servers = &$backend['ha_servers']['item'];
- foreach($a_servers as $server) {
- if (is_array($a_servers)) {
-
- foreach($a_servers as $be) {
- if (!$be['status'] == "inactive")
- continue;
- if (!is_ipaddr($be['address']))
- continue;
- $item = array();
- $item['name'] = $be['name'];
- $item['interface'] = $real_if;
- $item['address'] = $be['address'];
- $item['port'] = $be['port'];
- $transparent_backends[] = $item;
- }
+ if (is_array($a_servers)) {
+ foreach($a_servers as $be) {
+ if (!$be['status'] == "inactive")
+ continue;
+ if (!is_ipaddr($be['address']))
+ continue;
+ $item = array();
+ $item['name'] = $be['name'];
+ $item['interface'] = $real_if;
+ $item['forwardto'] = $be['forwardto'];
+ $item['address'] = $be['address'];
+ $item['port'] = $be['port'];
+ $transparent_backends[] = $item;
}
}
}
@@ -1129,12 +1300,19 @@ function haproxy_generate_rules($type) {
$rules = "";
switch($type) {
case 'filter':
+ // Sloppy pf rules are needed because of ipfw is used to 'catch' return traffic, and pf would otherwise terminate the connection after a few packets..
$transparent_backends = haproxy_get_transparent_backends();
- foreach($transparent_backends as $tb){
- // This sloppy rule is needed because of ipfw is used to 'catch' return traffic.
+ if (count($transparent_backends) > 0) {
$rules .= "# allow HAProxy transparent traffic\n";
- $rules .= "pass out quick on {$tb['interface']} inet proto tcp from any to {$tb['address']} port {$tb['port']} flags S/SA keep state ( sloppy ) label \"HAPROXY_transparent_rule_{$tb['name']}\"\n";
- }
+ foreach($transparent_backends as $tb){
+ if (is_ipaddrv4($tb['address']))
+ $rules .= "pass out quick on {$tb['interface']} inet proto tcp from any to {$tb['address']} port {$tb['port']} flags S/SA keep state ( sloppy ) label \"HAPROXY_transparent_rule_{$tb['name']}\"\n";
+ if (is_ipaddrv6($tb['address'])) {
+ list ($addr, $scope) = explode("%", $tb['address']);
+ $rules .= "pass out quick on {$tb['interface']} inet6 proto tcp from any to {$addr} port {$tb['port']} flags S/SA keep state ( sloppy ) label \"HAPROXY_transparent_rule_{$tb['name']}\"\n";
+ }
+ }
+ }
break;
}
return $rules;
@@ -1143,7 +1321,11 @@ function haproxy_generate_rules($type) {
function load_ipfw_rules() {
// On FreeBSD 8 pf does not support "divert-reply" so ipfw is needed.
global $g, $config;
- $ipfw_zone_haproxy = "haproxy";
+ if (haproxy_utils::$pf_version < 2.2) {
+ $ipfw_zone_haproxy = "haproxy";
+ } else {
+ $ipfw_zone_haproxy = "4000"; // seems that 4000 is a safe zone number to avoid conflicts with captive portal.. and 4095 is the max?
+ }
$a_backends = &$config['installedpackages']['haproxy']['ha_pools']['item'];
@@ -1156,22 +1338,39 @@ function load_ipfw_rules() {
$interface = $transparent_backend['interface'];
$transparent_interfaces[$interface] = 1;
}
- mwexec("/usr/local/sbin/ipfw_context -a $ipfw_zone_haproxy", true);
- foreach($transparent_interfaces as $transparent_if => $value) {
- mwexec("/usr/local/sbin/ipfw_context -a $ipfw_zone_haproxy -n $transparent_if", true);
+ if (haproxy_utils::$pf_version < 2.2) {
+ // pfSense 2.1 FreeBSD 8.3
+ mwexec("/usr/local/sbin/ipfw_context -a $ipfw_zone_haproxy", true);
+
+ foreach($transparent_interfaces as $transparent_if => $value) {
+ mwexec("/usr/local/sbin/ipfw_context -a $ipfw_zone_haproxy -n $transparent_if", true);
+ }
+ } else {
+ // pfSense 2.2 FreeBSD 10
+ mwexec("/sbin/ipfw zone $ipfw_zone_haproxy create", true);
+ foreach($transparent_interfaces as $transparent_if => $value) {
+ mwexec("/sbin/ipfw zone $ipfw_zone_haproxy madd $transparent_if", true);
+ }
}
$rulenum = 64000; // why that high? captiveportal.inc also does it...
$rules = "flush\n";
foreach($transparent_backends as $transparent_be) {
- $rules .= "add $rulenum fwd localhost tcp from {$transparent_be["address"]} {$transparent_be["port"]} to any in recv {$transparent_be["interface"]}\n";
+ if (is_ipaddrv4($transparent_be["address"]))
+ $rules .= "add $rulenum fwd localhost tcp from {$transparent_be["address"]} {$transparent_be["port"]} to any in recv {$transparent_be["interface"]}\n";
+ else if (is_ipaddrv6($transparent_be["address"])) {
+ list ($addr, $scope) = explode("%", $transparent_be['address']);
+ $rules .= "add $rulenum fwd ::1 tcp from {$addr} {$transparent_be["port"]} to any in recv {$transparent_be["interface"]}\n";
+ }
+
$rulenum++;
}
file_put_contents("{$g['tmp_path']}/ipfw_{$ipfw_zone_haproxy}.haproxy.rules", $rules);
- mwexec("/usr/local/sbin/ipfw_context -s $ipfw_zone_haproxy", true);
+ if (haproxy_utils::$pf_version < 2.2)
+ mwexec("/usr/local/sbin/ipfw_context -s $ipfw_zone_haproxy", true);
mwexec("/sbin/ipfw -x $ipfw_zone_haproxy -q {$g['tmp_path']}/ipfw_{$ipfw_zone_haproxy}.haproxy.rules", true);
}
@@ -1251,18 +1450,38 @@ function haproxy_check_run($reload) {
if(use_transparent_clientip_proxying()) {
filter_configure();
load_ipfw_rules();
+ } else {
+ if (haproxy_utils::$pf_version < 2.2) {
+ mwexec("/usr/local/sbin/ipfw_context -d haproxy", true);
+ } else {
+ $ipfw_zone_haproxy = 4000;
+ mwexec("/sbin/ipfw zone $ipfw_zone_haproxy destroy", true);
+ }
+ }
+
+ if (file_exists('/var/run/haproxy.pid')){
+ $old_pid = file_get_contents('/var/run/haproxy.pid');
} else
- mwexec("/usr/local/sbin/ipfw_context -d haproxy", true);
+ $old_pid = 'none';
if (haproxy_is_running()) {
if (isset($a_global['terminate_on_reload']))
$sf_st = "-st";//terminate old process as soon as the new process is listening
else
$sf_st = "-sf";//finish serving existing connections exit when done, and the new process is listening
+
+ syslog(LOG_NOTICE, "haproxy: reload old pid:$old_pid");
exec("/usr/local/sbin/haproxy -f {$configpath}/haproxy.cfg -p /var/run/haproxy.pid $sf_st `cat /var/run/haproxy.pid` 2>&1", $output, $errcode);
} else {
+ syslog(LOG_NOTICE, "haproxy: starting old pid:$old_pid");
exec("/usr/local/sbin/haproxy -f {$configpath}/haproxy.cfg -p /var/run/haproxy.pid -D 2>&1", $output, $errcode);
}
+ if (file_exists('/var/run/haproxy.pid')){
+ $new_pid = file_get_contents('/var/run/haproxy.pid');
+ } else
+ $new_pid = 'none';
+ syslog(LOG_NOTICE, "haproxy: started new pid:$new_pid");
+
foreach($output as $line)
$haproxy_run_message .= "<br/>" . htmlspecialchars($line) . "\n";
} else {
@@ -1291,13 +1510,16 @@ function killprocesses($processname, $pidfile, $signal = "KILL") {
function haproxy_sync_xmlrpc_settings() {
global $config;
// preserve 'old' sync settings, that should not be overwritten by xmlrpc-sync.
+ $old_config = $config['installedpackages']['haproxy'];
$enable = isset($config['installedpackages']['haproxy']['enablesync']);
$config['installedpackages']['haproxy'] = $config['installedpackages']['haproxysyncpkg'];
unset($config['installedpackages']['haproxysyncpkg']);
+ $new_config = &$config['installedpackages']['haproxy'];
// restore 'old' settings.
$config['installedpackages']['haproxy']['enablesync'] = $enable ? true : false;
+ $new_config['log-send-hostname'] = $old_config['log-send-hostname'];
write_config("haproxy, xmlrpc config synced"); // Write new 'merged' configuration
}
@@ -1333,22 +1555,28 @@ function haproxy_xmlrpc_sync_configure() {
function get_frontend_id($name) {
global $config;
- $a_backend = &$config['installedpackages']['haproxy']['ha_backends']['item'];
+ $a_frontend = &$config['installedpackages']['haproxy']['ha_backends']['item'];
$i = 0;
- foreach($a_backend as $backend)
+ foreach($a_frontend as $frontend)
{
- if ($backend['name'] == $name)
+ if ($frontend['name'] == $name)
return $i;
$i++;
}
return null;
}
+function haproxy_is_frontendname($name) {
+ if ($name[0] == '!')
+ $name = substr($name, 1);
+ return get_frontend_id($name) != null;
+}
+
function get_primaryfrontend($frontend) {
global $config;
- $a_backend = &$config['installedpackages']['haproxy']['ha_backends']['item'];
+ $a_frontend = &$config['installedpackages']['haproxy']['ha_backends']['item'];
if ($frontend['secondary'] == 'yes')
- $mainfrontend = $a_backend[get_frontend_id($frontend['primary_frontend'])];
+ $mainfrontend = $a_frontend[get_frontend_id($frontend['primary_frontend'])];
else
$mainfrontend = $frontend;
return $mainfrontend;
@@ -1405,10 +1633,15 @@ function get_haproxy_frontends($excludeitem="") {
$result[$frontend['name']]['name'] = "{$frontend['name']} - {$frontend['type']} ({$serveradress})";
$result[$frontend['name']]['ref'] = &$frontend;
}
- asort($result, SORT_STRING);
+ uasort($result, haproxy_compareByName);
return $result;
}
+function generate_cert_acl($crt, $defaultport, $nondefaultport){
+ // The host header send by a browser will contain the portnumber when a nondefault port is used for the server side.
+
+}
+
function get_frontend_acls($frontend) {
$mainfrontend = get_primaryfrontend($frontend);
$result = array();
@@ -1439,17 +1672,27 @@ function get_frontend_acls($frontend) {
$poolname = $frontend['backend_serverpool'] . "_" . strtolower($frontend['type']);
$aclname = "SNI_" . $poolname;
- if ($frontend['ssloffloadacl']){
+
+ if (ifset($frontend['ssloffloadacl']) == 'yes' || ifset($frontend['ssloffloadaclnondefault']) == 'yes') {
$cert = lookup_cert($frontend['ssloffloadcert']);
$cert_cn = cert_get_cn($cert['crt']);
$descr = haproxy_escape_acl_name($cert['descr']);
unset($cert);
+
$acl_item = array();
- $acl_item['descr'] = "Certificate ACL ".$cert_cn;
- $acl_item['ref'] = array('name' => "{$aclname}_{$descr}",'expression' => 'host_matches', 'value' => $cert_cn);
+ if (ifset($frontend['ssloffloadacl']) == 'yes' && ifset($frontend['ssloffloadaclnondefault']) == 'yes') {
+ $acl_item['descr'] = "Certificate ACL match regex: ^{$cert_cn}(:([0-9]){1,5})?$";
+ $acl_item['ref'] = array('name' => "{$aclname}_{$descr}",'expression' => 'host_regex', 'value' => "^{$cert_cn}(:([0-9]){1,5})?$");
+ } elseif (ifset($frontend['ssloffloadaclnondefault']) == 'yes') {
+ $acl_item['descr'] = "Certificate ACL starts with: {$cert_cn}:";
+ $acl_item['ref'] = array('name' => "{$aclname}_{$descr}",'expression' => 'host_starts_with', 'value' => $cert_cn.":");
+ } else {
+ $acl_item['descr'] = "Certificate ACL match: {$cert_cn}";
+ $acl_item['ref'] = array('name' => "{$aclname}_{$descr}",'expression' => 'host_matches', 'value' => $cert_cn);
+ }
$result[] = $acl_item;
}
- if ($frontend['ssloffloadacladditional']){
+ if (ifset($frontend['ssloffloadacladditional']) == 'yes' || ifset($frontend['ssloffloadacladditionalnondefault']) == 'yes') {
$certs = $frontend['ha_certificates']['item'];
if (is_array($certs)){
foreach($certs as $certref){
@@ -1457,9 +1700,18 @@ function get_frontend_acls($frontend) {
$cert_cn = cert_get_cn($cert['crt']);
$descr = haproxy_escape_acl_name($cert['descr']);
unset($cert);
+
$acl_item = array();
- $acl_item['descr'] = "Additional certificate ACLs: ".$cert_cn;
- $acl_item['ref'] = array('name' => "{$aclname}_{$descr}",'expression' => 'host_matches', 'value' => $cert_cn);
+ if (ifset($frontend['ssloffloadacladditional']) == 'yes' && ifset($frontend['ssloffloadacladditionalnondefault']) == 'yes') {
+ $acl_item['descr'] = "Certificate ACL match regex: ^{$cert_cn}(:([0-9]){1,5})?$";
+ $acl_item['ref'] = array('name' => "{$aclname}_{$descr}",'expression' => 'host_regex', 'value' => "^({$cert_cn}(($)|(:.*)))");
+ } elseif (ifset($frontend['ssloffloadacladditionalnondefault']) == 'yes') {
+ $acl_item['descr'] = "Certificate ACL starts with: {$cert_cn}:";
+ $acl_item['ref'] = array('name' => "{$aclname}_{$descr}",'expression' => 'host_starts_with', 'value' => $cert_cn.":");
+ } else {
+ $acl_item['descr'] = "Certificate ACL match: {$cert_cn}";
+ $acl_item['ref'] = array('name' => "{$aclname}_{$descr}",'expression' => 'host_matches', 'value' => $cert_cn);
+ }
$result[] = $acl_item;
}
}
@@ -1468,18 +1720,43 @@ function get_frontend_acls($frontend) {
return $result;
}
-function get_backend($name) {
+function get_backend_id($name) {
global $config;
$a_backend = &$config['installedpackages']['haproxy']['ha_pools']['item'];
+ $i = 0;
if(is_array($a_backend))
- foreach($a_backend as $key => $backend)
- {
+ foreach($a_backend as $key => $backend) {
if ($backend['name'] == $name)
- return $backend;
+ return $i;
+ $i++;
}
return null;
}
+function get_backend($name) {
+ global $config;
+ $a_backend = &$config['installedpackages']['haproxy']['ha_pools']['item'];
+ $id = get_backend_id($name);
+ if (is_numeric($id))
+ return $a_backend[$id];
+ return null;
+}
+
+function use_frontend_as_unixsocket($name) {
+ global $config;
+ $a_backends = &$config['installedpackages']['haproxy']['ha_pools']['item'];
+ foreach ($a_backends as $backend) {
+ $a_servers = &$backend['ha_servers']['item'];
+ if (is_array($a_servers)) {
+ foreach($a_servers as $server) {
+ if ($server['forwardto'] && $server['forwardto'] == $name)
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
function haproxy_escapestring($configurationsting) {
$result = str_replace('\\', '\\\\', $configurationsting);
$result = str_replace(' ', '\\ ', $result);
@@ -1500,13 +1777,17 @@ function haproxy_find_create_certificate($certificatename) {
$cert = array();
$cert['refid'] = uniqid();
$cert['descr'] = gettext($certificatename);
- mwexec("/usr/local/bin/openssl genrsa 1024 > {$g['tmp_path']}/ssl.key");
- mwexec("/usr/local/bin/openssl req -new -x509 -nodes -sha256 -days 2000 -key {$g['tmp_path']}/ssl.key > {$g['tmp_path']}/ssl.crt");
- $crt = file_get_contents("{$g['tmp_path']}/ssl.crt");
- $key = file_get_contents("{$g['tmp_path']}/ssl.key");
- unlink("{$g['tmp_path']}/ssl.key");
- unlink("{$g['tmp_path']}/ssl.crt");
- cert_import($cert, $crt, $key);
+
+ $new_cert = array();
+ $dn = array(
+ "organizationName" => "haproxy-pfsense",
+ "commonName" => "haproxy-pfsense"
+ );
+ $new_cert = array();
+ ca_create($new_cert, 1024, 2000, $dn);
+ $crt = base64_decode($new_cert['crt']);
+ $prv = base64_decode($new_cert['prv']);
+ cert_import($cert, $crt, $prv);
$a_cert[] = $cert;
return $cert;
}
diff --git a/config/haproxy-devel/haproxy_global.php b/config/haproxy-devel/haproxy_global.php
index 50472d9f..cad3795a 100755
--- a/config/haproxy-devel/haproxy_global.php
+++ b/config/haproxy-devel/haproxy_global.php
@@ -36,7 +36,7 @@ require_once("haproxy_utils.inc");
require_once("globals.inc");
require_once("pkg_haproxy_tabs.inc");
-$simplefields = array('localstats_refreshtime','localstats_sticktable_refreshtime');
+$simplefields = array('localstats_refreshtime','localstats_sticktable_refreshtime','log-send-hostname','ssldefaultdhparam');
if (!is_array($config['installedpackages']['haproxy']))
$config['installedpackages']['haproxy'] = array();
@@ -268,55 +268,6 @@ function enable_change(enable_change) {
</tr>
<tr>
<td valign="top" class="vncell">
- Remote syslog host
- </td>
- <td class="vtable">
- <input name="remotesyslog" type="text" class="formfld" id="remotesyslog" size="18" value="<?=htmlspecialchars($pconfig['remotesyslog']);?>" /><br/>
- To log to the local pfSense systemlog fill the host with the value <b>/var/run/log</b>, however if a lot of messages are generated logging is likely to be incomplete. (Also currently no informational logging gets shown in the systemlog.)
- </td>
- </tr>
- <tr>
- <td valign="top" class="vncell">
- Syslog facility
- </td>
- <td class="vtable">
- <select name="logfacility" class="formfld">
- <?php
- $facilities = array("kern", "user", "mail", "daemon", "auth", "syslog", "lpr",
- "news", "uucp", "cron", "auth2", "ftp", "ntp", "audit", "alert", "cron2",
- "local0", "local1", "local2", "local3", "local4", "local5", "local6", "local7");
- foreach ($facilities as $f):
- ?>
- <option value="<?=$f;?>" <?php if ($f == $pconfig['logfacility']) echo "selected"; ?>>
- <?=$f;?>
- </option>
- <?php
- endforeach;
- ?>
- </select>
- </td>
- </tr>
- <tr>
- <td valign="top" class="vncell">
- Syslog level
- </td>
- <td class="vtable">
- <select name="loglevel" class="formfld">
- <?php
- $levels = array("emerg", "alert", "crit", "err", "warning", "notice", "info", "debug");
- foreach ($levels as $l):
- ?>
- <option value="<?=$l;?>" <?php if ($l == $pconfig['loglevel']) echo "selected"; ?>>
- <?=$l;?>
- </option>
- <?php
- endforeach;
- ?>
- </select>
- </td>
- </tr>
- <tr>
- <td valign="top" class="vncell">
Carp monitor
</td>
<td class="vtable">
@@ -374,6 +325,77 @@ function enable_change(enable_change) {
</td>
</tr>
<tr>
+ <td colspan="2" valign="top" class="listtopic">Logging</td>
+ </tr>
+ <tr>
+ <td valign="top" class="vncell">
+ Remote syslog host
+ </td>
+ <td class="vtable">
+ <input name="remotesyslog" type="text" class="formfld" id="remotesyslog" size="18" value="<?=htmlspecialchars($pconfig['remotesyslog']);?>" /><br/>
+ To log to the local pfSense systemlog fill the host with the value <b>/var/run/log</b>, however if a lot of messages are generated logging is likely to be incomplete. (Also currently no informational logging gets shown in the systemlog.)
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" class="vncell">
+ Syslog facility
+ </td>
+ <td class="vtable">
+ <select name="logfacility" class="formfld">
+ <?php
+ $facilities = array("kern", "user", "mail", "daemon", "auth", "syslog", "lpr",
+ "news", "uucp", "cron", "auth2", "ftp", "ntp", "audit", "alert", "cron2",
+ "local0", "local1", "local2", "local3", "local4", "local5", "local6", "local7");
+ foreach ($facilities as $f):
+ ?>
+ <option value="<?=$f;?>" <?php if ($f == $pconfig['logfacility']) echo "selected"; ?>>
+ <?=$f;?>
+ </option>
+ <?php
+ endforeach;
+ ?>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" class="vncell">
+ Syslog level
+ </td>
+ <td class="vtable">
+ <select name="loglevel" class="formfld">
+ <?php
+ $levels = array("emerg", "alert", "crit", "err", "warning", "notice", "info", "debug");
+ foreach ($levels as $l):
+ ?>
+ <option value="<?=$l;?>" <?php if ($l == $pconfig['loglevel']) echo "selected"; ?>>
+ <?=$l;?>
+ </option>
+ <?php
+ endforeach;
+ ?>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Log hostname</td>
+ <td width="78%" class="vtable">
+ <input name="log-send-hostname" type="text" <?if(isset($pconfig['log-send-hostname'])) echo "value=\"{$pconfig['log-send-hostname']}\"";?> size="18" maxlength="50" /> EXAMPLE: HaproxyMasterNode<br/>Sets the hostname field in the syslog header. If empty defaults to the system hostname.
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" valign="top" class="listtopic">Tuning</td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Max SSL Diffie-Hellman size</td>
+ <td width="78%" class="vtable">
+ <input name="ssldefaultdhparam" type="text" <?if(isset($pconfig['ssldefaultdhparam'])) echo "value=\"{$pconfig['ssldefaultdhparam']}\"";?> size="10" maxlength="5" /> EXAMPLE: 2048<br/>Sets the maximum size of the Diffie-Hellman parameters used for generating
+the ephemeral/temporary Diffie-Hellman key in case of DHE key exchange.
+Minimum and default value is: 1024, bigger values might increase CPU usage.<br/>
+ For more information about the <b>"tune.ssl.default-dh-param"</b> option please see <b><a href='http://cbonte.github.io/haproxy-dconv/configuration-1.5.html#3.2-tune.ssl.default-dh-param' target='_blank'>HAProxy Documentation</a></b><br/>
+ NOTE: HAProxy will emit a warning when starting when this setting is used but not configured.
+ </td>
+ </tr>
+ <tr>
<td colspan="2" valign="top" class="listtopic">Global Advanced pass thru</td>
</tr>
<tr>
diff --git a/config/haproxy-devel/haproxy_htmllist.inc b/config/haproxy-devel/haproxy_htmllist.inc
index ae46ffd4..404e9fab 100644
--- a/config/haproxy-devel/haproxy_htmllist.inc
+++ b/config/haproxy-devel/haproxy_htmllist.inc
@@ -50,7 +50,30 @@ function haproxy_htmllist_get_values($html_list){
return $values;
}
-function haproxy_htmllist($tablename,$values,$items,$editstate=false){
+function haproxy_htmllist_drawcell($item, $itemvalue, $editable, $itemnamenr = "") {
+ $itemtype = $item['type'];
+ if ($editable) {
+ $itemtype = $item['type'];
+ if ($itemtype == "select"){
+ echo_html_select($itemnamenr, $item['items'], $itemvalue,"","updatevisibility();", "width:{$item['size']}");
+ } else
+ if ($itemtype == "checkbox"){
+ $checked = $itemvalue=='yes' ? " checked" : "";
+ echo "<input name='$itemnamenr' id='$itemnamenr' type='checkbox'$checked value='yes' size='{$item['size']}' />";
+ } else
+ echo "<input name='$itemnamenr' id='$itemnamenr' type='text' value='{$itemvalue}' size='{$item['size']}' />";
+ } else {
+ if ($itemtype == "select"){
+ echo $item['items'][$itemvalue]['name'];
+ } else
+ if ($itemtype == "checkbox"){
+ echo $itemvalue=='yes' ? gettext('yes') : gettext('no');
+ } else
+ echo $itemvalue;
+ }
+}
+
+function haproxy_htmllist($tablename,$rowvalues,$items,$editstate=false,$itemdetails=null){
global $g, $counter;
echo "<table class='' width='100%' cellpadding='0' cellspacing='0' id='$tablename'>
<tr>";
@@ -59,24 +82,20 @@ function haproxy_htmllist($tablename,$values,$items,$editstate=false){
}
echo "<td width='5%' class=''></td>
</tr>";
- if (is_array($values)){
- foreach($values as $value){
+ if (is_array($rowvalues)){
+ foreach($rowvalues as $value){
if (!$editstate) {
echo "<tr id='tr_view_$counter' ondblclick='editRow($counter); return false;' >";
$leftitem = true;
- foreach($items as $item){
+ foreach($items as $item) {
$tdclass = $leftitem ? "vtable listlr" : "vtable listr";
echo "<td class='$tdclass'>";
$itemname = $item['name'];
- $itemtype = $item['type'];
$itemvalue = $value[$itemname];
- if ($itemtype == "select"){
- echo $item['items'][$itemvalue]['name'];
+ if (isset($item['customdrawcell'])) {
+ $item['customdrawcell']($item, $itemvalue, false);
} else
- if ($itemtype == "checkbox"){
- echo $itemvalue=='yes' ? gettext('yes') : gettext('no');
- } else
- echo $itemvalue;
+ haproxy_htmllist_drawcell($item, $itemvalue, false);
echo "</td>";
$leftitem = false;
}
@@ -94,24 +113,18 @@ function haproxy_htmllist($tablename,$values,$items,$editstate=false){
</td></tr></table>
</td>";
echo "</tr>";
- }
+ }
$displaystyle = $editstate ? "" : "display: none;";
echo "<tr id='tr_edit_$counter' style='$displaystyle'>";
foreach($items as $item){
$itemname = $item['name'];
- $itemtype = $item['type'];
$itemvalue = $value[$itemname];
- $itemnamenr = $itemname.$counter;
+ $itemnamenr = $itemname . $counter;
echo "<td class='vtable'>";
- if ($itemtype == "select"){
- echo_html_select($itemnamenr, $item['items'], $itemvalue,"","updatevisibility();", "width:{$item['size']}");
+ if (isset($item['customdrawcell'])) {
+ $item['customdrawcell']($item, $itemvalue, true, $itemnamenr);
} else
- if ($itemtype == "checkbox"){
- $checked = $itemvalue=='yes' ? " checked" : "";
- echo "<input name='$itemnamenr' id='$itemnamenr' type='checkbox'$checked value='yes' size='{$item['size']}' />";
-
- } else
- echo "<input name='$itemnamenr' id='$itemnamenr' type='text' value='{$itemvalue}' size='{$item['size']}' />";
+ haproxy_htmllist_drawcell($item, $itemvalue, true, $itemnamenr);
echo "</td>";
}
echo "
@@ -125,6 +138,78 @@ function haproxy_htmllist($tablename,$values,$items,$editstate=false){
</td></tr></table>
</td>";
echo "</tr>";
+ if (isset($itemdetails)) {
+ $colspan = count($items)-1;
+ echo "<tr id='tr_viewdetail_$counter'>";
+ ?>
+ <td class='vtable listlr' style='border-bottom-width: medium;vertical-align:top;'>
+ <div style="position:relative;float:right;width:11px;height:11px;">
+ <a onclick="htmltable_toggle_details('<?="htmltable_{$tablename}_{$counter}_details"?>')">
+ <img id="htmltable_<?="{$tablename}_{$counter}"?>_details_off" alt="Expand advanced server settings"
+ src="tree/plus.gif" style="clip:rect(19px 13px 30px 2px); top:-19px;position:absolute;"/>
+ </a>
+ </div>
+ </td>
+ <?
+ echo "<td class='vtable listr' colspan='$colspan' style='border-bottom-width: medium;'>";
+ $itemnr = 0;
+ echo "<div id='htmltable_{$tablename}_{$counter}_details_view'>";
+ $itemcount = count($itemdetails);
+ foreach($itemdetails as $item) {
+ echo "<div style='float: left;padding-right: 2px;'>";
+ $tdclass = "";//$leftitem ? "vtable listlr" : "vtable listr";
+ echo $item['columnheader'] . ": ";
+ $itemname = $item['name'];
+ $itemvalue = $value[$itemname];
+ if (isset($item['customdrawcell'])) {
+ $item['customdrawcell']($item, $itemvalue, false);
+ } else
+ haproxy_htmllist_drawcell($item, $itemvalue, false);
+ $leftitem = false;
+ $itemnr++;
+ if ($itemcount != $itemnr)
+ echo ", ";
+ echo "</div>";
+ }
+ echo "</div>";
+ echo "<div id='htmltable_{$tablename}_{$counter}_details_edit' style='display:none;'>";
+ echo "<table class='tabcont' style='border-collapse:collapse' border='1' cellspacing='0' >";
+ $leftitem = true;
+ foreach($itemdetails as $item) {
+ echo "<tr id='tr_edititemdetails_$counter' ondblclick='editRow($counter); return false;'>";
+ $tdclass = "";//$leftitem ? "vtable listlr" : "vtable listr";
+ echo "<td style='border-right:0' class='$tdclass'>";
+ echo "{$item['columnheader']}: ";
+ echo "</td>";
+ echo "<td style='border-left:0' class='$tdclass'>";
+ $itemname = $item['name'];
+ $itemvalue = $value[$itemname];
+ $itemnamenr = $itemname . $counter;
+ echo "{$item['description']}<br/>";
+ if (isset($item['customdrawcell'])) {
+ $item['customdrawcell']($item, $itemvalue, true, $itemnamenr);
+ } else
+ haproxy_htmllist_drawcell($item, $itemvalue, true, $itemnamenr);
+ echo "</td>";
+ $leftitem = false;
+ echo "</tr>";
+ }
+ echo "</table>";
+ echo "</div>";
+ echo "</td>";
+ echo "</tr>";
+ }
+ if (isset($itemdetails)) {
+ $colspan = count($items)-1;
+ echo "<tr id='htmltable_{$tablename}_{$counter}_details' style='$displaystyle' >";
+ echo "<td class='vtable listlr' style='border-bottom-width: medium;'> </td>";
+ echo "<td class='vtable listr' colspan='$colspan' style='border-bottom-width: medium;'>";
+ echo "</td>";
+ echo "</tr>";
+ }
+
+
+
$counter++;
}
}
@@ -136,11 +221,11 @@ function haproxy_htmllist($tablename,$values,$items,$editstate=false){
function haproxy_htmllist_js(){
?><script type="text/javascript">
- function htmllist_get_select_items(tableId) {
+ function htmllist_get_select_items(prefix,tableId) {
var items;
var i = tableId.lastIndexOf('_');
- var items_name = "fields_"+tableId.substr(i+1);
- items = eval(items_name);
+ var items_name = prefix+"_"+tableId.substr(i+1);
+ items = eval("typeof "+items_name+" !== 'undefined' ? "+items_name+" : {}");
return items;
}
@@ -150,8 +235,7 @@ function haproxy_htmllist_js(){
var btable, btbody, btr, btd;
d = document;
- items = htmllist_get_select_items(tableId);
- seltext = htmllist_get_select_options(tableId);
+ items = htmllist_get_select_items('fields',tableId);
tbody = d.getElementById(tableId).getElementsByTagName("tbody").item(0);
tr = d.createElement("tr");
@@ -165,6 +249,7 @@ function haproxy_htmllist_js(){
"' id='" + items[i]['name'] + totalrows +
"'><\/input> ";
} else if(items[i]['type'] == 'select') {
+ seltext = htmllist_get_select_options(tableId, items[i]['name']);
td.innerHTML="<select style='width:" + items[i]['size'] + "' name='" + items[i]['name'] + totalrows +
"' id='" + items[i]['name'] + totalrows +
"'>" + seltext + "<\/select> ";
@@ -178,6 +263,13 @@ function haproxy_htmllist_js(){
td.rowSpan = "1";
td.setAttribute("class","list");
+ items = htmllist_get_select_items('fields_details',tableId);
+ for (var i in items) {
+ td.innerHTML=td.innerHTML+"<input type='hidden' name='" + items[i]['name'] + totalrows +
+ "' id='" + items[i]['name'] + totalrows +
+ "'><\/input> ";
+ }
+
// Recreate the button table.
btable = document.createElement("table");
btable.setAttribute("border", "0");
@@ -204,7 +296,7 @@ function haproxy_htmllist_js(){
var dupEl;
var newEl;
addRowTo(tableId);
- items = htmllist_get_select_items(tableId);
+ items = htmllist_get_select_items('fields',tableId);
for (var i in items) {
dupEl = document.getElementById(items[i]['name'] + rowId);
newEl = document.getElementById(items[i]['name'] + totalrows);
@@ -214,6 +306,16 @@ function haproxy_htmllist_js(){
else
newEl.value = dupEl.value;
}
+ items = htmllist_get_select_items('fields_details',tableId);
+ for (var i in items) {
+ dupEl = document.getElementById(items[i]['name'] + rowId);
+ newEl = document.getElementById(items[i]['name'] + totalrows);
+ if (dupEl && newEl)
+ if(items[i]['type'] == 'checkbox')
+ newEl.value = dupEl.checked ? 'yes' : '';
+ else
+ newEl.value = dupEl.value;
+ }
}
function editRow(num) {
var trview = document.getElementById('tr_view_' + num);
@@ -223,8 +325,10 @@ function haproxy_htmllist_js(){
}
function deleteRow(rowId, tableId) {
var view = document.getElementById("tr_view_" + rowId);
+ var viewdetail = document.getElementById("tr_viewdetail_" + rowId);
var edit = document.getElementById("tr_edit_" + rowId);
view.parentNode.removeChild(view);
+ viewdetail.parentNode.removeChild(viewdetail);
edit.parentNode.removeChild(edit);
}
function removeRow(el) {
@@ -240,6 +344,16 @@ function haproxy_htmllist_js(){
el.parentNode.removeChild(el);
}
}
+
+ function htmltable_toggle_details(table_row_detail_id) {
+ tredit = document.getElementById(table_row_detail_id+'_off');
+ trviewdetail = document.getElementById(table_row_detail_id+'_edit');
+ treditdetail = document.getElementById(table_row_detail_id+'_view');
+ current_on = tredit.style.display == 'none';
+ tredit.style.display=current_on ? '' : 'none';
+ trviewdetail.style.display=current_on ? 'none' : '';
+ treditdetail.style.display=current_on ? '' : 'none';
+ }
</script><?
}
diff --git a/config/haproxy-devel/haproxy_listeners.php b/config/haproxy-devel/haproxy_listeners.php
index 7022ec34..1deabdbb 100644
--- a/config/haproxy-devel/haproxy_listeners.php
+++ b/config/haproxy-devel/haproxy_listeners.php
@@ -134,10 +134,12 @@ include("head.inc");
$img_cert = "/themes/{$g['theme']}/images/icons/icon_frmfld_cert.png";
$img_adv = "/themes/{$g['theme']}/images/icons/icon_advanced.gif";
$img_acl = "/themes/{$g['theme']}/images/icons/icon_ts_rule.gif";
+ $textgray = "";
+ $first = true;
$last_frontend_shared = false;
foreach ($a_frontend_grouped as $a_frontend) {
usort($a_frontend,'sort_sharedfrontends');
- if (count($a_frontend) > 1 || $last_frontend_shared) {
+ if ((count($a_frontend) > 1 || $last_frontend_shared) && !$first) {
?> <tr class="<?=$textgray?>"><td colspan="7">&nbsp;</td></tr> <?
}
$last_frontend_shared = count($a_frontend) > 1;
@@ -151,11 +153,19 @@ include("head.inc");
</td>
<td class="listlr" ondblclick="document.location='haproxy_listeners_edit.php?id=<?=$frontendname;?>';">
<?
+ $acls = get_frontend_acls($frontend);
+ $isaclset = "";
+ foreach ($acls as $acl) {
+ $isaclset .= "&#10;" . htmlspecialchars($acl['descr']);
+ }
+ if ($isaclset)
+ echo "<img src=\"$img_acl\" title=\"" . gettext("acl's used") . ": {$isaclset}\" border=\"0\" />";
+
if (strtolower($frontend['type']) == "http" && $frontend['ssloffload']) {
$cert = lookup_cert($frontend['ssloffloadcert']);
$descr = htmlspecialchars($cert['descr']);
- $certs = $frontend['ha_certificates']['item'];
- if (is_array($certs)){
+ if (is_array($frontend['ha_certificates']) && is_array($frontend['ha_certificates']['item'])) {
+ $certs = $frontend['ha_certificates']['item'];
if (count($certs) > 0){
foreach($certs as $certitem){
$cert = lookup_cert($certitem['ssl_certificate']);
@@ -166,15 +176,6 @@ include("head.inc");
echo '<img src="'.$img_cert.'" title="SSL offloading cert: '.$descr.'" alt="SSL offloading" border="0" height="16" width="16" />';
}
- $acls = get_frontend_acls($frontend);
- $isaclset = "";
- foreach ($acls as $acl) {
- $isaclset .= "&#10;" . htmlspecialchars($acl['descr']);
- }
-
- if ($isaclset)
- echo "<img src=\"$img_acl\" title=\"" . gettext("acl's used") . ": {$isaclset}\" border=\"0\" />";
-
$isadvset = "";
if ($frontend['advanced_bind']) $isadvset .= "Advanced bind: ".htmlspecialchars($frontend['advanced_bind'])."\r\n";
if ($frontend['advanced']) $isadvset .= "Advanced pass thru setting used\r\n";
@@ -183,12 +184,15 @@ include("head.inc");
$backend_serverpool = $frontend['backend_serverpool'];
$backend = get_backend($backend_serverpool );
- if ($backend && is_array($backend['ha_servers']['item'])){
+ if ($backend && is_array($backend['ha_servers']) && is_array($backend['ha_servers']['item'])){
$servers = $backend['ha_servers']['item'];
$backend_serverpool_hint = gettext("Servers in pool:");
if (is_array($servers)){
foreach($servers as $server){
- $backend_serverpool_hint .= "\n".$server['address'].":".$server['port'];
+ if (isset($server['forwardto']) && $server['forwardto'] != "")
+ $backend_serverpool_hint .= "\n[".$server['forwardto']."]";
+ else
+ $backend_serverpool_hint .= "\n".$server['address'].":".$server['port'];
}
}
}
@@ -208,7 +212,9 @@ include("head.inc");
</td>
<td class="listlr" ondblclick="document.location='haproxy_listeners_edit.php?id=<?=$frontendname;?>';">
<div title='<?=$backend_serverpool_hint;?>'>
+ <a href="haproxy_pool_edit.php?id=<?=$frontend['backend_serverpool']?>">
<?=$frontend['backend_serverpool']?>
+ </a>
</div>
</td>
<td class="listlr" ondblclick="document.location='haproxy_listeners_edit.php?id=<?=$frontendname;?>';">
diff --git a/config/haproxy-devel/haproxy_listeners_edit.php b/config/haproxy-devel/haproxy_listeners_edit.php
index 78423f6d..d243ffb1 100644
--- a/config/haproxy-devel/haproxy_listeners_edit.php
+++ b/config/haproxy-devel/haproxy_listeners_edit.php
@@ -52,7 +52,7 @@ function haproxy_js_acl_select($mode) {
$seltext = '';
foreach ($a_acltypes as $key => $expr) {
if ($expr['mode'] == '' || $expr['mode'] == $mode)
- $seltext .= "<option value='" . $key . "'>" . $expr['name'] .":<\/option>";
+ $seltext .= "<option value='" . $key . "'>" . $expr['name'] ."<\/option>";
}
return $seltext;
}
@@ -63,10 +63,13 @@ if (!is_array($config['installedpackages']['haproxy']['ha_backends']['item'])) {
$a_backend = &$config['installedpackages']['haproxy']['ha_backends']['item'];
$a_pools = &$config['installedpackages']['haproxy']['ha_pools']['item'];
+uasort($a_pools, haproxy_compareByName);
global $simplefields;
$simplefields = array('name','desc','status','secondary','primary_frontend','type','forwardfor','httpclose','extaddr','backend_serverpool',
- 'max_connections','client_timeout','port','ssloffloadcert','dcertadv','ssloffload','ssloffloadacl','advanced_bind','ssloffloadacladditional');
+ 'max_connections','client_timeout','port','ssloffloadcert','dcertadv','ssloffload','ssloffloadacl','ssloffloadaclnondefault','advanced_bind',
+ 'ssloffloadacladditional','ssloffloadacladditionalnondefault',
+ 'dontlognull','dontlog-normal','log-separate-errors','log-detailed');
if (isset($_POST['id']))
$id = $_POST['id'];
@@ -84,8 +87,7 @@ if (!is_numeric($id))
$pconfig['ssloffloadacl'] = "yes";
}
-$servercerts = get_certificates_server();
-
+$servercerts = haproxy_get_certificates('server,user');
$fields_sslCertificates=array();
$fields_sslCertificates[0]['name']="ssl_certificate";
$fields_sslCertificates[0]['columnheader']="Certificates";
@@ -94,6 +96,28 @@ $fields_sslCertificates[0]['type']="select";
$fields_sslCertificates[0]['size']="500px";
$fields_sslCertificates[0]['items']=&$servercerts;
+$certs_ca = haproxy_get_certificates('ca');
+$ca_none['']['name']="None";
+$certs_ca = $ca_none + $certs_ca;
+$fields_caCertificates=array();
+$fields_caCertificates[0]['name']="cert_ca";
+$fields_caCertificates[0]['columnheader']="Certificates authorities";
+$fields_caCertificates[0]['colwidth']="95%";
+$fields_caCertificates[0]['type']="select";
+$fields_caCertificates[0]['size']="500px";
+$fields_caCertificates[0]['items']=&$certs_ca;
+
+$certs_crl = haproxy_get_crls();
+$ca_none['']['name']="None";
+$certs_crl = $ca_none + $certs_crl;
+$fields_crlCertificates=array();
+$fields_crlCertificates[0]['name']="cert_crl";
+$fields_crlCertificates[0]['columnheader']="Certificate revocation lists";
+$fields_crlCertificates[0]['colwidth']="95%";
+$fields_crlCertificates[0]['type']="select";
+$fields_crlCertificates[0]['size']="500px";
+$fields_crlCertificates[0]['items']=&$certs_crl;
+
$fields_aclSelectionList=array();
$fields_aclSelectionList[0]['name']="name";
$fields_aclSelectionList[0]['columnheader']="Name";
@@ -114,17 +138,21 @@ $fields_aclSelectionList[2]['colwidth']="35%";
$fields_aclSelectionList[2]['type']="textbox";
$fields_aclSelectionList[2]['size']="35";
-
if (isset($id) && $a_backend[$id]) {
$pconfig['a_acl']=&$a_backend[$id]['ha_acls']['item'];
$pconfig['a_certificates']=&$a_backend[$id]['ha_certificates']['item'];
+ $pconfig['clientcert_ca']=&$a_backend[$id]['clientcert_ca']['item'];
+ $pconfig['clientcert_crl']=&$a_backend[$id]['clientcert_crl']['item'];
$pconfig['advanced'] = base64_decode($a_backend[$id]['advanced']);
foreach($simplefields as $stat)
$pconfig[$stat] = $a_backend[$id][$stat];
}
-if (isset($_GET['dup']))
+if (isset($_GET['dup'])) {
unset($id);
+ if ($pconfig['secondary'] != 'yes')
+ $pconfig['primary_frontend'] = $pconfig['name'];
+}
$changedesc = "Services: HAProxy: Frontend";
$changecount = 0;
@@ -135,7 +163,6 @@ if ($_POST) {
unset($input_errors);
$pconfig = $_POST;
-
if ($pconfig['secondary'] != "yes") {
$reqdfields = explode(" ", "name type port");
$reqdfieldsn = explode(",", "Name,Type,Port");
@@ -173,6 +200,10 @@ if ($_POST) {
$a_certificates = haproxy_htmllist_get_values($fields_sslCertificates);
$pconfig['a_certificates'] = $a_certificates;
+ $a_clientcert_ca = haproxy_htmllist_get_values($fields_caCertificates);
+ $pconfig['a_clientcert_ca'] = $a_clientcert_ca;
+ $a_clientcert_crl = haproxy_htmllist_get_values($fields_crlCertificates);
+ $pconfig['a_clientcert_crl'] = $a_clientcert_crl;
$a_acl = haproxy_htmllist_get_values($fields_aclSelectionList);
$pconfig['a_acl'] = $a_acl;
@@ -214,6 +245,8 @@ if ($_POST) {
update_if_changed("advanced", $backend['advanced'], base64_encode($_POST['advanced']));
$backend['ha_acls']['item'] = $a_acl;
$backend['ha_certificates']['item'] = $a_certificates;
+ $backend['clientcert_ca']['item'] = $a_clientcert_ca;
+ $backend['clientcert_crl']['item'] = $a_clientcert_crl;
if (isset($id) && $a_backend[$id]) {
$a_backend[$id] = $backend;
@@ -262,7 +295,7 @@ $interfaces = haproxy_get_bindable_interfaces();
<?php endif; ?>
<script type="text/javascript">
- function htmllist_get_select_options(tableId) {
+ function htmllist_get_select_options(tableId, fieldname) {
var seltext;
seltext = "";
var type;
@@ -290,6 +323,12 @@ $interfaces = haproxy_get_bindable_interfaces();
if (tableId == 'tableA_sslCertificates'){
seltext = "<?=haproxy_js_select_options($servercerts);?>";
}
+ if (tableId == 'table_clientcert_ca'){
+ seltext = "<?=haproxy_js_select_options($certs_ca);?>";
+ }
+ if (tableId == 'table_clientcert_crl'){
+ seltext = "<?=haproxy_js_select_options($certs_crl);?>";
+ }
return seltext;
}
@@ -511,6 +550,48 @@ $interfaces = haproxy_get_bindable_interfaces();
For more information about ACL's please see <a href='http://haproxy.1wt.eu/download/1.5/doc/configuration.txt' target='_blank'>HAProxy Documentation</a> Section 7 - Using ACL's
</td>
</tr>
+ <tr class="haproxy_primary"><td>&nbsp;</td></tr>
+ <tr class="haproxy_primary">
+ <td colspan="2" valign="top" class="listtopic">Logging options</td>
+ </tr>
+ <tr class="haproxy_primary" align="left">
+ <td width="22%" valign="top" class="vncell">Dont log null</td>
+ <td width="78%" class="vtable" colspan="2">
+ <input id="dontlognull" name="dontlognull" type="checkbox" value="yes" <?php if ($pconfig['dontlognull']=='yes') echo "checked"; ?> onclick='updatevisibility();' />
+ A connection on which no data has been transferred will not be logged.
+ <div>To skip logging probes from monitoring systems that otherwise would pollute the logging. (It is generally recommended not to use this option in uncontrolled environments (eg: internet), otherwise scans and other malicious activities would not be logged.)</div>
+ </td>
+ </tr>
+ <tr class="haproxy_primary" align="left">
+ <td width="22%" valign="top" class="vncell">Dont log normal</td>
+ <td width="78%" class="vtable" colspan="2">
+ <input id="dontlog-normal" name="dontlog-normal" type="checkbox" value="yes" <?php if ($pconfig['dontlog-normal']=='yes') echo "checked"; ?> onclick='updatevisibility();' />
+ Don't log connections in which no anomalies are found.
+ <div>Setting this option ensures that
+ normal connections, those which experience no error, no timeout, no retry nor
+ redispatch, will not be logged.</div>
+ </td>
+ </tr>
+ <tr class="haproxy_primary" align="left">
+ <td width="22%" valign="top" class="vncell">Raise level for errors</td>
+ <td width="78%" class="vtable" colspan="2">
+ <input id="log-separate-errors" name="log-separate-errors" type="checkbox" value="yes" <?php if ($pconfig['log-separate-errors']=='yes') echo "checked"; ?> onclick='updatevisibility();' />
+ Change the level changes from "info" to "err" for potentially interesting information.
+ <div>This option makes haproxy raise the level of logs containing potentially interesting information such
+ as errors, timeouts, retries, redispatches, or HTTP status codes 5xx. </div>
+ </td>
+ </tr>
+ <tr class="haproxy_primary" align="left">
+ <td width="22%" valign="top" class="vncell">Detailed logging</td>
+ <td width="78%" class="vtable" colspan="2">
+ <input id="log-detailed" name="log-detailed" type="checkbox" value="yes" <?php if ($pconfig['log-detailed']=='yes') echo "checked"; ?> onclick='updatevisibility();' />
+ If checked provides more detailed logging.
+ <div>Each log line turns into a much richer format including, but
+ not limited to, the connection timers, the session status, the connections
+ numbers, the frontend, backend and server name, and of course the source
+ address and ports. In http mode also the HTTP request and captured headers and cookies will be logged.</div>
+ </td>
+ </tr>
</table>
<br/>&nbsp;<br/>
<table class="haproxy_primary" width="100%" border="0" cellpadding="6" cellspacing="0">
@@ -592,7 +673,8 @@ $interfaces = haproxy_get_bindable_interfaces();
<br/>
NOTE: choose the cert to use on this frontend.
<br/>
- <input id="ssloffloadacl" name="ssloffloadacl" type="checkbox" value="yes" <?php if ($pconfig['ssloffloadacl']=='yes') echo "checked";?> onclick="updatevisibility();" />Add ACL for certificate CommonName.
+ <input id="ssloffloadacl" name="ssloffloadacl" type="checkbox" value="yes" <?php if ($pconfig['ssloffloadacl']=='yes') echo "checked";?> onclick="updatevisibility();" />Add ACL for certificate CommonName. (host header matches 'CN')<br/>
+ <input id="ssloffloadaclnondefault" name="ssloffloadaclnondefault" type="checkbox" value="yes" <?php if ($pconfig['ssloffloadaclnondefault']=='yes') echo "checked";?> onclick="updatevisibility();" />Add ACL for certificate CommonName for nondefault ports. (host header starts with 'CN:')
</td>
</tr>
<tr class="haproxy_ssloffloading_enabled">
@@ -604,7 +686,8 @@ $interfaces = haproxy_get_bindable_interfaces();
haproxy_htmllist("tableA_sslCertificates", $a_certificates, $fields_sslCertificates);
?>
<br/>
- <input id="ssloffloadacladditional" name="ssloffloadacladditional" type="checkbox" value="yes" <?php if ($pconfig['ssloffloadacladditional']=='yes') echo "checked";?> onclick="updatevisibility();" />Add ACL for certificate CommonName.
+ <input id="ssloffloadacladditional" name="ssloffloadacladditional" type="checkbox" value="yes" <?php if ($pconfig['ssloffloadacladditional']=='yes') echo "checked";?> onclick="updatevisibility();" />Add ACL for certificate CommonName. (host header matches 'CN')<br/>
+ <input id="ssloffloadacladditionalnondefault" name="ssloffloadacladditionalnondefault" type="checkbox" value="yes" <?php if ($pconfig['ssloffloadacladditionalnondefault']=='yes') echo "checked";?> onclick="updatevisibility();" />Add ACL for certificate CommonName for nondefault ports. (host header starts with 'CN:')
</td>
</tr>
<tr class="haproxy_ssloffloading_enabled haproxy_primary" align="left">
@@ -616,6 +699,29 @@ $interfaces = haproxy_get_bindable_interfaces();
some options: force-sslv3, force-tlsv10 force-tlsv11 force-tlsv12 no-sslv3 no-tlsv10 no-tlsv11 no-tlsv12 no-tls-tickets
</td>
</tr>
+ <tr class="haproxy_ssloffloading_enabled haproxy_primary">
+ <td class="vncell" colspan="2"><b>Client certificate verification options, leave this empty if you do want to ask for a client certificate</b></td>
+ </tr>
+ <tr class="haproxy_ssloffloading_enabled haproxy_primary">
+ <td width="22%" valign="top" class="vncell">Client verification CA certificates</td>
+ <td width="78%" class="vtable" colspan="2" valign="top">
+ Client certificate will be verified against these CA certificates.
+ <?
+ $a_certificates = $pconfig['clientcert_ca'];
+ haproxy_htmllist("table_clientcert_ca", $a_certificates, $fields_caCertificates);
+ ?>
+ </td>
+ </tr>
+ <tr class="haproxy_ssloffloading_enabled haproxy_primary">
+ <td width="22%" valign="top" class="vncell">Client verification CRL</td>
+ <td width="78%" class="vtable" colspan="2" valign="top">
+ Client certificate will be verified against these CRL revocation lists.
+ <?
+ $a_certificates = $pconfig['clientcert_crl'];
+ haproxy_htmllist("table_clientcert_crl", $a_certificates, $fields_crlCertificates);
+ ?>
+ </td>
+ </tr>
<tr>
<td>&nbsp;</td>
</tr>
@@ -645,6 +751,8 @@ $interfaces = haproxy_get_bindable_interfaces();
phparray_to_javascriptarray($primaryfrontends,"primaryfrontends",Array('/*','/*/name','/*/ref','/*/ref/type','/*/ref/ssloffload'));
phparray_to_javascriptarray($a_closetypes,"closetypes",Array('/*','/*/name','/*/descr'));
phparray_to_javascriptarray($fields_sslCertificates,"fields_sslCertificates",Array('/*','/*/name','/*/type','/*/size','/*/items','/*/items/*','/*/items/*/*','/*/items/*/*/name'));
+ phparray_to_javascriptarray($fields_caCertificates,"fields_ca",Array('/*','/*/name','/*/type','/*/size','/*/items','/*/items/*','/*/items/*/*','/*/items/*/*/name'));
+ phparray_to_javascriptarray($fields_crlCertificates,"fields_crl",Array('/*','/*/name','/*/type','/*/size','/*/items','/*/items/*','/*/items/*/*','/*/items/*/*/name'));
phparray_to_javascriptarray($fields_aclSelectionList,"fields_acltable",Array('/*','/*/name','/*/type','/*/size','/*/items','/*/items/*','/*/items/*/*','/*/items/*/*/name'));
?>
</script>
diff --git a/config/haproxy-devel/haproxy_pool_edit.php b/config/haproxy-devel/haproxy_pool_edit.php
index cabc6e52..30079847 100644
--- a/config/haproxy-devel/haproxy_pool_edit.php
+++ b/config/haproxy-devel/haproxy_pool_edit.php
@@ -46,6 +46,10 @@ if (isset($_POST['id']))
$id = $_POST['id'];
else
$id = $_GET['id'];
+
+$tmp = get_backend_id($id);
+if (is_numeric($tmp))
+ $id = $tmp;
if (isset($_GET['dup']))
$id = $_GET['dup'];
@@ -53,57 +57,120 @@ if (isset($_GET['dup']))
global $simplefields;
$simplefields = array(
"name","balance","transparent_clientip","transparent_interface",
-"check_type","checkinter","httpcheck_method","monitor_uri","monitor_httpversion","monitor_username","monitor_domain","monitor_agentport",
+"check_type","checkinter","log-health-checks","httpcheck_method","monitor_uri","monitor_httpversion","monitor_username","monitor_domain","monitor_agentport",
"agent_check","agent_port","agent_inter",
"connection_timeout","server_timeout","retries",
"stats_enabled","stats_username","stats_password","stats_uri","stats_scope","stats_realm","stats_admin","stats_node","stats_desc","stats_refresh",
"persist_stick_expire","persist_stick_tablesize","persist_stick_length","persist_stick_cookiename","persist_sticky_type",
"persist_cookie_enabled","persist_cookie_name","persist_cookie_mode","persist_cookie_cachable",
-"strict_transport_security"
+"strict_transport_security","cookie_attribute_secure"
);
+$primaryfrontends = get_haproxy_frontends();
+$none = array();
+$none['']['name']="Address+Port:";
+$primaryfrontends = $none + $primaryfrontends;
+
$fields_servers=array();
$fields_servers[0]['name']="status";
$fields_servers[0]['columnheader']="Mode";
$fields_servers[0]['colwidth']="5%";
$fields_servers[0]['type']="select";
-$fields_servers[0]['size']="5";
+$fields_servers[0]['size']="70px";
$fields_servers[0]['items']=&$a_servermodes;
$fields_servers[1]['name']="name";
$fields_servers[1]['columnheader']="Name";
$fields_servers[1]['colwidth']="20%";
$fields_servers[1]['type']="textbox";
$fields_servers[1]['size']="30";
-$fields_servers[2]['name']="address";
-$fields_servers[2]['columnheader']="Address";
-$fields_servers[2]['colwidth']="10%";
-$fields_servers[2]['type']="textbox";
-$fields_servers[2]['size']="20";
-$fields_servers[3]['name']="port";
-$fields_servers[3]['columnheader']="Port";
-$fields_servers[3]['colwidth']="5%";
+$fields_servers[2]['name']="forwardto";
+$fields_servers[2]['columnheader']="Forwardto";
+$fields_servers[2]['colwidth']="15%";
+$fields_servers[2]['type']="select";
+$fields_servers[2]['size']="100px";
+$fields_servers[2]['items']=&$primaryfrontends;
+$fields_servers[3]['name']="address";
+$fields_servers[3]['columnheader']="Address";
+$fields_servers[3]['colwidth']="10%";
$fields_servers[3]['type']="textbox";
-$fields_servers[3]['size']="5";
-$fields_servers[4]['name']="ssl";
-$fields_servers[4]['columnheader']="SSL";
+$fields_servers[3]['size']="20";
+$fields_servers[4]['name']="port";
+$fields_servers[4]['columnheader']="Port";
$fields_servers[4]['colwidth']="5%";
-$fields_servers[4]['type']="checkbox";
-$fields_servers[4]['size']="30";
-$fields_servers[5]['name']="weight";
-$fields_servers[5]['columnheader']="Weight";
-$fields_servers[5]['colwidth']="8%";
-$fields_servers[5]['type']="textbox";
-$fields_servers[5]['size']="5";
-$fields_servers[6]['name']="cookie";
-$fields_servers[6]['columnheader']="Cookie";
-$fields_servers[6]['colwidth']="10%";
+$fields_servers[4]['type']="textbox";
+$fields_servers[4]['size']="5";
+$fields_servers[5]['name']="ssl";
+$fields_servers[5]['columnheader']="SSL";
+$fields_servers[5]['colwidth']="5%";
+$fields_servers[5]['type']="checkbox";
+$fields_servers[5]['size']="30";
+$fields_servers[6]['name']="weight";
+$fields_servers[6]['columnheader']="Weight";
+$fields_servers[6]['colwidth']="8%";
$fields_servers[6]['type']="textbox";
-$fields_servers[6]['size']="10";
-$fields_servers[7]['name']="advanced";
-$fields_servers[7]['columnheader']="Advanced";
-$fields_servers[7]['colwidth']="15%";
-$fields_servers[7]['type']="textbox";
-$fields_servers[7]['size']="20";
+$fields_servers[6]['size']="5";
+
+$listitem_none['']['name']="None";
+
+$certs_ca = haproxy_get_certificates('ca');
+$certs_ca = $listitem_none + $certs_ca;
+$certs_client = haproxy_get_certificates('server,user');
+$certs_client = $listitem_none + $certs_client;
+$certs_crl = haproxy_get_crls();
+$certs_crl = $listitem_none + $certs_crl;
+
+$fields_servers_details=array();
+$fields_servers_details[0]['name']="sslserververify";
+$fields_servers_details[0]['columnheader']="Check certificate";
+$fields_servers_details[0]['description']="SSL servers only, The server certificate will be verified against the CA and CRL certificate configured below.";
+$fields_servers_details[0]['colwidth']="5%";
+$fields_servers_details[0]['type']="checkbox";
+$fields_servers_details[0]['size']="5";
+$fields_servers_details[1]['name']="verifyhost";
+$fields_servers_details[1]['columnheader']="Certificate check CN";
+$fields_servers_details[1]['description']="SSL servers only, when set, must match the hostnames in the subject and subjectAlternateNames of the certificate provided by the server.";
+$fields_servers_details[1]['colwidth']="5%";
+$fields_servers_details[1]['type']="textbox";
+$fields_servers_details[1]['size']="50";
+$fields_servers_details[2]['name']="ssl-server-ca";
+$fields_servers_details[2]['columnheader']="CA";
+$fields_servers_details[2]['description']="SSL servers only, Select the CA authority to check the server certificate against.";
+$fields_servers_details[2]['colwidth']="15%";
+$fields_servers_details[2]['type']="select";
+$fields_servers_details[2]['size']="200px";
+$fields_servers_details[2]['items']=$certs_ca;
+$fields_servers_details[3]['name']="ssl-server-crl";
+$fields_servers_details[3]['columnheader']="CRL";
+$fields_servers_details[3]['description']="SSL servers only, Select the CRL to check revoked certificates.";
+$fields_servers_details[3]['colwidth']="15%";
+$fields_servers_details[3]['type']="select";
+$fields_servers_details[3]['size']="200px";
+$fields_servers_details[3]['items']=$certs_crl;
+$fields_servers_details[4]['name']="ssl-server-clientcert";
+$fields_servers_details[4]['columnheader']="Client certificate";
+$fields_servers_details[4]['description']="SSL servers only, This certificate will be sent if the server send a client certificate request.";
+$fields_servers_details[4]['colwidth']="15%";
+$fields_servers_details[4]['type']="select";
+$fields_servers_details[4]['size']="200px";
+$fields_servers_details[4]['items']=$certs_client;
+$fields_servers_details[5]['name']="cookie";
+$fields_servers_details[5]['columnheader']="Cookie";
+$fields_servers_details[5]['description']="Persistence only, Used to identify server when cookie persistence is configured for the backend.";
+$fields_servers_details[5]['colwidth']="10%";
+$fields_servers_details[5]['type']="textbox";
+$fields_servers_details[5]['size']="10";
+$fields_servers_details[6]['name']="maxconn";
+$fields_servers_details[6]['columnheader']="Max conn";
+$fields_servers_details[6]['description']="Tuning, If the number of incoming concurrent requests goes higher than this value, they will be queued";
+$fields_servers_details[6]['colwidth']="15%";
+$fields_servers_details[6]['type']="textbox";
+$fields_servers_details[6]['size']="10";
+$fields_servers_details[7]['name']="advanced";
+$fields_servers_details[7]['columnheader']="Advanced";
+$fields_servers_details[7]['description']="Advanced, Allows for adding custom HAProxy settings to the server. These are passed as written, use escaping where needed.";
+$fields_servers_details[7]['colwidth']="15%";
+$fields_servers_details[7]['type']="textbox";
+$fields_servers_details[7]['size']="80";
if (isset($id) && $a_pools[$id]) {
$pconfig['advanced'] = base64_decode($a_pools[$id]['advanced']);
@@ -129,26 +196,16 @@ if ($_POST) {
$reqdfields = explode(" ", "name");
$reqdfieldsn = explode(",", "Name");
- $pf_version=substr(trim(file_get_contents("/etc/version")),0,3);
- if ($pf_version < 2.1)
- $input_errors = eval('do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); return $input_errors;');
- else
- do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
if ($_POST['stats_enabled']) {
$reqdfields = explode(" ", "name stats_uri");
$reqdfieldsn = explode(",", "Name,Stats Uri");
- if ($pf_version < 2.1)
- $input_errors = eval('do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); return $input_errors;');
- else
- do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
if ($_POST['stats_username']) {
$reqdfields = explode(" ", "stats_password stats_realm");
$reqdfieldsn = explode(",", "Stats Password,Stats Realm");
- if ($pf_version < 2.1)
- $input_errors = eval('do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); return $input_errors;');
- else
- do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
}
}
@@ -183,7 +240,7 @@ if ($_POST) {
if (($_POST['name'] == $config['installedpackages']['haproxy']['ha_pools']['item'][$i]['name']) && ($i != $id))
$input_errors[] = "This pool name has already been used. Pool names must be unique.";
- $a_servers = haproxy_htmllist_get_values($fields_servers);
+ $a_servers = haproxy_htmllist_get_values(array_merge($fields_servers,$fields_servers_details));
foreach($a_servers as $server){
$server_name = $server['name'];
$server_address = $server['address'];
@@ -193,8 +250,14 @@ if ($_POST) {
if (preg_match("/[^a-zA-Z0-9\.\-_]/", $server_name))
$input_errors[] = "The field 'Name' contains invalid characters.";
- if (!is_ipaddr($server_address) && !is_hostname($server_address))
- $input_errors[] = "The field 'Address' is not a valid ip address or hostname.";
+ if (!isset($server['forwardto']) || $server['forwardto'] == "") {
+ if (!is_ipaddr($server_address) && !is_hostname($server_address) && !haproxy_is_frontendname($server_address))
+ $input_errors[] = "The field 'Address' for server $server_name is not a valid ip address or hostname." . $server_address;
+ } else {
+ if ( ($server_address && $server_address != "") || ($server_port && !is_numeric($server_port))) {
+ $input_errors[] = "'Address' and 'port' should be empty when a 'Forwardto' frontend is chosen other than 'Address+Port'.";
+ }
+ }
if (!preg_match("/.{2,}/", $server_name))
$input_errors[] = "The field 'Name' is required (and must be at least 2 characters).";
@@ -209,7 +272,7 @@ if ($_POST) {
if ($_POST['strict_transport_security'] !== "" && !is_numeric($_POST['strict_transport_security']))
$input_errors[] = "The field 'Strict-Transport-Security' is not empty or a number.";
- if (!$input_errors) {
+// if (!$input_errors) {
$pool = array();
if(isset($id) && $a_pools[$id])
$pool = $a_pools[$id];
@@ -244,7 +307,7 @@ if ($_POST) {
} else {
$a_pools[] = $pool;
}
-
+ if (!isset($input_errors)) {
if ($changecount > 0) {
touch($d_haproxyconfdirty_path);
write_config($changedesc);
@@ -261,10 +324,6 @@ if ($_POST) {
$pconfig['a_servers']=&$a_pools[$id]['ha_servers']['item'];
}
-$pf_version=substr(trim(file_get_contents("/etc/version")),0,3);
-if ($pf_version < 2.0)
- $one_two = true;
-
$closehead = false;
$pgtitle = "HAProxy: Backend server pool: Edit";
include("head.inc");
@@ -276,6 +335,7 @@ foreach($simplefields as $field){
?>
<style type="text/css">
+ .tableA_servers_details_visible{display:none;}
.haproxy_stats_visible{display:none;}
.haproxy_check_enabled{display:none;}
.haproxy_check_http{display:none;}
@@ -292,8 +352,11 @@ foreach($simplefields as $field){
</head>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<script type="text/javascript">
- function htmllist_get_select_options(tableId) {
- return "<?=haproxy_js_select_options($a_servermodes);?>";
+ function htmllist_get_select_options(tableId, fieldname) {
+ if (fieldname == 'forwardto')
+ return "<?=haproxy_js_select_options($primaryfrontends);?>";
+ else
+ return "<?=haproxy_js_select_options($a_servermodes);?>";
}
function clearcombo(){
@@ -331,6 +394,7 @@ foreach($simplefields as $field){
function updatevisibility()
{
d = document;
+ setCSSdisplay(".tableA_servers_details_visible", server_advanced_options_visible.checked);
setCSSdisplay(".haproxy_stats_visible", stats_enabled.checked);
setCSSdisplay(".haproxy_cookie_visible", persist_cookie_enabled.checked);
@@ -375,10 +439,7 @@ foreach($simplefields as $field){
}
</script>
<?php include("fbegin.inc"); ?>
-<?php if ($input_errors) print_input_errors($input_errors); ?>
-<?php if($one_two): ?>
-<p class="pgtitle"><?=$pgtitle?></p>
-<?php endif; ?>
+<?php if (isset($input_errors)) print_input_errors($input_errors); ?>
<form action="haproxy_pool_edit.php" method="post" name="iform" id="iform">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
@@ -401,14 +462,14 @@ foreach($simplefields as $field){
</td>
</tr>
<tr align="left">
- <td class="vncell" colspan="3"><strong>Server list</strong>
+ <td class="vncell" colspan="3"><strong>Server list</strong><input id="server_advanced_options_visible" name="server_advanced_options_visible" type='checkbox' onclick="updatevisibility();">Show advanced options(servers need to first be saved to configure these settings)</input>
<span style="float:right;">
Toggle serverlist help. <a onclick="toggleCSSdisplay('.haproxy_help_serverlist');" title="<?php echo gettext("Help"); ?>"><img style="vertical-align:middle" src="/themes/<?php echo $g['theme']; ?>/images/icons/icon_help.gif" border="0" alt="help" /></a>
</span>
<?
$counter=0;
$a_servers = $pconfig['a_servers'];
- haproxy_htmllist("tableA_servers", $a_servers, $fields_servers);
+ haproxy_htmllist("tableA_servers", $a_servers, $fields_servers, null, $fields_servers_details);
?>
<table class="haproxy_help_serverlist" style="border:1px dashed green" cellspacing="0">
<tr><td class="vncell">
@@ -521,10 +582,11 @@ foreach($simplefields as $field){
</div>
<br/>
Connect transparently to the backend server's so the connection seams to come straight from the client ip address.
- For proper workings this requires the reply's traffic to pass through pfSense by means of correct routing.
- (uses the option "source 0.0.0.0 usesrc clientip")
+ To work properly this requires the reply traffic to pass through pfSense by means of correct routing.<br/>
+ When using IPv6 only routable ip addresses can be used, host names or link-local addresses (FE80) will not work.<br/>
+ (uses the option "source 0.0.0.0 usesrc clientip" or "source ipv6@ usesrc clientip")
<br/><br/>
- Note : When this is enabled for a single backend HAProxy will run as 'root' instead of chrooting to a lower privileged user, this reduces security in case of a a bit.
+ Note : When this is enabled for any backend HAProxy will run as 'root' instead of chrooting to a lower privileged user, this reduces security in case a vulnerability is found.
</td>
</tr>
<tr align="left">
@@ -565,6 +627,15 @@ foreach($simplefields as $field){
<br/>For HTTP/HTTPS defaults to 1000 if left blank. For TCP no check will be performed if left empty.
</td>
</tr>
+ <tr align="left" class="haproxy_check_enabled">
+ <td width="22%" valign="top" class="vncell">Log checks</td>
+ <td width="78%" class="vtable" colspan="2">
+ <input id="log-health-checks" name="log-health-checks" type="checkbox" value="yes" <?php if ($pconfig['log-health-checks']=='yes') echo "checked"; ?> onclick='updatevisibility();' />
+ When this option is enabled, any change of the health check status or to the server's health will be logged.
+ <br/>
+ By default, failed health check are logged if server is UP and successful health checks are logged if server is DOWN, so the amount of additional information is limited.
+ </td>
+ </tr>
<tr align="left" class="haproxy_check_http">
<td width="22%" valign="top" class="vncell">Http check method</td>
<td width="78%" class="vtable" colspan="2">
@@ -774,6 +845,7 @@ set by the 'retries' parameter.</div>
<td width="22%" valign="top" class="vncell">Stats Enabled</td>
<td width="78%" class="vtable" colspan="2">
<input id="stats_enabled" name="stats_enabled" type="checkbox" value="yes" <?php if ($pconfig['stats_enabled']=='yes') echo "checked"; ?> onclick='updatevisibility();' />
+ Enables the haproxy statistics page (only used on 'http' frontends)
</td>
</tr>
<tr class="haproxy_stats_visible" align="left" id='stats_uri_row'>
@@ -853,7 +925,7 @@ set by the 'retries' parameter.</div>
<tr class="" align="left" id='Strict-Transport-Security'>
<td width="22%" valign="top" class="vncell">Strict-Transport-Security</td>
<td width="78%" class="vtable" colspan="2">
- When configured enables "HTTP Strict Transport Security" leave empty to disable.<br/>
+ When configured enables "HTTP Strict Transport Security" leave empty to disable. (only used on 'http' frontends)<br/>
<b>WARNING! the domain will only work over https with a valid certificate!</b><br/>
<input id="strict_transport_security" name="strict_transport_security" type="text" <?if(isset($pconfig['strict_transport_security'])) echo "value=\"{$pconfig['strict_transport_security']}\"";?> size="20" /> Seconds<br/>
If configured clients that requested the page with this setting active will not be able to visit this domain over a unencrypted http connection.
@@ -861,6 +933,14 @@ set by the 'retries' parameter.</div>
EXAMPLE: 60 for testing if you are absolutely sure you want this 31536000 (12 months) would be good for production.
</td>
</tr>
+ <tr class="" align="left">
+ <td width="22%" valign="top" class="vncell">Cookie protection.</td>
+ <td width="78%" class="vtable" colspan="2">
+ <input id="cookie_attribute_secure" name="cookie_attribute_secure" type="checkbox" value="yes" <?php if ($pconfig['cookie_attribute_secure']=='yes') echo "checked"; ?> onclick='updatevisibility();' />
+ Set 'secure' attribure on cookies (only used on 'http' frontends)<br/>
+ This configuration option sets up the Secure attribute on cookies if it has not been setup by the application server while the client was browsing the application over a ciphered connection.
+ </td>
+ </tr>
<tr><td>&nbsp;</td></tr>
<tr align="left">
<td width="22%" valign="top">&nbsp;</td>
@@ -880,6 +960,7 @@ set by the 'retries' parameter.</div>
<script type="text/javascript">
<?
phparray_to_javascriptarray($fields_servers,"fields_servers",Array('/*','/*/name','/*/type','/*/size','/*/items','/*/items/*','/*/items/*/*','/*/items/*/*/name'));
+ phparray_to_javascriptarray($fields_servers_details,"fields_details_servers",Array('/*','/*/name','/*/type'));
phparray_to_javascriptarray($a_checktypes,"checktypes",Array('/*','/*/name','/*/descr'));
phparray_to_javascriptarray($a_cookiemode,"cookiemode",Array('/*','/*/name','/*/descr'));
phparray_to_javascriptarray($a_sticky_type,"sticky_type",Array('/*','/*/descr','/*/cookiedescr'));
diff --git a/config/haproxy-devel/haproxy_socketinfo.inc b/config/haproxy-devel/haproxy_socketinfo.inc
index 6beb17c5..cbfb131b 100644
--- a/config/haproxy-devel/haproxy_socketinfo.inc
+++ b/config/haproxy-devel/haproxy_socketinfo.inc
@@ -122,6 +122,8 @@ function haproxy_get_clients($show_traffic = false){// "show sess"
$clients=array();
$sessions = haproxy_socket_command("show sess");
foreach($sessions as $line) {
+ if (trim($line) == "")
+ continue;
list($sessid,$proto,$src,$fe,$be,$srv,$ts,$age,$calls,$rq,$rp,$s0,$s1,$exp) = explode(" ", $line);
#Retrieve data
$sessid = explode(":", $sessid);
@@ -149,10 +151,10 @@ function haproxy_get_clients($show_traffic = false){// "show sess"
$session_data = haproxy_socket_command("show sess {$client['sessid']}");
$client['session_data'] = $session_data;
- $req = explode(" ",$session_data[13]);
+ $req = explode(" ",$session_data[12]);
$x = explode("=",$req[7]);
$client['session_datareq'] = $x[1];
- $res = explode(" ",$session_data[16]);
+ $res = explode(" ",$session_data[15]);
$x = explode("=",$res[7]);
$client['session_datares'] = $x[1];
}
diff --git a/config/haproxy-devel/haproxy_utils.inc b/config/haproxy-devel/haproxy_utils.inc
index 03bd434f..8fb89eab 100644
--- a/config/haproxy-devel/haproxy_utils.inc
+++ b/config/haproxy-devel/haproxy_utils.inc
@@ -33,6 +33,21 @@
require_once("config.inc");
+class haproxy_utils {
+ public static $pf_version;
+}
+haproxy_utils::$pf_version = substr(trim(file_get_contents("/etc/version")),0,3);
+
+if(!function_exists('ifset')){
+ function ifset(&$var, $default = ''){
+ return isset($var) ? $var : $default;
+ };
+}
+
+function haproxy_compareByName($a, $b) {
+ return strcasecmp($a['name'], $b['name']);
+}
+
function haproxy_interface_ip($interfacebindname,$userfriendly=false){
$list = haproxy_get_bindable_interfaces();
$item = $list[$interfacebindname];
@@ -203,20 +218,11 @@ function haproxy_cert_signed_by($cert, $signedbycert) {
return $authoritykeyid == $subjectid;
}
-function haproxy_get_certificates(){
- global $config;
- $allcerts = array();
- foreach($config['cert'] as &$cert)
- $allcerts[] = &$cert;
- foreach($config['ca'] as &$cert)
- $allcerts[] = &$cert;
- return $allcerts;
-}
function haproxy_recalculate_certifcate_chain(){
// and set "selfsigned" for certificates that where used to sign themselves
// recalculate the "caref" for all certificates where it is currently unkown.
- $allcertificates = haproxy_get_certificates();
+ $allcertificates = haproxy_get_certificates('ca,server,user',true);
$items_recalculated = 0;
foreach($allcertificates as &$cert){
$recalculate=false;
@@ -251,7 +257,7 @@ function get_certificat_usage($refid) {
$usage = array();
$cert = lookup_cert($refid);
if (is_cert_revoked($cert))
- $usage[] = "Revoked";
+ $usage[] = "*Revoked";
if (is_webgui_cert($refid))
$usage[] = "webConfigurator";
if (is_user_cert($refid))
@@ -260,55 +266,86 @@ function get_certificat_usage($refid) {
$usage[] = "OpenVPN Server";
if (is_openvpn_client_cert($refid))
$usage[] = "OpenVPN Client";
- if (is_ipsec_cert($cert['refid']))
+ if (is_ipsec_cert($refid))
$usage[] = "IPsec Tunnel";
if (function_exists("is_captiveportal_cert"))
if (is_captiveportal_cert($refid))
$usage[] = "Captive Portal";
-
return $usage;
}
-function get_certificates_server($get_includeWebCert=false) {
- // This function (is intended to) provide a uniform way to retrieve a list of server certificates
- global $config;
- $certificates=array();
- $a_cert = &$config['cert'];
- foreach ($a_cert as $cert)
- {
- if ($get_ca == false && is_webgui_cert($cert['refid']))
- continue;
- $purpose = cert_get_purpose($cert['crt']);
- //$certserverpurpose = $purpose['server'] == 'Yes' ? " [Server certificate]" : "";
- $certserverpurpose = "";
+function haproxy_get_certificate_descriptivename($cert) {
+ $usage = get_certificat_usage($cert['crt']);
+ foreach($usage as $use){
+ $usagestr .= " " . $use;
+ }
+ if ($usagestr != "")
+ $usagestr = " (".trim($usagestr).")";
- $selected = "";
- $caname = "";
- $inuse = "";
- $revoked = "";
- $ca = lookup_ca($cert['caref']);
- if ($ca)
- $caname = " (CA: {$ca['descr']})";
- if ($pconfig['certref'] == $cert['refid'])
- $selected = "selected";
- if (cert_in_use($cert['refid']))
- $inuse = " *In Use";
- if (is_cert_revoked($cert))
- $revoked = " *Revoked";
+ $purpose = cert_get_purpose($cert['crt']);
+ $certserverpurpose = $purpose['server'] == 'Yes' ? " [Server cert]" : "";
- $usagestr="";
- $usage = get_certificat_usage($cert['refid']);
- foreach($usage as $use){
- $usagestr .= " " . $use;
- }
- if ($usagestr != "")
- $usagestr = " (".trim($usagestr).")";
-
- $certificates[$cert['refid']]['name'] = $cert['descr'] . $caname . $certserverpurpose . $inuse . $revoked . $usagestr;
+ $caname = "";
+ $ca = lookup_ca($cert['caref']);
+ if ($ca)
+ $caname = " (CA: {$ca['descr']})";
+
+ return $cert['descr'] . $caname . $certserverpurpose . $usagestr;
+}
+
+function haproxy_get_certificates($type = 'server,user', $get_includeWebCert=false) {
+ // $type one or multiple of these separated by a comma: ca,server,user
+ // $get_includeWebCert if the webgui certificate may be included.
+
+ // This function (is intended to) provide a uniform way to retrieve a list of server certificates
+ global $config;
+ $type = ",$type,";
+ $certificates = array();
+ if (strpos($type,',server,') !== false || strpos($type,',user,') !== false ) {
+ if (is_array($config['cert'])) {
+ $a_cert = &$config['cert'];
+ foreach ($a_cert as $cert) {
+ $purpose = cert_get_purpose($cert['crt']);
+
+ $ok = false;
+ $ok |= stristr($type,',server,') && $purpose['server'] == 'Yes';
+ $ok |= stristr($type,',user,') && $purpose['server'] != 'Yes';
+ if (!$ok)
+ continue;
+ if ($get_includeWebCert == false && is_webgui_cert($cert['refid']))
+ continue;
+ $certificates[$cert['refid']]['name'] = haproxy_get_certificate_descriptivename($cert);
+ }
+ }
}
+ if (strpos($type,',ca,') !== false) {
+ if (is_array($config['ca'])) {
+ $a_cert = &$config['ca'];
+ foreach ($a_cert as $cert) {
+ $certificates[$cert['refid']]['name'] = haproxy_get_certificate_descriptivename($cert);
+ }
+ }
+ }
+ uasort($certificates, haproxy_compareByName);
return $certificates;
}
+function haproxy_get_crls() {
+ global $config;
+ $certificates=array();
+ if (is_array($config['crl'])) {
+ foreach ($config['crl'] as $crl) {
+ $caname = "";
+ $ca = lookup_ca($crl['caref']);
+ if ($ca)
+ $caname = " (CA: {$ca['descr']})";
+
+ $certificates[$crl['refid']]['name'] = $crl['descr'] . $caname;
+ }
+ }
+ uasort($certificates, haproxy_compareByName);
+ return $certificates;
+}
function phparray_to_javascriptarray_recursive($nestID, $path, $items, $nodeName, $includeitems) {
$offset = str_repeat(' ',$nestID);
diff --git a/config/lcdproc-dev/lcdproc.inc b/config/lcdproc-dev/lcdproc.inc
index 00768cd7..73827721 100644
--- a/config/lcdproc-dev/lcdproc.inc
+++ b/config/lcdproc-dev/lcdproc.inc
@@ -308,7 +308,8 @@
$config_text .= "[{$lcdproc_config['driver']}]\n";
$config_text .= "driverpath=/usr/local/lib/lcdproc/\n";
$config_text .= "ConnectionType={$lcdproc_config['connection_type']}\n";
- $config_text .= "Device={$realport}\n";
+ if($lcdproc_config['comport'] != "none")
+ $config_text .= "Device={$realport}\n";
$config_text .= "Port=0x378\n";
$config_text .= "Speed=0\n";
$config_text .= "Keypad=yes\n";
@@ -502,7 +503,7 @@ EOD;
restart_service(LCDPROC_SERVICE_NAME);
}
}
- if((! $lcdproc_config['driver']) || ($lcdproc_config['comport'] == "none")) {
+ if((! $lcdproc_config['driver']) || (! $lcdproc_config['comport'])) {
/* no parameters user does not want lcdproc running */
/* lets stop the service and remove the rc file */
if(file_exists(LCDPROC_RCFILE)) {
diff --git a/config/lcdproc-dev/lcdproc_client.php b/config/lcdproc-dev/lcdproc_client.php
index 5306c903..922ed14e 100644
--- a/config/lcdproc-dev/lcdproc_client.php
+++ b/config/lcdproc-dev/lcdproc_client.php
@@ -554,11 +554,11 @@
/* format speed in bits/sec, input: bytes/sec
Code from: graph.php ported to PHP*/
if ($speed < 125000)
- {return sprintf("%3d.1 Kbps", $speed / 125);}
+ {return sprintf("%5.1f Kbps", $speed / 125);}
if ($speed < 125000000)
- {return sprintf("%3d.1 Mbps", $speed / 125000);}
+ {return sprintf("%5.1f Mbps", $speed / 125000);}
// else
- return sprintf("%3d.1 Gbps", $speed / 125000000);
+ return sprintf("%5.1f Gbps", $speed / 125000000);
}
function add_summary_declaration(&$lcd_cmds, $name) {
diff --git a/config/lightsquid/sqstat.class.php b/config/lightsquid/sqstat.class.php
index 03695a47..5707e051 100644
--- a/config/lightsquid/sqstat.class.php
+++ b/config/lightsquid/sqstat.class.php
@@ -70,7 +70,7 @@ class squidstat{
$this->squidhost = '127.0.0.1';
$this->squidport = '3128';
- $This->group_by = 'host';
+ $this->group_by = 'host';
$this->resolveip = true;
$this->hosts_file = '';
$this->autorefresh = 0;
@@ -580,4 +580,4 @@ class squidstat{
}
}
-?> \ No newline at end of file
+?>
diff --git a/config/mailreport/mail_reports.inc b/config/mailreport/mail_reports.inc
index 0119457a..6dddf7cd 100644
--- a/config/mailreport/mail_reports.inc
+++ b/config/mailreport/mail_reports.inc
@@ -35,13 +35,13 @@ require_once("filter.inc");
require_once("rrd.inc");
$graph_length = array(
- "8hour" => 28800,
+ "eighthour" => 28800,
"day" => 86400,
"week" => 604800,
"month" => 2764800,
"quarter" => 8035200,
"year" => 31622400,
- "4year" => 126489600);
+ "fouryear" => 126489600);
$logfile_friendly = array(
"dhcpd" => "DHCP",
@@ -88,6 +88,7 @@ function get_dates($curperiod, $graph) {
$offset = 0;
}
switch($graph) {
+ case "eighthour":
case "8hour":
if($curhour < 24)
$starthour = 16;
@@ -142,6 +143,7 @@ function get_dates($curperiod, $graph) {
if($offset != 0)
$end = mktime(0, 0, 0, 1, 0, (($curyear + $offset) +1));
break;
+ case "fouryear":
case "4year":
$start = mktime(0, 0, 0, 1, 0, (($curyear - 3) + $offset));
if($offset != 0)
@@ -1263,4 +1265,15 @@ function get_friendly_log_name($logfile) {
return $friendly;
}
+function fixup_graph_timespan($timespan) {
+ switch ($timespan) {
+ case "8hour":
+ return "eighthour";
+ case "4year":
+ return "fouryear";
+ default:
+ return $timespan;
+ }
+}
+
?>
diff --git a/config/mailreport/mailreport.xml b/config/mailreport/mailreport.xml
index 9239f82e..803e205b 100644
--- a/config/mailreport/mailreport.xml
+++ b/config/mailreport/mailreport.xml
@@ -37,7 +37,7 @@
]]>
</copyright>
<name>mailreport</name>
- <version>2.0.12</version>
+ <version>2.1</version>
<title>Status: Email Reports</title>
<additional_files_needed>
<prefix>/usr/local/bin/</prefix>
diff --git a/config/mailreport/status_mail_report_add_graph.php b/config/mailreport/status_mail_report_add_graph.php
index 3f629d56..d6f0d362 100644
--- a/config/mailreport/status_mail_report_add_graph.php
+++ b/config/mailreport/status_mail_report_add_graph.php
@@ -130,16 +130,16 @@ $custom_databases = array_merge($dbheader_custom, $databases);
$styles = array('inverse' => gettext('Inverse'),
'absolute' => gettext('Absolute'));
-$graphs = array("8hour", "day", "week", "month", "quarter", "year", "4year");
+$graphs = array("eighthour", "day", "week", "month", "quarter", "year", "fouryear");
$periods = array("absolute" => gettext("Absolute Timespans"), "current" => gettext("Current Period"), "previous" => gettext("Previous Period"));
$graph_length = array(
- "8hour" => 28800,
+ "eighthour" => 28800,
"day" => 86400,
"week" => 604800,
"month" => 2764800,
"quarter" => 8035200,
"year" => 31622400,
- "4year" => 126489600);
+ "fouryear" => 126489600);
if ($_POST) {
unset($_POST['__csrf_magic']);
@@ -219,6 +219,7 @@ include("head.inc");
<select name="timespan" class="formselect" style="z-index: -10;">
<?php
foreach (array_keys($graph_length) as $timespan) {
+ $pconfig['timespan'] = fixup_graph_timespan($pconfig['timespan']);
echo "<option value=\"$timespan\"";
if ($timespan == $pconfig['timespan']) echo " selected";
echo ">" . htmlspecialchars(ucwords($timespan)) . "</option>\n";
diff --git a/config/mailscanner/mailscanner.inc b/config/mailscanner/mailscanner.inc
index 0147bb2e..4067eef3 100644
--- a/config/mailscanner/mailscanner.inc
+++ b/config/mailscanner/mailscanner.inc
@@ -33,15 +33,16 @@ require("globals.inc");
#require("guiconfig.inc");
$pf_version=substr(trim(file_get_contents("/etc/version")),0,3);
-if ($pf_version > 2.0)
- define('MAILSCANNER_LOCALBASE', '/usr/pbi/mailscanner-' . php_uname("m"));
+define('MAILSCANNER_PREFIX', '/usr/pbi/mailscanner-' . php_uname("m"));
+if ($pf_version != "2.1")
+ define('MAILSCANNER_LOCALBASE', MAILSCANNER_PREFIX);
else
- define('MAILSCANNER_LOCALBASE','/usr/local');
+ define('MAILSCANNER_LOCALBASE', MAILSCANNER_PREFIX . '/local');
$uname=posix_uname();
if ($uname['machine']=='amd64')
ini_set('memory_limit', '250M');
-
+
function ms_text_area_decode($text){
return preg_replace('/\r\n/', "\n",base64_decode($text));
}
@@ -311,8 +312,7 @@ Language Strings = %report-dir%/languages.conf
$load_samples++;
}
- //$report_dir=MAILSCANNER_LOCALBASE."/share/MailScanner/reports/".strtolower($report['language']);
- $report_dir="/usr/local/share/MailScanner/reports/".strtolower($report['language']);
+ $report_dir=MAILSCANNER_LOCALBASE."/share/MailScanner/reports/".strtolower($report['language']);
#CHECK REPORT FILES
$report_files= array('deletedbadcontent' => 'deleted.content.message.txt',
'deletedbadfilename' => 'deleted.filename.message.txt',
@@ -381,7 +381,7 @@ Phishing Bad Sites File = %etc-dir%/phishing.bad.sites.conf
Country Sub-Domains List = %etc-dir%/country.domains.conf
*/
#get mailscanner version
- $msc_bin=MAILSCANNER_LOCALBASE. "/sbin/mailscanner";
+ $msc_bin=MAILSCANNER_PREFIX. "/sbin/mailscanner";
if (file_exists($msc_bin)){
$msc_bin_file=file_get_contents($msc_bin);
if (preg_match("/MailScannerVersion = '(\S+)'/",$msc_bin_file,$msv_matches))
@@ -443,12 +443,12 @@ Country Sub-Domains List = %etc-dir%/country.domains.conf
if (preg_match('/use_pyzor/',$antispam['safeatures'])){
$pattern[]='/#pyzor_path/';
$pattern[]="/\S+yzor_disabled/";
- $pattern[]='/usr.bin.pyzor/';
+ $pattern[]='/\/usr.bin.pyzor/';
$pattern[]='/use_pyzor/';
$pattern[]="/\S+o_not_use_pyzor/";
$replacement[]="pyzor_path";
$replacement[]="pyzor_path";
- $replacement[]="usr/local/bin/pyzor";
+ $replacement[]=MAILSCANNER_PREFIX . "/bin/pyzor";
$replacement[]="use_pyzor";
$replacement[]="use_pyzor";
}
@@ -681,29 +681,29 @@ Country Sub-Domains List = %etc-dir%/country.domains.conf
$script=MAILSCANNER_LOCALBASE. '/etc/rc.d/mailscanner';
#fix MIME::ToolUtils deprecated function and usecure dependency calls in /usr/local/sbin/mailscanner
- $cconf=MAILSCANNER_LOCALBASE. "/sbin/mailscanner";
+ $cconf=MAILSCANNER_PREFIX. "/sbin/mailscanner";
if (file_exists($cconf)){
$perl_bin="perl_mailscanner";
- if(file_exists(MAILSCANNER_LOCALBASE . '/bin/perl') && !file_exists(MAILSCANNER_LOCALBASE . "/bin/{$perl_bin}")){
- link(MAILSCANNER_LOCALBASE . '/bin/perl',MAILSCANNER_LOCALBASE . '/bin/perl_mailscanner');
+ if(file_exists(MAILSCANNER_PREFIX . '/bin/perl') && !file_exists(MAILSCANNER_PREFIX . "/bin/{$perl_bin}")){
+ link(MAILSCANNER_PREFIX . '/bin/perl',MAILSCANNER_PREFIX . "/bin/{$perl_bin}");
}
- if (file_exists(MAILSCANNER_LOCALBASE . "/bin/{$perl_bin}")){
+ if (file_exists(MAILSCANNER_PREFIX . "/bin/{$perl_bin}")){
$cconf_file=file_get_contents($cconf);
$pattern2[0]='@#!/usr\S+bin/perl.*I@';
//$pattern2[1]='/\smy .current = config MIME::ToolUtils/';
- $replacement2[0]='#!'.MAILSCANNER_LOCALBASE. "/bin/{$perl_bin} -U -I";
+ $replacement2[0]='#!'.MAILSCANNER_PREFIX. "/bin/{$perl_bin} -U -I";
//$replacement2[1]=' #my $current = config MIME::ToolUtils';
if (preg_match('@#!/usr\S+bin/perl.*I@',$cconf_file)){
$cconf_file=preg_replace($pattern2,$replacement2,$cconf_file);
file_put_contents($cconf, $cconf_file, LOCK_EX);
- }
+ }
}
}
#check spam assassin rules
- $saupdate="/usr/local/bin/sa-update";
+ $saupdate=MAILSCANNER_PREFIX . "/bin/sa-update";
if (file_exists($saupdate)){
$rules_found=0;
if (file_exists("/var/db/spamassassin")){
diff --git a/config/nrpe2/nrpe2.inc b/config/nrpe2/nrpe2.inc
index 7b249368..c515ab99 100644
--- a/config/nrpe2/nrpe2.inc
+++ b/config/nrpe2/nrpe2.inc
@@ -47,6 +47,7 @@ function nrpe2_custom_php_install_command() {
$config['installedpackages']['nrpe2']['config'][0]['server_address'] = $ip;
$config['installedpackages']['nrpe2']['config'][0]['server_port'] = 5666;
$config['installedpackages']['nrpe2']['config'][0]['allowed_hosts'] = "127.0.0.1";
+ $config['installedpackages']['nrpe2']['config'][0]['dont_blame_nrpe'] = "on";
}
if (!is_array($config['installedpackages']['nrpe2']['config'][0]['row'])) {
@@ -170,6 +171,12 @@ function nrpe2_custom_php_write_config() {
$server_port = $config['installedpackages']['nrpe2']['config'][0]['server_port'];
$allowed_hosts = $config['installedpackages']['nrpe2']['config'][0]['allowed_hosts'];
+ $dont_blame_nrpe = $config['installedpackages']['nrpe2']['config'][0]['dont_blame_nrpe'];
+ if ($config['installedpackages']['nrpe2']['config'][0]['dont_blame_nrpe'] == "on") {
+ $dont_blame_nrpe = 1;
+ } else {
+ $dont_blame_nrpe = 0;
+ }
$fd = fopen(NRPE_CONFIG_DIR . '/nrpe.cfg', 'w');
$nrpe_cfg = <<<EOD
@@ -179,7 +186,7 @@ server_port={$server_port}
nrpe_user=nagios
nrpe_group=nagios
allowed_hosts={$allowed_hosts}
-dont_blame_nrpe=0
+dont_blame_nrpe={$dont_blame_nrpe}
debug=0
command_timeout=60
connection_timeout=300
diff --git a/config/nrpe2/nrpe2.xml b/config/nrpe2/nrpe2.xml
index fec09d06..8d6f0b09 100644
--- a/config/nrpe2/nrpe2.xml
+++ b/config/nrpe2/nrpe2.xml
@@ -63,6 +63,13 @@
<required/>
</field>
<field>
+ <fielddescr>Allow Arguments (dont_blame_nrpe)</fielddescr>
+ <fieldname>dont_blame_nrpe</fieldname>
+ <description>Check this to enable accept NRPE arguments (Default: 0)</description>
+ <type>checkbox</type>
+ </field>
+
+ <field>
<type>listtopic</type>
<name>Commands</name>
<fieldname>temp</fieldname>
@@ -109,7 +116,7 @@
<required/>
</rowhelperfield>
<rowhelperfield>
- <fielddescr>Extra Options</fielddescr>
+ <fielddescr>Extra Options (Example: -s Z \$ARG1\$ \$ARG2\$)</fielddescr>
<fieldname>extra</fieldname>
<description>Warning! Use at your own risk, incorrect settings here may prevent NRPE from starting!</description>
<type>input</type>
diff --git a/config/olsrd.inc b/config/olsrd.inc
index 9db79f1f..9eee0196 100644
--- a/config/olsrd.inc
+++ b/config/olsrd.inc
@@ -138,11 +138,6 @@ UseHysteresis no
LinkQualityLevel {$olsrd['enablelqe']}
-# Link quality window size
-# Defaults to 10
-
-LinkQualityWinSize 10
-
# Polling rate in seconds(float).
# Default value 0.05 sec
diff --git a/config/open-vm-tools/open-vm-tools.inc b/config/open-vm-tools/open-vm-tools.inc
index 5db7de3f..76e8c212 100644
--- a/config/open-vm-tools/open-vm-tools.inc
+++ b/config/open-vm-tools/open-vm-tools.inc
@@ -42,7 +42,7 @@ checkvm_cmd="/usr/local/bin/vmware-checkvm > /dev/null"
# VMware guest daemon
name="vmware_guestd"
-rcvar=`set_rcvar`
+rcvar="\${name}_enable"
start_precmd="\${checkvm_cmd}"
unset start_cmd
stop_precmd="\${checkvm_cmd}"
@@ -100,7 +100,7 @@ vmware_guest_vmhgfs_start()
# VMware kernel module: vmmemctl
name="vmware_guest_vmmemctl"
-rcvar=`set_rcvar`
+rcvar="\${name}_enable"
start_precmd="\${checkvm_cmd}"
start_cmd="vmware_guest_vmmemctl_start"
stop_precmd="\${checkvm_cmd}"
@@ -112,7 +112,7 @@ run_rc_command "\$1"
# VMware kernel module: vmxnet
name="vmware_guest_vmxnet"
-rcvar=`set_rcvar`
+rcvar="\${name}_enable"
start_precmd="\${checkvm_cmd}"
start_cmd="vmware_guest_vmxnet_start"
stop_precmd="\${checkvm_cmd}"
@@ -124,7 +124,7 @@ run_rc_command "\$1"
# VMware kernel module: vmblock
name="vmware_guest_vmblock"
-rcvar=`set_rcvar`
+rcvar="\${name}_enable"
start_precmd="\${checkvm_cmd}"
start_cmd="vmware_guest_vmblock_start"
stop_precmd="\${checkvm_cmd}"
@@ -136,7 +136,7 @@ run_rc_command "\$1"
# VMware kernel module: vmhgfs
name="vmware_guest_vmhgfs"
-rcvar=`set_rcvar`
+rcvar="\${name}_enable"
start_precmd="\${checkvm_cmd}"
start_cmd="vmware_guest_vmhgfs_start"
stop_precmd="\${checkvm_cmd}"
diff --git a/config/openvpn-client-export/openvpn-client-export.xml b/config/openvpn-client-export/openvpn-client-export.xml
index ee04b0cc..21faa26d 100755
--- a/config/openvpn-client-export/openvpn-client-export.xml
+++ b/config/openvpn-client-export/openvpn-client-export.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<packagegui>
<name>OpenVPN Client Export</name>
- <version>1.2.11</version>
+ <version>1.2.13</version>
<title>OpenVPN Client Export</title>
<include_file>/usr/local/pkg/openvpn-client-export.inc</include_file>
<backup_file></backup_file>
diff --git a/config/openvpn-client-export/readme.txt b/config/openvpn-client-export/readme.txt
index 071b6d59..b9310283 100755
--- a/config/openvpn-client-export/readme.txt
+++ b/config/openvpn-client-export/readme.txt
@@ -2,7 +2,7 @@ pfSense OpenVPN Client Export Package
-------------------------------------
This package includes a webConfigurator interface that allows for easy
-expory of user based OpenVPN configurations and pre-configured windows
+export of user based OpenVPN configurations and pre-configured windows
installer packages.
Contents
@@ -34,7 +34,7 @@ root package directory using the following command ...
tar zcvf openvpn-client-export.tgz client-export
-With the archive created, you will have three relevent files in the
+With the archive created, you will have three relevant files in the
root package directory ...
openvpn-client-export.inc
diff --git a/config/openvpn-client-export/source/openvpn-postinstall.nsi b/config/openvpn-client-export/source/openvpn-postinstall.nsi
index fb4356e0..70057f6d 100755
--- a/config/openvpn-client-export/source/openvpn-postinstall.nsi
+++ b/config/openvpn-client-export/source/openvpn-postinstall.nsi
@@ -37,7 +37,7 @@ Var /GLOBAL mui.FinishPage.Run
!define WELCOME_TITLE 'Welcome to OpenVPN installer.'
!define WELCOME_TEXT "This wizard will guide you through the installation of the OpenVPN client and configuration.$\r$\n$\r$\n\
-This wil automaticaly install the configuration files needed for your connection. \
+This will automatically install the configuration files needed for your connection. \
And if needed install the required DotNet2 framework."
!define MUI_WELCOMEPAGE_TITLE '${WELCOME_TITLE}'
;!define MUI_WELCOMEPAGE_TITLE_3LINES
diff --git a/config/openvpn-client-export/source/openvpn-postinstall64.nsi b/config/openvpn-client-export/source/openvpn-postinstall64.nsi
index b962ddff..720ab663 100644
--- a/config/openvpn-client-export/source/openvpn-postinstall64.nsi
+++ b/config/openvpn-client-export/source/openvpn-postinstall64.nsi
@@ -38,7 +38,7 @@ Var /GLOBAL mui.FinishPage.Run
!define WELCOME_TITLE 'Welcome to OpenVPN installer.'
!define WELCOME_TEXT "This wizard will guide you through the installation of the OpenVPN client and configuration.$\r$\n$\r$\n\
-This wil automaticaly install the configuration files needed for your connection. \
+This will automatically install the configuration files needed for your connection. \
And if needed install the required DotNet2 framework."
!define MUI_WELCOMEPAGE_TITLE '${WELCOME_TITLE}'
;!define MUI_WELCOMEPAGE_TITLE_3LINES
diff --git a/config/openvpn-client-export/vpn_openvpn_export.php b/config/openvpn-client-export/vpn_openvpn_export.php
index 086c2a52..6a8c9358 100755
--- a/config/openvpn-client-export/vpn_openvpn_export.php
+++ b/config/openvpn-client-export/vpn_openvpn_export.php
@@ -362,7 +362,7 @@ function download_begin(act, i, j) {
var proxyconf = document.getElementById("proxyconf").value;
if (useproxypass) {
if (!proxyuser) {
- alert("Please fill the proxy username and passowrd.");
+ alert("Please fill the proxy username and password.");
return;
}
if (!proxypass || !proxyconf) {
diff --git a/config/openvpn-client-export/vpn_openvpn_export_shared.php b/config/openvpn-client-export/vpn_openvpn_export_shared.php
index da77870a..26efc1ed 100644
--- a/config/openvpn-client-export/vpn_openvpn_export_shared.php
+++ b/config/openvpn-client-export/vpn_openvpn_export_shared.php
@@ -1,6 +1,6 @@
<?php
/*
- vpn_openvpn_export.php
+ vpn_openvpn_export_shared.php
Copyright (C) 2008 Shrew Soft Inc.
Copyright (C) 2010 Ermal Luçi
@@ -202,7 +202,7 @@ function download_begin(act) {
var proxyconf = document.getElementById("proxyconf").value;
if (useproxypass) {
if (!proxyuser) {
- alert("Please fill the proxy username and passowrd.");
+ alert("Please fill the proxy username and password.");
return;
}
if (!proxypass || !proxyconf) {
diff --git a/config/sarg/sarg_about.php b/config/sarg/sarg_about.php
index 573dc5ee..fba456b2 100755
--- a/config/sarg/sarg_about.php
+++ b/config/sarg/sarg_about.php
@@ -73,7 +73,7 @@ include("head.inc");
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Sarg Site");?></td>
- <td width="78%" class="vtable"><?=gettext("<a target=_new href='http://sarg.sourceforge.net/welcome.php'>Squid Analysis Report Generator</a><br><br>");?>
+ <td width="78%" class="vtable"><?=gettext("<a target=_new href='http://sarg.sourceforge.net/'>Squid Analysis Report Generator</a><br><br>");?>
</tr>
<tr>
<td colspan="2" valign="top" class="listtopic"><?=gettext("About sarg package"); ?></td>
@@ -83,7 +83,7 @@ include("head.inc");
<td width="78%" class="vtable"><?=gettext("Package Created by <a target=_new href='https://forum.pfsense.org/index.php?action=profile;u=4710'>Marcello Coutinho</a><br><br>");?></td>
</tr>
<tr>
- <td width="22%" valign="top" class="vncell"><?=gettext("Donatios ");?></td>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Donations ");?></td>
<td width="78%" class="vtable"><?=gettext("If you like this package, please <a target=_new href='https://www.pfsense.org/index.php?option=com_content&task=view&id=47&Itemid=77'>donate to pfSense project</a>.<br><br>
If you want that your donation goes to this package developer, make a note on donation forwarding it to me.<br><br>");?></td>
</tr>
diff --git a/config/suricata/suricata.xml b/config/suricata/suricata.xml
index 43ad68fa..995ed900 100644
--- a/config/suricata/suricata.xml
+++ b/config/suricata/suricata.xml
@@ -42,7 +42,7 @@
<description>Suricata IDS/IPS Package</description>
<requirements>None</requirements>
<name>suricata</name>
- <version>2.0.3 pkg v2.0.1</version>
+ <version>2.0.3 pkg v2.0.2</version>
<title>Services: Suricata IDS</title>
<include_file>/usr/local/pkg/suricata/suricata.inc</include_file>
<menu>
diff --git a/config/suricata/suricata_alerts.php b/config/suricata/suricata_alerts.php
index eab2a1d5..57ccbe27 100644
--- a/config/suricata/suricata_alerts.php
+++ b/config/suricata/suricata_alerts.php
@@ -294,6 +294,9 @@ if (($_POST['addsuppress_srcip'] || $_POST['addsuppress_dstip'] || $_POST['addsu
if (suricata_add_supplist_entry($suppress)) {
suricata_reload_config($a_instance[$instanceid]);
$savemsg = $success;
+
+ // Sync to configured CARP slaves if any are enabled
+ suricata_sync_on_changes();
sleep(2);
}
else
@@ -354,6 +357,9 @@ if ($_POST['togglesid'] && is_numeric($_POST['sidid']) && is_numeric($_POST['gen
/* Signal Suricata to live-load the new rules */
suricata_reload_config($a_instance[$instanceid]);
+
+ // Sync to configured CARP slaves if any are enabled
+ suricata_sync_on_changes();
sleep(2);
$savemsg = gettext("The state for rule {$gid}:{$sid} has been modified. Suricata is 'live-reloading' the new rules list. Please wait at least 15 secs for the process to complete before toggling additional rules.");
diff --git a/config/suricata/suricata_app_parsers.php b/config/suricata/suricata_app_parsers.php
index 16927092..51514ee5 100644
--- a/config/suricata/suricata_app_parsers.php
+++ b/config/suricata/suricata_app_parsers.php
@@ -420,6 +420,9 @@ elseif ($_POST['save'] || $_POST['apply']) {
conf_mount_rw();
suricata_generate_yaml($natent);
conf_mount_ro();
+
+ // Sync to configured CARP slaves if any are enabled
+ suricata_sync_on_changes();
}
header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' );
diff --git a/config/suricata/suricata_barnyard.php b/config/suricata/suricata_barnyard.php
index cd233b5e..987055fd 100644
--- a/config/suricata/suricata_barnyard.php
+++ b/config/suricata/suricata_barnyard.php
@@ -96,7 +96,7 @@ if ($_POST['save']) {
// Validate Sensor Name contains no spaces
if ($_POST['barnyard_enable'] == 'on') {
- if (!empty(trim($_POST['barnyard_sensor_name'])) && strpos(trim($_POST['barnyard_sensor_name']), " ") !== FALSE)
+ if (!empty($_POST['barnyard_sensor_name']) && strpos($_POST['barnyard_sensor_name'], " ") !== FALSE)
$input_errors[] = gettext("The value for 'Sensor Name' cannot contain spaces.");
}
@@ -153,7 +153,7 @@ if ($_POST['save']) {
$natent['barnyard_syslog_proto'] = $_POST['barnyard_syslog_proto'];
if ($_POST['barnyard_sensor_id']) $natent['barnyard_sensor_id'] = $_POST['barnyard_sensor_id']; else $natent['barnyard_sensor_id'] = '0';
- if ($_POST['barnyard_sensor_name']) $natent['barnyard_sensor_name'] = trim($_POST['barnyard_sensor_name']); else unset($natent['barnyard_sensor_name']);
+ if ($_POST['barnyard_sensor_name']) $natent['barnyard_sensor_name'] = $_POST['barnyard_sensor_name']; else unset($natent['barnyard_sensor_name']);
if ($_POST['barnyard_dbhost']) $natent['barnyard_dbhost'] = $_POST['barnyard_dbhost']; else unset($natent['barnyard_dbhost']);
if ($_POST['barnyard_dbname']) $natent['barnyard_dbname'] = $_POST['barnyard_dbname']; else unset($natent['barnyard_dbname']);
if ($_POST['barnyard_dbuser']) $natent['barnyard_dbuser'] = $_POST['barnyard_dbuser']; else unset($natent['barnyard_dbuser']);
diff --git a/config/suricata/suricata_blocked.php b/config/suricata/suricata_blocked.php
index c29d5745..842d4073 100644
--- a/config/suricata/suricata_blocked.php
+++ b/config/suricata/suricata_blocked.php
@@ -208,7 +208,7 @@ if ($savemsg) {
<input name="download" type="submit" class="formbtns" value="Download" title="<?=gettext("Download list of blocked hosts as a gzip archive");?>"/>
&nbsp;<?php echo gettext("All blocked hosts will be saved."); ?>&nbsp;&nbsp;
<input name="remove" type="submit" class="formbtns" value="Clear" title="<?=gettext("Remove blocks for all listed hosts");?>"
- onClick="return confirm('<?=gettext("Are you sure you want to remove all blocked hosts? Click OK to continue or CANCLE to quit.");?>');"/>&nbsp;
+ onClick="return confirm('<?=gettext("Are you sure you want to remove all blocked hosts? Click OK to continue or CANCEL to quit.");?>');"/>&nbsp;
<span class="red"><strong><?php echo gettext("Warning:"); ?></strong></span>&nbsp;<?php echo gettext("all hosts will be removed."); ?>
</td>
</tr>
@@ -260,8 +260,11 @@ if ($savemsg) {
/* 0 1 2 3 4 5 6 7 8 9 10 */
/* File format timestamp,action,sig_generator,sig_id,sig_rev,msg,classification,priority,proto,ip,port */
while (($fields = fgetcsv($fd, 1000, ',', '"')) !== FALSE) {
- if(count($fields) < 11)
+ if(count($fields) != 11) {
+ log_error("[suricata] ERROR: block.log entry failed to parse correctly with too many or not enough CSV entities, skipping this entry...");
+ log_error("[suricata] Failed block.log entry fields are: " . print_r($fields, true));
continue;
+ }
$fields[9] = inet_pton($fields[9]);
if (isset($tmpblocked[$fields[9]])) {
if (!is_array($src_ip_list[$fields[9]]))
diff --git a/config/suricata/suricata_define_vars.php b/config/suricata/suricata_define_vars.php
index 3fe5de0d..040244b0 100644
--- a/config/suricata/suricata_define_vars.php
+++ b/config/suricata/suricata_define_vars.php
@@ -135,6 +135,9 @@ if ($_POST) {
/* Soft-restart Suricaa to live-load new variables. */
suricata_reload_config($a_nat[$id]);
+ /* Sync to configured CARP slaves if any are enabled */
+ suricata_sync_on_changes();
+
/* after click go to this page */
header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' );
header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
diff --git a/config/suricata/suricata_flow_stream.php b/config/suricata/suricata_flow_stream.php
index fa9edc16..53c4e010 100644
--- a/config/suricata/suricata_flow_stream.php
+++ b/config/suricata/suricata_flow_stream.php
@@ -319,6 +319,9 @@ elseif ($_POST['save'] || $_POST['apply']) {
conf_mount_rw();
suricata_generate_yaml($natent);
conf_mount_ro();
+
+ // Sync to configured CARP slaves if any are enabled
+ suricata_sync_on_changes();
}
header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' );
diff --git a/config/suricata/suricata_migrate_config.php b/config/suricata/suricata_migrate_config.php
index ba13155b..4729109b 100644
--- a/config/suricata/suricata_migrate_config.php
+++ b/config/suricata/suricata_migrate_config.php
@@ -118,7 +118,7 @@ foreach ($rule as &$r) {
/***********************************************************/
/* Add the new 'dns-events.rules' file to the rulesets. */
/***********************************************************/
- if (strpos("dns-events.rules", $pconfig['rulesets']) === FALSE) {
+ if (strpos($pconfig['rulesets'], "dns-events.rules") === FALSE) {
$pconfig['rulesets'] = rtrim($pconfig['rulesets'], "||") . "||dns-events.rules";
$updated_cfg = true;
}
@@ -344,7 +344,7 @@ unset($r);
// Write out the new configuration to disk if we changed anything
if ($updated_cfg) {
- $config['installedpackages']['suricata']['config'][0]['suricata_config_ver'] = "2.0";
+ $config['installedpackages']['suricata']['config'][0]['suricata_config_ver'] = "2.0.2";
log_error("[Suricata] Saving configuration settings in new format...");
write_config("Suricata pkg: migrate existing settings to new format during package upgrade.");
log_error("[Suricata] Settings successfully migrated to new configuration format...");
diff --git a/config/suricata/suricata_post_install.php b/config/suricata/suricata_post_install.php
index 7c8d03a5..42f72eca 100644
--- a/config/suricata/suricata_post_install.php
+++ b/config/suricata/suricata_post_install.php
@@ -116,6 +116,46 @@ safe_mkdir(IPREP_PATH);
if ($config['installedpackages']['suricata']['config'][0]['forcekeepsettings'] == 'on') {
log_error(gettext("[Suricata] Saved settings detected... rebuilding installation with saved settings..."));
update_status(gettext("Saved settings detected..."));
+
+ /****************************************************************/
+ /* Do test and fix for duplicate UUIDs if this install was */
+ /* impacted by the DUP (clone) bug that generated a duplicate */
+ /* UUID for the cloned interface. Also fix any duplicate */
+ /* entries in ['rulesets'] for "dns-events.rules". */
+ /****************************************************************/
+ if (count($config['installedpackages']['suricata']['rule']) > 0) {
+ $uuids = array();
+ $suriconf = &$config['installedpackages']['suricata']['rule'];
+ foreach ($suriconf as &$suricatacfg) {
+ // Remove any duplicate ruleset names from earlier bug
+ $rulesets = explode("||", $suricatacfg['rulesets']);
+ $suricatacfg['rulesets'] = implode("||", array_keys(array_flip($rulesets)));
+
+ // Now check for and fix a duplicate UUID
+ $if_real = get_real_interface($suricatacfg['interface']);
+ if (!isset($uuids[$suricatacfg['uuid']])) {
+ $uuids[$suricatacfg['uuid']] = $if_real;
+ continue;
+ }
+ else {
+ // Found a duplicate UUID, so generate a
+ // new one for the affected interface.
+ $old_uuid = $suricatacfg['uuid'];
+ $new_uuid = suricata_generate_id();
+ if (file_exists("{$suricatalogdir}suricata_{$if_real}{$old_uuid}/"))
+ @rename("{$suricatalogdir}suricata_{$if_real}{$old_uuid}/", "{$suricatalogdir}suricata_{$if_real}{$new_uuid}/");
+ $suricatacfg['uuid'] = $new_uuid;
+ $uuids[$new_uuid] = $if_real;
+ log_error(gettext("[Suricata] updated UUID for interface " . convert_friendly_interface_to_friendly_descr($suricatacfg['interface']) . " from {$old_uuid} to {$new_uuid}."));
+ }
+ }
+ write_config("Suricata pkg: updated interface UUIDs to eliminate duplicates.");
+ unset($uuids, $rulesets);
+ }
+ /****************************************************************/
+ /* End of duplicate UUID and "dns-events.rules" bug fix. */
+ /****************************************************************/
+
/* Do one-time settings migration for new version configuration */
update_output_window(gettext("Please wait... migrating settings to new configuration..."));
include('/usr/local/pkg/suricata/suricata_migrate_config.php');
@@ -198,7 +238,7 @@ if (empty($config['installedpackages']['suricata']['config'][0]['forcekeepsettin
conf_mount_ro();
// Update Suricata package version in configuration
-$config['installedpackages']['suricata']['config'][0]['suricata_config_ver'] = "2.0";
+$config['installedpackages']['suricata']['config'][0]['suricata_config_ver'] = "2.0.2";
write_config("Suricata pkg: updated GUI package version number.");
// Done with post-install, so clear flag
diff --git a/config/suricata/suricata_rules.php b/config/suricata/suricata_rules.php
index aa420371..539a1daf 100644
--- a/config/suricata/suricata_rules.php
+++ b/config/suricata/suricata_rules.php
@@ -375,6 +375,9 @@ elseif ($_POST['clear']) {
conf_mount_ro();
$rebuild_rules = false;
$pconfig['customrules'] = '';
+
+ // Sync to configured CARP slaves if any are enabled
+ suricata_sync_on_changes();
}
elseif ($_POST['cancel']) {
$pconfig['customrules'] = base64_decode($a_rule[$id]['customrules']);
@@ -395,6 +398,9 @@ elseif ($_POST['save']) {
/* Signal Suricata to "live reload" the rules */
suricata_reload_config($a_rule[$id]);
clear_subsystem_dirty('suricata_rules');
+
+ // Sync to configured CARP slaves if any are enabled
+ suricata_sync_on_changes();
}
elseif ($_POST['apply']) {
@@ -416,6 +422,9 @@ elseif ($_POST['apply']) {
// We have saved changes and done a soft restart, so clear "dirty" flag
clear_subsystem_dirty('suricata_rules');
+
+ // Sync to configured CARP slaves if any are enabled
+ suricata_sync_on_changes();
}
include_once("head.inc");
@@ -632,7 +641,7 @@ if ($savemsg) {
<tbody>
<?php
- $counter = $enable_cnt = $disable_cnt = $managed_count = 0;
+ $counter = $enable_cnt = $disable_cnt = $user_enable_cnt = $user_disable_cnt = $managed_count = 0;
foreach ($rules_map as $k1 => $rulem) {
foreach ($rulem as $k2 => $v) {
$sid = suricata_get_sid($v['rule']);
@@ -660,6 +669,7 @@ if ($savemsg) {
$textse = "</span>";
$iconb = "icon_reject_d.gif";
$disable_cnt++;
+ $user_disable_cnt++;
$title = gettext("Disabled by user. Click to toggle to enabled state");
}
elseif (($v['disabled'] == 1) && (!isset($enablesid[$gid][$sid]))) {
@@ -673,6 +683,7 @@ if ($savemsg) {
$textss = $textse = "";
$iconb = "icon_reject.gif";
$enable_cnt++;
+ $user_enable_cnt++;
$title = gettext("Enabled by user. Click to toggle to disabled state");
}
else {
@@ -762,6 +773,8 @@ if ($savemsg) {
gettext("Total Rules: {$counter}") . "&nbsp;&nbsp;&nbsp;&nbsp;" .
gettext("Enabled: {$enable_cnt}") . "&nbsp;&nbsp;&nbsp;&nbsp;" .
gettext("Disabled: {$disable_cnt}") . "&nbsp;&nbsp;&nbsp;&nbsp;" .
+ gettext("User Enabled: {$user_enable_cnt}") . "&nbsp;&nbsp;&nbsp;&nbsp;" .
+ gettext("User Disabled: {$user_disable_cnt}") . "&nbsp;&nbsp;&nbsp;&nbsp;" .
gettext("Auto-Managed: {$managed_count}"); ?></td>
</tr>
<tr>
diff --git a/config/suricata/suricata_rulesets.php b/config/suricata/suricata_rulesets.php
index ce32af20..7ea672b1 100644
--- a/config/suricata/suricata_rulesets.php
+++ b/config/suricata/suricata_rulesets.php
@@ -165,6 +165,9 @@ if ($_POST["save"]) {
$enabled_rulesets_array = explode("||", $enabled_items);
if (suricata_is_running($suricata_uuid, $if_real))
$savemsg = gettext("Suricata is 'live-loading' the new rule set on this interface.");
+
+ // Sync to configured CARP slaves if any are enabled
+ suricata_sync_on_changes();
}
elseif ($_POST['unselectall']) {
// Remove all but the default events and files rules
diff --git a/config/suricata/suricata_sid_mgmt.php b/config/suricata/suricata_sid_mgmt.php
index c69a9fcd..2224e81a 100644
--- a/config/suricata/suricata_sid_mgmt.php
+++ b/config/suricata/suricata_sid_mgmt.php
@@ -188,6 +188,9 @@ if (isset($_POST['save_auto_sid_conf'])) {
$intf_msg .= convert_friendly_interface_to_friendly_descr($a_nat[$k]['interface']) . ", ";
}
$savemsg = gettext("Changes were applied to these interfaces: " . trim($intf_msg, ' ,') . " and Suricata signaled to live-load the new rules.");
+
+ // Sync to configured CARP slaves if any are enabled
+ suricata_sync_on_changes();
}
}
diff --git a/config/suricata/suricata_suppress.php b/config/suricata/suricata_suppress.php
index 2fd2deeb..80249724 100644
--- a/config/suricata/suricata_suppress.php
+++ b/config/suricata/suricata_suppress.php
@@ -94,15 +94,16 @@ function suricata_find_suppresslist_interface($supplist) {
return false;
}
-if ($_GET['act'] == "del") {
- if ($a_suppress[$_GET['id']]) {
+if ($_POST['del'] && is_numericint($_POST['list_id'])) {
+ if ($a_suppress[$_POST['list_id']]) {
// make sure list is not being referenced by any Suricata-configured interface
- if (suricata_suppresslist_used($a_suppress[$_GET['id']]['name'])) {
+ if (suricata_suppresslist_used($a_suppress[$_POST['list_id']]['name'])) {
$input_errors[] = gettext("ERROR -- Suppress List is currently assigned to an interface and cannot be removed!");
}
else {
- unset($a_suppress[$_GET['id']]);
- write_config();
+ unset($a_suppress[$_POST['list_id']]);
+ write_config("Suricata pkg: deleted SUPPRESS LIST.");
+ sync_suricata_package_config();
header("Location: /suricata/suricata_suppress.php");
exit;
}
@@ -126,6 +127,7 @@ if ($input_errors) {
?>
<form action="/suricata/suricata_suppress.php" method="post"><?php if ($savemsg) print_info_box($savemsg); ?>
+<input type="hidden" name="list_id" id="list_id" value=""/>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr><td>
@@ -189,10 +191,8 @@ if ($input_errors) {
width="17" height="17" border="0" title="<?php echo gettext("Goto first instance associated with this Suppress List");?>"/></a>
</td>
<?php else : ?>
- <td><a href="/suricata/suricata_suppress.php?act=del&id=<?=$i;?>"
- onclick="return confirm('<?php echo gettext("Do you really want to delete this Suppress List?"); ?>')"><img
- src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif"
- width="17" height="17" border="0" title="<?php echo gettext("delete Suppress List"); ?>"></a></td>
+ <td><input type="image" name="del[]" onclick="document.getElementById('list_id').value='<?=$i;?>';return confirm('<?=gettext("Do you really want to delete this Suppress List?");?>');"
+ src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif" width="17" height="17" border="0" title="<?=gettext("delete Suppress List");?>"/></td>
<td>&nbsp;</td>
<?php endif; ?>
</tr>