Added Agent API options to dial next number and search for lead phone number within a lead_id

git-svn-id: svn://192.168.202.10@2078 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2014-03-02 12:50:07 +00:00
parent 56c0294690
commit c254c735b1
4 changed files with 96 additions and 35 deletions
+6 -3
View File
@@ -1,4 +1,4 @@
AGENT API DOCUMENT Started: 2008-07-03 Updated: 2014-01-26
AGENT API DOCUMENT Started: 2008-07-03 Updated: 2014-03-01
This document describes the functions of an API(Application Programming Interface)
for the VICIDIAL Agent screen. This functionality will be rather limited at first
@@ -221,7 +221,7 @@ Places a manual dial phone call on the agent screen, you can define whether to s
VALUES:
value -
Any valid phone number (7275551212)
Any valid phone number (7275551212), or "MANUALNEXT" to mimic the Dial Next Number button
lead_id -
Any valid lead_id from the system(either value or lead_id are required) if both are defined, lead_id will override value
phone_code -
@@ -246,7 +246,9 @@ vtiger_callback -
alt_user -
OPTIONAL, instead of agent_user, this is to lookup the agent_user using the vicidial_users.custom_three field
alt_dial -
OPTIONAL, if using lead_id you can set this flag to dial the ALT number or the ADDR3 number
OPTIONAL, if using lead_id you can set this flag to dial the ALT number or the ADDR3 number or SEARCH a phone_number within the lead
if SEARCH is used and the phone_number is not matched with the lead's phone_number, alt_phone or address3 field
an ERROR will be returned
EXAMPLE URLS:
http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=external_dial&value=7275551212&phone_code=1&search=YES&preview=NO&focus=YES
@@ -263,6 +265,7 @@ ERROR: vtiger callback activity does not exist in vtiger system - 12345
ERROR: phone_number is already in this agents manual dial queue - 6666|7275551211
ERROR: lead_id is not valid - 6666|1234567
ERROR: phone number is not valid - 6666||1234567|
ERROR: phone number lead_id search not found - 6666|7275551212|1234567|
SUCCESS: external_dial function set - 7275551212|6666|1|YES|NO|YES|123456|1232020456|9|TESTING|7275551211|
+38 -3
View File
@@ -71,10 +71,11 @@
# 140107-2140 - Added webserver and url logging
# 140126-0701 - Added pause_code function
# 140214-1736 - Added preview_dial_action function
# 140301-2046 - Added options to dial next number and search for lead phone number
#
$version = '2.8-37';
$build = '140214-1736';
$version = '2.8-38';
$build = '140301-2046';
$startMS = microtime();
@@ -1109,7 +1110,10 @@ if ($function == 'call_agent')
################################################################################
if ($function == 'external_dial')
{
$value = preg_replace("/[^0-9]/","",$value);
if ($value == 'MANUALNEXT')
{$value = preg_replace("/[^0-9a-zA-Z]/","",$value);}
else
{$value = preg_replace("/[^0-9]/","",$value);}
if ( ( (strlen($value)<2) and (strlen($lead_id)<1) ) or ( (strlen($agent_user)<2) and (strlen($alt_user)<2) ) or (strlen($search)<2) or (strlen($preview)<2) or (strlen($focus)<2) )
{
@@ -1316,8 +1320,39 @@ if ($function == 'external_dial')
### If lead_id is populated, check for it and adjust variables accordingly
if (strlen($lead_id) > 0)
{
$phone_search = $value;
$value='';
$phone_code='';
if ($alt_dial=='SEARCH')
{
$alt_dial='';
$stmt = "SELECT phone_number,alt_phone,address3 FROM vicidial_list where lead_id='$lead_id';";
$rslt=mysql_to_mysqli($stmt, $link);
$paa_ct = mysqli_num_rows($rslt);
if ($paa_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$P_main = $row[0];
$P_alt = $row[1];
$P_adr3 = $row[2];
if ($P_adr3 == "$phone_search")
{$alt_dial='ADDR3';}
if ($P_alt == "$phone_search")
{$alt_dial='ALT';}
if ($P_main == "$phone_search")
{$alt_dial='MAIN';}
if ($alt_dial=='')
{
$result = 'ERROR';
$result_reason = "phone number lead_id search not found";
$data = "$value|$lead_id|$alt_dial";
echo "$result: $result_reason - $agent_user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
}
}
if ($alt_dial=='ALT')
{$stmtPF = "select alt_phone,phone_code from vicidial_list where lead_id='$lead_id';";}
if ($alt_dial=='ADDR3')
+15 -4
View File
@@ -346,12 +346,13 @@
# 140214-1852 - Added preview_dial_action API function
# 140215-2051 - Added several variable options for QM socket URL
# 140217-0803 - Small fix for campaigns with no lists
# 140301-2348 - Small change for new API MANUALNEXT option
#
$version = '2.8-243';
$build = '140217-0803';
$version = '2.8-244';
$build = '140301-2348';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=543;
$mysql_log_count=544;
$one_mysql_log=0;
require_once("dbconnect_mysqli.php");
@@ -1447,7 +1448,7 @@ if ($ACTION == 'manDiaLnextCaLL')
{
##### grab number of calls today in this campaign and increment
$eac_phone='';
$stmt="SELECT calls_today,extension FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';";
$stmt="SELECT calls_today,extension,external_dial FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';";
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00015',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
@@ -1457,11 +1458,21 @@ if ($ACTION == 'manDiaLnextCaLL')
$row=mysqli_fetch_row($rslt);
$calls_today = $row[0];
$eac_phone = $row[1];
$ed_vla = $row[2];
}
else
{$calls_today ='0';}
$calls_today++;
if (preg_match("/^MANUALNEXT/",$ed_vla))
{
$stmt = "UPDATE vicidial_live_agents set external_dial='' where user='$user';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00544',$user,$server_ip,$session_name,$one_mysql_log);}
$VLAEDXaffected_rows = mysqli_affected_rows($link);
}
$script_recording_delay=0;
##### find if script contains recording fields
$stmt="SELECT count(*) FROM vicidial_scripts vs,vicidial_campaigns vc WHERE campaign_id='$campaign' and vs.script_id=vc.campaign_script and script_text LIKE \"%--A--recording_%\";";
+37 -25
View File
@@ -420,10 +420,11 @@
# 140126-0741 - Added pause code API function
# 140204-1230 - Added check for valid date in call log view
# 140214-1851 - Added preview_dial_action API function
# 140301-2059 - Added API functions options for SEARCH for phone within lead_id and Dial Next Number
#
$version = '2.8-389c';
$build = '140214-1851';
$version = '2.8-390c';
$build = '140301-2059';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=79;
$one_mysql_log=0;
@@ -4899,30 +4900,41 @@ function set_length(SLnumber,SLlength_goal,SLdirection)
}
else
{
APIDiaL_ID = APIDiaL_array_detail[6];
document.vicidial_form.MDDiaLCodE.value = APIDiaL_array_detail[1];
document.vicidial_form.phone_code.value = APIDiaL_array_detail[1];
document.vicidial_form.MDPhonENumbeR.value = APIDiaL_array_detail[0];
document.vicidial_form.vendor_lead_code.value = APIDiaL_array_detail[5];
prefix_choice = APIDiaL_array_detail[7];
active_group_alias = APIDiaL_array_detail[8];
cid_choice = APIDiaL_array_detail[9];
vtiger_callback_id = APIDiaL_array_detail[10];
document.vicidial_form.MDLeadID.value = APIDiaL_array_detail[11];
document.vicidial_form.MDType.value = APIDiaL_array_detail[12];
// alert(APIDiaL_array_detail[1] + "-----" + APIDiaL + "-----" + document.vicidial_form.MDDiaLCodE.value + "-----" + document.vicidial_form.phone_code.value);
if (APIDiaL_array_detail[2] == 'YES') // lookup lead in system
{document.vicidial_form.LeadLookuP.checked=true;}
if (APIDiaL_array_detail[0] == 'MANUALNEXT') // trigger Dial Next Number button
{
if (APIDiaL_array_detail[4] == 'YES') // focus on vicidial agent screen
{window.focus(); alert_box("Placing call to next number");}
if (APIDiaL_array_detail[3] == 'YES')
{document.vicidial_form.LeadPreview.checked=true;}
ManualDialNext('','','','','','0');
}
else
{document.vicidial_form.LeadLookuP.checked=false;}
if (APIDiaL_array_detail[4] == 'YES') // focus on vicidial agent screen
{window.focus(); alert_box("Placing call to:" + APIDiaL_array_detail[1] + " " + APIDiaL_array_detail[0]);}
if (APIDiaL_array_detail[3] == 'YES') // call preview
{NeWManuaLDiaLCalLSubmiT('PREVIEW');}
else
{NeWManuaLDiaLCalLSubmiT('NOW');}
{
APIDiaL_ID = APIDiaL_array_detail[6];
document.vicidial_form.MDDiaLCodE.value = APIDiaL_array_detail[1];
document.vicidial_form.phone_code.value = APIDiaL_array_detail[1];
document.vicidial_form.MDPhonENumbeR.value = APIDiaL_array_detail[0];
document.vicidial_form.vendor_lead_code.value = APIDiaL_array_detail[5];
prefix_choice = APIDiaL_array_detail[7];
active_group_alias = APIDiaL_array_detail[8];
cid_choice = APIDiaL_array_detail[9];
vtiger_callback_id = APIDiaL_array_detail[10];
document.vicidial_form.MDLeadID.value = APIDiaL_array_detail[11];
document.vicidial_form.MDType.value = APIDiaL_array_detail[12];
// alert(APIDiaL_array_detail[1] + "-----" + APIDiaL + "-----" + document.vicidial_form.MDDiaLCodE.value + "-----" + document.vicidial_form.phone_code.value);
if (APIDiaL_array_detail[2] == 'YES') // lookup lead in system
{document.vicidial_form.LeadLookuP.checked=true;}
else
{document.vicidial_form.LeadLookuP.checked=false;}
if (APIDiaL_array_detail[4] == 'YES') // focus on vicidial agent screen
{window.focus(); alert_box("Placing call to:" + APIDiaL_array_detail[1] + " " + APIDiaL_array_detail[0]);}
if (APIDiaL_array_detail[3] == 'YES') // call preview
{NeWManuaLDiaLCalLSubmiT('PREVIEW');}
else
{NeWManuaLDiaLCalLSubmiT('NOW');}
}
}
}
if ( (in_lead_preview_state==1) || (alt_dial_status_display==1) )