Multilinguified Call Center and Active Call Center.

This commit is contained in:
Nate Jones
2013-05-29 21:14:36 +00:00
parent ef55146763
commit 50e969fb85
13 changed files with 447 additions and 337 deletions

View File

@@ -34,11 +34,19 @@ else {
exit;
}
//add multi-lingual support
require_once "app_languages.php";
foreach($text as $key => $value) {
$text[$key] = $value[$_SESSION['domain']['language']['code']];
}
//get the queue_name and set it as a variable
$queue_name = $_GET[queue_name];
//get the header
require_once "includes/header.php";
$page["title"] = $text['title-call_center_queue_activity'];
?><script type="text/javascript">
function loadXmlHttp(url, id) {
var f = this;

View File

@@ -35,6 +35,12 @@ else {
exit;
}
//add multi-lingual support
require_once "app_languages.php";
foreach($text as $key => $value) {
$text[$key] = $value[$_SESSION['domain']['language']['code']];
}
//get the queue_name and set it as a variable
$queue_name = $_GET[queue_name].'@'. $_SESSION['domains'][$domain_uuid]['domain_name'];
@@ -74,7 +80,7 @@ else {
//get the call center queue, agent and tiers list
if (!$fp) {
$msg = "<div align='center'>Connection to Event Socket failed.<br /></div>";
$msg = "<div align='center'>Connection to Event Socket failed.<br /></div>";
echo "<div align='center'>\n";
echo "<table width='40%'>\n";
echo "<tr>\n";
@@ -87,21 +93,21 @@ else {
echo "</div>\n";
}
else {
//get the agent list
//show the title
echo "<table width=\"100%\" border=\"0\" cellpadding=\"6\" cellspacing=\"0\">\n";
echo " <tr>\n";
echo " <td align='left'><b>Agents</b><br />\n";
echo " List all the agents.<br />\n";
echo " <td align='left'><b>".$text['header-agents']."</b><br />\n";
echo " ".$text['description-agents']."<br />\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<br />\n";
//send the event socket command and get the response
//callcenter_config queue list tiers [queue_name] |
//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, '|');
@@ -121,7 +127,7 @@ else {
array_multisort($tier_result, SORT_ASC);
//send the event socket command and get the response
//callcenter_config queue list agents [queue_name] [status] |
//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, '|');
@@ -129,18 +135,17 @@ else {
//list the agents
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th>Name</th>\n";
echo "<th>Extension</th>\n";
echo "<th>Status</th>\n";
echo "<th>State</th>\n";
//echo "<th>Offered Call</th>\n";
echo "<th>Status Change</th>\n";
echo "<th>Missed</th>\n";
echo "<th>Answered</th>\n";
echo "<th>Tier State</th>\n";
echo "<th>Tier Level</th>\n";
echo "<th>Tier Position</th>\n";
echo "<th>Options</th>\n";
echo "<th>".$text['label-name']."</th>\n";
echo "<th>".$text['label-extension']."</th>\n";
echo "<th>".$text['label-status']."</th>\n";
echo "<th>".$text['label-state']."</th>\n";
echo "<th>".$text['label-status_change']."</th>\n";
echo "<th>".$text['label-missed']."</th>\n";
echo "<th>".$text['label-answered']."</th>\n";
echo "<th>".$text['label-tier_state']."</th>\n";
echo "<th>".$text['label-tier_level']."</th>\n";
echo "<th>".$text['label-tier_position']."</th>\n";
echo "<th>".$text['label-options']."</th>\n";
echo "</tr>\n";
foreach ($tier_result as $tier_row) {
//$queue = $tier_row['queue'];
@@ -198,7 +203,6 @@ else {
echo "<td valign='top' class='".$row_style[$c]."'>".$a_exten."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$status."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$state."</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>".$last_offered_call_length."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$last_status_change_length."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$no_answer_count."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$calls_answered."</td>\n";
@@ -213,21 +217,20 @@ else {
//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=".$a_exten."}user/".$_SESSION['user']['extension'][0]['user']."@".$_SESSION['domain_name']." %26eavesdrop(".$a_uuid.")";
//debug
//echo $orig_command;
//echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"confirm_response = confirm('Do you really want to do this?');if (confirm_response){send_cmd('call_center_exec.php?cmd=log+".$orig_command.")');}\">log_cmd</a>&nbsp;\n";
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"confirm_response = confirm('Do you really want to do this?');if (confirm_response){send_cmd('call_center_exec.php?cmd=originate+".$orig_command.")');}\">eavesdrop</a>&nbsp;\n";
//echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"confirm_response = confirm('".$text['message-confirm']."');if (confirm_response){send_cmd('call_center_exec.php?cmd=log+".$orig_command.")');}\">log_cmd</a>&nbsp;\n";
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"confirm_response = confirm('".$text['message-confirm']."');if (confirm_response){send_cmd('call_center_exec.php?cmd=originate+".$orig_command.")');}\">".$text['label-eavesdrop']."</a>&nbsp;\n";
$xfer_command = $a_uuid." -bleg ".$_SESSION['user']['extension'][0]['user']." XML ".$_SESSION['domain_name'];
//$xfer_command = $a_uuid." ".$_SESSION['user']['extension'][0]['user']." XML default";
$xfer_command = urlencode($xfer_command);
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"confirm_response = confirm('Do you really want to do this?');if (confirm_response){send_cmd('call_center_exec.php?cmd=uuid_transfer+".$xfer_command."');}\">transfer</a>&nbsp;\n";
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"confirm_response = confirm('".$text['message-confirm']."');if (confirm_response){send_cmd('call_center_exec.php?cmd=uuid_transfer+".$xfer_command."');}\">".$text['label-transfer']."</a>&nbsp;\n";
}
else {
$orig_call="{origination_caller_id_name=c2c-".urlencode($name).",origination_caller_id_number=".$a_exten."}user/".$_SESSION['user']['extension'][0]['user']."@".$_SESSION['domain_name']." %26bridge(user/".$a_exten."@".$_SESSION['domain_name'].")";
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"confirm_response = confirm('Do you really want to do this?');if (confirm_response){send_cmd('call_center_exec.php?cmd=originate+".$orig_call.")');}\">Click to Call</a>&nbsp;\n";
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"confirm_response = confirm('".$text['message-confirm']."');if (confirm_response){send_cmd('call_center_exec.php?cmd=originate+".$orig_call.")');}\">".$text['label-call']."</a>&nbsp;\n";
}
echo "</td>";
}
@@ -245,7 +248,7 @@ else {
echo "<br />\n";
echo "<br />\n";
//get the queue list
//send the event socket command and get the response
//callcenter_config queue list members [queue_name]
@@ -256,8 +259,8 @@ else {
//show the title
echo "<table width=\"100%\" border=\"0\" cellpadding=\"6\" cellspacing=\"0\">\n";
echo " <tr>\n";
echo " <td align='left'><b>".ucfirst($_GET[queue_name])." Queue</b><br />\n";
echo " Shows a list of callers in the queue.<br />\n";
echo " <td align='left'><b>".$text['label-queue'].": ".ucfirst($_GET[queue_name])."</b><br />\n";
echo " ".$text['description-queue']."<br />\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
@@ -265,15 +268,15 @@ else {
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th>Time</th>\n";
//echo "<th>System</th>\n";
echo "<th>Name</th>\n";
echo "<th>Number</th>\n";
echo "<th>Status</th>\n";
echo "<th>".$text['label-time']."</th>\n";
//echo "<th>".$text['label-system']."</th>\n";
echo "<th>".$text['label-name']."</th>\n";
echo "<th>".$text['label-number']."</th>\n";
echo "<th>".$text['label-status']."</th>\n";
if (if_group("admin") || if_group("superadmin")) {
echo "<th>Options</th>\n";
echo "<th>".$text['label-options']."</th>\n";
}
echo "<th>Agent</th>\n";
echo "<th>".$text['label-agent']."</th>\n";
echo "</tr>\n";
$q_waiting=0;
@@ -302,7 +305,7 @@ else {
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));
@@ -310,7 +313,7 @@ else {
$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));
@@ -318,7 +321,7 @@ else {
//$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 "<tr>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$joined_length."</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>".$system_length."</td>\n";
@@ -329,13 +332,13 @@ else {
echo "<td valign='top' class='".$row_style[$c]."'>";
$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.")";
$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 " <a href='javascript:void(0);' style='color: #444444;' onclick=\"confirm_response = confirm('Do you really want to do this?');if (confirm_response){send_cmd('call_center_exec.php?cmd=log+".$orig_command.")');}\">log_cmd</a>&nbsp;\n";
//echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"confirm_response = confirm('".$text['message-confirm']."');if (confirm_response){send_cmd('call_center_exec.php?cmd=log+".$orig_command.")');}\">log_cmd</a>&nbsp;\n";
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"confirm_response = confirm('Do you really want to do this?');if (confirm_response){send_cmd('call_center_exec.php?cmd=originate+".$orig_command.")');}\">eavesdrop</a>&nbsp;\n";
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"confirm_response = confirm('".$text['message-confirm']."');if (confirm_response){send_cmd('call_center_exec.php?cmd=originate+".$orig_command.")');}\">".$text['label-eavesdrop']."</a>&nbsp;\n";
echo "</td>";
@@ -347,7 +350,7 @@ else {
}
echo "</table>\n";
echo "</br>";
echo "<b>Total Waiting is {$q_waiting}. Total Trying is {$q_trying}. Total Answered is {$q_answered}.\n</b>";
echo "<b>".$text['label-total_waiting'].": {$q_waiting}<br>".$text['label-total_trying'].": {$q_trying}<br>".$text['label-total_answered'].": {$q_answered}\n</b>";
//add vertical spacing
echo "<br />\n";

View File

@@ -33,7 +33,16 @@ else {
echo "access denied";
exit;
}
//add multi-lingual support
require_once "app_languages.php";
foreach($text as $key => $value) {
$text[$key] = $value[$_SESSION['domain']['language']['code']];
}
require_once "includes/header.php";
$page["title"] = $text['title-active_call_center'];
require_once "includes/paging.php";
$order_by = $_GET["order_by"];
@@ -48,13 +57,13 @@ $order = $_GET["order"];
echo "<table width='100%' border='0'>\n";
echo "<tr>\n";
echo "<td width='50%' align=\"left\" nowrap=\"nowrap\"><b>Call Center Queue List</b></td>\n";
echo "<td width='50%' align=\"left\" nowrap=\"nowrap\"><b>".$text['header-active_call_center']."</b></td>\n";
echo "<td width='50%' align=\"right\">\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align=\"left\" colspan='2'>\n";
echo "List of queues for the call center.<br /><br />\n";
echo $text['description-active_call_center']."<br /><br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "</tr></table>\n";
@@ -70,9 +79,9 @@ $order = $_GET["order"];
$rows_per_page = 100;
$param = "";
$page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
$sql = "select * from v_call_center_queues ";
$sql .= "where domain_uuid = '$domain_uuid' ";
@@ -92,21 +101,21 @@ $order = $_GET["order"];
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo th_order_by('queue_name', 'Queue Name', $order_by, $order);
echo th_order_by('queue_extension', 'Extension', $order_by, $order);
echo th_order_by('queue_strategy', 'Strategy', $order_by, $order);
//echo th_order_by('queue_moh_sound', 'Music On Hold', $order_by, $order);
//echo th_order_by('queue_record_template', 'Record Template', $order_by, $order);
//echo th_order_by('queue_time_base_score', 'Time Base Score', $order_by, $order);
//echo th_order_by('queue_max_wait_time', 'Max Wait Time', $order_by, $order);
//echo th_order_by('queue_max_wait_time_with_no_agent', 'Max Wait Time With No Agent', $order_by, $order);
//echo th_order_by('queue_tier_rules_apply', 'Tier Rules Apply', $order_by, $order);
//echo th_order_by('queue_tier_rule_wait_second', 'Tier Rule Wait Second', $order_by, $order);
//echo th_order_by('queue_tier_rule_no_agent_no_wait', 'Tier Rule No Agent No Wait', $order_by, $order);
//echo th_order_by('queue_discard_abandoned_after', 'Discard Abandoned After', $order_by, $order);
//echo th_order_by('queue_abandoned_resume_allowed', 'Abandoned Resume Allowed', $order_by, $order);
//echo th_order_by('queue_tier_rule_wait_multiply_level', 'Tier Rule Wait Multiply Level', $order_by, $order);
echo th_order_by('queue_description', 'Description', $order_by, $order);
echo th_order_by('queue_name', $text['label-queue_name'], $order_by, $order);
echo th_order_by('queue_extension', $text['label-extension'], $order_by, $order);
echo th_order_by('queue_strategy', $text['label-strategy'], $order_by, $order);
//echo th_order_by('queue_moh_sound', $text['label-music_on_hold'], $order_by, $order);
//echo th_order_by('queue_record_template', $text['label-record_template'], $order_by, $order);
//echo th_order_by('queue_time_base_score', $text['label-time_base_score'], $order_by, $order);
//echo th_order_by('queue_max_wait_time', $text['label-max_wait_time'], $order_by, $order);
//echo th_order_by('queue_max_wait_time_with_no_agent', $text['label-max_wait_time_with_no_agent'], $order_by, $order);
//echo th_order_by('queue_tier_rules_apply', $text['label-tier_rules_apply'], $order_by, $order);
//echo th_order_by('queue_tier_rule_wait_second', $text['label-tier_rule_wait_second'], $order_by, $order);
//echo th_order_by('queue_tier_rule_no_agent_no_wait', $text['label-tier_rule_no_agent_no_wait'], $order_by, $order);
//echo th_order_by('queue_discard_abandoned_after', $text['label-discard_abandoned_after'], $order_by, $order);
//echo th_order_by('queue_abandoned_resume_allowed', $text['label-abandoned_resume_allowed'], $order_by, $order);
//echo th_order_by('queue_tier_rule_wait_multiply_level', $text['label-tier_rule_wait_multiply_level'], $order_by, $order);
echo th_order_by('queue_description', $text['label-description'], $order_by, $order);
echo "<td align='right' width='42'>\n";
//echo " <a href='call_center_queue_edit.php' alt='add'>$v_link_label_add</a>\n";
echo "</td>\n";
@@ -133,7 +142,7 @@ $order = $_GET["order"];
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_tier_rule_wait_multiply_level]."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[queue_description]."&nbsp;</td>\n";
echo " <td valign='top' align='right'>\n";
echo " <a href='".PROJECT_PATH."/app/call_center_active/call_center_active.php?queue_name=".$row[queue_name]."' alt='edit'>$v_link_label_edit</a>\n";
echo " <a href='".PROJECT_PATH."/app/call_center_active/call_center_active.php?queue_name=".$row[queue_name]."' alt='".$text['button-edit']."'>$v_link_label_edit</a>\n";
//echo " <a href='call_center_queue_delete.php?id=".$row[call_center_queue_uuid]."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
//echo " <input type='button' class='btn' name='' alt='edit' onclick=\"window.location='call_center_queue_edit.php?id=".$row[call_center_queue_uuid]."'\" value='e'>\n";
//echo " <input type='button' class='btn' name='' alt='delete' onclick=\"if (confirm('Are you sure you want to delete this?')) { window.location='call_center_queue_delete.php?id=".$row[call_center_queue_uuid]."' }\" value='x'>\n";