From 2f4e605cc4147715ff252885b8965a0691161538 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Wed, 7 Jun 2017 12:10:46 -0600 Subject: [PATCH] Update calls_active_inc.php --- app/calls_active/calls_active_inc.php | 168 +++++++++++++------------- 1 file changed, 82 insertions(+), 86 deletions(-) diff --git a/app/calls_active/calls_active_inc.php b/app/calls_active/calls_active_inc.php index 74d8b05995..900ab1a7ca 100644 --- a/app/calls_active/calls_active_inc.php +++ b/app/calls_active/calls_active_inc.php @@ -23,16 +23,20 @@ Contributor(s): Mark J Crane */ -include "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (permission_exists('call_active_view')) { - //access granted -} -else { - echo "access denied"; - exit; -} + +//includes + include "root.php"; + require_once "resources/require.php"; + require_once "resources/check_auth.php"; + +//check permissions + if (permission_exists('call_active_view')) { + //access granted + } + else { + echo "access denied"; + exit; + } //add multi-lingual support $language = new text; @@ -51,6 +55,54 @@ else { //create the event socket connection $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); +//send the event socket command and get the array + if ($fp) { + $json = trim(event_socket_request($fp, 'api '.$switch_cmd)); + $results = json_decode($json, "true"); + } + +//set the domain_name + $domain_name = $_SESSION['domain_name']; + $domain_name = 'demo@www.fusionpbx.com'; + +//build a new array with domain_name + $rows = array(); + if (isset($results["rows"])) { + foreach ($results["rows"] as &$row) { + //get the domain + if (substr_count($row['presence_id'], '@') > 0) { + $presence_id_array = explode('@', $row['presence_id']); + $domain_name = $presence_id_array[1]; + } + else if ($context != '') { + if (substr_count($context, '@') > 0) { + $context_array = explode('@', $context); + $domain_name = $context_array[1]; + } + else { + $domain_name = $row['context']; + } + } + //set the domain_name + $row['domain_name'] = $domain_name; + //add the row to the array + if (($show == 'all' && permission_exists('call_active_all'))) { + $rows[] = $row; + } + else { + if ($row['context'] == $_SESSION['domain_name']) { + $rows[] = $row; + } + } + } + unset($results); + } + +//set the alternating color for each row + $c = 0; + $row_style["0"] = "row_style0"; + $row_style["1"] = "row_style1"; + //if the connnection is available then run it and return the results if (!$fp) { $msg = "
".$text['confirm-socket']."
"; @@ -66,11 +118,6 @@ else { echo "\n"; } else { - //send the event socket command - $json = trim(event_socket_request($fp, 'api '.$switch_cmd)); - //set the array - $results = json_decode($json, "true"); - //define js function call var $onhover_pause_refresh = " onmouseover='refresh_stop();' onmouseout='refresh_start();'"; @@ -93,30 +140,11 @@ else { echo " "; echo ""; - $rows = array(); - if (isset($results["rows"])) foreach ($results["rows"] as &$row) { - //determine show all - if (!($show == 'all' && permission_exists('call_active_all'))) { - $foreign_call = true; - foreach ($row as $key => $value) { - if (substr_count($value, $_SESSION['domain_name']) > 0) { $foreign_call = false; } - } - if ($foreign_call) { continue; } - } - // append call - $rows[] = $row; - } - echo "".$text['title']." (" . count($rows) . ")".""; echo "

\n"; echo $text['description']."\n"; echo "

\n"; - //set the alternating color for each row - $c = 0; - $row_style["0"] = "row_style0"; - $row_style["1"] = "row_style1"; - //show the results echo "
\n"; @@ -156,23 +184,6 @@ else { $tmp_number = $temp_array[0]; $tmp_number = str_replace("sip:", "", $tmp_number); - //get the domain - if ($show == 'all') { - if (substr_count($presence_id, '@') > 0) { - $presence_id_array = explode('@', $presence_id); - $domain_name = $presence_id_array[1]; - } - else if ($context != '') { - if (substr_count($context, '@') > 0) { - $context_array = explode('@', $context); - $domain_name = $context_array[1]; - } - else { - $domain_name = $context; - } - } - } - //remove the '+' because it breaks the call recording $cid_num = str_replace("+", "", $cid_num); @@ -188,44 +199,29 @@ else { $application_data = substr($application_data, 0, 512) . ' ...'; } - echo "\n"; - echo "".$sip_profile." \n"; - echo "".$created." \n"; - if ($show == 'all') { - echo "".$domain_name." \n"; - } - echo "".$tmp_number." \n"; - echo "".$cid_name." \n"; - echo "".$cid_num." \n"; - echo "".$dest." \n"; - echo "".((strlen($application) > 0) ? $application.":".$application_data : null)." \n"; - echo "".$read_codec.":".$read_rate." / ".$write_codec.":".$write_rate." \n"; - echo "".$secure." \n"; - echo "".$v_link_label_delete."\n"; - echo "\n"; - $c = ($c) ? 0 : 1; + //send the html + echo "\n"; + echo "".$sip_profile." \n"; + echo "".$created." \n"; + if ($show == 'all') { + echo "".$domain_name." \n"; + } + echo "".$tmp_number." \n"; + echo "".$cid_name." \n"; + echo "".$cid_num." \n"; + echo "".$dest." \n"; + echo "".((strlen($application) > 0) ? $application.":".$application_data : null)." \n"; + echo "".$read_codec.":".$read_rate." / ".$write_codec.":".$write_rate." \n"; + echo "".$secure." \n"; + echo "".$v_link_label_delete."\n"; + echo "\n"; + + //alternate the row style + $c = ($c) ? 0 : 1; } echo "\n"; echo "\n"; echo "\n"; } -/* -// deprecated features for this page - - //park - echo " ".$text['label-park']." \n"; - //record start/stop - $tmp_dir = $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/archive/".date("Y")."/".date("M")."/".date("d"); - event_socket_mkdir($tmp_dir); - $tmp_file = $tmp_dir."/".$uuid.".wav"; - if (file_exists($tmp_file)) { - //stop - echo " ".$text['label-stop']." \n"; - } - else { - //start - echo " ".$text['label-start']." \n"; - } -*/ -?> \ No newline at end of file +?>