diff --git a/app/call_recordings/app_config.php b/app/call_recordings/app_config.php index 3d6241adf9..c53ce30f5c 100644 --- a/app/call_recordings/app_config.php +++ b/app/call_recordings/app_config.php @@ -37,6 +37,8 @@ $y++; $apps[$x]['permissions'][$y]['name'] = 'call_recording_transcribe'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; + + //default settings $y = 0; $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "95cb740e-e377-4852-8894-06441c61e78b"; $apps[$x]['default_settings'][$y]['default_setting_category'] = "call_recordings"; diff --git a/app/call_recordings/app_defaults.php b/app/call_recordings/app_defaults.php index be28f1c477..bc22ebf126 100644 --- a/app/call_recordings/app_defaults.php +++ b/app/call_recordings/app_defaults.php @@ -46,6 +46,10 @@ if ($domains_processed == 1) { $array['email_templates'][$x]['template_body'] .= " Time \${start_time} \${end_time}
\n"; $array['email_templates'][$x]['template_body'] .= " Length \${duration}
\n"; $array['email_templates'][$x]['template_body'] .= "
\n"; + $array['email_templates'][$x]['template_body'] .= " Summary
\n"; + $array['email_templates'][$x]['template_body'] .= " \${summary}\n"; + $array['email_templates'][$x]['template_body'] .= "
\n"; + $array['email_templates'][$x]['template_body'] .= "
\n"; $array['email_templates'][$x]['template_body'] .= " Transcription
\n"; $array['email_templates'][$x]['template_body'] .= " \${transcript}\n"; $array['email_templates'][$x]['template_body'] .= "
\n"; diff --git a/app/call_recordings/resources/classes/call_recordings.php b/app/call_recordings/resources/classes/call_recordings.php index e7e5cd8ef8..b593969484 100644 --- a/app/call_recordings/resources/classes/call_recordings.php +++ b/app/call_recordings/resources/classes/call_recordings.php @@ -217,6 +217,9 @@ class call_recordings { //define the array $array = []; + //define the variable(s) + $call_summary = ''; + //summarize the transcript if ($settings->get('language_model', 'enabled') && !empty($params['transcribe_message'])) { //get the transcribed text @@ -235,6 +238,16 @@ class call_recordings { //load the language model and get the call summary $language_model = new language_model(); $params['transcript_summary'] = $language_model->request($request_model, $request_data); + + //get the summary from the params + $transcript_summary = $params['transcript_summary'] ?? ''; + + //format the call recording transcript summary + $parsedown = new Parsedown(); + $parsedown->setSafeMode(true); + $parsedown->setMarkupEscaped(true); + $call_summary = str_replace('###', '', $transcript_summary); + $call_summary = str_replace('&', '&', $parsedown->text($call_summary)); } //prepare the array with the transcript details @@ -353,6 +366,7 @@ class call_recordings { $email_body = str_replace('${time}', $start_time, $email_body); $email_body = str_replace('${duration}', $duration, $email_body); $email_body = str_replace('${length}', $duration, $email_body); + $email_body = str_replace('${summary}', $call_summary, $email_body); $email_body = str_replace('${transcript}', $transcribe_html, $email_body); //send email with the email_queue