diff --git a/app/xml_cdr/xml_cdr.php b/app/xml_cdr/xml_cdr.php index e6c635758e..df8651a9d1 100644 --- a/app/xml_cdr/xml_cdr.php +++ b/app/xml_cdr/xml_cdr.php @@ -448,52 +448,37 @@ ) ? true : false; foreach($result as $index => $row) { - $tmp_year = date("Y", strtotime($row['start_stamp'])); - $tmp_month = date("M", strtotime($row['start_stamp'])); - $tmp_day = date("d", strtotime($row['start_stamp'])); + //get the date and time + $tmp_year = date("Y", strtotime($row['start_stamp'])); + $tmp_month = date("M", strtotime($row['start_stamp'])); + $tmp_day = date("d", strtotime($row['start_stamp'])); + $tmp_start_epoch = ($_SESSION['domain']['time_format']['text'] == '12h') ? date("j M Y g:i:sa", $row['start_epoch']) : date("j M Y H:i:s", $row['start_epoch']); - $tmp_start_epoch = ($_SESSION['domain']['time_format']['text'] == '12h') ? date("j M Y g:i:sa", $row['start_epoch']) : date("j M Y H:i:s", $row['start_epoch']); - - $hangup_cause = $row['hangup_cause']; - $hangup_cause = str_replace("_", " ", $hangup_cause); - $hangup_cause = strtolower($hangup_cause); - $hangup_cause = ucwords($hangup_cause); + //get the hangup cause + $hangup_cause = $row['hangup_cause']; + $hangup_cause = str_replace("_", " ", $hangup_cause); + $hangup_cause = strtolower($hangup_cause); + $hangup_cause = ucwords($hangup_cause); //if call cancelled, show the ring time, not the bill time. $seconds = ($row['hangup_cause']=="ORIGINATOR_CANCEL") ? $row['duration'] : round(($row['billmsec'] / 1000), 0, PHP_ROUND_HALF_UP); //determine recording properties if (permission_exists('recording_play') || permission_exists('recording_download')) { - $tmp_rel_path = '/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day; - $tmp_dir = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION["domain_name"].$tmp_rel_path; - $tmp_name = ''; - if (!empty($row['recording_file']) && file_exists($row['recording_file'])) { $tmp_name = $row['recording_file']; } - else if (file_exists($tmp_dir.'/'.$row['uuid'].'.wav')) { $tmp_name = $row['uuid'].".wav"; } - else if (file_exists($tmp_dir.'/'.$row['uuid'].'_1.wav')) { $tmp_name = $row['uuid']."_1.wav"; } - else if (file_exists($tmp_dir.'/'.$row['uuid'].'.mp3')) { $tmp_name = $row['uuid'].".mp3"; } - else if (file_exists($tmp_dir.'/'.$row['uuid'].'_1.mp3')) { $tmp_name = $row['uuid']."_1.mp3"; } - else if (file_exists($tmp_dir.'/'.$row['bridge_uuid'].'.wav')) { $tmp_name = $row['bridge_uuid'].".wav"; } - else if (file_exists($tmp_dir.'/'.$row['bridge_uuid'].'_1.wav')) { $tmp_name = $row['bridge_uuid']."_1.wav"; } - else if (file_exists($tmp_dir.'/'.$row['bridge_uuid'].'.mp3')) { $tmp_name = $row['bridge_uuid'].".mp3"; } - else if (file_exists($tmp_dir.'/'.$row['bridge_uuid'].'_1.mp3')) { $tmp_name = $row['bridge_uuid']."_1.mp3"; } - if (strlen($tmp_name) > 0 && file_exists($tmp_dir.'/'.$tmp_name) && $seconds > 0) { - $recording_file_path = $tmp_rel_path.'/'.$tmp_name; - $recording_file_name = strtolower(pathinfo($tmp_name, PATHINFO_BASENAME)); - $recording_file_ext = pathinfo($recording_file_name, PATHINFO_EXTENSION); - switch ($recording_file_ext) { - case "wav" : $recording_type = "audio/wav"; break; - case "mp3" : $recording_type = "audio/mpeg"; break; - case "ogg" : $recording_type = "audio/ogg"; break; - } - } - else { - unset($recording_file_path); + $record_path = $row['record_path']; + $record_name = $row['record_name']; + //$record_name = strtolower(pathinfo($tmp_name, PATHINFO_BASENAME)); + $record_extension = pathinfo($record_name, PATHINFO_EXTENSION); + switch ($record_extension) { + case "wav" : $record_type = "audio/wav"; break; + case "mp3" : $record_type = "audio/mpeg"; break; + case "ogg" : $record_type = "audio/ogg"; break; } } //recording playback - if (permission_exists('recording_play') && $recording_file_path != '') { - echo "
\n"; + if (permission_exists('recording_play') && $record_path != '') { + echo "\n"; } if ($row['raw_data_exists'] && permission_exists('xml_cdr_details')) { @@ -505,7 +490,7 @@ echo "