diff --git a/bin/ADMIN_keepalive_ALL.pl b/bin/ADMIN_keepalive_ALL.pl index c57f785c..99cc8038 100644 --- a/bin/ADMIN_keepalive_ALL.pl +++ b/bin/ADMIN_keepalive_ALL.pl @@ -79,6 +79,7 @@ # 121215-2036 - Added email inbound script keepalive, option E # 130103-0808 - Added CLI options for delay to be used with auto-dial and FILL processes # 130108-1657 - Changes for Asterisk 1.8 compatibility +# 130227-1605 - Added --fill-staggered option for the AST_VDauto_dialFILL script # $DB=0; # Debug flag @@ -100,6 +101,7 @@ $reset_test = "$hour$min"; $cu3way_delay=''; $autodial_delay=''; $adfill_delay=''; +$fill_staggered=''; ### begin parsing run-time options ### if (length($ARGV[0])>1) @@ -117,6 +119,7 @@ if (length($ARGV[0])>1) print " [-test] = test\n"; print " [-autodial-delay=X] = setting delay milliseconds on local auto-dial process\n"; print " [-adfill-delay=X] = setting delay milliseconds on auto-dial FILL process\n"; + print " [-fill-staggered] = enable experimental staggered auto-dial FILL process\n"; print " [-cu3way] = keepalive for the optional 3way conference checker\n"; print " [-cu3way-delay=X] = setting delay seconds on 3way conference checker\n"; print " [-debug] = verbose debug messages\n"; @@ -171,6 +174,11 @@ if (length($ARGV[0])>1) } @CLIvarADFARY=@MT; @CLIvarADFARY=@MT; } + if ($args =~ /-fill-staggered/i) + { + $fill_staggered='--staggered'; + if ($DB > 0) {print "\n----- FILL STAGGERED ENABLED -----\n\n";} + } if ($args =~ /-cu3way/i) { $cu3way=1; @@ -604,7 +612,7 @@ if ( { if ($DB) {print "starting AST_VDauto_dial_FILL...\n";} # add a '-L' to the command below to activate logging - `/usr/bin/screen -d -m -S ASTVDautoFILL $PATHhome/AST_VDauto_dial_FILL.pl $adfill_delay`; + `/usr/bin/screen -d -m -S ASTVDautoFILL $PATHhome/AST_VDauto_dial_FILL.pl --debug $fill_staggered $adfill_delay`; } if ( ($email_inbound > 0) && ($runningemail_inbound < 1) ) { diff --git a/bin/AST_VDauto_dial_FILL.pl b/bin/AST_VDauto_dial_FILL.pl index 679a05a7..e53363a9 100644 --- a/bin/AST_VDauto_dial_FILL.pl +++ b/bin/AST_VDauto_dial_FILL.pl @@ -12,7 +12,7 @@ # # Should only be run on one server in a multi-server Asterisk/VICIDIAL cluster # -# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2013 Matt Florell LICENSE: AGPLv2 # # CHANGELOG: # 61115-1246 - First build, framework setup, non-functional @@ -33,6 +33,7 @@ # 110901-1127 - Added campaign areacode cid function # 110922-1203 - Added logging of last calltime to campaign # 120831-1502 - Added vicidial_dial_log outbound call logging +# 130227-1604 - Cleanup of staggered code, resetting of variables and arrays # ### begin parsing run-time options ### @@ -48,9 +49,9 @@ if (length($ARGV[0])>1) if ($args =~ /--help/i) { print "allowed run time options:\n"; - print " [-t] = test\n"; - print " [-debug] = verbose debug messages\n"; - print " [-staggered] = experimental staggering of placing calls on large multi-server systems\n"; + print " [--test] = test\n"; + print " [--debug] = verbose debug messages\n"; + print " [--staggered] = experimental staggering of placing calls on large multi-server systems\n"; print " [--delay=XXX] = delay of XXX seconds per loop, default 2.5 seconds\n"; print "\n"; exit; @@ -62,7 +63,7 @@ if (length($ARGV[0])>1) $DB=1; # Debug flag, set to 0 for no debug messages print "\n-- DEBUG --\n\n"; } - if ($args =~ /-t/i) + if ($args =~ /--test/i) { $TEST=1; $T=1; @@ -104,7 +105,7 @@ $RECprefix='7'; ### leave blank for no REC prefix # default path to astguiclient configuration file: -$PATHconf = '/etc/astguiclient.conf'; +$PATHconf = '/etc/astguiclient.conf'; open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; @conf = ; @@ -146,7 +147,7 @@ $server_ip = $VARserver_ip; # Asterisk server IP if (!$VARDB_port) {$VARDB_port='3306';} - &get_time_now; # update time/date variables +&get_time_now; # update time/date variables if (!$VDADLOGfile) {$VDADLOGfile = "$PATHlogs/vdautodial_FILL.$year-$mon-$mday";} @@ -193,8 +194,8 @@ if ($sthArows > 0) } $sthA->finish(); - $event_string='LOGGED INTO MYSQL SERVER ON 1 CONNECTION|'; - &event_logger; +$event_string='LOGGED INTO MYSQL SERVER ON 1 CONNECTION|'; +&event_logger; $one_day_interval = 12; # 1 month loops for one year while($one_day_interval > 0) @@ -208,9 +209,9 @@ while($one_day_interval > 0) $VDADLOGfile = "$PATHlogs/vdautodial_FILL.$year-$mon-$mday"; - ############################################################################### - ###### first figure out how many calls should be placed for each campaign per server - ############################################################################### + ############################################################################### + ###### first figure out how many calls should be placed for each campaign per server + ############################################################################### @DBfill_campaign=@MT; @DBfill_shortage=@MT; @DBfill_tally=@MT; @@ -251,6 +252,7 @@ while($one_day_interval > 0) $balance_servers=0; $lists_update = ''; $LUcount=0; + $staggered_ct=0; $stmtA = "SELECT count(*) FROM servers where vicidial_balance_active = 'Y';"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; @@ -555,12 +557,11 @@ while($one_day_interval > 0) $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; - $rec_count=0; - while ($sthArows > $rec_count) + $LVA_count=0; + if ($sthArows > 0) { @aryA = $sthA->fetchrow_array; $LVA_count = $aryA[0]; - $rec_count++; } $sthA->finish(); @@ -679,7 +680,7 @@ while($one_day_interval > 0) if ($Lhour < 10) {$Lhour = "0$Lhour";} if ($Lmin < 10) {$Lmin = "0$Lmin";} if ($Lsec < 10) {$Lsec = "0$Lsec";} - $LLCT_DATE = "$Lyear-$Lmon-$Lmday $Lhour:$Lmin:$Lsec"; + $LLCT_DATE = "$Lyear-$Lmon-$Lmday $Lhour:$Lmin:$Lsec"; if ( ($alt_dial =~ /ALT|ADDR3|X/) && ($DBIPautoaltdial[$user_CIPct] =~ /ALT|ADDR|X/) ) { @@ -860,13 +861,8 @@ while($one_day_interval > 0) &event_logger; } - - - - $server_CIPct++; } - } else { @@ -899,11 +895,11 @@ while($one_day_interval > 0) $staggered_rank_ct=0; while ( ($st_ct > $staggered_rank_ct) && ($staggered_ct > $staggered_fill) ) { - $TOTAL_available=0; $stmtA = "SELECT server_ip FROM servers where vicidial_balance_rank='$ST_rank[$staggered_rank_ct]' and vicidial_balance_active = 'Y' order by server_ip LIMIT $ST_count[$staggered_rank_ct];"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArowsSIPS=$sthA->rows; + $TOTAL_available=0; $st_si_ct=0; while ($sthArowsSIPS > $st_si_ct) { @@ -929,6 +925,16 @@ while($one_day_interval > 0) $failsafe_ct=0; $RANK_calls_placed=0; $st_si_loop=0; + $TEMP_server_ip = ''; + $TEMP_vm_insert = ''; + $TEMP_vac_insert = ''; + $TEMP_vl_update = ''; + $TEMP_st_logged = ''; + $TEMP_vddl_inserts = ''; + $TEMP_vm_insert = ''; + $TEMP_vac_insert = ''; + $TEMP_vddl_inserts = ''; + while ( ($TOTAL_available > $RANK_calls_placed) && ($failsafe_ct < 99999) && ($staggered_fill <= $staggered_ct) ) { $TEMP_server_ip = $ST_server_ip[$st_si_loop]; @@ -970,6 +976,9 @@ while($one_day_interval > 0) } } $staggered_ct=0; + @ST_server_ip=@MT; + @ST_available=@MT; + @ST_tally=@MT; @vm_inserts=@MT; @vac_inserts=@MT; @vl_updates=@MT;