diff --git a/app/call_recordings/call_recordings.php b/app/call_recordings/call_recordings.php index 10081a2b4d..c3d4be0889 100644 --- a/app/call_recordings/call_recordings.php +++ b/app/call_recordings/call_recordings.php @@ -44,7 +44,7 @@ //add the settings object $settings = new settings(["domain_uuid" => $_SESSION['domain_uuid'], "user_uuid" => $_SESSION['user_uuid']]); - $transcribe_enabled = $settings->get('transcribe', 'enabled', 'false'); + $transcribe_enabled = $settings->get('transcribe', 'enabled', false); $transcribe_engine = $settings->get('transcribe', 'engine', ''); //set additional variables @@ -161,7 +161,7 @@ unset($sql, $parameters); //detect if any transcriptions available - if ($transcribe_enabled == 'true' && !empty($transcribe_engine) && !empty($call_recordings) && is_array($call_recordings)) { + if ($transcribe_enabled && !empty($transcribe_engine) && !empty($call_recordings) && is_array($call_recordings)) { $transcriptions_exists = false; foreach ($call_recordings as $row) { if (!empty($row['call_recording_transcription'])) { $transcriptions_exists = true; } @@ -199,7 +199,7 @@ if (permission_exists('call_recording_download') && !empty($call_recordings)) { echo button::create(['type'=>'button','label'=>$text['button-download'],'icon'=>$_SESSION['theme']['button_icon_download'],'id'=>'btn_download','name'=>'btn_download','style'=>'display: none;','collapse'=>'hide-xs','onclick'=>"list_action_set('download'); list_form_submit('form_list');"]); } - if (permission_exists('call_recording_transcribe') && $transcribe_enabled == 'true' && !empty($transcribe_engine) && !empty($call_recordings)) { + if (permission_exists('call_recording_transcribe') && $transcribe_enabled && !empty($transcribe_engine) && !empty($call_recordings)) { echo button::create(['type'=>'button','label'=>$text['button-transcribe'],'icon'=>'quote-right','id'=>'btn_transcribe','name'=>'btn_transcribe','style'=>'display: none;','collapse'=>'hide-xs','onclick'=>"list_action_set('transcribe'); list_form_submit('form_list');"]); } if (permission_exists('call_recording_delete') && !empty($call_recordings)) { @@ -314,7 +314,7 @@ if (permission_exists('call_recording_download')) { echo button::create(['type'=>'button','title'=>$text['label-download'],'icon'=>$_SESSION['theme']['button_icon_download'],'link'=>'download.php?id='.urlencode($row['call_recording_uuid']).'&binary']); } - if (permission_exists('call_recording_transcribe') && $transcribe_enabled == 'true' && !empty($transcribe_engine) && $transcriptions_exists === true) { + if (permission_exists('call_recording_transcribe') && $transcribe_enabled && !empty($transcribe_engine) && $transcriptions_exists === true) { echo button::create(['type'=>'button','title'=>$text['label-transcription'],'icon'=>'quote-right','style'=>(empty($row['call_recording_transcription']) ? 'visibility:hidden;' : null),'onclick'=>"document.getElementById('transcription_".$row['call_recording_uuid']."').style.display = document.getElementById('transcription_".$row['call_recording_uuid']."').style.display == 'none' ? 'table-row' : 'none'; this.blur(); return false;"]); } } @@ -329,7 +329,7 @@ echo " \n"; } echo "\n"; - if (permission_exists('call_recording_transcribe') && $transcribe_enabled == 'true' && !empty($transcribe_engine) && !empty($row['call_recording_transcription'])) { + if (permission_exists('call_recording_transcribe') && $transcribe_enabled && !empty($transcribe_engine) && !empty($row['call_recording_transcription'])) { echo "\n"; // dummy row to maintain same background color for transcription row echo "\n"; echo " \n"; diff --git a/app/call_recordings/resources/classes/call_recordings.php b/app/call_recordings/resources/classes/call_recordings.php index 7f7bd3c95c..0029970748 100644 --- a/app/call_recordings/resources/classes/call_recordings.php +++ b/app/call_recordings/resources/classes/call_recordings.php @@ -152,11 +152,11 @@ if (!class_exists('call_recordings')) { //add the settings object $settings = new settings(["domain_uuid" => $_SESSION['domain_uuid'], "user_uuid" => $_SESSION['user_uuid']]); - $transcribe_enabled = $settings->get('transcribe', 'enabled', 'false'); + $transcribe_enabled = $settings->get('transcribe', 'enabled', false); $transcribe_engine = $settings->get('transcribe', 'engine', ''); //transcribe multiple recordings - if ($transcribe_enabled == 'true' && !empty($transcribe_engine) && is_array($records) && @sizeof($records) != 0) { + if ($transcribe_enabled && !empty($transcribe_engine) && is_array($records) && @sizeof($records) != 0) { //add the transcribe object $transcribe = new transcribe($settings); diff --git a/app/recordings/recording_edit.php b/app/recordings/recording_edit.php index 0647c734ed..dd563f4add 100644 --- a/app/recordings/recording_edit.php +++ b/app/recordings/recording_edit.php @@ -55,13 +55,13 @@ //add the settings object $settings = new settings(["domain_uuid" => $_SESSION['domain_uuid'], "user_uuid" => $_SESSION['user_uuid']]); - $speech_enabled = $settings->get('speech', 'enabled', 'false'); + $speech_enabled = $settings->get('speech', 'enabled', false); $speech_engine = $settings->get('speech', 'engine', ''); - $transcribe_enabled = $settings->get('transcribe', 'enabled', 'false'); + $transcribe_enabled = $settings->get('transcribe', 'enabled', false); $transcribe_engine = $settings->get('transcribe', 'engine', ''); //add the speech object and get the voices and languages arrays - if ($speech_enabled == 'true' && !empty($speech_engine)) { + if ($speech_enabled && !empty($speech_engine)) { $speech = new speech($settings); $voices = $speech->get_voices(); //$speech_models = $speech->get_models(); @@ -71,7 +71,7 @@ } //add the transcribe object and get the languages arrays - if ($transcribe_enabled == 'true' && !empty($transcribe_engine)) { + if ($transcribe_enabled && !empty($transcribe_engine)) { $transcribe = new transcribe($settings); //$transcribe_models = $transcribe->get_models(); //$translate_enabled = $transcribe->get_translate_enabled(); @@ -199,7 +199,7 @@ //determine whether to create the recording $create_recording = false; - if ($speech_enabled == 'true' && !empty($recording_voice) && !empty($recording_message)) { + if ($speech_enabled && !empty($recording_voice) && !empty($recording_message)) { if ($action == 'add') { $create_recording = true; } @@ -232,7 +232,7 @@ } //audio to text - get the transcription from the audio file - if ($transcribe_enabled == 'true' && empty($recording_message)) { + if ($transcribe_enabled && empty($recording_message)) { $transcribe->audio_path = $recording_path; $transcribe->audio_filename = $recording_filename; $recording_message = $transcribe->transcribe(); @@ -243,7 +243,7 @@ $array['recordings'][0]['recording_uuid'] = $recording_uuid; $array['recordings'][0]['recording_filename'] = $recording_filename; $array['recordings'][0]['recording_name'] = $recording_name; - if ($speech_enabled == 'true' || $transcribe_enabled == 'true') { + if ($speech_enabled || $transcribe_enabled) { $array['recordings'][0]['recording_voice'] = $recording_voice; $array['recordings'][0]['recording_message'] = $recording_message; } @@ -341,7 +341,7 @@ echo "\n"; } - if ($speech_enabled == 'true' || $transcribe_enabled == 'true') { + if ($speech_enabled || $transcribe_enabled) { //models if (!empty($models)) { echo "\n"; diff --git a/app/voicemail_greetings/voicemail_greeting_edit.php b/app/voicemail_greetings/voicemail_greeting_edit.php index 6f9c792e7e..03a3a7f1ec 100644 --- a/app/voicemail_greetings/voicemail_greeting_edit.php +++ b/app/voicemail_greetings/voicemail_greeting_edit.php @@ -43,9 +43,9 @@ //add the settings object $settings = new settings(["domain_uuid" => $_SESSION['domain_uuid'], "user_uuid" => $_SESSION['user_uuid']]); - $speech_enabled = $settings->get('speech', 'enabled', 'false'); + $speech_enabled = $settings->get('speech', 'enabled', false); $speech_engine = $settings->get('speech', 'engine', ''); - $transcribe_enabled = $settings->get('transcribe', 'enabled', 'false'); + $transcribe_enabled = $settings->get('transcribe', 'enabled', false); $transcribe_engine = $settings->get('transcribe', 'engine', ''); $storage_type = $settings->get('voicemail', 'storage_type', ''); @@ -54,7 +54,7 @@ $language_enabled = false; //add the speech object and get the voices and languages arrays - if ($speech_enabled == 'true' && !empty($speech_engine)) { + if ($speech_enabled && !empty($speech_engine)) { $speech = new speech($settings); $voices = $speech->get_voices(); //$speech_models = $speech->get_models(); @@ -64,7 +64,7 @@ } //add the transcribe object and get the languages arrays - if ($transcribe_enabled == 'true' && !empty($transcribe_engine)) { + if ($transcribe_enabled && !empty($transcribe_engine)) { $transcribe = new transcribe($settings); //$transcribe_models = $transcribe->get_models(); //$translate_enabled = $transcribe->get_translate_enabled(); @@ -184,7 +184,7 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) { $greeting_filename = 'greeting_'.$greeting_id.'.'.$greeting_format; //text to audio - make a new audio file from the message - if ($speech_enabled == 'true' && !empty($greeting_voice) && !empty($greeting_message)) { + if ($speech_enabled && !empty($greeting_voice) && !empty($greeting_message)) { $speech->audio_path = $greeting_path; $speech->audio_filename = $greeting_filename; $speech->audio_format = $greeting_format; @@ -207,7 +207,7 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) { } //audio to text - get the transcription from the audio file - if ($transcribe_enabled == 'true' && empty($greeting_voice) && empty($greeting_message)) { + if ($transcribe_enabled && empty($greeting_voice) && empty($greeting_message)) { $transcribe->audio_path = $greeting_path; $transcribe->audio_filename = $greeting_filename; $greeting_message = $transcribe->transcribe(); @@ -310,7 +310,7 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) { echo "\n"; echo "\n"; - if ($speech_enabled == 'true' || $transcribe_enabled == 'true') { + if ($speech_enabled || $transcribe_enabled) { //models if (!empty($models) && is_array($models)) { echo "\n"; diff --git a/app/voicemails/resources/classes/voicemail.php b/app/voicemails/resources/classes/voicemail.php index 5dad0a77a1..8b612ecdc4 100644 --- a/app/voicemails/resources/classes/voicemail.php +++ b/app/voicemails/resources/classes/voicemail.php @@ -1028,12 +1028,12 @@ //add the settings object $settings = new settings(["domain_uuid" => $this->domain_uuid, "user_uuid" => $this->user_uuid]); - $transcribe_enabled = $settings->get('transcribe', 'enabled', 'false'); + $transcribe_enabled = $settings->get('transcribe', 'enabled', false); $transcribe_engine = $settings->get('transcribe', 'engine', ''); $switch_voicemail = $settings->get('switch', 'voicemail', '/var/lib/freeswitch/storage/voicemail'); //transcribe multiple recordings - if ($transcribe_enabled == 'true' && !empty($transcribe_engine)) { + if ($transcribe_enabled && !empty($transcribe_engine)) { //get voicemail message base64 $sql = "select message_base64 from v_voicemail_messages where voicemail_message_uuid = :voicemail_message_uuid "; diff --git a/app/voicemails/voicemail_messages.php b/app/voicemails/voicemail_messages.php index 989e366e38..24290edc9b 100644 --- a/app/voicemails/voicemail_messages.php +++ b/app/voicemails/voicemail_messages.php @@ -94,7 +94,7 @@ //add the settings object $settings = new settings(["domain_uuid" => $_SESSION['domain_uuid'], "user_uuid" => $_SESSION['user_uuid']]); - $transcribe_enabled = $settings->get('transcribe', 'enabled', 'false'); + $transcribe_enabled = $settings->get('transcribe', 'enabled', false); $transcribe_engine = $settings->get('transcribe', 'engine', ''); //set the back button url @@ -151,7 +151,7 @@ // no return, exit exit; case 'transcribe': - if (permission_exists('voicemail_message_transcribe') && $transcribe_enabled == 'true' && !empty($transcribe_engine) && is_array($voicemail_messages) && @sizeof($voicemail_messages) != 0) { + if (permission_exists('voicemail_message_transcribe') && $transcribe_enabled && !empty($transcribe_engine) && is_array($voicemail_messages) && @sizeof($voicemail_messages) != 0) { $messages_transcribed = 0; foreach ($voicemail_messages as $voicemail_message) { if (!empty($voicemail_message['checked']) && $voicemail_message['checked'] == 'true' && is_uuid($voicemail_message['uuid']) && is_uuid($voicemail_message['voicemail_uuid'])) { @@ -304,7 +304,7 @@ if ($message['message_status'] != 'saved') { $new_messages++; } - if ($transcribe_enabled == 'true' && !empty($transcribe_engine) && !empty($message['message_transcription'])) { + if ($transcribe_enabled && !empty($transcribe_engine) && !empty($message['message_transcription'])) { $transcriptions_exists = true; } } @@ -326,7 +326,7 @@ echo "
\n"; echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','link'=>$_SESSION['back'][$_SERVER['PHP_SELF']]]); $margin_left = false; - if (permission_exists('voicemail_message_transcribe') && $transcribe_enabled == 'true' && !empty($transcribe_engine) && $num_rows) { + if (permission_exists('voicemail_message_transcribe') && $transcribe_enabled && !empty($transcribe_engine) && $num_rows) { echo button::create(['type'=>'button','label'=>$text['button-transcribe'],'icon'=>'quote-right','id'=>'btn_transcribe','name'=>'btn_transcribe','collapse'=>'hide-xs','style'=>'display: none; margin-left: 15px;','onclick'=>"list_action_set('transcribe'); list_form_submit('form_list');"]); $margin_left = true; } @@ -458,7 +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($row['message_transcription']) || ($transcribe_enabled == 'true' && !empty($transcribe_engine) && $transcriptions_exists === true)) { + if (!empty($row['message_transcription']) || ($transcribe_enabled && !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 " \n"; @@ -467,7 +467,7 @@ echo " ".escape($row['file_size_label'])."\n"; } echo "\n"; - if (!empty($row['message_transcription']) || ($transcribe_enabled == 'true' && !empty($transcribe_engine) && $transcriptions_exists === true)) { + if (!empty($row['message_transcription']) || ($transcribe_enabled && !empty($transcribe_engine) && $transcriptions_exists === true)) { echo "\n"; // dummy row to maintain same background color for transcription row echo "\n"; echo " \n"; diff --git a/app/voicemails/voicemails.php b/app/voicemails/voicemails.php index 3f571457de..f96675748d 100644 --- a/app/voicemails/voicemails.php +++ b/app/voicemails/voicemails.php @@ -271,7 +271,7 @@ echo th_order_by('voicemail_file', $text['label-voicemail_file_attached'], $order_by, $order, null, "class='center hide-md-dn'"); echo th_order_by('voicemail_local_after_email', $text['label-voicemail_local_after_email'], $order_by, $order, null, "class='center hide-md-dn'"); if (permission_exists('voicemail_transcription_enabled') && ($_SESSION['transcribe']['enabled']['boolean'] ?? '') == "true") { - echo th_order_by('voicemail_transcription_enabled', $text['label-voicemail_transcribe_enabled'], $order_by, $order); + echo th_order_by('voicemail_transcription_enabled', $text['label-voicemail_UU'], $order_by, $order); } if (permission_exists('voicemail_message_view') || permission_exists('voicemail_greeting_view')) { echo "".$text['label-tools']."\n"; diff --git a/app/xml_cdr/xml_cdr_details.php b/app/xml_cdr/xml_cdr_details.php index 3f186edd5f..dc7077c84c 100644 --- a/app/xml_cdr/xml_cdr_details.php +++ b/app/xml_cdr/xml_cdr_details.php @@ -43,8 +43,10 @@ //add the settings object $settings = new settings(["domain_uuid" => $_SESSION['domain_uuid'], "user_uuid" => $_SESSION['user_uuid']]); - $transcribe_enabled = $settings->get('transcribe', 'enabled', 'false'); + $transcribe_enabled = $settings->get('transcribe', 'enabled', false); $transcribe_engine = $settings->get('transcribe', 'engine', ''); + $call_log_enabled = $settings->get('cdr', 'call_log_enabled', false); + $summary_style = $settings->get('cdr', 'summary_style', 'horizontal'); //get the http values and set them to a variable if (is_uuid($_REQUEST["id"])) { @@ -88,7 +90,7 @@ if ( !empty($_GET['action']) && $_GET['action'] == 'transcribe' && - $transcribe_enabled == 'true' && + $transcribe_enabled && !empty($transcribe_engine) && empty($record_transcription) && !empty($record_path) && @@ -174,7 +176,7 @@ } //get the cdr log from the database - if ($_SESSION['cdr']['call_log_enabled']['boolean'] == 'true') { + if ($call_log_enabled) { $sql = "select * from v_xml_cdr_logs "; if (permission_exists('xml_cdr_all')) { $sql .= "where xml_cdr_uuid = :xml_cdr_uuid "; @@ -380,10 +382,10 @@ echo "".$text['title2']."

\n"; echo "\n"; echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'link'=>'xml_cdr.php'.(!empty($_SESSION['xml_cdr']['last_query']) ? '?'.urlencode($_SESSION['xml_cdr']['last_query']) : null)]); - if ($_SESSION['cdr']['call_log_enabled']['boolean'] == 'true' && isset($log_content) && !empty($log_content)) { + if ($call_log_enabled && isset($log_content) && !empty($log_content)) { echo button::create(['type'=>'button','label'=>$text['button-call_log'],'icon'=>$_SESSION['theme']['button_icon_search'],'style'=>'margin-left: 15px;','link'=>'xml_cdr_log.php?id='.$uuid]); } - if ($transcribe_enabled == 'true' && !empty($transcribe_engine) && empty($record_transcription)) { + if ($transcribe_enabled && !empty($transcribe_engine) && empty($record_transcription)) { echo button::create(['type'=>'button','label'=>$text['button-transcribe'],'icon'=>'quote-right','id'=>'btn_transcribe','name'=>'btn_transcribe','collapse'=>'hide-xs','style'=>'margin-left: 15px;','onclick'=>"window.location.href='?id=".$uuid."&action=transcribe';"]); } echo "\n"; @@ -405,7 +407,7 @@ echo "\n"; //show the call summary - vertical - if ($_SESSION['cdr']['summary_style']['text'] == 'vertical') { + if ($summary_style == 'vertical') { echo "
\n"; echo "\n"; echo "\n"; @@ -427,7 +429,7 @@ } //show the call summary - horizontal - if ($_SESSION['cdr']['summary_style']['text'] == 'horizontal') { + if ($summary_style == 'horizontal') { echo "
\n"; echo "
\n"; echo "\n";
".$text['label-direction']."