Added include_ip option for the agent_status Non-Agent API function
git-svn-id: svn://192.168.202.10@3654 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -2989,7 +2989,7 @@ if (!$T)
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
if (!$Q) {print "\nProcessing vicidial_agent table... ($vicidial_agent_log_count|$vicidial_agent_log_archive_count)\n";}
|
||||
if (!$Q) {print "\nProcessing vicidial_agent_log table... ($vicidial_agent_log_count|$vicidial_agent_log_archive_count)\n";}
|
||||
$stmtA = "INSERT IGNORE INTO vicidial_agent_log_archive SELECT * from vicidial_agent_log;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
@@ -3041,7 +3041,7 @@ if (!$T)
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
if (!$Q) {print "\nProcessing vicidial_agent table... ($vicidial_agent_visibility_log_count|$vicidial_agent_visibility_log_archive_count)\n";}
|
||||
if (!$Q) {print "\nProcessing vicidial_agent_visibility_log table... ($vicidial_agent_visibility_log_count|$vicidial_agent_visibility_log_archive_count)\n";}
|
||||
$stmtA = "INSERT IGNORE INTO vicidial_agent_visibility_log_archive SELECT * from vicidial_agent_visibility_log;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2022-09-20
|
||||
NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2022-11-09
|
||||
|
||||
This document describes the functions of an API(Application Programming
|
||||
Interface) for all functions NOT directly relating to the VICIDIAL Agent screen.
|
||||
@@ -204,6 +204,7 @@ Changes:
|
||||
220310-0825 - Added DELETE action to the 'update_presets' function
|
||||
220902-0823 - Added dial_status_add/dial_status_remove options to update_campaign function
|
||||
220920-0814 - Added more "XDAY" options to add_lead duplicate checks
|
||||
221108-1849 - Added include_ip option for agent_status function
|
||||
|
||||
|
||||
API Functions use the 'function' variable
|
||||
@@ -676,9 +677,10 @@ agent_user - 2-20 characters, use only for one agent status
|
||||
SETTINGS FIELDS-
|
||||
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
|
||||
include_ip - include computer_ip field(YES) or not(NO), the last ip address that the agent used to log in to the agent screen
|
||||
|
||||
Example URL strings for API calls:
|
||||
http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=agent_status&agent_user=1234&stage=csv&header=YES
|
||||
http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=agent_status&agent_user=1234&stage=csv&header=YES&include_ip=YES
|
||||
|
||||
Example responses:
|
||||
ERROR: agent_status USER DOES NOT HAVE PERMISSION TO GET AGENT INFO - 6666|0
|
||||
@@ -687,10 +689,10 @@ ERROR: agent_status AGENT NOT FOUND - 6666||
|
||||
ERROR: agent_status AGENT NOT LOGGED IN - 6666||
|
||||
|
||||
A SUCCESS response will not show "SUCCESS", but instead will just print the results in the following format:
|
||||
status,call_id,lead_id,campaign_id,calls_today,full_name,user_group,user_level,pause_code,real_time_sub_status,phone_number,vendor_lead_code,session_id
|
||||
INCALL,M4050908070000012345,12345,TESTCAMP,1,Test Agent,AGENTS,3,LOGIN,,7275551212,123456,8600051
|
||||
INCALL|M4181606420000000104|104|TESTBLND|1|Admin|ADMIN|9|BRK2|DEAD|3125551212|123457|8600051
|
||||
PAUSED||105|TESTBLND|1|Admin|ADMIN|9||PREVIEW|9545551212|123458|8600052
|
||||
status,call_id,lead_id,campaign_id,calls_today,full_name,user_group,user_level,pause_code,real_time_sub_status,phone_number,vendor_lead_code,session_id,computer_ip
|
||||
INCALL,M4050908070000012345,12345,TESTCAMP,1,Test Agent,AGENTS,3,LOGIN,,7275551212,123456,8600051,192.168.1.205
|
||||
INCALL|M4181606420000000104|104|TESTBLND|1|Admin|ADMIN|9|BRK2|DEAD|3125551212|123457|8600051,192.168.1.206
|
||||
PAUSED||105|TESTBLND|1|Admin|ADMIN|9||PREVIEW|9545551212|123458|8600052,192.168.1.202
|
||||
|
||||
NOTE: real_time_sub_status field can consist of: DEAD, DISPO, 3-WAY, PARK, RING, PREVIEW, DIAL or it can be empty
|
||||
|
||||
|
||||
@@ -197,10 +197,11 @@
|
||||
# 220519-2206 - Small fix for 'update_lead' delete_lead feature
|
||||
# 220902-0823 - Added dial_status_add/dial_status_remove options to update_campaign function
|
||||
# 220920-0814 - Added more "XDAY" options to add_lead duplicate checks
|
||||
# 221108-1849 - Added include_ip option for agent_status function
|
||||
#
|
||||
|
||||
$version = '2.14-174';
|
||||
$build = '220920-0814';
|
||||
$version = '2.14-175';
|
||||
$build = '221108-1849';
|
||||
$php_script='non_agent_api.php';
|
||||
$api_url_log = 0;
|
||||
|
||||
@@ -706,6 +707,8 @@ if (isset($_GET["dial_status_add"])) {$dial_status_add=$_GET["dial_status_add"
|
||||
elseif (isset($_POST["dial_status_add"])) {$dial_status_add=$_POST["dial_status_add"];}
|
||||
if (isset($_GET["dial_status_remove"])) {$dial_status_remove=$_GET["dial_status_remove"];}
|
||||
elseif (isset($_POST["dial_status_remove"])) {$dial_status_remove=$_POST["dial_status_remove"];}
|
||||
if (isset($_GET["include_ip"])) {$include_ip=$_GET["include_ip"];}
|
||||
elseif (isset($_POST["include_ip"])) {$include_ip=$_POST["include_ip"];}
|
||||
|
||||
$DB=preg_replace('/[^0-9]/','',$DB);
|
||||
|
||||
@@ -859,6 +862,7 @@ $preset_hide_number = preg_replace('/[^0-9a-zA-Z]/','',$preset_hide_number);
|
||||
$preset_number = preg_replace('/[^\*\#\.\_0-9a-zA-Z]/','',$preset_number);
|
||||
$preset_dtmf = preg_replace('/[^- \,\*\#0-9a-zA-Z]/','',$preset_dtmf);
|
||||
$action = preg_replace('/[^0-9a-zA-Z]/','',$action);
|
||||
$include_ip = preg_replace('/[^0-9a-zA-Z]/','',$include_ip);
|
||||
|
||||
if ($non_latin < 1)
|
||||
{
|
||||
@@ -11460,7 +11464,12 @@ if ($function == 'agent_status')
|
||||
if (strlen($time_format) < 1)
|
||||
{$time_format = 'HF';}
|
||||
if ($header == 'YES')
|
||||
{$output .= 'status' . $DL . 'callerid' . $DL . 'lead_id' . $DL . 'campaign_id' . $DL . 'calls_today' . $DL . 'full_name' . $DL . 'user_group' . $DL . 'user_level' . "\n";}
|
||||
{
|
||||
$output .= 'status' . $DL . 'callerid' . $DL . 'lead_id' . $DL . 'campaign_id' . $DL . 'calls_today' . $DL . 'full_name' . $DL . 'user_group' . $DL . 'user_level' . $DL . 'pause_code' . $DL . 'real_time_sub_status' . $DL . 'phone_number' . $DL . 'vendor_lead_code' . $DL . 'session_id';
|
||||
if ($include_ip == 'YES')
|
||||
{$output .= $DL . 'computer_ip';}
|
||||
$output .= "\n";
|
||||
}
|
||||
|
||||
$stmt="SELECT full_name,user_group,user_level from vicidial_users $agent_search_SQL $LOGadmin_viewable_groupsSQL;";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
@@ -11617,8 +11626,28 @@ if ($function == 'agent_status')
|
||||
{$phone_number = $row[0];}
|
||||
}
|
||||
}
|
||||
$computer_ipOUTPUT='';
|
||||
if ($include_ip == 'YES')
|
||||
{
|
||||
$computer_ip='';
|
||||
$two_days_ago = date("Y-m-d H:i:s", mktime(date("H"),date("i"),date("s"),date("m"),date("d")-2,date("Y")));
|
||||
$stmt="SELECT computer_ip from vicidial_user_log where user='$agent_user' and event='LOGIN' and event_date < \"$two_days_ago\" order by event_date desc limit 1;";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$ipinfo_ct = mysqli_num_rows($rslt);
|
||||
if ($ipinfo_ct > 0)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
if (strlen($row[0])>3)
|
||||
{
|
||||
$computer_ip = $row[0];
|
||||
$computer_ipOUTPUT = "$DL$computer_ip";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$output .= "$status$DL$callerid$DL$lead_id$DL$campaign_id$DL$calls_today$DL$full_name$DL$user_group$DL$user_level$DL$pause_code$DL$rtr_status$DL$phone_number$DL$vendor_lead_code$DL$conf_exten\n";
|
||||
|
||||
$output .= "$status$DL$callerid$DL$lead_id$DL$campaign_id$DL$calls_today$DL$full_name$DL$user_group$DL$user_level$DL$pause_code$DL$rtr_status$DL$phone_number$DL$vendor_lead_code$DL$conf_exten$computer_ipOUTPUT\n";
|
||||
|
||||
echo "$output";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user