diff --git a/app/xml_cdr/app_config.php b/app/xml_cdr/app_config.php index 2619f2c8e7..c46dac1d53 100644 --- a/app/xml_cdr/app_config.php +++ b/app/xml_cdr/app_config.php @@ -61,9 +61,37 @@ $y++; $apps[$x]['permissions'][$y]['name'] = "xml_cdr_all"; $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; + $y++; + $apps[$x]['permissions'][$y]['name'] = "xml_cdr_b_leg"; + $apps[$x]['permissions'][$y]['groups'][] = "admin"; + $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; //default settings $y=0; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = '0f208802-5f18-41f9-97a3-45e939e7a1b8'; + $apps[$x]['default_settings'][$y]['default_setting_category'] = 'cdr'; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = 'b_leg'; + $apps[$x]['default_settings'][$y]['default_setting_name'] = 'array'; + $apps[$x]['default_settings'][$y]['default_setting_value'] = 'outbound'; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = 'false'; + $apps[$x]['default_settings'][$y]['default_setting_description'] = ''; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = 'd9d09758-6deb-47e5-b5bb-812da3a8d196'; + $apps[$x]['default_settings'][$y]['default_setting_category'] = 'cdr'; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = 'b_leg'; + $apps[$x]['default_settings'][$y]['default_setting_name'] = 'array'; + $apps[$x]['default_settings'][$y]['default_setting_value'] = 'inbound'; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = 'false'; + $apps[$x]['default_settings'][$y]['default_setting_description'] = ''; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = '74e33709-da7d-4d46-a31f-6580ab9a7714'; + $apps[$x]['default_settings'][$y]['default_setting_category'] = 'cdr'; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = 'b_leg'; + $apps[$x]['default_settings'][$y]['default_setting_name'] = 'array'; + $apps[$x]['default_settings'][$y]['default_setting_value'] = 'local'; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = 'false'; + $apps[$x]['default_settings'][$y]['default_setting_description'] = ''; + $y++; $apps[$x]['default_settings'][$y]['default_setting_uuid'] = 'dbbadd02-f95d-480b-85d5-2a4113d4cccc'; $apps[$x]['default_settings'][$y]['default_setting_category'] = 'cdr'; $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = 'format'; diff --git a/app/xml_cdr/v_xml_cdr_import.php b/app/xml_cdr/v_xml_cdr_import.php index a7f04ce3f6..ade8cc2b01 100644 --- a/app/xml_cdr/v_xml_cdr_import.php +++ b/app/xml_cdr/v_xml_cdr_import.php @@ -74,6 +74,19 @@ require_once "app/billing/resources/functions/rating.php"; } + function accept_b_leg($xml){ + // if no filter set allow all for backward compatibility + if(empty($_SESSION['cdr']['b_leg'])){ + return true; + } + // filter out by call direction + if(in_array(@$xml->variables->call_direction, $_SESSION['cdr']['b_leg'])){ + return true; + } + // Disable cdr write + return false; + } + //define the process_xml_cdr function function process_xml_cdr($db, $leg, $xml_string) { //set global variable @@ -102,6 +115,13 @@ xml_cdr_log("\nfail loadxml: " . $e->getMessage() . "\n"); } + //filter out b-legs + if($leg == 'b'){ + if(!accept_b_leg($xml)){ + return; + } + } + //prepare the database object require_once "resources/classes/database.php"; $database = new database; @@ -175,7 +195,7 @@ unset($x); //if last_sent_callee_id_number is set use it for the destination_number - if (strlen($xml->variables->last_sent_callee_id_number) > 0) { + if (($leg == 'a') && (strlen($xml->variables->last_sent_callee_id_number) > 0)) { $database->fields['destination_number'] = urldecode($xml->variables->last_sent_callee_id_number); } diff --git a/app/xml_cdr/xml_cdr.php b/app/xml_cdr/xml_cdr.php index 98ecf69911..72445a5129 100644 --- a/app/xml_cdr/xml_cdr.php +++ b/app/xml_cdr/xml_cdr.php @@ -110,6 +110,7 @@ echo " \n"; echo " \n"; echo " \n"; + echo " \n"; if (is_array($_SESSION['cdr']['field'])) { foreach ($_SESSION['cdr']['field'] as $field) { $array = explode(",", $field); @@ -524,7 +525,12 @@ else { $call_result = 'failed'; } } if (strlen($row['direction']) > 0) { - echo "\n"; + $image_name = "icon_cdr_" . $row['direction'] . "_" . $call_result; + if($row['leg'] == 'b'){ + $image_name .= '_b'; + } + $image_name .= ".png"; + echo "\n"; } } else { echo " "; } diff --git a/app/xml_cdr/xml_cdr_inc.php b/app/xml_cdr/xml_cdr_inc.php index ea4eeedc3d..f185306970 100644 --- a/app/xml_cdr/xml_cdr_inc.php +++ b/app/xml_cdr/xml_cdr_inc.php @@ -99,9 +99,12 @@ } //$mos_comparison = check_str($_REQUEST["mos_comparison"]); $mos_score = check_str($_REQUEST["mos_score"]); + $leg = check_str($_REQUEST["leg"]); } - + if(!permission_exists(xml_cdr_b_leg)){ + $leg = 'a'; + } //build the sql where string if (strlen($start_epoch) > 0 && strlen($stop_epoch) > 0) { @@ -205,6 +208,7 @@ if (strlen($remote_media_ip) > 0) { $sql_where_ands[] = "remote_media_ip like '%".$remote_media_ip."%'"; } if (strlen($network_addr) > 0) { $sql_where_ands[] = "network_addr like '%".$network_addr."%'"; } if (strlen($mos_comparison) > 0 && strlen($mos_score) > 0 ) { $sql_where_ands[] = "rtp_audio_in_mos " . $mos_comparison . " ".$mos_score.""; } + if (strlen($leg) > 0) { $sql_where_ands[] = "leg='$leg'"; } //if not admin or superadmin, only show own calls if (!permission_exists('xml_cdr_domain')) { @@ -369,6 +373,7 @@ $sql .= "caller_destination, "; $sql .= "source_number, "; $sql .= "destination_number, "; + $sql .= "leg, "; $sql .= "(xml IS NOT NULL OR json IS NOT NULL) AS raw_data_exists, "; if (is_array($_SESSION['cdr']['field'])) { foreach ($_SESSION['cdr']['field'] as $field) { @@ -396,6 +401,7 @@ } else { $sql .= "where domain_uuid = '".$domain_uuid."' "; } + $sql .= $sql_where; if (strlen($order_by)> 0) { $sql .= " order by ".$order_by." ".$order." "; } if ($_REQUEST['export_format'] != "csv" && $_REQUEST['export_format'] != "pdf") { diff --git a/app/xml_cdr/xml_cdr_statistics.php b/app/xml_cdr/xml_cdr_statistics.php index 1c291eac4a..860a8e52e1 100644 --- a/app/xml_cdr/xml_cdr_statistics.php +++ b/app/xml_cdr/xml_cdr_statistics.php @@ -50,7 +50,11 @@ else { echo " \n"; echo " \n"; if (permission_exists('xml_cdr_search_advanced')) { - echo " \n"; + $advenced_search_url = 'xml_cdr_search.php?redirect=xml_cdr_statistics'; + if(permission_exists('xml_cdr_all') && (@$_GET['showall'] === 'true')){ + $advenced_search_url .= '&showall=true'; + } + echo " \n"; } if (permission_exists('xml_cdr_all')) { if ($_GET['showall'] != 'true') { diff --git a/themes/default/images/icon_cdr_inbound_answered_b.png b/themes/default/images/icon_cdr_inbound_answered_b.png new file mode 100644 index 0000000000..78df84406a Binary files /dev/null and b/themes/default/images/icon_cdr_inbound_answered_b.png differ diff --git a/themes/default/images/icon_cdr_inbound_cancelled_b.png b/themes/default/images/icon_cdr_inbound_cancelled_b.png new file mode 100644 index 0000000000..e8d0f2a2dd Binary files /dev/null and b/themes/default/images/icon_cdr_inbound_cancelled_b.png differ diff --git a/themes/default/images/icon_cdr_inbound_failed_b.png b/themes/default/images/icon_cdr_inbound_failed_b.png new file mode 100644 index 0000000000..0ac1828662 Binary files /dev/null and b/themes/default/images/icon_cdr_inbound_failed_b.png differ diff --git a/themes/default/images/icon_cdr_local_answered_b.png b/themes/default/images/icon_cdr_local_answered_b.png new file mode 100644 index 0000000000..e32080abfb Binary files /dev/null and b/themes/default/images/icon_cdr_local_answered_b.png differ diff --git a/themes/default/images/icon_cdr_local_cancelled_b.png b/themes/default/images/icon_cdr_local_cancelled_b.png new file mode 100644 index 0000000000..311a315d69 Binary files /dev/null and b/themes/default/images/icon_cdr_local_cancelled_b.png differ diff --git a/themes/default/images/icon_cdr_local_failed_b.png b/themes/default/images/icon_cdr_local_failed_b.png new file mode 100644 index 0000000000..a42295e3d2 Binary files /dev/null and b/themes/default/images/icon_cdr_local_failed_b.png differ diff --git a/themes/default/images/icon_cdr_outbound_answered_b.png b/themes/default/images/icon_cdr_outbound_answered_b.png new file mode 100644 index 0000000000..c00c666d00 Binary files /dev/null and b/themes/default/images/icon_cdr_outbound_answered_b.png differ diff --git a/themes/default/images/icon_cdr_outbound_cancelled_b.png b/themes/default/images/icon_cdr_outbound_cancelled_b.png new file mode 100644 index 0000000000..976207dc9d Binary files /dev/null and b/themes/default/images/icon_cdr_outbound_cancelled_b.png differ diff --git a/themes/default/images/icon_cdr_outbound_failed_b.png b/themes/default/images/icon_cdr_outbound_failed_b.png new file mode 100644 index 0000000000..b0640c6a86 Binary files /dev/null and b/themes/default/images/icon_cdr_outbound_failed_b.png differ