diff --git a/app/dialplan_outbound/dialplan_outbound_add.php b/app/dialplan_outbound/dialplan_outbound_add.php index a7857b44b7..5c711ff54b 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']['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(); diff --git a/app/xml_cdr/xml_cdr.php b/app/xml_cdr/xml_cdr.php index c318bd68a8..29d145cd66 100644 --- a/app/xml_cdr/xml_cdr.php +++ b/app/xml_cdr/xml_cdr.php @@ -574,13 +574,42 @@ $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; + 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 .= "