diff options
author | mcrane <mctch@yahoo.com> | 2009-07-04 04:10:55 -0600 |
---|---|---|
committer | mcrane <mctch@yahoo.com> | 2009-07-04 04:27:38 -0600 |
commit | 578fda76bb2566d8cf9deeaee3569a35da6ba63e (patch) | |
tree | b23be34bb00cef283f0578888a70f0c701fd1c54 /config/freeswitch | |
parent | 641bf230fc57b77feaadeca70da5b3511081e84a (diff) | |
download | pfsense-packages-578fda76bb2566d8cf9deeaee3569a35da6ba63e.tar.gz pfsense-packages-578fda76bb2566d8cf9deeaee3569a35da6ba63e.tar.bz2 pfsense-packages-578fda76bb2566d8cf9deeaee3569a35da6ba63e.zip |
add sip-force-contact to advanced extension options, add ability to disable an extension without removing it
Diffstat (limited to 'config/freeswitch')
-rw-r--r-- | config/freeswitch/freeswitch.inc | 122 | ||||
-rw-r--r-- | config/freeswitch/freeswitch_extensions.tmp | 7 | ||||
-rw-r--r-- | config/freeswitch/freeswitch_extensions_edit.tmp | 57 |
3 files changed, 122 insertions, 64 deletions
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 = "<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"; - } - $tmpxml .= " </variables>\n"; - $tmpxml .= " </user>\n"; - $tmpxml .= "</include>\n"; - fwrite($fout, $tmpxml); - unset($tmpxml); - fclose($fout); + $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(); 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()); <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"> + <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"> |