Portions created by the Initial Developer are Copyright (C) 2008-2012 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane */ include "root.php"; require_once "resources/require.php"; require_once "resources/check_auth.php"; require_once "resources/functions/get_call_activity.php"; if (permission_exists('operator_panel_view')) { //access granted } else { echo "access denied"; exit; } //add multi-lingual support include "app_languages.php"; foreach($text as $key => $value) { $text[$key] = $value[$_SESSION['domain']['language']['code']]; } $activity = get_call_activity(); foreach ($activity as $extension => $fields) { if (substr_count($fields['call_group'], ',')) { $tmp = explode(',', $fields['call_group']); foreach ($tmp as $tmp_index => $tmp_value) { if (trim($tmp_value) == '') { unset($tmp[$tmp_index]); } else { $groups[] = $tmp_value; } } } else if ($fields['call_group'] != '') { $groups[] = $fields['call_group']; } } $groups = array_unique($groups); sort($groups); echo ""; echo " "; echo " "; echo " "; echo "
"; if (sizeof($groups) > 0) { echo $text['label-call_group']." "; echo " \n"; } echo "
"; echo "".$text['title-operator_panel'].""; echo "


"; foreach ($activity as $extension => $ext) { unset($block); //filter by group, if defined if ($_REQUEST['group'] != '' && substr_count($ext['call_group'], $_REQUEST['group']) == 0 && !in_array($extension, $_SESSION['user']['extensions'])) { continue; } //check if feature code being called $format_number = (substr($ext['dest'], 0, 1) == '*') ? false : true; //determine extension state, direction icon, and displayed name/number for caller/callee if ($ext['state'] == 'CS_EXECUTE') { if (($ext['callstate'] == 'RINGING' || $ext['callstate'] == 'EARLY' || $ext['callstate'] == 'RING_WAIT') && $ext['direction'] == 'inbound') { $ext_state = 'ringing'; } else if ($ext['callstate'] == 'ACTIVE' && $ext['direction'] == 'outbound') { $ext_state = 'active'; } else if ($ext['callstate'] == 'RING_WAIT' && $ext['direction'] == 'outbound') { $ext_state = 'ringing'; } else if ($ext['callstate'] == 'ACTIVE' && $ext['direction'] == 'inbound') { $ext_state = 'active'; } if (!$format_number) { $call_name = 'System'; $call_number = $ext['dest']; } else { $call_name = $activity[(int) $ext['dest']]['effective_caller_id_name']; $call_number = format_phone((int) $ext['dest']); } $dir_icon = 'outbound'; } else if ($ext['state'] == 'CS_CONSUME_MEDIA' || $ext['state'] == 'CS_EXCHANGE_MEDIA') { if ($ext['state'] == 'CS_CONSUME_MEDIA' && $ext['callstate'] == 'RINGING' && $ext['direction'] == 'outbound') { $ext_state = 'ringing'; } else if ($ext['state'] == 'CS_EXCHANGE_MEDIA' && $ext['callstate'] == 'ACTIVE' && $ext['direction'] == 'outbound') { $ext_state = 'active'; } $dir_icon = 'inbound'; $call_name = $activity[(int) $ext['cid_num']]['effective_caller_id_name']; $call_number = format_phone((int) $ext['cid_num']); } else { unset($ext_state, $dir_icon, $call_name, $call_number); } //determine block style by state (if any) $style = ($ext_state != '') ? "state_".$ext_state : null; //determine the call identifier passed on drop if ($ext['uuid'] == $ext['call_uuid'] && $ext['variable_bridge_uuid'] == '') { // transfer an outbound internal call $call_identifier = $activity[$call_number]['uuid']; } else if (($ext['variable_call_direction'] == 'outbound' || $ext['variable_call_direction'] == 'local') && $ext['variable_bridge_uuid'] != '') { // transfer an outbound external call $call_identifier = $ext['variable_bridge_uuid']; } else { $call_identifier = $ext['call_uuid']; // transfer all other call types } //determine extension draggable state if (!in_array($extension, $_SESSION['user']['extensions']) && $ext_state != "ringing") { $draggable = false; } else if ($ext['uuid'] != '' && $ext['call_uuid'] == $ext['uuid'] && $ext['variable_bridge_uuid'] == '') { $draggable = false; } else if ($ext_state == 'ringing' && $ext['variable_call_direction'] == 'local') { $draggable = false; } else if ($ext_state != '' && !$format_number) { $draggable = false; } else { $draggable = true; } $block .= "
"; // TO $block .= ""; $block .= " "; $block .= " "; $block .= " "; $block .= " "; $block .= "
"; $block .= " "; // FROM $block .= ""; $block .= ""; $block .= " "; if ($dir_icon != '') { $block .= " "; } $block .= "
"; if ($ext_state != '') { $block .= " "; $block .= "
".$ext['call_length']."
"; $block .= " ".$call_name."
".$call_number; $block .= "
"; } else { if (in_array($extension, $_SESSION['user']['extensions'])) { $block .= " "; $block .= "
"; $block .= " "; $block .= "
"; } } $block .= "
"; if (isset($_GET['debug'])) { $block .= ""; $block .= "From ID
    ".$extension."
"; $block .= "uuid
    ".$ext['uuid']."
"; $block .= "call_uuid
    ".$ext['call_uuid']."
"; $block .= "variable_bridge_uuid
    ".$ext['variable_bridge_uuid']."
"; $block .= "direction
    ".$ext['direction']."
"; $block .= "variable_call_direction
    ".$ext['variable_call_direction']."
"; $block .= "state
    ".$ext['state']."
"; $block .= "cid_num
    ".$ext['cid_num']."
"; $block .= "dest
    ".$ext['dest']."
"; $block .= "context
    ".$ext['context']."
"; $block .= "presence_id
    ".$ext['presence_id']."
"; $block .= "callstate
    ".$ext['callstate']."
"; $block .= "
"; } $block .= "
"; if (in_array($extension, $_SESSION['user']['extensions'])) { $user_extensions[] = $block; } else { $other_extensions[] = $block; } } if (sizeof($user_extensions) > 0) { echo "
"; foreach ($user_extensions as $ext_block) { echo $ext_block; } echo "
"; } if ($_REQUEST['group'] != '') { if (sizeof($user_extensions) > 0) { echo "
"; } echo "".ucwords($_REQUEST['group']).""; echo "

"; } else if (sizeof($user_extensions) > 0) { echo "
"; echo "".$text['label-other_extensions'].""; echo "

"; } if (sizeof($other_extensions) > 0) { echo "
"; foreach ($other_extensions as $ext_block) { echo $ext_block; } echo "
"; } else { echo $text['label-no_extensions_found']; } echo "

"; if (isset($_GET['debug'])) { echo ""; echo "

"; echo '$_SESSION...'; echo ""; } ?>