From e878c7b72d1e4f88486bfbfb55f1cdf3233b7379 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Wed, 18 Apr 2018 11:53:12 -0600 Subject: [PATCH] Update v_xml_cdr_import.php --- app/xml_cdr/v_xml_cdr_import.php | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/app/xml_cdr/v_xml_cdr_import.php b/app/xml_cdr/v_xml_cdr_import.php index 65a04a367b..cda171402c 100644 --- a/app/xml_cdr/v_xml_cdr_import.php +++ b/app/xml_cdr/v_xml_cdr_import.php @@ -215,10 +215,10 @@ $database->fields['pdd_ms'] = check_str(urldecode($xml->variables->progress_mediamsec) + urldecode($xml->variables->progressmsec)); //get break down the date to year, month and day - $tmp_time = strtotime($start_stamp); - $tmp_year = date("Y", $tmp_time); - $tmp_month = date("M", $tmp_time); - $tmp_day = date("d", $tmp_time); + $start_time = strtotime($start_stamp); + $start_year = date("Y", $start_time); + $start_month = date("M", $start_time); + $start_day = date("d", $start_time); //get the domain values from the xml $domain_name = check_str(urldecode($xml->variables->domain_name)); @@ -334,6 +334,16 @@ } } } + if (!isset($record_name)) { + $bridge_uuid = urldecode($xml->variables->bridge_uuid); + $record_path = $_SESSION['switch']['recordings']['dir'].'/'.$domain_name.'/archive/'.$start_year.'/'.$start_month.'/'.$start_day; + if (file_exists($record_path.'/'.$bridge_uuid.'.wav')) { + $record_name = $bridge_uuid.'.wav'; + } elseif (file_exists($record_path.'/'.$bridge_uuid.'.mp3')) { + $record_name = $bridge_uuid.'.mp3'; + } + $record_length = urldecode($xml->variables->duration); + } //add the call recording if (isset($record_path) && isset($record_name) && file_exists($record_path.'/'.$record_name) && $record_length > 0) { @@ -585,11 +595,7 @@ if ($_SESSION['cdr']['storage']['text'] == "dir" && $error != "true") { if (strlen($uuid) > 0) { - $tmp_time = strtotime($start_stamp); - $tmp_year = date("Y", $tmp_time); - $tmp_month = date("M", $tmp_time); - $tmp_day = date("d", $tmp_time); - $tmp_dir = $_SESSION['switch']['log']['dir'].'/xml_cdr/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day; + $tmp_dir = $_SESSION['switch']['log']['dir'].'/xml_cdr/archive/'.$start_year.'/'.$start_month.'/'.$start_day; if(!file_exists($tmp_dir)) { event_socket_mkdir($tmp_dir); }