diff --git a/app/call_center_active/call_center_active_inc.php b/app/call_center_active/call_center_active_inc.php index 8d2bd776f2..7324ee65f4 100644 --- a/app/call_center_active/call_center_active_inc.php +++ b/app/call_center_active/call_center_active_inc.php @@ -121,8 +121,8 @@ //send the event socket command and get the response //callcenter_config queue list tiers [queue_name] | - $switch_cmd = 'callcenter_config queue list tiers '.$queue_uuid; - $event_socket_str = trim(event_socket_request($fp, 'api '.$switch_cmd)); + $switch_command = 'callcenter_config queue list tiers '.$queue_uuid; + $event_socket_str = trim(event_socket_request($fp, 'api '.$switch_command)); $result = str_to_named_array($event_socket_str, '|'); //prepare the result for array_multisort @@ -143,8 +143,8 @@ //send the event socket command and get the response //callcenter_config queue list agents [queue_name] [status] | - $switch_cmd = 'callcenter_config queue list agents '.$queue_uuid; - $event_socket_str = trim(event_socket_request($fp, 'api '.$switch_cmd)); + $switch_command = 'callcenter_config queue list agents '.$queue_uuid; + $event_socket_str = trim(event_socket_request($fp, 'api '.$switch_command)); $agent_result = str_to_named_array($event_socket_str, '|'); //get the agents from the database @@ -252,19 +252,14 @@ //need to check state to so only waiting gets call, and trying/answer gets eavesdrop if ($tier_state == "Offering" || $tier_state == "Active Inbound") { $orig_command="{origination_caller_id_name=eavesdrop,origination_caller_id_number=".escape($agent_extension)."}user/".$_SESSION['user']['extension'][0]['user']."@".$_SESSION['domain_name']." %26eavesdrop(".escape($agent_uuid).")"; - - //debug - //echo $orig_command; - //echo " log_cmd \n"; - echo " ".$text['label-eavesdrop']." \n"; + echo " ".$text['label-eavesdrop']." \n"; $xfer_command = escape($agent_uuid)." -bleg ".escape($_SESSION['user']['extension'][0]['user'])." XML ".escape($_SESSION['domain_name']); - //$xfer_command = $agent_uuid." ".$_SESSION['user']['extension'][0]['user']." XML default"; - echo " ".$text['label-transfer']." \n"; + echo " ".$text['label-transfer']." \n"; } else { $orig_call="{origination_caller_id_name=c2c-".urlencode(escape($name)).",origination_caller_id_number=".escape($agent_extension)."}user/".$_SESSION['user']['extension'][0]['user']."@".$_SESSION['domain_name']." %26bridge(user/".escape($agent_extension)."@".$_SESSION['domain_name'].")"; - echo " ".$text['label-call']." \n"; + echo " ".$text['label-call']." \n"; } echo ""; } @@ -285,10 +280,12 @@ //get the queue list //send the event socket command and get the response //callcenter_config queue list members [queue_name] - $switch_cmd = 'callcenter_config queue list members '.$queue_uuid; - $event_socket_str = trim(event_socket_request($fp, 'api '.$switch_cmd)); - $result = str_to_named_array($event_socket_str, '|'); - if (!is_array($result)) { unset($result); } + if (is_uuid($queue_uuid)) { + $switch_command = 'callcenter_config queue list members '.$queue_uuid; + $event_socket_str = trim(event_socket_request($fp, 'api '.$switch_command)); + $result = str_to_named_array($event_socket_str, '|'); + if (!is_array($result)) { unset($result); } + } //show the title $q_waiting=0; @@ -301,11 +298,13 @@ echo " ".$text['description-queue']."
\n"; echo " \n"; echo " "; - if (isset($result)) foreach ($result as $row) { - $state = $row['state']; - $q_trying += ($state == "Trying") ? 1 : 0; - $q_waiting += ($state == "Waiting") ? 1 : 0; - $q_answered += ($state == "Answered") ? 1 : 0; + if (isset($result)) { + foreach ($result as $row) { + $state = $row['state']; + $q_trying += ($state == "Trying") ? 1 : 0; + $q_waiting += ($state == "Waiting") ? 1 : 0; + $q_answered += ($state == "Answered") ? 1 : 0; + } } echo " ".$text['label-waiting'].": ".$q_waiting."   "; echo " ".$text['label-trying'].": ".$q_trying."    "; @@ -328,65 +327,61 @@ echo "".$text['label-agent']."\n"; echo "\n"; - if (isset($result)) foreach ($result as $row) { - $queue = $row['queue']; - $system = $row['system']; - $uuid = $row['uuid']; - $session_uuid = $row['session_uuid']; - $caller_number = $row['cid_number']; - $caller_name = $row['cid_name']; - $system_epoch = $row['system_epoch']; - $joined_epoch = $row['joined_epoch']; - $rejoined_epoch = $row['rejoined_epoch']; - $bridge_epoch = $row['bridge_epoch']; - $abandoned_epoch = $row['abandoned_epoch']; - $base_score = $row['base_score']; - $skill_score = $row['skill_score']; - $serving_agent = $row['serving_agent']; - $serving_system = $row['serving_system']; - $state = $row['state']; - $joined_seconds = time() - $joined_epoch; - $joined_length_hour = floor($joined_seconds/3600); - $joined_length_min = floor($joined_seconds/60 - ($joined_length_hour * 60)); - $joined_length_sec = $joined_seconds - (($joined_length_hour * 3600) + ($joined_length_min * 60)); - $joined_length_min = sprintf("%02d", $joined_length_min); - $joined_length_sec = sprintf("%02d", $joined_length_sec); - $joined_length = $joined_length_hour.':'.$joined_length_min.':'.$joined_length_sec; + if (is_array($result)) { + foreach ($result as $row) { + $queue = $row['queue']; + $system = $row['system']; + $uuid = $row['uuid']; + $session_uuid = $row['session_uuid']; + $caller_number = $row['cid_number']; + $caller_name = $row['cid_name']; + $system_epoch = $row['system_epoch']; + $joined_epoch = $row['joined_epoch']; + $rejoined_epoch = $row['rejoined_epoch']; + $bridge_epoch = $row['bridge_epoch']; + $abandoned_epoch = $row['abandoned_epoch']; + $base_score = $row['base_score']; + $skill_score = $row['skill_score']; + $serving_agent = $row['serving_agent']; + $serving_system = $row['serving_system']; + $state = $row['state']; + $joined_seconds = time() - $joined_epoch; + $joined_length_hour = floor($joined_seconds/3600); + $joined_length_min = floor($joined_seconds/60 - ($joined_length_hour * 60)); + $joined_length_sec = $joined_seconds - (($joined_length_hour * 3600) + ($joined_length_min * 60)); + $joined_length_min = sprintf("%02d", $joined_length_min); + $joined_length_sec = sprintf("%02d", $joined_length_sec); + $joined_length = $joined_length_hour.':'.$joined_length_min.':'.$joined_length_sec; - //get the serving agent name - $serving_agent_name = ''; - if (is_array($_SESSION['agents'])) foreach ($_SESSION['agents'] as $agent) { - if ($agent['call_center_agent_uuid'] == $serving_agent) { - $serving_agent_name = $agent['agent_name']; + //get the serving agent name + $serving_agent_name = ''; + if (is_array($_SESSION['agents'])) foreach ($_SESSION['agents'] as $agent) { + if ($agent['call_center_agent_uuid'] == $serving_agent) { + $serving_agent_name = $agent['agent_name']; + } } + + echo "\n"; + echo "".escape($joined_length)."\n"; + //echo "".escape($system_length)."\n"; + echo "".escape($caller_name)." \n"; + echo "".escape($caller_number)." \n"; + echo "".escape($state)."\n"; + if (if_group("admin") || if_group("superadmin")) { + echo ""; + if ($state != "Abandoned") { + $orig_command="{origination_caller_id_name=eavesdrop,origination_caller_id_number=".escape($q_caller_number)."}user/".escape($_SESSION['user']['extension'][0]['user'])."@".escape($_SESSION['domain_name'])." %26eavesdrop(".escape($session_uuid).")"; + echo " ".$text['label-eavesdrop']." \n"; + } + else { + echo " "; + } + echo ""; + } + echo "".escape($serving_agent_name)." \n"; + echo "\n"; + if ($c==0) { $c=1; } else { $c=0; } } - - echo "\n"; - echo "".escape($joined_length)."\n"; - //echo "".escape($system_length)."\n"; - echo "".escape($caller_name)." \n"; - echo "".escape($caller_number)." \n"; - echo "".escape($state)."\n"; - if (if_group("admin") || if_group("superadmin")) { - echo ""; - if ($state != "Abandoned") { - $q_caller_number = urlencode($caller_number); - $orig_command="{origination_caller_id_name=eavesdrop,origination_caller_id_number=".escape($q_caller_number)."}user/".escape($_SESSION['user']['extension'][0]['user'])."@".escape($_SESSION['domain_name'])." %26eavesdrop(".escape($session_uuid).")"; - - //debug - //echo $orig_command; - //echo " log_cmd \n"; - - echo " ".$text['label-eavesdrop']." \n"; - } - else { - echo " "; - } - echo ""; - } - echo "".escape($serving_agent_name)." \n"; - echo "\n"; - if ($c==0) { $c=1; } else { $c=0; } } echo "\n";