Fixed minor admin bugs

Added Non-Agent API functions: server_refresh, check_phone_number

git-svn-id: svn://192.168.202.10@2072 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2014-02-14 21:52:59 +00:00
parent 674eb52301
commit 9dcab0afbb
9 changed files with 503 additions and 42 deletions
+2
View File
@@ -186,6 +186,8 @@ OTHER CHANGES:
32. Added Non-Agent API function update_user to allow updating of the major
user fields
33. Added Non-Agent API functions for check_phone_number and server_refresh
+10 -8
View File
@@ -92,9 +92,10 @@
# 140112-1910 - Fixed issue with MoH in Astrisk 1.8
# 140126-1153 - Added VMAIL_NO_INST option dialplan generation
# 140126-2252 - Added voicemail_instructions option for phones
# 140214-1519 - Added reload_timestamp value to conf files
#
$build = '140126-2252';
$build = '140214-1519';
$DB=0; # Debug flag
$MT[0]=''; $MT[1]='';
@@ -1280,7 +1281,7 @@ if ($timeclock_end_of_day_NOW > 0)
################################################################################
##### Get the settings from system_settings #####
$stmtA = "SELECT sounds_central_control_active,active_voicemail_server,custom_dialplan_entry,default_codecs,generate_cross_server_exten,voicemail_timezones,default_voicemail_timezone,call_menu_qualify_enabled,allow_voicemail_greeting FROM system_settings;";
$stmtA = "SELECT sounds_central_control_active,active_voicemail_server,custom_dialplan_entry,default_codecs,generate_cross_server_exten,voicemail_timezones,default_voicemail_timezone,call_menu_qualify_enabled,allow_voicemail_greeting,reload_timestamp FROM system_settings;";
# print "$stmtA\n";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -1297,6 +1298,7 @@ if ($sthArows > 0)
$SSdefault_voicemail_timezone = $aryA[6];
$SScall_menu_qualify_enabled = $aryA[7];
$SSallow_voicemail_greeting = $aryA[8];
$SSreload_timestamp = $aryA[9];
}
$sthA->finish();
if ($DBXXX > 0) {print "SYSTEM SETTINGS: $sounds_central_control_active|$active_voicemail_server|$SScustom_dialplan_entry|$SSdefault_codecs\n";}
@@ -3014,32 +3016,32 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r
if (length($SScustom_dialplan_entry)>5)
{print ext "include => vicidial-auto-system-setting-custom\n";}
print ext "\n";
print ext "\n; END OF FILE\n";
print ext "\n; END OF FILE Last Forced System Reload: $SSreload_timestamp\n";
print iax "; WARNING- THIS FILE IS AUTO-GENERATED BY VICIDIAL, ANY EDITS YOU MAKE WILL BE LOST\n";
print iax "$iax\n";
print iax "$Liax\n";
print iax "$Piax\n";
print iax "\n; END OF FILE\n";
print iax "\n; END OF FILE Last Forced System Reload: $SSreload_timestamp\n";
print sip "; WARNING- THIS FILE IS AUTO-GENERATED BY VICIDIAL, ANY EDITS YOU MAKE WILL BE LOST\n";
print sip "$sip\n";
print sip "$Lsip\n";
print sip "$Psip\n";
print sip "\n; END OF FILE\n";
print sip "\n; END OF FILE Last Forced System Reload: $SSreload_timestamp\n";
# print vm "; WARNING- THIS FILE IS AUTO-GENERATED BY VICIDIAL, ANY EDITS YOU MAKE WILL BE LOST\n";
print vm "$vm_header_content\n";
print vm "$vm\n";
print vm "\n; END OF FILE\n";
print vm "\n; END OF FILE Last Forced System Reload: $SSreload_timestamp\n";
print moh "; WARNING- THIS FILE IS AUTO-GENERATED BY VICIDIAL, ANY EDITS YOU MAKE WILL BE LOST\n";
print moh "$moh\n";
print moh "\n; END OF FILE\n";
print moh "\n; END OF FILE Last Forced System Reload: $SSreload_timestamp\n";
print mm "; WARNING- THIS FILE IS AUTO-GENERATED BY VICIDIAL, ANY EDITS YOU MAKE WILL BE LOST\n";
print mm "$mm\n";
print mm "\n; END OF FILE\n";
print mm "\n; END OF FILE Last Forced System Reload: $SSreload_timestamp\n";
close(ext);
close(iax);
+82 -1
View File
@@ -1,4 +1,4 @@
NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2014-02-06
NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2014-02-14
This document describes the functions of an API(Application Programming
Interface) for all functions NOT directly relating to the VICIDIAL Agent screen.
@@ -36,6 +36,8 @@ user_group_status - real-time status of one or more user groups
in_group_status - real-time status of one or more in groups
agent_status - real-time status of one user
callid_info - information about a call based upon the caller_code or call ID
server_refresh - forces a conf file refresh on all telco servers in the cluster
check_phone_number - allows you to check if a phone number is valid and dialable
New scripts:
@@ -88,6 +90,8 @@ Changes:
130617-2232 - Added real-time sub-statuses to output of agent_status function
140124-1057 - Added callid_info function
140206-1205 - Added update_user function
140211-1056 - Added server_refresh function
140214-1540 - Added check_phone_number function
API Functions use the 'function' variable
@@ -1051,6 +1055,26 @@ SUCCESS: update_phone_alias PHONE ALIAS HAS BEEN DELETED - 6666|x100|
--------------------------------------------------------------------------------
server_refresh - forces a conf file refresh on all telco servers in the cluster
NOTE: api user for this function must have user_level set to 8 or higher and "ast admin access" enabled
REQUIRED FIELDS-
stage - "REFRESH"
Example URL string for API calls:
http://server/vicidial/non_agent_api.php?source=test&function=server_refresh&user=6666&pass=1234&stage=REFRESH
Example responses:
ERROR: server_refresh USER DOES NOT HAVE PERMISSION TO REFRESH SERVERS - 6666|0
ERROR: server_refresh YOU MUST USE ALL REQUIRED FIELDS - 6666|
SUCCESS: server_refresh SERVER REFRESH HAS BEEN TRIGGERED - 6666|1
--------------------------------------------------------------------------------
add_list - adds a list to the system
@@ -1157,3 +1181,60 @@ NOTICE: update_list LEADS IN LIST HAVE BEEN DELETED - 6666|1101|324
ERROR: NO FUNCTION SPECIFIED
--------------------------------------------------------------------------------
check_phone_number - allows you to check if a phone number is valid and dialable
NOTE: api user for this function must have user_level set to 8 or higher
REQUIRED FIELDS-
phone_number - must be all numbers, 6-16 digits
phone_code - must be all numbers, 1-4 digits, defaults to 1 if not set
local_call_time - must be a valid call time ID in the system
OPTIONAL FIELDS-
postal_code - must be 5 digits. Only works for USA zipcodes, needed for POSTAL tz_method
state - must be 2 letters. Only needed if state call time rules enabled
owner - must be 2-5 letters. Only needed if using TZCODE tz_method
SETTINGS FIELDS-
dnc_check - Y, N or AREACODE, default is N
campaign_dnc_check - Y, N or AREACODE, default is N
campaign_id - 2-8 Character campaign ID, required if using campaign_dnc_check
usacan_prefix_check - Y or N, default is N. Check for a valid 4th digit for USA and Canada phone numbers (cannot be 0 or 1)
usacan_areacode_check - Y or N, default is N. Check for a valid areacode for USA and Canada phone numbers
nanpa_ac_prefix_check - Y or N, default is N. Check for a valid NANPA areacode and prefix, if optional NANPA data is on the system
tz_method - <empty>, POSTAL, TZCODE, NANPA or AREACODE, default is <empty> which will use the country code and AREACODE for time zone lookups
AREACODE relies on the phone number's areacode
POSTAL relies on the postal_code field
TZCODE relies on the owner field being populated with a proper time zone code
NANPA relies on the optional NANPA areacode prefix data being loaded on your system
(NOTE: you can do more than one method at once, i.e.: "POSTALTZCODE")
Example URL strings for API calls:
http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=check_phone_number&phone_number=7275551111&call_time=9am-9pm
http://server/vicidial/non_agent_api.php?DB=0&source=test&function=check_phone_number&user=6666&pass=1234&owner=GST&postal_code=81009&phone_number=3125551212&local_call_time=9am-9pm&tz_method=AREACODEPOSTALNANPATZCODE
Example responses:
ERROR: check_phone_number USER DOES NOT HAVE PERMISSION TO CHECK PHONE NUMBERS - |6666|0|
ERROR: check_phone_number THIS IS NOT A VALID CALL TIME - |6666|badct|
ERROR: check_phone_number NANPA options disabled, NANPA prefix data not loaded - 0|6666
ERROR: check_phone_number INVALID PHONE NUMBER LENGTH - 72755|6666
ERROR: check_phone_number INVALID PHONE NUMBER PREFIX - 72755|6666
ERROR: check_phone_number INVALID PHONE NUMBER AREACODE - 72755|6666
ERROR: check_phone_number INVALID PHONE NUMBER NANPA AREACODE PREFIX - 7275551212|6666
ERROR: check_phone_number PHONE NUMBER IN DNC - 7275551112|6666
A success response will show the results for each tz_method used(with 0 or 1 for dialable and the gmt-offset) followed by a hash"#" and then the phone information after:
AREACODE: 1|-6#PHONE: 3125551212|1||||
AREACODE: 1|-6#POSTAL: 1|-7.0#TZCODE: 0|10#NANPA: 1|-6#PHONE: 3125551212|1|81009||GST|
ERROR: NO FUNCTION SPECIFIED
+3 -2
View File
@@ -1544,7 +1544,8 @@ pass_key VARCHAR(100) default '',
pass_cost TINYINT(2) UNSIGNED default '2',
disable_auto_dial ENUM('0','1') default '0',
queuemetrics_record_hold ENUM('0','1') default '0',
country_code_list_stats ENUM('0','1') default '0'
country_code_list_stats ENUM('0','1') default '0',
reload_timestamp DATETIME
) ENGINE=MyISAM;
CREATE TABLE vicidial_campaigns_list_mix (
@@ -3253,4 +3254,4 @@ UPDATE vicidial_configuration set value='1766' where name='qc_database_version';
UPDATE system_settings set vdc_agent_api_active='1';
UPDATE system_settings SET db_schema_version='1368',db_schema_update_date=NOW();
UPDATE system_settings SET db_schema_version='1369',db_schema_update_date=NOW(),reload_timestamp=NOW();
+4
View File
@@ -204,3 +204,7 @@ UPDATE system_settings SET db_schema_version='1367',db_schema_update_date=NOW()
CREATE UNIQUE INDEX vlca_user_campaign_id on vicidial_campaign_agents (user, campaign_id);
UPDATE system_settings SET db_schema_version='1368',db_schema_update_date=NOW() where db_schema_version < 1368;
ALTER TABLE system_settings ADD reload_timestamp DATETIME;
UPDATE system_settings SET db_schema_version='1369',db_schema_update_date=NOW(),reload_timestamp=NOW() where db_schema_version < 1369;
+27 -8
View File
@@ -84,10 +84,11 @@
# 130620-2303 - Added filtering of input to prevent SQL injection attacks and new user auth
# 130901-2008 - Changed to mysqli PHP functions
# 131120-1543 - Fixed small display bug when customer phone view is enabled
# 140213-1705 - Fixed division by zero bug
#
$version = '2.8-73';
$build = '131120-1543';
$version = '2.8-74';
$build = '140213-1705';
header ("Content-type: text/html; charset=utf-8");
@@ -1458,16 +1459,34 @@ if ($CARRIERstats > 0)
if (strlen($FTminute_count[$print_ctp])<1) {$FTminute_count[$print_ctp]=0;}
if (strlen($FIVEminute_count[$print_ctp])<1) {$FIVEminute_count[$print_ctp]=0;}
if (strlen($ONEminute_count[$print_ctp])<1) {$ONEminute_count[$print_ctp]=0;}
if ( ($TFhour_count[$print_ctp] < 1) or ($TFhour_total < 1) ) {$TFhour_pct=0;}
else {$TFhour_pct = (100*($TFhour_count[$print_ctp]/$TFhour_total));}
if ( ($SIXhour_count[$print_ctp] < 1) or ($SIXhour_total < 1) ) {$SIXhour_pct=0;}
else {$SIXhour_pct = (100*($SIXhour_count[$print_ctp]/$SIXhour_total));}
if ( ($ONEhour_count[$print_ctp] < 1) or ($ONEhour_total < 1) ) {$ONEhour_pct=0;}
else {$ONEhour_pct = (100*($ONEhour_count[$print_ctp]/$ONEhour_total));}
if ( ($FTminute_count[$print_ctp] < 1) or ($FTminute_total < 1) ) {$TFminute_pct=0;}
else {$TFminute_pct = (100*($FTminute_count[$print_ctp]/$FTminute_total));}
if ( ($FIVEminute_count[$print_ctp] < 1) or ($FIVEminute_total < 1) ) {$FIVEminute_pct=0;}
else {$FIVEminute_pct = (100*($FIVEminute_count[$print_ctp]/$FIVEminute_total));}
if ( ($ONEminute_count[$print_ctp] < 1) or ($ONEminute_total < 1) ) {$ONEminute_pct=0;}
else {$ONEminute_pct = (100*($ONEminute_count[$print_ctp]/$ONEminute_total));}
$CARRIERstatsHTML .= "<TR>";
$CARRIERstatsHTML .= "<TD BGCOLOR=white><font size=2>&nbsp;</TD>";
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=LEFT><font size=2>&nbsp; &nbsp; $TFhour_status[$print_ctp] </TD>";
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $TFhour_count[$print_ctp] </font>&nbsp;<font size=1 color='#990000'>".sprintf("%01.1f", (100*($TFhour_count[$print_ctp]/$TFhour_total)))."%</font></TD>";
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $SIXhour_count[$print_ctp] </font>&nbsp;<font size=1 color='#990000'>".sprintf("%01.1f", (100*($SIXhour_count[$print_ctp]/$SIXhour_total)))."%</font></TD>";
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $ONEhour_count[$print_ctp] </font>&nbsp;<font size=1 color='#990000'>".sprintf("%01.1f", (100*($ONEhour_count[$print_ctp]/$ONEhour_total)))."%</font></TD>";
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $FTminute_count[$print_ctp] </font>&nbsp;<font size=1 color='#990000'>".sprintf("%01.1f", (100*($FTminute_count[$print_ctp]/$FTminute_total)))."%</font></TD>";
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $FIVEminute_count[$print_ctp] </font>&nbsp;<font size=1 color='#990000'>".sprintf("%01.1f", (100*($FIVEminute_count[$print_ctp]/$FIVEminute_total)))."%</font></TD>";
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $ONEminute_count[$print_ctp] </font>&nbsp;<font size=1 color='#990000'>".sprintf("%01.1f", (100*($ONEminute_count[$print_ctp]/$ONEminute_total)))."%</font></TD>";
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $TFhour_count[$print_ctp] </font>&nbsp;<font size=1 color='#990000'>".sprintf("%01.1f", $TFhour_pct)."%</font></TD>";
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $SIXhour_count[$print_ctp] </font>&nbsp;<font size=1 color='#990000'>".sprintf("%01.1f", $SIXhour_pct)."%</font></TD>";
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $ONEhour_count[$print_ctp] </font>&nbsp;<font size=1 color='#990000'>".sprintf("%01.1f", $ONEhour_pct)."%</font></TD>";
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $FTminute_count[$print_ctp] </font>&nbsp;<font size=1 color='#990000'>".sprintf("%01.1f", $TFminute_pct)."%</font></TD>";
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $FIVEminute_count[$print_ctp] </font>&nbsp;<font size=1 color='#990000'>".sprintf("%01.1f", $FIVEminute_pct)."%</font></TD>";
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $ONEminute_count[$print_ctp] </font>&nbsp;<font size=1 color='#990000'>".sprintf("%01.1f", $ONEminute_pct)."%</font></TD>";
$CARRIERstatsHTML .= "</TR>";
$print_ctp++;
}
+10 -5
View File
@@ -3273,12 +3273,13 @@ else
# 140126-0939 - Added VMAIL_NO_INST options
# 140126-2253 - Added voicemail_instructions option for phones
# 140206-1357 - Filter dashes from new or copied campaigns and in-groups
# 140214-1643 - Added system settings dialplan reload timestamp
#
# make sure you have added a user to the vicidial_users MySQL table with at least user_level 8 to access this page the first time
$admin_version = '2.8-425a';
$build = '140206-1357';
$admin_version = '2.8-426a';
$build = '140214-1643';
$STARTtime = date("U");
$SQLdate = date("Y-m-d H:i:s");
@@ -14342,6 +14343,9 @@ if ($ADD==411111111111111)
if ($reload_dialplan_on_servers > 0)
{
$stmtB="UPDATE system_settings set reload_timestamp=NOW();";
$rslt=mysql_to_mysqli($stmtB, $link);
$stmtB="UPDATE servers set rebuild_conf_files='Y' where active='Y' and active_asterisk_server='Y' and generate_vicidial_conf='Y';";
$rslt=mysql_to_mysqli($stmtB, $link);
}
@@ -23561,7 +23565,7 @@ if ($ADD==3811)
echo "<tr bgcolor=#B6D3FC><td align=right>In-Group Email Date: </td><td align=left>$group_calldate$NWB#inbound_groups-group_emaildate$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2>\n";
horizontal_bar_chart($group_id,'8','in-group',$link,'total_calls','call count',1);
horizontal_bar_chart($group_id,'8','in-group',$link,'total_calls','call count',1,'','');
echo "</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Admin User Group: </td><td align=left><select size=1 name=user_group>\n";
@@ -28205,7 +28209,7 @@ if ($ADD==311111111111111)
$ALLagent_count = $rowx[2];
}
$stmt="SELECT version,install_date,use_non_latin,webroot_writable,enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_url,queuemetrics_log_id,queuemetrics_eq_prepend,vicidial_agent_disable,allow_sipsak_messages,admin_home_url,enable_agc_xfer_log,db_schema_version,auto_user_add_value,timeclock_end_of_day,timeclock_last_reset_date,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,vdc_agent_api_active,qc_last_pull_time,enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url,qc_features_active,outbound_autodial_active,outbound_calls_per_second,enable_tts_integration,agentonly_callback_campaign_lock,sounds_central_control_active,sounds_web_server,sounds_web_directory,active_voicemail_server,auto_dial_limit,user_territories_active,allow_custom_dialplan,db_schema_update_date,enable_second_webform,default_webphone,default_external_server_ip,webphone_url,enable_agc_dispo_log,custom_dialplan_entry,queuemetrics_loginout,callcard_enabled,queuemetrics_callstatus,default_codecs,admin_web_directory,label_title,label_first_name,label_middle_initial,label_last_name,label_address1,label_address2,label_address3,label_city,label_state,label_province,label_postal_code,label_vendor_lead_code,label_gender,label_phone_number,label_phone_code,label_alt_phone,label_security_phrase,label_email,label_comments,custom_fields_enabled,slave_db_server,reports_use_slave_db,webphone_systemkey,first_login_trigger,default_phone_registration_password,default_phone_login_password,default_server_password,admin_modify_refresh,nocache_admin,generate_cross_server_exten,queuemetrics_addmember_enabled,queuemetrics_dispo_pause,label_hide_field_logs,queuemetrics_pe_phone_append,test_campaign_calls,agents_calls_reset,default_voicemail_timezone,default_local_gmt,noanswer_log,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db,did_agent_log,campaign_cid_areacodes_enabled,pllb_grouping_limit,did_ra_extensions_enabled,expanded_list_stats,contacts_enabled,call_menu_qualify_enabled,admin_list_counts,allow_voicemail_greeting,svn_revision,queuemetrics_socket,queuemetrics_socket_url,enhanced_disconnect_logging,allow_emails,level_8_disable_add,pass_hash_enabled,pass_key,pass_cost,disable_auto_dial,queuemetrics_record_hold,country_code_list_stats from system_settings;";
$stmt="SELECT version,install_date,use_non_latin,webroot_writable,enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_url,queuemetrics_log_id,queuemetrics_eq_prepend,vicidial_agent_disable,allow_sipsak_messages,admin_home_url,enable_agc_xfer_log,db_schema_version,auto_user_add_value,timeclock_end_of_day,timeclock_last_reset_date,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,vdc_agent_api_active,qc_last_pull_time,enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url,qc_features_active,outbound_autodial_active,outbound_calls_per_second,enable_tts_integration,agentonly_callback_campaign_lock,sounds_central_control_active,sounds_web_server,sounds_web_directory,active_voicemail_server,auto_dial_limit,user_territories_active,allow_custom_dialplan,db_schema_update_date,enable_second_webform,default_webphone,default_external_server_ip,webphone_url,enable_agc_dispo_log,custom_dialplan_entry,queuemetrics_loginout,callcard_enabled,queuemetrics_callstatus,default_codecs,admin_web_directory,label_title,label_first_name,label_middle_initial,label_last_name,label_address1,label_address2,label_address3,label_city,label_state,label_province,label_postal_code,label_vendor_lead_code,label_gender,label_phone_number,label_phone_code,label_alt_phone,label_security_phrase,label_email,label_comments,custom_fields_enabled,slave_db_server,reports_use_slave_db,webphone_systemkey,first_login_trigger,default_phone_registration_password,default_phone_login_password,default_server_password,admin_modify_refresh,nocache_admin,generate_cross_server_exten,queuemetrics_addmember_enabled,queuemetrics_dispo_pause,label_hide_field_logs,queuemetrics_pe_phone_append,test_campaign_calls,agents_calls_reset,default_voicemail_timezone,default_local_gmt,noanswer_log,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db,did_agent_log,campaign_cid_areacodes_enabled,pllb_grouping_limit,did_ra_extensions_enabled,expanded_list_stats,contacts_enabled,call_menu_qualify_enabled,admin_list_counts,allow_voicemail_greeting,svn_revision,queuemetrics_socket,queuemetrics_socket_url,enhanced_disconnect_logging,allow_emails,level_8_disable_add,pass_hash_enabled,pass_key,pass_cost,disable_auto_dial,queuemetrics_record_hold,country_code_list_stats,reload_timestamp from system_settings;";
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$version = $row[0];
@@ -28328,6 +28332,7 @@ if ($ADD==311111111111111)
$disable_auto_dial = $row[117];
$queuemetrics_record_hold = $row[118];
$country_code_list_stats = $row[119];
$reload_timestamp = $row[120];
if ($pass_hash_enabled > 0) {$pass_hash_enabled = 'ENABLED';}
else {$pass_hash_enabled = 'DISABLED';}
@@ -28568,7 +28573,7 @@ if ($ADD==311111111111111)
{
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2>Custom Dialplan Entry: $NWB#settings-custom_dialplan_entry$NWE <TEXTAREA NAME=custom_dialplan_entry ROWS=8 COLS=80>$custom_dialplan_entry</TEXTAREA></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Reload Dialplan On Servers: </td><td align=left><select size=1 name=reload_dialplan_on_servers><option>1</option><option selected>0</option></select>$NWB#settings-reload_dialplan_on_servers$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Reload Dialplan On Servers: </td><td align=left><select size=1 name=reload_dialplan_on_servers><option>1</option><option selected>0</option></select>$NWB#settings-reload_dialplan_on_servers$NWE &nbsp; &nbsp; Last: $reload_timestamp</td></tr>\n";
}
else
{
+17 -16
View File
@@ -2,7 +2,7 @@
# admin_listloader_fourth_gen.php - version 2.8
# (based upon - new_listloader_superL.php script)
#
# Copyright (C) 2013 Matt Florell,Joe Johnson <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2014 Matt Florell,Joe Johnson <vicidial@gmail.com> LICENSE: AGPLv2
#
# ViciDial web-based lead loader from formatted file
#
@@ -53,10 +53,11 @@
# 130719-1914 - Added SQL to filter by template statuses, if template has specific statuses to dedupe against
# 130802-0619 - Added status deduping option without template
# 130824-2322 - Changed to mysqli PHP functions
# 140214-1022 - Fixed status dedupe bug
#
$version = '2.8-51';
$build = '130824-2322';
$version = '2.8-52';
$build = '140214-1022';
require("dbconnect_mysqli.php");
require("functions.php");
@@ -319,6 +320,18 @@ else
$LOCAL_GMT_OFF = $SERVER_GMT;
$LOCAL_GMT_OFF_STD = $SERVER_GMT;
$dedupe_status_select='';
$stmt="SELECT status, status_name from vicidial_statuses order by status;";
$rslt=mysql_to_mysqli($stmt, $link);
$stat_num_rows = mysqli_num_rows($rslt);
$snr_count=0;
while ($stat_num_rows > $snr_count)
{
$row=mysqli_fetch_row($rslt);
$dedupe_status_select .= "\t\t\t<option value='$row[0]'>$row[0] - $row[1]</option>\n";
$snr_count++;
}
#if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOCAL GMT OFFSET NOW: $LOCAL_GMT_OFF\n";}
@@ -573,19 +586,7 @@ if ( (!$OK_to_process) or ( ($leadfile) and ($file_layout!="standard" && $file_l
<span id='statuses_display'>
<select id='dedupe_statuses' name='dedupe_statuses[]' size=5 multiple>
<option value='--ALL--' selected>--ALL DISPOSITIONS--</option>
<?php
$stmt="SELECT status, status_name from vicidial_statuses order by status;";
$rslt=mysql_to_mysqli($stmt, $link);
$num_rows = mysqli_num_rows($rslt);
$count=0;
while ( $num_rows > $count )
{
$row = mysqli_fetch_row($rslt);
echo "\t\t\t<option value='$row[0]'>$row[0] - $row[1]</option>\n";
$count++;
}
?>
<?php echo $dedupe_status_select ?>
</select></font>
</span>
</td>
+348 -2
View File
@@ -84,10 +84,12 @@
# 140107-2143 - Added webserver and url logging
# 140124-1057 - Added callid_info function
# 140206-1205 - Added update_user function
# 140211-1056 - Added server_refresh function
# 140214-1540 - Added check_phone_number function
#
$version = '2.8-60';
$build = '140206-1205';
$version = '2.8-62';
$build = '140214-1540';
$api_url_log = 0;
$startMS = microtime();
@@ -348,6 +350,8 @@ if (isset($_GET["campaign_rank"])) {$campaign_rank=$_GET["campaign_rank"];}
elseif (isset($_POST["campaign_rank"])) {$campaign_rank=$_POST["campaign_rank"];}
if (isset($_GET["campaign_grade"])) {$campaign_grade=$_GET["campaign_grade"];}
elseif (isset($_POST["campaign_grade"])) {$campaign_grade=$_POST["campaign_grade"];}
if (isset($_GET["local_call_time"])) {$local_call_time=$_GET["local_call_time"];}
elseif (isset($_POST["local_call_time"])) {$local_call_time=$_POST["local_call_time"];}
header ("Content-type: text/html; charset=utf-8");
@@ -507,6 +511,7 @@ if ($non_latin < 1)
$delete_user = preg_replace('/[^A-Z]/','',$delete_user);
$campaign_rank = preg_replace('/[^-_0-9]/','',$campaign_rank);
$campaign_grade = preg_replace('/[^0-9]/','',$campaign_grade);
$local_call_time = preg_replace('/[^-_0-9a-zA-Z]/','',$local_call_time);
}
else
{
@@ -3255,6 +3260,80 @@ if ($function == 'update_phone_alias')
################################################################################
### server_refresh - forces a conf file refresh on all telco servers in the cluster
################################################################################
if ($function == 'server_refresh')
{
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
{
$stmt="SELECT count(*) from vicidial_users where user='$user' and vdc_agent_api_access='1' and ast_admin_access='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 = "server_refresh USER DOES NOT HAVE PERMISSION TO REFRESH SERVERS";
$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 (!preg_match("/REFRESH/",$stage))
{
$result = 'ERROR';
$result_reason = "server_refresh YOU MUST USE ALL REQUIRED FIELDS";
$data = "$alias_id|$alias_name|$phone_logins";
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="UPDATE system_settings set reload_timestamp=NOW();";
$rslt=mysql_to_mysqli($stmt, $link);
$stmt="UPDATE servers SET rebuild_conf_files='Y';";
$rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {echo "|$stmt|\n";}
$affected_rows = 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='SERVERS', event_type='OTHER', record_id='refresh', event_code='ADMIN API SERVERS REFRESH', event_sql=\"$SQL_log\", event_notes='servers: $affected_rows';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$result = 'SUCCESS';
$result_reason = "server_refresh SERVER REFRESH HAS BEEN TRIGGERED";
$data = "$affected_rows";
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 server_refresh
################################################################################
################################################################################
### update_list - updates list information in the vicidial_lists table and other functions
################################################################################
@@ -6879,6 +6958,273 @@ if ($function == 'update_lead')
################################################################################
### check_phone_number - allows you to check if a phone number is valid and dialable
################################################################################
if ($function == 'check_phone_number')
{
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
{
$stmt="SELECT count(*) from vicidial_users where user='$user' and vdc_agent_api_access='1' and user_level > 7 and active='Y';";
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$allowed_check=$row[0];
if ($allowed_check < 1)
{
$result = 'ERROR';
$result_reason = "check_phone_number USER DOES NOT HAVE PERMISSION TO CHECK PHONE NUMBERS";
echo "$result: $result_reason: |$user|$modify_leads|\n";
$data = "$modify_leads";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
else
{
$stmt="SELECT count(*) from vicidial_call_times where call_time_id='$local_call_time';";
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$valid_call_time=$row[0];
if ($valid_call_time < 1)
{
$result = 'ERROR';
$result_reason = "check_phone_number THIS IS NOT A VALID CALL TIME";
echo "$result: $result_reason: |$user|$local_call_time|\n";
$data = "$valid_call_time";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
else
{
if (strlen($phone_code)<1) {$phone_code='1';}
if (strlen($tz_method)<1) {$tz_method='AREACODE';}
if ( ($nanpa_ac_prefix_check == 'Y') or (preg_match("/NANPA/i",$tz_method)) )
{
$stmt="SELECT count(*) from vicidial_nanpa_prefix_codes;";
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$vicidial_nanpa_prefix_codes_count = $row[0];
if ($vicidial_nanpa_prefix_codes_count < 10)
{
$nanpa_ac_prefix_check='N';
$tz_method = preg_replace("/NANPA/",'',$tz_method);
$result = 'ERROR';
$result_reason = "check_phone_number NANPA options disabled, NANPA prefix data not loaded";
echo "$result: $result_reason - $vicidial_nanpa_prefix_codes_count|$user\n";
$data = "$inserted_alt_phones|$lead_id";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
}
$valid_number=1;
if ( (strlen($phone_number)<6) || (strlen($phone_number)>16) )
{
$valid_number=0;
$result_reason = "check_phone_number INVALID PHONE NUMBER LENGTH";
}
if ( ($usacan_prefix_check=='Y') and ($valid_number > 0) )
{
$USprefix = substr($phone_number, 3, 1);
if ($DB>0) {echo "DEBUG: check_phone_number prefix check - $USprefix|$phone_number\n";}
if ($USprefix < 2)
{
$valid_number=0;
$result_reason = "check_phone_number INVALID PHONE NUMBER PREFIX";
}
}
if ( ($usacan_areacode_check=='Y') and ($valid_number > 0) )
{
$phone_areacode = substr($phone_number, 0, 3);
$stmt = "select count(*) from vicidial_phone_codes where areacode='$phone_areacode' and country_code='1';";
if ($DB>0) {echo "DEBUG: check_phone_number areacode check query - $stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$valid_number=$row[0];
if ($valid_number < 1)
{
$result_reason = "check_phone_number INVALID PHONE NUMBER AREACODE";
}
}
if ( ($nanpa_ac_prefix_check=='Y') and ($valid_number > 0) )
{
$phone_areacode = substr($phone_number, 0, 3);
$phone_prefix = substr($phone_number, 3, 3);
$stmt = "SELECT count(*) from vicidial_nanpa_prefix_codes where areacode='$phone_areacode' and prefix='$phone_prefix';";
if ($DB>0) {echo "DEBUG: check_phone_number areacode check query - $stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$valid_number=$row[0];
if ($valid_number < 1)
{
$result_reason = "check_phone_number INVALID PHONE NUMBER NANPA AREACODE PREFIX";
}
}
if ($valid_number < 1)
{
$result = 'ERROR';
echo "$result: $result_reason - $phone_number|$user\n";
$data = "$phone_number";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
else
{
### START checking for DNC if defined ###
if ( ($dnc_check == 'Y') or ($dnc_check == 'AREACODE') )
{
if ($DB>0) {echo "DEBUG: Checking for system DNC\n";}
if ($dnc_check == 'AREACODE')
{
$phone_areacode = substr($phone_number, 0, 3);
$phone_areacode .= "XXXXXXX";
$stmt="SELECT count(*) from vicidial_dnc where phone_number IN('$phone_number','$phone_areacode');";
}
else
{$stmt="SELECT count(*) from vicidial_dnc where phone_number='$phone_number';";}
if ($DB>0) {echo "DEBUG: check_phone_number query - $stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$dnc_found=$row[0];
if ($dnc_found > 0)
{
$result = 'ERROR';
$result_reason = "check_phone_number PHONE NUMBER IN DNC";
echo "$result: $result_reason - $phone_number|$user\n";
$data = "$phone_number";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
}
if ( ($campaign_dnc_check == 'Y') or ($campaign_dnc_check == 'AREACODE') )
{
if ($DB>0) {echo "DEBUG: Checking for campaign DNC\n";}
$stmt="SELECT use_other_campaign_dnc from vicidial_campaigns where campaign_id='$campaign_id';";
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$use_other_campaign_dnc = $row[0];
$temp_campaign_id = $campaign_id;
if (strlen($use_other_campaign_dnc) > 0) {$temp_campaign_id = $use_other_campaign_dnc;}
if ($campaign_dnc_check == 'AREACODE')
{
$phone_areacode = substr($phone_number, 0, 3);
$phone_areacode .= "XXXXXXX";
$stmt="SELECT count(*) from vicidial_campaign_dnc where phone_number IN('$phone_number','$phone_areacode') and campaign_id='$temp_campaign_id';";
}
else
{$stmt="SELECT count(*) from vicidial_campaign_dnc where phone_number='$phone_number' and campaign_id='$temp_campaign_id';";}
if ($DB>0) {echo "DEBUG: check_phone_number query - $stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$dnc_found=$row[0];
if ($dnc_found > 0)
{
$result = 'ERROR';
$result_reason = "check_phone_number PHONE NUMBER IN CAMPAIGN DNC";
echo "$result: $result_reason - $phone_number|$campaign_id|$user\n";
$data = "$phone_number|$campaign_id";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
}
### END checking for DNC if defined ###
$tz_run=0;
$result_reason='';
$gmt_offset=''; $dialable='0';
if (preg_match("/AREACODE/i",$tz_method))
{
$tz_run++;
### get current gmt_offset of the phone_number
$gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,'',$postal_code,$owner,$USprefix);
### call function to determine if lead is dialable
$dialable = dialable_gmt($DB,$link,$local_call_time,$gmt_offset,$state);
$result_reason .= "AREACODE: $dialable|$gmt_offset#";
}
$gmt_offset=''; $dialable='0';
if (preg_match("/POSTAL/i",$tz_method))
{
$tz_run++;
if ( (strlen($postal_code)>4) and (strlen($postal_code)< 6) )
{
### get current gmt_offset of the phone_number
$gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,'POSTAL',$postal_code,$owner,$USprefix);
### call function to determine if lead is dialable
$dialable = dialable_gmt($DB,$link,$local_call_time,$gmt_offset,$state);
}
$result_reason .= "POSTAL: $dialable|$gmt_offset#";
}
$gmt_offset=''; $dialable='0';
if (preg_match("/TZCODE/i",$tz_method))
{
$tz_run++;
if ( (strlen($owner)>0) and (strlen($owner)< 7) )
{
### get current gmt_offset of the phone_number
$gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,'TZCODE',$postal_code,$owner,$USprefix);
### call function to determine if lead is dialable
$dialable = dialable_gmt($DB,$link,$local_call_time,$gmt_offset,$state);
}
$result_reason .= "TZCODE: $dialable|$gmt_offset#";
}
$gmt_offset=''; $dialable='0';
if (preg_match("/NANPA/i",$tz_method))
{
$tz_run++;
### get current gmt_offset of the phone_number
$gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,'NANPA',$postal_code,$owner,$USprefix);
### call function to determine if lead is dialable
$dialable = dialable_gmt($DB,$link,$local_call_time,$gmt_offset,$state);
$result_reason .= "NANPA: $dialable|$gmt_offset#";
}
$result = 'NOTICE';
$result_reason .= "PHONE: $phone_number|$phone_code|$postal_code|$state|$owner|";
echo "$result_reason\n";
$data = "";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
}
exit;
}
}
################################################################################
### END check_phone_number
################################################################################
$result = 'ERROR';
$result_reason = "NO FUNCTION SPECIFIED";
echo "$result: $result_reason\n";