From 0f2b942781d17b62342ccfe51fe6bfed32be9576 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Wed, 24 Dec 2025 13:40:23 -0700 Subject: [PATCH] Add a new setting transcribe_enabled to category call_recordings --- app/call_recordings/app_config.php | 9 +++++++ app/xml_cdr/resources/classes/xml_cdr.php | 31 ++++++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/app/call_recordings/app_config.php b/app/call_recordings/app_config.php index a1946f00bd..b2c9d2b4b2 100644 --- a/app/call_recordings/app_config.php +++ b/app/call_recordings/app_config.php @@ -61,3 +61,12 @@ $apps[$x]['default_settings'][$y]['default_setting_value'] = "\${year}\${month_number}\${day}.\${time}.\${caller_id_number}.\${uuid}.mp3"; $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; $apps[$x]['default_settings'][$y]['default_setting_description'] = "Call recording download template. Options: \${uuid}, \${caller_id_name}, \${caller_id_number}, \${caller_destination}, \${destination_number}, \${date}, \${call_direction}, \${year}, \${month_name}, \${month_number}, \${day}, \${time}"; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "a21c3dab-36e3-4d7f-8356-9d9fd3eec0a3"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "call_recordings"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "transcribe_enabled"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "boolean"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "true"; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Call recordings set to auto transcribe. Options: true, false"; + $y++; \ No newline at end of file diff --git a/app/xml_cdr/resources/classes/xml_cdr.php b/app/xml_cdr/resources/classes/xml_cdr.php index 9334309483..9b48434683 100644 --- a/app/xml_cdr/resources/classes/xml_cdr.php +++ b/app/xml_cdr/resources/classes/xml_cdr.php @@ -1066,8 +1066,14 @@ class xml_cdr { //echo "record_length: ".$record_length."\n"; //exit; - //add the call record path, name and length to the database + //check if recording file exists + $record_exists = false; if (isset($record_path) && isset($record_name) && file_exists($record_path . '/' . $record_name)) { + $record_exists = true; + } + + //add the call record path, name and length to the database + if (isset($record_path) && isset($record_name) && $record_exists) { $this->array[$key][0]['record_path'] = $record_path; $this->array[$key][0]['record_name'] = $record_name; if (isset($record_length)) { @@ -1077,6 +1083,29 @@ class xml_cdr { } } + //if call recording transcribe is enabled then add the recording to the transcribe queue + if ($record_exists && $this->settings->get('call_recordings', 'transcribe_enabled', false)) { + //prepare the paramaters + $params['domain_uuid'] = $domain_uuid; + $params['xml_cdr_uuid'] = $uuid; + $params['call_direction'] = $call_direction; + + //prepare the transcribe queue array + $app_sourcetranscribe_queue = array(); + $transcribe_queue['transcribe_queue'][$x]['transcribe_queue_uuid'] = $uuid; + $transcribe_queue['transcribe_queue'][$x]['domain_uuid'] = $domain_uuid; + $transcribe_queue['transcribe_queue'][$x]['hostname'] = gethostname(); + $transcribe_queue['transcribe_queue'][$x]['transcribe_status'] = 'pending'; + $transcribe_queue['transcribe_queue'][$x]['transcribe_app_class'] = 'call_recordings'; + $transcribe_queue['transcribe_queue'][$x]['transcribe_app_method'] = 'transcribe_queue'; + $transcribe_queue['transcribe_queue'][$x]['transcribe_app_params'] = json_encode($params); + $transcribe_queue['transcribe_queue'][$x]['transcribe_audio_path'] = $field['call_recording_path']; + $transcribe_queue['transcribe_queue'][$x]['transcribe_audio_name'] = $field['call_recording_name']; + + //save the data + $this->database->save($transcribe_queue); + } + //save the xml object to json $this->json = json_encode($xml);