diff --git a/app/dialplan_outbound/app_languages.php b/app/dialplan_outbound/app_languages.php index e72df16f08..b0232bced6 100644 --- a/app/dialplan_outbound/app_languages.php +++ b/app/dialplan_outbound/app_languages.php @@ -197,6 +197,11 @@ $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['button-add']['en-us'] = "Add"; + $text['button-add']['es-cl'] = "Agregar"; + $text['button-add']['pt-pt'] = "Adicionar"; + $text['button-add']['fr-fr'] = "Ajouter"; + $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"; diff --git a/app/dialplan_outbound/dialplan_outbound_add.php b/app/dialplan_outbound/dialplan_outbound_add.php index ea8bc989bf..27b71757ab 100644 --- a/app/dialplan_outbound/dialplan_outbound_add.php +++ b/app/dialplan_outbound/dialplan_outbound_add.php @@ -54,7 +54,6 @@ 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"]); @@ -262,7 +261,13 @@ else { $label = $dialplan_expression; $abbrv = filename_safe($dialplan_expression); } - + + // Use as outbound prefix all digits beetwen ^ and first ( + $tmp_prefix = preg_replace("/^\^(\d{1,})\(.*/", "$1", $dialplan_expression); + $tmp_prefix == $dialplan_expression + ? $outbound_prefix = "" + : $outbound_prefix = $tmp_prefix; + if ($gateway_type == "gateway") { $dialplan_name = $gateway_name.".".$abbrv; $action_data = "sofia/gateway/".$gateway_uuid."/".$prefix_number."\$1"; @@ -466,10 +471,10 @@ else { 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) { + if (strlen($outbound_prefix) > 0) { $dialplan_detail_tag = 'action'; //condition, action, antiaction $dialplan_detail_type = 'set'; - $dialplan_detail_data = 'outbound_prefix='.$custom_outbound_prefix; + $dialplan_detail_data = 'outbound_prefix='.$outbound_prefix; $dialplan_detail_order = '060'; $dialplan_detail_group = ''; $dialplan_detail_break = ''; @@ -629,19 +634,16 @@ function type_onchange(dialplan_detail_type) { 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 " document.getElementById('outbound_prefix').value = '';\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('dialplan_expression').value += document.getElementById('dialplan_expression_select').value + '\\n';\n"; echo " document.getElementById('outbound_prefix').value = '';\n"; + echo " $('#enter_custom_outbound_prefix_box').slideUp();\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 " document.getElementById('dialplan_expression').value += '^' + document.getElementById('outbound_prefix').value + '(\\\d*)\$' + '\\n';\n"; echo "}\n"; echo "\n"; echo "\n"; @@ -834,8 +836,9 @@ function type_onchange(dialplan_detail_type) { echo " \n"; echo "
\n"; echo "