From 7c7fd1da0fa764e8edd75608f40ce16e11ec1323 Mon Sep 17 00:00:00 2001 From: mattf Date: Tue, 12 Aug 2014 14:00:53 +0000 Subject: [PATCH] Added phone_number and vendor_lead_code to agent_status function output of Non-agent-API git-svn-id: svn://192.168.202.10@2164 3d104415-ff17-0410-8863-d5cf3c621b8a --- docs/NON-AGENT_API.txt | 11 ++++++----- www/vicidial/non_agent_api.php | 36 +++++++++++++++++++++++++++++++--- 2 files changed, 39 insertions(+), 8 deletions(-) diff --git a/docs/NON-AGENT_API.txt b/docs/NON-AGENT_API.txt index 61a2928b..45015e47 100644 --- a/docs/NON-AGENT_API.txt +++ b/docs/NON-AGENT_API.txt @@ -1,4 +1,4 @@ -NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2014-06-17 +NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2014-08-12 This document describes the functions of an API(Application Programming Interface) for all functions NOT directly relating to the VICIDIAL Agent screen. @@ -96,6 +96,7 @@ Changes: 140403-2024 - Added camp_rg_only option to update_user function 140418-1553 - Added preview_lead_id for agent_status 140617-2029 - Added vicidial_users wrapup_seconds_override option +140812-0939 - Added phone_number and vendor_lead_code to agent_status function output API Functions use the 'function' variable @@ -433,10 +434,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 -INCALL,M4050908070000012345,12345,TESTCAMP,1,Test Agent,AGENTS,3,LOGIN, -INCALL|M4181606420000000104|104|TESTBLND|1|Admin|ADMIN|9|BRK2|DEAD -PAUSED||105|TESTBLND|1|Admin|ADMIN|9||PREVIEW +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 +INCALL,M4050908070000012345,12345,TESTCAMP,1,Test Agent,AGENTS,3,LOGIN,,7275551212,123456 +INCALL|M4181606420000000104|104|TESTBLND|1|Admin|ADMIN|9|BRK2|DEAD|3125551212|123457 +PAUSED||105|TESTBLND|1|Admin|ADMIN|9||PREVIEW|9545551212|123458 NOTE: real_time_sub_status field can consist of: DEAD, DISPO, 3-WAY, PARK, RING, PREVIEW or it can be empty diff --git a/www/vicidial/non_agent_api.php b/www/vicidial/non_agent_api.php index 3fe409fb..2225607f 100644 --- a/www/vicidial/non_agent_api.php +++ b/www/vicidial/non_agent_api.php @@ -90,10 +90,11 @@ # 140403-2024 - Added camp_rg_only option to update_user function # 140418-1553 - Added preview_lead_id for agent_status # 140617-2029 - Added vicidial_users wrapup_seconds_override option +# 140812-0939 - Added phone_number and vendor_lead_code to agent_status function output # -$version = '2.10-66'; -$build = '140617-2029'; +$version = '2.10-67'; +$build = '140812-0939'; $api_url_log = 0; $startMS = microtime(); @@ -5124,7 +5125,36 @@ if ($function == 'agent_status') } } - $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\n"; + $vendor_lead_code=''; + $phone_number=''; + if ($lead_id > 0) + { + $stmt="SELECT vendor_lead_code,phone_number from vicidial_list where lead_id='$lead_id';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $leadinfo_ct = mysqli_num_rows($rslt); + if ($leadinfo_ct > 0) + { + $row=mysqli_fetch_row($rslt); + $vendor_lead_code = $row[0]; + $phone_number = $row[1]; + } + } + if (strlen($callerid) > 0) + { + $stmt="SELECT phone_number from vicidial_auto_calls where callerid='$callerid';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} + $phoneinfo_ct = mysqli_num_rows($rslt); + if ($phoneinfo_ct > 0) + { + $row=mysqli_fetch_row($rslt); + if (strlen($row[0])>3) + {$phone_number = $row[0];} + } + } + + $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\n"; echo "$output";