Add a new setting transcribe_enabled to category call_recordings

This commit is contained in:
markjcrane
2025-12-24 13:40:23 -07:00
parent 1e515baa34
commit 0f2b942781
2 changed files with 39 additions and 1 deletions

View File

@@ -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++;

View File

@@ -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);