Added campaign_id option to agent_stats_export function in Non-Agent API

git-svn-id: svn://192.168.202.10@3310 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2020-11-06 22:04:03 +00:00
parent 91bfd5155d
commit dae079684d
4 changed files with 26 additions and 16 deletions
+6 -4
View File
@@ -1,4 +1,4 @@
NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2020-10-04
NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2020-11-06
This document describes the functions of an API(Application Programming
Interface) for all functions NOT directly relating to the VICIDIAL Agent screen.
@@ -164,6 +164,7 @@ Changes:
200815-1025 - Added campaigns_list & hopper_list functions
200824-2330 - Added search_method BLOCK option for hopper_list function
201002-1545 - Added extension as recording_lookup option, Allowed for secure sounds_web_server setting
201106-1654 - Added campaign_id option to agent_stats_export function
API Functions use the 'function' variable
@@ -531,7 +532,8 @@ datetime_start - start date/time of the agent activity to pull (must be in "YYYY
datetime_end - end date/time of the agent activity to pull (must be in "YYYY-MM-DD+HH:MM:SS" format)
SETTINGS FIELDS-
agent_user - 2-20 characters, use only for one agent stats
agent_user - 2-20 characters, use only for one agent stats <optional>
campaign_id - 2-8 characters, use only for one campaign stats <optional>
stage - the format of the exported data: csv, tab, pipe(default)
header - include a header(YES) or not(NO). This is optional, default is not to include a header
time_format - time format('H','HF','M','S') in hours, minutes or seconds: H = 1:23:45, M = 83:45, S = 5023 (default 'HF')
@@ -546,8 +548,8 @@ http://server/vicidial/non_agent_apiX.php?DB=0&stage=pipe&user=6666&pass=1234&so
Example responses:
ERROR: agent_stats_export USER DOES NOT HAVE PERMISSION TO GET AGENT INFO - 6666|0
ERROR: agent_stats_export INVALID SEARCH PARAMETERS - 6666||2010-12-03 00:00:00|2010-12-03 00:00:01
ERROR: agent_stats_export NO RECORDS FOUND - 1255||2010-12-03 00:00:00|2010-12-03 00:00:01
ERROR: agent_stats_export INVALID SEARCH PARAMETERS - 6666||2010-12-03 00:00:00|2010-12-03 00:00:01|
ERROR: agent_stats_export NO RECORDS FOUND - 1255||2010-12-03 00:00:00|2010-12-03 00:00:01|
A SUCCESS response will not show "SUCCESS", but instead will just print the results in the following format:
user|full_name|user_group|calls|login_time|total_talk_time|avg_talk_time|avg_wait_time|pct_of_queue|pause_time|sessions|avg_session|pauses|avg_pause_time|pause_pct|pauses_per_session|total_wait_time
@@ -155,7 +155,7 @@ if ($time_in_sec)
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,enable_languages,language_method,report_default_format FROM system_settings;";
$rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {echo "$stmt\n";}
if ($DB) {echo "|$stmt\n";}
$qm_conf_ct = mysqli_num_rows($rslt);
if ($qm_conf_ct > 0)
{
@@ -274,7 +274,7 @@ if (strlen($LOGserver_name)<1) {$LOGserver_name='X';}
$stmt="SELECT webserver_id FROM vicidial_webservers where webserver='$LOGserver_name' and hostname='$LOGhostname' LIMIT 1;";
$rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {echo "$stmt\n";}
if ($DB) {echo "|$stmt\n";}
$webserver_id_ct = mysqli_num_rows($rslt);
if ($webserver_id_ct > 0)
{
@@ -382,7 +382,7 @@ while($i < $group_ct)
$stmt="select campaign_id from vicidial_campaigns $whereLOGallowed_campaignsSQL order by campaign_id;";
$rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {echo "$stmt\n";}
if ($DB) {echo "|$stmt\n";}
$campaigns_to_print = mysqli_num_rows($rslt);
$i=0;
while ($i < $campaigns_to_print)
@@ -422,7 +422,7 @@ else
# }
$stmt="select user_group from vicidial_user_groups $whereLOGadmin_viewable_groupsSQL order by user_group;";
$rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {echo "$stmt\n";}
if ($DB) {echo "|$stmt\n";}
$user_groups_to_print = mysqli_num_rows($rslt);
$user_groups=array();
$i=0;
@@ -454,11 +454,11 @@ else
$TCuser_group_SQL = "and user_group IN($TCuser_group_SQL)";
}
if ($DB) {echo "$user_group_string|$user_group_ct|$user_groupQS|$i<BR>";}
if ($DB) {echo "|$user_group_string|$user_group_ct|$user_groupQS|$i<BR>";}
$stmt="select distinct pause_code,pause_code_name from vicidial_pause_codes;";
$rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {echo "$stmt\n";}
if ($DB) {echo "|$stmt\n";}
$statha_to_print = mysqli_num_rows($rslt);
$i=0;
while ($i < $statha_to_print)
@@ -588,7 +588,7 @@ else
### BEGIN gather user IDs and names for matching up later
$stmt="select full_name,$userSQL from vicidial_users $whereLOGadmin_viewable_groupsSQL order by user limit 100000;";
$rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {echo "$stmt\n";}
if ($DB) {echo "|$stmt\n";}
$users_to_print = mysqli_num_rows($rslt);
$i=0;
$graph_stats=array();
+12 -4
View File
@@ -154,10 +154,11 @@
# 200815-1025 - Added campaigns_list & hopper_list functions
# 200824-2330 - Added search_method BLOCK option for hopper_list function
# 201002-1545 - Added extension as recording lookup option, Allowed for secure sounds_web_server setting
# 201106-1654 - Added campaign_id option to agent_stats_export function
#
$version = '2.14-131';
$build = '201002-1545';
$version = '2.14-132';
$build = '201106-1654';
$api_url_log = 0;
$startMS = microtime();
@@ -7837,6 +7838,13 @@ if ($function == 'agent_stats_export')
$search_SQL .= "user='$agent_user'";
$search_ready++;
}
if ( (strlen($campaign_id)>0) and (strlen($campaign_id)<9) )
{
if (strlen($search_SQL)>5)
{$search_SQL .= " and ";}
$search_SQL .= "campaign_id='$campaign_id'";
$search_ready++;
}
if ( (strlen($datetime_start)>18) and (strlen($datetime_start)<20) and (strlen($datetime_end)>18) and (strlen($datetime_end)<20) )
{
$datetime_start = preg_replace("/\+/",' ',$datetime_start);
@@ -7852,7 +7860,7 @@ if ($function == 'agent_stats_export')
{
$result = 'ERROR';
$result_reason = "agent_stats_export INVALID SEARCH PARAMETERS";
$data = "$user|$agent_user|$datetime_start|$datetime_end";
$data = "$user|$agent_user|$datetime_start|$datetime_end|$campaign_id";
echo "$result: $result_reason: $data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
@@ -7867,7 +7875,7 @@ if ($function == 'agent_stats_export')
{
$result = 'ERROR';
$result_reason = "agent_stats_export NO RECORDS FOUND";
$data = "$user|$agent_user|$lead_id|$date";
$data = "$user|$agent_user|$datetime_start|$datetime_end|$campaign_id";
echo "$result: $result_reason - $data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
@@ -311,6 +311,6 @@ else
{
echo "$qc_user_logged_in";
}
echo "&nbsp;<A HREF=$PHP_SELF?lead_id=$lead_id&list_id=$CLlist_id&stage=DISPLAY&submit_button=YES&user=$PHP_AUTH_USER&pass=$PHP_AUTH_PW&bgcolor=E6E6E6>"._QXZ("Refresh")."</A>";
echo "&nbsp;<A HREF=$PHP_SELF?phone_number=$phone_number&phone_code=$phone_code&lead_id=$lead_id&list_id=$CLlist_id&stage=DISPLAY&submit_button=YES&user=$PHP_AUTH_USER&pass=$PHP_AUTH_PW&bgcolor=E6E6E6>"._QXZ("Refresh")."</A>";
?>