Added shift enforcement for agent logins

Added vital statistics display(CPU/load/disk) to reports and server modification screens
Added configurable max calls per second to servers and system settings

git-svn-id: svn://192.168.202.10@1068 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2009-03-08 12:42:54 +00:00
parent 6463253fab
commit 19d31fe064
12 changed files with 1596 additions and 926 deletions
+125 -58
View File
@@ -7,7 +7,7 @@
#
# It is recommended that you run this program on the local Asterisk machine
#
# Copyright (C) 2008 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGES
# 60717-1242 - changed to DBI by Marin Blu
@@ -16,6 +16,7 @@
# 71109-1725 - fixed vicidial_campaign_stats bug
# 71215-0410 - fixed UPDATE/DELETE results
# 80909-0555 - added vicidial_campaign_dnc table
# 90307-2025 - Added several new queries and rearranged update/deletes
#
# default path to astguiclient configuration file:
@@ -67,6 +68,102 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA
or die "Couldn't connect to database: " . DBI->errstr;
$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_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 = "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_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 = "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_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 = "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_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 = "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_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 call_log;";
if($DB){print STDERR "\n|$stmtA|\n";}
if (!$T) {
@@ -173,28 +270,6 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA
$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_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_dnc;";
if($DB){print STDERR "\n|$stmtA|\n";}
if (!$T) {
@@ -261,46 +336,38 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA
$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';";
$stmtA = "optimize table servers;";
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";}
}
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;";
$stmtA = "optimize table vicidial_timeclock_log;";
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";}
}
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;";
$stmtA = "optimize table vicidial_timeclock_status;";
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 = "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 = "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";}
}
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();