Added update_alt_url Non-Agent API function

Added dispo_call_url as option for update_campaign Non-Agent API function
Added display of the URL ID to the URL Multi admin page
Added email_header_attach and allow_sendmail_bypass options.php settings for dispo_call_url.php script

git-svn-id: svn://192.168.202.10@3558 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2022-01-28 02:43:52 +00:00
parent 9650fba333
commit ce9aae2385
7 changed files with 633 additions and 48 deletions
+2
View File
@@ -706,6 +706,8 @@ OTHER CHANGES:
after a set number of call attempts, and thereafter only dialing the after a set number of call attempts, and thereafter only dialing the
main phone number for the lead. main phone number for the lead.
197. Added 'update_alt_url' Non-Agent API function
+76 -1
View File
@@ -1,4 +1,4 @@
NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2021-11-18 NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2022-01-27
This document describes the functions of an API(Application Programming This document describes the functions of an API(Application Programming
Interface) for all functions NOT directly relating to the VICIDIAL Agent screen. Interface) for all functions NOT directly relating to the VICIDIAL Agent screen.
@@ -62,6 +62,7 @@ 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 add_fpg_phone - adds a phone number to a Filter Phone Group
campaigns_list - displays information about all campaigns in the system campaigns_list - displays information about all campaigns in the system
hopper_list - displays information about leads in the hopper for a campaign hopper_list - displays information about leads in the hopper for a campaign
update_alt_url - updates alternate dispo call url entries for a campaign
New scripts: New scripts:
@@ -197,6 +198,7 @@ Changes:
210917-1615 - Added batch_update_lead function 210917-1615 - Added batch_update_lead function
211107-1556 - Added optional phone_number search for lead_all_info function 211107-1556 - Added optional phone_number search for lead_all_info function
211118-1946 - Added 'delete_cf_data' setting to the update_lead function 211118-1946 - Added 'delete_cf_data' setting to the update_lead function
220126-2116 - Added dispo_call_url and alt URL options for update_campaign. Added 'update_alt_url' function
API Functions use the 'function' variable API Functions use the 'function' variable
@@ -2244,6 +2246,8 @@ xferconf_two - Transfer - Conf Number 2: 1-50 characters
xferconf_three - Transfer - Conf Number 3: 1-50 characters xferconf_three - Transfer - Conf Number 3: 1-50 characters
xferconf_four - Transfer - Conf Number 4: 1-50 characters xferconf_four - Transfer - Conf Number 4: 1-50 characters
xferconf_five - Transfer - Conf Number 5: 1-50 characters xferconf_five - Transfer - Conf Number 5: 1-50 characters
dispo_call_url - URL for the Dispo URL(If using a full non-local URL must include 'http://' or 'https://') Must be URL-encoded if sending request as a URL
EXAMPLE URL-ENCODED URL: "http://vicidial.org/query.php?var1=X&var2=y" = "http%3A%2F%2Fvicidial.org%2Fquery.php%3Fvar1%3DX%26var2%3Dy"
NOTES: NOTES:
- please use no special characters like apostrophes, quotes or amphersands - please use no special characters like apostrophes, quotes or amphersands
@@ -2251,6 +2255,8 @@ Example URL strings for API calls:
http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=update_campaign&campaign_id=TESTOUT&campaign_name=Updated+test+API+campaign&auto_dial_level=3.0 http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=update_campaign&campaign_id=TESTOUT&campaign_name=Updated+test+API+campaign&auto_dial_level=3.0
http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=update_campaign&campaign_id=TESTOUT&active=N http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=update_campaign&campaign_id=TESTOUT&active=N
http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=update_campaign&campaign_id=TESTOUT&reset_hopper=Y http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=update_campaign&campaign_id=TESTOUT&reset_hopper=Y
http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=update_campaign&campaign_id=TESTOUT&dispo_call_url=http%3A%2F%2Fvicidial.org%2Fquery.php%3Fvar1%3DX%26var2%3Dy
http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=update_campaign&campaign_id=TESTOUT&dispo_call_url=ALT
Example responses: Example responses:
ERROR: update_campaign USER DOES NOT HAVE PERMISSION TO UPDATE CAMPAIGNS - 6666 ERROR: update_campaign USER DOES NOT HAVE PERMISSION TO UPDATE CAMPAIGNS - 6666
@@ -2279,6 +2285,75 @@ SUCCESS: update_campaign CAMPAIGN HAS BEEN UPDATED - 6666|1101
--------------------------------------------------------------------------------
update_alt_url - updates alternate dispo call url entries for a campaign
NOTE: api user for this function must have user_level set to 8 or higher and "modify campaigns" enabled
REQUIRED FIELDS-
campaign_id - 2-8 characters
source - description of what originated the API call (maximum 20 characters)
entry_type - One of these: 'campaign'
url_type - One of these: 'dispo','start','addlead','noagent'
alt_url_id - Digits only, 'NEW' or 'LIST'. Must be a valid alt URL ID for this campaign, or set to 'NEW' to add a new ALT URL
NOTE: If only one Alt URL exists for this campaign and type, then this field can be left blank
NOTE: 'stage'(csv, tab, pipe[default]) and 'header'(YES, NO) options are available for an alt_url_id of 'LIST'
EDITABLE FIELDS-
active - One of these: 'Y','N', default is 'N'
url_rank - Digits only
url_statuses - FOR DISPO URLs ONLY! List of dispo statuses this URL is active for, separated by spaces, i.e.: "SALE1 SALE2" or can be set to "---ALL---"
url_description - Text description of the alt URL
url_lists - Lists that the URL is active for, separated by spaces, i.e.: "101 102" or can be set to blank "" for all lists
url_call_length - Digits only. Only calls that are this minimum length in seconds and higher, default is 0
url_address - URL for the Alt URL(If using a full non-local URL must include 'http://' or 'https://') Must be URL-encoded if sending request as a URL
EXAMPLE URL-ENCODED URL: "http://vicidial.org/query.php?var1=X&var2=y" = "http%3A%2F%2Fvicidial.org%2Fquery.php%3Fvar1%3DX%26var2%3Dy"
NOTES:
- Please use no special characters like apostrophes, quotes or amphersands
- A value of '--BLANK--' can be used on the url_description and url_lists options above to set their values to empty
Example URL strings for API calls:
http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=update_alt_url&campaign_id=ALTTEST&entry_type=campaign&url_type=dispo&alt_url_id=3&active=N
http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=update_alt_url&campaign_id=ALTTEST&entry_type=campaign&url_type=dispo&alt_url_id=3&url_rank=2
http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=update_alt_url&campaign_id=ALTTEST&entry_type=campaign&url_type=dispo&alt_url_id=3&url_statuses=SALE+PSALE
http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=update_alt_url&campaign_id=ALTTEST&entry_type=campaign&url_type=dispo&alt_url_id=3&url_description=Updated+SALE+URL
http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=update_alt_url&campaign_id=ALTTEST&entry_type=campaign&url_type=dispo&alt_url_id=3&url_lists=101+102
http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=update_alt_url&campaign_id=ALTTEST&entry_type=campaign&url_type=dispo&alt_url_id=3&url_call_length=2
http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=update_alt_url&campaign_id=ALTTEST&entry_type=campaign&url_type=dispo&alt_url_id=3&url_address=http%3A%2F%2Fvicidial.org%2Fquery.php%3Fvar1%3DX%26var2%3Dy
http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=update_alt_url&campaign_id=ALTTEST&entry_type=campaign&url_type=dispo&alt_url_id=LIST
http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=update_alt_url&campaign_id=ALTTEST&entry_type=campaign&url_type=dispo&alt_url_id=NEW&url_statuses=PRQUAL&url_description=Testing&url_address=http%3A%2F%2Fvicidial.org%2Fquery.php%3Fvar1%3DX%26var2%3Dy
Example responses:
ERROR: update_alt_url USER DOES NOT HAVE PERMISSION TO UPDATE CAMPAIGNS - 6666
ERROR: update_alt_url YOU MUST USE ALL REQUIRED FIELDS - 6666|1
ERROR: update_alt_url NOT AN ALLOWED CAMPAIGN ID - 98762
ERROR: update_alt_url CAMPAIGN DOES NOT EXIST - 6666|1000
ERROR: update_alt_url NO VALID URL TYPE DEFINED: - 6666|||
ERROR: update_alt_url NO ENTRY TYPE DEFINED - 6666||
ERROR: update_alt_url CAMPAIGNS dispo URL IS NOT SET TO ALT - 6666|dispo|campaign|TESTCAMP
ERROR: update_alt_url ALT URL ID DOES NOT EXIST - 6666|2|dispo|campaign|TESTCAMP|2
ERROR: update_alt_url ACTIVE MUST BE Y OR N, THIS IS AN OPTIONAL FIELD - 6666|U
ERROR: update_alt_url URL ADDRESS IS NOT VALID, THIS IS AN OPTIONAL FIELD - 6666|
ERROR: update_alt_url URL RANK IS NOT VALID, THIS IS AN OPTIONAL FIELD - 6666|999999
ERROR: update_alt_url URL CAL LENGTH IS NOT VALID, THIS IS AN OPTIONAL FIELD - 6666|999999
ERROR: update_alt_url URL STATUSES IS NOT VALID, THIS IS AN OPTIONAL FIELD - 6666|
ERROR: update_alt_url URL DESCRIPTION IS NOT VALID, THIS IS AN OPTIONAL FIELD - 6666|
ERROR: update_alt_url URL LISTS IS NOT VALID, THIS IS AN OPTIONAL FIELD - 6666|
NOTICE: update_campaign NO UPDATES DEFINED - 6666|
SUCCESS: update_alt_url ALT URL HAS BEEN UPDATED - 6666|1|dispo|campaign|TESTCAMP
SUCCESS: update_alt_url ALT URL HAS BEEN ADDED - 6666|NEW URL ID: 2|dispo|campaign|TESTCAMP
NOTICE: update_alt_url LIST, No Records Found - 6666|dispo|campaign|TESTCAMP|0
A LIST response will not show "SUCCESS", but instead will just print the results in the following format:
url_id|campaign_id|entry_type|active|url_type|url_rank|url_statuses|url_description|url_lists|url_call_length|url_address
3|ALTTEST|campaign|Y|dispo|2|SALE PSALE|Updated SALE URL||2|http://vicidial.org/query.php?var1=X&var2=y
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
add_did - adds new Inbound DID entries to the system in the vicidial_inbound_dids table add_did - adds new Inbound DID entries to the system in the vicidial_inbound_dids table
+49 -32
View File
@@ -1,7 +1,7 @@
<?php <?php
# dispo_send_email.php # dispo_send_email.php
# #
# Copyright (C) 2021 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2 # Copyright (C) 2022 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# #
# This script is designed to be used in the "Dispo URL" field of a campaign # This script is designed to be used in the "Dispo URL" field of a campaign
# or in-group. It will send out an email to a fixed email address as defined # or in-group. It will send out an email to a fixed email address as defined
@@ -45,6 +45,7 @@
# 210616-2044 - Added optional CORS support, see options.php for details # 210616-2044 - Added optional CORS support, see options.php for details
# 210823-1623 - Fix for security issue, removed absolute path attachments, now must be in "agc/attachments" directory # 210823-1623 - Fix for security issue, removed absolute path attachments, now must be in "agc/attachments" directory
# 210823-1947 - Fix to allow for legacy attachment file locations in "agc" directory # 210823-1947 - Fix to allow for legacy attachment file locations in "agc" directory
# 220127-0942 - Added email_header_attach and allow_sendmail_bypass options.php settings
# #
$api_script = 'send_email'; $api_script = 'send_email';
@@ -150,6 +151,9 @@ $email_charset = 'iso-8859-1';
#$email_attachment_path = '/dev/null'; #$email_attachment_path = '/dev/null';
$email_attachment_path = './attachments'; $email_attachment_path = './attachments';
$email_attachment_path_legacy = '.'; $email_attachment_path_legacy = '.';
$email_header_attach='0';
$sendmail_bypass=0;
$allow_sendmail_bypass='';
# filter variables # filter variables
$user=preg_replace("/\'|\"|\\\\|;| |\|/","",$user); $user=preg_replace("/\'|\"|\\\\|;| |\|/","",$user);
@@ -164,6 +168,9 @@ if (file_exists('options.php'))
header ("Content-type: text/html; charset=utf-8"); header ("Content-type: text/html; charset=utf-8");
$EHA='';
if ($email_header_attach > 0) {$EHA="\n\n";}
############################################# #############################################
##### START SYSTEM_SETTINGS AND USER LANGUAGE LOOKUP ##### ##### START SYSTEM_SETTINGS AND USER LANGUAGE LOOKUP #####
$VUselected_language = ''; $VUselected_language = '';
@@ -378,6 +385,8 @@ if ($match_found > 0)
{$email_charset = 'utf-8';} {$email_charset = 'utf-8';}
if (preg_match("/^email_body_begin/",$line)) if (preg_match("/^email_body_begin/",$line))
{$email_body = $line; $email_body = trim(preg_replace("/.*=/",'',$email_body)) . "\n"; $email_body_gather++;} {$email_body = $line; $email_body = trim(preg_replace("/.*=/",'',$email_body)) . "\n"; $email_body_gather++;}
if ( (preg_match("/^sendmail_bypass/",$line)) and (strlen($allow_sendmail_bypass) > 2) )
{$sendmail_bypass=1;}
} }
else else
{ {
@@ -808,7 +817,7 @@ if ($match_found > 0)
// Edit content type for different file extensions // Edit content type for different file extensions
$attachment_1 .= "Content-Type: application/xml; name=\"".$filename_1."\"".PHP_EOL; $attachment_1 .= "Content-Type: application/xml; name=\"".$filename_1."\"".PHP_EOL;
$attachment_1 .= "Content-Transfer-Encoding: base64".PHP_EOL; $attachment_1 .= "Content-Transfer-Encoding: base64".PHP_EOL;
$attachment_1 .= "Content-Disposition: attachment; filename=\"".$filename_1."\"".PHP_EOL.PHP_EOL; $attachment_1 .= "Content-Disposition: attachment; filename=\"".$filename_1."\"$EHA".PHP_EOL.PHP_EOL;
$attachment_1 .= $content.PHP_EOL; $attachment_1 .= $content.PHP_EOL;
$attachment_1 .= "--".$boundary; $attachment_1 .= "--".$boundary;
@@ -847,7 +856,7 @@ if ($match_found > 0)
// Edit content type for different file extensions // Edit content type for different file extensions
$attachment_2 .= "Content-Type: application/xml; name=\"".$filename_2."\"".PHP_EOL; $attachment_2 .= "Content-Type: application/xml; name=\"".$filename_2."\"".PHP_EOL;
$attachment_2 .= "Content-Transfer-Encoding: base64".PHP_EOL; $attachment_2 .= "Content-Transfer-Encoding: base64".PHP_EOL;
$attachment_2 .= "Content-Disposition: attachment; filename=\"".$filename_2."\"".PHP_EOL.PHP_EOL; $attachment_2 .= "Content-Disposition: attachment; filename=\"".$filename_2."\"$EHA".PHP_EOL.PHP_EOL;
$attachment_2 .= $content.PHP_EOL; $attachment_2 .= $content.PHP_EOL;
$attachment_2 .= "--".$boundary; $attachment_2 .= "--".$boundary;
@@ -886,7 +895,7 @@ if ($match_found > 0)
// Edit content type for different file extensions // Edit content type for different file extensions
$attachment_3 .= "Content-Type: application/xml; name=\"".$filename_3."\"".PHP_EOL; $attachment_3 .= "Content-Type: application/xml; name=\"".$filename_3."\"".PHP_EOL;
$attachment_3 .= "Content-Transfer-Encoding: base64".PHP_EOL; $attachment_3 .= "Content-Transfer-Encoding: base64".PHP_EOL;
$attachment_3 .= "Content-Disposition: attachment; filename=\"".$filename_3."\"".PHP_EOL.PHP_EOL; $attachment_3 .= "Content-Disposition: attachment; filename=\"".$filename_3."\"$EHA".PHP_EOL.PHP_EOL;
$attachment_3 .= $content.PHP_EOL; $attachment_3 .= $content.PHP_EOL;
$attachment_3 .= "--".$boundary; $attachment_3 .= "--".$boundary;
@@ -925,7 +934,7 @@ if ($match_found > 0)
// Edit content type for different file extensions // Edit content type for different file extensions
$attachment_4 .= "Content-Type: application/xml; name=\"".$filename_4."\"".PHP_EOL; $attachment_4 .= "Content-Type: application/xml; name=\"".$filename_4."\"".PHP_EOL;
$attachment_4 .= "Content-Transfer-Encoding: base64".PHP_EOL; $attachment_4 .= "Content-Transfer-Encoding: base64".PHP_EOL;
$attachment_4 .= "Content-Disposition: attachment; filename=\"".$filename_4."\"".PHP_EOL.PHP_EOL; $attachment_4 .= "Content-Disposition: attachment; filename=\"".$filename_4."\"$EHA".PHP_EOL.PHP_EOL;
$attachment_4 .= $content.PHP_EOL; $attachment_4 .= $content.PHP_EOL;
$attachment_4 .= "--".$boundary; $attachment_4 .= "--".$boundary;
@@ -964,7 +973,7 @@ if ($match_found > 0)
// Edit content type for different file extensions // Edit content type for different file extensions
$attachment_5 .= "Content-Type: application/xml; name=\"".$filename_5."\"".PHP_EOL; $attachment_5 .= "Content-Type: application/xml; name=\"".$filename_5."\"".PHP_EOL;
$attachment_5 .= "Content-Transfer-Encoding: base64".PHP_EOL; $attachment_5 .= "Content-Transfer-Encoding: base64".PHP_EOL;
$attachment_5 .= "Content-Disposition: attachment; filename=\"".$filename_5."\"".PHP_EOL.PHP_EOL; $attachment_5 .= "Content-Disposition: attachment; filename=\"".$filename_5."\"$EHA".PHP_EOL.PHP_EOL;
$attachment_5 .= $content.PHP_EOL; $attachment_5 .= $content.PHP_EOL;
$attachment_5 .= "--".$boundary; $attachment_5 .= "--".$boundary;
@@ -1003,7 +1012,7 @@ if ($match_found > 0)
// Edit content type for different file extensions // Edit content type for different file extensions
$attachment_6 .= "Content-Type: application/xml; name=\"".$filename_6."\"".PHP_EOL; $attachment_6 .= "Content-Type: application/xml; name=\"".$filename_6."\"".PHP_EOL;
$attachment_6 .= "Content-Transfer-Encoding: base64".PHP_EOL; $attachment_6 .= "Content-Transfer-Encoding: base64".PHP_EOL;
$attachment_6 .= "Content-Disposition: attachment; filename=\"".$filename_6."\"".PHP_EOL.PHP_EOL; $attachment_6 .= "Content-Disposition: attachment; filename=\"".$filename_6."\"$EHA".PHP_EOL.PHP_EOL;
$attachment_6 .= $content.PHP_EOL; $attachment_6 .= $content.PHP_EOL;
$attachment_6 .= "--".$boundary; $attachment_6 .= "--".$boundary;
@@ -1042,7 +1051,7 @@ if ($match_found > 0)
// Edit content type for different file extensions // Edit content type for different file extensions
$attachment_7 .= "Content-Type: application/xml; name=\"".$filename_7."\"".PHP_EOL; $attachment_7 .= "Content-Type: application/xml; name=\"".$filename_7."\"".PHP_EOL;
$attachment_7 .= "Content-Transfer-Encoding: base64".PHP_EOL; $attachment_7 .= "Content-Transfer-Encoding: base64".PHP_EOL;
$attachment_7 .= "Content-Disposition: attachment; filename=\"".$filename_7."\"".PHP_EOL.PHP_EOL; $attachment_7 .= "Content-Disposition: attachment; filename=\"".$filename_7."\"$EHA".PHP_EOL.PHP_EOL;
$attachment_7 .= $content.PHP_EOL; $attachment_7 .= $content.PHP_EOL;
$attachment_7 .= "--".$boundary; $attachment_7 .= "--".$boundary;
@@ -1081,7 +1090,7 @@ if ($match_found > 0)
// Edit content type for different file extensions // Edit content type for different file extensions
$attachment_8 .= "Content-Type: application/xml; name=\"".$filename_8."\"".PHP_EOL; $attachment_8 .= "Content-Type: application/xml; name=\"".$filename_8."\"".PHP_EOL;
$attachment_8 .= "Content-Transfer-Encoding: base64".PHP_EOL; $attachment_8 .= "Content-Transfer-Encoding: base64".PHP_EOL;
$attachment_8 .= "Content-Disposition: attachment; filename=\"".$filename_8."\"".PHP_EOL.PHP_EOL; $attachment_8 .= "Content-Disposition: attachment; filename=\"".$filename_8."\"$EHA".PHP_EOL.PHP_EOL;
$attachment_8 .= $content.PHP_EOL; $attachment_8 .= $content.PHP_EOL;
$attachment_8 .= "--".$boundary; $attachment_8 .= "--".$boundary;
@@ -1120,7 +1129,7 @@ if ($match_found > 0)
// Edit content type for different file extensions // Edit content type for different file extensions
$attachment_9 .= "Content-Type: application/xml; name=\"".$filename_9."\"".PHP_EOL; $attachment_9 .= "Content-Type: application/xml; name=\"".$filename_9."\"".PHP_EOL;
$attachment_9 .= "Content-Transfer-Encoding: base64".PHP_EOL; $attachment_9 .= "Content-Transfer-Encoding: base64".PHP_EOL;
$attachment_9 .= "Content-Disposition: attachment; filename=\"".$filename_9."\"".PHP_EOL.PHP_EOL; $attachment_9 .= "Content-Disposition: attachment; filename=\"".$filename_9."\"$EHA".PHP_EOL.PHP_EOL;
$attachment_9 .= $content.PHP_EOL; $attachment_9 .= $content.PHP_EOL;
$attachment_9 .= "--".$boundary; $attachment_9 .= "--".$boundary;
@@ -1159,7 +1168,7 @@ if ($match_found > 0)
// Edit content type for different file extensions // Edit content type for different file extensions
$attachment_10 .= "Content-Type: application/xml; name=\"".$filename_10."\"".PHP_EOL; $attachment_10 .= "Content-Type: application/xml; name=\"".$filename_10."\"".PHP_EOL;
$attachment_10 .= "Content-Transfer-Encoding: base64".PHP_EOL; $attachment_10 .= "Content-Transfer-Encoding: base64".PHP_EOL;
$attachment_10 .= "Content-Disposition: attachment; filename=\"".$filename_10."\"".PHP_EOL.PHP_EOL; $attachment_10 .= "Content-Disposition: attachment; filename=\"".$filename_10."\"$EHA".PHP_EOL.PHP_EOL;
$attachment_10 .= $content.PHP_EOL; $attachment_10 .= $content.PHP_EOL;
$attachment_10 .= "--".$boundary; $attachment_10 .= "--".$boundary;
@@ -1198,7 +1207,7 @@ if ($match_found > 0)
// Edit content type for different file extensions // Edit content type for different file extensions
$attachment_11 .= "Content-Type: application/xml; name=\"".$filename_11."\"".PHP_EOL; $attachment_11 .= "Content-Type: application/xml; name=\"".$filename_11."\"".PHP_EOL;
$attachment_11 .= "Content-Transfer-Encoding: base64".PHP_EOL; $attachment_11 .= "Content-Transfer-Encoding: base64".PHP_EOL;
$attachment_11 .= "Content-Disposition: attachment; filename=\"".$filename_11."\"".PHP_EOL.PHP_EOL; $attachment_11 .= "Content-Disposition: attachment; filename=\"".$filename_11."\"$EHA".PHP_EOL.PHP_EOL;
$attachment_11 .= $content.PHP_EOL; $attachment_11 .= $content.PHP_EOL;
$attachment_11 .= "--".$boundary; $attachment_11 .= "--".$boundary;
@@ -1237,7 +1246,7 @@ if ($match_found > 0)
// Edit content type for different file extensions // Edit content type for different file extensions
$attachment_12 .= "Content-Type: application/xml; name=\"".$filename_12."\"".PHP_EOL; $attachment_12 .= "Content-Type: application/xml; name=\"".$filename_12."\"".PHP_EOL;
$attachment_12 .= "Content-Transfer-Encoding: base64".PHP_EOL; $attachment_12 .= "Content-Transfer-Encoding: base64".PHP_EOL;
$attachment_12 .= "Content-Disposition: attachment; filename=\"".$filename_12."\"".PHP_EOL.PHP_EOL; $attachment_12 .= "Content-Disposition: attachment; filename=\"".$filename_12."\"$EHA".PHP_EOL.PHP_EOL;
$attachment_12 .= $content.PHP_EOL; $attachment_12 .= $content.PHP_EOL;
$attachment_12 .= "--".$boundary; $attachment_12 .= "--".$boundary;
@@ -1276,7 +1285,7 @@ if ($match_found > 0)
// Edit content type for different file extensions // Edit content type for different file extensions
$attachment_13 .= "Content-Type: application/xml; name=\"".$filename_13."\"".PHP_EOL; $attachment_13 .= "Content-Type: application/xml; name=\"".$filename_13."\"".PHP_EOL;
$attachment_13 .= "Content-Transfer-Encoding: base64".PHP_EOL; $attachment_13 .= "Content-Transfer-Encoding: base64".PHP_EOL;
$attachment_13 .= "Content-Disposition: attachment; filename=\"".$filename_13."\"".PHP_EOL.PHP_EOL; $attachment_13 .= "Content-Disposition: attachment; filename=\"".$filename_13."\"$EHA".PHP_EOL.PHP_EOL;
$attachment_13 .= $content.PHP_EOL; $attachment_13 .= $content.PHP_EOL;
$attachment_13 .= "--".$boundary; $attachment_13 .= "--".$boundary;
@@ -1315,7 +1324,7 @@ if ($match_found > 0)
// Edit content type for different file extensions // Edit content type for different file extensions
$attachment_14 .= "Content-Type: application/xml; name=\"".$filename_14."\"".PHP_EOL; $attachment_14 .= "Content-Type: application/xml; name=\"".$filename_14."\"".PHP_EOL;
$attachment_14 .= "Content-Transfer-Encoding: base64".PHP_EOL; $attachment_14 .= "Content-Transfer-Encoding: base64".PHP_EOL;
$attachment_14 .= "Content-Disposition: attachment; filename=\"".$filename_14."\"".PHP_EOL.PHP_EOL; $attachment_14 .= "Content-Disposition: attachment; filename=\"".$filename_14."\"$EHA".PHP_EOL.PHP_EOL;
$attachment_14 .= $content.PHP_EOL; $attachment_14 .= $content.PHP_EOL;
$attachment_14 .= "--".$boundary; $attachment_14 .= "--".$boundary;
@@ -1354,7 +1363,7 @@ if ($match_found > 0)
// Edit content type for different file extensions // Edit content type for different file extensions
$attachment_15 .= "Content-Type: application/xml; name=\"".$filename_15."\"".PHP_EOL; $attachment_15 .= "Content-Type: application/xml; name=\"".$filename_15."\"".PHP_EOL;
$attachment_15 .= "Content-Transfer-Encoding: base64".PHP_EOL; $attachment_15 .= "Content-Transfer-Encoding: base64".PHP_EOL;
$attachment_15 .= "Content-Disposition: attachment; filename=\"".$filename_15."\"".PHP_EOL.PHP_EOL; $attachment_15 .= "Content-Disposition: attachment; filename=\"".$filename_15."\"$EHA".PHP_EOL.PHP_EOL;
$attachment_15 .= $content.PHP_EOL; $attachment_15 .= $content.PHP_EOL;
$attachment_15 .= "--".$boundary; $attachment_15 .= "--".$boundary;
@@ -1393,7 +1402,7 @@ if ($match_found > 0)
// Edit content type for different file extensions // Edit content type for different file extensions
$attachment_16 .= "Content-Type: application/xml; name=\"".$filename_16."\"".PHP_EOL; $attachment_16 .= "Content-Type: application/xml; name=\"".$filename_16."\"".PHP_EOL;
$attachment_16 .= "Content-Transfer-Encoding: base64".PHP_EOL; $attachment_16 .= "Content-Transfer-Encoding: base64".PHP_EOL;
$attachment_16 .= "Content-Disposition: attachment; filename=\"".$filename_16."\"".PHP_EOL.PHP_EOL; $attachment_16 .= "Content-Disposition: attachment; filename=\"".$filename_16."\"$EHA".PHP_EOL.PHP_EOL;
$attachment_16 .= $content.PHP_EOL; $attachment_16 .= $content.PHP_EOL;
$attachment_16 .= "--".$boundary; $attachment_16 .= "--".$boundary;
@@ -1432,7 +1441,7 @@ if ($match_found > 0)
// Edit content type for different file extensions // Edit content type for different file extensions
$attachment_17 .= "Content-Type: application/xml; name=\"".$filename_17."\"".PHP_EOL; $attachment_17 .= "Content-Type: application/xml; name=\"".$filename_17."\"".PHP_EOL;
$attachment_17 .= "Content-Transfer-Encoding: base64".PHP_EOL; $attachment_17 .= "Content-Transfer-Encoding: base64".PHP_EOL;
$attachment_17 .= "Content-Disposition: attachment; filename=\"".$filename_17."\"".PHP_EOL.PHP_EOL; $attachment_17 .= "Content-Disposition: attachment; filename=\"".$filename_17."\"$EHA".PHP_EOL.PHP_EOL;
$attachment_17 .= $content.PHP_EOL; $attachment_17 .= $content.PHP_EOL;
$attachment_17 .= "--".$boundary; $attachment_17 .= "--".$boundary;
@@ -1471,7 +1480,7 @@ if ($match_found > 0)
// Edit content type for different file extensions // Edit content type for different file extensions
$attachment_18 .= "Content-Type: application/xml; name=\"".$filename_18."\"".PHP_EOL; $attachment_18 .= "Content-Type: application/xml; name=\"".$filename_18."\"".PHP_EOL;
$attachment_18 .= "Content-Transfer-Encoding: base64".PHP_EOL; $attachment_18 .= "Content-Transfer-Encoding: base64".PHP_EOL;
$attachment_18 .= "Content-Disposition: attachment; filename=\"".$filename_18."\"".PHP_EOL.PHP_EOL; $attachment_18 .= "Content-Disposition: attachment; filename=\"".$filename_18."\"$EHA".PHP_EOL.PHP_EOL;
$attachment_18 .= $content.PHP_EOL; $attachment_18 .= $content.PHP_EOL;
$attachment_18 .= "--".$boundary; $attachment_18 .= "--".$boundary;
@@ -1510,7 +1519,7 @@ if ($match_found > 0)
// Edit content type for different file extensions // Edit content type for different file extensions
$attachment_19 .= "Content-Type: application/xml; name=\"".$filename_19."\"".PHP_EOL; $attachment_19 .= "Content-Type: application/xml; name=\"".$filename_19."\"".PHP_EOL;
$attachment_19 .= "Content-Transfer-Encoding: base64".PHP_EOL; $attachment_19 .= "Content-Transfer-Encoding: base64".PHP_EOL;
$attachment_19 .= "Content-Disposition: attachment; filename=\"".$filename_19."\"".PHP_EOL.PHP_EOL; $attachment_19 .= "Content-Disposition: attachment; filename=\"".$filename_19."\"$EHA".PHP_EOL.PHP_EOL;
$attachment_19 .= $content.PHP_EOL; $attachment_19 .= $content.PHP_EOL;
$attachment_19 .= "--".$boundary; $attachment_19 .= "--".$boundary;
@@ -1549,7 +1558,7 @@ if ($match_found > 0)
// Edit content type for different file extensions // Edit content type for different file extensions
$attachment_20 .= "Content-Type: application/xml; name=\"".$filename_20."\"".PHP_EOL; $attachment_20 .= "Content-Type: application/xml; name=\"".$filename_20."\"".PHP_EOL;
$attachment_20 .= "Content-Transfer-Encoding: base64".PHP_EOL; $attachment_20 .= "Content-Transfer-Encoding: base64".PHP_EOL;
$attachment_20 .= "Content-Disposition: attachment; filename=\"".$filename_20."\"".PHP_EOL.PHP_EOL; $attachment_20 .= "Content-Disposition: attachment; filename=\"".$filename_20."\"$EHA".PHP_EOL.PHP_EOL;
$attachment_20 .= $content.PHP_EOL; $attachment_20 .= $content.PHP_EOL;
$attachment_20 .= "--".$boundary; $attachment_20 .= "--".$boundary;
@@ -1636,19 +1645,27 @@ if ($match_found > 0)
$header = preg_replace("/\n\n|\r\r|\r\n\r\n/","\n",$header); $header = preg_replace("/\n\n|\r\r|\r\n\r\n/","\n",$header);
// Send email // Send email
if (mail($email_to, $email_subject, $email_body, $header)) if ( ($sendmail_bypass > 0) and (strlen($allow_sendmail_bypass) > 2) )
{echo "Sent";}
else
{ {
echo "Error"; passthru("$allow_sendmail_bypass -t -i <<END_MESSAGE_XYZ1838127361\nTo: $email_to\nSubject: $email_subject\n$header\n\n$email_body \r\n\r\nEND_MESSAGE_XYZ1838127361\n > /tmp/mail-debug");
if ($DB) echo "Sent";
}
else
{
if (mail($email_to, $email_subject, $email_body, $header))
{echo "Sent";}
else
{ {
echo "\n"; echo "Error";
# echo "email_to: $email_to \n"; if ($DB)
# echo "email_subject: $email_subject \n"; {
# echo "headers:\n"; echo "\n";
# echo "$header\n"; # echo "email_to: $email_to \n";
# echo "\n"; # echo "email_subject: $email_subject \n";
# echo "headers:\n";
# echo "$header\n";
# echo "\n";
}
} }
} }
} }
+4 -1
View File
@@ -1,7 +1,7 @@
<?php <?php
# options.php - manually defined options for vicidial.php # options.php - manually defined options for vicidial.php
# #
# Copyright (C) 2021 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2 # Copyright (C) 2022 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# #
# rename this file to options.php for the settings here to go into effect # rename this file to options.php for the settings here to go into effect
# #
@@ -22,6 +22,7 @@
# 210616-0959 - Added CORS support # 210616-0959 - Added CORS support
# 210705-1624 - Added user_pass_webform and phone_login_webform options # 210705-1624 - Added user_pass_webform and phone_login_webform options
# 210823-1633 - Added email_attachment_path option for dispo_send_email.php script # 210823-1633 - Added email_attachment_path option for dispo_send_email.php script
# 220127-0931 - Added email_header_attach and allow_sendmail_bypass options
# #
$conf_silent_prefix = '5'; # vicidial_conferences prefix to enter silently and muted for recording $conf_silent_prefix = '5'; # vicidial_conferences prefix to enter silently and muted for recording
@@ -66,6 +67,8 @@ $user_pass_webform = '0'; # set to 1 or 2 to return to default of including the
$phone_login_webform = '0'; # set to 1 or 2 to return to default of including the 'phone_login'(1) and 'phone_pass'(2) by default in webform URLs $phone_login_webform = '0'; # set to 1 or 2 to return to default of including the 'phone_login'(1) and 'phone_pass'(2) by default in webform URLs
$alt_display_enabled = '0'; # set to 1 to allow the alt_display.php script to be used $alt_display_enabled = '0'; # set to 1 to allow the alt_display.php script to be used
$email_attachment_path = './attachments'; # set to the absolute path from where all of the dispo_send_email.php script attachemnts will be located $email_attachment_path = './attachments'; # set to the absolute path from where all of the dispo_send_email.php script attachemnts will be located
$email_header_attach = '0'; # set to 1 to force blank line after attachments in header. WARNING: Will break on newer versions of PHP
$allow_sendmail_bypass = ''; # some setups require bypassing PHP's mail() function to send properly, set this to 'sendmail' path: '/usr/sbin/sendmail'
$TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen $TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen
+4 -3
View File
@@ -131,7 +131,7 @@ $UGreports = 'ALL REPORTS, NONE, Real-Time Main Report, Real-Time Campaign Summa
$Vtables = 'NONE,log_noanswer,did_agent_log,contact_information'; $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 copy_user 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 batch_update_lead update_list list_info list_custom_fields update_log_entry update_phone update_phone_alias update_user user_group_status vm_list webphone_url webserver logged_in_agents update_campaign add_did update_did lead_field_info lead_all_info phone_number_log switch_lead ccc_lead_info lead_status_search lead_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'; $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 copy_user 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 batch_update_lead update_list list_info list_custom_fields update_log_entry update_phone update_phone_alias update_user user_group_status vm_list webphone_url webserver logged_in_agents update_campaign update_alt_url add_did update_did lead_field_info lead_all_info phone_number_log switch_lead ccc_lead_info lead_status_search lead_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';
$browser_alert_sounds_list = 'bark_dog,beep_double,beep_five,beep_up,bell_double,bell_school,bird,blaster1,blaster2,buzz1,buzz2,cash_register,chat_alert,click_single,click_double,click_quiet,close_encounter,confirmation,ding,droplet,droplet_double,elephant,email_alert,hold_tone,horn_bike,horn_car,horn_car_triple,horn_clown,horn_double,horn_train,meow_cat,scream_wilhelm,silence_quick,siren,slide_down,slide_up,swish,teleport1,teleport2,ticking_two,ticking_four,ticking_six,whip,whistle_up,whistle_two,whistle_three,whoosh,xylophone1,xylophone2,xylophone3,xylophone4'; $browser_alert_sounds_list = 'bark_dog,beep_double,beep_five,beep_up,bell_double,bell_school,bird,blaster1,blaster2,buzz1,buzz2,cash_register,chat_alert,click_single,click_double,click_quiet,close_encounter,confirmation,ding,droplet,droplet_double,elephant,email_alert,hold_tone,horn_bike,horn_car,horn_car_triple,horn_clown,horn_double,horn_train,meow_cat,scream_wilhelm,silence_quick,siren,slide_down,slide_up,swish,teleport1,teleport2,ticking_two,ticking_four,ticking_six,whip,whistle_up,whistle_two,whistle_three,whoosh,xylophone1,xylophone2,xylophone3,xylophone4';
@@ -5769,12 +5769,13 @@ if ($SSscript_remove_js > 0)
# 220118-1944 - Added auto_alt_threshold option for campaigns and override option for lists # 220118-1944 - Added auto_alt_threshold option for campaigns and override option for lists
# 220120-0902 - Added download_invalid_files user option # 220120-0902 - Added download_invalid_files user option
# 220122-1659 - Added more variable filtering, updated copyright year to 2022 # 220122-1659 - Added more variable filtering, updated copyright year to 2022
# 220127-2915 - Added update_alt_url Non-Agent API function
# #
# 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 # 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-841a'; $admin_version = '2.14-842a';
$build = '220122-1659'; $build = '220127-2915';
$STARTtime = date("U"); $STARTtime = date("U");
$SQLdate = date("Y-m-d H:i:s"); $SQLdate = date("Y-m-d H:i:s");
+10 -8
View File
@@ -1,7 +1,7 @@
<?php <?php
# admin_url_multi.php # admin_url_multi.php
# #
# Copyright (C) 2021 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2 # Copyright (C) 2022 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# #
# this screen will control the *url* settings needed when the Campaign or # this screen will control the *url* settings needed when the Campaign or
# In-Group or List URL setting is set to "ALT". This screen allows for multiple # In-Group or List URL setting is set to "ALT". This screen allows for multiple
@@ -17,10 +17,11 @@
# 170409-1545 - Added IP List validation code # 170409-1545 - Added IP List validation code
# 180503-2215 - Added new help display # 180503-2215 - Added new help display
# 211117-2006 - Added minimum call length field # 211117-2006 - Added minimum call length field
# 220127-1900 - Added display of the URL ID
# #
$admin_version = '2.14-7'; $admin_version = '2.14-8';
$build = '211117-2006'; $build = '220127-1900';
require("dbconnect_mysqli.php"); require("dbconnect_mysqli.php");
require("functions.php"); require("functions.php");
@@ -445,12 +446,12 @@ if ($action == "BLANK")
echo "<TABLE><TR><TD>\n"; echo "<TABLE><TR><TD>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"; echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
echo "<br>"._QXZ("Alternate URL Form"); echo "<br>"._QXZ("Alternate URL Form");
echo "<center><TABLE width=920 cellspacing=3>\n"; echo "<center><TABLE width=1020 cellspacing=3>\n";
echo "<tr><td align=center colspan=2>\n"; echo "<tr><td align=center colspan=2>\n";
echo "<br><b>"._QXZ("Alternate %1s URLs for %2s",0,'',$url_type,$entry_type).": <a href=\"./admin.php?$mod_link$campaign_id\">$campaign_id</a></b> &nbsp; $NWB#alt_multi_urls$NWE\n"; echo "<br><b>"._QXZ("Alternate %1s URLs for %2s",0,'',$url_type,$entry_type).": <a href=\"./admin.php?$mod_link$campaign_id\">$campaign_id</a></b> &nbsp; $NWB#alt_multi_urls$NWE\n";
echo "<TABLE width=900 cellspacing=3>\n"; echo "<TABLE width=1000 cellspacing=3>\n";
echo "<tr><td><font size=2><b>#</td><td><font size=2><b>"._QXZ("ACTIVE")."</td><td><font size=2><b>"._QXZ("RANK")."</td><td><font size=2><b>"._QXZ("STATUSES")."</td><td><font size=2><b>"._QXZ("LISTS")."</td><td><font size=2><b>"._QXZ("MIN LENGTH")."</td><td><font size=2><b>"._QXZ("DESCRIPTION")."</td><td><font size=2><b>"._QXZ("SUBMIT")."</td></tr>\n"; echo "<tr><td><font size=2><b>#</td><td NOWRAP><font size=1>URL ID</td><td><font size=2><b>"._QXZ("ACTIVE")."</td><td><font size=2><b>"._QXZ("RANK")."</td><td><font size=2><b>"._QXZ("STATUSES")."</td><td><font size=2><b>"._QXZ("LISTS")."</td><td><font size=2><b>"._QXZ("MIN LENGTH")."</td><td><font size=2><b>"._QXZ("DESCRIPTION")."</td><td><font size=2><b>"._QXZ("SUBMIT")."</td></tr>\n";
$stmt="SELECT url_id,active,url_rank,url_statuses,url_description,url_address,url_lists,url_call_length from vicidial_url_multi where campaign_id='$campaign_id' and entry_type='$entry_type' and url_type='$url_type' order by url_rank limit 1000;"; $stmt="SELECT url_id,active,url_rank,url_statuses,url_description,url_address,url_lists,url_call_length from vicidial_url_multi where campaign_id='$campaign_id' and entry_type='$entry_type' and url_type='$url_type' order by url_rank limit 1000;";
if ($DB) {echo "$stmt\n";} if ($DB) {echo "$stmt\n";}
@@ -485,8 +486,9 @@ if ($action == "BLANK")
echo "<input type=hidden name=url_id value=\"$Rurl_id\">\n"; echo "<input type=hidden name=url_id value=\"$Rurl_id\">\n";
echo "<input type=hidden name=action value=URL_MULTI_MODIFY>\n"; echo "<input type=hidden name=action value=URL_MULTI_MODIFY>\n";
echo "<td><font size=1>$o</td>"; echo "<td><font size=1>$o</td>";
echo "<td align=right><font size=1>$Rurl_id &nbsp;</td>";
echo "<td><font size=1><select size=1 name=active><option value='Y'>"._QXZ("Y")."</option><option value='N'>"._QXZ("N")."</option><option SELECTED>$Ractive</option></select></td>"; echo "<td><font size=1><select size=1 name=active><option value='Y'>"._QXZ("Y")."</option><option value='N'>"._QXZ("N")."</option><option SELECTED>$Ractive</option></select></td>";
echo "<td><font size=1><input type=text size=4 maxlength=3 name=url_rank value=\"$Rurl_rank\"></td>"; echo "<td><font size=1><input type=text size=3 maxlength=3 name=url_rank value=\"$Rurl_rank\"></td>";
echo "<td><font size=1><input type=text size=24 maxlength=1000 name=url_statuses value=\"$Rurl_statuses\"></td>"; echo "<td><font size=1><input type=text size=24 maxlength=1000 name=url_statuses value=\"$Rurl_statuses\"></td>";
echo "<td><font size=1><input type=text size=24 maxlength=1000 name=url_lists value=\"$Rurl_lists\"></td>"; echo "<td><font size=1><input type=text size=24 maxlength=1000 name=url_lists value=\"$Rurl_lists\"></td>";
echo "<td><font size=1><input type=text size=5 maxlength=5 name=url_call_length value=\"$Rurl_call_length\"></td>"; echo "<td><font size=1><input type=text size=5 maxlength=5 name=url_call_length value=\"$Rurl_call_length\"></td>";
@@ -500,7 +502,7 @@ if ($action == "BLANK")
echo "</td>"; echo "</td>";
echo "</tr>"; echo "</tr>";
echo "<tr $bgcolor>"; echo "<tr $bgcolor>";
echo "<td colspan=7 NOWRAP><font size=1>"._QXZ("URL").":<input type=text size=110 maxlength=5000 name=url_address value=\"$Rurl_address\"></td>"; echo "<td colspan=8 NOWRAP><font size=1>"._QXZ("URL").":<input type=text size=125 maxlength=5000 name=url_address value=\"$Rurl_address\"></td>";
echo "</form>\n"; echo "</form>\n";
echo "</tr>\n"; echo "</tr>\n";
} }
+488 -3
View File
@@ -189,10 +189,11 @@
# 211118-1946 - Added 'delete_cf_data' setting to the update_lead function # 211118-1946 - Added 'delete_cf_data' setting to the update_lead function
# 211217-0733 - Fixes for PHP8, issue #1341 # 211217-0733 - Fixes for PHP8, issue #1341
# 220120-0914 - Added download_invalid_files user function for audio store file listings # 220120-0914 - Added download_invalid_files user function for audio store file listings
# 220126-2116 - Added dispo_call_url and alt URL options for update_campaign. Added 'update_alt_url' function
# #
$version = '2.14-166'; $version = '2.14-167';
$build = '220120-0914'; $build = '220126-2116';
$php_script='non_agent_api.php'; $php_script='non_agent_api.php';
$api_url_log = 0; $api_url_log = 0;
@@ -670,6 +671,26 @@ if (isset($_GET["lead_ids"])) {$lead_ids=$_GET["lead_ids"];}
elseif (isset($_POST["lead_ids"])) {$lead_ids=$_POST["lead_ids"];} elseif (isset($_POST["lead_ids"])) {$lead_ids=$_POST["lead_ids"];}
if (isset($_GET["delete_cf_data"])) {$delete_cf_data=$_GET["delete_cf_data"];} if (isset($_GET["delete_cf_data"])) {$delete_cf_data=$_GET["delete_cf_data"];}
elseif (isset($_POST["delete_cf_data"])) {$delete_cf_data=$_POST["delete_cf_data"];} elseif (isset($_POST["delete_cf_data"])) {$delete_cf_data=$_POST["delete_cf_data"];}
if (isset($_GET["dispo_call_url"])) {$dispo_call_url=$_GET["dispo_call_url"];}
elseif (isset($_POST["dispo_call_url"])) {$dispo_call_url=$_POST["dispo_call_url"];}
if (isset($_GET["entry_type"])) {$entry_type=$_GET["entry_type"];}
elseif (isset($_POST["entry_type"])) {$entry_type=$_POST["entry_type"];}
if (isset($_GET["alt_url_id"])) {$alt_url_id=$_GET["alt_url_id"];}
elseif (isset($_POST["alt_url_id"])) {$alt_url_id=$_POST["alt_url_id"];}
if (isset($_GET["url_address"])) {$url_address=$_GET["url_address"];}
elseif (isset($_POST["url_address"])) {$url_address=$_POST["url_address"];}
if (isset($_GET["url_type"])) {$url_type=$_GET["url_type"];}
elseif (isset($_POST["url_type"])) {$url_type=$_POST["url_type"];}
if (isset($_GET["url_rank"])) {$url_rank=$_GET["url_rank"];}
elseif (isset($_POST["url_rank"])) {$url_rank=$_POST["url_rank"];}
if (isset($_GET["url_statuses"])) {$url_statuses=$_GET["url_statuses"];}
elseif (isset($_POST["url_statuses"])) {$url_statuses=$_POST["url_statuses"];}
if (isset($_GET["url_description"])) {$url_description=$_GET["url_description"];}
elseif (isset($_POST["url_description"])) {$url_description=$_POST["url_description"];}
if (isset($_GET["url_lists"])) {$url_lists=$_GET["url_lists"];}
elseif (isset($_POST["url_lists"])) {$url_lists=$_POST["url_lists"];}
if (isset($_GET["url_call_length"])) {$url_call_length=$_GET["url_call_length"];}
elseif (isset($_POST["url_call_length"])) {$url_call_length=$_POST["url_call_length"];}
if (file_exists('options.php')) if (file_exists('options.php'))
@@ -938,6 +959,8 @@ if ($non_latin < 1)
$ingroup_grade = preg_replace('/[^0-9]/','',$ingroup_grade); $ingroup_grade = preg_replace('/[^0-9]/','',$ingroup_grade);
$group_id = preg_replace('/[^_0-9a-zA-Z]/','',$group_id); $group_id = preg_replace('/[^_0-9a-zA-Z]/','',$group_id);
$ingrp_rg_only = preg_replace('/[^0-9]/','',$ingrp_rg_only); $ingrp_rg_only = preg_replace('/[^0-9]/','',$ingrp_rg_only);
$url_statuses = preg_replace('/[^- 0-9a-zA-Z]/', '',$url_statuses);
$url_description = preg_replace('/[^ \.\,-\_0-9a-zA-Z]/','',$url_description);
} }
else else
{ {
@@ -950,6 +973,8 @@ else
$phone_number = preg_replace('/[^\,0-9]/','',$phone_number); $phone_number = preg_replace('/[^\,0-9]/','',$phone_number);
$vendor_lead_code = preg_replace('/;|#/','',$vendor_lead_code); $vendor_lead_code = preg_replace('/;|#/','',$vendor_lead_code);
$vendor_lead_code = preg_replace('/\+/',' ',$vendor_lead_code); $vendor_lead_code = preg_replace('/\+/',' ',$vendor_lead_code);
$url_statuses = preg_replace('/[^- 0-9\p{L}]/u', '',$url_statuses);
$url_description = preg_replace('/[^ \.\,-\_0-9\p{L}]/u','',$url_description);
} }
$list_id = preg_replace('/[^-_0-9a-zA-Z]/','',$list_id); $list_id = preg_replace('/[^-_0-9a-zA-Z]/','',$list_id);
$list_id_field = preg_replace('/[^0-9]/','',$list_id_field); $list_id_field = preg_replace('/[^0-9]/','',$list_id_field);
@@ -965,6 +990,12 @@ $dialable_count = preg_replace('/[^_0-9a-zA-Z]/','',$dialable_count);
$call_handle_method = preg_replace('/[^_0-9a-zA-Z]/','',$call_handle_method); $call_handle_method = preg_replace('/[^_0-9a-zA-Z]/','',$call_handle_method);
$agent_search_method = preg_replace('/[^_0-9a-zA-Z]/','',$agent_search_method); $agent_search_method = preg_replace('/[^_0-9a-zA-Z]/','',$agent_search_method);
$delete_cf_data = preg_replace('/[^A-Z]/','',$delete_cf_data); $delete_cf_data = preg_replace('/[^A-Z]/','',$delete_cf_data);
$entry_type = preg_replace('/[^_0-9a-zA-Z]/','',$entry_type);
$alt_url_id = preg_replace('/[^0-9A-Z]/','',$alt_url_id);
$url_type = preg_replace('/[^_0-9a-zA-Z]/','',$url_type);
$url_rank = preg_replace('/[^0-9]/','',$url_rank);
$url_lists = preg_replace('/[^- 0-9A-Z]/', '',$url_lists);
$url_call_length = preg_replace('/[^0-9]/','',$url_call_length);
$USarea = substr($phone_number, 0, 3); $USarea = substr($phone_number, 0, 3);
$USprefix = substr($phone_number, 3, 3); $USprefix = substr($phone_number, 3, 3);
@@ -7404,6 +7435,7 @@ if ($function == 'update_campaign')
$xferconf_threeSQL=''; $xferconf_threeSQL='';
$xferconf_fourSQL=''; $xferconf_fourSQL='';
$xferconf_fiveSQL=''; $xferconf_fiveSQL='';
$dispo_call_urlSQL='';
if (strlen($auto_dial_level) > 0) if (strlen($auto_dial_level) > 0)
{ {
@@ -7649,8 +7681,27 @@ if ($function == 'update_campaign')
{$xferconf_fiveSQL = " ,xferconf_e_number='$xferconf_five'";} {$xferconf_fiveSQL = " ,xferconf_e_number='$xferconf_five'";}
} }
} }
if (strlen($dispo_call_url) > 0)
{
if ($dispo_call_url == '--BLANK--')
{$dispo_call_urlSQL = " ,dispo_call_url=''";}
else
{
if ( (strlen($dispo_call_url) < 3) or (strlen($dispo_call_url) > 65000) )
{
$result = 'ERROR';
$result_reason = "update_campaign DISPO CALL URL IS NOT VALID, THIS IS AN OPTIONAL FIELD";
$data = "$dispo_call_url";
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
{$dispo_call_urlSQL = " ,dispo_call_url='" . mysqli_real_escape_string($link, $dispo_call_url) . "'";}
}
}
$updateSQL = "$campaignnameSQL$activeSQL$dialtimeoutSQL$hopperlevelSQL$campaignvdadextenSQL$adaptivemaximumlevelSQL$dialmethodSQL$autodiallevelSQL$campaigncidSQL$campaignfilterSQL$xferconf_oneSQL$xferconf_twoSQL$xferconf_threeSQL$xferconf_fourSQL$xferconf_fiveSQL"; $updateSQL = "$campaignnameSQL$activeSQL$dialtimeoutSQL$hopperlevelSQL$campaignvdadextenSQL$adaptivemaximumlevelSQL$dialmethodSQL$autodiallevelSQL$campaigncidSQL$campaignfilterSQL$xferconf_oneSQL$xferconf_twoSQL$xferconf_threeSQL$xferconf_fourSQL$xferconf_fiveSQL$dispo_call_urlSQL";
if (strlen($updateSQL)< 3) if (strlen($updateSQL)< 3)
{ {
@@ -7715,6 +7766,440 @@ if ($function == 'update_campaign')
################################################################################
### update_alt_url - updates alternate dispo call url entries for a campaign
################################################################################
if ($function == 'update_alt_url')
{
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 vdc_agent_api_access='1' and modify_campaigns='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 = "update_alt_url USER DOES NOT HAVE PERMISSION TO UPDATE CAMPAIGNS";
$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($campaign_id)<2) or (strlen($campaign_id)>20) )
{
$result = 'ERROR';
$result_reason = "update_alt_url YOU MUST USE ALL REQUIRED FIELDS";
$data = "$campaign_id|$campaign_name|$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 allowed_campaigns,admin_viewable_groups from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB>0) {echo "|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGadmin_viewable_groups = $row[1];
$LOGallowed_campaignsSQL='';
$whereLOGallowed_campaignsSQL='';
if ( (!preg_match('/\-ALL/i', $LOGallowed_campaigns)) )
{
$rawLOGallowed_campaignsSQL = preg_replace("/ -/",'',$LOGallowed_campaigns);
$rawLOGallowed_campaignsSQL = preg_replace("/ /","','",$rawLOGallowed_campaignsSQL);
$LOGallowed_campaignsSQL = "and campaign_id IN('$rawLOGallowed_campaignsSQL')";
$whereLOGallowed_campaignsSQL = "where campaign_id IN('$rawLOGallowed_campaignsSQL')";
}
$stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id' $LOGallowed_campaignsSQL;";
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$camp_exists=$row[0];
if ($camp_exists < 1)
{
$result = 'ERROR';
$result_reason = "update_alt_url CAMPAIGN DOES NOT EXIST";
$data = "$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
{
if ($alt_url_id == 'LIST')
{
$output='';
$DLset=0;
if ($stage == 'csv')
{$DL = ','; $DLset++;}
if ($stage == 'tab')
{$DL = "\t"; $DLset++;}
if ($stage == 'pipe')
{$DL = '|'; $DLset++;}
if ($DLset < 1)
{$DL='|';}
if ($header == 'YES')
{$output .= 'url_id' . $DL . 'campaign_id' . $DL . 'entry_type' . $DL . 'active' . $DL . 'url_type' . $DL . 'url_rank' . $DL . 'url_statuses' . $DL . 'url_description' . $DL . 'url_lists' . $DL . 'url_call_length' . $DL . "url_address\n";}
$stmt="SELECT url_id,campaign_id,entry_type,active,url_type,url_rank,url_statuses,url_description,url_lists,url_call_length,url_address from vicidial_url_multi where campaign_id='$campaign_id' and entry_type='$entry_type' and url_type='$url_type' order by url_id limit 1000;";
$rslt=mysql_to_mysqli($stmt, $link);
$vum_recs = mysqli_num_rows($rslt);
if ($DB>0) {echo "$vum_recs|$stmt|\n";}
$M=0;
while ($vum_recs > $M)
{
$row=mysqli_fetch_row($rslt);
$url_id = $row[0];
$campaign_id = $row[1];
$entry_type = $row[2];
$active = $row[3];
$url_type = $row[4];
$url_rank = $row[5];
$url_statuses = $row[6];
$url_description = $row[7];
$url_lists = $row[8];
$url_call_length = $row[9];
$url_address = $row[10];
$output .= "$url_id" . $DL . "$campaign_id" . $DL . "$entry_type" . $DL . "$active" . $DL . "$url_type" . $DL . "$url_rank" . $DL . "$url_statuses" . $DL . "$url_description" . $DL . "$url_lists" . $DL . "$url_call_length" . $DL . "$url_address\n";
$M++;
}
if ($M < 1)
{echo "NOTICE: update_alt_url LIST, No Records Found - $user|$url_type|$entry_type|$campaign_id|0\n";}
else
{echo $output;}
$result = 'SUCCESS';
$result_reason = "update_alt_url ALT URL LIST DISPLAYED";
$data = "$url_type|$entry_type|$campaign_id|$M";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
if ($entry_type == 'campaign')
{
$event_section = 'CAMPAIGNS';
if ($url_type == 'dispo')
{$validate_stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id' and dispo_call_url='ALT';";}
elseif ($url_type == 'start')
{$validate_stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id' and start_call_url='ALT';";}
elseif ($url_type == 'noagent')
{$validate_stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id' and na_call_url='ALT';";}
else
{
$result = 'ERROR';
$result_reason = "update_alt_url NO VALID URL TYPE DEFINED:";
$data = "$url_type|$entry_type|$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;
}
}
elseif ($entry_type == 'ingroup')
{
$event_section = 'INGROUPS';
if ($url_type == 'dispo')
{$validate_stmt="SELECT count(*) from vicidial_inbound_groups where group_id='$campaign_id' and dispo_call_url='ALT';";}
elseif ($url_type == 'start')
{$validate_stmt="SELECT count(*) from vicidial_inbound_groups where group_id='$campaign_id' and start_call_url='ALT';";}
elseif ($url_type == 'noagent')
{$validate_stmt="SELECT count(*) from vicidial_inbound_groups where group_id='$campaign_id' and na_call_url='ALT';";}
elseif ($url_type == 'addlead')
{$validate_stmt="SELECT count(*) from vicidial_inbound_groups where group_id='$campaign_id' and add_lead_url='ALT';";}
else
{
$result = 'ERROR';
$result_reason = "update_alt_url NO VALID URL TYPE DEFINED:";
$data = "$url_type|$entry_type|$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;
}
}
elseif ($entry_type == 'list')
{
$event_section = 'LISTS';
if ($url_type == 'noagent')
{$validate_stmt="SELECT count(*) from vicidial_lists where list_id='$campaign_id' and na_call_url='ALT';";}
else
{
$result = 'ERROR';
$result_reason = "update_alt_url NO VALID URL TYPE DEFINED:";
$data = "$url_type|$entry_type|$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
{
$result = 'ERROR';
$result_reason = "update_alt_url NO ENTRY TYPE DEFINED:";
$data = "$entry_type|$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;
}
# find if the campaign/in-group/list field type is set to use ALT URLs
$rslt=mysql_to_mysqli($validate_stmt, $link);
$row=mysqli_fetch_row($rslt);
$camp_exists=$row[0];
if ($camp_exists < 1)
{
$result = 'ERROR';
$result_reason = "update_alt_url $event_section $url_type URL IS NOT SET TO ALT";
$data = "$url_type|$entry_type|$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;
}
if ($alt_url_id != 'NEW')
{
$stmt="SELECT count(*) from vicidial_url_multi where campaign_id='$campaign_id' and entry_type='$entry_type' and url_type='$url_type' and url_id='$alt_url_id';";
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$alt_id_exists=$row[0];
if ($alt_id_exists < 1)
{
$stmt="SELECT url_id from vicidial_url_multi where campaign_id='$campaign_id' and entry_type='$entry_type' and url_type='$url_type' order by url_id limit 2;";
$rslt=mysql_to_mysqli($stmt, $link);
$vum_recs = mysqli_num_rows($rslt);
if ($vum_recs < 2)
{
$row=mysqli_fetch_row($rslt);
$alt_url_id = $row[0];
}
else
{
$result = 'ERROR';
$result_reason = "update_alt_url ALT URL ID DOES NOT EXIST";
$data = "$alt_url_id|$url_type|$entry_type|$campaign_id|$vum_recs";
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;
}
}
}
$activeSQL='';
$url_addressSQL='';
$url_rankSQL='';
$url_statusesSQL='';
$url_descriptionSQL='';
$url_listsSQL='';
$url_call_lengthSQL='';
if (strlen($active) > 0)
{
if ( ($active != 'Y') and ($active != 'N') )
{
$result = 'ERROR';
$result_reason = "update_alt_url ACTIVE MUST BE Y OR N, THIS IS AN OPTIONAL FIELD";
$data = "$active";
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
{$activeSQL = " ,active='$active'";}
}
if (strlen($url_address) > 0)
{
if ($url_address == '--BLANK--')
{$url_addressSQL = " ,url_address=''";}
else
{
if ( (strlen($url_address) < 5) or (strlen($url_address) > 65000) )
{
$result = 'ERROR';
$result_reason = "update_alt_url URL ADDRESS IS NOT VALID, THIS IS AN OPTIONAL FIELD";
$data = "$url_address";
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
{$url_addressSQL = " ,url_address='" . mysqli_real_escape_string($link, $url_address) . "'";}
}
}
if (strlen($url_rank) > 0)
{
if (strlen($url_rank) > 5)
{
$result = 'ERROR';
$result_reason = "update_alt_url URL RANK IS NOT VALID, THIS IS AN OPTIONAL FIELD";
$data = "$url_rank";
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
{$url_rankSQL = " ,url_rank='$url_rank'";}
}
if (strlen($url_call_length) > 0)
{
if (strlen($url_call_length) > 5)
{
$result = 'ERROR';
$result_reason = "update_alt_url URL CAL LENGTH IS NOT VALID, THIS IS AN OPTIONAL FIELD";
$data = "$url_call_length";
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
{$url_call_lengthSQL = " ,url_call_length='$url_call_length'";}
}
if (strlen($url_statuses) > 0)
{
if (strlen($url_statuses) > 1000)
{
$result = 'ERROR';
$result_reason = "update_alt_url URL STATUSES IS NOT VALID, THIS IS AN OPTIONAL FIELD";
$data = "$url_statuses";
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
{$url_statusesSQL = " ,url_statuses='$url_statuses'";}
}
if (strlen($url_description) > 0)
{
if ($url_description == '--BLANK--')
{$url_descriptionSQL = " ,url_description=''";}
else
{
if (strlen($url_description) > 255)
{
$result = 'ERROR';
$result_reason = "update_alt_url URL DESCRIPTION IS NOT VALID, THIS IS AN OPTIONAL FIELD";
$data = "$url_description";
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
{$url_descriptionSQL = " ,url_description='$url_description'";}
}
}
if (strlen($url_lists) > 0)
{
if ($url_lists == '--BLANK--')
{$url_listsSQL = " ,url_lists=''";}
else
{
if (strlen($url_lists) > 1000)
{
$result = 'ERROR';
$result_reason = "update_alt_url URL LISTS IS NOT VALID, THIS IS AN OPTIONAL FIELD";
$data = "$url_lists";
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
{$url_listsSQL = " ,url_lists='$url_lists'";}
}
}
$updateSQL = "$activeSQL$url_rankSQL$url_statusesSQL$url_descriptionSQL$url_listsSQL$url_call_lengthSQL$url_addressSQL";
if (strlen($updateSQL)< 3)
{
$result = 'NOTICE';
$result_reason = "update_alt_url NO UPDATES DEFINED";
$data = "$updateSQL";
echo "$result: $result_reason: |$user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
else
{
if ($alt_url_id == 'NEW')
{
$updateSQLx = ltrim($updateSQL, ' ,');
$stmt="INSERT INTO vicidial_url_multi SET campaign_id='$campaign_id',entry_type='$entry_type',url_type='$url_type', $updateSQLx;";
$rslt=mysql_to_mysqli($stmt, $link);
$add_count = mysqli_affected_rows($link);
$new_url_id = mysqli_insert_id($link);
if ($DB) {echo "$add_count|$new_url_id|$stmt|\n";}
### 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='$event_section', event_type='ADD', record_id='$campaign_id', event_code='ADMIN API UPDATE ALT URL', event_sql=\"$SQL_log\", event_notes='campaign: $campaign_id|url_id: $new_url_id|entry_type: $entry_type|url_type:$url_type';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$result = 'SUCCESS';
$result_reason = "update_alt_url ALT URL HAS BEEN ADDED";
$data = "NEW URL ID: $new_url_id|$url_type|$entry_type|$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);
}
else
{
$updateSQLx = ltrim($updateSQL, ' ,');
$stmt="UPDATE vicidial_url_multi SET $updateSQLx WHERE campaign_id='$campaign_id' and url_id='$alt_url_id';";
$rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {echo "|$stmt|\n";}
### 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='$event_section', event_type='MODIFY', record_id='$campaign_id', event_code='ADMIN API UPDATE ALT URL', event_sql=\"$SQL_log\", event_notes='campaign: $campaign_id|url_id: $alt_url_id|entry_type: $entry_type|url_type:$url_type';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$result = 'SUCCESS';
$result_reason = "update_alt_url ALT URL HAS BEEN UPDATED";
$data = "$alt_url_id|$url_type|$entry_type|$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 update_alt_url
################################################################################
################################################################################ ################################################################################
### add_did - adds new Inbound DID entries to the system in the vicidial_inbound_dids table ### add_did - adds new Inbound DID entries to the system in the vicidial_inbound_dids table
################################################################################ ################################################################################