From aafdffb8b6d72a272b940999dff308ea25a18831 Mon Sep 17 00:00:00 2001 From: Riccardo Granchi Date: Wed, 5 Nov 2014 16:40:48 +0000 Subject: [PATCH] Simplified the use of a custom prefix in the outbound routes --- app/dialplan_outbound/app_languages.php | 10 +++ .../dialplan_outbound_add.php | 67 ++++++++++++++----- 2 files changed, 62 insertions(+), 15 deletions(-) diff --git a/app/dialplan_outbound/app_languages.php b/app/dialplan_outbound/app_languages.php index dcfe75f24c..223242e28a 100644 --- a/app/dialplan_outbound/app_languages.php +++ b/app/dialplan_outbound/app_languages.php @@ -191,6 +191,16 @@ $text['label-800']['pt-pt'] = "Sem Custo"; $text['label-800']['fr-fr'] = "Sans Charge"; + $text['label-custom-outbound-prefix']['en-us'] = "Dial custom prefix, then Digits"; + $text['label-custom-outbound-prefix']['es-cl'] = "Marcar prefijo personalizados, luego Dígitos"; + $text['label-custom-outbound-prefix']['pt-pt'] = "Marque prefixo personalizado, seguido de Dígitos"; + $text['label-custom-outbound-prefix']['fr-fr'] = "Compose préfixe personnalisé, puis Digits"; + + $text['description-enter-custom-outbound-prefix']['en-us'] = "Enter custom outbound prefix"; + $text['description-enter-custom-outbound-prefix']['es-cl'] = "Ingrese un prefijo de salida personalizados"; + $text['description-enter-custom-outbound-prefix']['pt-pt'] = "Introduza um prefixo de saída personalizado"; + $text['description-enter-custom-outbound-prefix']['fr-fr'] = "Choisir le préfixe sortantes personnalisé"; + $text['message-update']['en-us'] = "Update Complete"; $text['message-update']['es-cl'] = "Actualización Completa"; $text['message-update']['pt-pt'] = "Actualização Efectuada"; diff --git a/app/dialplan_outbound/dialplan_outbound_add.php b/app/dialplan_outbound/dialplan_outbound_add.php index 64605407c1..e1325eb332 100644 --- a/app/dialplan_outbound/dialplan_outbound_add.php +++ b/app/dialplan_outbound/dialplan_outbound_add.php @@ -53,6 +53,7 @@ else { $dialplan_name = check_str($_POST["dialplan_name"]); $dialplan_order = check_str($_POST["dialplan_order"]); $dialplan_expression = check_str($_POST["dialplan_expression"]); + $custom_outbound_prefix = check_str($_POST["custom-outbound-prefix"]); $prefix_number = check_str($_POST["prefix_number"]); $condition_field_1 = check_str($_POST["condition_field_1"]); $condition_expression_1 = check_str($_POST["condition_expression_1"]); @@ -392,7 +393,7 @@ else { $dialplan_detail_tag = 'action'; //condition, action, antiaction $dialplan_detail_type = 'set'; $dialplan_detail_data = 'sip_h_X-Tag='; - $dialplan_detail_order = '012'; + $dialplan_detail_order = '015'; $dialplan_detail_group = ''; dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data); } @@ -400,22 +401,31 @@ else { $dialplan_detail_tag = 'action'; //condition, action, antiaction $dialplan_detail_type = 'set'; $dialplan_detail_data = 'call_direction=outbound'; - $dialplan_detail_order = '015'; + $dialplan_detail_order = '020'; $dialplan_detail_group = ''; dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data); + if (strlen($custom_outbound_prefix) > 0) { + $dialplan_detail_tag = 'action'; //condition, action, antiaction + $dialplan_detail_type = 'set'; + $dialplan_detail_data = 'outbound_prefix='.$custom_outbound_prefix; + $dialplan_detail_order = '025'; + $dialplan_detail_group = ''; + dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data); + } + if ($gateway_type != "transfer") { $dialplan_detail_tag = 'action'; //condition, action, antiaction $dialplan_detail_type = 'set'; $dialplan_detail_data = 'hangup_after_bridge=true'; - $dialplan_detail_order = '020'; + $dialplan_detail_order = '030'; $dialplan_detail_group = ''; dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data); $dialplan_detail_tag = 'action'; //condition, action, antiaction $dialplan_detail_type = 'set'; $dialplan_detail_data = 'effective_caller_id_name=${outbound_caller_id_name}'; - $dialplan_detail_order = '025'; + $dialplan_detail_order = '035'; $dialplan_detail_group = ''; dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data); @@ -427,21 +437,21 @@ else { else { $dialplan_detail_data = 'effective_caller_id_number=${outbound_caller_id_number}'; } - $dialplan_detail_order = '030'; + $dialplan_detail_order = '040'; $dialplan_detail_group = ''; dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data); $dialplan_detail_tag = 'action'; //condition, action, antiaction $dialplan_detail_type = 'set'; $dialplan_detail_data = 'inherit_codec=true'; - $dialplan_detail_order = '035'; + $dialplan_detail_order = '045'; $dialplan_detail_group = ''; dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data); $dialplan_detail_tag = 'action'; //condition, action, antiaction $dialplan_detail_type = 'set'; $dialplan_detail_data = 'continue_on_fail=true'; - $dialplan_detail_order = '040'; + $dialplan_detail_order = '050'; $dialplan_detail_group = ''; dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data); } @@ -450,7 +460,7 @@ else { $dialplan_detail_tag = 'action'; //condition, action, antiaction $dialplan_detail_type = 'enum'; $dialplan_detail_data = $prefix_number."$1 e164.org"; - $dialplan_detail_order = '045'; + $dialplan_detail_order = '055'; $dialplan_detail_group = ''; dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data); } @@ -459,7 +469,7 @@ else { $dialplan_detail_tag = 'action'; //condition, action, antiaction $dialplan_detail_type = 'limit'; $dialplan_detail_data = "hash \${domain} outbound ".$limit." !USER_BUSY"; - $dialplan_detail_order = '050'; + $dialplan_detail_order = '060'; $dialplan_detail_group = ''; dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data); } @@ -467,7 +477,7 @@ else { $dialplan_detail_tag = 'action'; //condition, action, antiaction $dialplan_detail_type = 'bridge'; $dialplan_detail_data = $action_data; - $dialplan_detail_order = '055'; + $dialplan_detail_order = '065'; $dialplan_detail_group = ''; dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data); @@ -475,7 +485,7 @@ else { $dialplan_detail_tag = 'action'; //condition, action, antiaction $dialplan_detail_type = 'bridge'; $dialplan_detail_data = $bridge_2_data; - $dialplan_detail_order = '060'; + $dialplan_detail_order = '070'; $dialplan_detail_group = ''; dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data); } @@ -484,7 +494,7 @@ else { $dialplan_detail_tag = 'action'; //condition, action, antiaction $dialplan_detail_type = 'bridge'; $dialplan_detail_data = $bridge_3_data; - $dialplan_detail_order = '065'; + $dialplan_detail_order = '075'; $dialplan_detail_group = ''; dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data); } @@ -542,6 +552,7 @@ function type_onchange(dialplan_detail_type) { document.getElementById("desc_condition_expression_2").innerHTML = ""; } } +} --> @@ -613,6 +624,22 @@ function type_onchange(dialplan_detail_type) { echo " obj[0].parentNode.removeChild(obj[1]);\n"; echo " obj[0].parentNode.removeChild(obj[2]);\n"; echo "}\n"; + echo "function update_dialplan_expression() {\n"; + echo " if ( document.getElementById('dialplan_expression_select').value == 'CUSTOM_PREFIX' ) {\n"; + echo " document.getElementById('dialplan_expression').value = '^(\\\d*)\$';\n"; + echo " $('#enter_custom_outbound_prefix_box').slideDown();\n"; + echo " $('#dialplan_expression_box').slideUp();\n"; + echo " document.getElementById('outbound_prefix').value = '';\n"; + echo " } else { \n"; + echo " document.getElementById('dialplan_expression').value = document.getElementById('dialplan_expression_select').value;\n"; + echo " $('#enter_custom_outbound_prefix_box').slideUp();\n"; + echo " $('#dialplan_expression_box').slideDown();\n"; + echo " document.getElementById('outbound_prefix').value = '';\n"; + echo " }\n"; + echo "}\n"; + echo "function update_outbound_prefix() {\n"; + echo " document.getElementById('dialplan_expression').value = '^' + document.getElementById('outbound_prefix').value + '(\\\d*)\$';\n"; + echo "}\n"; echo "\n"; echo "\n"; } @@ -797,9 +824,18 @@ function type_onchange(dialplan_detail_type) { echo "\n"; echo " ".$text['label-dialplan-expression'].":\n"; echo " "; - echo " \n"; - echo "
\n"; - echo " \n"; + echo "
\n"; + echo " \n"; + + echo "
\n"; + echo "
\n"; + echo " ".$text['description-enter-custom-outbound-prefix'].".\n"; + echo "
\n"; + + echo " \n"; echo " \n"; echo "
\n";