From 24b6c0f3f46beb49b01b486e98521697f5428a8f Mon Sep 17 00:00:00 2001 From: agree <37550360+greenbea@users.noreply.github.com> Date: Fri, 24 May 2019 13:55:59 -0400 Subject: [PATCH 1/6] Update xml_cdr_inc.php --- app/xml_cdr/xml_cdr_inc.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/xml_cdr/xml_cdr_inc.php b/app/xml_cdr/xml_cdr_inc.php index 98e47b0fbe..b6d88b5892 100644 --- a/app/xml_cdr/xml_cdr_inc.php +++ b/app/xml_cdr/xml_cdr_inc.php @@ -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); From 2a99f7ad2d6ef4d46650614f21c6800688a00369 Mon Sep 17 00:00:00 2001 From: agree <37550360+greenbea@users.noreply.github.com> Date: Fri, 24 May 2019 13:58:31 -0400 Subject: [PATCH 2/6] Update xml_cdr.php --- app/xml_cdr/xml_cdr.php | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/app/xml_cdr/xml_cdr.php b/app/xml_cdr/xml_cdr.php index c318bd68a8..d718a891c0 100644 --- a/app/xml_cdr/xml_cdr.php +++ b/app/xml_cdr/xml_cdr.php @@ -464,7 +464,7 @@ $tmp_month = date("M", strtotime($row['start_stamp'])); $tmp_day = date("d", strtotime($row['start_stamp'])); $tmp_start_epoch = ($_SESSION['domain']['time_format']['text'] == '12h') ? date("j M Y g:i:sa", $row['start_epoch']) : date("j M Y H:i:s", $row['start_epoch']); - + //get the hangup cause $hangup_cause = $row['hangup_cause']; $hangup_cause = str_replace("_", " ", $hangup_cause); @@ -574,13 +574,37 @@ $content .= " \n"; } //destination + if ($_SESSION['cdr']['cut_prefix']['boolean'] == 'true') { + //get outbound prefix variable from json table if exists + $json_string = trim($row["json"]); + $array = json_decode($json_string,true); + $cut_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); + $cut_prefix = true; } + } + } $content .= " "; $content .= " \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)); + if ($prefix == $is_prefixed) { + //cut the prefix + $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 ($cut_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"; From ea84f989a0acaeebe312bcb4678d288ed01928e1 Mon Sep 17 00:00:00 2001 From: agree <37550360+greenbea@users.noreply.github.com> Date: Fri, 24 May 2019 14:07:53 -0400 Subject: [PATCH 3/6] Update dialplan_outbound_add.php --- app/dialplan_outbound/dialplan_outbound_add.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/dialplan_outbound/dialplan_outbound_add.php b/app/dialplan_outbound/dialplan_outbound_add.php index a7857b44b7..ac56739978 100644 --- a/app/dialplan_outbound/dialplan_outbound_add.php +++ b/app/dialplan_outbound/dialplan_outbound_add.php @@ -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']['cut_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(); From 888945e03e58867616b0a7fffe71db4ed31142e7 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Fri, 24 May 2019 13:45:29 -0600 Subject: [PATCH 4/6] Update xml_cdr.php --- app/xml_cdr/xml_cdr.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/xml_cdr/xml_cdr.php b/app/xml_cdr/xml_cdr.php index d718a891c0..9f32a66b9b 100644 --- a/app/xml_cdr/xml_cdr.php +++ b/app/xml_cdr/xml_cdr.php @@ -464,7 +464,7 @@ $tmp_month = date("M", strtotime($row['start_stamp'])); $tmp_day = date("d", strtotime($row['start_stamp'])); $tmp_start_epoch = ($_SESSION['domain']['time_format']['text'] == '12h') ? date("j M Y g:i:sa", $row['start_epoch']) : date("j M Y H:i:s", $row['start_epoch']); - + //get the hangup cause $hangup_cause = $row['hangup_cause']; $hangup_cause = str_replace("_", " ", $hangup_cause); From 6f1e5aa4793b74ddb637c0e7ad88ce74e246576c Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Fri, 24 May 2019 13:51:43 -0600 Subject: [PATCH 5/6] Update xml_cdr.php --- app/xml_cdr/xml_cdr.php | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/app/xml_cdr/xml_cdr.php b/app/xml_cdr/xml_cdr.php index 9f32a66b9b..29d145cd66 100644 --- a/app/xml_cdr/xml_cdr.php +++ b/app/xml_cdr/xml_cdr.php @@ -574,37 +574,42 @@ $content .= " \n"; } //destination - if ($_SESSION['cdr']['cut_prefix']['boolean'] == 'true') { + 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); - $cut_prefix = false; + $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); - $cut_prefix = true; } + $remove_prefix = true; + } } } $content .= " "; $content .= " \n"; if (is_numeric($row['destination_number'])) { - if ($prefix ) { + 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) { - //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 { - $content .= format_phone(escape(substr($row['destination_number'], 0, 20)))."\n";} + $content .= format_phone(escape(substr($row['destination_number'], 0, 20)))."\n"; + } } else { - if ($cut_prefix == 'true') { - $content .= substr(format_phone(escape(substr($row['destination_number'], 0, 20))),strlen($prefix))."\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 .= format_phone(escape(substr($row['destination_number'], 0, 20)))."\n"; + } } $content .= " \n"; $content .= " \n"; @@ -617,7 +622,8 @@ $content .= "".$v_link_label_play.""; } else { - $content .= "don't have recording_play permission "; + //needs a translation + $content .= "Don't have recording_play permission "; } if (permission_exists('recording_download')) { $content .= "".$v_link_label_download.""; From e4cb6617b46b80a89a90ec8d342b1a32db69b988 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Fri, 24 May 2019 13:52:41 -0600 Subject: [PATCH 6/6] Update dialplan_outbound_add.php --- app/dialplan_outbound/dialplan_outbound_add.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/dialplan_outbound/dialplan_outbound_add.php b/app/dialplan_outbound/dialplan_outbound_add.php index ac56739978..5c711ff54b 100644 --- a/app/dialplan_outbound/dialplan_outbound_add.php +++ b/app/dialplan_outbound/dialplan_outbound_add.php @@ -622,7 +622,7 @@ } if (strlen($prefix_number) > 0) { - if ($_SESSION['cdr']['cut_prefix']['boolean'] == 'true') { + 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'];