added without-logs option to ADMIN_backup script for database dump

added multi-dnc submit to admin.php
added more debug output to AST_VDhopper script

git-svn-id: svn://192.168.202.10@890 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2008-06-11 10:31:22 +00:00
parent f0cf33c605
commit 83ba412515
8 changed files with 139 additions and 33 deletions
+3 -1
View File
@@ -113,7 +113,7 @@ NOTE: Upgrading from 1.1.12-3 to 2.0.1 is at the bottom
user IDs as you are adding users to the system. timeclock.php user login
page created and linked to from admin/agent/welcome screens
23. Added a new inbound/closer report for showing service levels
23. Added a new inbound/closer(queues) report for showing service levels
24. Added Calls in Queue counter to agent vicidial.php screen
@@ -125,6 +125,8 @@ NOTE: Upgrading from 1.1.12-3 to 2.0.1 is at the bottom
admin.php interface and they have new options shown in the Survey sub-
section
27. Changed add-to-DNC list to allow for multiple phone numbers per submission
+51 -1
View File
@@ -12,6 +12,7 @@
# 80316-2211 - First Build
# 80317-1609 - Added Sangoma conf file backup and changed FTP settings
# 80328-0135 - Do not attempt to archive /etc/my.cnf is --without-db flag is set
# 80611-0549 - Added DB option to backup all tables except for log tables
#
@@ -43,6 +44,7 @@ if (length($ARGV[0])>1)
{
print "allowed run time options:\n";
print " [--db-only] = only backup the database\n";
print " [--db-without-logs] = do not backup the log tables in the database\n";
print " [--conf-only] = only backup the asterisk conf files\n";
print " [--without-db] = do not backup the database\n";
print " [--without-conf] = do not backup the conf files\n";
@@ -76,6 +78,11 @@ if (length($ARGV[0])>1)
$db_only=1;
print "\n----- Backup Database Only -----\n\n";
}
if ($args =~ /--db-without-logs/i)
{
$db_without_logs=1;
print "\n----- Backup Database Without Logs -----\n\n";
}
if ($args =~ /--conf-only/i)
{
$conf_only=1;
@@ -160,6 +167,9 @@ foreach(@conf)
$i++;
}
# Customized Variables
$server_ip = $VARserver_ip; # Asterisk server IP
if (!$ARCHIVEpath) {$ARCHIVEpath = "$PATHlogs/archive";}
if (!$VARDB_port) {$VARDB_port='3306';}
@@ -231,7 +241,47 @@ $sgSTRING='';
if ( ($without_db < 1) && ($conf_only < 1) )
{
### BACKUP THE MYSQL FILES ON THE DB SERVER ###
`$mysqldumpbin --lock-tables --flush-logs $VARDB_database | $gzipbin > $ARCHIVEpath/temp/$VARserver_ip$VARDB_database$wday.gz`;
if ($db_without_logs)
{
use DBI;
### connect to MySQL database defined in the conf file
$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass")
or die "Couldn't connect to database: " . DBI->errstr;
$stmtA = "show tables;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_count=0;
$log_tables='';
$archive_tables='';
while ($sthArows > $rec_count)
{
@aryA = $sthA->fetchrow_array;
if ($aryA[0] =~ /_log|server_performance|vicidial_ivr|vicidial_hopper|vicidial_manager|web_client_sessions|imm_outcomes/)
{
$log_tables .= " $aryA[0]";
}
else
{
$archive_tables .= " $aryA[0]";
}
$rec_count++;
}
$sthA->finish();
$dump_non_log_command = "$mysqldumpbin --lock-tables --flush-logs $VARDB_database $archive_tables | $gzipbin > $ARCHIVEpath/temp/$VARserver_ip$VARDB_database$wday.gz";
$dump_log_command = "$mysqldumpbin --lock-tables --flush-logs --no-data --no-create-db $VARDB_database $log_tables | $gzipbin > $ARCHIVEpath/temp/LOGS_$VARserver_ip$VARDB_database$wday.gz";
if ($DBX) {print "$dump_non_log_command\n$dump_log_command";}
`$dump_non_log_command`;
`$dump_log_command`;
}
else
{
`$mysqldumpbin --lock-tables --flush-logs $VARDB_database | $gzipbin > $ARCHIVEpath/temp/$VARserver_ip$VARDB_database$wday.gz`;
}
}
if ( ($without_conf < 1) && ($db_only < 1) )
+22 -4
View File
@@ -1087,11 +1087,13 @@ foreach(@campaign_id)
@REC_gmt_to_hopper=@MT;
@REC_state_to_hopper=@MT;
@REC_status_to_hopper=@MT;
@REC_modify_to_hopper=@MT;
@REC_user_to_hopper=@MT;
if ($rec_ct[$i] > 0)
{
if ($DB) {print " looking for RECYCLE leads, maximum of 100\n";}
$stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state,status FROM vicidial_list where $recycle_SQL[$i] and list_id IN($camp_lists[$i]) and lead_id NOT IN($lead_id_lists) and ($all_gmtSQL[$i]) $lead_filter_sql[$i] limit 100;";
$stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state,status,modify_date,user FROM vicidial_list where $recycle_SQL[$i] and list_id IN($camp_lists[$i]) and lead_id NOT IN($lead_id_lists) and ($all_gmtSQL[$i]) $lead_filter_sql[$i] limit 100;";
if ($DBX) {print " |$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -1107,6 +1109,8 @@ foreach(@campaign_id)
$REC_phone_to_hopper[$REC_rec_countLEADS] = "$aryA[3]";
$REC_state_to_hopper[$REC_rec_countLEADS] = "$aryA[4]";
$REC_status_to_hopper[$REC_rec_countLEADS] = "$aryA[5]";
$REC_modify_to_hopper[$REC_rec_countLEADS] = "$aryA[6]";
$REC_user_to_hopper[$REC_rec_countLEADS] = "$aryA[7]";
if ($DB_show_offset) {print "LEAD_ADD: $aryA[2] $aryA[3] $aryA[4]\n";}
$REC_rec_countLEADS++;
}
@@ -1127,6 +1131,8 @@ foreach(@campaign_id)
@NEW_gmt_to_hopper=@MT;
@NEW_state_to_hopper=@MT;
@NEW_status_to_hopper=@MT;
@NEW_modify_to_hopper=@MT;
@NEW_user_to_hopper=@MT;
if ($NEW_count > 0)
{
$NEW_level = int($hopper_level[$i] / $NEW_count);
@@ -1134,7 +1140,7 @@ foreach(@campaign_id)
# $order_stmt = 'order by called_count, lead_id asc';
if ($DB) {print " looking for $NEW_level NEW leads mixed in with $OTHER_level other leads\n";}
$stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state,status FROM vicidial_list where called_since_last_reset='N' and status IN('NEW') and list_id IN($camp_lists[$i]) and lead_id NOT IN($lead_id_lists) and ($all_gmtSQL[$i]) $lead_filter_sql[$i] $order_stmt limit $NEW_level;";
$stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state,status,modify_date,user FROM vicidial_list where called_since_last_reset='N' and status IN('NEW') and list_id IN($camp_lists[$i]) and lead_id NOT IN($lead_id_lists) and ($all_gmtSQL[$i]) $lead_filter_sql[$i] $order_stmt limit $NEW_level;";
if ($DBX) {print " |$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -1148,6 +1154,8 @@ foreach(@campaign_id)
$NEW_phone_to_hopper[$NEW_rec_countLEADS] = "$aryA[3]";
$NEW_state_to_hopper[$NEW_rec_countLEADS] = "$aryA[4]";
$NEW_status_to_hopper[$NEW_rec_countLEADS] = "$aryA[5]";
$NEW_modify_to_hopper[$NEW_rec_countLEADS] = "$aryA[6]";
$NEW_user_to_hopper[$NEW_rec_countLEADS] = "$aryA[7]";
if ($DB_show_offset) {print "LEAD_ADD: $aryA[2] $aryA[3] $aryA[4]\n";}
$NEW_rec_countLEADS++;
}
@@ -1167,10 +1175,12 @@ foreach(@campaign_id)
@state_to_hopper=@MT;
@phone_to_hopper=@MT;
@status_to_hopper=@MT;
@modify_to_hopper=@MT;
@user_to_hopper=@MT;
if ($campaign_leads_to_call[$i] > 0)
{
if ($DB) {print " lead call order: $order_stmt\n";}
$stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state,status FROM vicidial_list where called_since_last_reset='N' and status IN($STATUSsql[$i]) and list_id IN($camp_lists[$i]) and lead_id NOT IN($lead_id_lists) and ($all_gmtSQL[$i]) $lead_filter_sql[$i] $order_stmt limit $OTHER_level;";
$stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state,status,modify_date,user FROM vicidial_list where called_since_last_reset='N' and status IN($STATUSsql[$i]) and list_id IN($camp_lists[$i]) and lead_id NOT IN($lead_id_lists) and ($all_gmtSQL[$i]) $lead_filter_sql[$i] $order_stmt limit $OTHER_level;";
if ($DBX) {print " |$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -1193,6 +1203,8 @@ foreach(@campaign_id)
$state_to_hopper[$rec_countLEADS] = "$NEW_state_to_hopper[$NEW_in]";
$phone_to_hopper[$rec_countLEADS] = "$NEW_phone_to_hopper[$NEW_in]";
$status_to_hopper[$rec_countLEADS] = "$NEW_status_to_hopper[$NEW_in]";
$modify_to_hopper[$rec_countLEADS] = "$NEW_modify_to_hopper[$NEW_in]";
$user_to_hopper[$rec_countLEADS] = "$NEW_user_to_hopper[$NEW_in]";
if ($DB_show_offset) {print "LEAD_ADD: $NEW_leads_to_hopper[$NEW_in] $NEW_phone_to_hopper[$NEW_in]\n";}
$rec_countLEADS++;
$NEW_in++;
@@ -1207,6 +1219,8 @@ foreach(@campaign_id)
$state_to_hopper[$rec_countLEADS] = "$REC_state_to_hopper[$REC_insert_count]";
$phone_to_hopper[$rec_countLEADS] = "$REC_phone_to_hopper[$REC_insert_count]";
$status_to_hopper[$rec_countLEADS] = "$REC_status_to_hopper[$REC_insert_count]";
$modify_to_hopper[$rec_countLEADS] = "$REC_modify_to_hopper[$REC_insert_count]";
$user_to_hopper[$rec_countLEADS] = "$REC_user_to_hopper[$REC_insert_count]";
$rec_countLEADS++;
$REC_insert_count++;
}
@@ -1216,6 +1230,8 @@ foreach(@campaign_id)
$state_to_hopper[$rec_countLEADS] = "$aryA[4]";
$phone_to_hopper[$rec_countLEADS] = "$aryA[3]";
$status_to_hopper[$rec_countLEADS] = "$aryA[5]";
$modify_to_hopper[$rec_countLEADS] = "$aryA[6]";
$user_to_hopper[$rec_countLEADS] = "$aryA[7]";
if ($DB_show_offset) {print "LEAD_ADD: $aryA[2] $aryA[3] $aryA[4]\n";}
$rec_countLEADS++;
$rec_count++;
@@ -1231,6 +1247,8 @@ foreach(@campaign_id)
$state_to_hopper[$rec_countLEADS] = "$REC_state_to_hopper[$REC_insert_count]";
$phone_to_hopper[$rec_countLEADS] = "$REC_phone_to_hopper[$REC_insert_count]";
$status_to_hopper[$rec_countLEADS] = "$REC_status_to_hopper[$REC_insert_count]";
$modify_to_hopper[$rec_countLEADS] = "$REC_modify_to_hopper[$REC_insert_count]";
$user_to_hopper[$rec_countLEADS] = "$REC_user_to_hopper[$REC_insert_count]";
$rec_countLEADS++;
$REC_insert_count++;
}
@@ -1274,7 +1292,7 @@ foreach(@campaign_id)
if ($DBX) {print "LEAD INSERTED: $affected_rows|$leads_to_hopper[$h]|\n";}
if ($DB_detail)
{
$detail_string = "|$campaign_id[$i]|$leads_to_hopper[$h]|$phone_to_hopper[$h]|$state_to_hopper[$h]|$gmt_to_hopper[$h]|$status_to_hopper[$h]|";
$detail_string = "|$campaign_id[$i]|$leads_to_hopper[$h]|$phone_to_hopper[$h]|$state_to_hopper[$h]|$gmt_to_hopper[$h]|$status_to_hopper[$h]|$modify_to_hopper[$h]|$user_to_hopper[$h]|";
&detail_logger;
}
}
+4 -4
View File
@@ -505,11 +505,11 @@ rm -f /usr/lib/asterisk/modules/res_speech.so
mkdir /usr/src/asterisk-1.4
cd /usr/src/asterisk-1.4
wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.4.19.tar.gz
wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.4.20.1.tar.gz
wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.4.9.tar.gz
wget http://ftp.digium.com/pub/libpri/releases/libpri-1.4.3.tar.gz
gunzip asterisk-1.4.18.tar.gz
tar xvf asterisk-1.4.18.tar
gunzip asterisk-1.4.20.1.tar.gz
tar xvf asterisk-1.4.20.1.tar
gunzip zaptel-1.4.9.tar.gz
tar xvf zaptel-1.4.9.tar
gunzip libpri-1.4.3.tar.gz
@@ -522,7 +522,7 @@ cd ../libpri-1.4.3
make clean
make
make install
cd ../asterisk-1.4.18
cd ../asterisk-1.4.20.1
wget http://www.eflo.net/files/enter.h
wget http://www.eflo.net/files/leave.h
mv -f enter.h apps/enter.h
@@ -415,6 +415,14 @@ exten => 8372,3,AGI(agi-VDADautoREMINDER.agi,${EXTEN})
exten => 8372,4,AGI(agi-VDADautoREMINDER.agi,${EXTEN})
exten => 8372,5,Hangup
; VICIDIAL SURVEY transfer script AMD with Load Balanced:
exten => 8373,1,AGI(agi://127.0.0.1:4577/call_log)
exten => 8373,2,AMD(2000|2000|1000|5000|120|50|4|256)
exten => 8373,3,AGI(VD_amd.agi,${EXTEN})
exten => 8373,4,AGI(agi-VDAD_ALL_outbound.agi,SURVEYCAMP-----LB)
exten => 8373,5,AGI(agi-VDAD_ALL_outbound.agi,SURVEYCAMP-----LB)
exten => 8373,6,Hangup
;#### VDAD SIP UNREGISTERED TRANSFER ENTRIES ####
;#### Use these entries IN PLACE OF the entries above if you are using SIP trunks
;#### and are not registering your provider in sip.conf
@@ -468,6 +476,16 @@ exten => 8372,5,Hangup
;exten => 8372,3,AGI(agi-VDADautoREMINDER.agi,${EXTEN})
;exten => 8372,4,AGI(agi-VDADautoREMINDER.agi,${EXTEN})
;exten => 8372,5,Hangup
;
;; VICIDIAL SURVEY transfer script AMD with Load Balanced:
;exten => 8373,1,Playback(sip-silence)
;exten => 8373,2,AGI(agi://127.0.0.1:4577/call_log)
;exten => 8373,3,AMD(2000|2000|1000|5000|120|50|4|256)
;exten => 8373,4,AGI(VD_amd.agi,${EXTEN})
;exten => 8373,5,AGI(agi-VDAD_ALL_outbound.agi,SURVEYCAMP-----LB)
;exten => 8373,6,AGI(agi-VDAD_ALL_outbound.agi,SURVEYCAMP-----LB)
;exten => 8373,7,Hangup
;
@@ -192,6 +192,10 @@ Modify Timeclock Log Record||
Delete Timeclock Log Record||
USER GROUP TIMECLOCK STATUS REPORT||
Click here to see the Timeclock Status for this user group||
ADD NUMBERS TO THE DNC LIST||
Phone Numbers: ||
one phone number per line only||
VICIDIAL DNC List -<\/B> This Do Not Call list contains every lead that has been set to a status of DNC in the system. Through the LISTS - ADD NUMBER TO DNC page you are able to manually add numbers to this list so that they will not be called by campaigns that use the internal DNC list||
############################################################ CLIENT
+35 -21
View File
@@ -757,6 +757,8 @@ if (isset($_GET["modify_timeclock_log"])) {$modify_timeclock_log=$_GET["modify
elseif (isset($_POST["modify_timeclock_log"])) {$modify_timeclock_log=$_POST["modify_timeclock_log"];}
if (isset($_GET["delete_timeclock_log"])) {$delete_timeclock_log=$_GET["delete_timeclock_log"];}
elseif (isset($_POST["delete_timeclock_log"])) {$delete_timeclock_log=$_POST["delete_timeclock_log"];}
if (isset($_GET["phone_numbers"])) {$phone_numbers=$_GET["phone_numbers"];}
elseif (isset($_POST["phone_numbers"])) {$phone_numbers=$_POST["phone_numbers"];}
if (isset($script_id)) {$script_id= strtoupper($script_id);}
if (isset($lead_filter_id)) {$lead_filter_id = strtoupper($lead_filter_id);}
@@ -933,6 +935,9 @@ $group_rank = ereg_replace("[^-0-9]","",$group_rank);
$campaign_rank = ereg_replace("[^-0-9]","",$campaign_rank);
$queue_priority = ereg_replace("[^-0-9]","",$queue_priority);
### DIGITS and NEWLINES
$phone_numbers = ereg_replace("[^\n0-9]","",$phone_numbers);
### Y or N ONLY ###
$active = ereg_replace("[^NY]","",$active);
$allow_closers = ereg_replace("[^NY]","",$allow_closers);
@@ -1304,11 +1309,12 @@ $survey_camp_record_dir = ereg_replace(";","",$survey_camp_record_dir);
# 80515-1345 - Added Shifts sub-section to Admin section
# 80528-0001 - Added campaign survey sub-section
# 80528-1102 - Added user timeclock edit options
# 80608-1304 - Changed add-to-DNC to allow for multiple entries per submission
#
# 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.0.5-131';
$build = '80528-0001';
$admin_version = '2.0.5-132';
$build = '80608-1304';
$STARTtime = date("U");
$SQLdate = date("Y-m-d H:i:s");
@@ -2875,7 +2881,7 @@ echo "<TABLE WIDTH=98% BGCOLOR=#E6E6E6 cellpadding=2 cellspacing=0><TR><TD ALIGN
<BR>
<A NAME="vicidial_list-dnc">
<BR>
<B>VICIDIAL DNC List -</B> This Do Not Call list contains every lead that has been set to a status of DNC in the system. Through the LISTS - ADD NUMBER TO DNC page you are able to manually add a number to this list so that it will not be called by campaigns that use the internal DNC list.
<B>VICIDIAL DNC List -</B> This Do Not Call list contains every lead that has been set to a status of DNC in the system. Through the LISTS - ADD NUMBER TO DNC page you are able to manually add numbers to this list so that they will not be called by campaigns that use the internal DNC list.
@@ -4882,34 +4888,42 @@ if ($ADD==121)
echo "<TABLE><TR><TD>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
if (strlen($phone_number) > 2)
if (strlen($phone_numbers) > 2)
{
$stmt="SELECT count(*) from vicidial_dnc where phone_number='$phone_number';";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
if ($row[0] > 0)
{echo "<br>DNC NOT ADDED - This phone number is already in the Do Not Call List: $phone_number<BR><BR>\n";}
else
$PN = explode("\n",$phone_numbers);
$PNct = count($PN);
$p=0;
while ($p < $PNct)
{
$stmt="INSERT INTO vicidial_dnc (phone_number) values('$phone_number');";
$stmt="SELECT count(*) from vicidial_dnc where phone_number='$PN[$p]';";
$rslt=mysql_query($stmt, $link);
echo "<br><B>DNC ADDED: $phone_number</B><BR><BR>\n";
### LOG INSERTION TO LOG FILE ###
if ($WeBRooTWritablE > 0)
$row=mysql_fetch_row($rslt);
if ($row[0] > 0)
{echo "<br>DNC NOT ADDED - This phone number is already in the Do Not Call List: $PN[$p]\n";}
else
{
$fp = fopen ("./admin_changes_log.txt", "a");
fwrite ($fp, "$date|ADD A NEW DNC NUMBER|$PHP_AUTH_USER|$ip|'$phone_number'|\n");
fclose($fp);
$stmt="INSERT INTO vicidial_dnc (phone_number) values('$PN[$p]');";
$rslt=mysql_query($stmt, $link);
echo "<br><B>DNC ADDED: $PN[$p]</B>\n";
}
$p++;
}
### LOG INSERTION TO LOG FILE ###
if ($WeBRooTWritablE > 0)
{
$fp = fopen ("./admin_changes_log.txt", "a");
fwrite ($fp, "$date|ADD A NEW DNC NUMBER|$PHP_AUTH_USER|$ip|'$phone_number'|\n");
fclose($fp);
}
}
echo "<br>ADD A NUMBER TO THE DNC LIST<form action=$PHP_SELF method=POST>\n";
echo "<br>ADD NUMBERS TO THE DNC LIST<form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=ADD value=121>\n";
echo "<center><TABLE width=$section_width cellspacing=3>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Phone Number: </td><td align=left><input type=text name=phone_number size=14 maxlength=12> (digits only)$NWB#vicidial_list-dnc$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Phone Numbers: <BR><BR> (one phone number per line only)<BR>$NWB#vicidial_list-dnc$NWE</td><td align=left><TEXTAREA name=phone_numbers ROWS=20 COLS=20></TEXTAREA></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2><input type=submit name=SUBMIT value=SUBMIT></td></tr>\n";
echo "</TABLE></center>\n";
@@ -60,9 +60,9 @@ $HHteod = substr($timeclock_end_of_day,0,2);
$MMteod = substr($timeclock_end_of_day,2,2);
if ($HHMM < $timeclock_end_of_day)
{$EoD = mktime($HHteod, $MMteod, 0, date("m"), date("d")-1, date("Y"));}
{$EoD = mktime($HHteod, $MMteod, 10, date("m"), date("d")-1, date("Y"));}
else
{$EoD = mktime($HHteod, $MMteod, 0, date("m"), date("d"), date("Y"));}
{$EoD = mktime($HHteod, $MMteod, 10, date("m"), date("d"), date("Y"));}
$EoDdate = date("Y-m-d H:i:s", $EoD);