Merge pull request #4175 from greenbea/master
Added the ability to cut outbound prefixes from the CDR
This commit is contained in:
commit
60cf648d1a
|
|
@ -620,6 +620,20 @@
|
|||
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10;
|
||||
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0';
|
||||
}
|
||||
|
||||
if (strlen($prefix_number) > 0) {
|
||||
if ($_SESSION['cdr']['remove_prefix']['boolean'] == 'true') {
|
||||
$y++;
|
||||
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid();
|
||||
$array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_uuid'] = $dialplan_uuid;
|
||||
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_tag'] = 'action';
|
||||
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_type'] = 'set';
|
||||
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = 'prefix='.$prefix_number;
|
||||
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10;
|
||||
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0';
|
||||
}
|
||||
}
|
||||
|
||||
$y++;
|
||||
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid();
|
||||
|
|
|
|||
|
|
@ -574,13 +574,42 @@
|
|||
$content .= " </td>\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;
|
||||
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 .= " <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";
|
||||
|
||||
if (is_numeric($row['destination_number'])) {
|
||||
$content .= format_phone(escape(substr($row['destination_number'], 0, 20)))."\n";
|
||||
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";
|
||||
}
|
||||
else {
|
||||
$content .= format_phone(escape(substr($row['destination_number'], 0, 20)))."\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
$content .= " ".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 .= " </a>\n";
|
||||
$content .= " </td>\n";
|
||||
|
|
@ -593,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>";
|
||||
}
|
||||
else {
|
||||
$content .= "don't have recording_play permission ";
|
||||
//needs a translation
|
||||
$content .= "Don't have recording_play permission ";
|
||||
}
|
||||
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>";
|
||||
|
|
|
|||
|
|
@ -383,6 +383,7 @@
|
|||
$sql .= "c.destination_number, \n";
|
||||
$sql .= "c.leg, \n";
|
||||
$sql .= "(c.xml IS NOT NULL OR c.json IS NOT NULL) AS raw_data_exists, \n";
|
||||
$sql .= "c.json, \n";
|
||||
if (is_array($_SESSION['cdr']['field'])) {
|
||||
foreach ($_SESSION['cdr']['field'] as $field) {
|
||||
$array = explode(",", $field);
|
||||
|
|
|
|||
Loading…
Reference in New Issue