diff --git a/app/xml_cdr/xml_cdr.php b/app/xml_cdr/xml_cdr.php index 34f3d0409b..c318bd68a8 100644 --- a/app/xml_cdr/xml_cdr.php +++ b/app/xml_cdr/xml_cdr.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2018 + Portions created by the Initial Developer are Copyright (C) 2008-2019 the Initial Developer. All Rights Reserved. Contributor(s): @@ -487,9 +487,12 @@ } } + //set an empty content variable + $content = ''; + //recording playback if (permission_exists('recording_play') && $record_path != '') { - echo "\n"; + $content .= "\n"; } if ($row['raw_data_exists'] && permission_exists('xml_cdr_details')) { @@ -498,17 +501,17 @@ else { $tr_link = null; } - echo "\n"; + $content .= "\n"; if (permission_exists('xml_cdr_delete')) { - echo " "; - echo " "; - echo " "; - echo " "; + $content .= " "; + $content .= " "; + $content .= " "; + $content .= " "; $xml_ids[] = 'checkbox_'.$row['xml_cdr_uuid']; } //determine call result and appropriate icon - echo "\n"; + $content .= "\n"; if ($theme_cdr_images_exist) { if ($row['direction'] == 'inbound' || $row['direction'] == 'local') { if ($row['answer_stamp'] != '' && $row['bridge_uuid'] != '') { $call_result = 'answered'; } @@ -527,79 +530,78 @@ $image_name .= '_b'; } $image_name .= ".png"; - echo "\n"; + $content .= "\n"; } } - else { echo " "; } - echo "\n"; + else { $content .= " "; } + $content .= "\n"; //extension if (permission_exists('xml_cdr_extension')) { - echo " "; - echo $row['extension'].' '; - echo " \n"; + $content .= " "; + $content .= $row['extension'].' '; + $content .= " \n"; } //domain name if ($_REQUEST['show'] == "all" && permission_exists('xml_cdr_all')) { - echo " "; - echo $row['domain_name'].' '; - echo " \n"; + $content .= " "; + $content .= $row['domain_name'].' '; + $content .= " \n"; } //caller id name - echo " ".escape(substr($row['caller_id_name'], 0, 20))." \n"; + $content .= " ".escape(substr($row['caller_id_name'], 0, 20))." \n"; //source - echo " "; - echo " \n"; + $content .= " "; + $content .= " \n"; if (is_numeric($row['caller_id_number'])) { - echo " ".format_phone(substr($row['caller_id_number'], 0, 20)).' '; + $content .= " ".format_phone(substr($row['caller_id_number'], 0, 20)).' '; } else { - echo " ".escape(substr($row['caller_id_number'], 0, 20)).' '; + $content .= " ".escape(substr($row['caller_id_number'], 0, 20)).' '; } - echo " "; - echo " \n"; + $content .= " "; + $content .= " \n"; //caller destination if (permission_exists('caller_destination')) { - echo " "; - echo " \n"; + $content .= " "; + $content .= " \n"; if (is_numeric($row['caller_destination'])) { - echo " ".format_phone(escape(substr($row['caller_destination'], 0, 20))).' '; + $content .= " ".format_phone(escape(substr($row['caller_destination'], 0, 20))).' '; } else { - echo " ".escape(substr($row['caller_destination'], 0, 20)).' '; + $content .= " ".escape(substr($row['caller_destination'], 0, 20)).' '; } - echo " "; - echo " \n"; + $content .= " "; + $content .= " \n"; } //destination - - echo " "; - echo " \n"; + $content .= " "; + $content .= " \n"; if (is_numeric($row['destination_number'])) { - echo format_phone(escape(substr($row['destination_number'], 0, 20)))."\n"; + $content .= format_phone(escape(substr($row['destination_number'], 0, 20)))."\n"; } else { - echo " ".escape(substr($row['destination_number'], 0, 20))."\n"; + $content .= " ".escape(substr($row['destination_number'], 0, 20))."\n"; } - echo " \n"; - echo " \n"; + $content .= " \n"; + $content .= " \n"; //recording if (permission_exists('recording_play') || permission_exists('recording_download')) { if ($record_path != '' && file_exists($record_path.'/'.$record_name)) { - echo " "; + $content .= " "; if (permission_exists('recording_play')) { - echo ""; - echo "".$v_link_label_play.""; + $content .= ""; + $content .= "".$v_link_label_play.""; } else { - echo "don't have recording_play permission "; + $content .= "don't have recording_play permission "; } if (permission_exists('recording_download')) { - echo "".$v_link_label_download.""; + $content .= "".$v_link_label_download.""; } - echo " \n"; + $content .= " \n"; } else { - echo "  \n"; + $content .= "  \n"; } } //dynamic cdr fields @@ -608,16 +610,16 @@ $array = explode(",", $field); $field_name = $array[count($array) - 1]; if ($field_name != "destination_number") { - echo " ".escape($row[$field_name])."\n"; + $content .= " ".escape($row[$field_name])."\n"; } } } //start - echo " ".escape($tmp_start_epoch)."\n"; + $content .= " ".escape($tmp_start_epoch)."\n"; //tta (time to answer) - echo " ".(($row['tta'] > 0) ? $row['tta']."s" : " ")."\n"; + $content .= " ".(($row['tta'] > 0) ? $row['tta']."s" : " ")."\n"; //duration - echo " ".gmdate("G:i:s", $seconds)."\n"; + $content .= " ".gmdate("G:i:s", $seconds)."\n"; //billing if (file_exists($_SERVER["PROJECT_ROOT"]."/app/billing/app_config.php")){ @@ -652,7 +654,7 @@ } } catch(Exception $e) { - echo $e->getMessage(); + $content .= $e->getMessage(); } $n = (($lcr_direction == "inbound")? @@ -676,12 +678,12 @@ else { $price = 0; } - echo " ".number_format($price,6)." $billing_currency\n"; + $content .= " ".number_format($price,6)." $billing_currency\n"; unset ($sell_price, $price); } //pdd (post dial delay) if (permission_exists("xml_cdr_pdd")) { - echo " ".number_format(escape($row['pdd_ms'])/1000,2)."s\n"; + $content .= " ".number_format(escape($row['pdd_ms'])/1000,2)."s\n"; } //mos (mean opinion score) if (permission_exists("xml_cdr_mos")) { @@ -689,28 +691,39 @@ $title = " title='".$text['label-mos_score-'.round($row['rtp_audio_in_mos'])]."'"; $value = $row['rtp_audio_in_mos']; } - echo " $value\n"; + $content .= " $value\n"; } //hangup cause/call result if (permission_exists('hangup_cause')) { - echo " ".escape($hangup_cause)."\n"; + $content .= " ".escape($hangup_cause)."\n"; } else { - echo " ".ucwords(escape($call_result))."\n"; + $content .= " ".ucwords(escape($call_result))."\n"; } //control icons if (permission_exists('xml_cdr_details')) { - echo " "; + $content .= " "; if ($tr_link!=null) { - echo " $v_link_label_view"; //CJB + $content .= " $v_link_label_view"; //CJB } if (permission_exists('xml_cdr_delete')) { - echo "".$v_link_label_delete.""; + $content .= "".$v_link_label_delete.""; } - echo " \n"; + $content .= " \n"; } - echo "\n"; - $c = ($c) ? 0 : 1; + $content .= "\n"; + + //show the leg b only to those with the permission + if ($row['leg'] == 'a') { + echo $content; + } + elseif ($row['leg'] == 'b' && permission_exists('xml_cdr_b_leg')) { + echo $content; + } + unset($content); + + //toggle the color + $c = ($c) ? 0 : 1; } //end foreach unset($sql, $result, $row_count); } //end if results