Added Cached Realtime Carrier Stats option to System Settings to have the Carrier Log Stats generated once per minute system-wide instead of every time the realtime report refreshes on every screen.
git-svn-id: svn://192.168.202.10@2414 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -189,6 +189,10 @@ OTHER CHANGES:
|
||||
calls sent to a message to play a different message depending on whether
|
||||
a wildcard text string is present in a selected lead data field.
|
||||
|
||||
46. Added Cached Realtime Carrier Stats option to System Settings to have the
|
||||
Carrier Log Stats generated once per minute system-wide instead of every
|
||||
time the realtime report refreshes on every screen.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+353
-2
@@ -1,12 +1,12 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# AST_VDadapt.pl version 2.10
|
||||
# AST_VDadapt.pl version 2.12
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# adjusts the auto_dial_level for vicidial adaptive-predictive campaigns.
|
||||
# gather call stats for campaigns and in-groups
|
||||
#
|
||||
# Copyright (C) 2014 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2015 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGELOG
|
||||
# 60823-1302 - First build from AST_VDhopper.pl
|
||||
@@ -41,6 +41,7 @@
|
||||
# 131122-1314 - Added several missing sthA->finish
|
||||
# 141109-1957 - Fixed issue #793
|
||||
# 141113-1616 - Added concurrency check
|
||||
# 151124-1235 - Added function to cache carrier log stats
|
||||
#
|
||||
|
||||
# constants
|
||||
@@ -55,6 +56,7 @@ $run_check=1; # concurrency check
|
||||
$vicidial_closer_log = 'vicidial_closer_log FORCE INDEX (call_date) ';
|
||||
# $vicidial_closer_log = 'vicidial_closer_log';
|
||||
|
||||
$generate_carrier_stats=1;
|
||||
|
||||
$i=0;
|
||||
$daily_stats=1;
|
||||
@@ -620,6 +622,24 @@ while ($master_loop < $CLIloops)
|
||||
&launch_max_calls_gather;
|
||||
}
|
||||
|
||||
if ( (($stat_count =~ /00$|50$/) || ($stat_count==1)) )
|
||||
{
|
||||
$stmtA = "SELECT cache_carrier_stats_realtime from system_settings;";
|
||||
$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;
|
||||
$generate_carrier_stats = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
if ($generate_carrier_stats > 0)
|
||||
{
|
||||
&launch_carrier_stats_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);
|
||||
@@ -1619,6 +1639,313 @@ sub launch_max_calls_gather
|
||||
################################################################################
|
||||
}
|
||||
|
||||
|
||||
|
||||
sub launch_carrier_stats_gather
|
||||
{
|
||||
################################################################################
|
||||
#### BEGIN gather carrier stats for real-time report
|
||||
################################################################################
|
||||
$TFhour_total=0; @TFhour_status=@MT; @TFhour_count=@MT;
|
||||
$SIXhour_total=0; @SIXhour_status=@MT; @SIXhour_count=@MT;
|
||||
$ONEhour_total=0; @ONEhour_status=@MT; @ONEhour_count=@MT;
|
||||
$FTminute_total=0; @FTminute_status=@MT; @FTminute_count=@MT;
|
||||
$FIVEminute_total=0; @FIVEminute_status=@MT; @FIVEminute_count=@MT;
|
||||
$ONEminute_total=0; @ONEminute_status=@MT; @ONEminute_count=@MT;
|
||||
|
||||
### BEGIN calculate times needed for queries ###
|
||||
$secC = time();
|
||||
$epochONEminuteAGO = ($secC - 60);
|
||||
$epochFIVEminutesAGO = ($secC - 300);
|
||||
$epochFIFTEENminutesAGO = ($secC - 900);
|
||||
$epochONEhourAGO = ($secC - 3600);
|
||||
$epochSIXhoursAGO = ($secC - 21600);
|
||||
$epochTWENTYFOURhoursAGO = ($secC - 86400);
|
||||
|
||||
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($secC);
|
||||
$mon++; $year = ($year + 1900);
|
||||
if ($mon < 10) {$mon = "0$mon";}
|
||||
if ($mday < 10) {$mday = "0$mday";}
|
||||
if ($hour < 10) {$hour = "0$hour";}
|
||||
if ($min < 10) {$min = "0$min";}
|
||||
if ($sec < 10) {$sec = "0$sec";}
|
||||
$timeNOW = "$year-$mon-$mday $hour:$min:$sec";
|
||||
|
||||
($Osec,$Omin,$Ohour,$Omday,$Omon,$Oyear,$Owday,$Oyday,$Oisdst) = localtime($epochONEminuteAGO);
|
||||
$Omon++; $Oyear = ($Oyear + 1900);
|
||||
if ($Omon < 10) {$Omon = "0$Omon";}
|
||||
if ($Omday < 10) {$Omday = "0$Omday";}
|
||||
if ($Ohour < 10) {$Ohour = "0$Ohour";}
|
||||
if ($Omin < 10) {$Omin = "0$Omin";}
|
||||
if ($Osec < 10) {$Osec = "0$Osec";}
|
||||
$timeONEminuteAGO = "$Oyear-$Omon-$Omday $Ohour:$Omin:$Osec";
|
||||
|
||||
($Fsec,$Fmin,$Fhour,$Fmday,$Fmon,$Fyear,$Fwday,$Fyday,$Fisdst) = localtime($epochFIVEminutesAGO);
|
||||
$Fmon++; $Fyear = ($Fyear + 1900);
|
||||
if ($Fmon < 10) {$Fmon = "0$Fmon";}
|
||||
if ($Fmday < 10) {$Fmday = "0$Fmday";}
|
||||
if ($Fhour < 10) {$Fhour = "0$Fhour";}
|
||||
if ($Fmin < 10) {$Fmin = "0$Fmin";}
|
||||
if ($Fsec < 10) {$Fsec = "0$Fsec";}
|
||||
$timeFIVEminutesAGO = "$Fyear-$Fmon-$Fmday $Fhour:$Fmin:$Fsec";
|
||||
|
||||
($Isec,$Imin,$Ihour,$Imday,$Imon,$Iyear,$Iwday,$Iyday,$Iisdst) = localtime($epochFIFTEENminutesAGO);
|
||||
$Imon++; $Iyear = ($Iyear + 1900);
|
||||
if ($Imon < 10) {$Imon = "0$Imon";}
|
||||
if ($Imday < 10) {$Imday = "0$Imday";}
|
||||
if ($Ihour < 10) {$Ihour = "0$Ihour";}
|
||||
if ($Imin < 10) {$Imin = "0$Imin";}
|
||||
if ($Isec < 10) {$Isec = "0$Isec";}
|
||||
$timeFIFTEENminutesAGO = "$Iyear-$Imon-$Imday $Ihour:$Imin:$Isec";
|
||||
|
||||
($Hsec,$Hmin,$Hhour,$Hmday,$Hmon,$Hyear,$Hwday,$Hyday,$Hisdst) = localtime($epochONEhourAGO);
|
||||
$Hmon++; $Hyear = ($Hyear + 1900);
|
||||
if ($Hmon < 10) {$Hmon = "0$Hmon";}
|
||||
if ($Hmday < 10) {$Hmday = "0$Hmday";}
|
||||
if ($Hhour < 10) {$Hhour = "0$Hhour";}
|
||||
if ($Hmin < 10) {$Hmin = "0$Hmin";}
|
||||
if ($Hsec < 10) {$Hsec = "0$Hsec";}
|
||||
$timeONEhourAGO = "$Hyear-$Hmon-$Hmday $Hhour:$Hmin:$Hsec";
|
||||
|
||||
($Ssec,$Smin,$Shour,$Smday,$Smon,$Syear,$Swday,$Syday,$Sisdst) = localtime($epochSIXhoursAGO);
|
||||
$Smon++; $Syear = ($Syear + 1900);
|
||||
if ($Smon < 10) {$Smon = "0$Smon";}
|
||||
if ($Smday < 10) {$Smday = "0$Smday";}
|
||||
if ($Shour < 10) {$Shour = "0$Shour";}
|
||||
if ($Smin < 10) {$Smin = "0$Smin";}
|
||||
if ($Ssec < 10) {$Ssec = "0$Ssec";}
|
||||
$timeSIXhoursAGO = "$Syear-$Smon-$Smday $Shour:$Smin:$Ssec";
|
||||
|
||||
($Wsec,$Wmin,$Whour,$Wmday,$Wmon,$Wyear,$Wwday,$Wyday,$Wisdst) = localtime($epochTWENTYFOURhoursAGO);
|
||||
$Wmon++; $Wyear = ($Wyear + 1900);
|
||||
if ($Wmon < 10) {$Wmon = "0$Wmon";}
|
||||
if ($Wmday < 10) {$Wmday = "0$Wmday";}
|
||||
if ($Whour < 10) {$Whour = "0$Whour";}
|
||||
if ($Wmin < 10) {$Wmin = "0$Wmin";}
|
||||
if ($Wsec < 10) {$Wsec = "0$Wsec";}
|
||||
$timeTWENTYFOURhoursAGO = "$Wyear-$Wmon-$Wmday $Whour:$Wmin:$Wsec";
|
||||
|
||||
if ($DB > 0)
|
||||
{
|
||||
print "Carrier stats gather starting now:\n";
|
||||
print "Time now: $timeNOW\n";
|
||||
}
|
||||
if ($DBX > 0)
|
||||
{
|
||||
print "Time one minute ago: $timeONEminuteAGO\n";
|
||||
print "Time five minutes ago: $timeFIVEminutesAGO\n";
|
||||
print "Time fifteen minutes ago: $timeFIFTEENminutesAGO\n";
|
||||
print "Time one hour ago: $timeONEhourAGO\n";
|
||||
print "Time six hours ago: $timeSIXhoursAGO\n";
|
||||
print "Time twenty four hours ago: $timeTWENTYFOURhoursAGO\n";
|
||||
}
|
||||
### END calculate times needed for queries ###
|
||||
|
||||
$CARRIERstatsHTML='';
|
||||
$stmtA="SELECT dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeTWENTYFOURhoursAGO\" group by dialstatus;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
$ctp=0;
|
||||
while ($sthArows > $ctp)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$TFhour_status[$ctp] = $aryA[0];
|
||||
$TFhour_count[$ctp] = $aryA[1];
|
||||
$TFhour_total = ($TFhour_total + $aryA[1]);
|
||||
$dialstatuses .= "'$aryA[0]',";
|
||||
$ctp++;
|
||||
}
|
||||
$sthA->finish();
|
||||
$dialstatuses =~ s/,$//gi;
|
||||
|
||||
$CARRIERstatsHTML .= "<TR BGCOLOR=white><TD ALIGN=left COLSPAN=8>";
|
||||
$CARRIERstatsHTML .= "<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0 BGCOLOR=white>";
|
||||
$CARRIERstatsHTML .= "<TR BGCOLOR='#E6E6E6'>";
|
||||
$CARRIERstatsHTML .= "<TD ALIGN=LEFT><font size=2><B>CARRIER STATS: </B></TD>";
|
||||
$CARRIERstatsHTML .= "<TD ALIGN=LEFT><font size=2><B> HANGUP STATUS </B></TD>";
|
||||
$CARRIERstatsHTML .= "<TD ALIGN=CENTER><font size=2><B> 24 HOURS </B></TD>";
|
||||
$CARRIERstatsHTML .= "<TD ALIGN=CENTER><font size=2><B> 6 HOURS </B></TD>";
|
||||
$CARRIERstatsHTML .= "<TD ALIGN=CENTER><font size=2><B> 1 HOUR </B></TD>";
|
||||
$CARRIERstatsHTML .= "<TD ALIGN=CENTER><font size=2><B> 15 MIN </B></TD>";
|
||||
$CARRIERstatsHTML .= "<TD ALIGN=CENTER><font size=2><B> 5 MIN </B></TD>";
|
||||
$CARRIERstatsHTML .= "<TD ALIGN=CENTER><font size=2><B> 1 MIN </B></TD>";
|
||||
$CARRIERstatsHTML .= "</TR>";
|
||||
|
||||
if (length($dialstatuses) > 1)
|
||||
{
|
||||
$stmtA="SELECT dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeSIXhoursAGO\" group by dialstatus;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
$print_sctp=0;
|
||||
while ($sthArows > $print_sctp)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$SIXhour_total+=$aryA[1];
|
||||
$print_ctp=0;
|
||||
while ($print_ctp < $ctp)
|
||||
{
|
||||
if ($TFhour_status[$print_ctp] == "$aryA[0]")
|
||||
{$SIXhour_count[$print_ctp] = $aryA[1];}
|
||||
$print_ctp++;
|
||||
}
|
||||
$print_sctp++;
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
$stmtA="SELECT dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeONEhourAGO\" group by dialstatus;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
$print_sctp=0;
|
||||
while ($sthArows > $print_sctp)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$ONEhour_total = ($ONEhour_total + $aryA[1]);
|
||||
$print_ctp=0;
|
||||
while ($print_ctp < $ctp)
|
||||
{
|
||||
if ($TFhour_status[$print_ctp] == "$aryA[0]")
|
||||
{$ONEhour_count[$print_ctp] = $aryA[1];}
|
||||
$print_ctp++;
|
||||
}
|
||||
$print_sctp++;
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
$stmtA="SELECT dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeFIFTEENminutesAGO\" group by dialstatus;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
$print_sctp=0;
|
||||
while ($sthArows > $print_sctp)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$FTminute_total = ($FTminute_total + $aryA[1]);
|
||||
$print_ctp=0;
|
||||
while ($print_ctp < $ctp)
|
||||
{
|
||||
if ($TFhour_status[$print_ctp] == "$aryA[0]")
|
||||
{$FTminute_count[$print_ctp] = $aryA[1];}
|
||||
$print_ctp++;
|
||||
}
|
||||
$print_sctp++;
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
$stmtA="SELECT dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeFIVEminutesAGO\" group by dialstatus;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
$print_sctp=0;
|
||||
while ($sthArows > $print_sctp)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$FIVEminute_total = ($FIVEminute_total + $aryA[1]);
|
||||
$print_ctp=0;
|
||||
while ($print_ctp < $ctp)
|
||||
{
|
||||
if ($TFhour_status[$print_ctp] == "$aryA[0]")
|
||||
{$FIVEminute_count[$print_ctp] = $aryA[1];}
|
||||
$print_ctp++;
|
||||
}
|
||||
$print_sctp++;
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
$stmtA="SELECT dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeONEminuteAGO\" group by dialstatus;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
$print_sctp=0;
|
||||
while ($sthArows > $print_sctp)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$ONEminute_total = ($ONEminute_total + $aryA[1]);
|
||||
$print_ctp=0;
|
||||
while ($print_ctp < $ctp)
|
||||
{
|
||||
if ($TFhour_status[$print_ctp] == "$aryA[0]")
|
||||
{$ONEminute_count[$print_ctp] = $aryA[1];}
|
||||
$print_ctp++;
|
||||
}
|
||||
$print_sctp++;
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
$print_ctp=0;
|
||||
while ($print_ctp < $ctp)
|
||||
{
|
||||
if (length($TFhour_count[$print_ctp])<1) {$TFhour_count[$print_ctp]=0;}
|
||||
if (length($SIXhour_count[$print_ctp])<1) {$SIXhour_count[$print_ctp]=0;}
|
||||
if (length($ONEhour_count[$print_ctp])<1) {$ONEhour_count[$print_ctp]=0;}
|
||||
if (length($FTminute_count[$print_ctp])<1) {$FTminute_count[$print_ctp]=0;}
|
||||
if (length($FIVEminute_count[$print_ctp])<1) {$FIVEminute_count[$print_ctp]=0;}
|
||||
if (length($ONEminute_count[$print_ctp])<1) {$ONEminute_count[$print_ctp]=0;}
|
||||
|
||||
$dividend=$TFhour_count[$print_ctp]; $divisor=$TFhour_total; $TFhour_prw = &MathZDC;
|
||||
$dividend=$SIXhour_count[$print_ctp]; $divisor=$SIXhour_total; $SIXhour_prw = &MathZDC;
|
||||
$dividend=$ONEhour_count[$print_ctp]; $divisor=$ONEhour_total; $ONEhour_prw = &MathZDC;
|
||||
$dividend=$FTminute_count[$print_ctp]; $divisor=$FTminute_total; $TFminute_prw = &MathZDC;
|
||||
$dividend=$FIVEminute_count[$print_ctp]; $divisor=$FIVEminute_total; $FIVEminute_prw = &MathZDC;
|
||||
$dividend=$ONEminute_count[$print_ctp]; $divisor=$ONEminute_total; $ONEminute_prw = &MathZDC;
|
||||
|
||||
$TFhour_pct = (100 * $TFhour_prw);
|
||||
$SIXhour_pct = (100 * $SIXhour_prw);
|
||||
$ONEhour_pct = (100 * $ONEhour_prw);
|
||||
$TFminute_pct = (100 * $TFminute_prw);
|
||||
$FIVEminute_pct = (100 * $FIVEminute_prw);
|
||||
$ONEminute_pct = (100 * $ONEminute_prw);
|
||||
|
||||
# if ($DBX)
|
||||
# {
|
||||
# print "$TFhour_prw | ($TFhour_count[$print_ctp], $TFhour_total)\n";
|
||||
# print "$SIXhour_prw | ($SIXhour_count[$print_ctp], $SIXhour_total)\n";
|
||||
# print "$ONEhour_prw | ($ONEhour_count[$print_ctp], $ONEhour_total)\n";
|
||||
# print "$TFminute_prw | ($FTminute_count[$print_ctp], $FTminute_total)\n";
|
||||
# print "$FIVEminute_prw | ($FIVEminute_count[$print_ctp], $FIVEminute_total)\n";
|
||||
# print "$ONEminute_prw | ($ONEminute_count[$print_ctp], $ONEminute_total)\n";
|
||||
# }
|
||||
|
||||
$CARRIERstatsHTML .= "<TR>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR=white><font size=2> </TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR='#E6E6E6' ALIGN=LEFT><font size=2> $TFhour_status[$print_ctp] </TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR='#E6E6E6' ALIGN=CENTER><font size=2> $TFhour_count[$print_ctp] </font> <font size=1 color='#990000'>".sprintf("%01.1f", $TFhour_pct)."%</font></TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR='#E6E6E6' ALIGN=CENTER><font size=2> $SIXhour_count[$print_ctp] </font> <font size=1 color='#990000'>".sprintf("%01.1f", $SIXhour_pct)."%</font></TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR='#E6E6E6' ALIGN=CENTER><font size=2> $ONEhour_count[$print_ctp] </font> <font size=1 color='#990000'>".sprintf("%01.1f", $ONEhour_pct)."%</font></TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR='#E6E6E6' ALIGN=CENTER><font size=2> $FTminute_count[$print_ctp] </font> <font size=1 color='#990000'>".sprintf("%01.1f", $TFminute_pct)."%</font></TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR='#E6E6E6' ALIGN=CENTER><font size=2> $FIVEminute_count[$print_ctp] </font> <font size=1 color='#990000'>".sprintf("%01.1f", $FIVEminute_pct)."%</font></TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR='#E6E6E6' ALIGN=CENTER><font size=2> $ONEminute_count[$print_ctp] </font> <font size=1 color='#990000'>".sprintf("%01.1f", $ONEminute_pct)."%</font></TD>";
|
||||
$CARRIERstatsHTML .= "</TR>";
|
||||
$print_ctp++;
|
||||
}
|
||||
$CARRIERstatsHTML .= "<TR>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR=white><font size=1>generated: $timeNOW</TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR='#E6E6E6' ALIGN=LEFT><font size=2><B> TOTALS</B></TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR='#E6E6E6' ALIGN=CENTER><font size=2><B> ".($TFhour_total+0)."</B> </TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR='#E6E6E6' ALIGN=CENTER><font size=2><B> ".($SIXhour_total+0)."</B> </TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR='#E6E6E6' ALIGN=CENTER><font size=2><B> ".($ONEhour_total+0)."</B> </TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR='#E6E6E6' ALIGN=CENTER><font size=2><B> ".($FTminute_total+0)."</B> </TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR='#E6E6E6' ALIGN=CENTER><font size=2><B> ".($FIVEminute_total+0)."</B> </TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR='#E6E6E6' ALIGN=CENTER><font size=2><B> ".($ONEminute_total+0)."</B> </TD>";
|
||||
$CARRIERstatsHTML .= "</TR>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$CARRIERstatsHTML .= "<TR><TD BGCOLOR=white colspan=7><font size=2>no carrier log entries in last 24 hours</TD></TR>";
|
||||
}
|
||||
$CARRIERstatsHTML .= "</TABLE>";
|
||||
$CARRIERstatsHTML .= "</TD></TR>";
|
||||
|
||||
$stmtA="INSERT IGNORE INTO vicidial_html_cache_stats SET stats_type='carrier_stats',stats_id='ALL',stats_date=NOW(),stats_count='$TFhour_total',stats_html=\"$CARRIERstatsHTML\" ON DUPLICATE KEY UPDATE stats_date=NOW(),stats_count='$TFhour_total',stats_html=\"$CARRIERstatsHTML\";";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
if ($DB) {print "CARRIER STATS INSERT/UPDATE TOTAL|$affected_rows|$stmtA|\n";}
|
||||
################################################################################
|
||||
#### END gather carrier stats for real-time report
|
||||
################################################################################
|
||||
}
|
||||
|
||||
sub launch_inbound_gather
|
||||
{
|
||||
################################################################################
|
||||
@@ -2275,3 +2602,27 @@ sub calculate_dial_level
|
||||
}
|
||||
##### END calculate the proper dial level #####
|
||||
|
||||
|
||||
##### BEGIN math divisor sub #####
|
||||
sub MathZDC
|
||||
{
|
||||
$quotient=0;
|
||||
# if ($DBX) {print "MathZDC sub DEBUG: dividend: $dividend divisor: $divisor\n";}
|
||||
|
||||
if ( ($divisor == '0') || (length($divisor) < 1) )
|
||||
{
|
||||
return $quotient;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($dividend == '0')
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$percent = ($dividend/$divisor);
|
||||
return $percent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1622,7 +1622,8 @@ default_language VARCHAR(100) default 'default English',
|
||||
agent_whisper_enabled ENUM('0','1') default '0',
|
||||
user_hide_realtime_enabled ENUM('0','1') default '0',
|
||||
custom_reports_use_slave_db VARCHAR(2000) default '',
|
||||
usacan_phone_dialcode_fix ENUM('0','1') default '0'
|
||||
usacan_phone_dialcode_fix ENUM('0','1') default '0',
|
||||
cache_carrier_stats_realtime ENUM('0','1') default '0'
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
CREATE TABLE vicidial_campaigns_list_mix (
|
||||
@@ -3370,6 +3371,15 @@ PRIMARY KEY (amm_id),
|
||||
KEY vicidial_AMM_multi_campaign_id_key (campaign_id)
|
||||
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
CREATE TABLE vicidial_html_cache_stats (
|
||||
stats_type VARCHAR(20) NOT NULL,
|
||||
stats_id VARCHAR(20) NOT NULL,
|
||||
stats_date DATETIME NOT NULL,
|
||||
stats_count INT(9) UNSIGNED default '0',
|
||||
stats_html MEDIUMTEXT,
|
||||
UNIQUE KEY vicidial_html_cache_stats_key (stats_type,stats_id)
|
||||
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
|
||||
ALTER TABLE vicidial_email_list MODIFY message text character set utf8;
|
||||
|
||||
@@ -3619,4 +3629,4 @@ UPDATE vicidial_configuration set value='1766' where name='qc_database_version';
|
||||
|
||||
UPDATE system_settings set vdc_agent_api_active='1';
|
||||
|
||||
UPDATE system_settings SET db_schema_version='1435',db_schema_update_date=NOW(),reload_timestamp=NOW();
|
||||
UPDATE system_settings SET db_schema_version='1436',db_schema_update_date=NOW(),reload_timestamp=NOW();
|
||||
|
||||
@@ -362,3 +362,16 @@ KEY vicidial_AMM_multi_campaign_id_key (campaign_id)
|
||||
ALTER TABLE vicidial_campaigns ADD am_message_wildcards ENUM('Y','N') default 'N';
|
||||
|
||||
UPDATE system_settings SET db_schema_version='1435',db_schema_update_date=NOW() where db_schema_version < 1435;
|
||||
|
||||
CREATE TABLE vicidial_html_cache_stats (
|
||||
stats_type VARCHAR(20) NOT NULL,
|
||||
stats_id VARCHAR(20) NOT NULL,
|
||||
stats_date DATETIME NOT NULL,
|
||||
stats_count INT(9) UNSIGNED default '0',
|
||||
stats_html MEDIUMTEXT,
|
||||
UNIQUE KEY vicidial_html_cache_stats_key (stats_type,stats_id)
|
||||
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
ALTER TABLE system_settings ADD cache_carrier_stats_realtime ENUM('0','1') default '0';
|
||||
|
||||
UPDATE system_settings SET db_schema_version='1436',db_schema_update_date=NOW() where db_schema_version < 1436;
|
||||
|
||||
+181
-165
@@ -181,7 +181,7 @@ $db_source = 'M';
|
||||
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,enable_languages,language_method,agent_whisper_enabled,allow_chats FROM system_settings;";
|
||||
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,enable_languages,language_method,agent_whisper_enabled,allow_chats,cache_carrier_stats_realtime FROM system_settings;";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$qm_conf_ct = mysqli_num_rows($rslt);
|
||||
@@ -196,6 +196,7 @@ if ($qm_conf_ct > 0)
|
||||
$SSlanguage_method = $row[5];
|
||||
$agent_whisper_enabled = $row[6];
|
||||
$allow_chats = $row[7];
|
||||
$cache_carrier_stats_realtime = $row[8];
|
||||
}
|
||||
##### END SETTINGS LOOKUP #####
|
||||
###########################################
|
||||
@@ -1333,180 +1334,195 @@ if ( ($DROPINGROUPstats > 0) and (!preg_match("/ALL-ACTIVE/",$group_string)) )
|
||||
$CARRIERstatsHTML='';
|
||||
if ($CARRIERstats > 0)
|
||||
{
|
||||
$stmtB="SELECT dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeTWENTYFOURhoursAGO\" group by dialstatus;";
|
||||
if ($DB > 0) {echo "\n|$stmtB|\n";}
|
||||
$rslt=mysql_to_mysqli($stmtB, $link);
|
||||
$car_to_print = mysqli_num_rows($rslt);
|
||||
$ctp=0;
|
||||
while ($car_to_print > $ctp)
|
||||
if ($cache_carrier_stats_realtime > 0)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$TFhour_status[$ctp] = $row[0];
|
||||
$TFhour_count[$ctp] = $row[1];
|
||||
$TFhour_total+=$row[1];
|
||||
$dialstatuses .= "'$row[0]',";
|
||||
$ctp++;
|
||||
}
|
||||
$dialstatuses = preg_replace("/,$/",'',$dialstatuses);
|
||||
|
||||
$CARRIERstatsHTML .= "<TR BGCOLOR=white><TD ALIGN=left COLSPAN=8>";
|
||||
$CARRIERstatsHTML .= "<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0 BGCOLOR=white>";
|
||||
$CARRIERstatsHTML .= "<TR BGCOLOR=\"#E6E6E6\">";
|
||||
$CARRIERstatsHTML .= "<TD ALIGN=LEFT><font size=2><B>"._QXZ("CARRIER STATS").": </B></TD>";
|
||||
$CARRIERstatsHTML .= "<TD ALIGN=LEFT><font size=2><B> "._QXZ("HANGUP STATUS")." </B></TD>";
|
||||
$CARRIERstatsHTML .= "<TD ALIGN=CENTER><font size=2><B> "._QXZ("24 HOURS")." </B></TD>";
|
||||
$CARRIERstatsHTML .= "<TD ALIGN=CENTER><font size=2><B> "._QXZ("6 HOURS")." </B></TD>";
|
||||
$CARRIERstatsHTML .= "<TD ALIGN=CENTER><font size=2><B> "._QXZ("1 HOUR")." </B></TD>";
|
||||
$CARRIERstatsHTML .= "<TD ALIGN=CENTER><font size=2><B> "._QXZ("15 MIN")." </B></TD>";
|
||||
$CARRIERstatsHTML .= "<TD ALIGN=CENTER><font size=2><B> "._QXZ("5 MIN")." </B></TD>";
|
||||
$CARRIERstatsHTML .= "<TD ALIGN=CENTER><font size=2><B> "._QXZ("1 MIN")." </B></TD>";
|
||||
$CARRIERstatsHTML .= "</TR>";
|
||||
|
||||
if (strlen($dialstatuses) > 1)
|
||||
{
|
||||
$stmtB="SELECT dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeSIXhoursAGO\" group by dialstatus;";
|
||||
$stmtB="SELECT stats_html from vicidial_html_cache_stats where stats_type='carrier_stats' and stats_id='ALL';";
|
||||
if ($DB > 0) {echo "\n|$stmtB|\n";}
|
||||
$rslt=mysql_to_mysqli($stmtB, $link);
|
||||
$scar_to_print = mysqli_num_rows($rslt);
|
||||
$print_sctp=0;
|
||||
while ($scar_to_print > $print_sctp)
|
||||
$csh_to_print = mysqli_num_rows($rslt);
|
||||
if ($csh_to_print > 0)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$SIXhour_total+=$row[1];
|
||||
$print_ctp=0;
|
||||
while ($print_ctp < $ctp)
|
||||
{
|
||||
if ($TFhour_status[$print_ctp] == $row[0])
|
||||
{$SIXhour_count[$print_ctp] = $row[1];}
|
||||
$print_ctp++;
|
||||
}
|
||||
$print_sctp++;
|
||||
$CARRIERstatsHTML = $row[0];
|
||||
}
|
||||
|
||||
$stmtB="SELECT dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeONEhourAGO\" group by dialstatus;";
|
||||
if ($DB > 0) {echo "\n|$stmtB|\n";}
|
||||
$rslt=mysql_to_mysqli($stmtB, $link);
|
||||
$scar_to_print = mysqli_num_rows($rslt);
|
||||
$print_sctp=0;
|
||||
while ($scar_to_print > $print_sctp)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$ONEhour_total+=$row[1];
|
||||
$print_ctp=0;
|
||||
while ($print_ctp < $ctp)
|
||||
{
|
||||
if ($TFhour_status[$print_ctp] == $row[0])
|
||||
{$ONEhour_count[$print_ctp] = $row[1];}
|
||||
$print_ctp++;
|
||||
}
|
||||
$print_sctp++;
|
||||
}
|
||||
|
||||
$stmtB="SELECT dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeFIFTEENminutesAGO\" group by dialstatus;";
|
||||
if ($DB > 0) {echo "\n|$stmtB|\n";}
|
||||
$rslt=mysql_to_mysqli($stmtB, $link);
|
||||
$scar_to_print = mysqli_num_rows($rslt);
|
||||
$print_sctp=0;
|
||||
while ($scar_to_print > $print_sctp)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$FTminute_total+=$row[1];
|
||||
$print_ctp=0;
|
||||
while ($print_ctp < $ctp)
|
||||
{
|
||||
if ($TFhour_status[$print_ctp] == $row[0])
|
||||
{$FTminute_count[$print_ctp] = $row[1];}
|
||||
$print_ctp++;
|
||||
}
|
||||
$print_sctp++;
|
||||
}
|
||||
|
||||
$stmtB="SELECT dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeFIVEminutesAGO\" group by dialstatus;";
|
||||
if ($DB > 0) {echo "\n|$stmtB|\n";}
|
||||
$rslt=mysql_to_mysqli($stmtB, $link);
|
||||
$scar_to_print = mysqli_num_rows($rslt);
|
||||
$print_sctp=0;
|
||||
while ($scar_to_print > $print_sctp)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$FIVEminute_total+=$row[1];
|
||||
$print_ctp=0;
|
||||
while ($print_ctp < $ctp)
|
||||
{
|
||||
if ($TFhour_status[$print_ctp] == $row[0])
|
||||
{$FIVEminute_count[$print_ctp] = $row[1];}
|
||||
$print_ctp++;
|
||||
}
|
||||
$print_sctp++;
|
||||
}
|
||||
|
||||
$stmtB="SELECT dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeONEminuteAGO\" group by dialstatus;";
|
||||
if ($DB > 0) {echo "\n|$stmtB|\n";}
|
||||
$rslt=mysql_to_mysqli($stmtB, $link);
|
||||
$scar_to_print = mysqli_num_rows($rslt);
|
||||
$print_sctp=0;
|
||||
while ($scar_to_print > $print_sctp)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$ONEminute_total+=$row[1];
|
||||
$print_ctp=0;
|
||||
while ($print_ctp < $ctp)
|
||||
{
|
||||
if ($TFhour_status[$print_ctp] == $row[0])
|
||||
{$ONEminute_count[$print_ctp] = $row[1];}
|
||||
$print_ctp++;
|
||||
}
|
||||
$print_sctp++;
|
||||
}
|
||||
|
||||
|
||||
$print_ctp=0;
|
||||
while ($print_ctp < $ctp)
|
||||
{
|
||||
if (strlen($TFhour_count[$print_ctp])<1) {$TFhour_count[$print_ctp]=0;}
|
||||
if (strlen($SIXhour_count[$print_ctp])<1) {$SIXhour_count[$print_ctp]=0;}
|
||||
if (strlen($ONEhour_count[$print_ctp])<1) {$ONEhour_count[$print_ctp]=0;}
|
||||
if (strlen($FTminute_count[$print_ctp])<1) {$FTminute_count[$print_ctp]=0;}
|
||||
if (strlen($FIVEminute_count[$print_ctp])<1) {$FIVEminute_count[$print_ctp]=0;}
|
||||
if (strlen($ONEminute_count[$print_ctp])<1) {$ONEminute_count[$print_ctp]=0;}
|
||||
|
||||
$TFhour_pct = (100*MathZDC($TFhour_count[$print_ctp], $TFhour_total));
|
||||
$SIXhour_pct = (100*MathZDC($SIXhour_count[$print_ctp], $SIXhour_total));
|
||||
$ONEhour_pct = (100*MathZDC($ONEhour_count[$print_ctp], $ONEhour_total));
|
||||
$TFminute_pct = (100*MathZDC($FTminute_count[$print_ctp], $FTminute_total));
|
||||
$FIVEminute_pct = (100*MathZDC($FIVEminute_count[$print_ctp], $FIVEminute_total));
|
||||
$ONEminute_pct = (100*MathZDC($ONEminute_count[$print_ctp], $ONEminute_total));
|
||||
|
||||
$CARRIERstatsHTML .= "<TR>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR=white><font size=2> </TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=LEFT><font size=2> $TFhour_status[$print_ctp] </TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $TFhour_count[$print_ctp] </font> <font size=1 color='#990000'>".sprintf("%01.1f", $TFhour_pct)."%</font></TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $SIXhour_count[$print_ctp] </font> <font size=1 color='#990000'>".sprintf("%01.1f", $SIXhour_pct)."%</font></TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $ONEhour_count[$print_ctp] </font> <font size=1 color='#990000'>".sprintf("%01.1f", $ONEhour_pct)."%</font></TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $FTminute_count[$print_ctp] </font> <font size=1 color='#990000'>".sprintf("%01.1f", $TFminute_pct)."%</font></TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $FIVEminute_count[$print_ctp] </font> <font size=1 color='#990000'>".sprintf("%01.1f", $FIVEminute_pct)."%</font></TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $ONEminute_count[$print_ctp] </font> <font size=1 color='#990000'>".sprintf("%01.1f", $ONEminute_pct)."%</font></TD>";
|
||||
$CARRIERstatsHTML .= "</TR>";
|
||||
$print_ctp++;
|
||||
}
|
||||
$CARRIERstatsHTML .= "<TR>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR=white><font size=2> </TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=LEFT><font size=2><B> "._QXZ("TOTALS")."</B></TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2><B> ".($TFhour_total+0)."</B> </TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2><B> ".($SIXhour_total+0)."</B> </TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2><B> ".($ONEhour_total+0)."</B> </TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2><B> ".($FTminute_total+0)."</B> </TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2><B> ".($FIVEminute_total+0)."</B> </TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2><B> ".($ONEminute_total+0)."</B> </TD>";
|
||||
$CARRIERstatsHTML .= "</TR>";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$CARRIERstatsHTML .= "<TR><TD BGCOLOR=white colspan=7><font size=2>"._QXZ("no log entries")."</TD></TR>";
|
||||
$stmtB="SELECT dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeTWENTYFOURhoursAGO\" group by dialstatus;";
|
||||
if ($DB > 0) {echo "\n|$stmtB|\n";}
|
||||
$rslt=mysql_to_mysqli($stmtB, $link);
|
||||
$car_to_print = mysqli_num_rows($rslt);
|
||||
$ctp=0;
|
||||
while ($car_to_print > $ctp)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$TFhour_status[$ctp] = $row[0];
|
||||
$TFhour_count[$ctp] = $row[1];
|
||||
$TFhour_total+=$row[1];
|
||||
$dialstatuses .= "'$row[0]',";
|
||||
$ctp++;
|
||||
}
|
||||
$dialstatuses = preg_replace("/,$/",'',$dialstatuses);
|
||||
|
||||
$CARRIERstatsHTML .= "<TR BGCOLOR=white><TD ALIGN=left COLSPAN=8>";
|
||||
$CARRIERstatsHTML .= "<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0 BGCOLOR=white>";
|
||||
$CARRIERstatsHTML .= "<TR BGCOLOR=\"#E6E6E6\">";
|
||||
$CARRIERstatsHTML .= "<TD ALIGN=LEFT><font size=2><B>"._QXZ("CARRIER STATS").": </B></TD>";
|
||||
$CARRIERstatsHTML .= "<TD ALIGN=LEFT><font size=2><B> "._QXZ("HANGUP STATUS")." </B></TD>";
|
||||
$CARRIERstatsHTML .= "<TD ALIGN=CENTER><font size=2><B> "._QXZ("24 HOURS")." </B></TD>";
|
||||
$CARRIERstatsHTML .= "<TD ALIGN=CENTER><font size=2><B> "._QXZ("6 HOURS")." </B></TD>";
|
||||
$CARRIERstatsHTML .= "<TD ALIGN=CENTER><font size=2><B> "._QXZ("1 HOUR")." </B></TD>";
|
||||
$CARRIERstatsHTML .= "<TD ALIGN=CENTER><font size=2><B> "._QXZ("15 MIN")." </B></TD>";
|
||||
$CARRIERstatsHTML .= "<TD ALIGN=CENTER><font size=2><B> "._QXZ("5 MIN")." </B></TD>";
|
||||
$CARRIERstatsHTML .= "<TD ALIGN=CENTER><font size=2><B> "._QXZ("1 MIN")." </B></TD>";
|
||||
$CARRIERstatsHTML .= "</TR>";
|
||||
|
||||
if (strlen($dialstatuses) > 1)
|
||||
{
|
||||
$stmtB="SELECT dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeSIXhoursAGO\" group by dialstatus;";
|
||||
if ($DB > 0) {echo "\n|$stmtB|\n";}
|
||||
$rslt=mysql_to_mysqli($stmtB, $link);
|
||||
$scar_to_print = mysqli_num_rows($rslt);
|
||||
$print_sctp=0;
|
||||
while ($scar_to_print > $print_sctp)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$SIXhour_total+=$row[1];
|
||||
$print_ctp=0;
|
||||
while ($print_ctp < $ctp)
|
||||
{
|
||||
if ($TFhour_status[$print_ctp] == $row[0])
|
||||
{$SIXhour_count[$print_ctp] = $row[1];}
|
||||
$print_ctp++;
|
||||
}
|
||||
$print_sctp++;
|
||||
}
|
||||
|
||||
$stmtB="SELECT dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeONEhourAGO\" group by dialstatus;";
|
||||
if ($DB > 0) {echo "\n|$stmtB|\n";}
|
||||
$rslt=mysql_to_mysqli($stmtB, $link);
|
||||
$scar_to_print = mysqli_num_rows($rslt);
|
||||
$print_sctp=0;
|
||||
while ($scar_to_print > $print_sctp)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$ONEhour_total+=$row[1];
|
||||
$print_ctp=0;
|
||||
while ($print_ctp < $ctp)
|
||||
{
|
||||
if ($TFhour_status[$print_ctp] == $row[0])
|
||||
{$ONEhour_count[$print_ctp] = $row[1];}
|
||||
$print_ctp++;
|
||||
}
|
||||
$print_sctp++;
|
||||
}
|
||||
|
||||
$stmtB="SELECT dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeFIFTEENminutesAGO\" group by dialstatus;";
|
||||
if ($DB > 0) {echo "\n|$stmtB|\n";}
|
||||
$rslt=mysql_to_mysqli($stmtB, $link);
|
||||
$scar_to_print = mysqli_num_rows($rslt);
|
||||
$print_sctp=0;
|
||||
while ($scar_to_print > $print_sctp)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$FTminute_total+=$row[1];
|
||||
$print_ctp=0;
|
||||
while ($print_ctp < $ctp)
|
||||
{
|
||||
if ($TFhour_status[$print_ctp] == $row[0])
|
||||
{$FTminute_count[$print_ctp] = $row[1];}
|
||||
$print_ctp++;
|
||||
}
|
||||
$print_sctp++;
|
||||
}
|
||||
|
||||
$stmtB="SELECT dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeFIVEminutesAGO\" group by dialstatus;";
|
||||
if ($DB > 0) {echo "\n|$stmtB|\n";}
|
||||
$rslt=mysql_to_mysqli($stmtB, $link);
|
||||
$scar_to_print = mysqli_num_rows($rslt);
|
||||
$print_sctp=0;
|
||||
while ($scar_to_print > $print_sctp)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$FIVEminute_total+=$row[1];
|
||||
$print_ctp=0;
|
||||
while ($print_ctp < $ctp)
|
||||
{
|
||||
if ($TFhour_status[$print_ctp] == $row[0])
|
||||
{$FIVEminute_count[$print_ctp] = $row[1];}
|
||||
$print_ctp++;
|
||||
}
|
||||
$print_sctp++;
|
||||
}
|
||||
|
||||
$stmtB="SELECT dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeONEminuteAGO\" group by dialstatus;";
|
||||
if ($DB > 0) {echo "\n|$stmtB|\n";}
|
||||
$rslt=mysql_to_mysqli($stmtB, $link);
|
||||
$scar_to_print = mysqli_num_rows($rslt);
|
||||
$print_sctp=0;
|
||||
while ($scar_to_print > $print_sctp)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$ONEminute_total+=$row[1];
|
||||
$print_ctp=0;
|
||||
while ($print_ctp < $ctp)
|
||||
{
|
||||
if ($TFhour_status[$print_ctp] == $row[0])
|
||||
{$ONEminute_count[$print_ctp] = $row[1];}
|
||||
$print_ctp++;
|
||||
}
|
||||
$print_sctp++;
|
||||
}
|
||||
|
||||
|
||||
$print_ctp=0;
|
||||
while ($print_ctp < $ctp)
|
||||
{
|
||||
if (strlen($TFhour_count[$print_ctp])<1) {$TFhour_count[$print_ctp]=0;}
|
||||
if (strlen($SIXhour_count[$print_ctp])<1) {$SIXhour_count[$print_ctp]=0;}
|
||||
if (strlen($ONEhour_count[$print_ctp])<1) {$ONEhour_count[$print_ctp]=0;}
|
||||
if (strlen($FTminute_count[$print_ctp])<1) {$FTminute_count[$print_ctp]=0;}
|
||||
if (strlen($FIVEminute_count[$print_ctp])<1) {$FIVEminute_count[$print_ctp]=0;}
|
||||
if (strlen($ONEminute_count[$print_ctp])<1) {$ONEminute_count[$print_ctp]=0;}
|
||||
|
||||
$TFhour_pct = (100*MathZDC($TFhour_count[$print_ctp], $TFhour_total));
|
||||
$SIXhour_pct = (100*MathZDC($SIXhour_count[$print_ctp], $SIXhour_total));
|
||||
$ONEhour_pct = (100*MathZDC($ONEhour_count[$print_ctp], $ONEhour_total));
|
||||
$TFminute_pct = (100*MathZDC($FTminute_count[$print_ctp], $FTminute_total));
|
||||
$FIVEminute_pct = (100*MathZDC($FIVEminute_count[$print_ctp], $FIVEminute_total));
|
||||
$ONEminute_pct = (100*MathZDC($ONEminute_count[$print_ctp], $ONEminute_total));
|
||||
|
||||
$CARRIERstatsHTML .= "<TR>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR=white><font size=2> </TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=LEFT><font size=2> $TFhour_status[$print_ctp] </TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $TFhour_count[$print_ctp] </font> <font size=1 color='#990000'>".sprintf("%01.1f", $TFhour_pct)."%</font></TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $SIXhour_count[$print_ctp] </font> <font size=1 color='#990000'>".sprintf("%01.1f", $SIXhour_pct)."%</font></TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $ONEhour_count[$print_ctp] </font> <font size=1 color='#990000'>".sprintf("%01.1f", $ONEhour_pct)."%</font></TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $FTminute_count[$print_ctp] </font> <font size=1 color='#990000'>".sprintf("%01.1f", $TFminute_pct)."%</font></TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $FIVEminute_count[$print_ctp] </font> <font size=1 color='#990000'>".sprintf("%01.1f", $FIVEminute_pct)."%</font></TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $ONEminute_count[$print_ctp] </font> <font size=1 color='#990000'>".sprintf("%01.1f", $ONEminute_pct)."%</font></TD>";
|
||||
$CARRIERstatsHTML .= "</TR>";
|
||||
$print_ctp++;
|
||||
}
|
||||
$CARRIERstatsHTML .= "<TR>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR=white><font size=2> </TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=LEFT><font size=2><B> "._QXZ("TOTALS")."</B></TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2><B> ".($TFhour_total+0)."</B> </TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2><B> ".($SIXhour_total+0)."</B> </TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2><B> ".($ONEhour_total+0)."</B> </TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2><B> ".($FTminute_total+0)."</B> </TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2><B> ".($FIVEminute_total+0)."</B> </TD>";
|
||||
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2><B> ".($ONEminute_total+0)."</B> </TD>";
|
||||
$CARRIERstatsHTML .= "</TR>";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$CARRIERstatsHTML .= "<TR><TD BGCOLOR=white colspan=7><font size=2>"._QXZ("no log entries")."</TD></TR>";
|
||||
}
|
||||
$CARRIERstatsHTML .= "</TABLE>";
|
||||
$CARRIERstatsHTML .= "</TD></TR>";
|
||||
}
|
||||
$CARRIERstatsHTML .= "</TABLE>";
|
||||
$CARRIERstatsHTML .= "</TD></TR>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
+11
-4
File diff suppressed because one or more lines are too long
@@ -76,7 +76,7 @@ $PHP_SELF=$_SERVER['PHP_SELF'];
|
||||
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin,auto_dial_limit,user_territories_active,allow_custom_dialplan,callcard_enabled,admin_modify_refresh,nocache_admin,webroot_writable,allow_emails,active_modules,sounds_central_control_active,qc_features_active,contacts_enabled,enable_languages,language_method FROM system_settings;";
|
||||
$stmt = "SELECT use_non_latin,auto_dial_limit,user_territories_active,allow_custom_dialplan,callcard_enabled,admin_modify_refresh,nocache_admin,webroot_writable,allow_emails,active_modules,sounds_central_control_active,qc_features_active,contacts_enabled,enable_languages,language_method,admin_web_directory FROM system_settings;";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$qm_conf_ct = mysqli_num_rows($rslt);
|
||||
@@ -98,6 +98,7 @@ if ($qm_conf_ct > 0)
|
||||
$SScontacts_enabled = $row[12];
|
||||
$SSenable_languages = $row[13];
|
||||
$SSlanguage_method = $row[14];
|
||||
$SSadmin_web_directory = $row[15];
|
||||
}
|
||||
##### END SETTINGS LOOKUP #####
|
||||
###########################################
|
||||
@@ -1372,7 +1373,7 @@ if ($ADD==363111111111)
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr bgcolor=#B6D3FC><td align=left colspan=2>\n";
|
||||
|
||||
echo "<iframe src=\"/vicidial/admin_languages.php?ADD=363211111111&language_id=$language_id&DB=$DB&action=$action\" name=\"language_phrases\" style=\"background-color:transparent;\" scrolling=\"auto\" frameborder=\"0\" allowtransparency=\"true\" width=\"100%\" height=\"400\">\n</iframe>\n";
|
||||
echo "<iframe src=\"$PHP_SELF?ADD=363211111111&language_id=$language_id&DB=$DB&action=$action\" name=\"language_phrases\" style=\"background-color:transparent;\" scrolling=\"auto\" frameborder=\"0\" allowtransparency=\"true\" width=\"100%\" height=\"400\">\n</iframe>\n";
|
||||
|
||||
|
||||
echo "</td></tr>\n";
|
||||
|
||||
@@ -1245,6 +1245,21 @@ function MathZDC($dividend, $divisor, $quotient=0)
|
||||
}
|
||||
}
|
||||
|
||||
function use_archive_table($table_name)
|
||||
{
|
||||
global $link;
|
||||
$tbl_stmt="show tables like '".$table_name."_archive'";
|
||||
$tbl_rslt=mysql_to_mysqli($tbl_stmt, $link);
|
||||
if (mysqli_num_rows($tbl_rslt)>0)
|
||||
{
|
||||
$tbl_row=mysqli_fetch_row($tbl_rslt);
|
||||
return $tbl_row[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
return $table_name;
|
||||
}
|
||||
}
|
||||
|
||||
# function to print/echo content, options for length, alignment and ordered internal variables are included
|
||||
function _QXZ($English_text, $sprintf=0, $align="l", $v_one='', $v_two='', $v_three='', $v_four='', $v_five='', $v_six='', $v_seven='', $v_eight='', $v_nine='')
|
||||
|
||||
@@ -66,6 +66,7 @@
|
||||
# 151020-0704 - Added Status Groups and Custom Reports entries
|
||||
# 151030-0639 - Added usacan_phone_dialcode_fix entry
|
||||
# 151104-1541 - Added am_message_wildcards entry
|
||||
# 151121-1144 - Added cache_carrier_stats_realtime
|
||||
#
|
||||
|
||||
|
||||
@@ -4885,6 +4886,11 @@ FR_SPAC 00 00 00 00 00 - <?php echo _QXZ("France space separated phone number");
|
||||
<BR>
|
||||
<B><?php echo _QXZ("Enhanced Disconnect Logging"); ?> -</B><?php echo _QXZ("This setting enables logging of calls that get a CONGESTION signal with a cause code of 1, 19, 21, 34 or 38. We usually do not recommend enabling this in the USA. Default is 0 for disabled."); ?>
|
||||
|
||||
<BR>
|
||||
<A NAME="settings-cache_carrier_stats_realtime">
|
||||
<BR>
|
||||
<B><?php echo _QXZ("Cached Realtime Carrier Stats"); ?> -</B><?php echo _QXZ("This setting if enabled will change the real-time report from gathering the carrier log stats every time it is refreshed on every screen it is running on, to a cached set of carrier log stats that are refreshed once per minute. Default is 0 for disabled."); ?>
|
||||
|
||||
<BR>
|
||||
<A NAME="settings-campaign_cid_areacodes_enabled">
|
||||
<BR>
|
||||
|
||||
Reference in New Issue
Block a user