From c08313fbafecf6c38e51db3b4256cb4e3d357dca Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 28 Sep 2019 19:30:07 -0600 Subject: [PATCH] CDR: TTA min/max search support. --- app/xml_cdr/xml_cdr_inc.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/xml_cdr/xml_cdr_inc.php b/app/xml_cdr/xml_cdr_inc.php index 6ba17f1777..5315bf5bdb 100644 --- a/app/xml_cdr/xml_cdr_inc.php +++ b/app/xml_cdr/xml_cdr_inc.php @@ -76,6 +76,8 @@ $remote_media_ip = $_REQUEST["remote_media_ip"]; $network_addr = $_REQUEST["network_addr"]; $bridge_uuid = $_REQUEST["network_addr"]; + $tta_min = $_REQUEST['tta_min']; + $tta_max = $_REQUEST['tta_max']; $order_by = $_REQUEST["order_by"]; $order = $_REQUEST["order"]; if (is_array($_SESSION['cdr']['field'])) { @@ -166,6 +168,8 @@ $param .= "&bridge_uuid=".urlencode($bridge_uuid); $param .= "&mos_comparison=".urlencode($mos_comparison); $param .= "&mos_score=".urlencode($mos_score); + $param .= "&tta_min=".urlencode($tta_min); + $param .= "&tta_max=".urlencode($tta_max); if (is_array($_SESSION['cdr']['field'])) { foreach ($_SESSION['cdr']['field'] as $field) { $array = explode(",", $field); @@ -182,6 +186,7 @@ $param .= "&order_by=".urlencode($order_by)."&order=".urlencode($order); } + //create the sql query to get the xml cdr records if (strlen($order_by) == 0) { $order_by = "start_stamp"; } if (strlen($order) == 0) { $order = "desc"; } @@ -485,6 +490,14 @@ $sql .= "and leg = :leg "; $parameters['leg'] = $leg; } + if (is_numeric($tta_min)) { + $sql .= "and (c.answer_epoch - c.start_epoch) >= :tta_min "; + $parameters['tta_min'] = $tta_min; + } + if (is_numeric($tta_max)) { + $sql .= "and (c.answer_epoch - c.start_epoch) <= :tta_max "; + $parameters['tta_max'] = $tta_max; + } //end where if (strlen($order_by) > 0) { $sql .= order_by($order_by, $order);