added voicemail and crontab backups to ADMIN_backup.pl script

improved staggered dialing in the FILL script
other small fixes

git-svn-id: svn://192.168.202.10@1335 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2010-02-11 15:00:13 +00:00
parent da7f1c9f03
commit e4bf160b61
4 changed files with 76 additions and 31 deletions
+2 -2
View File
@@ -1759,7 +1759,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) )
$stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$VARserver_ip','','Originate','$VHqueryCID','Exten: 83047777777777','Context: vicidial-auto','Channel: Local/$dtmf_silent_prefix$VDADconf_exten$at$ext_context','Priority: 1','Callerid: $agent_alert_exten','Timeout: 10','','','','')";
$affected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='02048'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
if ($AGILOG) {$agi_string = "-- VDCL agent alert: |$VHqueryCID|7$VDADconf_exten|$channel|insert to vicidial_manager"; &agi_output;}
if ($AGILOG) {$agi_string = "-- VDCL agent alert: |$VHqueryCID|7$VDADconf_exten|$channel|$agent_alert_exten|insert to vicidial_manager"; &agi_output;}
usleep(1 * $agent_alert_delay * 1000);
}
@@ -2161,7 +2161,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) )
$stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$VDADserver_ip','','Originate','$VHqueryCID','Exten: 83047777777777','Context: vicidial-auto','Channel: Local/$alertVDADremDIALstr$at$ext_context','Priority: 1','Callerid: $agent_alert_exten','Timeout: 10','','','','')";
$affected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='02068'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
if ($AGILOG) {$agi_string = "-- VDCL agent alert: |$VHqueryCID|$alertVDADremDIALstr|$channel|insert to vicidial_manager"; &agi_output;}
if ($AGILOG) {$agi_string = "-- VDCL agent alert: |$VHqueryCID|$alertVDADremDIALstr|$agent_alert_exten|$channel|insert to vicidial_manager"; &agi_output;}
usleep(1 * $agent_alert_delay * 1000);
}
+48 -16
View File
@@ -5,7 +5,7 @@
# DESCRIPTION:
# Backs-up the asterisk database, conf/agi/sounds/bin files
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGELOG
#
@@ -14,6 +14,7 @@
# 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
# 90620-1851 - Moved mysqldump bin lookup to database backup section
# 100211-0910 - Added crontab backup and voicemail bacup option
#
$secT = time();
@@ -50,6 +51,8 @@ if (length($ARGV[0])>1)
print " [--without-conf] = do not backup the conf files\n";
print " [--without-web] = do not backup web files\n";
print " [--without-sounds] = do not backup asterisk sounds\n";
print " [--without-voicemail] = do not backup asterisk voicemail\n";
print " [--without-crontab] = do not backup crontab\n";
print " [--ftp-transfer] = Transfer backup to FTP server\n";
print " [--debugX] = super debug\n";
print " [--debug] = debug\n";
@@ -108,6 +111,16 @@ if (length($ARGV[0])>1)
$without_web=1;
print "\n----- No web files Backup -----\n\n";
}
if ($args =~ /--without-voicemail/i)
{
$without_voicemail=1;
print "\n----- No voicemail files Backup -----\n\n";
}
if ($args =~ /--without-crontab/i)
{
$without_crontab=1;
print "\n----- No crontab Backup -----\n\n";
}
if ($args =~ /--ftp-transfer/i)
{
$ftp_transfer=1;
@@ -213,6 +226,7 @@ $linux='_LINUX_';
$bin='_BIN_';
$web='_WEB_';
$sounds='_SOUNDS_';
$voicemail='_VOICEMAIL_';
$all='_ALL_';
$tar='.tar';
$gz='.gz';
@@ -279,6 +293,7 @@ if ( ($without_db < 1) && ($conf_only < 1) )
}
else
{
if ($DBX) {print "$mysqldumpbin --user=$VARDB_user --password=$VARDB_pass --lock-tables --flush-logs $VARDB_database | $gzipbin > $ARCHIVEpath/temp/$VARserver_ip$VARDB_database$wday.gz\n";}
`$mysqldumpbin --user=$VARDB_user --password=$VARDB_pass --lock-tables --flush-logs $VARDB_database | $gzipbin > $ARCHIVEpath/temp/$VARserver_ip$VARDB_database$wday.gz`;
}
}
@@ -286,8 +301,10 @@ if ( ($without_db < 1) && ($conf_only < 1) )
if ( ($without_conf < 1) && ($db_only < 1) )
{
### BACKUP THE ASTERISK CONF FILES ON THE SERVER ###
if ($DBX) {print "$tarbin cf $ARCHIVEpath/temp/$VARserver_ip$conf$wday$tar /etc/astguiclient.conf /etc/zaptel.conf /etc/asterisk\n";}
`$tarbin cf $ARCHIVEpath/temp/$VARserver_ip$conf$wday$tar /etc/astguiclient.conf /etc/zaptel.conf /etc/asterisk`;
### BACKUP THE WANPIPE CONF FILES(if there are any) ###
if ( -e ('/etc/wanpipe/wanpipe1.conf'))
{
@@ -301,60 +318,73 @@ if ( ($without_conf < 1) && ($db_only < 1) )
if ( -e ('/etc/wanpipe/wanpipe8.conf')) {$sgSTRING .= '/etc/wanpipe/wanpipe8.conf ';}
if ( -e ('/etc/wanpipe/wanrouter.rc')) {$sgSTRING .= '/etc/wanpipe/wanrouter.rc ';}
if ($DBX) {print "$tarbin cf $ARCHIVEpath/temp/$VARserver_ip$sangoma$wday$tar $sgSTRING\n";}
`$tarbin cf $ARCHIVEpath/temp/$VARserver_ip$sangoma$wday$tar $sgSTRING`;
}
### BACKUP OTHER CONF FILES ON THE SERVER ###
$files = "";
if ($without_db < 1)
{
### BACKUP OTHER CONF FILES ON THE SERVER ###
$files = "";
if ( -e ('/etc/my.cnf')) {$files .= "/etc/my.cnf ";}
if ( -e ('/etc/hosts')) {$files .= "/etc/hosts ";}
if ( -e ('/etc/rc.d/rc.local')) {$files .= "/etc/rc.d/rc.local ";}
if ( -e ('/etc/resolv.conf')) {$files .= "/etc/resolv.conf ";}
`$tarbin cf $ARCHIVEpath/temp/$VARserver_ip$linux$wday$tar $files`;
}
else
if ($without_crontab < 1)
{
### BACKUP OTHER CONF FILES ON THE SERVER ###
$files = "";
if ( -e ('/etc/hosts')) {$files += "/etc/hosts ";}
if ( -e ('/etc/rc.d/rc.local')) {$files += "/etc/rc.d/rc.local ";}
if ( -e ('/etc/resolv.conf')) {$files += "/etc/resolv.conf ";}
`$tarbin cf $ARCHIVEpath/temp/$VARserver_ip$linux$wday$tar $files`;
`crontab -l > /etc/crontab_snapshot`;
if ( -e ('/etc/crontab_snapshot')) {$files .= "/etc/crontab_snapshot ";}
}
if ( -e ('/etc/hosts')) {$files .= "/etc/hosts ";}
if ( -e ('/etc/rc.d/rc.local')) {$files .= "/etc/rc.d/rc.local ";}
if ( -e ('/etc/resolv.conf')) {$files .= "/etc/resolv.conf ";}
if ($DBX) {print "$tarbin cf $ARCHIVEpath/temp/$VARserver_ip$linux$wday$tar $files\n";}
`$tarbin cf $ARCHIVEpath/temp/$VARserver_ip$linux$wday$tar $files`;
}
if ( ($conf_only < 1) && ($db_only < 1) && ($without_web < 1) )
{
### BACKUP THE WEB FILES ON THE SERVER ###
if ($DBX) {print "$tarbin cf $ARCHIVEpath/temp/$VARserver_ip$web$wday$tar $PATHweb\n";}
`$tarbin cf $ARCHIVEpath/temp/$VARserver_ip$web$wday$tar $PATHweb`;
}
if ( ($conf_only < 1) && ($db_only < 1) )
{
### BACKUP THE ASTGUICLIENT AND AGI FILES ON THE SERVER ###
if ($DBX) {print "$tarbin cf $ARCHIVEpath/temp/$VARserver_ip$bin$wday$tar $PATHagi $PATHhome\n";}
`$tarbin cf $ARCHIVEpath/temp/$VARserver_ip$bin$wday$tar $PATHagi $PATHhome`;
}
if ( ($conf_only < 1) && ($db_only < 1) && ($without_sounds < 1) )
{
### BACKUP THE ASTERISK SOUNDS ON THE SERVER ###
if ($DBX) {print "$tarbin cf $ARCHIVEpath/temp/$VARserver_ip$sounds$wday$tar $PATHsounds\n";}
`$tarbin cf $ARCHIVEpath/temp/$VARserver_ip$sounds$wday$tar $PATHsounds`;
}
if ( ($conf_only < 1) && ($db_only < 1) && ($without_voicemail < 1) )
{
### BACKUP THE ASTERISK VOICEMAIL ON THE SERVER ###
if ($DBX) {print "$tarbin cf $ARCHIVEpath/temp/$VARserver_ip$voicemail$wday$tar /var/spool/asterisk/voicemail\n";}
`$tarbin cf $ARCHIVEpath/temp/$VARserver_ip$voicemail$wday$tar /var/spool/asterisk/voicemail`;
}
### PUT EVERYTHING TOGETHER TO BE COMPRESSED ###
if ($DBX) {print "$tarbin cf $ARCHIVEpath/$VARserver_ip$all$wday$tar $ARCHIVEpath/temp\n";}
`$tarbin cf $ARCHIVEpath/$VARserver_ip$all$wday$tar $ARCHIVEpath/temp`;
### REMOVE OLD GZ FILE
if ($DBX) {print "rm -f $ARCHIVEpath/$VARserver_ip$all$wday$tar$gz\n";}
`rm -f $ARCHIVEpath/$VARserver_ip$all$wday$tar$gz`;
### COMPRESS THE ALL FILE ###
if ($DBX) {print "$gzipbin -9 $ARCHIVEpath/$VARserver_ip$all$wday$tar\n";}
`$gzipbin -9 $ARCHIVEpath/$VARserver_ip$all$wday$tar`;
### REMOVE TEMP FILES ###
if ($DBX) {print "rm -fR $ARCHIVEpath/temp\n";}
`rm -fR $ARCHIVEpath/temp`;
@@ -371,4 +401,6 @@ if ($ftp_transfer > 0)
}
if ($DBX) {print "DONE, Exiting...\n";}
exit;
+12 -9
View File
@@ -204,14 +204,17 @@ if (-e "$PATHconf")
if ($AUTO)
{
$manual='n';
@ip = `/sbin/ifconfig`;
$j=0;
while($#ip>=$j)
{
if ($ip[$j] =~ /inet addr/) {$VARserver_ip = $ip[$j]; $j=1000;}
$j++;
if (length($VARserver_ip)<7)
{
@ip = `/sbin/ifconfig`;
$j=0;
while($#ip>=$j)
{
if ($ip[$j] =~ /inet addr/) {$VARserver_ip = $ip[$j]; $j=1000;}
$j++;
}
$VARserver_ip =~ s/.*addr:| Bcast.*|\r|\n|\t| //gi;
}
$VARserver_ip =~ s/.*addr:| Bcast.*|\r|\n|\t| //gi;
}
else
{
@@ -481,10 +484,10 @@ exit;
sub leading_zero($)
{
{
$_ = $_[0];
s/^(\d)$/0$1/;
s/^(\d\d)$/0$1/;
return $_;
} # End of the leading_zero() routine.
} # End of the leading_zero() routine.
+14 -4
View File
@@ -606,9 +606,9 @@ while($one_day_interval > 0)
else
{
$stmtA = "UPDATE vicidial_hopper set status='INCALL' where lead_id='$lead_id';";
print "|$stmtA|\n";
# print "|$stmtA|\n";
$UQaffected_rows = $dbhA->do($stmtA);
print "hopper row updated to INCALL: |$UQaffected_rows|$lead_id|\n";
# print "hopper row updated to INCALL: |$UQaffected_rows|$lead_id|\n";
$stmtA = "SELECT list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,address3,alt_phone,called_count FROM vicidial_list where lead_id='$lead_id';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
@@ -715,7 +715,14 @@ while($one_day_interval > 0)
{
$stmtA = "UPDATE vicidial_list set called_since_last_reset='$CSLR', called_count='$called_count',user='VDAD',last_local_call_time='$LLCT_DATE' where lead_id='$lead_id';";
}
$affected_rows = $dbhA->do($stmtA);
if ($staggered < 1)
{
$affected_rows = $dbhA->do($stmtA);
}
else
{
$vl_updates[$staggered_ct] = $stmtA;
}
$stmtA = "DELETE FROM vicidial_hopper where lead_id='$lead_id';";
$affected_rows = $dbhA->do($stmtA);
@@ -880,6 +887,7 @@ while($one_day_interval > 0)
$TEMP_vm_insert = $vm_inserts[$staggered_fill];
$TEMP_vac_insert = $vac_inserts[$staggered_fill];
$TEMP_vl_update = $vl_updates[$staggered_fill];
$TEMP_st_logged = $st_logged[$staggered_fill];
$TEMP_vm_insert =~ s/XXXXXXXXXXXXXXX/$TEMP_server_ip/gi;
@@ -887,11 +895,12 @@ while($one_day_interval > 0)
if (length($TEMP_vm_insert) > 20)
{
$affected_rows_vl = $dbhA->do($TEMP_vl_update);
$affected_rows_vm = $dbhA->do($TEMP_vm_insert);
$affected_rows_vac = $dbhA->do($TEMP_vac_insert);
}
$event_string = "| number call stagger dialed|$TEMP_server_ip|$staggered_fill|$staggered_ct|$affected_rows_vm|$affected_rows_vac $TEMP_st_logged";
$event_string = "| number call stagger dialed|$TEMP_server_ip|$staggered_fill|$staggered_ct|$affected_rows_vm|$affected_rows_vac|$affected_rows_vl $TEMP_st_logged";
&event_logger;
### sleep for 2.5 hundredths of a second to not flood the server with new calls
@@ -912,6 +921,7 @@ while($one_day_interval > 0)
$staggered_ct=0;
@vm_inserts=@MT;
@vac_inserts=@MT;
@vl_updates=@MT;
@st_logged=@MT;
###############################################################################
###### END - experimental balanced FILL dialing ($staggered)