Added Max Daily Stats gathering/updating/display functions

Fixed some ereg issues in admin.php

git-svn-id: svn://192.168.202.10@1763 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2011-12-23 14:04:39 +00:00
parent d85afbd46d
commit f2345e29ae
12 changed files with 981 additions and 125 deletions
+8
View File
@@ -778,6 +778,14 @@ OTHER CHANGES:
178. Added ability to update phone number on a lead when call is looked up
through the cm_lookup.agi script from a Call Menu
179. Added Daily Max Stats used for measuring the total calls for the day for
in-groups and campaigns as well as the maximum number of concurrent
calls handled by each at any time during the day. Small graphs added to
the in-group and campaign screens as well as larger graphs with more
details on a new report screen. These stats are summary stats that are
generated from the logs in real-time on the back end, they are not
recalculated every time the screen loads as with most other reports.
+54 -8
View File
@@ -171,6 +171,7 @@
# 111102-2014 - Added in-group max_calls_ feature
# 111116-0157 - Added ALT and ADDR3 methods for CIDLOOKUP
# 111201-1457 - Added grade-random next-agent-call option for inbound
# 111219-2124 - Added max stats updating
#
$script = 'agi-VDAD_ALL_inbound.agi';
@@ -182,7 +183,7 @@ $wait_prompt_runs=0;
$at='@';
$S='*';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=191;
$mysql_log_count=195;
$one_mysql_log=0;
@@ -202,6 +203,7 @@ $now_date_epoch = time();
$start_epoch = $now_date_epoch;
$now_date = "$year-$mon-$mday $hour:$min:$sec";
$CLInow_date = "$year-$mon-$mday\\ $hour:$min:$sec";
$YMD = "$year-$mon-$mday";
$start_time=$now_date;
$CIDdate = "$mon$mday$hour$min$sec";
$tsSQLdate = "$year$mon$mday$hour$min$sec";
@@ -1130,10 +1132,9 @@ $MCcomments='';
if ( ($max_calls_method !~ /DISABLED/) && ($max_calls_count > 0) )
{
$concurrent_calls=0;
$incalls_count=0;
### Get count of concurrent calls for this in-group
$stmtA = "SELECT count(*) FROM vicidial_auto_calls where campaign_id='$channel_group';";
if (($max_calls_method =~ /IN_QUEUE/))
{$stmtA = "SELECT count(*) FROM vicidial_auto_calls where campaign_id='$channel_group' and status IN('LIVE','IVR');";}
$stmtA = "SELECT count(*) FROM vicidial_auto_calls where campaign_id='$channel_group' and callerid!='$callerid';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
@@ -1142,9 +1143,58 @@ if ( ($max_calls_method !~ /DISABLED/) && ($max_calls_count > 0) )
{
@aryA = $sthA->fetchrow_array;
$concurrent_calls = $aryA[0];
$incalls_count = $aryA[0];
$incalls_count++;
}
$sthA->finish();
$STATSmax_inbound=0;
$stmtA = "SELECT max_inbound from vicidial_daily_max_stats where campaign_id='$channel_group' and stats_type='INGROUP' and stats_flag='OPEN' order by update_time desc limit 1;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$dbhP=$dbhA; $mysql_count='02192'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$STATSmax_inbound = $aryA[0];
$sthA->finish();
$update_SQL='';
if ($STATSmax_inbound < $incalls_count)
{$update_SQL .= ",max_inbound='$incalls_count'";}
if (length($update_SQL) > 5)
{
$stmtA = "UPDATE vicidial_daily_max_stats SET update_time=NOW()$update_SQL where campaign_id='$channel_group' and stats_type='INGROUP' and stats_flag='OPEN';";
$affected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='02193'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
if ($AGILOG) {$agi_string = "DAILY STATS UPDATE $channel_group|$affected_rows|$stmtA|\n"; &agi_output;}
}
}
else
{
$stmtA = "INSERT INTO vicidial_daily_max_stats SET stats_date='$YMD',update_time=NOW(),max_inbound='$incalls_count',campaign_id='$channel_group',stats_type='INGROUP',stats_flag='OPEN';";
$affected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='02195'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
if ($AGILOG) {$agi_string = "DAILY STATS INSERT $channel_group|$affected_rows|$stmtA|\n"; &agi_output;}
}
if (($max_calls_method =~ /IN_QUEUE/))
{
$stmtA = "SELECT count(*) FROM vicidial_auto_calls where campaign_id='$channel_group' and status IN('LIVE','IVR') and callerid!='$callerid';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$dbhP=$dbhA; $mysql_count='02194'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$concurrent_calls = $aryA[0];
}
$sthA->finish();
}
if ($concurrent_calls >= $max_calls_count)
{
if ($max_calls_action =~ /DROP/)
@@ -1169,10 +1219,6 @@ if ( ($max_calls_method !~ /DISABLED/) && ($max_calls_count > 0) )
##### BEGIN AFTER HOURS CHECK #####
$ct_stop_overflow=0; # allow for overflow time, past midnight
if ($ct_default_stop > 2400)
+51 -3
View File
@@ -92,12 +92,13 @@
# 110829-2324 - Added survey_recording option
# 110926-1929 - Small fixes
# 111201-1751 - Added grade-random next-agent-call option
# 111219-2256 - Added max stats updating
#
$script = 'agi-VDAD_ALL_outbound.agi';
$AGILOG = '0';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=92;
$mysql_log_count=96;
$one_mysql_log=0;
@@ -122,6 +123,7 @@ $now_date = "$year-$mon-$mday $hour:$min:$sec";
$CLInow_date = "$year-$mon-$mday\\ $hour:$min:$sec";
$start_time_epoch = $now_date_epoch;
$start_time=$now_date;
$YMD = "$year-$mon-$mday";
$CIDdate = "$mon$mday$hour$min$sec";
$tsSQLdate = "$year$mon$mday$hour$min$sec";
$filedate = "$US$year-$mon-$mday$US$hour$min$sec";
@@ -420,14 +422,60 @@ if ($VDACaffected_rows < 1)
$stmtA = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,uniqueid,callerid,channel,phone_code,phone_number,call_time,call_type,stage,queue_priority) values('$VARserver_ip','$VDADcampaign','LIVE','$VDADlead_id','$uniqueid','$callerid','$channel','$VDADphone_code','$VDADphone','$VDADcall_time','$VDADorigin','LIVE-0','$VDADqueue_priority')";
$affected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='01071'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
if ($AGILOG) {$agi_string = "$affected_rows|VDAC-reinsert|$stmtA|"; &agi_output;}
if ($AGILOG) {$agi_string = "$affected_rows|VDAC-reinsert|$stmtA|"; &agi_output;}
}
else
{
if ($AGILOG) {$agi_string = "-- NO VDM FOUND!!!!!!!!!!: $callerid"; &agi_output;}
}
##### BEGIN - Max call stats
$outcalls_count=0;
### Get count of concurrent calls for this campaign
$stmtA = "SELECT count(*) FROM vicidial_auto_calls where campaign_id='$VDADcampaign';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$dbhP=$dbhA; $mysql_count='02093'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$outcalls_count = $aryA[0];
}
$sthA->finish();
$STATSmax_outbound=0;
$stmtA = "SELECT max_outbound from vicidial_daily_max_stats where campaign_id='$VDADcampaign' and stats_type='CAMPAIGN' and stats_flag='OPEN' order by update_time desc limit 1;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$dbhP=$dbhA; $mysql_count='02094'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$STATSmax_outbound = $aryA[0];
$sthA->finish();
$update_SQL='';
if ($STATSmax_outbound < $outcalls_count)
{$update_SQL .= ",max_outbound='$outcalls_count'";}
if (length($update_SQL) > 5)
{
$stmtA = "UPDATE vicidial_daily_max_stats SET update_time=NOW()$update_SQL where campaign_id='$VDADcampaign' and stats_type='CAMPAIGN' and stats_flag='OPEN';";
$affected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='02095'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
if ($AGILOG) {$agi_string = "DAILY STATS UPDATE $VDADcampaign|$affected_rows|$stmtA|\n"; &agi_output;}
}
}
else
{
$stmtA = "INSERT INTO vicidial_daily_max_stats SET stats_date='$YMD',update_time=NOW(),max_outbound='$outcalls_count',campaign_id='$VDADcampaign',stats_type='CAMPAIGN',stats_flag='OPEN';";
$affected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='02096'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
if ($AGILOG) {$agi_string = "DAILY STATS INSERT $VDADcampaign|$affected_rows|$stmtA|\n"; &agi_output;}
}
##### END - Max call stats
}
if ($VDACaffected_rows > 0)
{
+154 -13
View File
@@ -67,6 +67,7 @@
# 110911-1452 - Added resets for extension groups and areacode cid tables
# 110922-2148 - Added reset for vicidial_did_ra_extensions
# 111004-2333 - Added Call Menu option for update of fields
# 111221-1454 - Added resetting of max stats records at timeclock end of day
#
$DB=0; # Debug flag
@@ -573,7 +574,7 @@ if ($timeclock_auto_logout > 0)
################################################################################
##### START clear out non-used vicidial_conferences sessions and reset daily
##### tally tables
##### tally tables at Timeclock end-of-day
################################################################################
# default path to astguiclient configuration file:
@@ -623,17 +624,17 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA
$timeclock_end_of_day_NOW=0;
### Grab system_settings values from the database
$stmtA = "SELECT count(*) from system_settings where timeclock_end_of_day LIKE \"%$reset_test%\";";
if ($DB) {print "|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$timeclock_end_of_day_NOW = "$aryA[0]";
}
$sthA->finish();
$stmtA = "SELECT count(*) from system_settings where timeclock_end_of_day LIKE \"%$reset_test%\";";
if ($DB) {print "|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$timeclock_end_of_day_NOW = "$aryA[0]";
}
$sthA->finish();
if ($timeclock_end_of_day_NOW > 0)
{
@@ -831,7 +832,6 @@ if ($timeclock_end_of_day_NOW > 0)
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);
@@ -897,6 +897,147 @@ if ($timeclock_end_of_day_NOW > 0)
$sthA->finish();
##### BEGIN max stats end of day process #####
$secX = time();
$RMtarget = ($secX - 86400); # 24 hours ago
($RMsec,$RMmin,$RMhour,$RMmday,$RMmon,$RMyear,$RMwday,$RMyday,$RMisdst) = localtime($RMtarget);
$RMyear = ($RMyear + 1900);
$RMmon++;
if ($RMmon < 10) {$RMmon = "0$RMmon";}
if ($RMmday < 10) {$RMmday = "0$RMmday";}
if ($RMhour < 10) {$RMhour = "0$RMhour";}
if ($RMmin < 10) {$RMmin = "0$RMmin";}
if ($RMsec < 10) {$RMsec = "0$RMsec";}
$RMSQLdate = "$RMyear-$RMmon-$RMmday $RMhour:$RMmin:$RMsec";
# set OPEN max stats records to CLOSING for processing
$stmtA = "UPDATE vicidial_daily_max_stats SET stats_flag='CLOSING' where stats_flag='OPEN';";
if($DBX){print STDERR "\n|$stmtA|\n";}
$affected_rows = $dbhA->do($stmtA);
if($DB){print STDERR "\n|$affected_rows Daily Max Stats Closing Process Started|\n";}
# gather data from CLOSING max stats records
$stmtA = "SELECT stats_date,stats_flag,stats_type,campaign_id,update_time,closed_time,max_channels,max_calls,max_inbound,max_outbound,max_agents,max_remote_agents,total_calls from vicidial_daily_max_stats where stats_flag='CLOSING';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArowsDMS=$sthA->rows;
$i=0;
while ($sthArowsDMS > $i)
{
@aryA = $sthA->fetchrow_array;
$Astats_date[$i] = $aryA[0];
$Astats_flag[$i] = $aryA[1];
$Astats_type[$i] = $aryA[2];
$Acampaign_id[$i] = $aryA[3];
$Aupdate_time[$i] = $aryA[4];
$Aclosed_time[$i] = $aryA[5];
$Amax_channels[$i] = $aryA[6];
$Amax_calls[$i] = $aryA[7];
$Amax_inbound[$i] = $aryA[8];
$Amax_outbound[$i] = $aryA[9];
$Amax_agents[$i] = $aryA[10];
$Amax_remote_agents[$i] = $aryA[11];
$Atotal_calls[$i] = $aryA[12];
if($DBXXX){print STDERR "\nMAX STATS: |$i|$Astats_date[$i]|$Astats_flag[$i]|$Astats_type[$i]|$Acampaign_id[$i]|$Aupdate_time[$i]|$Aclosed_time[$i]|$Amax_channels[$i]|$Amax_calls[$i]|$Amax_inbound[$i]|$Amax_outbound[$i]|$Amax_agents[$i]|$Amax_remote_agents[$i]|$Atotal_calls[$i]|\n";}
$i++;
}
$sthA->finish();
### loop through CLOSING max stats records and calculate end of day numbers, updating if necessary
$i=0;
while ($sthArowsDMS > $i)
{
$NEWtotal_calls=0;
$inbound_count=0;
$outbound_count=0;
### calculate total calls for system, did inbound and vicidial outbound
if ($Astats_type[$i] =~ /TOTAL/)
{
$stmtA = "SELECT count(*) from vicidial_did_log where call_date > \"$RMSQLdate\";";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$inbound_count = $aryA[0];
}
$sthA->finish();
$stmtA = "SELECT count(*) from vicidial_log where call_date > \"$RMSQLdate\";";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$outbound_count = $aryA[0];
}
$sthA->finish();
$NEWtotal_calls = ($inbound_count + $outbound_count);
$stmtA = "UPDATE vicidial_daily_max_stats SET total_calls='$NEWtotal_calls',stats_flag='CLOSED' where stats_flag='CLOSING' and campaign_id='' and stats_type='TOTAL';";
if($DBX){print STDERR "\n|$stmtA|\n";}
$affected_rows = $dbhA->do($stmtA);
if($DB){print STDERR "\n|$affected_rows Daily Max Stats Closed for TOTAL: $NEWtotal_calls|$Atotal_calls[$i]\n";}
}
### calculate total calls for ingroups
if ($Astats_type[$i] =~ /INGROUP/)
{
$stmtA = "SELECT count(*) from vicidial_closer_log where call_date > \"$RMSQLdate\" and campaign_id='$Acampaign_id[$i]';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$inbound_count = $aryA[0];
}
$sthA->finish();
$NEWtotal_calls = ($inbound_count + $outbound_count);
$stmtA = "UPDATE vicidial_daily_max_stats SET total_calls='$NEWtotal_calls',stats_flag='CLOSED' where stats_flag='CLOSING' and campaign_id='$Acampaign_id[$i]' and stats_type='INGROUP';";
if($DBX){print STDERR "\n|$stmtA|\n";}
$affected_rows = $dbhA->do($stmtA);
if($DB){print STDERR "\n|$affected_rows Daily Max Stats Closed for INGROUP $Acampaign_id[$i]: $NEWtotal_calls|$Atotal_calls[$i]|\n";}
}
### calculate total calls for campaigns
if ($Astats_type[$i] =~ /CAMPAIGN/)
{
$stmtA = "SELECT count(*) from vicidial_log where call_date > \"$RMSQLdate\" and campaign_id='$Acampaign_id[$i]';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$outbound_count = $aryA[0];
}
$sthA->finish();
$NEWtotal_calls = ($inbound_count + $outbound_count);
$stmtA = "UPDATE vicidial_daily_max_stats SET total_calls='$NEWtotal_calls',stats_flag='CLOSED' where stats_flag='CLOSING' and campaign_id='$Acampaign_id[$i]' and stats_type='CAMPAIGN';";
if($DBX){print STDERR "\n|$stmtA|\n";}
$affected_rows = $dbhA->do($stmtA);
if($DB){print STDERR "\n|$affected_rows Daily Max Stats Closed for CAMPAIGN $Acampaign_id[$i]: $NEWtotal_calls|$Atotal_calls[$i]|\n";}
}
if($DBXXX){print STDERR "\nMAX STATS: |$i|$Astats_date[$i]|$Astats_flag[$i]|$Astats_type[$i]|$Acampaign_id[$i]|$Aupdate_time[$i]|$Aclosed_time[$i]|$Amax_channels[$i]|$Amax_calls[$i]|$Amax_inbound[$i]|$Amax_outbound[$i]|$Amax_agents[$i]|$Amax_remote_agents[$i]|$Atotal_calls[$i]| |$NEWtotal_calls = ($inbound_count + $outbound_count)|\n";}
$i++;
}
$stmtA = "UPDATE vicidial_daily_max_stats SET stats_flag='CLOSED' where stats_flag='CLOSING';";
if($DBX){print STDERR "\n|$stmtA|\n";}
$affected_rows = $dbhA->do($stmtA);
if($DB){print STDERR "\n|$affected_rows Daily Max Stats Closed Cleanup|\n";}
##### END max stats end of day process #####
$dbhC = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_custom_user", "$VARDB_custom_pass")
or die "Couldn't connect to database: " . DBI->errstr;
+360 -6
View File
@@ -36,6 +36,7 @@
# 100206-1453 - Fixed calculation of hold_sec stats (service level) for in-groups
# 110513-0721 - Added debug DB table, dial level and available only tally threshold options
# 111103-0626 - Added MAXCAL as a drop status
# 111219-1420 - Added daily stats updates to new table for total, in-group and campaign
#
# constants
@@ -51,6 +52,7 @@ $MT[0]='';
$i=0;
$daily_stats=1;
$drop_count_updater=0;
$stat_it=15;
$diff_ratio_updater=0;
@@ -105,7 +107,17 @@ if (length($ARGV[0])>1)
if ($args =~ /--help/i)
{
print "allowed run time options(must stay in this order):\n [--debug] = debug\n [--debugX] = super debug\n [-t] = test\n [--loops=XXX] = force a number of loops of XXX\n [--delay=XXX] = force a loop delay of XXX seconds\n [--campaign=XXX] = run for campaign XXX only\n [-force] = force calculation of suggested predictive dial_level\n [-test] = test only, do not alter dial_level\n\n";
print "allowed run time options(must stay in this order):\n";
print " [--loops=XXX] = force a number of loops of XXX\n";
print " [--delay=XXX] = force a loop delay of XXX seconds\n";
print " [--campaign=XXX] = run for campaign XXX only\n";
print " [--no-daily-stats] = will not daily stats for total, ingroup, campaign\n";
print " [--force] = force calculation of suggested predictive dial_level\n";
print " [--test] = test only, do not alter dial_level\n";
print " [--debug] = debug\n";
print " [--debugX] = super debug\n";
print "\n";
exit;
}
else
{
@@ -189,15 +201,20 @@ if (length($ARGV[0])>1)
print "CLIdelay- $CLIdelay\n";
print "\n";
}
if ($args =~ /-force/i)
if ($args =~ /--force/i)
{
$force_test=1;
print "\n----- FORCE TESTING -----\n\n";
}
if ($args =~ /-t/i)
if ($args =~ /--test/i)
{
$T=1; $TEST=1;
print "\n-----TESTING -----\n\n";
print "\n----- TESTING -----\n\n";
}
if ($args =~ /--no-daily-stats/i)
{
$daily_stats=0;
print "\n----- NO DAILY STATS -----\n\n";
}
}
}
@@ -305,7 +322,6 @@ $sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
##### END QUEUEMETRICS LOGGING LOOKUP #####
###########################################
$master_loop=0;
### Start master loop ###
@@ -424,7 +440,7 @@ while ($master_loop<$CLIloops)
$five_min_ago = time();
$five_min_ago = ($five_min_ago - 300);
##### LOOP THROUGH EACH CAMPAIGN AND PROCESS THE HOPPER #####
##### LOOP THROUGH EACH CAMPAIGN AND PROCESS THE DATA #####
$i=0;
foreach(@campaign_id)
{
@@ -555,6 +571,11 @@ while ($master_loop<$CLIloops)
&launch_inbound_gather;
}
if ( ($daily_stats > 0) && (($stat_count =~ /0$|5$/) || ($stat_count==1)) )
{
&launch_max_calls_gather;
}
if ($RESETdiff_ratio_updater>0) {$RESETdiff_ratio_updater=0; $diff_ratio_updater=0;}
if ($RESETdrop_count_updater>0) {$RESETdrop_count_updater=0; $drop_count_updater=0;}
$diff_ratio_updater = ($diff_ratio_updater + $CLIdelay);
@@ -707,6 +728,7 @@ sub count_agents_lines
### Calculate campaign-wide agent waiting and calls waiting differential
$stat_it=15;
$total_agents[$i]=0;
$total_remote_agents[$i]=0;
$ready_agents[$i]=0;
$waiting_calls[$i]=0;
$ready_diff_total[$i]=0;
@@ -771,6 +793,21 @@ sub count_agents_lines
$it++;
}
# LIVE CAMPAIGN CALLS RIGHT NOW
if ($daily_stats > 0)
{
$stmtA = "SELECT count(*) from vicidial_live_agents where campaign_id='$campaign_id[$i]' and last_update_time > '$VDL_one' and extension LIKE \"R/%\";";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$total_remote_agents[$i] = $aryA[0];
}
$sthA->finish();
}
if ($ready_diff_total[$i] > 0)
{$ready_diff_avg[$i] = ($ready_diff_total[$i] / $stat_it);}
if ($waiting_diff_total[$i] > 0)
@@ -856,6 +893,7 @@ sub calculate_drops
$VCSagent_custtalk_today[$i]=0;
$VCSagent_acw_today[$i]=0;
$VCSagent_calls_today[$i]=0;
$VCSlive_calls[$i]=0;
# LAST ONE MINUTE CALL AND DROP STATS
$stmtA = "SELECT count(*) from $vicidial_log where campaign_id='$campaign_id[$i]' and call_date > '$VDL_one';";
@@ -1162,6 +1200,22 @@ sub calculate_drops
}
$sthA->finish();
# LIVE CAMPAIGN CALLS RIGHT NOW
if ($daily_stats > 0)
{
$stmtA = "SELECT count(*) from vicidial_auto_calls where campaign_id='$campaign_id[$i]';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$VCSlive_calls[$i] = $aryA[0];
$debug_camp_output .= " LIVE CALLS: $aryA[0]|$stmtA\n";
}
$sthA->finish();
}
# If campaign is using a drop rate group, gather its stats
if ($drop_rate_group[$i] !~ /DISABLED/)
{
@@ -1220,9 +1274,57 @@ sub calculate_drops
$stmtA = "UPDATE vicidial_campaign_stats_debug SET entry_time='$now_date',debug_output='$debug_camp_output' where campaign_id='$campaign_id[$i]' and server_ip='ADAPT';";
$affected_rows = $dbhA->do($stmtA);
$debug_camp_output='';
##### BEGIN - DAILY STATS UPDATE CAMPAIGN
if ($daily_stats > 0)
{
$STATSmax_outbound=0;
$STATSmax_agents=0;
$STATSmax_remote_agents=0;
$STATStotal_calls=0;
$stmtA = "SELECT max_outbound,max_agents,max_remote_agents,total_calls from vicidial_daily_max_stats where campaign_id='$campaign_id[$i]' and stats_type='CAMPAIGN' and stats_flag='OPEN' order by update_time desc limit 1;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$STATSmax_outbound = $aryA[0];
$STATSmax_agents = $aryA[1];
$STATSmax_remote_agents = $aryA[2];
$STATStotal_calls = $aryA[3];
$sthA->finish();
$update_SQL='';
if ($STATSmax_outbound < $VCSlive_calls[$i])
{$update_SQL .= ",max_outbound='$VCSlive_calls[$i]'";}
if ($STATSmax_agents < $total_agents[$i])
{$update_SQL .= ",max_agents='$total_agents[$i]'";}
if ($STATSmax_remote_agents < $total_remote_agents[$i])
{$update_SQL .= ",max_remote_agents='$total_remote_agents[$i]'";}
if ($STATStotal_calls < $VCScalls_today[$i])
{$update_SQL .= ",total_calls='$VCScalls_today[$i]'";}
if (length($update_SQL) > 5)
{
$stmtA = "UPDATE vicidial_daily_max_stats SET update_time=NOW()$update_SQL where campaign_id='$campaign_id[$i]' and stats_type='CAMPAIGN' and stats_flag='OPEN';";
$affected_rows = $dbhA->do($stmtA);
if ($DBX) {print "DAILY STATS UPDATE $campaign_id[$i]|$affected_rows|$stmtA|\n";}
}
}
else
{
$sthA->finish();
$stmtA = "INSERT INTO vicidial_daily_max_stats SET stats_date='$file_date',update_time=NOW(),max_outbound='$VCSlive_calls[$i]',max_agents='$total_agents[$i]',max_remote_agents='$total_remote_agents[$i]',total_calls='$VCScalls_today[$i]',campaign_id='$campaign_id[$i]',stats_type='CAMPAIGN',stats_flag='OPEN';";
$affected_rows = $dbhA->do($stmtA);
if ($DBX) {print "DAILY STATS INSERT $campaign_id[$i]|$affected_rows|$stmtA|\n";}
}
}
##### END - DAILY STATS UPDATE CAMPAIGN
}
sub drop_rate_group_gather
{
################################################################################
@@ -1293,6 +1395,170 @@ sub drop_rate_group_gather
}
sub launch_max_calls_gather
{
################################################################################
#### BEGIN gather stats for max channels and max calls
################################################################################
$serversSQL='';
# Get list of active asterisk servers
$stmtA = "SELECT server_ip from servers where active_asterisk_server='Y';";
$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)
{
@aryA = $sthA->fetchrow_array;
$serversSQL .= "'$aryA[0]',";
$rec_count++;
}
$sthA->finish();
chop($serversSQL);
if (length($serversSQL) > 5)
{
$stmtA = "SELECT count(*) from live_sip_channels where server_ip IN($serversSQL);";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$lsc_count=0;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$lsc_count = $aryA[0];
}
$sthA->finish();
$stmtA = "SELECT count(*) from live_channels where server_ip IN($serversSQL);";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$lc_count=0;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$lc_count = $aryA[0];
}
$sthA->finish();
$tc_count = ($lsc_count + $lc_count);
$stmtA = "SELECT count(*) from live_channels where channel NOT LIKE \"%pseudo%\" and server_ip IN($serversSQL);";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$tcalls_count=0;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$tcalls_count = $aryA[0];
}
$sthA->finish();
$stmtA = "SELECT count(*) from vicidial_auto_calls where call_type='IN' and server_ip IN($serversSQL);";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$incalls_count=0;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$incalls_count = $aryA[0];
}
$sthA->finish();
$stmtA = "SELECT count(*) from vicidial_auto_calls where call_type IN('OUT','OUTBALANCE') and server_ip IN($serversSQL);";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$outcalls_count=0;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$outcalls_count = $aryA[0];
}
$sthA->finish();
$stmtA = "SELECT count(*) from vicidial_live_agents where last_update_time > '$VDL_one' and server_ip IN($serversSQL);";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$live_agents=0;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$live_agents = $aryA[0];
$sthA->finish();
}
$stmtA = "SELECT count(*) from vicidial_live_agents where last_update_time > '$VDL_one' and extension LIKE \"R/%\" and server_ip IN($serversSQL);";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$live_remote_agents=0;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$live_remote_agents = $aryA[0];
$sthA->finish();
}
if ($DB) {print "$now_date MAX CHANNELS TOTALS: $tc_count($lsc_count+$lc_count)|$tcalls_count|$incalls_count|$outcalls_count|$live_agents|$live_remote_agents\n";}
$STATSmax_channels=0;
$STATSmax_calls=0;
$stmtA = "SELECT max_channels,max_calls,max_inbound,max_outbound,max_agents,max_remote_agents from vicidial_daily_max_stats where campaign_id='' and stats_type='TOTAL' and stats_flag='OPEN' order by update_time desc limit 1;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$STATSmax_channels = $aryA[0];
$STATSmax_calls = $aryA[1];
$STATSmax_inbound = $aryA[2];
$STATSmax_outbound = $aryA[3];
$STATSmax_agents = $aryA[4];
$STATSmax_remote_agents = $aryA[5];
$sthA->finish();
$update_SQL='';
if ($STATSmax_channels < $tc_count)
{$update_SQL .= ",max_channels='$tc_count'";}
if ($STATSmax_calls < $tcalls_count)
{$update_SQL .= ",max_calls='$tcalls_count'";}
if ($STATSmax_inbound < $incalls_count)
{$update_SQL .= ",max_inbound='$incalls_count'";}
if ($STATSmax_outbound < $outcalls_count)
{$update_SQL .= ",max_outbound='$outcalls_count'";}
if ($STATSmax_agents < $live_agents)
{$update_SQL .= ",max_agents='$live_agents'";}
if ($STATSmax_remote_agents < $live_remote_agents)
{$update_SQL .= ",max_remote_agents='$live_remote_agents'";}
if (length($update_SQL) > 5)
{
$stmtA = "UPDATE vicidial_daily_max_stats SET update_time=NOW()$update_SQL where campaign_id='' and stats_type='TOTAL' and stats_flag='OPEN';";
$affected_rows = $dbhA->do($stmtA);
if ($DBX) {print "DAILY STATS UPDATE $campaign_id[$i]|$affected_rows|$stmtA|\n";}
}
}
else
{
$sthA->finish();
$stmtA = "INSERT INTO vicidial_daily_max_stats SET stats_date='$file_date',update_time=NOW(),max_channels='$tc_count',max_calls='$tcalls_count',max_inbound='$incalls_count',max_outbound='$outcalls_count',max_agents='$live_agents',max_remote_agents='$live_remote_agents',campaign_id='',stats_type='TOTAL',stats_flag='OPEN';";
$affected_rows = $dbhA->do($stmtA);
if ($DBX) {print "DAILY STATS INSERT TOTAL|$affected_rows|$stmtA|\n";}
}
}
################################################################################
#### END gather stats for max channels and max calls
################################################################################
}
sub launch_inbound_gather
{
################################################################################
@@ -1390,6 +1656,47 @@ sub calculate_drops_inbound
$hold_sec_answer_calls[$p]=0;
$hold_sec_drop_calls[$p]=0;
$hold_sec_queue_calls[$p]=0;
$iVCSlive_calls[$p]=0;
$itotal_agents[$p]=0;
$itotal_remote_agents[$p]=0;
# DAILY STATS UPDATE
if ($daily_stats > 0)
{
$stmtA = "SELECT count(*) from vicidial_auto_calls where campaign_id='$group_id[$p]';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$iVCSlive_calls[$p] = $aryA[0];
$sthA->finish();
}
$stmtA = "SELECT count(*) from vicidial_live_agents where closer_campaigns LIKE \"% $group_id[$p] %\" and last_update_time > '$VDL_one';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$itotal_agents[$p] = $aryA[0];
$sthA->finish();
}
$stmtA = "SELECT count(*) from vicidial_live_agents where closer_campaigns LIKE \"% $group_id[$p] %\" and last_update_time > '$VDL_one' and extension LIKE \"R/%\";";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$itotal_remote_agents[$p] = $aryA[0];
$sthA->finish();
}
$debug_ingroup_output .= " DAILY STATS|$iVCSlive_calls[$p]|$itotal_agents[$p]|$itotal_remote_agents[$p]|";
}
# TODAY CALL AND DROP STATS
$stmtA = "SELECT count(*) from $vicidial_closer_log where campaign_id='$group_id[$p]' and call_date > '$VDL_date';";
@@ -1598,6 +1905,53 @@ sub calculate_drops_inbound
$debug_ingroup_output =~ s/;|\\\\|\/|\'//gi;
$stmtA="INSERT IGNORE INTO vicidial_campaign_stats_debug SET server_ip='INBOUND',campaign_id='$group_id[$p]',entry_time='$now_date',debug_output='$debug_ingroup_output' ON DUPLICATE KEY UPDATE entry_time='$now_date',debug_output='$debug_ingroup_output';";
$affected_rows = $dbhA->do($stmtA);
##### BEGIN - DAILY STATS UPDATE INGROUP
if ($daily_stats > 0)
{
$STATSmax_inbound=0;
$STATSmax_agents=0;
$STATSmax_remote_agents=0;
$STATStotal_calls=0;
$stmtA = "SELECT max_inbound,max_agents,max_remote_agents,total_calls from vicidial_daily_max_stats where campaign_id='$group_id[$p]' and stats_type='INGROUP' and stats_flag='OPEN' order by update_time desc limit 1;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$STATSmax_inbound = $aryA[0];
$STATSmax_agents = $aryA[1];
$STATSmax_remote_agents = $aryA[2];
$STATStotal_calls = $aryA[3];
$sthA->finish();
$update_SQL='';
if ($STATSmax_inbound < $iVCSlive_calls[$p])
{$update_SQL .= ",max_inbound='$iVCSlive_calls[$p]'";}
if ($STATSmax_agents < $itotal_agents[$p])
{$update_SQL .= ",max_agents='$itotal_agents[$p]'";}
if ($STATSmax_remote_agents < $itotal_remote_agents[$p])
{$update_SQL .= ",max_remote_agents='$itotal_remote_agents[$p]'";}
if ($STATStotal_calls < $iVCScalls_today[$p])
{$update_SQL .= ",total_calls='$iVCScalls_today[$p]'";}
if (length($update_SQL) > 5)
{
$stmtA = "UPDATE vicidial_daily_max_stats SET update_time=NOW()$update_SQL where campaign_id='$group_id[$p]' and stats_type='INGROUP' and stats_flag='OPEN';";
$affected_rows = $dbhA->do($stmtA);
if ($DBX) {print "DAILY STATS UPDATE $campaign_id[$p]|$affected_rows|$stmtA|\n";}
}
}
else
{
$sthA->finish();
$stmtA = "INSERT INTO vicidial_daily_max_stats SET stats_date='$file_date',update_time=NOW(),max_inbound='$iVCSlive_calls[$p]',max_agents='$itotal_agents[$p]',max_remote_agents='$itotal_remote_agents[$p]',total_calls='$iVCScalls_today[$p]',campaign_id='$group_id[$p]',stats_type='INGROUP',stats_flag='OPEN';";
$affected_rows = $dbhA->do($stmtA);
if ($DBX) {print "DAILY STATS INSERT $group_id[$p]|$affected_rows|$stmtA|\n";}
}
}
##### END - DAILY STATS UPDATE INGROUP
}
##### END calculate_drops_inbound
+2 -2
View File
@@ -122,7 +122,7 @@ while ($one_day_interval > 0)
if ($NEW_actions)
{
my $stmtA = "UPDATE vicidial_manager set status='QUEUE' where server_ip = '" . $conf{VARserver_ip} . "' and status = 'NEW' order by entry_date limit 1";
my $stmtA = "UPDATE vicidial_manager set status='QUEUE' where server_ip = '" . $conf{VARserver_ip} . "' and status = 'NEW' order by man_id limit 1";
$affected_rows = $dbhA->do($stmtA);
print STDERR "rows updated to QUEUE: |$affected_rows|\n" if ($DB);
}
@@ -133,7 +133,7 @@ while ($one_day_interval > 0)
if ($affected_rows)
{
my $stmtA = "SELECT man_id,uniqueid,entry_date,status,response,server_ip,channel,action,callerid,cmd_line_b,cmd_line_c,cmd_line_d,cmd_line_e,cmd_line_f,cmd_line_g,cmd_line_h,cmd_line_i,cmd_line_j,cmd_line_k FROM vicidial_manager where server_ip = '" . $conf{VARserver_ip} . "' and status = 'QUEUE' order by entry_date desc limit 1";
my $stmtA = "SELECT man_id,uniqueid,entry_date,status,response,server_ip,channel,action,callerid,cmd_line_b,cmd_line_c,cmd_line_d,cmd_line_e,cmd_line_f,cmd_line_g,cmd_line_h,cmd_line_i,cmd_line_j,cmd_line_k FROM vicidial_manager where server_ip = '" . $conf{VARserver_ip} . "' and status = 'QUEUE' order by man_id limit 1";
eventLogger($conf{'PATHlogs'}, 'process', "SQL_QUERY|" . $stmtA . "|");
my $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
+20 -1
View File
@@ -2606,6 +2606,25 @@ UNIQUE KEY snapshot_date_list_key
KEY snapshot_date_key (snapshot_time)
);
CREATE TABLE vicidial_daily_max_stats (
stats_date DATE NOT NULL,
stats_flag ENUM('OPEN','CLOSED','CLOSING') default 'CLOSED',
stats_type ENUM('TOTAL','INGROUP','CAMPAIGN','') default '',
campaign_id VARCHAR(20) default '',
update_time TIMESTAMP,
closed_time DATETIME,
max_channels MEDIUMINT(8) UNSIGNED default '0',
max_calls MEDIUMINT(8) UNSIGNED default '0',
max_inbound MEDIUMINT(8) UNSIGNED default '0',
max_outbound MEDIUMINT(8) UNSIGNED default '0',
max_agents MEDIUMINT(8) UNSIGNED default '0',
max_remote_agents MEDIUMINT(8) UNSIGNED default '0',
total_calls INT(9) UNSIGNED default '0',
index (stats_date),
index (stats_flag),
index (campaign_id)
);
ALTER TABLE vicidial_campaign_server_stats ENGINE=MEMORY;
@@ -2758,7 +2777,7 @@ CREATE TABLE vicidial_log_noanswer_archive LIKE vicidial_log_noanswer;
CREATE TABLE vicidial_did_agent_log_archive LIKE vicidial_did_agent_log;
CREATE UNIQUE INDEX vdala on vicidial_did_agent_log_archive (uniqueid,call_date,did_route);
UPDATE system_settings SET db_schema_version='1310',db_schema_update_date=NOW();
UPDATE system_settings SET db_schema_version='1311',db_schema_update_date=NOW();
GRANT RELOAD ON *.* TO cron@'%';
GRANT RELOAD ON *.* TO cron@localhost;
+22
View File
@@ -1217,3 +1217,25 @@ ALTER TABLE vicidial_campaign_agents ADD campaign_grade TINYINT(2) UNSIGNED defa
ALTER TABLE vicidial_campaigns MODIFY next_agent_call ENUM('random','oldest_call_start','oldest_call_finish','campaign_rank','overall_user_level','fewest_calls','longest_wait_time','campaign_grade_random') default 'longest_wait_time';
UPDATE system_settings SET db_schema_version='1310',db_schema_update_date=NOW() where db_schema_version < 1310;
CREATE TABLE vicidial_daily_max_stats (
stats_date DATE NOT NULL,
stats_flag ENUM('OPEN','CLOSED','CLOSING') default 'CLOSED',
stats_type ENUM('TOTAL','INGROUP','CAMPAIGN','') default '',
campaign_id VARCHAR(20) default '',
update_time TIMESTAMP,
closed_time DATETIME,
max_channels MEDIUMINT(8) UNSIGNED default '0',
max_calls MEDIUMINT(8) UNSIGNED default '0',
max_inbound MEDIUMINT(8) UNSIGNED default '0',
max_outbound MEDIUMINT(8) UNSIGNED default '0',
max_agents MEDIUMINT(8) UNSIGNED default '0',
max_remote_agents MEDIUMINT(8) UNSIGNED default '0',
total_calls INT(9) UNSIGNED default '0',
index (stats_date),
index (stats_flag),
index (campaign_id)
);
UPDATE system_settings SET db_schema_version='1311',db_schema_update_date=NOW() where db_schema_version < 1311;
@@ -822,6 +822,11 @@ Another field in this section is GRADE, which allows for the campaign_grade_rand
gives a higher probability of getting a call to the higher graded agents||
gives a higher probability of getting a call to the higher graded agents by in-group||
gives a higher probability of getting a call to the higher graded agents by campaign||
Day call count for this in-group||
Day call count for this campaign||
SUMMARY STATS||
Daily Maximum Stats||
These are statistics that are generated by the system each day throughout the day until the timeclock end-of-day as it is set in the System Settings. These numbers are generated from the logs within the system to allow for much faster display. The stats are included are - Total Calls, Maximum Agents, Maximum inbound calls, Maximum outbound calls||
lead_report_export.php
+214 -92
View File
@@ -5,6 +5,7 @@
#
require("dbconnect.php");
require("functions.php");
######################################################################################################
######################################################################################################
@@ -2442,7 +2443,7 @@ if ($non_latin < 1)
### ALPHA-NUMERIC and spaces
$lead_order = ereg_replace("[^ 0-9a-zA-Z]","",$lead_order);
### ALPHA-NUMERIC and spaces and dashes and underscores
$preset_name = ereg_replace("[^ -\_0-9a-zA-Z]","",$preset_name);
$preset_name = ereg_replace("[^- \_0-9a-zA-Z]","",$preset_name);
### ALPHA-NUMERIC and hash
$group_color = ereg_replace("[^\#0-9a-zA-Z]","",$group_color);
@@ -2460,88 +2461,88 @@ if ($non_latin < 1)
### ALPHA-NUMERIC and spaces dots, commas, dashes, underscores
$adaptive_dl_diff_target = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$adaptive_dl_diff_target);
$adaptive_intensity = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$adaptive_intensity);
$asterisk_version = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$asterisk_version);
$call_time_comments = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$call_time_comments);
$call_time_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$call_time_name);
$campaign_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$campaign_name);
$adaptive_dl_diff_target = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$adaptive_dl_diff_target);
$adaptive_intensity = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$adaptive_intensity);
$asterisk_version = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$asterisk_version);
$call_time_comments = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$call_time_comments);
$call_time_name = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$call_time_name);
$campaign_name = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$campaign_name);
$campaign_rec_filename = ereg_replace("[^\.-\_0-9a-zA-Z]","",$campaign_rec_filename);
$ingroup_rec_filename = ereg_replace("[^\.-\_0-9a-zA-Z]","",$ingroup_rec_filename);
$company = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$company);
$full_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$full_name);
$fullname = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$fullname);
$group_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$group_name);
$HKstatus = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$HKstatus);
$lead_filter_comments = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$lead_filter_comments);
$lead_filter_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$lead_filter_name);
$list_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$list_name);
$local_gmt = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$local_gmt);
$phone_type = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$phone_type);
$picture = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$picture);
$script_comments = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$script_comments);
$script_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$script_name);
$server_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$server_description);
$status = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$status);
$status_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$status_name);
$wrapup_message = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$wrapup_message);
$pause_code_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$pause_code_name);
$campaign_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$campaign_description);
$list_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$list_description);
$vcl_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$vcl_name);
$vsc_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$vsc_name);
$vsc_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$vsc_description);
$code_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$code_name);
$alias_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$alias_name);
$shift_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$shift_name);
$did_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$did_description);
$alt_server_ip = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$alt_server_ip);
$template_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$template_name);
$carrier_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$carrier_name);
$group_alias_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$group_alias_name);
$caller_id_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$caller_id_name);
$user_code = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$user_code);
$territory = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$territory);
$tts_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$tts_name);
$moh_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$moh_name);
$timer_action_message = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$timer_action_message);
$external_server_ip = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$external_server_ip);
$default_codecs = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$default_codecs);
$codecs_list = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$codecs_list);
$label_title = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$label_title);
$label_first_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$label_first_name);
$label_middle_initial = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$label_middle_initial);
$label_last_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$label_last_name);
$label_address1 = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$label_address1);
$label_address2 = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$label_address2);
$label_address3 = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$label_address3);
$label_city = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$label_city);
$label_state = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$label_state);
$label_province = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$label_province);
$label_postal_code = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$label_postal_code);
$label_vendor_lead_code = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$label_vendor_lead_code);
$label_gender = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$label_gender);
$label_phone_number = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$label_phone_number);
$label_phone_code = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$label_phone_code);
$label_alt_phone = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$label_alt_phone);
$label_security_phrase = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$label_security_phrase);
$label_email = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$label_email);
$label_comments = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$label_comments);
$slave_db_server = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$slave_db_server);
$filter_phone_group_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$filter_phone_group_name);
$filter_phone_group_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$filter_phone_group_description);
$filter_clean_cid_number = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$filter_clean_cid_number);
$label_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$label_name);
$default_local_gmt = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$default_local_gmt);
$cid_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$cid_description);
$description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$description);
$first_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$first_name);
$last_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$last_name);
$bu_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$bu_name);
$department = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$department);
$group = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$group);
$job_title = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$job_title);
$location = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$location);
$company = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$company);
$full_name = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$full_name);
$fullname = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$fullname);
$group_name = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$group_name);
$HKstatus = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$HKstatus);
$lead_filter_comments = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$lead_filter_comments);
$lead_filter_name = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$lead_filter_name);
$list_name = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$list_name);
$local_gmt = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$local_gmt);
$phone_type = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$phone_type);
$picture = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$picture);
$script_comments = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$script_comments);
$script_name = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$script_name);
$server_description = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$server_description);
$status = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$status);
$status_name = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$status_name);
$wrapup_message = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$wrapup_message);
$pause_code_name = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$pause_code_name);
$campaign_description = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$campaign_description);
$list_description = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$list_description);
$vcl_name = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$vcl_name);
$vsc_name = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$vsc_name);
$vsc_description = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$vsc_description);
$code_name = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$code_name);
$alias_name = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$alias_name);
$shift_name = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$shift_name);
$did_description = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$did_description);
$alt_server_ip = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$alt_server_ip);
$template_name = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$template_name);
$carrier_name = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$carrier_name);
$group_alias_name = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$group_alias_name);
$caller_id_name = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$caller_id_name);
$user_code = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$user_code);
$territory = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$territory);
$tts_name = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$tts_name);
$moh_name = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$moh_name);
$timer_action_message = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$timer_action_message);
$external_server_ip = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$external_server_ip);
$default_codecs = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$default_codecs);
$codecs_list = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$codecs_list);
$label_title = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$label_title);
$label_first_name = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$label_first_name);
$label_middle_initial = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$label_middle_initial);
$label_last_name = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$label_last_name);
$label_address1 = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$label_address1);
$label_address2 = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$label_address2);
$label_address3 = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$label_address3);
$label_city = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$label_city);
$label_state = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$label_state);
$label_province = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$label_province);
$label_postal_code = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$label_postal_code);
$label_vendor_lead_code = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$label_vendor_lead_code);
$label_gender = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$label_gender);
$label_phone_number = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$label_phone_number);
$label_phone_code = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$label_phone_code);
$label_alt_phone = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$label_alt_phone);
$label_security_phrase = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$label_security_phrase);
$label_email = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$label_email);
$label_comments = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$label_comments);
$slave_db_server = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$slave_db_server);
$filter_phone_group_name = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$filter_phone_group_name);
$filter_phone_group_description = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$filter_phone_group_description);
$filter_clean_cid_number = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$filter_clean_cid_number);
$label_name = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$label_name);
$default_local_gmt = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$default_local_gmt);
$cid_description = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$cid_description);
$description = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$description);
$first_name = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$first_name);
$last_name = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$last_name);
$bu_name = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$bu_name);
$department = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$department);
$group = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$group);
$job_title = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$job_title);
$location = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$location);
### ALPHA-NUMERIC and underscore and dash and slash and at and dot
$call_out_number_group = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$call_out_number_group);
@@ -2571,10 +2572,10 @@ if ($non_latin < 1)
$filter_extension = ereg_replace("[^-\*\#\.\:\/\@\_0-9a-zA-Z]","",$filter_extension);
### ALPHA-NUMERIC and space and underscore and dash and slash and at and dot and pound and star and pipe and comma
$ivr_park_call_agi = ereg_replace("[^ -\*\#\.\,\:\/\|\@\_0-9a-zA-Z]","",$ivr_park_call_agi);
$ivr_park_call_agi = ereg_replace("[^- \*\#\.\,\:\/\|\@\_0-9a-zA-Z]","",$ivr_park_call_agi);
### ALPHA-NUMERIC and space and underscore and dash and slash and at and dot and pound and star and pipe and comma and equal
$voicemail_options = ereg_replace("[^ -\=\*\#\.\,\:\/\|\@\_0-9a-zA-Z]","",$voicemail_options);
$voicemail_options = ereg_replace("[^- \=\*\#\.\,\:\/\|\@\_0-9a-zA-Z]","",$voicemail_options);
### NUMERIC and comma and pipe
$waitforsilence_options = ereg_replace("[^\|\,0-9a-zA-Z]","",$waitforsilence_options);
@@ -3019,12 +3020,13 @@ else
# 111116-0207 - Added ALT and ADDR3 in-group handle methods
# 111122-1333 - Added Inbound Daily Report
# 111201-0939 - Added graded-random next-agent-call option
# 111223-0043 - Added max stats displays for in-groups and , fixed several ereg issues
#
# 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.4-350a';
$build = '111201-0939';
$admin_version = '2.4-351a';
$build = '111223-0043';
$STARTtime = date("U");
$SQLdate = date("Y-m-d H:i:s");
@@ -3639,6 +3641,7 @@ if ($ADD==999997) {$hh='reports'; echo "CHANGE PASSWORD";}
if ($ADD==999996) {$hh='reports'; echo "INITIAL INSTALL WELCOME";}
if ($ADD==999995) {$hh='reports'; echo "COPYRIGHT TRADEMARK LICENSE";}
if ($ADD==999994) {$hh='reports'; echo "ADMIN UTILITIES";}
if ($ADD==999993) {$hh='reports'; echo "SUMMARY STATS";}
if ( ($ADD>9) and ($ADD < 99998) )
@@ -4632,6 +4635,11 @@ if ($ADD==99999)
<BR>
<B>Last Campaign Call Date -</B> This is the last time that a call was handled by an agent logged into this campaign.
<BR>
<A NAME="vicidial_campaigns-max_stats">
<BR>
<B>Daily Maximum Stats -</B> These are statistics that are generated by the system each day throughout the day until the timeclock end-of-day as it is set in the System Settings. These numbers are generated from the logs within the system to allow for much faster display. The stats are included are - Total Calls, Maximum Agents, Maximum inbound calls, Maximum outbound calls.
<BR>
<A NAME="vicidial_campaigns-campaign_stats_refresh">
<BR>
@@ -11936,7 +11944,7 @@ if ($ADD==202)
elseif (isset($_POST[$Factive])) {$Factive_value=$_POST[$Factive];}
if (isset($_GET[$Fcid_description])) {$Fcid_description_value=$_GET[$Fcid_description];}
elseif (isset($_POST[$Fcid_description])) {$Fcid_description_value=$_POST[$Fcid_description];}
$Fcid_description_value = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$Fcid_description_value);
$Fcid_description_value = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$Fcid_description_value);
$Factive_value = ereg_replace("[^A-Z]","",$Factive_value);
# echo "$campaign_id - $Xareacode[$o] - $Xoutbound_cid[$o] - $Factive($Factive_value|$Xactive[$o]) - $Fcid_description($Fcid_description_value|$Xcid_description[$o])<BR>";
@@ -15790,7 +15798,7 @@ if ($ADD==4511)
$option_description = ereg_replace("[^- \:\/\_0-9a-zA-Z]","",$option_description);
$option_route = ereg_replace("[^-\_0-9a-zA-Z]","",$option_route);
$option_route_value = ereg_replace("[^-\/\|\_\#\*\,\.\_0-9a-zA-Z]","",$option_route_value);
$option_route_value_context = ereg_replace("[^,-_0-9a-zA-Z]","",$option_route_value_context);
$option_route_value_context = ereg_replace("[^-\,\_0-9a-zA-Z]","",$option_route_value_context);
}
if (strlen($option_route) > 0)
@@ -16039,7 +16047,7 @@ if ($ADD==411111)
$group_shifts_ct = count($group_shifts);
while ($p <= $group_shifts_ct)
{
$group_shifts[$p] = ereg_replace("[^ -_0-9a-zA-Z]","",$group_shifts[$p]);
$group_shifts[$p] = ereg_replace("[^- \_0-9a-zA-Z]","",$group_shifts[$p]);
$GROUP_shifts .= "$group_shifts[$p] ";
$p++;
}
@@ -16048,7 +16056,7 @@ if ($ADD==411111)
$vgroup_vgroups_ct = count($agent_status_viewable_groups);
while ($p <= $vgroup_vgroups_ct)
{
$agent_status_viewable_groups[$p] = ereg_replace("[^ -_0-9a-zA-Z]","",$agent_status_viewable_groups[$p]);
$agent_status_viewable_groups[$p] = ereg_replace("[^- \_0-9a-zA-Z]","",$agent_status_viewable_groups[$p]);
$VGROUP_vgroups .= "$agent_status_viewable_groups[$p] ";
$p++;
}
@@ -16057,7 +16065,7 @@ if ($ADD==411111)
$admin_viewable_groups_ct = count($admin_viewable_groups);
while ($p <= $admin_viewable_groups_ct)
{
$admin_viewable_groups[$p] = ereg_replace("[^ -_0-9a-zA-Z]","",$admin_viewable_groups[$p]);
$admin_viewable_groups[$p] = ereg_replace("[^- \_0-9a-zA-Z]","",$admin_viewable_groups[$p]);
$Vadmin_viewable_groups .= "$admin_viewable_groups[$p] ";
$p++;
}
@@ -16066,7 +16074,7 @@ if ($ADD==411111)
$admin_viewable_call_times_ct = count($admin_viewable_call_times);
while ($p <= $admin_viewable_call_times_ct)
{
$admin_viewable_call_times[$p] = ereg_replace("[^ -_0-9a-zA-Z]","",$admin_viewable_call_times[$p]);
$admin_viewable_call_times[$p] = ereg_replace("[^- \_0-9a-zA-Z]","",$admin_viewable_call_times[$p]);
$Vadmin_viewable_call_times .= "$admin_viewable_call_times[$p] ";
$p++;
}
@@ -20661,6 +20669,11 @@ if ($ADD==31)
echo "<tr bgcolor=#B6D3FC><td align=right>Campaign Change Date: </td><td align=left>$campaign_changedate &nbsp; $NWB#vicidial_campaigns-campaign_changedate$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Campaign Login Date: </td><td align=left>$campaign_logindate &nbsp; $NWB#vicidial_campaigns-campaign_logindate$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Campaign Call Date: </td><td align=left>$campaign_calldate &nbsp; $NWB#vicidial_campaigns-campaign_calldate$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2>\n";
horizontal_bar_chart($campaign_id,'8','campaign',$link,'total_calls','call count',1);
echo "</td></tr>\n";
echo "<tr bgcolor=#8EBCFD><td align=right>Active: </td><td align=left><select size=1 name=active><option>Y</option><option>N</option><option SELECTED>$campaign_active</option></select>$NWB#vicidial_campaigns-active$NWE</td></tr>\n";
echo "<tr bgcolor=#8EBCFD><td align=right>Admin User Group: </td><td align=left><select size=1 name=user_group>\n";
echo "$UUgroups_list";
@@ -24846,6 +24859,11 @@ if ($ADD==3111)
echo "<tr bgcolor=#B6D3FC><td align=right>Group Color: </td><td align=left bgcolor=\"$row[2]\" id=\"group_color_td\"><input type=text name=group_color size=7 maxlength=7 value=\"$row[2]\">$NWB#vicidial_inbound_groups-group_color$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Active: </td><td align=left><select size=1 name=active><option>Y</option><option>N</option><option SELECTED>$active</option></select>$NWB#vicidial_inbound_groups-active$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>In-Group Calldate: </td><td align=left>$group_calldate$NWB#vicidial_inbound_groups-group_calldate$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2>\n";
horizontal_bar_chart($group_id,'8','in-group',$link,'total_calls','call count',1);
echo "</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Admin User Group: </td><td align=left><select size=1 name=user_group>\n";
echo "$UUgroups_list";
echo "<option SELECTED value=\"$user_group\">$user_group</option>\n";
@@ -26043,7 +26061,7 @@ if ($ADD==3321)
elseif (isset($_POST[$Factive])) {$Factive_value=$_POST[$Factive];}
if (isset($_GET[$Fdescription])) {$Fdescription_value=$_GET[$Fdescription];}
elseif (isset($_POST[$Fdescription])) {$Fdescription_value=$_POST[$Fdescription];}
$Fdescription_value = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$Fdescription_value);
$Fdescription_value = ereg_replace("[^- \.\,\_0-9a-zA-Z]","",$Fdescription_value);
$Factive_value = ereg_replace("[^A-Z]","",$Factive_value);
# echo "$did_id - $Xuser_start[$o] - $Xextension[$o] - $Factive($Factive_value|$Xactive[$o]) - $Fdescription($Fdescription_value|$Xdescription[$o])<BR>";
@@ -29251,6 +29269,44 @@ if ($ADD==311111111111111)
$row=mysql_fetch_row($rslt);
$vicidial_nanpa_prefix_codes_count = $row[0];
$stmt="SELECT sum(total_calls) from vicidial_daily_max_stats where stats_flag='OPEN' and stats_type!='TOTAL';";
$rslt=mysql_query($stmt, $link);
$stats_to_print = mysql_num_rows($rslt);
if ($stats_to_print > 0)
{
$rowx=mysql_fetch_row($rslt);
$ALLtotal_calls = $rowx[0];
}
$stmt="SELECT max(max_inbound) from vicidial_daily_max_stats where stats_flag='OPEN' and stats_type='INGROUP';";
$rslt=mysql_query($stmt, $link);
$stats_to_print = mysql_num_rows($rslt);
if ($stats_to_print > 0)
{
$rowx=mysql_fetch_row($rslt);
$ALLmax_inbound = $rowx[0];
}
$stmt="SELECT max(max_outbound) from vicidial_daily_max_stats where stats_flag='OPEN' and stats_type='CAMPAIGN';";
$rslt=mysql_query($stmt, $link);
$stats_to_print = mysql_num_rows($rslt);
if ($stats_to_print > 0)
{
$rowx=mysql_fetch_row($rslt);
$ALLmax_outbound = $rowx[0];
}
$stmt="SELECT max_channels,max_calls,max_agents from vicidial_daily_max_stats where stats_flag='OPEN' and stats_type='TOTAL';";
$rslt=mysql_query($stmt, $link);
$stats_to_print = mysql_num_rows($rslt);
if ($stats_to_print > 0)
{
$rowx=mysql_fetch_row($rslt);
$ALLchannels_count = $rowx[0];
$ALLcalls_count = $rowx[1];
$ALLagent_count = $rowx[2];
}
$stmt="SELECT version,install_date,use_non_latin,webroot_writable,enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_url,queuemetrics_log_id,queuemetrics_eq_prepend,vicidial_agent_disable,allow_sipsak_messages,admin_home_url,enable_agc_xfer_log,db_schema_version,auto_user_add_value,timeclock_end_of_day,timeclock_last_reset_date,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,vdc_agent_api_active,qc_last_pull_time,enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url,qc_features_active,outbound_autodial_active,outbound_calls_per_second,enable_tts_integration,agentonly_callback_campaign_lock,sounds_central_control_active,sounds_web_server,sounds_web_directory,active_voicemail_server,auto_dial_limit,user_territories_active,allow_custom_dialplan,db_schema_update_date,enable_second_webform,default_webphone,default_external_server_ip,webphone_url,enable_agc_dispo_log,custom_dialplan_entry,queuemetrics_loginout,callcard_enabled,queuemetrics_callstatus,default_codecs,admin_web_directory,label_title,label_first_name,label_middle_initial,label_last_name,label_address1,label_address2,label_address3,label_city,label_state,label_province,label_postal_code,label_vendor_lead_code,label_gender,label_phone_number,label_phone_code,label_alt_phone,label_security_phrase,label_email,label_comments,custom_fields_enabled,slave_db_server,reports_use_slave_db,webphone_systemkey,first_login_trigger,default_phone_registration_password,default_phone_login_password,default_server_password,admin_modify_refresh,nocache_admin,generate_cross_server_exten,queuemetrics_addmember_enabled,queuemetrics_dispo_pause,label_hide_field_logs,queuemetrics_pe_phone_append,test_campaign_calls,agents_calls_reset,default_voicemail_timezone,default_local_gmt,noanswer_log,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db,did_agent_log,campaign_cid_areacodes_enabled,pllb_grouping_limit,did_ra_extensions_enabled,expanded_list_stats,contacts_enabled from system_settings;";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
@@ -29372,6 +29428,7 @@ if ($ADD==311111111111111)
$pcblinkB=''; $pcblinkE='';
if ($vicidial_phone_codes_count < 1000) {$pcblinkB='<b><font color=red><blink>'; $pcblinkE='</blink></font></b>';}
echo "<tr bgcolor=#B6D3FC><td align=right>Phone Codes: </td><td align=left> $pcblinkB$vicidial_phone_codes_count - $vicidial_postal_codes_count - $vicidial_nanpa_prefix_codes_count$pcblinkE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Today System Stats: </td><td align=left> $ALLtotal_calls - $ALLmax_inbound - $ALLmax_outbound - $ALLchannels_count - $ALLcalls_count - $ALLagent_count</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Use Non-Latin: </td><td align=left><select size=1 name=use_non_latin><option>1</option><option>0</option><option selected>$use_non_latin</option></select>$NWB#settings-use_non_latin$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Webroot Writable: </td><td align=left><select size=1 name=webroot_writable><option>1</option><option>0</option><option selected>$webroot_writable</option></select>$NWB#settings-webroot_writable$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>VICIDIAL Agent Disable Display: </td><td align=left><select size=1 name=vicidial_agent_disable>\n";
@@ -32621,6 +32678,71 @@ if ($ADD==999994)
##### END admin hidden utilities page #####
######################
# ADD=999993 - max stats detail report
######################
if ($ADD==999993)
{
echo "<TABLE><TR><TD>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
if ($stage == 'in-group')
{
$in_out = 'in-group';
$max_type = 'max_inbound';
$modify_link = "<a href=\"$PHP_SELF?ADD=3111&group_id=$campaign_id\">";
$stmt="SELECT group_name from vicidial_inbound_groups where group_id='$campaign_id' $LOGadmin_viewable_groupsSQL;";
$rslt=mysql_query($stmt, $link);
$rows_to_print = mysql_num_rows($rslt);
if ($rows_to_print > 0)
{
$rowx=mysql_fetch_row($rslt);
$campaign_name = $rowx[0];
}
else
{echo "Not found"; exit;}
}
else
{
$in_out = 'campaign';
$max_type = 'max_outbound';
$modify_link = "<a href=\"$PHP_SELF?ADD=31&campaign_id=$campaign_id\">";
$stmt="SELECT campaign_name from vicidial_campaigns where campaign_id='$campaign_id' $LOGallowed_campaignsSQL;";
$rslt=mysql_query($stmt, $link);
$rows_to_print = mysql_num_rows($rslt);
if ($rows_to_print > 0)
{
$rowx=mysql_fetch_row($rslt);
$campaign_name = $rowx[0];
}
else
{echo "Not found"; exit;}
}
echo "<br><B> Administration: Max Stats Detail for $stage $modify_link$campaign_id</a> - $campaign_name</B><BR><BR>\n";
echo "<center><TABLE width=$section_width cellspacing=5 cellpadding=2>\n";
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2>\n";
horizontal_bar_chart($campaign_id,'30',$in_out,$link,'total_calls','call count',0);
echo "</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2>\n";
horizontal_bar_chart($campaign_id,'30',$in_out,$link,$max_type,'most concurrent calls',0);
echo "</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2>\n";
horizontal_bar_chart($campaign_id,'30',$in_out,$link,'max_agents','most concurrent agents',0);
echo "</td></tr>\n";
echo "</TABLE></center>\n";
}
##### END max stats detail report #####
echo "</TD></TR></TABLE></center>\n";
echo "</TD></TR></TABLE></center>\n";
+21
View File
@@ -1019,6 +1019,27 @@ if ( ($ADD==3111) or ($ADD==2111) or ($ADD==2011) or ($ADD==4111) or ($ADD==5111
<?php
}
echo "</script>\n";
##### BEGIN - bar chart CSS style #####
?>
<style type="text/css">
<!--
.auraltext
{
position: absolute;
font-size: 0;
left: -1000px;
}
.chart_td
{background-image: url(images/gridline58.gif); background-repeat: repeat-x; background-position: left top; border-left: 1px solid #e5e5e5; border-right: 1px solid #e5e5e5; padding:0; border-bottom: 1px solid #e5e5e5; background-color:transparent;}
-->
</style>
<?
##### END - bar chart CSS style #####
echo "</head>\n";
if ( ($SSadmin_modify_refresh > 1) and (preg_match("/^3|^4/",$ADD)) )
{
+70
View File
@@ -10,6 +10,7 @@
# CHANGES:
# 90524-1503 - First Build
# 110708-1723 - Added HF precision option
# 111222-2124 - Added max stats bar chart function
#
##### reformat seconds into HH:MM:SS or MM:SS #####
@@ -97,4 +98,73 @@ function array_group_count($array, $sort = false)
return $tally_array;
}
##### bar chart using max stats data #####
function horizontal_bar_chart($campaign_id,$days_graph,$title,$link,$metric,$metric_name,$more_link)
{
$stats_start_time = time();
$Bstats_date[0]=date("Y-m-d");
$Btotal_calls[0]=0;
$link_text='';
$max_count=0;
$i=0;
$NWB = " &nbsp; <a href=\"javascript:openNewWindow('$PHP_SELF?ADD=99999";
$NWE = "')\"><IMG SRC=\"help.gif\" WIDTH=20 HEIGHT=20 BORDER=0 ALT=\"HELP\" ALIGN=TOP></A>";
### get stats for last X days
$stmt="SELECT stats_date,$metric from vicidial_daily_max_stats where campaign_id='$campaign_id' and stats_flag='OPEN';";
$rslt=mysql_query($stmt, $link);
$Xstats_to_print = mysql_num_rows($rslt);
if ($Xstats_to_print > 0)
{
$rowx=mysql_fetch_row($rslt);
$Bstats_date[0] = $rowx[0];
$Btotal_calls[0] = $rowx[1];
if ($max_count < $Btotal_calls[0]) {$max_count = $Btotal_calls[0];}
}
$stats_date_ARRAY = explode("-",$Bstats_date[0]);
$stats_start_time = mktime(10, 10, 10, $stats_date_ARRAY[1], $stats_date_ARRAY[2], $stats_date_ARRAY[0]);
while($i <= $days_graph)
{
$i++;
$stats_start_time = ($stats_start_time - 86400);
$Bstats_date[$i] = date("Y-m-d", $stats_start_time);
$Btotal_calls[$i]=0;
$stmt="SELECT stats_date,$metric from vicidial_daily_max_stats where campaign_id='$campaign_id' and stats_date='$Bstats_date[$i]';";
$rslt=mysql_query($stmt, $link);
$Ystats_to_print = mysql_num_rows($rslt);
if ($Ystats_to_print > 0)
{
$rowx=mysql_fetch_row($rslt);
$Btotal_calls[$i] = $rowx[1];
if ($max_count < $Btotal_calls[$i]) {$max_count = $Btotal_calls[$i];}
}
}
if ($max_count < 1)
{echo "<!-- no max stats cache summary information available -->";}
else
{
if ($more_link > 0) {$link_text = "<a href=\"$PHP_SELF?ADD=999993&campaign_id=$campaign_id&stage=$title\"><font size=1>more summary stats...</font></a>";}
echo "<table cellspacing=\"1\" cellpadding=\"0\" bgcolor=\"white\" summary=\"Multiple day $metric_name.\" style=\"background-image:url(images/bg_fade.png); background-repeat:repeat-x; background-position:left top; width: 33em;\">\n";
echo "<caption align=\"top\">$days_graph Day $metric_name for this $title &nbsp; $link_text &nbsp; $NWB#vicidial_campaigns-max_stats$NWE<br /></caption>\n";
echo "<tr>\n";
echo "<th scope=\"col\" style=\"text-align: left; vertical-align:top;\"><span class=\"auraltext\">date</span> </th>\n";
echo "<th scope=\"col\" style=\"text-align: left; vertical-align:top;\"><span class=\"auraltext\">$metric_name</span> </th>\n";
echo "</tr>\n";
$max_multi = (400 / $max_count);
$i=0;
while($i < $days_graph)
{
$bar_width = intval($max_multi * $Btotal_calls[$i]);
if ($Btotal_calls[$i] < 1) {$Btotal_calls[$i] = "-none-";}
echo "<tr>\n";
echo "<td class=\"chart_td\"><font style=\"font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 60%;\">$Bstats_date[$i] </font></td>\n";
echo "<td class=\"chart_td\"><img src=\"images/bar.png\" alt=\"\" width=\"$bar_width\" height=\"10\" style=\"vertical-align: middle; margin: 2px 2px 2px 0;\"/><font style=\"font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 60%;\"> $Btotal_calls[$i]</font></td>\n";
echo "</tr>\n";
$i++;
}
echo "</table>\n";
}
}
?>