Portions created by the Initial Developer are Copyright (C) 2008-2016 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane */ //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; $text = $language->get(); //get the HTTP values and set as variables $show = trim($_REQUEST["show"]); if ($show != "all") { $show = ''; } //include theme config for button images include_once("themes/".$_SESSION['domain']['template']['name']."/config.php"); //set the command $switch_cmd = 'show channels as json'; //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"); } //build a new array with domain_name $rows = array(); if (isset($results["rows"])) { foreach ($results["rows"] as &$row) { //get the domain if (strlen($row['context']) > 0 and $row['context'] != "public") { if (substr_count($row['context'], '@') > 0) { $context_array = explode('@', $row['context']); $row['domain_name'] = $context_array[1]; } else { $row['domain_name'] = $row['context']; } } else if (substr_count($row['presence_id'], '@') > 0) { $presence_id_array = explode('@', $row['presence_id']); $row['domain_name'] = $presence_id_array[1].' '.__line__.' '.$row['presence_id']; } //add the row to the array if (($show == 'all' && permission_exists('call_active_all'))) { $rows[] = $row; } else { if ($row['domain_name'] == $_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']."
"; echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
".$text['label-message']."
$msg
\n"; echo "
\n"; } else { //define js function call var $onhover_pause_refresh = " onmouseover='refresh_stop();' onmouseout='refresh_start();'"; //show content echo ""; echo " "; echo " "; echo " "; echo " "; echo "
"; echo " \"".$text['label-refresh_pause']."\""; echo " "; if (permission_exists('call_active_all')) { if ($show == "all") { echo " \n"; } else { echo " \n"; } } echo "
"; echo "".$text['title']." (" . count($rows) . ")".""; echo "

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

\n"; //show the results echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; if ($show == 'all') { echo "\n"; } echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; foreach ($rows as &$row) { //set the php variables foreach ($row as $key => $value) { $$key = $value; } if (if_group("superadmin") && isset($_REQUEST['debug'])) { echo ""; } //get the sip profile $name_array = explode("/", $name); $sip_profile = $name_array[1]; $sip_uri = $name_array[2]; //get the number $temp_array = explode("@", $sip_uri); $tmp_number = $temp_array[0]; $tmp_number = str_replace("sip:", "", $tmp_number); //remove the '+' because it breaks the call recording $cid_num = str_replace("+", "", $cid_num); //replace gateway uuid with name if (sizeof($_SESSION['gateways']) > 0) { foreach ($_SESSION['gateways'] as $gateway_uuid => $gateway_name) { $application_data = str_replace($gateway_uuid, $gateway_name, $application_data); } } // reduce too long app data if(strlen($application_data) > 512) { $application_data = substr($application_data, 0, 512) . ' ...'; } //send the html echo "\n"; echo "\n"; echo "\n"; if ($show == 'all') { echo "\n"; } echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; //alternate the row style $c = ($c) ? 0 : 1; } echo "\n"; echo "\n"; echo "
".$text['label-profile']."".$text['label-created']."".$text['label-domain']."".$text['label-number']."".$text['label-cid-name']."".$text['label-cid-number']."".$text['label-destination']."".$text['label-app']."".$text['label-codec']."".$text['label-secure']."
".print_r($row, true)."
".$sip_profile." ".$created." ".$domain_name." ".$tmp_number." ".$cid_name." ".$cid_num." ".$dest." ".((strlen($application) > 0) ? $application.":".$application_data : null)." ".$read_codec.":".$read_rate." / ".$write_codec.":".$write_rate." ".$secure." ".$v_link_label_delete."
\n"; } ?>