Added calls_in_queue_count function to Agent API
git-svn-id: svn://192.168.202.10@2893 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
+24
-1
@@ -1,4 +1,4 @@
|
||||
AGENT API DOCUMENT Started: 2008-07-03 Updated: 2017-02-20
|
||||
AGENT API DOCUMENT Started: 2008-07-03 Updated: 2018-01-24
|
||||
|
||||
This document describes the functions of an API(Application Programming Interface)
|
||||
for the VICIDIAL Agent screen. This functionality will be rather limited at first
|
||||
@@ -34,6 +34,7 @@ call_agent - send a call to connect the agent to their session
|
||||
pause_code - set a pause code if the agent is paused
|
||||
audio_playback - basic play/pause/resume/stop/restart audio in agent session
|
||||
switch_lead - for inbound calls, switches lead_id of live inbound call on agent screen
|
||||
calls_in_queue_count - display a count of the calls waiting in queue for the specific agent
|
||||
|
||||
|
||||
New scripts:
|
||||
@@ -885,6 +886,28 @@ SUCCESS: pause_code function sent - 6666
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
calls_in_queue_count -
|
||||
|
||||
DESCRIPTION:
|
||||
display a count of the calls waiting in queue for the specific agent
|
||||
|
||||
VALUES:
|
||||
value -
|
||||
REQUIRED, choices are below:
|
||||
DISPLAY - displays number of calls in queue that could be sent to this agent
|
||||
|
||||
EXAMPLE URLS:
|
||||
http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=calls_in_queue_count&value=DISPLAY
|
||||
|
||||
RESPONSES:
|
||||
ERROR: no user found - 6666
|
||||
ERROR: agent_user is not logged in - 6666
|
||||
SUCCESS: calls_in_queue_count - 0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
+99
-3
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
# api.php
|
||||
#
|
||||
# Copyright (C) 2017 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2018 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed as an API(Application Programming Interface) to allow
|
||||
# other programs to interact with the VICIDIAL Agent screen
|
||||
@@ -91,10 +91,11 @@
|
||||
# 170220-1303 - Added switch_lead function
|
||||
# 170527-2250 - Fix for rare inbound logging issue #1017, Added variable filtering
|
||||
# 170815-1314 - Added HTTP error code 418
|
||||
# 180124-1608 - Added calls_in_queue_count function
|
||||
#
|
||||
|
||||
$version = '2.14-57';
|
||||
$build = '170815-1314';
|
||||
$version = '2.14-58';
|
||||
$build = '180124-1608';
|
||||
|
||||
$startMS = microtime();
|
||||
|
||||
@@ -4055,6 +4056,101 @@ if ($function == 'pause_code')
|
||||
|
||||
|
||||
|
||||
################################################################################
|
||||
### BEGIN - calls_in_queue_count - display a count of the calls waiting in queue for the specific agent
|
||||
################################################################################
|
||||
if ($function == 'calls_in_queue_count')
|
||||
{
|
||||
if ( ($value!='DISPLAY') or ( (strlen($agent_user)<1) and (strlen($alt_user)<2) ) )
|
||||
{
|
||||
$result = _QXZ("ERROR");
|
||||
$result_reason = _QXZ("calls_in_queue_count 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 ( (!preg_match("/ $function /",$VUapi_allowed_functions)) and (!preg_match("/ALL_FUNCTIONS/",$VUapi_allowed_functions)) )
|
||||
{
|
||||
$result = _QXZ("ERROR");
|
||||
$result_reason = _QXZ("auth USER DOES NOT HAVE PERMISSION TO USE THIS FUNCTION");
|
||||
echo "$result: $result_reason - $value|$user|$function|$VUuser_group\n";
|
||||
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
|
||||
exit;
|
||||
}
|
||||
if (strlen($alt_user)>1)
|
||||
{
|
||||
$stmt = "select count(*) from vicidial_users where custom_three='$alt_user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_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_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$agent_user = $row[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = _QXZ("ERROR");
|
||||
$result_reason = _QXZ("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_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
if ($row[0] > 0)
|
||||
{
|
||||
$ADsql='';
|
||||
### grab the status, campaign and in-group details for this logged-in agent
|
||||
$stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$agent_user';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$Alogin=$row[0];
|
||||
$Acampaign=$row[1];
|
||||
$AccampSQL=$row[2];
|
||||
$AccampSQL = preg_replace('/\s\-/','', $AccampSQL);
|
||||
$AccampSQL = preg_replace('/\s/',"','", $AccampSQL);
|
||||
if (preg_match('/AGENTDIRECT/i', $AccampSQL))
|
||||
{
|
||||
$AccampSQL = preg_replace('/AGENTDIRECT/i','', $AccampSQL);
|
||||
$ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$agent_user') )";
|
||||
}
|
||||
|
||||
### grab the number of calls waiting in queue that could be routed to this agent
|
||||
$stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$calls_in_queue_count=$row[0];
|
||||
|
||||
$result = _QXZ("SUCCESS");
|
||||
$result_reason = _QXZ("SUCCESS: calls_in_queue_count") . " - " . $calls_in_queue_count;
|
||||
echo "$result_reason";
|
||||
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = _QXZ("ERROR");
|
||||
$result_reason = _QXZ("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 - calls_in_queue_count
|
||||
################################################################################
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
################################################################################
|
||||
### BEGIN - optional "close window" link
|
||||
|
||||
@@ -126,7 +126,7 @@ $UGreports = 'ALL REPORTS, NONE, Real-Time Main Report, Real-Time Campaign Summa
|
||||
|
||||
$Vtables = 'NONE,log_noanswer,did_agent_log,contact_information';
|
||||
|
||||
$APIfunctions = 'ALL_FUNCTIONS add_group_alias add_lead add_list add_phone add_phone_alias add_user agent_ingroup_info agent_stats_export agent_status audio_playback blind_monitor call_agent callid_info change_ingroups check_phone_number did_log_export external_add_lead external_dial external_hangup external_pause external_status in_group_status logout moh_list park_call pause_code preview_dial_action ra_call_control recording recording_lookup send_dtmf server_refresh set_timer_action sounds_list st_get_agent_active_lead st_login_log transfer_conference update_fields update_lead update_list update_log_entry update_phone update_phone_alias update_user user_group_status vm_list webphone_url webserver logged_in_agents update_campaigns lead_field_info phone_number_log switch_lead ccc_lead_info lead_status_search call_status_stats';
|
||||
$APIfunctions = 'ALL_FUNCTIONS add_group_alias add_lead add_list add_phone add_phone_alias add_user agent_ingroup_info agent_stats_export agent_status audio_playback blind_monitor call_agent callid_info change_ingroups check_phone_number did_log_export external_add_lead external_dial external_hangup external_pause external_status in_group_status logout moh_list park_call pause_code preview_dial_action ra_call_control recording recording_lookup send_dtmf server_refresh set_timer_action sounds_list st_get_agent_active_lead st_login_log transfer_conference update_fields update_lead update_list update_log_entry update_phone update_phone_alias update_user user_group_status vm_list webphone_url webserver logged_in_agents update_campaigns lead_field_info phone_number_log switch_lead ccc_lead_info lead_status_search call_status_stats calls_in_queue_count';
|
||||
|
||||
|
||||
### BEGIN housecleaning of old static report files, if not done before ###
|
||||
|
||||
Reference in New Issue
Block a user