Add call center queue language, dialect, and voice

This commit is contained in:
FusionPBX
2025-06-09 14:11:52 -06:00
committed by GitHub
parent e5ac4f8779
commit ef18551090
3 changed files with 79 additions and 3 deletions

View File

@@ -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'] = "";

View File

@@ -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 "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " ".$text['label-language']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' type='text' name='queue_language'>\n";
echo " <option></option>\n";
if (!empty($queue_language) && !empty($queue_dialect) && !empty($queue_voice)) {
$language_formatted = $queue_language."-".$queue_dialect." ".$queue_voice;
echo " <option value='".escape($queue_language.'/'.$queue_dialect.'/'.$queue_voice)."' selected='selected'>".escape($language_formatted)."</option>\n";
}
if (!empty($language_paths)) {
foreach ($language_paths as $key => $language_variables) {
$language_variables = explode('/',$language_paths[$key]);
$language = $language_variables[0];
$dialect = $language_variables[1];
$voice = $language_variables[2];
if (empty($language_formatted) || $language_formatted != $language.'-'.$dialect.' '.$voice) {
echo " <option value='".$language."/".$dialect."/".$voice."'>".$language."-".$dialect." ".$voice."</option>\n";
}
}
}
echo " </select>\n";
echo "<br />\n";
echo $text['description-language']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " ".$text['label-strategy']."\n";

View File

@@ -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([[ <queue name="]] .. xml.sanitize(queue_extension) .. [[@]] .. xml.sanitize(domain_name) .. [[" label="]] .. xml.sanitize(queue_name) .. [[@]] .. xml.sanitize(domain_name) .. [[">]]);
@@ -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