From 4369ab6380b07e779b982bad0365f99d4d4edc76 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Mon, 24 Jun 2024 18:12:49 -0600 Subject: [PATCH] Update email_send.php Email transcription has a value no need to transcribe again so run the transcription when the value is empty. --- app/email_queue/resources/jobs/email_send.php | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/app/email_queue/resources/jobs/email_send.php b/app/email_queue/resources/jobs/email_send.php index 8f8e178e2d..9514b64de7 100644 --- a/app/email_queue/resources/jobs/email_send.php +++ b/app/email_queue/resources/jobs/email_send.php @@ -134,6 +134,7 @@ $email_to = $row["email_to"]; $email_subject = $row["email_subject"]; $email_body = $row["email_body"]; + $email_transcription = $row["email_transcription"]; $email_status = $row["email_status"]; $email_retry_count = $row["email_retry_count"]; $email_uuid = $row["email_uuid"]; @@ -225,20 +226,28 @@ //debug message echo "transcribe enabled: true\n"; - //add the settings object - $transcribe_engine = $settings->get('transcribe', 'engine', ''); + //if email transcription has a value no need to transcribe again so run the transcription when the value is empty + if (empty($email_transcription)) { + //add the settings object + $transcribe_engine = $settings->get('transcribe', 'engine', ''); - //add the transcribe object and get the languages arrays - if (!empty($transcribe_engine)) { - $transcribe = new transcribe($settings); + //add the transcribe object and get the languages arrays + if (!empty($transcribe_engine)) { + $transcribe = new transcribe($settings); + } + + //transcribe the voicemail recording + $transcribe->audio_path = $email_attachment_path; + $transcribe->audio_filename = $email_attachment_name; + $transcribe_message = $transcribe->transcribe(); + + echo "transcribe path: ".$email_attachment_path."\n"; + echo "transcribe name: ".$email_attachment_name."\n"; + } + else { + $transcribe_message = $email_transcription; } - //transcribe the voicemail recording - $transcribe->audio_path = $email_attachment_path; - $transcribe->audio_filename = $email_attachment_name; - $transcribe_message = $transcribe->transcribe(); - echo "transcribe path: ".$email_attachment_path."\n"; - echo "transcribe name: ".$email_attachment_name."\n"; echo "transcribe message: ".$transcribe_message."\n"; //prepare the email body