\n";
echo "\n";
@@ -457,39 +470,64 @@
}
//column headings
- echo "| | \n";
+ if (permission_exists('xml_cdr_direction')) {
+ echo " | \n";
+ $col_count++;
+ }
if (permission_exists('xml_cdr_extension')) {
echo "".$text['label-extension']." | \n";
+ $col_count++;
}
- if ($_REQUEST['show'] == "all" && permission_exists('xml_cdr_all')) {
+ if (permission_exists('xml_cdr_all') && $_REQUEST['show'] == "all") {
echo "".$text['label-domain']." | \n";
$col_count++;
}
- echo "".$text['label-caller_id_name']." | \n";
- echo "".$text['label-caller_id_number']." | \n";
+ if (permission_exists('xml_cdr_caller_id_name')) {
+ echo "".$text['label-caller_id_name']." | \n";
+ $col_count++;
+ }
+ if (permission_exists('xml_cdr_caller_id_number')) {
+ echo "".$text['label-caller_id_number']." | \n";
+ $col_count++;
+ }
if (permission_exists('xml_cdr_caller_destination')) {
echo "".$text['label-caller_destination']." | \n";
+ $col_count++;
}
- echo "".$text['label-destination']." | \n";
- if (permission_exists('recording_play') || permission_exists('recording_download')) {
+ if (permission_exists('xml_cdr_destination')) {
+ echo "".$text['label-destination']." | \n";
+ $col_count++;
+ }
+ if (permission_exists('xml_cdr_recording') && (permission_exists('recording_play') || permission_exists('recording_download'))) {
echo "".$text['label-recording']." | \n";
$col_count++;
}
- if (is_array($_SESSION['cdr']['field'])) {
- foreach ($_SESSION['cdr']['field'] as $field) {
- $array = explode(",", $field);
- $field_name = $array[count($array) - 1];
- $field_label = ucwords(str_replace("_", " ", $field_name));
- $field_label = str_replace("Sip", "SIP", $field_label);
- if ($field_name != "destination_number") {
- echo "".$field_label." | \n";
- $col_count++;
+ if (permission_exists('xml_cdr_custom_fields')) {
+ if (is_array($_SESSION['cdr']['field']) && @sizeof($_SESSION['cdr']['field'])) {
+ foreach ($_SESSION['cdr']['field'] as $field) {
+ $array = explode(",", $field);
+ $field_name = end($array);
+ $field_label = ucwords(str_replace("_", " ", $field_name));
+ $field_label = str_replace("Sip", "SIP", $field_label);
+ if ($field_name != "destination_number") {
+ echo "".$field_label." | \n";
+ $col_count++;
+ }
}
}
}
- echo "".$text['label-start']." | \n";
- echo "".$text['label-tta']." | \n";
- echo "".$text['label-duration']." | \n";
+ if (permission_exists('xml_cdr_start')) {
+ echo "".$text['label-start']." | \n";
+ $col_count++;
+ }
+ if (permission_exists('xml_cdr_tta')) {
+ echo "".$text['label-tta']." | \n";
+ $col_count++;
+ }
+ if (permission_exists('xml_cdr_duration')) {
+ echo "".$text['label-duration']." | \n";
+ $col_count++;
+ }
if (permission_exists('xml_cdr_pdd')) {
echo "".$text['label-pdd']." | \n";
$col_count++;
@@ -500,11 +538,13 @@
}
if (permission_exists('xml_cdr_hangup_cause')) {
echo "".$text['label-hangup_cause']." | \n";
+ $col_count++;
}
else {
echo "".$text['label-status']." | \n";
+ $col_count++;
}
- if (if_group("admin") || if_group("superadmin") || if_group("cdr")) {
+ if (permission_exists('xml_cdr_details')) {
echo "";
if (permission_exists('xml_cdr_delete') && $result_count > 0) {
echo "".$v_link_label_delete."";
@@ -570,7 +610,7 @@
$content .= " |
|
\n";
}
- if ($row['raw_data_exists'] && permission_exists('xml_cdr_details')) {
+ if (permission_exists('xml_cdr_details') && $row['raw_data_exists']) {
$tr_link = "href='xml_cdr_details.php?id=".escape($row['xml_cdr_uuid']).(($_REQUEST['show']) ? "&show=all" : null)."'";
}
else {
@@ -586,30 +626,32 @@
}
//determine call result and appropriate icon
- $content .= "\n";
- if ($theme_cdr_images_exist) {
- if ($row['direction'] == 'inbound' || $row['direction'] == 'local') {
- if ($row['answer_stamp'] != '' && $row['bridge_uuid'] != '') { $call_result = 'answered'; }
- else if ($row['answer_stamp'] != '' && $row['bridge_uuid'] == '') { $call_result = 'voicemail'; }
- else if ($row['answer_stamp'] == '' && $row['bridge_uuid'] == '' && $row['sip_hangup_disposition'] != 'send_refuse') { $call_result = 'cancelled'; }
- else { $call_result = 'failed'; }
- }
- else if ($row['direction'] == 'outbound') {
- if ($row['answer_stamp'] != '' && $row['bridge_uuid'] != '') { $call_result = 'answered'; }
- else if ($row['answer_stamp'] == '' && $row['bridge_uuid'] != '') { $call_result = 'cancelled'; }
- else { $call_result = 'failed'; }
- }
- if (strlen($row['direction']) > 0) {
- $image_name = "icon_cdr_" . $row['direction'] . "_" . $call_result;
- if($row['leg'] == 'b') {
- $image_name .= '_b';
+ if (permission_exists('xml_cdr_direction')) {
+ $content .= " | \n";
+ if ($theme_cdr_images_exist) {
+ if ($row['direction'] == 'inbound' || $row['direction'] == 'local') {
+ if ($row['answer_stamp'] != '' && $row['bridge_uuid'] != '') { $call_result = 'answered'; }
+ else if ($row['answer_stamp'] != '' && $row['bridge_uuid'] == '') { $call_result = 'voicemail'; }
+ else if ($row['answer_stamp'] == '' && $row['bridge_uuid'] == '' && $row['sip_hangup_disposition'] != 'send_refuse') { $call_result = 'cancelled'; }
+ else { $call_result = 'failed'; }
+ }
+ else if ($row['direction'] == 'outbound') {
+ if ($row['answer_stamp'] != '' && $row['bridge_uuid'] != '') { $call_result = 'answered'; }
+ else if ($row['answer_stamp'] == '' && $row['bridge_uuid'] != '') { $call_result = 'cancelled'; }
+ else { $call_result = 'failed'; }
+ }
+ if (strlen($row['direction']) > 0) {
+ $image_name = "icon_cdr_" . $row['direction'] . "_" . $call_result;
+ if($row['leg'] == 'b') {
+ $image_name .= '_b';
+ }
+ $image_name .= ".png";
+ $content .= " \n";
}
- $image_name .= ".png";
- $content .= " \n";
}
+ else { $content .= " "; }
+ $content .= " | \n";
}
- else { $content .= " "; }
- $content .= "\n";
//extension
if (permission_exists('xml_cdr_extension')) {
$content .= " ";
@@ -617,24 +659,28 @@
$content .= " | \n";
}
//domain name
- if ($_REQUEST['show'] == "all" && permission_exists('xml_cdr_all')) {
+ if (permission_exists('xml_cdr_all') && $_REQUEST['show'] == "all") {
$content .= " ";
$content .= $row['domain_name'].' ';
$content .= " | \n";
}
//caller id name
- $content .= " ".escape(substr($row['caller_id_name'], 0, 20))." | \n";
+ if (permission_exists('xml_cdr_caller_id_name')) {
+ $content .= " ".escape(substr($row['caller_id_name'], 0, 20))." | \n";
+ }
//source
- $content .= " ";
- $content .= " \n";
- if (is_numeric($row['caller_id_number'])) {
- $content .= " ".format_phone(substr($row['caller_id_number'], 0, 20)).' ';
+ if (permission_exists('xml_cdr_caller_id_number')) {
+ $content .= " | ";
+ $content .= " \n";
+ if (is_numeric($row['caller_id_number'])) {
+ $content .= " ".format_phone(substr($row['caller_id_number'], 0, 20)).' ';
+ }
+ else {
+ $content .= " ".escape(substr($row['caller_id_number'], 0, 20)).' ';
+ }
+ $content .= " ";
+ $content .= " | \n";
}
- else {
- $content .= " ".escape(substr($row['caller_id_number'], 0, 20)).' ';
- }
- $content .= " ";
- $content .= " \n";
//caller destination
if (permission_exists('xml_cdr_caller_destination')) {
$content .= " ";
@@ -649,54 +695,55 @@
$content .= " | \n";
}
//destination
- if ($_SESSION['cdr']['remove_prefix']['boolean'] == 'true') {
- //get outbound prefix variable from json table if exists
- $json_string = trim($row["json"]);
- $array = json_decode($json_string,true);
- $remove_prefix = false;
- $prefix = false;
- if (is_array($array["app_log"]["application"])) {
- foreach ($array["app_log"]["application"] as $application) {
- $app_data = urldecode($application["@attributes"]["app_data"]);
- if (substr($app_data,0,7) == "prefix=") {
- $prefix = substr($app_data,7);
- $remove_prefix = true;
+ if (permission_exists('xml_cdr_destination')) {
+ if ($_SESSION['cdr']['remove_prefix']['boolean'] == 'true') {
+ //get outbound prefix variable from json table if exists
+ $json_string = trim($row["json"]);
+ $array = json_decode($json_string,true);
+ $remove_prefix = false;
+ $prefix = false;
+ if (is_array($array["app_log"]["application"])) {
+ foreach ($array["app_log"]["application"] as $application) {
+ $app_data = urldecode($application["@attributes"]["app_data"]);
+ if (substr($app_data,0,7) == "prefix=") {
+ $prefix = substr($app_data,7);
+ $remove_prefix = true;
+ }
}
}
}
- }
- $content .= " ";
- $content .= " \n";
+ $content .= " | ";
+ $content .= " \n";
+ if (is_numeric($row['destination_number'])) {
+ if ($prefix) {
+ //confirms call was made with a prefix
+ $is_prefixed = substr(format_phone(escape(substr($row['destination_number'], 0, 20))),0,strlen($prefix));
- if (is_numeric($row['destination_number'])) {
- if ($prefix) {
- //confirms call was made with a prefix
- $is_prefixed = substr(format_phone(escape(substr($row['destination_number'], 0, 20))),0,strlen($prefix));
-
- //remove the prefix
- if ($prefix == $is_prefixed) {
- $content .= substr(format_phone(escape(substr($row['destination_number'], 0, 20))),strlen($prefix))."\n";
+ //remove the prefix
+ if ($prefix == $is_prefixed) {
+ $content .= substr(format_phone(escape(substr($row['destination_number'], 0, 20))),strlen($prefix))."\n";
+ }
+ else {
+ $content .= format_phone(escape(substr($row['destination_number'], 0, 20)))."\n";
+ }
}
else {
$content .= format_phone(escape(substr($row['destination_number'], 0, 20)))."\n";
}
}
else {
- $content .= format_phone(escape(substr($row['destination_number'], 0, 20)))."\n";
+ if ($remove_prefix == 'true') {
+ $content .= substr(format_phone(escape(substr($row['destination_number'], 0, 20))),strlen($prefix))."\n";
+ }
+ else {
+ $content .= format_phone(escape(substr($row['destination_number'], 0, 20)))."\n";
+ }
}
+ $content .= " \n";
+ $content .= " | \n";
}
- else {
- if ($remove_prefix == 'true') {
- $content .= substr(format_phone(escape(substr($row['destination_number'], 0, 20))),strlen($prefix))."\n";
- }
- else {
- $content .= format_phone(escape(substr($row['destination_number'], 0, 20)))."\n";
- }
- }
- $content .= " \n";
- $content .= " \n";
//recording
- if (permission_exists('recording_play') || permission_exists('recording_download')) {
+ if (permission_exists('xml_cdr_recording') && (permission_exists('recording_play') || permission_exists('recording_download'))) {
if ($record_path != '' && file_exists($record_path.'/'.$record_name)) {
$content .= " ";
if (permission_exists('recording_play')) {
@@ -716,22 +763,30 @@
$content .= " | | \n";
}
}
- //dynamic cdr fields
- if (is_array($_SESSION['cdr']['field'])) {
- foreach ($_SESSION['cdr']['field'] as $field) {
- $array = explode(",", $field);
- $field_name = $array[count($array) - 1];
- if ($field_name != "destination_number") {
- $content .= " ".escape($row[$field_name])." | \n";
+ //custom cdr fields
+ if (permission_exists('xml_cdr_custom_fields')) {
+ if (is_array($_SESSION['cdr']['field'])) {
+ foreach ($_SESSION['cdr']['field'] as $field) {
+ $array = explode(",", $field);
+ $field_name = $array[count($array) - 1];
+ if ($field_name != "destination_number") {
+ $content .= " ".escape($row[$field_name])." | \n";
+ }
}
}
}
//start
- $content .= " ".escape($tmp_start_epoch)." | \n";
+ if (permission_exists('xml_cdr_start')) {
+ $content .= " ".escape($tmp_start_epoch)." | \n";
+ }
//tta (time to answer)
- $content .= " ".(($row['tta'] > 0) ? $row['tta']."s" : " ")." | \n";
+ if (permission_exists('xml_cdr_tta')) {
+ $content .= " ".(($row['tta'] > 0) ? $row['tta']."s" : " ")." | \n";
+ }
//duration
- $content .= " ".gmdate("G:i:s", $seconds)." | \n";
+ if (permission_exists('xml_cdr_duration')) {
+ $content .= " ".gmdate("G:i:s", $seconds)." | \n";
+ }
//pdd (post dial delay)
if (permission_exists("xml_cdr_pdd")) {
$content .= " ".number_format(escape($row['pdd_ms'])/1000,2)."s | \n";
@@ -754,8 +809,8 @@
//control icons
if (permission_exists('xml_cdr_details')) {
$content .= " ";
- if ($tr_link!=null) {
- $content .= " $v_link_label_view";
+ if ($tr_link != null) {
+ $content .= " ".$v_link_label_view."";
}
if (permission_exists('xml_cdr_delete')) {
$content .= "".$v_link_label_delete."";
|