Added delete_fpg_phone Non-Agent API function
git-svn-id: svn://192.168.202.10@3794 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
+26
-1
@@ -1,4 +1,4 @@
|
||||
NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2024-01-01
|
||||
NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2024-01-05
|
||||
|
||||
This document describes the functions of an API(Application Programming
|
||||
Interface) for all functions NOT directly relating to the VICIDIAL Agent screen.
|
||||
@@ -60,6 +60,7 @@ 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
|
||||
delete_fpg_phone - removes a phone number from a Filter Phone Group
|
||||
campaigns_list - displays information about all campaigns in the system
|
||||
hopper_list - displays information about leads in the hopper for a campaign
|
||||
update_alt_url - updates/adds/displays alternate dispo call url entries for a campaign
|
||||
@@ -213,6 +214,7 @@ Changes:
|
||||
231109-0933 - Added archived_lead option to multiple functions
|
||||
231109-2022 - Added lead_dearchive function
|
||||
240101-0920 - Added DUPPHONEALT... options for duplicate_check within add_lead function
|
||||
240105-1009 - Added delete_fpg_phone function
|
||||
|
||||
|
||||
API Functions use the 'function' variable
|
||||
@@ -1624,6 +1626,29 @@ SUCCESS: add_fpg_phone FILTER PHONE GROUP NUMBER HAS BEEN ADDED - 6666|727555121
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
delete_fpg_phone - removes phone number from 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=delete_fpg_phone&user=6666&pass=1234&phone_number=7275551212&group=TEST_IN_FILTER
|
||||
|
||||
Example responses:
|
||||
ERROR: delete_fpg_phone USER DOES NOT HAVE PERMISSION TO DELETE FILTER PHONE GROUP NUMBERS - 6666|0
|
||||
ERROR: delete_fpg_phone YOU MUST USE ALL REQUIRED FIELDS - 6666|||1000
|
||||
ERROR: delete_fpg_phone FILTER PHONE GROUP DOES NOT EXIST - 6666|TEST_IN_FILTER2
|
||||
ERROR: delete_fpg_phone FILTER PHONE GROUP NUMBER DOES NOT EXIST - 6666|7275551212|TEST_IN_FILTER
|
||||
SUCCESS: delete_fpg_phone FILTER PHONE GROUP NUMBER HAS BEEN DELETED - 6666|7275551212|TEST_IN_FILTER
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
add_phone - adds a phone to the system
|
||||
|
||||
|
||||
@@ -206,10 +206,11 @@
|
||||
# 231109-0933 - Added archived_lead option to multiple functions
|
||||
# 231109-2022 - Added lead_dearchive function
|
||||
# 240101-0920 - Added DUPPHONEALT... options for duplicate_check within add_lead function
|
||||
# 240105-1009 - Added delete_fpg_phone function
|
||||
#
|
||||
|
||||
$version = '2.14-183';
|
||||
$build = '240101-0920';
|
||||
$version = '2.14-184';
|
||||
$build = '240105-1009';
|
||||
$php_script='non_agent_api.php';
|
||||
$api_url_log = 0;
|
||||
|
||||
@@ -4902,7 +4903,7 @@ if ($function == 'add_fpg_phone')
|
||||
$affected_rowsA = mysqli_affected_rows($link);
|
||||
|
||||
### LOG INSERTION Admin Log Table ###
|
||||
$SQL_log = "$stmt|";
|
||||
$SQL_log = "$stmtA|";
|
||||
$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';";
|
||||
@@ -4926,6 +4927,116 @@ if ($function == 'add_fpg_phone')
|
||||
################################################################################
|
||||
|
||||
|
||||
################################################################################
|
||||
### delete_fpg_phone - removes a phone number from a Filter Phone Group in the system
|
||||
################################################################################
|
||||
if ($function == 'delete_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 = "delete_fpg_phone USER DOES NOT HAVE PERMISSION TO DELETE 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 = "delete_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 = "delete_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 < 1)
|
||||
{
|
||||
$result = 'ERROR';
|
||||
$result_reason = "delete_fpg_phone FILTER PHONE GROUP NUMBER DOES NOT EXIST";
|
||||
$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="DELETE FROM vicidial_filter_phone_numbers WHERE phone_number='$phone_number' and filter_phone_group_id='$group';";
|
||||
$rslt=mysql_to_mysqli($stmtA, $link);
|
||||
$affected_rowsA = mysqli_affected_rows($link);
|
||||
|
||||
### LOG INSERTION Admin Log Table ###
|
||||
$SQL_log = "$stmtA|";
|
||||
$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='DELETE', record_id='$phone_number', event_code='ADMIN API DELETE NUMBER FROM 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 = "delete_fpg_phone FILTER PHONE GROUP NUMBER HAS BEEN DELETED";
|
||||
$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 delete_fpg_phone
|
||||
################################################################################
|
||||
|
||||
|
||||
################################################################################
|
||||
### add_phone - adds phone to the phones table
|
||||
################################################################################
|
||||
|
||||
Reference in New Issue
Block a user