diff --git a/app/xml_cdr/app_languages.php b/app/xml_cdr/app_languages.php index 9e13de7c95..11b2f2b74b 100644 --- a/app/xml_cdr/app_languages.php +++ b/app/xml_cdr/app_languages.php @@ -3818,4 +3818,30 @@ $text['label-codec_write']['uk-ua'] = ""; $text['label-codec_write']['zh-cn'] = ""; $text['label-codec_write']['ja-jp'] = ""; $text['label-codec_write']['ko-kr'] = ""; -?> + +$text['label-text']['en-us'] = "Text"; +$text['label-text']['en-gb'] = "Text"; +$text['label-text']['ar-eg'] = "نص"; +$text['label-text']['de-at'] = "Text"; +$text['label-text']['de-ch'] = "Text"; +$text['label-text']['de-de'] = "Text"; +$text['label-text']['el-gr'] = "Κείμενο"; +$text['label-text']['es-cl'] = "Texto"; +$text['label-text']['es-mx'] = "Texto"; +$text['label-text']['fr-ca'] = "Texte"; +$text['label-text']['fr-fr'] = "Texte"; +$text['label-text']['he-il'] = "טֶקסט"; +$text['label-text']['it-it'] = "Testo"; +$text['label-text']['nl-nl'] = "Tekst"; +$text['label-text']['pl-pl'] = "Tekst"; +$text['label-text']['pt-br'] = "Texto"; +$text['label-text']['pt-pt'] = "Texto"; +$text['label-text']['ro-ro'] = "Text"; +$text['label-text']['ru-ru'] = "Текст"; +$text['label-text']['sv-se'] = "Text"; +$text['label-text']['uk-ua'] = "текст"; +$text['label-text']['zh-cn'] = "文本"; +$text['label-text']['ja-jp'] = "文章"; +$text['label-text']['ko-kr'] = "텍스트"; + +?> \ No newline at end of file diff --git a/app/xml_cdr/xml_cdr_details.php b/app/xml_cdr/xml_cdr_details.php index 62314b4d07..c4fb252e7b 100644 --- a/app/xml_cdr/xml_cdr_details.php +++ b/app/xml_cdr/xml_cdr_details.php @@ -41,6 +41,11 @@ $language = new text; $text = $language->get(); +//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_engine = $settings->get('transcribe', 'engine', ''); + //get the http values and set them to a variable if (is_uuid($_REQUEST["id"])) { $uuid = $_REQUEST["id"]; @@ -72,10 +77,62 @@ $call_flow = trim($row["call_flow"] ?? ''); $direction = trim($row["direction"] ?? ''); $call_direction = trim($row["direction"] ?? ''); + $record_path = trim($row["record_path"] ?? ''); + $record_name = trim($row["record_name"] ?? ''); + $record_transcription = trim($row["record_transcription"] ?? ''); $status = trim($row["status"] ?? ''); } unset($sql, $parameters, $row); +//transcribe, if enabled + if ( + !empty($_GET['action']) && + $_GET['action'] == 'transcribe' && + $transcribe_enabled == 'true' && + !empty($transcribe_engine) && + empty($record_transcription) && + !empty($record_path) && + !empty($record_name) && + file_exists($record_path.'/'.$record_name) + ) { + //add the transcribe object + $transcribe = new transcribe($settings); + //audio to text - get the transcription from the audio file + $transcribe->audio_path = $record_path; + $transcribe->audio_filename = $record_name; + $record_transcription = $transcribe->transcribe(); + //build call recording data array + if (!empty($record_transcription)) { + $array['xml_cdr'][0]['xml_cdr_uuid'] = $uuid; + $array['xml_cdr'][0]['record_transcription'] = $record_transcription; + } + //update the checked rows + if (is_array($array) && @sizeof($array) != 0) { + + //add temporary permissions + $p = new permissions; + $p->add('xml_cdr_edit', 'temp'); + + //remove record_path, record_name and record_length + $database = new database; + $database->app_name = 'xml_cdr'; + $database->app_uuid = '4a085c51-7635-ff03-f67b-86e834422848'; + $database->save($array, false); + $message = $database->message; + unset($array); + + //remove the temporary permissions + $p->delete('xml_cdr_edit', 'temp'); + + //set message + message::add($text['message-audio_transcribed']); + + } + //redirect + header('Location: '.$_SERVER['PHP_SELF'].'?id='.$uuid); + exit; + } + //get the cdr json from the database if (empty($json_string)) { $sql = "select * from v_xml_cdr_json "; @@ -320,12 +377,15 @@ //page title and description echo "\n"; echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -459,6 +519,20 @@ echo "
".$text['title2']."".$text['title2']."

\n"; - echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-left: 15px;','link'=>'xml_cdr.php'.(!empty($_SESSION['xml_cdr']['last_query']) ? '?'.urlencode($_SESSION['xml_cdr']['last_query']) : null)]); + 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)) { 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)) { + 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 "
"; echo "

\n"; +//transcription, if enabled + if ($transcribe_enabled == 'true' && !empty($transcribe_engine) && !empty($record_transcription)) { + echo "".$text['label-transcription']."
\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo "\n"; + echo "
".$text['label-text']."
".escape($record_transcription)."
"; + echo "

\n"; + } + //call stats if (permission_exists('xml_cdr_call_stats')) { $c = 0;