Added add_dnc_phone and add_fpg_phone Non-agent API functions
git-svn-id: svn://192.168.202.10@3165 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2019-11-07
|
||||
NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2019-11-13
|
||||
|
||||
This document describes the functions of an API(Application Programming
|
||||
Interface) for all functions NOT directly relating to the VICIDIAL Agent screen.
|
||||
@@ -51,6 +51,9 @@ call_dispo_report - call disposition breakdown report
|
||||
lead_callback_info - outputs scheduled callback data for a specific lead
|
||||
agent_campaigns - looks up allowed campaigns/in-groups for a specific user
|
||||
update_cid_group_entry - updates CID Group entries
|
||||
add_dnc_phone - adds a phone number to one of the DNC lists
|
||||
add_fpg_phone - adds a phone number to a Filter Phone Group
|
||||
|
||||
|
||||
New scripts:
|
||||
/vicidial/non_agent_api.php - the script that is accessed to execute commands
|
||||
@@ -147,6 +150,7 @@ Changes:
|
||||
190703-0858 - Added custom_fields_copy option to add_list function
|
||||
190930-1629 - Added list_description field to add_list and update_list functions
|
||||
191107-1143 - Added list_info function
|
||||
191113-1758 - Added add_dnc_phone and add_fpg_phone functions
|
||||
|
||||
|
||||
API Functions use the 'function' variable
|
||||
@@ -1205,6 +1209,50 @@ SUCCESS: add_group_alias GROUP ALIAS HAS BEEN ADDED - 6666|7275551212|test_group
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
add_dnc_phone - adds phone number to a DNC list in the system
|
||||
|
||||
NOTE: api user for this function must have user_level set to 8 or higher and "modify lists" enabled
|
||||
|
||||
REQUIRED FIELDS-
|
||||
phone_number - 6-20 characters
|
||||
campaign_id - 2-30 characters, should be a valid campaign ID or "SYSTEM_INTERNAL" for the internal DNC list
|
||||
|
||||
Example URL strings for API calls:
|
||||
http://server/vicidial/non_agent_api.php?source=test&function=add_dnc_phone&user=6666&pass=1234&phone_number=7275551212&campaign_id=TESTCAMP
|
||||
http://server/vicidial/non_agent_api.php?source=test&function=add_dnc_phone&user=6666&pass=1234&phone_number=7275551212&campaign_id=SYSTEM_INTERNAL
|
||||
|
||||
Example responses:
|
||||
ERROR: add_dnc_phone USER DOES NOT HAVE PERMISSION TO ADD DNC NUMBERS - 6666|0
|
||||
ERROR: add_dnc_phone YOU MUST USE ALL REQUIRED FIELDS - 6666|||1000
|
||||
ERROR: add_dnc_phone DNC NUMBER ALREADY EXISTS - 6666|7275551212
|
||||
SUCCESS: add_dnc_phone DNC NUMBER HAS BEEN ADDED - 6666|7275551212|TESTCAMP
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
add_fpg_phone - adds phone number to a Filter Phone Group in the system
|
||||
|
||||
NOTE: api user for this function must have user_level set to 8 or higher and "modify lists" enabled
|
||||
|
||||
REQUIRED FIELDS-
|
||||
phone_number - 6-20 characters
|
||||
group - 2-30 characters, should be a valid Filter Phone Group ID in the system
|
||||
|
||||
Example URL strings for API calls:
|
||||
http://server/vicidial/non_agent_api.php?source=test&function=add_fpg_phone&user=6666&pass=1234&phone_number=7275551212&group=TEST_IN_FILTER
|
||||
|
||||
Example responses:
|
||||
ERROR: add_fpg_phone USER DOES NOT HAVE PERMISSION TO ADD FILTER PHONE GROUP NUMBERS - 6666|0
|
||||
ERROR: add_fpg_phone YOU MUST USE ALL REQUIRED FIELDS - 6666|||1000
|
||||
ERROR: add_fpg_phone FILTER PHONE GROUP DOES NOT EXIST - 6666|TEST_IN_FILTER2
|
||||
ERROR: add_fpg_phone FILTER PHONE GROUP NUMBER ALREADY EXISTS - 6666|7275551212|TEST_IN_FILTER
|
||||
SUCCESS: add_fpg_phone FILTER PHONE GROUP NUMBER HAS BEEN ADDED - 6666|7275551212|TEST_IN_FILTER
|
||||
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
add_phone - adds a phone to the system
|
||||
|
||||
@@ -128,7 +128,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 list_info update_log_entry update_phone update_phone_alias update_user user_group_status vm_list webphone_url webserver logged_in_agents update_campaign update_did lead_field_info phone_number_log switch_lead ccc_lead_info lead_status_search call_status_stats calls_in_queue_count force_fronter_leave_3way force_fronter_audio_stop update_cid_group_entry';
|
||||
$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 list_info update_log_entry update_phone update_phone_alias update_user user_group_status vm_list webphone_url webserver logged_in_agents update_campaign update_did lead_field_info phone_number_log switch_lead ccc_lead_info lead_status_search call_status_stats calls_in_queue_count force_fronter_leave_3way force_fronter_audio_stop update_cid_group_entry add_dnc_phone add_fpg_phone';
|
||||
|
||||
|
||||
### BEGIN housecleaning of old static report files, if not done before ###
|
||||
@@ -4585,12 +4585,13 @@ else
|
||||
# 191107-2356 - Added Dial Timeout Lead Container functionality
|
||||
# 191111-0833 - Added LTMGAD/XAMMAD Hotkey options
|
||||
# 191111-1601 - Added additional user status group setting(status_group_id)
|
||||
# 191113-1751 - Added add_dnc_phone add_fpg_phone API functions
|
||||
#
|
||||
|
||||
# make sure you have added a user to the vicidial_users MySQL table with at least user_level 9 to access this page the first time
|
||||
|
||||
$admin_version = '2.14-727a';
|
||||
$build = '191111-1601';
|
||||
$admin_version = '2.14-728a';
|
||||
$build = '191113-1751';
|
||||
|
||||
$STARTtime = date("U");
|
||||
$SQLdate = date("Y-m-d H:i:s");
|
||||
|
||||
@@ -140,10 +140,11 @@
|
||||
# 190703-0858 - Added custom_fields_copy option to add_list function
|
||||
# 190930-1629 - Added list_description field to add_list and update_list functions
|
||||
# 191107-1143 - Added list_info function
|
||||
# 191113-1758 - Added add_dnc_phone and add_fpg_phone functions
|
||||
#
|
||||
|
||||
$version = '2.14-117';
|
||||
$build = '191107-1143';
|
||||
$version = '2.14-118';
|
||||
$build = '191113-1758';
|
||||
$api_url_log = 0;
|
||||
|
||||
$startMS = microtime();
|
||||
@@ -3056,6 +3057,220 @@ if ($function == 'add_group_alias')
|
||||
|
||||
|
||||
|
||||
################################################################################
|
||||
### add_dnc_phone - adds a phone number to a DNC list in the system
|
||||
################################################################################
|
||||
if ($function == 'add_dnc_phone')
|
||||
{
|
||||
if(strlen($source)<2)
|
||||
{
|
||||
$result = 'ERROR';
|
||||
$result_reason = "Invalid Source";
|
||||
echo "$result: $result_reason - $source\n";
|
||||
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
|
||||
echo "ERROR: Invalid Source: |$source|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( (!preg_match("/ $function /",$api_allowed_functions)) and (!preg_match("/ALL_FUNCTIONS/",$api_allowed_functions)) )
|
||||
{
|
||||
$result = 'ERROR';
|
||||
$result_reason = "auth USER DOES NOT HAVE PERMISSION TO USE THIS FUNCTION";
|
||||
echo "$result: $result_reason: |$user|$function|\n";
|
||||
$data = "$allowed_user";
|
||||
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
|
||||
exit;
|
||||
}
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and modify_lists='1' and user_level >= 8 and active='Y';";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$allowed_user=$row[0];
|
||||
if ($allowed_user < 1)
|
||||
{
|
||||
$result = 'ERROR';
|
||||
$result_reason = "add_dnc_phone USER DOES NOT HAVE PERMISSION TO ADD DNC NUMBERS";
|
||||
$data = "$allowed_user";
|
||||
echo "$result: $result_reason: |$user|$data\n";
|
||||
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( (strlen($phone_number) < 6) or (strlen($campaign_id) < 1) )
|
||||
{
|
||||
$result = 'ERROR';
|
||||
$result_reason = "add_dnc_phone YOU MUST USE ALL REQUIRED FIELDS";
|
||||
$data = "$phone_number|$campaign_id";
|
||||
echo "$result: $result_reason: |$user|$data\n";
|
||||
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from vicidial_campaign_dnc where phone_number='$phone_number' and campaign_id='$campaign_id';";
|
||||
if ($campaign_id == 'SYSTEM_INTERNAL')
|
||||
{$stmt="SELECT count(*) from vicidial_dnc where phone_number='$phone_number';";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$dnc_exists=$row[0];
|
||||
if ($dnc_exists > 0)
|
||||
{
|
||||
$result = 'ERROR';
|
||||
$result_reason = "add_dnc_phone DNC NUMBER ALREADY EXISTS";
|
||||
$data = "$phone_number|$campaign_id";
|
||||
echo "$result: $result_reason: |$user|$data\n";
|
||||
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmtA="INSERT INTO vicidial_campaign_dnc (phone_number,campaign_id) values('$phone_number','$campaign_id');";
|
||||
if ($campaign_id == 'SYSTEM_INTERNAL')
|
||||
{$stmtA="INSERT INTO vicidial_dnc (phone_number) values('$phone_number');";}
|
||||
$rslt=mysql_to_mysqli($stmtA, $link);
|
||||
$affected_rowsA = mysqli_affected_rows($link);
|
||||
|
||||
$stmtB="INSERT INTO vicidial_dnc_log SET phone_number='$phone_number', campaign_id='$campaign_id', action='add', action_date=NOW(), user='$user';";
|
||||
if ($campaign_id == 'SYSTEM_INTERNAL')
|
||||
{$stmtB="INSERT INTO vicidial_dnc_log SET phone_number='$phone_number', campaign_id='-SYSINT-', action='add', action_date=NOW(), user='$user';";}
|
||||
$rslt=mysql_to_mysqli($stmtB, $link);
|
||||
$affected_rowsB = mysqli_affected_rows($link);
|
||||
|
||||
### LOG INSERTION Admin Log Table ###
|
||||
$SQL_log = "$stmt|";
|
||||
$SQL_log = preg_replace('/;/', '', $SQL_log);
|
||||
$SQL_log = addslashes($SQL_log);
|
||||
$stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$user', ip_address='$ip', event_section='LISTS', event_type='ADD', record_id='$phone_number', event_code='ADMIN API ADD DNC NUMBER', event_sql=\"$SQL_log\", event_notes='$phone_number|$campaign_id|$affected_rowsA|$affected_rowsB';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
|
||||
$result = 'SUCCESS';
|
||||
$result_reason = "add_dnc_phone DNC NUMBER HAS BEEN ADDED";
|
||||
$data = "$phone_number|$campaign_id";
|
||||
echo "$result: $result_reason - $user|$data\n";
|
||||
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
exit;
|
||||
}
|
||||
################################################################################
|
||||
### END add_dnc_phone
|
||||
################################################################################
|
||||
|
||||
|
||||
################################################################################
|
||||
### add_fpg_phone - adds a phone number to a Filter Phone Group in the system
|
||||
################################################################################
|
||||
if ($function == 'add_fpg_phone')
|
||||
{
|
||||
if(strlen($source)<2)
|
||||
{
|
||||
$result = 'ERROR';
|
||||
$result_reason = "Invalid Source";
|
||||
echo "$result: $result_reason - $source\n";
|
||||
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
|
||||
echo "ERROR: Invalid Source: |$source|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( (!preg_match("/ $function /",$api_allowed_functions)) and (!preg_match("/ALL_FUNCTIONS/",$api_allowed_functions)) )
|
||||
{
|
||||
$result = 'ERROR';
|
||||
$result_reason = "auth USER DOES NOT HAVE PERMISSION TO USE THIS FUNCTION";
|
||||
echo "$result: $result_reason: |$user|$function|\n";
|
||||
$data = "$allowed_user";
|
||||
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
|
||||
exit;
|
||||
}
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and modify_lists='1' and user_level >= 8 and active='Y';";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$allowed_user=$row[0];
|
||||
if ($allowed_user < 1)
|
||||
{
|
||||
$result = 'ERROR';
|
||||
$result_reason = "add_fpg_phone USER DOES NOT HAVE PERMISSION TO ADD FILTER PHONE GROUP NUMBERS";
|
||||
$data = "$allowed_user";
|
||||
echo "$result: $result_reason: |$user|$data\n";
|
||||
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( (strlen($phone_number) < 6) or (strlen($group) < 1) )
|
||||
{
|
||||
$result = 'ERROR';
|
||||
$result_reason = "add_fpg_phone YOU MUST USE ALL REQUIRED FIELDS";
|
||||
$data = "$phone_number|$group";
|
||||
echo "$result: $result_reason: |$user|$data\n";
|
||||
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from vicidial_filter_phone_groups where filter_phone_group_id='$group';";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$fpg_exists=$row[0];
|
||||
if ($fpg_exists < 1)
|
||||
{
|
||||
$result = 'ERROR';
|
||||
$result_reason = "add_fpg_phone FILTER PHONE GROUP DOES NOT EXIST";
|
||||
$data = "$group";
|
||||
echo "$result: $result_reason: |$user|$data\n";
|
||||
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from vicidial_filter_phone_numbers where phone_number='$phone_number' and filter_phone_group_id='$group';";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$fpg_entry_exists=$row[0];
|
||||
if ($fpg_entry_exists > 0)
|
||||
{
|
||||
$result = 'ERROR';
|
||||
$result_reason = "add_fpg_phone FILTER PHONE GROUP NUMBER ALREADY EXISTS";
|
||||
$data = "$phone_number|$group";
|
||||
echo "$result: $result_reason: |$user|$data\n";
|
||||
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmtA="INSERT INTO vicidial_filter_phone_numbers (phone_number,filter_phone_group_id) values('$phone_number','$group');";
|
||||
$rslt=mysql_to_mysqli($stmtA, $link);
|
||||
$affected_rowsA = mysqli_affected_rows($link);
|
||||
|
||||
### LOG INSERTION Admin Log Table ###
|
||||
$SQL_log = "$stmt|";
|
||||
$SQL_log = preg_replace('/;/', '', $SQL_log);
|
||||
$SQL_log = addslashes($SQL_log);
|
||||
$stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$user', ip_address='$ip', event_section='FILTERPHONEGROUPS', event_type='ADD', record_id='$phone_number', event_code='ADMIN API ADD NUMBER TO FILTER PHONE GROUP $group', event_sql=\"$SQL_log\", event_notes='$phone_number|$group|$affected_rowsA';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
|
||||
$result = 'SUCCESS';
|
||||
$result_reason = "add_fpg_phone FILTER PHONE GROUP NUMBER HAS BEEN ADDED";
|
||||
$data = "$phone_number|$group";
|
||||
echo "$result: $result_reason - $user|$data\n";
|
||||
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
exit;
|
||||
}
|
||||
################################################################################
|
||||
### END add_fpg_phone
|
||||
################################################################################
|
||||
|
||||
|
||||
################################################################################
|
||||
### add_phone - adds phone to the phones table
|
||||
################################################################################
|
||||
|
||||
Reference in New Issue
Block a user