From 578fda76bb2566d8cf9deeaee3569a35da6ba63e Mon Sep 17 00:00:00 2001 From: mcrane Date: Sat, 4 Jul 2009 04:10:55 -0600 Subject: add sip-force-contact to advanced extension options, add ability to disable an extension without removing it --- config/freeswitch/freeswitch.inc | 122 ++++++++++++----------- config/freeswitch/freeswitch_extensions.tmp | 7 +- config/freeswitch/freeswitch_extensions_edit.tmp | 57 ++++++++++- 3 files changed, 122 insertions(+), 64 deletions(-) (limited to 'config/freeswitch') diff --git a/config/freeswitch/freeswitch.inc b/config/freeswitch/freeswitch.inc index 0a3929eb..fcba145e 100644 --- a/config/freeswitch/freeswitch.inc +++ b/config/freeswitch/freeswitch.inc @@ -562,66 +562,70 @@ function sync_package_freeswitch_extensions() 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"); - $fout = fopen("/usr/local/freeswitch/conf/directory/default/".$rowhelper['extension'].".xml","w"); - - $tmpxml = "\n"; - if (strlen($rowhelper['cidr']) == 0) { - $tmpxml .= " \n"; - } - else { - $tmpxml .= " \n"; - } - $tmpxml .= " \n"; - $tmpxml .= " \n"; - $tmpxml .= " \n"; - if (strlen($rowhelper['vm-mailto']) > 0) { - $tmpxml .= " \n"; - - switch ($rowhelper['vm-attach-file']) { - case "true": - $tmpxml .= " \n"; - break; - case "false": - $tmpxml .= " \n"; - break; - default: - $tmpxml .= " \n"; - } - switch ($rowhelper['vm-keep-local-after-email']) { - case "true": - $tmpxml .= " \n"; - break; - case "false": - $tmpxml .= " \n"; - break; - default: - $tmpxml .= " \n"; - } - $tmpxml .= " \n"; - } - if (strlen($rowhelper['auth-acl']) > 0) { - $tmpxml .= " \n"; - } - $tmpxml .= " \n"; - $tmpxml .= " \n"; - $tmpxml .= " \n"; - $tmpxml .= " \n"; - $tmpxml .= " \n"; - if (strlen($rowhelper['effective_caller_id_number']) > 0) { - $tmpxml .= " \n"; - $tmpxml .= " \n"; - } - if (strlen($rowhelper['outbound_caller_id_number']) > 0) { - $tmpxml .= " \n"; - $tmpxml .= " \n"; - } - $tmpxml .= " \n"; - $tmpxml .= " \n"; - $tmpxml .= "\n"; - fwrite($fout, $tmpxml); - unset($tmpxml); - fclose($fout); + $tmpxml = "\n"; + if (strlen($rowhelper['cidr']) == 0) { + $tmpxml .= " \n"; + } + else { + $tmpxml .= " \n"; + } + $tmpxml .= " \n"; + $tmpxml .= " \n"; + $tmpxml .= " \n"; + if (strlen($rowhelper['vm-mailto']) > 0) { + $tmpxml .= " \n"; + + switch ($rowhelper['vm-attach-file']) { + case "true": + $tmpxml .= " \n"; + break; + case "false": + $tmpxml .= " \n"; + break; + default: + $tmpxml .= " \n"; + } + switch ($rowhelper['vm-keep-local-after-email']) { + case "true": + $tmpxml .= " \n"; + break; + case "false": + $tmpxml .= " \n"; + break; + default: + $tmpxml .= " \n"; + } + $tmpxml .= " \n"; + } + if (strlen($rowhelper['auth-acl']) > 0) { + $tmpxml .= " \n"; + } + $tmpxml .= " \n"; + $tmpxml .= " \n"; + $tmpxml .= " \n"; + $tmpxml .= " \n"; + $tmpxml .= " \n"; + if (strlen($rowhelper['effective_caller_id_number']) > 0) { + $tmpxml .= " \n"; + $tmpxml .= " \n"; + } + if (strlen($rowhelper['outbound_caller_id_number']) > 0) { + $tmpxml .= " \n"; + $tmpxml .= " \n"; + } + if (strlen($rowhelper['sip-force-contact']) > 0) { + $tmpxml .= " \n"; + } + $tmpxml .= " \n"; + $tmpxml .= " \n"; + $tmpxml .= "\n"; + fwrite($fout, $tmpxml); + unset($tmpxml); + fclose($fout); + } } conf_mount_ro(); diff --git a/config/freeswitch/freeswitch_extensions.tmp b/config/freeswitch/freeswitch_extensions.tmp index 8ef415fd..b1db2702 100644 --- a/config/freeswitch/freeswitch_extensions.tmp +++ b/config/freeswitch/freeswitch_extensions.tmp @@ -38,8 +38,11 @@ $a_extensions = &$config['installedpackages']['freeswitchextensions']['confi if ($_GET['act'] == "del") { if ($_GET['type'] == 'extensions') { - if ($a_extensions[$_GET['id']]) { - unlink("/usr/local/freeswitch/conf/directory/default/".$_GET['extension'].".xml"); + 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"); diff --git a/config/freeswitch/freeswitch_extensions_edit.tmp b/config/freeswitch/freeswitch_extensions_edit.tmp index 54b46d7c..8e4a72dc 100644 --- a/config/freeswitch/freeswitch_extensions_edit.tmp +++ b/config/freeswitch/freeswitch_extensions_edit.tmp @@ -60,6 +60,8 @@ if (isset($id) && $a_extensions[$id]) { $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']; } @@ -94,8 +96,9 @@ if ($_POST) { $ent['user_context'] = $_POST['user_context']; $ent['callgroup'] = $_POST['callgroup']; $ent['auth-acl'] = $_POST['auth-acl']; - $ent['cidr'] = $_POST['cidr']; - + $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]) { @@ -325,10 +328,58 @@ display_top_tabs(build_menu());
Enter the outbound caller id number here.
+ + SIP-Force-Contact + + \n"; + echo " \n"; + switch (htmlspecialchars($pconfig['sip-force-contact'])) { + case "NDLB-connectile-dysfunction": + echo " \n"; + echo " \n"; + break; + case "NDLB-tls-connectile-dysfunction": + echo " \n"; + echo " \n"; + default: + echo " \n"; + echo " \n"; + } + echo " \n"; + ?> +
+ Choose sip-force-contact can be used to NDLB-connectile-dysfunction rewrites contact IP and port,
and NDLB-tls-connectile-dysfunction rewrites the contact port.
+ + - +
+ + + +
Enabled + \n"; + echo " \n"; + switch (htmlspecialchars($pconfig['enabled'])) { + case "true": + echo " \n"; + echo " \n"; + break; + case "false": + echo " \n"; + echo " \n"; + + break; + default: + echo " \n"; + echo " \n"; + } + echo " \n"; + ?> +
Extension Description -- cgit v1.2.3