Added Agent API function logout to log an agent out of their session

git-svn-id: svn://192.168.202.10@1721 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2011-09-11 20:19:40 +00:00
parent 8d2ac50466
commit 55447ebcb1
6 changed files with 119 additions and 7 deletions
+1
View File
@@ -696,6 +696,7 @@ OTHER CHANGES:
159. Added ability to set custom callerID numbers per campaign for outbound
calls by areacode. You can even set multiple callerIDs per areacode.
160. Added Agent API function logout to log an agent out of their session
+23 -1
View File
@@ -1,4 +1,4 @@
AGENT API DOCUMENT Started: 2008-07-03 Updated: 2011-04-30
AGENT API DOCUMENT Started: 2008-07-03 Updated: 2011-09-11
This document describes the functions of an API(Application Programming Interface)
for the VICIDIAL Agent screen. This functionality will be rather limited at first
@@ -25,6 +25,7 @@ ra_call_control - remote agent call control: hangup/transfer calls being handled
send_dtmf - sends dtmf signal string to agent's session
transfer_conference - sends several commands related to the agent transfer-conf frame
park_call - sends command to park customer or grab customer from park or ivr
logout - logs the agent out of the agent interface
New scripts:
@@ -140,6 +141,27 @@ SUCCESS: external_pause function set - PAUSE|1232020456|6666
--------------------------------------------------------------------------------
logout -
DESCRIPTION:
Logs the agent out of the agent interface. If the agent is on a live call, will logout after the live call is dispositioned
VALUES: (value)
LOGOUT - Logout the agent session
EXAMPLE URLS:
http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=logout&value=LOGOUT
RESPONSES:
ERROR: logout not valid - PAUSE|6666
ERROR: no user found - 6666
ERROR: agent_user is not logged in - 6666
SUCCESS: logout function set - LOGOUT|1232020456|6666
--------------------------------------------------------------------------------
external_dial -
@@ -781,6 +781,7 @@ Postal Code Outside Dialable Zone||
Custom Transfer||
System Delay, Please try again||
Disposition Status List Hidden||
The system has received a command to log you out, you have been logged out of your session||
############################################################ MANAGER Manual
+72 -2
View File
@@ -54,10 +54,11 @@
# 110224-1711 - Added compatibility with QM phone environment logging
# 110409-0821 - Added run_time logging of API functions
# 110430-0953 - Added option to external_dial by lead_id with alt_dial option
# 110911-1555 - Added logout function
#
$version = '2.4-20';
$build = '110430-0953';
$version = '2.4-21';
$build = '110911-1555';
$startMS = microtime();
@@ -583,6 +584,75 @@ if ($function == 'external_pause')
################################################################################
### BEGIN - logout - log the agent out of the system
################################################################################
if ($function == 'logout')
{
if ( (strlen($value)<1) or ( (strlen($agent_user)<1) and (strlen($alt_user)<1) ) or (!ereg("LOGOUT",$value)) )
{
$result = 'ERROR';
$result_reason = "logout not valid";
echo "$result: $result_reason - $value|$agent_user\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
else
{
if (strlen($alt_user)>1)
{
$stmt = "select count(*) from vicidial_users where custom_three='$alt_user';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
if ($row[0] > 0)
{
$stmt = "select user from vicidial_users where custom_three='$alt_user' order by user;";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$agent_user = $row[0];
}
else
{
$result = 'ERROR';
$result_reason = "no user found";
echo "$result: $result_reason - $alt_user\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
$stmt = "select count(*) from vicidial_live_agents where user='$agent_user';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
if ($row[0] > 0)
{
$stmt="UPDATE vicidial_live_agents set external_pause='$value' where user='$agent_user';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
$result = 'SUCCESS';
$result_reason = "logout function set";
echo "$result: $result_reason - $value|$epoch|$agent_user\n";
$data = "$epoch";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
else
{
$result = 'ERROR';
$result_reason = "agent_user is not logged in";
echo "$result: $result_reason - $agent_user\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
}
################################################################################
### END - logout
################################################################################
################################################################################
### BEGIN - external_dial - place a manual dial phone call
################################################################################
+5
View File
@@ -658,6 +658,11 @@ if ($ACTION == 'refresh')
{$Alogin='DEAD_EXTERNAL';}
if ($Ashift_logout > 0)
{$Alogin='SHIFT_LOGOUT';}
if ($external_pause == 'LOGOUT')
{
$Alogin='API_LOGOUT';
$external_pause='';
}
echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Status: ' . $Astatus . '|DiaLCalls: ' . $DiaLCalls . '|APIHanguP: ' . $external_hangup . '|APIStatuS: ' . $external_status . '|APIPausE: ' . $external_pause . '|APIDiaL: ' . $external_dial . '|DEADcall: ' . $DEADcustomer . '|InGroupChange: ' . $InGroupChangeDetails . '|APIFields: ' . $external_update_fields . '|APIFieldsData: ' . $external_update_fields_data . '|APITimerAction: ' . $timer_action . '|APITimerMessage: ' . $timer_action_message . '|APITimerSeconds: ' . $timer_action_seconds . '|APIdtmf: ' . $external_dtmf . '|APItransferconf: ' . $external_transferconf . '|APIpark: ' . $external_park . '|APITimerDestination: ' . $timer_action_destination . '|APIManualDialQueue: ' . $MDQ_count . "\n";
+17 -4
View File
@@ -363,10 +363,11 @@
# 110723-2308 - Complete hiding of phone numbers in logs when alter phone is set to HIDE
# 110730-2240 - Added option to hide dispo statuses, only to be used with API
# 110802-0122 - Added call_id variable
# 110911-1604 - Added API logout function
#
$version = '2.4-330c';
$build = '110802-0122';
$version = '2.4-331c';
$build = '110911-1604';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=73;
$one_mysql_log=0;
@@ -3300,6 +3301,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
var alert_enabled = '<?php echo $VU_alert_enabled ?>';
var allow_alerts = '<?php echo $VU_allow_alerts ?>';
var shift_logout_flag = 0;
var api_logout_flag = 0;
var vtiger_callback_id = 0;
var agent_status_view = '<?php echo $agent_status_view ?>';
var agent_status_view_time = '<?php echo $agent_status_view_time ?>';
@@ -4199,6 +4201,12 @@ function set_length(SLnumber,SLlength_goal,SLdirection)
{
shift_logout_flag=1;
}
if (AGLogiN == 'API_LOGOUT')
{
api_logout_flag=1;
if ( (MD_channel_look < 1) && (VD_live_customer_call < 1) && (alt_dial_status_display < 1) )
{LogouT('API');}
}
}
var VLAStatuS_array = check_time_array[4].split("Status: ");
var VLAStatuS = VLAStatuS_array[1];
@@ -8911,7 +8919,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection)
AgentDispoing = 0;
if (shift_logout_flag < 1)
if ( (shift_logout_flag < 1) && (api_logout_flag < 1) )
{
if (wrapup_waiting == 0)
{
@@ -8949,7 +8957,10 @@ function set_length(SLnumber,SLlength_goal,SLdirection)
}
else
{
LogouT('SHIFT');
if (shift_logout_flag > 0)
{LogouT('SHIFT');}
else
{LogouT('API');}
}
if (focus_blur_enabled==1)
{
@@ -9667,6 +9678,8 @@ function set_length(SLnumber,SLlength_goal,SLdirection)
var logout_content='';
if (tempreason=='SHIFT')
{logout_content='Your Shift is over or has changed, you have been logged out of your session<br /><br />';}
if (tempreason=='API')
{logout_content='The system has received a command to log you out, you have been logged out of your session<br /><br />';}
document.getElementById("LogouTBoxLink").innerHTML = logout_content + "<a href=\"" + agcPAGE + "?relogin=YES&session_epoch=" + epoch_sec + "&session_id=" + session_id + "&session_name=" + session_name + "&VD_login=" + user + "&VD_campaign=" + campaign + "&phone_login=" + original_phone_login + "&phone_pass=" + phone_pass + "&VD_pass=" + pass + "\">CLICK HERE TO LOG IN AGAIN</a>\n";