diff --git a/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl b/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl index 5e94880f..df2b26a5 100644 --- a/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl +++ b/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl @@ -42,6 +42,8 @@ # 90821-1246 - Fixed central voicemail server conf file, changed voicemail to use phone password # 90903-1626 - Added musiconhold and meetme conf file generation # 90919-1516 - Added generation of standalone voicemail boxes in voicemail conf file +# 91028-1023 - Added clearing of daily-reset tables at the timeclock reset time +# 91031-1258 - Added carrier description comments # $DB=0; # Debug flag @@ -485,7 +487,8 @@ if ($timeclock_auto_logout > 0) ################################################################################ -##### START clear out non-used vicidial_conferences sessions +##### START clear out non-used vicidial_conferences sessions and reset daily +##### tally tables ################################################################################ # default path to astguiclient configuration file: @@ -586,10 +589,142 @@ if ($timeclock_end_of_day_NOW > 0) $k++; } + + if ($DB) {print "Starting clear out daily reset tables...\n";} + + $secX = time(); + $TDtarget = ($secX - 86000); # almost one day old + ($Tsec,$Tmin,$Thour,$Tmday,$Tmon,$Tyear,$Twday,$Tyday,$Tisdst) = localtime($TDtarget); + $Tyear = ($Tyear + 1900); + $Tmon++; + if ($Tmon < 10) {$Tmon = "0$Tmon";} + if ($Tmday < 10) {$Tmday = "0$Tmday";} + if ($Thour < 10) {$Thour = "0$Thour";} + if ($Tmin < 10) {$Tmin = "0$Tmin";} + if ($Tsec < 10) {$Tsec = "0$Tsec";} + $TDSQLdate = "$Tyear-$Tmon-$Tmday $Thour:$Tmin:$Tsec"; + + $stmtA = "UPDATE vicidial_campaign_stats SET dialable_leads='0', calls_today='0', answers_today='0', drops_today='0', drops_today_pct='0', drops_answers_today_pct='0', calls_hour='0', answers_hour='0', drops_hour='0', drops_hour_pct='0', calls_halfhour='0', answers_halfhour='0', drops_halfhour='0', drops_halfhour_pct='0', calls_fivemin='0', answers_fivemin='0', drops_fivemin='0', drops_fivemin_pct='0', calls_onemin='0', answers_onemin='0', drops_onemin='0', drops_onemin_pct='0', differential_onemin='0', agents_average_onemin='0', balance_trunk_fill='0', status_category_count_1='0', status_category_count_2='0', status_category_count_3='0', status_category_count_4='0';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows vicidial_campaign_stats records reset|\n";} + + $stmtA = "optimize table vicidial_campaign_stats;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if ($DB) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + + $stmtA = "UPDATE vicidial_drop_rate_groups SET calls_today='0', answers_today='0', drops_today='0', drops_today_pct='0', drops_answers_today_pct='0';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows vicidial_campaign_stats records reset|\n";} + + $stmtA = "optimize table vicidial_drop_rate_groups;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if ($DB) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + + $stmtA = "delete from vicidial_campaign_server_stats;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows vicidial_campaign_server_stats records deleted|\n";} + + $stmtA = "optimize table vicidial_campaign_server_stats;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if ($DB) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + + $stmtA = "update vicidial_inbound_group_agents SET calls_today=0;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows vicidial_inbound_group_agents call counts reset|\n";} + + $stmtA = "optimize table vicidial_inbound_group_agents;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if ($DB) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + + $stmtA = "update vicidial_campaign_agents SET calls_today=0;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows vicidial_campaign_agents call counts reset|\n";} + + $stmtA = "optimize table vicidial_campaign_agents;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if ($DB) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + + $stmtA = "delete from vicidial_live_inbound_agents where last_call_finish < \"$TDSQLdate\";"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows vicidial_live_inbound_agents old records deleted|\n";} + + $stmtA = "update vicidial_live_inbound_agents SET calls_today=0;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows vicidial_live_inbound_agents call counts reset|\n";} + + $stmtA = "optimize table vicidial_live_inbound_agents;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if ($DB) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + + $stmtA = "delete from vicidial_live_agents where last_state_change < \"$TDSQLdate\" and extension NOT LIKE \"R/%\";"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows vicidial_live_agents old records deleted|\n";} + + $stmtA = "optimize table vicidial_live_agents;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if ($DB) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + + $stmtA = "delete from vicidial_auto_calls where last_update_time < \"$TDSQLdate\";"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows vicidial_auto_calls old records deleted|\n";} + + $stmtA = "optimize table vicidial_auto_calls;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if ($DB) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); } ################################################################################ -##### END clear out non-used vicidial_conferences sessions +##### END clear out non-used vicidial_conferences sessions and reset daily +##### tally tables ################################################################################ @@ -804,7 +939,7 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r ##### BEGIN Generate the IAX carriers for this server_ip ##### - $stmtA = "SELECT carrier_id,carrier_name,registration_string,template_id,account_entry,globals_string,dialplan_entry FROM vicidial_server_carriers where server_ip='$server_ip' and active='Y' and protocol='IAX2' order by carrier_id;"; + $stmtA = "SELECT carrier_id,carrier_name,registration_string,template_id,account_entry,globals_string,dialplan_entry,carrier_description FROM vicidial_server_carriers where server_ip='$server_ip' and active='Y' and protocol='IAX2' order by carrier_id;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -812,13 +947,14 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r while ($sthArows > $i) { @aryA = $sthA->fetchrow_array; - $carrier_id[$i] = "$aryA[0]"; - $carrier_name[$i] = "$aryA[1]"; - $registration_string[$i] = "$aryA[2]"; - $template_id[$i] = "$aryA[3]"; - $account_entry[$i] = "$aryA[4]"; - $globals_string[$i] = "$aryA[5]"; - $dialplan_entry[$i] = "$aryA[6]"; + $carrier_id[$i] = $aryA[0]; + $carrier_name[$i] = $aryA[1]; + $registration_string[$i] = $aryA[2]; + $template_id[$i] = $aryA[3]; + $account_entry[$i] = $aryA[4]; + $globals_string[$i] = $aryA[5]; + $dialplan_entry[$i] = $aryA[6]; + $carrier_description[$i] = $aryA[7]; $i++; } $sthA->finish(); @@ -845,9 +981,11 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r $iax .= "$registration_string[$i]\n"; $Lext .= "; VICIDIAL Carrier: $carrier_id[$i] - $carrier_name[$i]\n"; + if (length($carrier_description[$i]) > 0) {$Lext .= "; $carrier_description[$i]\n";} $Lext .= "$dialplan_entry[$i]\n"; $Liax .= "; VICIDIAL Carrier: $carrier_id[$i] - $carrier_name[$i]\n"; + if (length($carrier_description[$i]) > 0) {$Liax .= "; $carrier_description[$i]\n";} $Liax .= "$account_entry[$i]\n"; $Liax .= "$template_contents[$i]\n"; @@ -858,7 +996,7 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r ##### BEGIN Generate the SIP carriers for this server_ip ##### - $stmtA = "SELECT carrier_id,carrier_name,registration_string,template_id,account_entry,globals_string,dialplan_entry FROM vicidial_server_carriers where server_ip='$server_ip' and active='Y' and protocol='SIP' order by carrier_id;"; + $stmtA = "SELECT carrier_id,carrier_name,registration_string,template_id,account_entry,globals_string,dialplan_entry,carrier_description FROM vicidial_server_carriers where server_ip='$server_ip' and active='Y' and protocol='SIP' order by carrier_id;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -866,13 +1004,14 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r while ($sthArows > $i) { @aryA = $sthA->fetchrow_array; - $carrier_id[$i] = "$aryA[0]"; - $carrier_name[$i] = "$aryA[1]"; - $registration_string[$i] = "$aryA[2]"; - $template_id[$i] = "$aryA[3]"; - $account_entry[$i] = "$aryA[4]"; - $globals_string[$i] = "$aryA[5]"; - $dialplan_entry[$i] = "$aryA[6]"; + $carrier_id[$i] = $aryA[0]; + $carrier_name[$i] = $aryA[1]; + $registration_string[$i] = $aryA[2]; + $template_id[$i] = $aryA[3]; + $account_entry[$i] = $aryA[4]; + $globals_string[$i] = $aryA[5]; + $dialplan_entry[$i] = $aryA[6]; + $carrier_description[$i] = $aryA[7]; $i++; } $sthA->finish(); @@ -899,9 +1038,11 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r $sip .= "$registration_string[$i]\n"; $Lext .= "; VICIDIAL Carrier: $carrier_id[$i] - $carrier_name[$i]\n"; + if (length($carrier_description[$i]) > 0) {$Lext .= "; $carrier_description[$i]\n";} $Lext .= "$dialplan_entry[$i]\n"; $Lsip .= "; VICIDIAL Carrier: $carrier_id[$i] - $carrier_name[$i]\n"; + if (length($carrier_description[$i]) > 0) {$Lsip .= "; $carrier_description[$i]\n";} $Lsip .= "$account_entry[$i]\n"; $Lsip .= "$template_contents[$i]\n"; diff --git a/agc_2-X/trunk/bin/AST_DB_optimize.pl b/agc_2-X/trunk/bin/AST_DB_optimize.pl index 0889084d..7f4876dd 100644 --- a/agc_2-X/trunk/bin/AST_DB_optimize.pl +++ b/agc_2-X/trunk/bin/AST_DB_optimize.pl @@ -19,6 +19,7 @@ # 90307-2025 - Added several new queries and rearranged update/deletes # 90401-1335 - Added quiet and test flag functions # 90628-2354 - Added vicidial_drop_rate_groups optimizations +# 91028-1028 - Removed non-optimize queries, they are placed in ADMIN_keepalive now and happen at timeclock reset time # # default path to astguiclient configuration file: @@ -71,375 +72,265 @@ $q=0; ### begin parsing run-time options ### if (length($ARGV[0])>1) -{ + { $i=0; while ($#ARGV >= $i) - { - $args = "$args $ARGV[$i]"; - $i++; - } + { + $args = "$args $ARGV[$i]"; + $i++; + } if ($args =~ /--help/i) - { - print "allowed run time options:\n"; - print " [-q] = quiet\n"; - print " [-t] = test\n"; - print " [-help] = this screen\n"; - print "\n"; + { + print "allowed run time options:\n"; + print " [-q] = quiet\n"; + print " [-t] = test\n"; + print " [-help] = this screen\n"; + print "\n"; - exit; - } + exit; + } else - { + { if ($args =~ /-t/i) - { - $T=1; - } + { + $T=1; + } if ($args =~ /-q/i) - { - $q=1; - $DB=0; + { + $q=1; + $DB=0; + } } } -} else -{ -print "no command line options set\n"; -} + { + print "no command line options set\n"; + } use DBI; $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 = "optimize table call_log;"; +if($DB){print STDERR "\n|$stmtA|\n";} +if (!$T) + { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } +$stmtA = "optimize table park_log;"; +if($DB){print STDERR "\n|$stmtA|\n";} +if (!$T) + { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } - $stmtA = "UPDATE vicidial_campaign_stats SET dialable_leads='0', calls_today='0', answers_today='0', drops_today='0', drops_today_pct='0', drops_answers_today_pct='0', calls_hour='0', answers_hour='0', drops_hour='0', drops_hour_pct='0', calls_halfhour='0', answers_halfhour='0', drops_halfhour='0', drops_halfhour_pct='0', calls_fivemin='0', answers_fivemin='0', drops_fivemin='0', drops_fivemin_pct='0', calls_onemin='0', answers_onemin='0', drops_onemin='0', drops_onemin_pct='0', differential_onemin='0', agents_average_onemin='0', balance_trunk_fill='0', status_category_count_1='0', status_category_count_2='0', status_category_count_3='0', status_category_count_4='0';"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) - { - $affected_rows = $dbhA->do($stmtA); - if(!$q){print STDERR "\n|$affected_rows vicidial_campaign_stats records reset|\n";} - } +$stmtA = "optimize table vicidial_log;"; +if($DB){print STDERR "\n|$stmtA|\n";} +if (!$T) + { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } - $stmtA = "optimize table vicidial_campaign_stats;"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) { - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - @aryA = $sthA->fetchrow_array; - if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} - $sthA->finish(); - } +$stmtA = "optimize table vicidial_closer_log;"; +if($DB){print STDERR "\n|$stmtA|\n";} +if (!$T) + { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } - $stmtA = "UPDATE vicidial_drop_rate_groups SET calls_today='0', answers_today='0', drops_today='0', drops_today_pct='0', drops_answers_today_pct='0';"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) - { - $affected_rows = $dbhA->do($stmtA); - if(!$q){print STDERR "\n|$affected_rows vicidial_campaign_stats records reset|\n";} - } +$stmtA = "optimize table vicidial_xfer_log;"; +if($DB){print STDERR "\n|$stmtA|\n";} +if (!$T) + { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } - $stmtA = "optimize table vicidial_drop_rate_groups;"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) { - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - @aryA = $sthA->fetchrow_array; - if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} - $sthA->finish(); - } +$stmtA = "optimize table vicidial_list;"; +if($DB){print STDERR "\n|$stmtA|\n";} +if (!$T) + { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } - $stmtA = "delete from vicidial_campaign_server_stats;"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) - { - $affected_rows = $dbhA->do($stmtA); - if(!$q){print STDERR "\n|$affected_rows vicidial_campaign_server_stats records deleted|\n";} - } +$stmtA = "optimize table vicidial_manager;"; +if($DB){print STDERR "\n|$stmtA|\n";} +if (!$T) + { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } - $stmtA = "optimize table vicidial_campaign_server_stats;"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) { - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - @aryA = $sthA->fetchrow_array; - if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} - $sthA->finish(); - } +$stmtA = "optimize table vicidial_auto_calls;"; +if($DB){print STDERR "\n|$stmtA|\n";} +if (!$T) + { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } - $stmtA = "delete from vicidial_live_inbound_agents;"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) - { - $affected_rows = $dbhA->do($stmtA); - if(!$q){print STDERR "\n|$affected_rows vicidial_live_inbound_agents records deleted|\n";} - } +$stmtA = "optimize table vicidial_live_agents;"; +if($DB){print STDERR "\n|$stmtA|\n";} +if (!$T) + { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } - $stmtA = "optimize table vicidial_live_inbound_agents;"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) { - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - @aryA = $sthA->fetchrow_array; - if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} - $sthA->finish(); - } +$stmtA = "optimize table vicidial_dnc;"; +if($DB){print STDERR "\n|$stmtA|\n";} +if (!$T) + { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } - $stmtA = "update vicidial_inbound_group_agents SET calls_today=0;;"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) - { - $affected_rows = $dbhA->do($stmtA); - if(!$q){print STDERR "\n|$affected_rows vicidial_inbound_group_agents call counts reset|\n";} - } +$stmtA = "optimize table vicidial_campaign_dnc;"; +if($DB){print STDERR "\n|$stmtA|\n";} +if (!$T) + { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } - $stmtA = "optimize table vicidial_inbound_group_agents;"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) { - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - @aryA = $sthA->fetchrow_array; - if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} - $sthA->finish(); - } +$stmtA = "optimize table vicidial_callbacks;"; +if($DB){print STDERR "\n|$stmtA|\n";} +if (!$T) + { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } - $stmtA = "update vicidial_campaign_agents SET calls_today=0;;"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) - { - $affected_rows = $dbhA->do($stmtA); - if(!$q){print STDERR "\n|$affected_rows vicidial_campaign_agents call counts reset|\n";} - } +$stmtA = "optimize table vicidial_agent_log;"; +if($DB){print STDERR "\n|$stmtA|\n";} +if (!$T) + { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } - $stmtA = "optimize table vicidial_campaign_agents;"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) { - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - @aryA = $sthA->fetchrow_array; - if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} - $sthA->finish(); - } +$stmtA = "optimize table vicidial_conferences;"; +if($DB){print STDERR "\n|$stmtA|\n";} +if (!$T) + { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } - $stmtA = "optimize table call_log;"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) { - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - @aryA = $sthA->fetchrow_array; - if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} - $sthA->finish(); - } +$stmtA = "optimize table vicidial_hopper;"; +if($DB){print STDERR "\n|$stmtA|\n";} +if (!$T) + { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } +$stmtA = "optimize table servers;"; +if($DB){print STDERR "\n|$stmtA|\n";} +if (!$T) + { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } - $stmtA = "optimize table park_log;"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) { - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - @aryA = $sthA->fetchrow_array; - if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} - $sthA->finish(); - } +$stmtA = "optimize table vicidial_timeclock_log;"; +if($DB){print STDERR "\n|$stmtA|\n";} +if (!$T) + { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } +$stmtA = "optimize table vicidial_timeclock_status;"; +if($DB){print STDERR "\n|$stmtA|\n";} +if (!$T) + { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } - $stmtA = "optimize table vicidial_log;"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) { - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - @aryA = $sthA->fetchrow_array; - if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} - $sthA->finish(); - } - - - $stmtA = "optimize table vicidial_closer_log;"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) { - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - @aryA = $sthA->fetchrow_array; - if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} - $sthA->finish(); - } - - - $stmtA = "optimize table vicidial_xfer_log;"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) { - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - @aryA = $sthA->fetchrow_array; - if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} - $sthA->finish(); - } - - $stmtA = "optimize table vicidial_list;"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) { - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - @aryA = $sthA->fetchrow_array; - if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} - $sthA->finish(); - } - - - $stmtA = "optimize table vicidial_manager;"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) { - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - @aryA = $sthA->fetchrow_array; - if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} - $sthA->finish(); - } - - - $stmtA = "optimize table vicidial_auto_calls;"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) { - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - @aryA = $sthA->fetchrow_array; - if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} - $sthA->finish(); - } - - - $stmtA = "optimize table vicidial_live_agents;"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) { - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - @aryA = $sthA->fetchrow_array; - if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} - $sthA->finish(); - } - - $stmtA = "optimize table vicidial_dnc;"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) { - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - @aryA = $sthA->fetchrow_array; - if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} - $sthA->finish(); - } - - $stmtA = "optimize table vicidial_campaign_dnc;"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) { - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - @aryA = $sthA->fetchrow_array; - if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} - $sthA->finish(); - } - - $stmtA = "optimize table vicidial_callbacks;"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) { - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - @aryA = $sthA->fetchrow_array; - if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} - $sthA->finish(); - } - - $stmtA = "optimize table vicidial_agent_log;"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) { - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - @aryA = $sthA->fetchrow_array; - if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} - $sthA->finish(); - } - - $stmtA = "optimize table vicidial_conferences;"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) { - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - @aryA = $sthA->fetchrow_array; - if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} - $sthA->finish(); - } - - $stmtA = "optimize table vicidial_hopper;"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) { - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - @aryA = $sthA->fetchrow_array; - if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} - $sthA->finish(); - } - - $stmtA = "optimize table servers;"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) { - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - @aryA = $sthA->fetchrow_array; - if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} - $sthA->finish(); - } - - $stmtA = "optimize table vicidial_timeclock_log;"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) { - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - @aryA = $sthA->fetchrow_array; - if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} - $sthA->finish(); - } - - $stmtA = "optimize table vicidial_timeclock_status;"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) { - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - @aryA = $sthA->fetchrow_array; - if (!$q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} - $sthA->finish(); - } - - $dbhA->disconnect(); +$dbhA->disconnect(); exit; - - - - - diff --git a/agc_2-X/trunk/extras/upgrade_2.2.0.sql b/agc_2-X/trunk/extras/upgrade_2.2.0.sql index 71e2a57d..940c1771 100644 --- a/agc_2-X/trunk/extras/upgrade_2.2.0.sql +++ b/agc_2-X/trunk/extras/upgrade_2.2.0.sql @@ -596,3 +596,11 @@ ALTER TABLE vicidial_campaigns MODIFY use_internal_dnc ENUM('Y','N','AREACODE') ALTER TABLE vicidial_campaigns MODIFY use_campaign_dnc ENUM('Y','N','AREACODE') default 'N'; UPDATE system_settings SET db_schema_version='1178',db_schema_update_date=NOW(); + + + + + +ALTER TABLE vicidial_server_carriers ADD carrier_description VARCHAR(255); + +UPDATE system_settings SET db_schema_version='1179',db_schema_update_date=NOW(); diff --git a/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.2.0.txt b/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.2.0.txt index 97e3f8c2..69eeafeb 100644 --- a/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.2.0.txt +++ b/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.2.0.txt @@ -342,6 +342,9 @@ Agent Choose Territories|| This option if set to 1 allows the user to choose the territories that they will receive calls from when they login to a MANUAL or INBOUND_MAN campaign. Otherwise the user will be set to use all of the territories that they are set to belong to in the User Territories administrative section|| The AREACODE option is just like the Y option, except it is used to also filter out an entire area code in North America from being dialed, in this case using the 201XXXXXXX entry in the DNC list would block all calls to the 201 areacode if enabled|| If you have the active DNC option set to AREACODE then you can also use area code wildcard entries like this 201XXXXXXX to block all calls to the 201 areacode when enabled|| +Carrier Description|| +This is put in the comments of the asterisk conf files above the dialplan and account entries. Maximum 255 characters|| +CAMPAIGNS ALLOWING THIS IN-GROUP|| add-file: user_territories.php diff --git a/agc_2-X/trunk/www/vicidial/admin.php b/agc_2-X/trunk/www/vicidial/admin.php index d2d06020..19dca20e 100644 --- a/agc_2-X/trunk/www/vicidial/admin.php +++ b/agc_2-X/trunk/www/vicidial/admin.php @@ -1131,6 +1131,9 @@ if (isset($_GET["agent_select_territories"])) {$agent_select_territories=$_GET elseif (isset($_POST["agent_select_territories"])) {$agent_select_territories=$_POST["agent_select_territories"];} if (isset($_GET["agent_choose_territories"])) {$agent_choose_territories=$_GET["agent_choose_territories"];} elseif (isset($_POST["agent_choose_territories"])) {$agent_choose_territories=$_POST["agent_choose_territories"];} +if (isset($_GET["carrier_description"])) {$carrier_description=$_GET["carrier_description"];} + elseif (isset($_POST["carrier_description"])) {$carrier_description=$_POST["carrier_description"];} + if (isset($script_id)) {$script_id= strtoupper($script_id);} if (isset($lead_filter_id)) {$lead_filter_id = strtoupper($lead_filter_id);} @@ -1720,6 +1723,11 @@ if ($non_latin < 1) $tts_text = ereg_replace(";","",$tts_text); $tts_text = ereg_replace("\r","",$tts_text); $tts_text = ereg_replace("\"","",$tts_text); + $carrier_description = ereg_replace("\\\\","",$carrier_description); + $carrier_description = ereg_replace(";","",$carrier_description); + $carrier_description = ereg_replace("\r","",$carrier_description); + $carrier_description = ereg_replace("\"","",$carrier_description); + ### VARIABLES TO BE mysql_real_escape_string ### # $web_form_address @@ -1978,11 +1986,12 @@ else # 90924-1645 - Added list_id overrides for cid, am_message and drop in-group # 90930-2107 - Added agent territory selection options for ViciDial agents # 91026-1050 - Added AREACODE DNC option for campaigns +# 91031-1232 - Added carrier_description field, campaigns links from in-group screen, server links on reports page, agent ranks listing active only # # 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.2.0-221'; -$build = '91026-1050'; +$admin_version = '2.2.0-222'; +$build = '91031-1232'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -5543,6 +5552,11 @@ if ($ADD==99999)
Carrier Name - This is the descriptive name of the carrier entry. +
+ +
+ Carrier Description - This is put in the comments of the asterisk conf files above the dialplan and account entries. Maximum 255 characters. +

@@ -7541,6 +7555,7 @@ if ($ADD==141111111111) echo "Carrier ID: $NWB#vicidial_server_carriers-carrier_id$NWE\n"; echo "Carrier Name: $NWB#vicidial_server_carriers-carrier_name$NWE\n"; + echo "Carrier Description: $NWB#vicidial_server_carriers-carrier_description$NWE\n"; echo "Registration String: $NWB#vicidial_server_carriers-registration_string$NWE\n"; echo "Template ID: \n"; @@ -21314,6 +21345,7 @@ if ($ADD==341111111111) echo "
\n"; echo "\n"; echo "\n"; + echo "\n"; echo "\n"; echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n";
Carrier ID: $carrier_id
Carrier Name: $NWB#vicidial_server_carriers-carrier_name$NWE
Carrier Description: $NWB#vicidial_server_carriers-carrier_description$NWE
Registration String: $NWB#vicidial_server_carriers-registration_string$NWE
Template ID:
$server_id[$o]$server_id[$o]$server_description[$o]$server_ip[$o]$active[$o]