Operator Panel: Added ability to record an extension, and set the current user's status.

This commit is contained in:
Nate Jones 2014-12-09 03:38:02 +00:00
parent 84142e5f6e
commit f24f2c8f17
6 changed files with 130 additions and 34 deletions

View File

@ -37,8 +37,24 @@
$apps[$x]['menu'][0]['groups'][] = 'admin';
//permission details
$apps[$x]['permissions'][0]['name'] = 'operator_panel_view';
$apps[$x]['permissions'][0]['groups'][] = 'superadmin';
$apps[$x]['permissions'][0]['groups'][] = 'admin';
$y = 0;
$apps[$x]['permissions'][$y]['name'] = 'operator_panel_view';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'operator_panel_manage';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'operator_panel_eavesdrop';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'operator_panel_kill';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'operator_panel_record';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
?>

View File

@ -30,6 +30,11 @@
$text['label-status_available_on_demand']['pt-pt'] = "Disponível (A Pedido)";
$text['label-status_available_on_demand']['fr-fr'] = "Disponble (sur demande)";
$text['label-status_on_demand']['en-us'] = "On Demand";
$text['label-status_on_demand']['es-cl'] = "A Pedido";
$text['label-status_on_demand']['pt-pt'] = "A Pedido";
$text['label-status_on_demand']['fr-fr'] = "Sur Demande";
$text['label-status_logged_out']['en-us'] = "Logged Out";
$text['label-status_logged_out']['es-cl'] = "Desconectado";
$text['label-status_logged_out']['pt-pt'] = "Desligado";
@ -46,9 +51,9 @@
$text['label-status_on_break']['fr-fr'] = "En Pause";
$text['label-status_do_not_disturb']['en-us'] = "Do Not Disturb";
$text['label-status_do_not_disturb']['es-cl'] = "No molestar";
$text['label-status_do_not_disturb']['es-cl'] = "No Molestar";
$text['label-status_do_not_disturb']['pt-pt'] = "Não Perturbar";
$text['label-status_do_not_disturb']['fr-fr'] = "Ne pas déranger";
$text['label-status_do_not_disturb']['fr-fr'] = "Ne pas Déranger";
$text['label-eavesdrop']['en-us'] = "Eavesdrop";
$text['label-eavesdrop']['es-cl'] = "Escuchar";
@ -60,6 +65,16 @@
$text['label-kill']['pt-pt'] = "Chamada Final";
$text['label-kill']['fr-fr'] = "Tuer Appel";
$text['label-record']['en-us'] = "Record";
$text['label-record']['es-cl'] = "Registro";
$text['label-record']['pt-pt'] = "Registro";
$text['label-record']['fr-fr'] = "Enregistrer";
$text['label-recording']['en-us'] = "Recording";
$text['label-recording']['es-cl'] = "Grabación de Llamadas";
$text['label-recording']['pt-pt'] = "Gravação de Chamadas";
$text['label-recording']['fr-fr'] = "Enregistrement de L'appel";
$text['button-all']['en-us'] = "All";
$text['button-all']['es-cl'] = "Todos";
$text['button-all']['pt-pt'] = "Tudo";

View File

@ -41,6 +41,33 @@ else {
$text[$key] = $value[$_SESSION['domain']['language']['code']];
}
//set user status
if (isset($_REQUEST['status']) && $_REQUEST['status'] != '') {
$user_status = check_str($_REQUEST['status']);
//sql update
$sql = "update v_users set ";
$sql .= "user_status = '".$user_status."' ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and user_uuid = '".$_SESSION['user']['user_uuid']."' ";
if (permission_exists("user_account_setting_edit")) {
$count = $db->exec(check_sql($sql));
}
//if call center app is installed then update the user_status
if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/call_center')) {
//update the user_status
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
$switch_cmd .= "callcenter_config agent set status ".$_SESSION['user']['username']."@".$_SESSION['domain_name']." '".$user_status."'";
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
//update the user state
$cmd = "api callcenter_config agent set state ".$_SESSION['user']['username']."@".$_SESSION['domain_name']." Waiting";
$response = event_socket_request($fp, $cmd);
}
exit;
}
require_once "resources/header.php";
?>
@ -213,6 +240,16 @@ require_once "resources/header.php";
}
}
//record call
function record_call(chan_uuid) {
if (chan_uuid != '') {
cmd = get_record_cmd(chan_uuid);
if (cmd != '') {
send_cmd('exec.php?cmd='+escape(cmd));
}
}
}
//used by call control and ajax refresh functions
function send_cmd(url) {
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
@ -323,7 +360,7 @@ require_once "resources/header.php";
DIV.ext {
float: left;
width: 235px;
margin: 0px 10px 10px 0px;
margin: 0px 8px 8px 0px;
padding: 0px;
border-style: solid;
-moz-border-radius: 5px;

View File

@ -59,36 +59,53 @@ foreach ($activity as $extension => $fields) {
$groups = array_unique($groups);
sort($groups);
echo "<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
echo " <tr>";
echo " <td valign='top' align='left' width='50%' nowrap>";
echo " <b>".$text['title-operator_panel']."</b>";
echo " </td>";
echo " <td valign='top' align='center' nowrap>";
echo " <input type='hidden' id='current_user_status' value=''>";
if (sizeof($groups) > 0) {
echo "<table cellpadding='0' cellspacing='0' border='0' align='right'>";
echo " <tr>";
echo " <td>";
echo " <input type='hidden' id='group' value=\"".$_REQUEST['group']."\">";
echo " <strong style='color: #000;'>".$text['label-call_group']."</strong>&nbsp;&nbsp;";
if (sizeof($groups) > 5) {
//show select box
echo " <select class='formfld' onchange=\"document.getElementById('group').value = this.options[this.selectedIndex].value; refresh_start();\" onfocus='refresh_stop();' onblur='refresh_start();'>\n";
echo " <option value=''></option>";
foreach ($groups as $group) {
echo " <option value='".$group."' ".(($_REQUEST['group'] == $group) ? "selected" : null).">".$group."</option>\n";
}
echo " </select>\n";
}
else {
//show buttons
echo " <input type='button' class='btn' value=\"".$text['button-all']."\" onclick=\"document.getElementById('group').value = '';\">";
foreach ($groups as $group) {
echo " <input type='button' class='btn' value=\"".$group."\" ".(($_REQUEST['group'] == $group) ? "disabled='disabled'" : null)." onclick=\"document.getElementById('group').value = this.value;\">";
}
}
echo " </td>";
echo " </tr>";
echo "</table>";
$status_options = Array(
"Available" => $text['label-status_available'],
"Available (On Demand)" => $text['label-status_on_demand'],
"On Break" => $text['label-status_on_break'],
"Do Not Disturb" => $text['label-status_do_not_disturb'],
"Logged Out" => $text['label-status_logged_out']
);
foreach ($status_options as $status_value => $status_label) {
echo " <input type='button' class='btn' value=\"".$status_label."\" onclick=\"send_cmd('index.php?status='+escape('".$status_value."'));\">";
}
echo "<b>".$text['title-operator_panel']."</b>";
echo "<br><br><br>";
echo " </td>";
echo " <td valign='top' align='right' width='50%' nowrap>";
if (sizeof($groups) > 0) {
echo " <input type='hidden' id='group' value=\"".$_REQUEST['group']."\">";
if (sizeof($groups) > 5) {
//show select box
echo " <select class='formfld' onchange=\"document.getElementById('group').value = this.options[this.selectedIndex].value; refresh_start();\" onfocus='refresh_stop();' onblur='refresh_start();'>\n";
echo " <option value='' ".(($_REQUEST['group'] == '') ? "selected" : null).">".$text['label-call_group']."</option>";
echo " <option value=''>".$text['button-all']."</option>";
foreach ($groups as $group) {
echo " <option value='".$group."' ".(($_REQUEST['group'] == $group) ? "selected" : null).">".$group."</option>\n";
}
echo " </select>\n";
}
else {
//show buttons
echo " <input type='button' class='btn' title=\"".$text['label-call_group']."\" value=\"".$text['button-all']."\" onclick=\"document.getElementById('group').value = '';\">";
foreach ($groups as $group) {
echo " <input type='button' class='btn' title=\"".$text['label-call_group']."\" value=\"".$group."\" ".(($_REQUEST['group'] == $group) ? "disabled='disabled'" : null)." onclick=\"document.getElementById('group').value = this.value;\">";
}
}
}
echo " </td>";
echo " </tr>";
echo "</table>";
echo "<br>";
foreach ($activity as $extension => $ext) {
unset($block);
@ -243,6 +260,17 @@ foreach ($activity as $extension => $ext) {
$block .= " <span class='caller_info'>";
$block .= " <table align='right'><tr><td style='text-align: right;'>";
$block .= " <span class='call_info'>".$ext['call_length']."</span><br>";
//record
if (permission_exists('operator_panel_record') && $ext_state == 'active') {
$call_identifier_record = $ext['call_uuid'];
$rec_file = $_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d")."/".$call_identifier_record.".wav";
if (file_exists($rec_file)) {
$block .= "<img src='resources/images/recording.png' style='width: 12px; height: 12px; border: none; margin: 4px 0px 0px 5px; cursor: help;' title=\"".$text['label-recording']."\">";
}
else {
$block .= "<img src='resources/images/record.png' style='width: 12px; height: 12px; border: none; margin: 4px 0px 0px 5px; cursor: pointer;' title=\"".$text['label-record']."\" onclick=\"record_call('".$call_identifier_record."');\">";
}
}
//eavesdrop
if (permission_exists('operator_panel_eavesdrop') && $ext_state == 'active' && !in_array($extension, $_SESSION['user']['extensions'])) {
$block .= "<img src='resources/images/eavesdrop.png' style='width: 12px; height: 12px; border: none; margin: 4px 0px 0px 5px; cursor: pointer;' title='".$text['label-eavesdrop']."' onclick=\"eavesdrop_call('".$extension."','".$call_identifier."');\">";

Binary file not shown.

After

Width:  |  Height:  |  Size: 813 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 830 B