mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-31 13:09:17 +00:00
Add call summary to the call recording transcript email
This commit is contained in:
@@ -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";
|
||||
|
||||
@@ -46,6 +46,10 @@ if ($domains_processed == 1) {
|
||||
$array['email_templates'][$x]['template_body'] .= " Time \${start_time} \${end_time}<br />\n";
|
||||
$array['email_templates'][$x]['template_body'] .= " Length \${duration}<br />\n";
|
||||
$array['email_templates'][$x]['template_body'] .= " <br />\n";
|
||||
$array['email_templates'][$x]['template_body'] .= " Summary<br />\n";
|
||||
$array['email_templates'][$x]['template_body'] .= " \${summary}\n";
|
||||
$array['email_templates'][$x]['template_body'] .= " <br />\n";
|
||||
$array['email_templates'][$x]['template_body'] .= " <br />\n";
|
||||
$array['email_templates'][$x]['template_body'] .= " Transcription<br />\n";
|
||||
$array['email_templates'][$x]['template_body'] .= " \${transcript}\n";
|
||||
$array['email_templates'][$x]['template_body'] .= " <br />\n";
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user