Copyright (C) 2010 - 2019 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('active_queue_view')) { //access granted } else { echo "access denied"; exit; } //add multi-lingual support $language = new text; $text = $language->get(); //set variables $fifo_name = trim($_REQUEST["c"]); $fifo_name = preg_replace('[^a-zA-Z0-9\-_@.\/]', '', $fifo_name); //if not the user is not a member of the superadmin then restrict to viewing their own domain if (!if_group("superadmin")) { if (stripos($fifo_name, $_SESSION['domain_name']) === false) { echo "access denied"; exit; } } //prepare and send the api command over event socket $switch_cmd = 'fifo list_verbose '.$fifo_name.''; $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); if (!$fp) { $msg = "
Connection to Event Socket failed.
"; echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
Message
".escape($msg)."
\n"; echo "
\n"; } else { //send the api command over event socket $xml_str = trim(event_socket_request($fp, 'api '.$switch_cmd)); //parse the response as xml try { $xml = new SimpleXMLElement($xml_str); } catch(Exception $e) { //echo $e->getMessage(); } //set variables from the xml //$name = $xml->conference['name']; //$member_count = $xml->conference['member-count']; //$locked = $xml->conference['locked']; //set the alternating row styles $c = 0; $row_style["0"] = "row_style0"; $row_style["1"] = "row_style1"; //response div tag echo "
\n"; echo "
\n"; //show the content echo "\n"; /* echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; */ echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; if ($xml->fifo->callers->caller && @sizeof($xml->fifo->callers->caller) != 0) { foreach ($xml->fifo->callers->caller as $row) { /* $username = $row->caller_profile->username; $dialplan = $row->caller_profile->dialplan; $caller_id_name = urldecode($row->caller_profile->caller_id_name); $caller_id_number = $row->caller_profile->caller_id_number; $ani = $row->caller_profile->ani; $aniii = $row->caller_profile->aniii; $network_addr = $row->caller_profile->network_addr; $destination_number = $row->destination_number->rdnis; $rdnis = $row->caller_profile->rdnis; $uuid = $row->caller_profile->uuid; $source = $row->caller_profile->source; $context = $row->caller_profile->context; $chan_name = $row->caller_profile->chan_name; $default_language = $row->variables->default_language; $fifo_position = $row->variables->fifo_position; $fifo_priority = $row->variables->fifo_priority; $fifo_status = $row->variables->fifo_status; $fifo_timestamp = urldecode($row->variables->fifo_timestamp); $fifo_time = strtotime($fifo_timestamp); $fifo_duration = time() - $fifo_time; $fifo_duration_formatted = str_pad(intval(intval($fifo_duration/3600)),2,"0",STR_PAD_LEFT).":" . str_pad(intval(($fifo_duration / 60) % 60),2,"0",STR_PAD_LEFT).":" . str_pad(intval($fifo_duration % 60),2,"0",STR_PAD_LEFT) ; */ $username = $row->cdr->callflow->caller_profile->username; $dialplan = $row->cdr->callflow->caller_profile->dialplan; $caller_id_name = urldecode($row->cdr->callflow->caller_profile->caller_id_name); $caller_id_number = $row->cdr->callflow->caller_profile->caller_id_number; $ani = $row->cdr->callflow->caller_profile->ani; $aniii = $row->cdr->callflow->caller_profile->aniii; $network_addr = $row->cdr->callflow->caller_profile->network_addr; $destination_number = $row->cdr->callflow->caller_profile->destination_number; $rdnis = $row->cdr->callflow->caller_profile->rdnis; $uuid = $row->cdr->callflow->caller_profile->uuid; $source = $row->cdr->callflow->caller_profile->source; $context = $row->cdr->callflow->caller_profile->context; $chan_name = $row->cdr->callflow->caller_profile->chan_name; $default_language = $row->cdr->variables->default_language; $fifo_position = $row->cdr->variables->fifo_position; $fifo_priority = $row->cdr->variables->fifo_priority; $fifo_status = $row->cdr->variables->fifo_status; $fifo_timestamp = urldecode($row->cdr->variables->fifo_timestamp); $fifo_time = strtotime($fifo_timestamp); $fifo_duration = time() - $fifo_time; $fifo_duration_formatted = str_pad(intval(intval($fifo_duration/3600)),2,"0",STR_PAD_LEFT).":" . str_pad(intval(($fifo_duration / 60) % 60),2,"0",STR_PAD_LEFT).":" . str_pad(intval($fifo_duration % 60),2,"0",STR_PAD_LEFT) ; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; $c = $c ? 0 : 1; } } echo "
\n"; //echo " Count: $member_count\n"; echo "\n"; echo "  \n"; echo "\n"; echo " Queues Tools: \n"; echo " Start Record \n"; echo " Stop Record \n"; if ($locked == "true") { echo " Unlock \n"; } else { echo " Lock \n"; } echo "
".$text['label-username']."".$text['label-caller_id_name']."".$text['label-caller_id_number']."".$text['label-language']."".$text['label-destination_number']."".$text['label-position']."".$text['label-priority']."".$text['label-status']."".$text['label-duration']."
".escape($username)."  ".escape($caller_id_name)."  ".escape($caller_id_number)."  ".escape($default_language)."  ".escape($destination_number)."  ".escape($fifo_position)."  ".escape($fifo_priority)."  ".escape($fifo_status)."  ".escape($fifo_duration_formatted)."  
\n"; //Current logged members //set the alternating row styles $c = 0; $row_style["0"] = "row_style0"; $row_style["1"] = "row_style1"; //response div tag echo "
\n"; echo "
\n"; echo "

Logged in agents

\n"; //show the content echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; //print_r($xml->fifo->outbound->member[0]); //print_r($xml->fifo->outbound->member[1]); if ($xml->fifo->outbound->member && @sizeof($xml->fifo->outbound->member) != 0) { foreach ($xml->fifo->outbound->member as $row) { $username=explode("@",$row); $username=explode("/",$username[0]); $username=$username[1]; $fifo_duration_formatted=$row["logged-on-since"]; $fifo_total_inbound_calls=$row["outbound-call-total-count"]; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; $c = $c ? 0 : 1; } } echo "
".$text['label-username']."Total inbound callsLogged on since
".escape($username)."  ".escape($fifo_total_inbound_calls)."  ".escape($fifo_duration_formatted)."  
\n"; } ?>