From 539944a527a3bd1b80b67a7e20dcf0d20a74d32a Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Mon, 11 Sep 2017 02:46:50 -0500 Subject: [PATCH] Update v_xml_cdr_import.php --- app/xml_cdr/v_xml_cdr_import.php | 70 ++++++++++++++++---------------- 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/app/xml_cdr/v_xml_cdr_import.php b/app/xml_cdr/v_xml_cdr_import.php index 29d2b3874b..e2cd94f987 100644 --- a/app/xml_cdr/v_xml_cdr_import.php +++ b/app/xml_cdr/v_xml_cdr_import.php @@ -256,10 +256,10 @@ elseif (file_exists($_SESSION['switch']['recordings']['dir'].$recording_relative_path.'/'.$uuid.'.mp3')) { $recording_file = $recording_relative_path.'/'.$uuid.'.mp3'; } - if(isset($recording_file) && !empty($recording_file)) { + if (isset($recording_file) && !empty($recording_file)) { $database->fields['recording_file'] = $recording_file; } - if(isset($recording_file) && !empty($recording_file)) { + if (isset($recording_file) && !empty($recording_file)) { $database->fields['recording_name'] = $recording_file; } @@ -268,37 +268,6 @@ $database->fields['recording_name'] = urldecode($xml->variables->recording_name); } - //add the call recording - if (strlen($xml->variables->record_name) > 0 && file_exists($_SERVER["PROJECT_ROOT"]."/app/call_recordings/app_config.php")) { - $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'] = check_str(urldecode($xml->variables->record_name)); - $array['call_recordings'][$x]['call_recording_path'] = check_str(urldecode($xml->variables->record_path)); - $array['call_recordings'][$x]['call_recording_length']= check_str(urldecode($xml->variables->billsec)); - $array['call_recordings'][$x]['call_recording_date']= check_str(urldecode($xml->variables->answer_stamp)); - $array['call_recordings'][$x]['call_direction']= check_str(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); - $message = $database->message; - unset($array); - - //remove the temporary permission - $p->delete("call_recording_add", "temp"); - $p->delete("call_recording_edit", "temp"); - } - //dynamic cdr fields if (is_array($_SESSION['cdr']['field'])) { foreach ($_SESSION['cdr']['field'] as $field) { @@ -573,6 +542,38 @@ } } unset($sql); + + //add the call recording + if (strlen($xml->variables->record_name) > 0 && file_exists($_SERVER["PROJECT_ROOT"]."/app/call_recordings/app_config.php")) { + $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'] = check_str(urldecode($xml->variables->record_name)); + $array['call_recordings'][$x]['call_recording_path'] = check_str(urldecode($xml->variables->record_path)); + $array['call_recordings'][$x]['call_recording_length']= check_str(urldecode($xml->variables->billsec)); + $array['call_recordings'][$x]['call_recording_date']= check_str(urldecode($xml->variables->answer_stamp)); + $array['call_recordings'][$x]['call_direction']= check_str(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); + $message = $database->message; + unset($array); + + //remove the temporary permission + $p->delete("call_recording_add", "temp"); + $p->delete("call_recording_edit", "temp"); + } + } //get cdr details from the http post @@ -668,7 +669,8 @@ //delete the file after it has been imported unlink($xml_cdr_dir.'/'.$file); - $x++; + //increment the variable + $x++; } } }