From 0f60b2b34dcfd5ac5ae6d3fc081792370379817c Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Sat, 3 Dec 2022 18:36:42 -0700 Subject: [PATCH] Add record_length numeric And remove call_recordings save --- app/xml_cdr/resources/classes/xml_cdr.php | 73 ++++++++++++----------- 1 file changed, 39 insertions(+), 34 deletions(-) diff --git a/app/xml_cdr/resources/classes/xml_cdr.php b/app/xml_cdr/resources/classes/xml_cdr.php index 26a750e12c..b81591cd00 100644 --- a/app/xml_cdr/resources/classes/xml_cdr.php +++ b/app/xml_cdr/resources/classes/xml_cdr.php @@ -164,6 +164,7 @@ if (!class_exists('xml_cdr')) { $this->fields[] = "network_addr"; $this->fields[] = "record_path"; $this->fields[] = "record_name"; + $this->fields[] = "record_length"; $this->fields[] = "leg"; $this->fields[] = "originating_leg_uuid"; $this->fields[] = "pdd_ms"; @@ -732,44 +733,48 @@ if (!class_exists('xml_cdr')) { //echo "record_length: ".$record_length."\n"; //exit; - //add the call recording + //add the call recording path name and length if (isset($record_path) && isset($record_name) && file_exists($record_path.'/'.$record_name) && $record_length > 0) { //add to the xml cdr table - $this->array[$key]['record_path'] = $record_path; - $this->array[$key]['record_name'] = $record_name; - //add to the call recordings table - if (file_exists($_SERVER["PROJECT_ROOT"]."/app/call_recordings/app_config.php")) { - //build the array - $x = 0; - $array['call_recordings'][$x]['call_recording_uuid'] = $uuid; - $array['call_recordings'][$x]['domain_uuid'] = $domain_uuid; - $array['call_recordings'][$x]['call_recording_name'] = $record_name; - $array['call_recordings'][$x]['call_recording_path'] = $record_path; - $array['call_recordings'][$x]['call_recording_length'] = $record_length; - $array['call_recordings'][$x]['call_recording_date'] = date('c', $start_epoch); - $array['call_recordings'][$x]['call_direction'] = urldecode($xml->variables->call_direction); - //$array['call_recordings'][$x]['call_recording_description']= $row['zzz']; - //$array['call_recordings'][$x]['call_recording_base64']= $row['zzz']; - - //add the temporary permission - $p = new permissions; - $p->add("call_recording_add", "temp"); - $p->add("call_recording_edit", "temp"); - - $database = new database; - $database->app_name = 'call_recordings'; - $database->app_uuid = '56165644-598d-4ed8-be01-d960bcb8ffed'; - $database->domain_uuid = $domain_uuid; - $database->save($array, false); - //$message = $database->message; - - //remove the temporary permission - $p->delete("call_recording_add", "temp"); - $p->delete("call_recording_edit", "temp"); - unset($array); - } + $this->array[$key]['record_path'] = $record_path; + $this->array[$key]['record_name'] = $record_name; + $this->array[$key]['record_length'] = record_length; } + //add to the call recordings table + /* + if (file_exists($_SERVER["PROJECT_ROOT"]."/app/call_recordings/app_config.php")) { + //build the array + $x = 0; + $array['call_recordings'][$x]['call_recording_uuid'] = $uuid; + $array['call_recordings'][$x]['domain_uuid'] = $domain_uuid; + $array['call_recordings'][$x]['call_recording_name'] = $record_name; + $array['call_recordings'][$x]['call_recording_path'] = $record_path; + $array['call_recordings'][$x]['call_recording_length'] = $record_length; + $array['call_recordings'][$x]['call_recording_date'] = date('c', $start_epoch); + $array['call_recordings'][$x]['call_direction'] = urldecode($xml->variables->call_direction); + //$array['call_recordings'][$x]['call_recording_description']= $row['zzz']; + //$array['call_recordings'][$x]['call_recording_base64']= $row['zzz']; + + //add the temporary permission + $p = new permissions; + $p->add("call_recording_add", "temp"); + $p->add("call_recording_edit", "temp"); + + $database = new database; + $database->app_name = 'call_recordings'; + $database->app_uuid = '56165644-598d-4ed8-be01-d960bcb8ffed'; + $database->domain_uuid = $domain_uuid; + $database->save($array, false); + //$message = $database->message; + + //remove the temporary permission + $p->delete("call_recording_add", "temp"); + $p->delete("call_recording_edit", "temp"); + unset($array); + } + */ + //save to the database in xml format if ($_SESSION['cdr']['format']['text'] == "xml" && $_SESSION['cdr']['storage']['text'] == "db") { $this->array[$key]['xml'] = $xml_string;