Simplify voicemail transcription

This is done by deprecating default setting voicemail transcribe_enabled.

Instead control this with the voicemail_transcription_enabled permission  and per voicemail.
This commit is contained in:
FusionPBX 2024-09-09 12:58:36 -06:00 committed by GitHub
parent 259ac1212d
commit 214a24bc39
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 8 additions and 23 deletions

View File

@ -1772,7 +1772,7 @@
echo "</td>\n";
echo "</tr>\n";
if (permission_exists('voicemail_transcription_enabled') && ($_SESSION['voicemail']['transcribe_enabled']['boolean'] ?? '') == "true") {
if (permission_exists('voicemail_transcription_enabled') && ($_SESSION['transcribe']['enabled']['boolean'] ?? '') == "true") {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-voicemail_transcription_enabled']."\n";

View File

@ -567,7 +567,7 @@
if (storage_type == "base64") then
table.insert(sql, "message_base64, ");
end
if (transcribe_enabled == "true") and (voicemail_transcription_enabled == "true") then
if (voicemail_transcription_enabled == "true") then
table.insert(sql, "message_transcription, ");
end
table.insert(sql, "message_length ");
@ -585,7 +585,7 @@
if (storage_type == "base64") then
table.insert(sql, ":message_base64, ");
end
if (transcribe_enabled == "true") and (voicemail_transcription_enabled == "true") then
if (voicemail_transcription_enabled == "true") then
table.insert(sql, ":transcription, ");
end
table.insert(sql, ":message_length ");

View File

@ -30,9 +30,8 @@
--define a function to send email
function send_email(id, uuid)
local db = dbh or Database.new('system')
local settings = Settings.new(db, domain_name, domain_uuid)
local transcribe_enabled = settings:get('voicemail', 'transcribe_enabled', 'boolean');
local db = dbh or Database.new('system');
local settings = Settings.new(db, domain_name, domain_uuid);
local http_protocol = settings:get('domain', 'http_protocol', 'text') or "https";
local email_queue_enabled = "true";
@ -185,7 +184,7 @@
sql = sql .. "WHERE (domain_uuid = :domain_uuid or domain_uuid is null) ";
sql = sql .. "AND template_language = :template_language ";
sql = sql .. "AND template_category = 'voicemail' "
if (transcribe_enabled == 'true' and voicemail_transcription_enabled == 'true') then
if (voicemail_transcription_enabled == 'true') then
sql = sql .. "AND template_subcategory = 'transcription' "
else
sql = sql .. "AND template_subcategory = 'default' "

View File

@ -386,14 +386,6 @@
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false";
$apps[$x]['default_settings'][$y]['default_setting_description'] = "";
$y++;
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "5d9a1f93-e163-4c05-a975-bd1e5a045660";
$apps[$x]['default_settings'][$y]['default_setting_category'] = "voicemail";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "transcribe_enabled";
$apps[$x]['default_settings'][$y]['default_setting_name'] = "boolean";
$apps[$x]['default_settings'][$y]['default_setting_value'] = "true";
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false";
$apps[$x]['default_settings'][$y]['default_setting_description'] = "Transcription enabled default false.";
$y++;
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "275cf580-7b72-45e4-9af5-b8eed9a45ec0";
$apps[$x]['default_settings'][$y]['default_setting_category'] = "voicemail";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "database_retention_days";

View File

@ -458,10 +458,7 @@
}
echo button::create(['type'=>'button','title'=>$text['label-play'].' / '.$text['label-pause'].' '.$text['label-message'],'icon'=>$_SESSION['theme']['button_icon_play'],'id'=>'recording_button_'.escape($row['voicemail_message_uuid']),'onclick'=>"recording_play('".escape($row['voicemail_message_uuid'])."','".$row['voicemail_id'].'|'.$row['voicemail_uuid']."','message');"]);
echo button::create(['type'=>'button','title'=>$text['label-download'],'icon'=>$_SESSION['theme']['button_icon_download'],'link'=>"voicemail_messages.php?action=download&id=".urlencode($row['voicemail_id'])."&voicemail_uuid=".escape($row['voicemail_uuid'])."&uuid=".escape($row['voicemail_message_uuid'])."&t=bin&r=".uuid(),'onclick'=>"$(this).closest('tr').children('td').css('font-weight','normal');"]);
if (
(!empty($_SESSION['voicemail']['transcribe_enabled']['boolean']) && $_SESSION['voicemail']['transcribe_enabled']['boolean'] == 'true' && !empty($row['message_transcription'])) ||
($transcribe_enabled == 'true' && !empty($transcribe_engine) && $transcriptions_exists === true)
) {
if (!empty($row['message_transcription']) || ($transcribe_enabled == 'true' && !empty($transcribe_engine) && $transcriptions_exists === true)) {
echo button::create(['type'=>'button','title'=>$text['label-transcription'],'icon'=>'quote-right','style'=>(empty($row['message_transcription']) ? 'visibility:hidden;' : null),'onclick'=>(!empty($bold) ? "mark_saved('".$row['voicemail_message_uuid']."', '".$row['voicemail_uuid']."');" : null)."document.getElementById('transcription_".$row['voicemail_message_uuid']."').style.display = document.getElementById('transcription_".$row['voicemail_message_uuid']."').style.display == 'none' ? 'table-row' : 'none'; this.blur(); return false;"]);
}
echo " </td>\n";
@ -470,10 +467,7 @@
echo " <td class='right no-wrap hide-sm-dn' style='".$bold."'>".escape($row['file_size_label'])."</td>\n";
}
echo "</tr>\n";
if (
(!empty($_SESSION['voicemail']['transcribe_enabled']['boolean']) && $_SESSION['voicemail']['transcribe_enabled']['boolean'] == 'true' && !empty($row['message_transcription'])) ||
($transcribe_enabled == 'true' && !empty($transcribe_engine) && $transcriptions_exists === true)
) {
if (!empty($row['message_transcription']) || ($transcribe_enabled == 'true' && !empty($transcribe_engine) && $transcriptions_exists === true)) {
echo "<tr style='display: none;'><td></td></tr>\n"; // dummy row to maintain same background color for transcription row
echo "<tr id='transcription_".$row['voicemail_message_uuid']."' class='list-row' style='display: none;'>\n";
echo " <td style='padding: 10px 20px 15px 20px;' colspan='".$col_count."'>\n";