diff --git a/app/destinations/app_config.php b/app/destinations/app_config.php index 9c93d61272..babc2efc4b 100644 --- a/app/destinations/app_config.php +++ b/app/destinations/app_config.php @@ -123,6 +123,9 @@ $apps[$x]['permissions'][$y]['name'] = "destination_fax"; $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; $y++; + $apps[$x]['permissions'][$y]['name'] = "destination_emergency"; + $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; + $y++; $apps[$x]['permissions'][$y]['name'] = "destination_destinations"; $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; $apps[$x]['permissions'][$y]['groups'][] = "admin"; @@ -287,6 +290,10 @@ $apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Number is used for fax calls."; $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = "destination_type_emergency"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric"; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Number is used to place emergency calls."; + $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "destination_type_text"; $apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Number is used for text messages."; diff --git a/app/destinations/app_languages.php b/app/destinations/app_languages.php index 8b7c0c73b0..804e5dc5d3 100644 --- a/app/destinations/app_languages.php +++ b/app/destinations/app_languages.php @@ -883,6 +883,27 @@ $text['label-text']['ru-ru'] = "Текст"; $text['label-text']['sv-se'] = "Text"; $text['label-text']['uk-ua'] = "Текст"; +$text['label-emergency']['en-us'] = "Emergency"; +$text['label-emergency']['en-gb'] = "Emergency"; +$text['label-emergency']['ar-eg'] = ""; +$text['label-emergency']['de-at'] = "Anruferkennung"; //copied from de-de +$text['label-emergency']['de-ch'] = "Anruferkennung"; +$text['label-emergency']['de-de'] = "Notruf Anruferkennung"; +$text['label-emergency']['es-cl'] = "Emergencia"; +$text['label-emergency']['es-mx'] = "Emergencia"; //copied from es-cl +$text['label-emergency']['fr-ca'] = "Urgence"; //copied from fr-fr +$text['label-emergency']['fr-fr'] = "Urgence"; +$text['label-emergency']['he-il'] = ""; +$text['label-emergency']['it-it'] = "Emergenze"; +$text['label-emergency']['nl-nl'] = "Noodnummer"; +$text['label-emergency']['pl-pl'] = "Prezentacja nazwy dzwoniącego (emergency)"; +$text['label-emergency']['pt-br'] = "Emergência"; +$text['label-emergency']['pt-pt'] = "Emergência"; +$text['label-emergency']['ro-ro'] = ""; +$text['label-emergency']['ru-ru'] = "Идентификатор (Caller ID) имени экстренного вызова"; +$text['label-emergency']['sv-se'] = "Nöd Namnpresentation"; +$text['label-emergency']['uk-ua'] = ""; + $text['header-destinations']['en-us'] = "Destinations"; $text['header-destinations']['en-gb'] = "Destinations"; $text['header-destinations']['ar-eg'] = "جهات الأتصال"; diff --git a/app/destinations/destination_edit.php b/app/destinations/destination_edit.php index 77d92ccd5b..5f5b891fc8 100644 --- a/app/destinations/destination_edit.php +++ b/app/destinations/destination_edit.php @@ -107,6 +107,7 @@ $destination_type_voice = $_POST["destination_type_voice"]; $destination_type_fax = $_POST["destination_type_fax"]; $destination_type_text = $_POST["destination_type_text"]; + $destination_type_emergency = $_POST["destination_type_emergency"]; $destination_carrier = trim($_POST["destination_carrier"]); //get the destination app and data @@ -671,6 +672,9 @@ $array['destinations'][0]["destination_type_voice"] = $destination_type_voice ? 1 : null; $array['destinations'][0]["destination_type_fax"] = $destination_type_fax ? 1 : null; $array['destinations'][0]["destination_type_text"] = $destination_type_text ? 1 : null; + if (permission_exists('destination_emergency')){ + $array['destinations'][0]["destination_type_emergency"] = $destination_type_emergency ? 1 : null; + } if ($destination->valid($destination_app.':'.$destination_data)) { $array['destinations'][0]["destination_app"] = $destination_app; $array['destinations'][0]["destination_data"] = $destination_data; @@ -786,6 +790,7 @@ $destination_type_voice = $row["destination_type_voice"]; $destination_type_fax = $row["destination_type_fax"]; $destination_type_text = $row["destination_type_text"]; + $destination_type_emergency = $row["destination_type_emergency"]; $destination_context = $row["destination_context"]; $destination_app = $row["destination_app"]; $destination_data = $row["destination_data"]; @@ -1233,6 +1238,9 @@ echo "  \n"; echo "  \n"; echo " \n"; + if (permission_exists('destination_emergency')){ + echo " \n"; + } echo "
\n"; echo $text['description-usage']."\n"; echo "\n"; diff --git a/app/extensions/app_config.php b/app/extensions/app_config.php index 2c2e0ec61b..4012dfbeee 100644 --- a/app/extensions/app_config.php +++ b/app/extensions/app_config.php @@ -169,6 +169,8 @@ $apps[$x]['permissions'][$y]['name'] = "emergency_caller_id_number"; $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; $y++; + $apps[$x]['permissions'][$y]['name'] = "emergency_caller_id_select"; + $y++; $apps[$x]['permissions'][$y]['name'] = "extension_user_record"; $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; $y++; diff --git a/app/extensions/extension_edit.php b/app/extensions/extension_edit.php index 4ef2eddade..d35143b2c8 100644 --- a/app/extensions/extension_edit.php +++ b/app/extensions/extension_edit.php @@ -800,6 +800,19 @@ $destinations = $database->select($sql, $parameters, 'all'); unset($sql, $parameters); +//get the emergency destinations + if (permission_exists('emergency_caller_id_select')) { + $sql = "select * from v_destinations "; + $sql .= "where domain_uuid = :domain_uuid "; + $sql .= "and destination_type = 'inbound' "; + $sql .= "and destination_type_emergency = 1 "; + $sql .= "order by destination_number asc "; + $parameters['domain_uuid'] = $domain_uuid; + $database = new database; + $emergency_destinations = $database->select($sql, $parameters, 'all'); + unset($sql, $parameters); + } + //change toll allow delimiter $toll_allow = str_replace(':',',', $toll_allow); @@ -1298,7 +1311,31 @@ echo " ".$text['label-emergency_caller_id_name']."\n"; echo "\n"; echo "\n"; - if (permission_exists('outbound_caller_id_select')) { + if (permission_exists('emergency_caller_id_select')) { + if (count($emergency_destinations) > 0) { + echo " \n"; + } + else { + echo " \n"; + } + } + elseif (permission_exists('outbound_caller_id_select')) { if (count($destinations) > 0) { echo " \n"; + //echo " \n"; Don't allow no selection when validating emergency numbers this way + foreach ($emergency_destinations as &$row) { + $tmp = $row["destination_caller_id_number"]; + if(strlen($tmp) == 0){ + $tmp = $row["destination_number"]; + } + if(strlen($tmp) > 0){ + if ($emergency_caller_id_number == $tmp) { + echo " \n"; + } + else { + echo " \n"; + } + } + } + echo " \n"; + } + else { + echo " \n"; + } + } + elseif (permission_exists('outbound_caller_id_select')) { if (count($destinations) > 0) { echo " \n"; } echo "
\n"; - if (permission_exists('outbound_caller_id_select') && count($destinations) > 0) { + if (permission_exists('emergency_caller_id_select') && count($emergency_destinations) > 0){ + echo $text['description-emergency_caller_id_number-select']."\n"; + } + elseif (permission_exists('outbound_caller_id_select') && count($destinations) > 0) { echo $text['description-emergency_caller_id_number-select']."\n"; } else {