From f10e56516854d31ed455e61582d0190e14b99246 Mon Sep 17 00:00:00 2001 From: James Rose Date: Tue, 4 Sep 2012 14:53:46 +0000 Subject: [PATCH] change to urlencode --- .../v_call_center_active_inc.php | 648 +++++++++--------- 1 file changed, 323 insertions(+), 325 deletions(-) diff --git a/app/call_center_active/v_call_center_active_inc.php b/app/call_center_active/v_call_center_active_inc.php index dc67e78dc9..940e083f7f 100644 --- a/app/call_center_active/v_call_center_active_inc.php +++ b/app/call_center_active/v_call_center_active_inc.php @@ -1,325 +1,323 @@ - - 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 "includes/require.php"; -require_once "includes/checkauth.php"; -if (permission_exists('call_center_active_view')) { - //access granted -} -else { - echo "access denied"; - exit; -} - -//get the queue_name and set it as a variable - $queue_name = $_GET[queue_name].'@'. $_SESSION['domains'][$domain_uuid]['domain_name']; - -//convert the string to a named array - function str_to_named_array($tmp_str, $tmp_delimiter) { - $tmp_array = explode ("\n", $tmp_str); - $result = ''; - if (trim(strtoupper($tmp_array[0])) != "+OK") { - $tmp_field_name_array = explode ($tmp_delimiter, $tmp_array[0]); - $x = 0; - foreach ($tmp_array as $row) { - if ($x > 0) { - $tmp_field_value_array = explode ($tmp_delimiter, $tmp_array[$x]); - $y = 0; - foreach ($tmp_field_value_array as $tmp_value) { - $tmp_name = $tmp_field_name_array[$y]; - if (trim(strtoupper($tmp_value)) != "+OK") { - $result[$x][$tmp_name] = $tmp_value; - } - $y++; - } - } - $x++; - } - unset($row); - } - return $result; - } - -//alternate the color of the row - $c = 0; - $row_style["0"] = "row_style0"; - $row_style["1"] = "row_style1"; - -//create an event socket connection - $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - -//get the call center queue, agent and tiers list - 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
$msg
\n"; - echo "
\n"; - } - else { - //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_name; - $event_socket_str = trim(event_socket_request($fp, 'api '.$switch_cmd)); - $result = str_to_named_array($event_socket_str, '|'); - - //show the title - echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
".ucfirst($_GET[queue_name])." Queue
\n"; - echo " Shows a list of callers in the queue.
\n"; - echo "
\n"; - echo "
\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - //echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - if (if_group("admin") || if_group("superadmin")) { - echo "\n"; - } - echo "\n"; - echo "\n"; - - $q_waiting=0; - $q_trying=0; - $q_answered=0; - - foreach ($result as $row) { - $switch_cmd = 'uuid_exists '.$row['session_uuid']; - if (trim(event_socket_request($fp, 'api '.$switch_cmd)) == "true") { - $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']; - if ($state=="Trying") {$q_trying = $q_trying + 1;} - if ($state=="Waiting") {$q_waiting = $q_waiting + 1;} - if ($state=="Answered") {$q_answered = $q_answered + 1;} - - $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; - - //$system_seconds = time() - $system_epoch; - //$system_length_hour = floor($system_seconds/3600); - //$system_length_min = floor($system_seconds/60 - ($system_length_hour * 60)); - //$system_length_sec = $system_seconds - (($system_length_hour * 3600) + ($system_length_min * 60)); - //$system_length_min = sprintf("%02d", $system_length_min); - //$system_length_sec = sprintf("%02d", $system_length_sec); - //$system_length = $system_length_hour.':'.$system_length_min.':'.$system_length_sec; - - echo "\n"; - echo "\n"; - //echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - if (if_group("admin") || if_group("superadmin")) { - echo ""; - } - echo "\n"; - echo "\n"; - if ($c==0) { $c=1; } else { $c=0; } - } //end if uuid_exists - } - echo "
TimeSystemNameNumberStatusOptionsAgent
".$joined_length."".$system_length."".$caller_name." ".$caller_number." ".$state.""; - - $orig_command="{origination_caller_id_name=eavesdrop,origination_caller_id_number=".$caller_number."}user/".$_SESSION['user']['extension'][0]['user']."@".$_SESSION['domain_name']." %26eavesdrop(".$session_uuid.")"; - - //url encode any plus signs in caller id - $orig_command = str_replace("+", "%2B", $orig_command); - - //debug - //echo $orig_command; - //echo " log_cmd \n"; - - echo " eavesdrop \n"; - - - echo "".$serving_agent." 
\n"; - - //add vertical spacing - echo "
\n"; - echo "
\n"; - echo "
\n"; - - //get the agent list - - //show the title - echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
Agents
\n"; - echo " List all the agents.
\n"; - echo "
\n"; - echo "
\n"; - - //send the event socket command and get the response - //callcenter_config queue list tiers [queue_name] | - $switch_cmd = 'callcenter_config queue list tiers '.$queue_name; - $event_socket_str = trim(event_socket_request($fp, 'api '.$switch_cmd)); - $result = str_to_named_array($event_socket_str, '|'); - - //prepare the result for array_multisort - $x = 0; - foreach ($result as $row) { - $tier_result[$x]['level'] = $row['level']; - $tier_result[$x]['position'] = $row['position']; - $tier_result[$x]['agent'] = $row['agent']; - $tier_result[$x]['state'] = trim($row['state']); - $tier_result[$x]['queue'] = $row['queue']; - $x++; - } - - //sort the array //SORT_ASC, SORT_DESC, SORT_REGULAR, SORT_NUMERIC, SORT_STRING - array_multisort($tier_result, SORT_ASC); - - //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_name; - $event_socket_str = trim(event_socket_request($fp, 'api '.$switch_cmd)); - $agent_result = str_to_named_array($event_socket_str, '|'); - - //list the agents - 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"; - foreach ($tier_result as $tier_row) { - //$queue = $tier_row['queue']; - //$queue = str_replace('@'.$_SESSION['domain_name'], '', $queue); - $agent = $tier_row['agent']; - //$agent = str_replace('@'.$_SESSION['domain_name'], '', $agent); - $tier_state = $tier_row['state']; - $tier_level = $tier_row['level']; - $tier_position = $tier_row['position']; - - foreach ($agent_result as $agent_row) { - if ($tier_row['agent'] == $agent_row['name']) { - $name = $agent_row['name']; - $name = str_replace('@'.$_SESSION['domain_name'], '', $name); - //$system = $agent_row['system']; - //$uuid = $agent_row['uuid']; - //$type = $agent_row['type']; - $contact = $agent_row['contact']; - $status = $agent_row['status']; - $state = $agent_row['state']; - $max_no_answer = $agent_row['max_no_answer']; - $wrap_up_time = $agent_row['wrap_up_time']; - $reject_delay_time = $agent_row['reject_delay_time']; - $busy_delay_time = $agent_row['busy_delay_time']; - $last_bridge_start = $agent_row['last_bridge_start']; - $last_bridge_end = $agent_row['last_bridge_end']; - //$last_offered_call = $agent_row['last_offered_call']; - $last_status_change = $agent_row['last_status_change']; - $no_answer_count = $agent_row['no_answer_count']; - $calls_answered = $agent_row['calls_answered']; - $talk_time = $agent_row['talk_time']; - $ready_time = $agent_row['ready_time']; - - $last_offered_call_seconds = time() - $last_offered_call; - $last_offered_call_length_hour = floor($last_offered_call_seconds/3600); - $last_offered_call_length_min = floor($last_offered_call_seconds/60 - ($last_offered_call_length_hour * 60)); - $last_offered_call_length_sec = $last_offered_call_seconds - (($last_offered_call_length_hour * 3600) + ($last_offered_call_length_min * 60)); - $last_offered_call_length_min = sprintf("%02d", $last_offered_call_length_min); - $last_offered_call_length_sec = sprintf("%02d", $last_offered_call_length_sec); - $last_offered_call_length = $last_offered_call_length_hour.':'.$last_offered_call_length_min.':'.$last_offered_call_length_sec; - - $last_status_change_seconds = time() - $last_status_change; - $last_status_change_length_hour = floor($last_status_change_seconds/3600); - $last_status_change_length_min = floor($last_status_change_seconds/60 - ($last_status_change_length_hour * 60)); - $last_status_change_length_sec = $last_status_change_seconds - (($last_status_change_length_hour * 3600) + ($last_status_change_length_min * 60)); - $last_status_change_length_min = sprintf("%02d", $last_status_change_length_min); - $last_status_change_length_sec = sprintf("%02d", $last_status_change_length_sec); - $last_status_change_length = $last_status_change_length_hour.':'.$last_status_change_length_min.':'.$last_status_change_length_sec; - - 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 ($c==0) { $c=1; } else { $c=0; } - } - echo "
NameContactStatusStateOffered CallStatus ChangeMissedAnsweredTier StateTier LevelTier Position
".$name."".$contact."".$status."".$state."".$last_offered_call_length."".$last_status_change_length."".$no_answer_count."".$calls_answered."".$tier_state."".$tier_level."".$tier_position."
\n\n"; - echo "
"; - echo "Total Waiting is {$q_waiting}. Total Trying is {$q_trying}. Total Answered is {$q_answered}.\n"; - - //add vertical spacing - echo "
\n"; - echo "
\n"; - echo "
\n"; - } -?> \ No newline at end of file + + 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 "includes/require.php"; +require_once "includes/checkauth.php"; +if (permission_exists('call_center_active_view')) { + //access granted +} +else { + echo "access denied"; + exit; +} + +//get the queue_name and set it as a variable + $queue_name = $_GET[queue_name].'@'. $_SESSION['domains'][$domain_uuid]['domain_name']; + +//convert the string to a named array + function str_to_named_array($tmp_str, $tmp_delimiter) { + $tmp_array = explode ("\n", $tmp_str); + $result = ''; + if (trim(strtoupper($tmp_array[0])) != "+OK") { + $tmp_field_name_array = explode ($tmp_delimiter, $tmp_array[0]); + $x = 0; + foreach ($tmp_array as $row) { + if ($x > 0) { + $tmp_field_value_array = explode ($tmp_delimiter, $tmp_array[$x]); + $y = 0; + foreach ($tmp_field_value_array as $tmp_value) { + $tmp_name = $tmp_field_name_array[$y]; + if (trim(strtoupper($tmp_value)) != "+OK") { + $result[$x][$tmp_name] = $tmp_value; + } + $y++; + } + } + $x++; + } + unset($row); + } + return $result; + } + +//alternate the color of the row + $c = 0; + $row_style["0"] = "row_style0"; + $row_style["1"] = "row_style1"; + +//create an event socket connection + $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); + +//get the call center queue, agent and tiers list + 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
$msg
\n"; + echo "
\n"; + } + else { + //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_name; + $event_socket_str = trim(event_socket_request($fp, 'api '.$switch_cmd)); + $result = str_to_named_array($event_socket_str, '|'); + + //show the title + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
".ucfirst($_GET[queue_name])." Queue
\n"; + echo " Shows a list of callers in the queue.
\n"; + echo "
\n"; + echo "
\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + //echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + if (if_group("admin") || if_group("superadmin")) { + echo "\n"; + } + echo "\n"; + echo "\n"; + + $q_waiting=0; + $q_trying=0; + $q_answered=0; + + foreach ($result as $row) { + $switch_cmd = 'uuid_exists '.$row['session_uuid']; + if (trim(event_socket_request($fp, 'api '.$switch_cmd)) == "true") { + $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']; + if ($state=="Trying") {$q_trying = $q_trying + 1;} + if ($state=="Waiting") {$q_waiting = $q_waiting + 1;} + if ($state=="Answered") {$q_answered = $q_answered + 1;} + + $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; + + //$system_seconds = time() - $system_epoch; + //$system_length_hour = floor($system_seconds/3600); + //$system_length_min = floor($system_seconds/60 - ($system_length_hour * 60)); + //$system_length_sec = $system_seconds - (($system_length_hour * 3600) + ($system_length_min * 60)); + //$system_length_min = sprintf("%02d", $system_length_min); + //$system_length_sec = sprintf("%02d", $system_length_sec); + //$system_length = $system_length_hour.':'.$system_length_min.':'.$system_length_sec; + + echo "\n"; + echo "\n"; + //echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + if (if_group("admin") || if_group("superadmin")) { + echo ""; + } + echo "\n"; + echo "\n"; + if ($c==0) { $c=1; } else { $c=0; } + } //end if uuid_exists + } + echo "
TimeSystemNameNumberStatusOptionsAgent
".$joined_length."".$system_length."".$caller_name." ".$caller_number." ".$state.""; + + $q_caller_number = urlencode($caller_number); + $orig_command="{origination_caller_id_name=eavesdrop,origination_caller_id_number=".$q_caller_number."}user/".$_SESSION['user']['extension'][0]['user']."@".$_SESSION['domain_name']." %26eavesdrop(".$session_uuid.")"; + + //debug + //echo $orig_command; + //echo " log_cmd \n"; + + echo " eavesdrop \n"; + + + echo "".$serving_agent." 
\n"; + + //add vertical spacing + echo "
\n"; + echo "
\n"; + echo "
\n"; + + //get the agent list + + //show the title + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
Agents
\n"; + echo " List all the agents.
\n"; + echo "
\n"; + echo "
\n"; + + //send the event socket command and get the response + //callcenter_config queue list tiers [queue_name] | + $switch_cmd = 'callcenter_config queue list tiers '.$queue_name; + $event_socket_str = trim(event_socket_request($fp, 'api '.$switch_cmd)); + $result = str_to_named_array($event_socket_str, '|'); + + //prepare the result for array_multisort + $x = 0; + foreach ($result as $row) { + $tier_result[$x]['level'] = $row['level']; + $tier_result[$x]['position'] = $row['position']; + $tier_result[$x]['agent'] = $row['agent']; + $tier_result[$x]['state'] = trim($row['state']); + $tier_result[$x]['queue'] = $row['queue']; + $x++; + } + + //sort the array //SORT_ASC, SORT_DESC, SORT_REGULAR, SORT_NUMERIC, SORT_STRING + array_multisort($tier_result, SORT_ASC); + + //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_name; + $event_socket_str = trim(event_socket_request($fp, 'api '.$switch_cmd)); + $agent_result = str_to_named_array($event_socket_str, '|'); + + //list the agents + 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"; + foreach ($tier_result as $tier_row) { + //$queue = $tier_row['queue']; + //$queue = str_replace('@'.$_SESSION['domain_name'], '', $queue); + $agent = $tier_row['agent']; + //$agent = str_replace('@'.$_SESSION['domain_name'], '', $agent); + $tier_state = $tier_row['state']; + $tier_level = $tier_row['level']; + $tier_position = $tier_row['position']; + + foreach ($agent_result as $agent_row) { + if ($tier_row['agent'] == $agent_row['name']) { + $name = $agent_row['name']; + $name = str_replace('@'.$_SESSION['domain_name'], '', $name); + //$system = $agent_row['system']; + //$uuid = $agent_row['uuid']; + //$type = $agent_row['type']; + $contact = $agent_row['contact']; + $status = $agent_row['status']; + $state = $agent_row['state']; + $max_no_answer = $agent_row['max_no_answer']; + $wrap_up_time = $agent_row['wrap_up_time']; + $reject_delay_time = $agent_row['reject_delay_time']; + $busy_delay_time = $agent_row['busy_delay_time']; + $last_bridge_start = $agent_row['last_bridge_start']; + $last_bridge_end = $agent_row['last_bridge_end']; + //$last_offered_call = $agent_row['last_offered_call']; + $last_status_change = $agent_row['last_status_change']; + $no_answer_count = $agent_row['no_answer_count']; + $calls_answered = $agent_row['calls_answered']; + $talk_time = $agent_row['talk_time']; + $ready_time = $agent_row['ready_time']; + + $last_offered_call_seconds = time() - $last_offered_call; + $last_offered_call_length_hour = floor($last_offered_call_seconds/3600); + $last_offered_call_length_min = floor($last_offered_call_seconds/60 - ($last_offered_call_length_hour * 60)); + $last_offered_call_length_sec = $last_offered_call_seconds - (($last_offered_call_length_hour * 3600) + ($last_offered_call_length_min * 60)); + $last_offered_call_length_min = sprintf("%02d", $last_offered_call_length_min); + $last_offered_call_length_sec = sprintf("%02d", $last_offered_call_length_sec); + $last_offered_call_length = $last_offered_call_length_hour.':'.$last_offered_call_length_min.':'.$last_offered_call_length_sec; + + $last_status_change_seconds = time() - $last_status_change; + $last_status_change_length_hour = floor($last_status_change_seconds/3600); + $last_status_change_length_min = floor($last_status_change_seconds/60 - ($last_status_change_length_hour * 60)); + $last_status_change_length_sec = $last_status_change_seconds - (($last_status_change_length_hour * 3600) + ($last_status_change_length_min * 60)); + $last_status_change_length_min = sprintf("%02d", $last_status_change_length_min); + $last_status_change_length_sec = sprintf("%02d", $last_status_change_length_sec); + $last_status_change_length = $last_status_change_length_hour.':'.$last_status_change_length_min.':'.$last_status_change_length_sec; + + 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 ($c==0) { $c=1; } else { $c=0; } + } + echo "
NameContactStatusStateOffered CallStatus ChangeMissedAnsweredTier StateTier LevelTier Position
".$name."".$contact."".$status."".$state."".$last_offered_call_length."".$last_status_change_length."".$no_answer_count."".$calls_answered."".$tier_state."".$tier_level."".$tier_position."
\n\n"; + echo "
"; + echo "Total Waiting is {$q_waiting}. Total Trying is {$q_trying}. Total Answered is {$q_answered}.\n"; + + //add vertical spacing + echo "
\n"; + echo "
\n"; + echo "
\n"; + } +?>