Update xml_cdr.php

This commit is contained in:
FusionPBX 2019-05-24 13:51:43 -06:00 committed by GitHub
parent c23d39bbd9
commit c2f77eb539
1 changed files with 17 additions and 11 deletions

View File

@ -574,37 +574,42 @@
$content .= " </td>\n"; $content .= " </td>\n";
} }
//destination //destination
if ($_SESSION['cdr']['cut_prefix']['boolean'] == 'true') { if ($_SESSION['cdr']['remove_prefix']['boolean'] == 'true') {
//get outbound prefix variable from json table if exists //get outbound prefix variable from json table if exists
$json_string = trim($row["json"]); $json_string = trim($row["json"]);
$array = json_decode($json_string,true); $array = json_decode($json_string,true);
$cut_prefix = false; $remove_prefix = false;
if (is_array($array["app_log"]["application"])) foreach ($array["app_log"]["application"] as $application) { if (is_array($array["app_log"]["application"])) foreach ($array["app_log"]["application"] as $application) {
$app_data = urldecode($application["@attributes"]["app_data"]); $app_data = urldecode($application["@attributes"]["app_data"]);
if (substr($app_data,0,7) == "prefix=") { if (substr($app_data,0,7) == "prefix=") {
$prefix = substr($app_data,7); $prefix = substr($app_data,7);
$cut_prefix = true; } $remove_prefix = true;
}
} }
} }
$content .= " <td valign='top' class='".$row_style[$c]." tr_link_void' nowrap='nowrap'>"; $content .= " <td valign='top' class='".$row_style[$c]." tr_link_void' nowrap='nowrap'>";
$content .= " <a href=\"javascript:void(0)\" onclick=\"send_cmd('".PROJECT_PATH."/app/click_to_call/click_to_call.php?src_cid_name=".urlencode(escape($row['destination_number']))."&src_cid_number=".urlencode(escape($row['destination_number']))."&dest_cid_name=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_name'])."&dest_cid_number=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_number'])."&src=".urlencode($_SESSION['user']['extension'][0]['user'])."&dest=".urlencode(escape($row['destination_number']))."&rec=false&ringback=us-ring&auto_answer=true');\">\n"; $content .= " <a href=\"javascript:void(0)\" onclick=\"send_cmd('".PROJECT_PATH."/app/click_to_call/click_to_call.php?src_cid_name=".urlencode(escape($row['destination_number']))."&src_cid_number=".urlencode(escape($row['destination_number']))."&dest_cid_name=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_name'])."&dest_cid_number=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_number'])."&src=".urlencode($_SESSION['user']['extension'][0]['user'])."&dest=".urlencode(escape($row['destination_number']))."&rec=false&ringback=us-ring&auto_answer=true');\">\n";
if (is_numeric($row['destination_number'])) { if (is_numeric($row['destination_number'])) {
if ($prefix ) { if ($prefix) {
//confirms call was made with a prefix //confirms call was made with a prefix
$is_prefixed = substr(format_phone(escape(substr($row['destination_number'], 0, 20))),0,strlen($prefix)); $is_prefixed = substr(format_phone(escape(substr($row['destination_number'], 0, 20))),0,strlen($prefix));
//remove the prefix
if ($prefix == $is_prefixed) { if ($prefix == $is_prefixed) {
//cut the prefix $content .= substr(format_phone(escape(substr($row['destination_number'], 0, 20))),strlen($prefix))."\n";
$content .= substr(format_phone(escape(substr($row['destination_number'], 0, 20))),strlen($prefix))."\n"; } }
else { else {
$content .= format_phone(escape(substr($row['destination_number'], 0, 20)))."\n";} $content .= format_phone(escape(substr($row['destination_number'], 0, 20)))."\n";
}
} }
else { else {
if ($cut_prefix == 'true') { if ($remove_prefix == 'true') {
$content .= substr(format_phone(escape(substr($row['destination_number'], 0, 20))),strlen($prefix))."\n"; $content .= substr(format_phone(escape(substr($row['destination_number'], 0, 20))),strlen($prefix))."\n";
} }
else { else {
$content .= format_phone(escape(substr($row['destination_number'], 0, 20)))."\n"; }} $content .= format_phone(escape(substr($row['destination_number'], 0, 20)))."\n";
}
} }
$content .= " </a>\n"; $content .= " </a>\n";
$content .= " </td>\n"; $content .= " </td>\n";
@ -617,7 +622,8 @@
$content .= "<span id='recording_button_".escape($row['xml_cdr_uuid'])."' onclick=\"recording_play('".escape($row['xml_cdr_uuid'])."')\" title='".$text['label-play']." / ".$text['label-pause']."'>".$v_link_label_play."</span>"; $content .= "<span id='recording_button_".escape($row['xml_cdr_uuid'])."' onclick=\"recording_play('".escape($row['xml_cdr_uuid'])."')\" title='".$text['label-play']." / ".$text['label-pause']."'>".$v_link_label_play."</span>";
} }
else { else {
$content .= "don't have recording_play permission "; //needs a translation
$content .= "Don't have recording_play permission ";
} }
if (permission_exists('recording_download')) { if (permission_exists('recording_download')) {
$content .= "<a href=\"download.php?id=".escape($row['xml_cdr_uuid'])."&t=bin\" title='".$text['label-download']."'>".$v_link_label_download."</a>"; $content .= "<a href=\"download.php?id=".escape($row['xml_cdr_uuid'])."&t=bin\" title='".$text['label-download']."'>".$v_link_label_download."</a>";