Portions created by the Initial Developer are Copyright (C) 2008-2014 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane Luis Daniel Lucio Quiroz */ require_once "root.php"; require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "app_languages.php"; if (permission_exists('xml_cdr_view')) { //access granted } else { echo "access denied"; exit; } //add multi-lingual support foreach($text as $key => $value) { $text[$key] = $value[$_SESSION['domain']['language']['code']]; } //import xml_cdr files require_once "v_xml_cdr_import.php"; //additional includes require_once "resources/header.php"; require_once "resources/paging.php"; //xml cdr include $rows_per_page = 100; require_once "xml_cdr_inc.php"; //javascript function: send_cmd echo "\n"; //javascript to toggle input/select boxes echo ""; //page title and description echo "
"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
".$text['title']."


\n"; echo "\n"; echo "\n"; echo "\n"; echo ""; echo "\n"; echo " \n"; echo "\n"; echo "
\n"; if (permission_exists('xml_cdr_search_advanced')) { echo " \n"; } echo " \n"; echo " \n"; echo "
\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
\n"; echo "
\n"; echo "".$text['description']." \n"; echo "".$text['description2']." \n"; echo "".$text['description-3']." \n"; echo "".$text['description-4']." \n"; //To do an advanced search of the call detail records click on the following advanced button. echo "
\n"; echo "
\n"; echo "
\n"; //basic search of call detail records if (permission_exists('xml_cdr_search')) { echo "
\n"; echo "\n"; echo "\n"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
\n"; echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
\n"; echo " ".$text['label-direction']."\n"; echo " \n"; echo " \n"; echo "
\n"; echo " ".$text['label-status']."\n"; echo " \n"; echo " \n"; echo "
\n"; echo "
\n"; // set visibility of Source field(s) if ($caller_extension_uuid == '' && $caller_id_number != '') { $style['caller_extension_uuid'] = 'display: none;'; } else { $style['caller_id_number'] = 'display: none;'; } echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
\n"; echo " ".$text['label-source']."\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
\n"; echo " ".$text['label-destination']."\n"; echo " \n"; echo " \n"; echo "
\n"; echo "
\n"; echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
\n"; echo " ".$text['label-start_range']."\n"; echo " \n"; echo " \n"; echo " \n"; echo "
\n"; echo " ".$text['label-cid-name']."\n"; echo " \n"; echo " \n"; echo "
\n"; echo "
"; echo $text['description_search']; echo ""; echo "\n"; echo "\n"; echo "
"; echo "
"; echo "

"; } //show the results echo "\n"; echo "\n"; echo "\n"; //echo th_order_by('direction', 'Direction', $order_by, $order); //echo th_order_by('default_language', 'Language', $order_by, $order); //echo th_order_by('context', 'Context', $order_by, $order); //echo th_order_by('leg', 'Leg', $order_by, $order); echo th_order_by('caller_id_name', $text['label-cid-name'], $order_by, $order); echo th_order_by('caller_id_number', $text['label-source'], $order_by, $order); echo th_order_by('destination_number', $text['label-destination'], $order_by, $order); echo "\n"; echo th_order_by('start_stamp', $text['label-start'], $order_by, $order); //echo th_order_by('end_stamp', 'End', $order_by, $order); echo th_order_by('duration', $text['label-duration'], $order_by, $order); if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billing/app_config.php")){ // billing collumns echo "\n"; } if (permission_exists('xml_cdr_pdd')) { echo th_order_by('pdd_ms', 'PDD', $order_by, $order); } if (permission_exists('xml_cdr_mos')) { echo th_order_by('rtp_audio_in_mos', 'MOS', $order_by, $order); } echo th_order_by('hangup_cause', $text['label-status'], $order_by, $order); if (if_group("admin") || if_group("superadmin")) { echo "\n"; } echo "\n"; if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billing/app_config.php")){ require_once "app/billing/resources/functions/rating.php"; require_once "resources/classes/database.php"; $database = new database; } if ($result_count > 0) { foreach($result as $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'])); if (defined('TIME_24HR') && TIME_24HR == 1) { $tmp_start_epoch = date("j M Y H:i:s", $row['start_epoch']); } else { $tmp_start_epoch = date("j M Y h:i:sa", $row['start_epoch']); } $hangup_cause = $row['hangup_cause']; $hangup_cause = str_replace("_", " ", $hangup_cause); $hangup_cause = strtolower($hangup_cause); $hangup_cause = ucwords($hangup_cause); $tmp_dir = $_SESSION['switch']['recordings']['dir'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day; $tmp_name = ''; if(!empty($row['recording_file']) && file_exists($row['recording_file'])){ $tmp_name=$row['recording_file']; } elseif (file_exists($tmp_dir.'/'.$row['uuid'].'.wav')) { $tmp_name = $row['uuid'].".wav"; } elseif (file_exists($tmp_dir.'/'.$row['uuid'].'_1.wav')) { $tmp_name = $row['uuid']."_1.wav"; } elseif (file_exists($tmp_dir.'/'.$row['uuid'].'.mp3')) { $tmp_name = $row['uuid'].".mp3"; } elseif (file_exists($tmp_dir.'/'.$row['uuid'].'_1.mp3')) { $tmp_name = $row['uuid']."_1.mp3"; } $tr_link = (if_group("admin") || if_group("superadmin")) ? "href='xml_cdr_details.php?uuid=".$row['uuid']."'" : null; echo "\n"; if ( file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_inbound_missed.png") && file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_inbound_connected.png") && file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_outbound_failed.png") && file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_outbound_connected.png") && file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_local_failed.png") && file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_local_connected.png") ) { echo " \n"; } else { echo " "; } //echo " \n"; //echo " \n"; //echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; //echo " \n"; //If they cancelled, show the ring time, not the bill time. $seconds = ($row['hangup_cause']=="ORIGINATOR_CANCEL") ? $row['duration'] : $row['billsec']; echo " \n"; if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billing/app_config.php")){ $database->table = "v_xml_cdr"; $accountcode = (strlen($row["accountcode"])?$row["accountcode"]:$_SESSION[domain_name]); $database->sql = "SELECT currency FROM v_billings WHERE type_value='$accountcode'"; $database->result = $database->execute(); $billing_currency = (strlen($database->result[0]['currency'])?$database->result[0]['currency']:'USD'); unset($database->sql); unset($database->result); $sell_price = $row['call_sell']; $lcr_direction = (strlen($row['direction'])?$row['direction']:"outbound"); $n = (($lcr_direction == "inbound")?$row['caller_id_number']:$row['destination_number']); $database->table = "v_lcr"; $database->sql = "SELECT currency FROM v_lcr WHERE v_lcr.carrier_uuid= '' AND v_lcr.enabled='true' AND v_lcr.lcr_direction='$lcr_direction' AND v_lcr.digits IN (".number_series($n).") ORDER BY digits DESC, rate ASC, date_start DESC LIMIT 1"; $database->result = $database->execute(); //print "
"; print_r($database->result); print "[".$database->result[0]['currency']."]"; print "
"; $lcr_currency = ((is_string($database->result[0]['currency']) && strlen($database->result[0]['currency']))?$database->result[0]['currency']:'USD'); //billed currency unset($database->sql); unset($database->result); $price = currency_convert($sell_price, $billing_currency, $lcr_currency); echo " \n"; } if (permission_exists("xml_cdr_pdd")) { echo " \n"; } if (permission_exists("xml_cdr_mos")) { echo " \n"; } echo " \n"; if (if_group("admin") || if_group("superadmin")) { echo " \n"; } echo "\n"; if ($c==0) { $c=1; } else { $c=0; } } //end foreach unset($sql, $result, $row_count); } //end if results echo "\n"; echo "\n"; echo "\n"; echo "
 ".$text['label-tools']."".$text['label-price']." 
"; switch ($row['direction']) { case "inbound" : if ($row['billsec'] == 0) echo "".$text[\n"; else echo "".$text[\n"; break; case "outbound" : if ($row['billsec'] == 0) echo "".$text[\n"; else echo "".$text[\n"; break; case "local" : if ($row['billsec'] == 0) echo "".$text[\n"; else echo "".$text[\n"; break; } echo "  ".$row['default_language']."".$row['context']."".$row['leg'].""; echo $row['caller_id_name'].' '; echo " "; if (strlen($tmp_name) > 0 && file_exists($_SESSION['switch']['recordings']['dir'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$tmp_name)) { echo " \n"; echo " ".$text['label-play']."\n"; echo " \n"; echo "  \n"; echo " \n"; echo " ".$text['label-download']."\n"; echo " \n"; } else { echo "  \n"; } echo " ".$tmp_start_epoch."".$row['end_stamp']."".gmdate("G:i:s", $seconds)."".number_format($price,6)." $billing_currency".number_format($row['pdd_ms']/1000,2)."s 0) ? "title='".($row['rtp_audio_in_mos'] / 5 * 100)."%'" : null).">".((strlen($row['rtp_audio_in_mos']) > 0) ? $row['rtp_audio_in_mos'] : " ").""; if (if_group("admin") || if_group("superadmin")) { echo "".$hangup_cause.""; } else { echo $hangup_cause; } echo " "; echo " $v_link_label_view"; echo "
\n"; echo "

"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
 $paging_controls 
\n"; echo "
"; echo "
"; echo "

"; echo "

"; //show the footer require_once "resources/footer.php"; ?>