From ef18551090db140c73b58b9c84234d1b80720c54 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Mon, 9 Jun 2025 14:11:52 -0600 Subject: [PATCH] Add call center queue language, dialect, and voice --- app/call_centers/app_config.php | 12 ++++ app/call_centers/call_center_queue_edit.php | 55 +++++++++++++++++++ .../scripts/configuration/callcenter.conf.lua | 15 ++++- 3 files changed, 79 insertions(+), 3 deletions(-) diff --git a/app/call_centers/app_config.php b/app/call_centers/app_config.php index f1a46d8a58..4afafe6e4f 100644 --- a/app/call_centers/app_config.php +++ b/app/call_centers/app_config.php @@ -421,6 +421,18 @@ $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = "queue_language"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = "queue_dialect"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = "queue_voice"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; + $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "queue_time_base_score"; $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; diff --git a/app/call_centers/call_center_queue_edit.php b/app/call_centers/call_center_queue_edit.php index 475346a7b5..182bc0f3ff 100644 --- a/app/call_centers/call_center_queue_edit.php +++ b/app/call_centers/call_center_queue_edit.php @@ -72,6 +72,20 @@ //initialize the destination object $destination = new destinations; +//get installed languages + $language_paths = glob($settings->get('switch', 'sounds')."/*/*/*"); + foreach ($language_paths as $key => $path) { + $path = str_replace($settings->get('switch', 'sounds').'/', "", $path); + $path_array = explode('/', $path); + if (count($path_array) <> 3 || strlen($path_array[0]) <> 2 || strlen($path_array[1]) <> 2) { + unset($language_paths[$key]); + } + $language_paths[$key] = str_replace($settings->get('switch', 'sounds')."/","",$language_paths[$key] ?? ''); + if (empty($language_paths[$key])) { + unset($language_paths[$key]); + } + } + //get total call center queues count from the database, check limit, if defined if ($action == 'add') { if (!empty($settings->get('limit','call_center_queues', ''))) { @@ -97,6 +111,7 @@ $queue_name = $_POST["queue_name"]; $queue_extension = $_POST["queue_extension"]; $queue_greeting = $_POST["queue_greeting"]; + $queue_language = $_POST["queue_language"]; $queue_strategy = $_POST["queue_strategy"]; $call_center_tiers = $_POST["call_center_tiers"]; $queue_moh_sound = $_POST["queue_moh_sound"]; @@ -131,6 +146,12 @@ $queue_context = $domain_name; } + //seperate the language components into language, dialect and voice + $language_array = explode("/",$queue_language); + $queue_language = $language_array[0] ?? ''; + $queue_dialect = $language_array[1] ?? ''; + $queue_voice = $language_array[2] ?? ''; + //remove invalid characters $queue_cid_prefix = str_replace(":", "-", $queue_cid_prefix); $queue_cid_prefix = str_replace("\"", "", $queue_cid_prefix); @@ -311,9 +332,12 @@ $array['call_center_queues'][0]['queue_name'] = $queue_name; $array['call_center_queues'][0]['queue_extension'] = $queue_extension; $array['call_center_queues'][0]['queue_greeting'] = $queue_greeting; + $array['call_center_queues'][0]['queue_language'] = $queue_language; $array['call_center_queues'][0]['queue_strategy'] = $queue_strategy; $array['call_center_queues'][0]['queue_moh_sound'] = $queue_moh_sound; $array['call_center_queues'][0]['queue_record_template'] = $queue_record_template; + $array['call_center_queues'][0]['queue_dialect'] = $queue_dialect; + $array['call_center_queues'][0]['queue_voice'] = $queue_voice; $array['call_center_queues'][0]['queue_time_base_score'] = $queue_time_base_score; $array['call_center_queues'][0]['queue_time_base_score_sec'] = $queue_time_base_score_sec; $array['call_center_queues'][0]['queue_max_wait_time'] = $queue_max_wait_time; @@ -548,6 +572,9 @@ $database_queue_name = $row["queue_name"]; $queue_extension = $row["queue_extension"]; $queue_greeting = $row["queue_greeting"]; + $queue_language = $row["queue_language"]; + $queue_dialect = $row["queue_dialect"]; + $queue_voice = $row["queue_voice"]; $queue_strategy = $row["queue_strategy"]; $queue_moh_sound = $row["queue_moh_sound"]; $queue_record_template = $row["queue_record_template"]; @@ -864,6 +891,34 @@ echo "\n"; echo "\n"; + echo "\n"; + echo "\n"; + echo " ".$text['label-language']."\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-language']."\n"; + echo "\n"; + echo "\n"; + echo "\n"; echo "\n"; echo " ".$text['label-strategy']."\n"; diff --git a/app/switch/resources/scripts/app/xml_handler/resources/scripts/configuration/callcenter.conf.lua b/app/switch/resources/scripts/app/xml_handler/resources/scripts/configuration/callcenter.conf.lua index d674456c21..583e1b956f 100644 --- a/app/switch/resources/scripts/app/xml_handler/resources/scripts/configuration/callcenter.conf.lua +++ b/app/switch/resources/scripts/app/xml_handler/resources/scripts/configuration/callcenter.conf.lua @@ -25,7 +25,7 @@ -- POSSIBILITY OF SUCH DAMAGE. --include functions -require "resources.functions.format_ringback" + require "resources.functions.format_ringback" --include xml library local Xml = require "resources.functions.xml"; @@ -102,6 +102,9 @@ require "resources.functions.format_ringback" domain_name = row.domain_name; queue_name = row.queue_name; queue_extension = row.queue_extension; + queue_language = row.queue_language; + queue_dialect = row.queue_dialect; + queue_voice = row.queue_voice; queue_strategy = row.queue_strategy; queue_moh_sound = row.queue_moh_sound; queue_record_template = row.queue_record_template; @@ -132,7 +135,6 @@ require "resources.functions.format_ringback" queue_record_template = string.gsub(queue_record_template, "{sip_from_user}", "${sip_from_user}"); queue_record_template = string.gsub(queue_record_template, "{sip_to_user}", "${sip_to_user}"); queue_record_template = string.gsub(queue_record_template, "{sip_req_user}", "${sip_req_user}"); - --start the xml xml:append([[ ]]); @@ -232,8 +234,15 @@ require "resources.functions.format_ringback" --add the call_timeout agent_contact = "{call_timeout="..agent_call_timeout..",domain_name="..domain_name..",domain_uuid="..domain_uuid..",extension_uuid="..extension_uuid..",sip_h_caller_destination=${caller_destination}"..record.."}"..agent_contact; else + --set the language, voice and dialect + if (queue_language ~= nil and queue_language ~= nil and queue_language ~= nil) then + language = "default_language="..queue_language..",queue_voice="..queue_voice..",queue_dialect="..queue_dialect; + else + language = ''; + end + --add the call_timeout and confirm - agent_contact = "{"..confirm..",call_timeout="..agent_call_timeout..",domain_name="..domain_name..",domain_uuid="..domain_uuid..",sip_h_caller_destination=${caller_destination}}"..agent_contact; + agent_contact = "{"..confirm..",call_timeout="..agent_call_timeout..",domain_name="..domain_name..","..language..",domain_uuid="..domain_uuid..",sip_h_caller_destination=${caller_destination}}"..agent_contact; end else --found