Added option to List Modification screen to allow you to choose the method of time zone adjustment that happens nightly on a per list basis
Added Available Only Tally Threshold and Auto Dial Level Threshold options, allowing settings to change automatically with less agents git-svn-id: svn://192.168.202.10@1658 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -565,6 +565,37 @@ OTHER CHANGES:
|
||||
application that allows full phone usage without needing to login as an
|
||||
agent
|
||||
|
||||
128. Added option to Lists to allow you to choose in the List Modification
|
||||
screen the method of time zone adjustment that happens nightly on a per
|
||||
list basis. COUNTRY_AND_AREA_CODE is the default, and will use the
|
||||
country code and area code of the phone number to determine the time
|
||||
zone of the lead. POSTAL_CODE will use the postal code if available to
|
||||
determine the time zone of the lead. NANPA_PREFIX works only in the USA
|
||||
and will use the area code and prefix of the phone number to determine
|
||||
the time zone of the lead, but this is not enabled by default in the
|
||||
system, so please be sure you have the NANPA prefix data loaded onto
|
||||
your system before selecting this option. OWNER_TIME_ZONE_CODE will use
|
||||
a standard time zone abbraviation loaded into the owner field of the
|
||||
lead to determine the time zone, in the USA examples are AST, EST, CST,
|
||||
MST, PST, AKST, HST. This feature does NOT affect the time zone used at
|
||||
the moment leads are loaded, that needs to be selected when you are
|
||||
loading leads. This feature must be enabled in the crontab for the GMT
|
||||
adjust script:
|
||||
/usr/share/astguiclient/ADMIN_adjust_GMTnow_on_leads.pl --list-settings
|
||||
|
||||
129. Added Available Only Tally Threshold campaign option which allows you to
|
||||
set the number of agents below which Available Only Tally will be
|
||||
temporarily enabled
|
||||
|
||||
130. Added Auto Dial Level Threshold campaign option which allows you to set a
|
||||
minimum number agents that the predictive algorithm will work at. If the
|
||||
number of agents falls below the number that you have set, then the
|
||||
dial level will go to 1.0 until more agents log in or go into the
|
||||
selected state
|
||||
|
||||
131. Change Dial Level Difference Target to work properly with all RATIO and
|
||||
ADAPT dial method outbound campaigns.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
# 100117-2122 - Added force-date option and activated FSO-FSA and LSS-FSA
|
||||
# 110406-0652 - Added omitlistid option
|
||||
# 110424-0834 - Added ownertimezone option
|
||||
# 110513-1444 - Added list-settings option to use settings from the vicidial_lists table
|
||||
#
|
||||
|
||||
use Time::Local;
|
||||
@@ -63,6 +64,7 @@ if (length($ARGV[0])>1)
|
||||
print " [--singlelistid=XXX] = Only lookup and alter leads in one list_id\n";
|
||||
print " [--omitlistid=XXX-YYY-ZZZ] = Skip these list_ids, separated by dash\n";
|
||||
print " [--ownertimezone] = Check the owner field for time zone abbreviation: (EST,CST,etc...)\n";
|
||||
print " [--list-settings] = Will use the time zone settings as defined in each list\n";
|
||||
print " [--force-date=YYYY-MM-DD] = Force this date as date to run\n";
|
||||
print "\n";
|
||||
|
||||
@@ -117,6 +119,11 @@ if (length($ARGV[0])>1)
|
||||
if ($q < 1) {print "\n----- OMIT LISTID OVERRIDE: $omitlistidSQL -----\n\n";}
|
||||
$omitlistidSQL =~ s/-/','/gi;
|
||||
}
|
||||
if ($args =~ /--list-settings/i)
|
||||
{
|
||||
$use_list_settings=1;
|
||||
if ($q < 1) {print "\n----- USE LIST SETTINGS -----\n\n";}
|
||||
}
|
||||
if ($args =~ /-force-date=/i)
|
||||
{
|
||||
@data_in = split(/-force-date=/,$args);
|
||||
@@ -239,6 +246,101 @@ $LOCAL_GMT_OFF_STD = $SERVER_GMT;
|
||||
if ($isdst) {$LOCAL_GMT_OFF++;}
|
||||
if ($DB) {print "SEED TIME $time : $year-$mon-$mday $hour:$min:$sec LOCAL GMT OFFSET NOW: $LOCAL_GMT_OFF\n";}
|
||||
|
||||
$CAAC_codes_list='';
|
||||
$POST_codes_list='';
|
||||
$NPFX_codes_list='';
|
||||
$OWTZ_codes_list='';
|
||||
$rec_countCAAC=0;
|
||||
$rec_countPOST=0;
|
||||
$rec_countNPFX=0;
|
||||
$rec_countOWTZ=0;
|
||||
|
||||
if ($use_list_settings > 0)
|
||||
{
|
||||
##### COUNTRY_AND_AREA_CODE lists gather #####
|
||||
$stmtA = "select list_id from vicidial_lists where time_zone_setting='COUNTRY_AND_AREA_CODE';";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
while ($sthArows > $rec_countCAAC)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$CAAC_codes_list .= "'$aryA[0]',";
|
||||
$rec_countCAAC++;
|
||||
}
|
||||
$sthA->finish();
|
||||
chop($CAAC_codes_list);
|
||||
if ($rec_countCAAC > 0)
|
||||
{$CAAC_codes_list = "and list_id IN($CAAC_codes_list)";}
|
||||
else
|
||||
{$rec_countCAAC=-1;}
|
||||
if ($DB) {print " - COUNTRY_AND_AREA_CODE lists found: $rec_countCAAC $CAAC_codes_list\n";}
|
||||
|
||||
|
||||
##### POSTAL_CODE lists gather #####
|
||||
$stmtA = "select list_id from vicidial_lists where time_zone_setting='POSTAL_CODE';";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
while ($sthArows > $rec_countPOST)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$POST_codes_list .= "'$aryA[0]',";
|
||||
$rec_countPOST++;
|
||||
}
|
||||
$sthA->finish();
|
||||
chop($POST_codes_list);
|
||||
if ($rec_countPOST > 0)
|
||||
{$POST_codes_list = "and list_id IN($POST_codes_list)";}
|
||||
else
|
||||
{$rec_countPOST=-1;}
|
||||
if ($DB) {print " - POSTAL_CODE lists found: $rec_countPOST $POST_codes_list\n";}
|
||||
|
||||
|
||||
##### NANPA_PREFIX lists gather #####
|
||||
$stmtA = "select list_id from vicidial_lists where time_zone_setting='NANPA_PREFIX';";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
while ($sthArows > $rec_countNPFX)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$NPFX_codes_list .= "'$aryA[0]',";
|
||||
$rec_countNPFX++;
|
||||
}
|
||||
$sthA->finish();
|
||||
chop($NPFX_codes_list);
|
||||
if ($rec_countNPFX > 0)
|
||||
{$NPFX_codes_list = "and list_id IN($NPFX_codes_list)";}
|
||||
else
|
||||
{$rec_countNPFX=-1;}
|
||||
if ($DB) {print " - NANPA_PREFIX lists found: $rec_countNPFX $NPFX_codes_list\n";}
|
||||
|
||||
|
||||
##### OWNER_TIME_ZONE_CODE lists gather #####
|
||||
$stmtA = "select list_id from vicidial_lists where time_zone_setting='OWNER_TIME_ZONE_CODE';";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
while ($sthArows > $rec_countOWTZ)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$OWTZ_codes_list .= "'$aryA[0]',";
|
||||
$rec_countOWTZ++;
|
||||
}
|
||||
$sthA->finish();
|
||||
chop($OWTZ_codes_list);
|
||||
if ($rec_countOWTZ > 0)
|
||||
{$OWTZ_codes_list = "and list_id IN($OWTZ_codes_list)";}
|
||||
else
|
||||
{$rec_countOWTZ=-1;}
|
||||
if ($DB) {print " - OWNER_TIME_ZONE_CODE lists found: $rec_countOWTZ $OWTZ_codes_list\n";}
|
||||
}
|
||||
|
||||
if (length($singlelistid)> 0) {$listSQL = "where list_id='$singlelistid'"; $XlistSQL=" and list_id='$singlelistid' ";}
|
||||
else {$listSQL = ''; $XlistSQL='';}
|
||||
if (length($omitlistidSQL)> 0)
|
||||
@@ -251,6 +353,7 @@ if (length($omitlistidSQL)> 0)
|
||||
}
|
||||
else {$XomitlistidSQL=''; $omitlistidSQL='';}
|
||||
|
||||
|
||||
$stmtA = "select distinct phone_code from vicidial_list $listSQL $omitlistidSQL;";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
@@ -258,7 +361,7 @@ $sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
$rec_countY=0;
|
||||
@phone_codes=@MT;
|
||||
$phone_codes_list="'";
|
||||
$phone_codes_list='';
|
||||
|
||||
while ($sthArows > $rec_countY)
|
||||
{
|
||||
@@ -268,16 +371,18 @@ while ($sthArows > $rec_countY)
|
||||
$phone_codes_ORIG[$rec_countY] = $aryA[0];
|
||||
$phone_codes[$rec_countY] =~ s/011|0011| |\t|\r|\n//gi;
|
||||
|
||||
$phone_codes_list .= "$aryA[0]'";
|
||||
$phone_codes_list .= "'$aryA[0]',";
|
||||
|
||||
if ($DBX) {print "|",$aryA[0],"|","\n";}
|
||||
$rec_countY++;
|
||||
}
|
||||
$sthA->finish();
|
||||
chop($phone_codes_list);
|
||||
if ($DB) {print " - Unique Country dial codes found: $rec_countY\n";}
|
||||
if (length($phone_codes_list)<2) {$phone_codes_list="''";}
|
||||
|
||||
if ($ownertimezone > 0)
|
||||
##### Owner time zone abbreviation lookup #####
|
||||
if ( ( ($ownertimezone > 0) || ($rec_countOWTZ > 0) ) && ($rec_countOWTZ > -1) )
|
||||
{
|
||||
$stmtA = "select distinct tz_code,GMT_offset,country_code from vicidial_phone_codes where country_code IN($phone_codes_list);";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
@@ -321,7 +426,7 @@ while ($sthArows > $rec_countZ)
|
||||
$rec_countZ++;
|
||||
}
|
||||
|
||||
if ($searchPOST > 0)
|
||||
if ( ( ($searchPOST > 0) || ($rec_countPOST > 0) ) && ($rec_countPOST > -1) )
|
||||
{
|
||||
##### Put all postal code records into an array for speed
|
||||
$stmtA = "select postal_code,state,GMT_offset,DST,DST_range,country,country_code from vicidial_postal_codes;";
|
||||
@@ -341,7 +446,7 @@ if ($searchPOST > 0)
|
||||
if ($DB) {print " - GMT postal codes records: $rec_countT\n";}
|
||||
}
|
||||
|
||||
if ($searchNANPA > 0)
|
||||
if ( ( ($searchNANPA > 0) || ($rec_countNPFX > 0) ) && ($rec_countNPFX > -1) )
|
||||
{
|
||||
##### Put all nanpa prefix records into an array for speed
|
||||
$stmtA = "select areacode,prefix,GMT_offset,DST from vicidial_nanpa_prefix_codes;";
|
||||
@@ -401,7 +506,7 @@ foreach (@phone_codes)
|
||||
else {$AC_match = " and phone_number LIKE \"$area_code%\"";}
|
||||
}
|
||||
if ($DBX) {print "PROCESSING THIS LINE: $codefile[$e]\n";}
|
||||
|
||||
|
||||
$stmtA = "select count(*) from vicidial_list where phone_code='$match_code_ORIG' $AC_match $XlistSQL $XomitlistidSQL;";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
|
||||
@@ -513,7 +618,6 @@ foreach (@phone_codes)
|
||||
$AC_processed++;
|
||||
}
|
||||
|
||||
|
||||
if ($AC_processed)
|
||||
{
|
||||
$stmtA = "select count(*) from vicidial_list where phone_code='$match_code_ORIG' $AC_match and (gmt_offset_now != '$area_GMT' or gmt_offset_now IS NULL) $XlistSQL $XomitlistidSQL;";
|
||||
@@ -533,7 +637,7 @@ foreach (@phone_codes)
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmtA = "update vicidial_list set gmt_offset_now='$area_GMT' where phone_code='$match_code_ORIG' $AC_match and (gmt_offset_now != '$area_GMT' or gmt_offset_now IS NULL) $XlistSQL $XomitlistidSQL;";
|
||||
$stmtA = "update vicidial_list set gmt_offset_now='$area_GMT',modify_date=modify_date where phone_code='$match_code_ORIG' $AC_match and (gmt_offset_now != '$area_GMT' or gmt_offset_now IS NULL) $XlistSQL $XomitlistidSQL;";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
if (!$T)
|
||||
{
|
||||
@@ -567,7 +671,7 @@ foreach (@phone_codes)
|
||||
|
||||
##### BEGIN RUN LOOP FOR EACH POSTAL CODE RECORD THAT IS INSIDE THIS COUNTRY CODE #####
|
||||
$postal_updated_count=0;
|
||||
if ($searchPOST > 0)
|
||||
if ( ( ($searchPOST > 0) || ($rec_countPOST > 0) ) && ($rec_countPOST > -1) )
|
||||
{
|
||||
if ($DB) {print "POSTAL CODE RUN START...\n";}
|
||||
$e=0;
|
||||
@@ -584,7 +688,7 @@ foreach (@phone_codes)
|
||||
$AC_match = " and postal_code LIKE \"$postal_code%\"";
|
||||
if ($DBX) {print "PROCESSING THIS LINE: $postalfile[$e]\n";}
|
||||
|
||||
$stmtA = "select count(*) from vicidial_list where phone_code='$match_code_ORIG' $AC_match $XlistSQL $XomitlistidSQL;";
|
||||
$stmtA = "select count(*) from vicidial_list where phone_code='$match_code_ORIG' $AC_match $XlistSQL $XomitlistidSQL $POST_codes_list;";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
@@ -698,7 +802,7 @@ foreach (@phone_codes)
|
||||
|
||||
if ($AC_processed)
|
||||
{
|
||||
$stmtA = "select count(*) from vicidial_list where phone_code='$match_code_ORIG' $AC_match and (gmt_offset_now != '$area_GMT' or gmt_offset_now IS NULL) $XlistSQL $XomitlistidSQL;";
|
||||
$stmtA = "select count(*) from vicidial_list where phone_code='$match_code_ORIG' $AC_match and (gmt_offset_now != '$area_GMT' or gmt_offset_now IS NULL) $XlistSQL $XomitlistidSQL $POST_codes_list;";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
@@ -715,7 +819,7 @@ foreach (@phone_codes)
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmtA = "update vicidial_list set gmt_offset_now='$area_GMT' where phone_code='$match_code_ORIG' $AC_match and (gmt_offset_now != '$area_GMT' or gmt_offset_now IS NULL) $XlistSQL $XomitlistidSQL;";
|
||||
$stmtA = "update vicidial_list set gmt_offset_now='$area_GMT',modify_date=modify_date where phone_code='$match_code_ORIG' $AC_match and (gmt_offset_now != '$area_GMT' or gmt_offset_now IS NULL) $XlistSQL $XomitlistidSQL $POST_codes_list;";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
if (!$T)
|
||||
{
|
||||
@@ -751,7 +855,7 @@ foreach (@phone_codes)
|
||||
##### START RUN LOOP FOR EACH NANPA PREFIX RECORD #####
|
||||
# areacode,prefix,GMT_offset,DST,SSM-FSN
|
||||
$nanpa_updated_count=0;
|
||||
if ( ($searchNANPA > 0) && ($match_code =~ /^1$/) )
|
||||
if ( ( ( ($searchNANPA > 0) && ($match_code =~ /^1$/) ) || ($rec_countNPFX > 0) ) && ($rec_countNPFX > -1) )
|
||||
{
|
||||
if ($DB) {print "NANPA PREFIX RUN START...\n";}
|
||||
$e=0;
|
||||
@@ -766,7 +870,7 @@ foreach (@phone_codes)
|
||||
$AC_match = " and phone_number LIKE \"$nanpa_areacode$nanpa_prefix%\"";
|
||||
if ($DBX) {print "PROCESSING THIS LINE: $nanpafile[$e]\n";}
|
||||
|
||||
$stmtA = "select count(*) from vicidial_list where phone_code='$match_code_ORIG' $AC_match $XlistSQL $XomitlistidSQL;";
|
||||
$stmtA = "select count(*) from vicidial_list where phone_code='$match_code_ORIG' $AC_match $XlistSQL $XomitlistidSQL $NPFX_codes_list;";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
@@ -880,7 +984,7 @@ foreach (@phone_codes)
|
||||
|
||||
if ($AC_processed)
|
||||
{
|
||||
$stmtA = "select count(*) from vicidial_list where phone_code='$match_code_ORIG' $AC_match and (gmt_offset_now != '$area_GMT' or gmt_offset_now IS NULL) $XlistSQL $XomitlistidSQL;";
|
||||
$stmtA = "select count(*) from vicidial_list where phone_code='$match_code_ORIG' $AC_match and (gmt_offset_now != '$area_GMT' or gmt_offset_now IS NULL) $XlistSQL $XomitlistidSQL $NPFX_codes_list;";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
@@ -897,7 +1001,7 @@ foreach (@phone_codes)
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmtA = "update vicidial_list set gmt_offset_now='$area_GMT' where phone_code='$match_code_ORIG' $AC_match and (gmt_offset_now != '$area_GMT' or gmt_offset_now IS NULL) $XlistSQL $XomitlistidSQL;";
|
||||
$stmtA = "update vicidial_list set gmt_offset_now='$area_GMT',modify_date=modify_date where phone_code='$match_code_ORIG' $AC_match and (gmt_offset_now != '$area_GMT' or gmt_offset_now IS NULL) $XlistSQL $XomitlistidSQL $NPFX_codes_list;";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
if (!$T)
|
||||
{
|
||||
@@ -926,7 +1030,7 @@ foreach (@phone_codes)
|
||||
|
||||
##### START RUN LOOP FOR EACH TIME ZONE CODE RECORD #####
|
||||
$tzcode_updated_count=0;
|
||||
if ($ownertimezone > 0)
|
||||
if ( ( ($ownertimezone > 0) || ($rec_countOWTZ > 0) ) && ($rec_countOWTZ > -1) )
|
||||
{
|
||||
if ($DB) {print "TIME ZONE CODE RUN START...\n";}
|
||||
$e=0;
|
||||
@@ -948,7 +1052,7 @@ foreach (@phone_codes)
|
||||
|
||||
if ($DBX) {print "PROCESSING THIS TIME ZONE CODE: $tz_codes[$e]|$tz_country[$e]|$area_GMT|$area_GMT_method\n";}
|
||||
|
||||
$stmtA = "select count(*) from vicidial_list where owner='$tz_codes[$e]' and phone_code='$tz_country[$e]' $XlistSQL $XomitlistidSQL;";
|
||||
$stmtA = "select count(*) from vicidial_list where owner='$tz_codes[$e]' and phone_code='$tz_country[$e]' $XlistSQL $XomitlistidSQL $OWTZ_codes_list;";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
@@ -1061,7 +1165,7 @@ foreach (@phone_codes)
|
||||
|
||||
if ($AC_processed)
|
||||
{
|
||||
$stmtA = "select count(*) from vicidial_list where owner='$tz_codes[$e]' and phone_code='$tz_country[$e]' and (gmt_offset_now != '$area_GMT' or gmt_offset_now IS NULL) $XlistSQL $XomitlistidSQL;";
|
||||
$stmtA = "select count(*) from vicidial_list where owner='$tz_codes[$e]' and phone_code='$tz_country[$e]' and (gmt_offset_now != '$area_GMT' or gmt_offset_now IS NULL) $XlistSQL $XomitlistidSQL $OWTZ_codes_list;";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
@@ -1078,7 +1182,7 @@ foreach (@phone_codes)
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmtA = "UPDATE vicidial_list set gmt_offset_now='$area_GMT' where owner='$tz_codes[$e]' and phone_code='$tz_country[$e]' and (gmt_offset_now != '$area_GMT' or gmt_offset_now IS NULL) $XlistSQL $XomitlistidSQL;";
|
||||
$stmtA = "UPDATE vicidial_list set gmt_offset_now='$area_GMT',modify_date=modify_date where owner='$tz_codes[$e]' and phone_code='$tz_country[$e]' and (gmt_offset_now != '$area_GMT' or gmt_offset_now IS NULL) $XlistSQL $XomitlistidSQL $OWTZ_codes_list;";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
if (!$T)
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
# - Runs trigger processes at defined times
|
||||
# - Auto reset lists at defined times
|
||||
#
|
||||
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2011 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGES
|
||||
# 61011-1348 - First build
|
||||
@@ -59,6 +59,7 @@
|
||||
# 101022-1655 - Added new variables to be cleared from vicidial_cacmpaign_stats table
|
||||
# 101107-2257 - Added cross-server phone dialplan extensions
|
||||
# 101214-1507 - Changed list auto-reset to work with inactive lists
|
||||
# 110512-2112 - Added vicidial_campaign_stats_debug to table cleaning
|
||||
#
|
||||
|
||||
$DB=0; # Debug flag
|
||||
@@ -741,6 +742,20 @@ if ($timeclock_end_of_day_NOW > 0)
|
||||
if ($DB) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";}
|
||||
$sthA->finish();
|
||||
|
||||
$stmtA = "delete from vicidial_campaign_stats_debug;";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
if($DB){print STDERR "\n|$affected_rows vicidial_campaign_stats_debug records deleted|\n";}
|
||||
|
||||
$stmtA = "optimize table vicidial_campaign_stats_debug;";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
if ($DB) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";}
|
||||
$sthA->finish();
|
||||
|
||||
$stmtA = "update vicidial_inbound_group_agents SET calls_today=0;";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# AST_VDadapt.pl version 2.2.0
|
||||
# AST_VDadapt.pl version 2.4
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# adjusts the auto_dial_level for vicidial adaptive-predictive campaigns.
|
||||
# gather call stats for campaigns and in-groups
|
||||
#
|
||||
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2011 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGELOG
|
||||
# 60823-1302 - First build from AST_VDhopper.pl
|
||||
@@ -34,6 +34,7 @@
|
||||
# 91115-0929 - Added auto-kill of script at timeclock reset time of day to facilitate cleaner clearing of daily stats
|
||||
# 91206-2203 - Added campaign_calldate within last 5 minute as an override to recalculate stats
|
||||
# 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
|
||||
#
|
||||
|
||||
# constants
|
||||
@@ -257,7 +258,11 @@ if ($DBX) {print "CONNECTED TO DATABASE: $VARDB_server|$VARDB_database\n";}
|
||||
|
||||
# make sure the vicidial_campaign_stats table has all of the campaigns.
|
||||
# They should exist, but sometimes they get accidently removed during db moves and the like.
|
||||
$stmtA = "insert ignore into vicidial_campaign_stats (campaign_id) select campaign_id from vicidial_campaigns;";
|
||||
$stmtA = "INSERT IGNORE into vicidial_campaign_stats (campaign_id) select campaign_id from vicidial_campaigns;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
|
||||
$stmtA = "INSERT IGNORE into vicidial_campaign_stats_debug (campaign_id,server_ip) select campaign_id,'ADAPT' from vicidial_campaigns;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
|
||||
@@ -362,14 +367,18 @@ while ($master_loop<$CLIloops)
|
||||
@campaign_stats_refresh=@MT;
|
||||
@campaign_allow_inbound=@MT;
|
||||
@drop_rate_group=@MT;
|
||||
@available_only_tally_threshold=@MT;
|
||||
@available_only_tally_threshold_agents=@MT;
|
||||
@dial_level_threshold=@MT;
|
||||
@dial_level_threshold_agents=@MT;
|
||||
|
||||
if ($CLIcampaign)
|
||||
{
|
||||
$stmtA = "SELECT campaign_id,lead_order,hopper_level,auto_dial_level,local_call_time,lead_filter_id,use_internal_dnc,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,UNIX_TIMESTAMP(campaign_changedate),campaign_stats_refresh,campaign_allow_inbound,drop_rate_group,UNIX_TIMESTAMP(campaign_calldate),realtime_agent_time_stats from vicidial_campaigns where campaign_id='$CLIcampaign'";
|
||||
$stmtA = "SELECT campaign_id,lead_order,hopper_level,auto_dial_level,local_call_time,lead_filter_id,use_internal_dnc,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,UNIX_TIMESTAMP(campaign_changedate),campaign_stats_refresh,campaign_allow_inbound,drop_rate_group,UNIX_TIMESTAMP(campaign_calldate),realtime_agent_time_stats,available_only_tally_threshold,available_only_tally_threshold_agents,dial_level_threshold,dial_level_threshold_agents from vicidial_campaigns where campaign_id='$CLIcampaign'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmtA = "SELECT campaign_id,lead_order,hopper_level,auto_dial_level,local_call_time,lead_filter_id,use_internal_dnc,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,UNIX_TIMESTAMP(campaign_changedate),campaign_stats_refresh,campaign_allow_inbound,drop_rate_group,UNIX_TIMESTAMP(campaign_calldate),realtime_agent_time_stats from vicidial_campaigns where ( (active='Y') or (campaign_stats_refresh='Y') )";
|
||||
$stmtA = "SELECT campaign_id,lead_order,hopper_level,auto_dial_level,local_call_time,lead_filter_id,use_internal_dnc,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,UNIX_TIMESTAMP(campaign_changedate),campaign_stats_refresh,campaign_allow_inbound,drop_rate_group,UNIX_TIMESTAMP(campaign_calldate),realtime_agent_time_stats,available_only_tally_threshold,available_only_tally_threshold_agents,dial_level_threshold,dial_level_threshold_agents from vicidial_campaigns where ( (active='Y') or (campaign_stats_refresh='Y') )";
|
||||
}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
@@ -389,7 +398,7 @@ while ($master_loop<$CLIloops)
|
||||
$lead_filter_id[$rec_count] = $aryA[5];
|
||||
$use_internal_dnc[$rec_count] = $aryA[6];
|
||||
$dial_method[$rec_count] = $aryA[7];
|
||||
$available_only_ratio_tally[$i][$rec_count] = $aryA[8];
|
||||
$available_only_ratio_tally[$rec_count] = $aryA[8];
|
||||
$adaptive_dropped_percentage[$rec_count] = $aryA[9];
|
||||
$adaptive_maximum_level[$rec_count] = $aryA[10];
|
||||
$adaptive_latest_server_time[$rec_count] = $aryA[11];
|
||||
@@ -401,6 +410,10 @@ while ($master_loop<$CLIloops)
|
||||
$drop_rate_group[$rec_count] = $aryA[17];
|
||||
$campaign_calldate_epoch[$rec_count] = $aryA[18];
|
||||
$realtime_agent_time_stats[$rec_count] = $aryA[19];
|
||||
$available_only_tally_threshold[$rec_count] = $aryA[20];
|
||||
$available_only_tally_threshold_agents[$rec_count] = $aryA[21];
|
||||
$dial_level_threshold[$rec_count] = $aryA[22];
|
||||
$dial_level_threshold_agents[$rec_count] = $aryA[23];
|
||||
|
||||
$rec_count++;
|
||||
}
|
||||
@@ -414,6 +427,7 @@ while ($master_loop<$CLIloops)
|
||||
$i=0;
|
||||
foreach(@campaign_id)
|
||||
{
|
||||
$debug_camp_output='';
|
||||
### Find out how many leads are in the hopper from a specific campaign
|
||||
$hopper_ready_count=0;
|
||||
$stmtA = "SELECT count(*) from vicidial_hopper where campaign_id='$campaign_id[$i]' and status='READY';";
|
||||
@@ -425,14 +439,17 @@ while ($master_loop<$CLIloops)
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$hopper_ready_count = $aryA[0];
|
||||
if ($DB) {print " $campaign_id[$i] hopper READY count: $hopper_ready_count";}
|
||||
$debug_camp_output .= " $campaign_id[$i] hopper READY count: $hopper_ready_count\n";
|
||||
# if ($DBX) {print " |$stmtA|\n";}
|
||||
}
|
||||
$sthA->finish();
|
||||
$event_string = "|$campaign_id[$i]|$hopper_level[$i]|$hopper_ready_count|$local_call_time[$i]|$diff_ratio_updater|$drop_count_updater|";
|
||||
if ($DBX) {print "$i $event_string\n";}
|
||||
if ($DBX) {print "$i $event_string\n";}
|
||||
$debug_camp_output .= "$i $event_string\n";
|
||||
&event_logger;
|
||||
|
||||
if ($DBX) {print " TIME CALL CHECK: $five_min_ago/$campaign_calldate_epoch[$i]\n";}
|
||||
$debug_camp_output .= " TIME CALL CHECK: $five_min_ago/$campaign_calldate_epoch[$i]\n";
|
||||
|
||||
##### IF THERE ARE NO LEADS IN THE HOPPER FOR THE CAMPAIGN WE DO NOT WANT TO ADJUST THE DIAL_LEVEL
|
||||
if ($hopper_ready_count>0)
|
||||
@@ -464,6 +481,7 @@ while ($master_loop<$CLIloops)
|
||||
if ($drop_count_updater>=60)
|
||||
{
|
||||
if ($DB) {print " REFRESH OVERRIDE: $campaign_id[$i]\n";}
|
||||
$debug_camp_output .= " REFRESH OVERRIDE: $campaign_id[$i]\n";
|
||||
|
||||
&calculate_drops;
|
||||
|
||||
@@ -480,6 +498,7 @@ while ($master_loop<$CLIloops)
|
||||
if ($drop_count_updater>=60)
|
||||
{
|
||||
if ($DB) {print " CHANGEDATE OVERRIDE: $campaign_id[$i]\n";}
|
||||
$debug_camp_output .= " CHANGEDATE OVERRIDE: $campaign_id[$i]\n";
|
||||
|
||||
&calculate_drops;
|
||||
|
||||
@@ -496,6 +515,7 @@ while ($master_loop<$CLIloops)
|
||||
if ($drop_count_updater>=60)
|
||||
{
|
||||
if ($DB) {print " REFRESH OVERRIDE: $campaign_id[$i]\n";}
|
||||
$debug_camp_output .= " REFRESH OVERRIDE: $campaign_id[$i]\n";
|
||||
|
||||
&calculate_drops;
|
||||
|
||||
@@ -512,6 +532,7 @@ while ($master_loop<$CLIloops)
|
||||
if ($drop_count_updater>=60)
|
||||
{
|
||||
if ($DB) {print " CHANGEDATE OVERRIDE: $campaign_id[$i]\n";}
|
||||
$debug_camp_output .= " CHANGEDATE OVERRIDE: $campaign_id[$i]\n";
|
||||
|
||||
&calculate_drops;
|
||||
|
||||
@@ -591,6 +612,10 @@ sub adaptive_logger
|
||||
print Aout "$now_date$adaptive_string\n";
|
||||
close(Aout);
|
||||
}
|
||||
|
||||
$stmtA = "UPDATE vicidial_campaign_stats_debug SET entry_time='$now_date',adapt_output='$adaptive_string' where campaign_id='$campaign_id[$i]' and server_ip='ADAPT';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
|
||||
$adaptive_string='';
|
||||
}
|
||||
|
||||
@@ -659,7 +684,7 @@ sub get_time_now
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$timeclock_end_of_day_NOW = "$aryA[0]";
|
||||
$timeclock_end_of_day_NOW = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
@@ -699,8 +724,8 @@ sub count_agents_lines
|
||||
while ($sthArows > $rec_count)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$VCSagent_count[$i] = "$aryA[0]";
|
||||
$VCSagent_status[$i] = "$aryA[1]";
|
||||
$VCSagent_count[$i] = $aryA[0];
|
||||
$VCSagent_status[$i] = $aryA[1];
|
||||
$rec_count++;
|
||||
if ($VCSagent_status[$i] =~ /READY|DONE/) {$ready_agents[$i] = ($ready_agents[$i] + $VCSagent_count[$i]);}
|
||||
$total_agents[$i] = ($total_agents[$i] + $VCSagent_count[$i]);
|
||||
@@ -714,7 +739,7 @@ sub count_agents_lines
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$waiting_calls[$i] = "$aryA[0]";
|
||||
$waiting_calls[$i] = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
@@ -756,6 +781,7 @@ sub count_agents_lines
|
||||
$event_string="CAMPAIGN DIFFERENTIAL: $total_agents_avg[$i] $stat_differential[$i] ($ready_diff_avg[$i] - $waiting_diff_avg[$i])";
|
||||
if ($DBX) {print "$campaign_id[$i]|$event_string\n";}
|
||||
if ($DB) {print " $event_string\n";}
|
||||
$debug_camp_output .= "$event_string\n";
|
||||
|
||||
&event_logger;
|
||||
|
||||
@@ -798,6 +824,7 @@ sub calculate_drops
|
||||
$sthA->finish();
|
||||
chop($camp_ANS_STAT_SQL);
|
||||
|
||||
$debug_camp_output .= " CAMPAIGN ANSWERED STATUSES: $campaign_id[$i]|$camp_ANS_STAT_SQL|\n";
|
||||
if ($DBX) {print " CAMPAIGN ANSWERED STATUSES: $campaign_id[$i]|$camp_ANS_STAT_SQL|\n";}
|
||||
|
||||
$RESETdrop_count_updater++;
|
||||
@@ -838,7 +865,7 @@ sub calculate_drops
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$VCScalls_one[$i] = "$aryA[0]";
|
||||
$VCScalls_one[$i] = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
if ($VCScalls_one[$i] > 0)
|
||||
@@ -851,7 +878,7 @@ sub calculate_drops
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$VCSanswers_one[$i] = "$aryA[0]";
|
||||
$VCSanswers_one[$i] = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
# LAST MINUTE DROPS
|
||||
@@ -862,7 +889,7 @@ sub calculate_drops
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$VCSdrops_one[$i] = "$aryA[0]";
|
||||
$VCSdrops_one[$i] = $aryA[0];
|
||||
if ($VCSdrops_one[$i] > 0)
|
||||
{
|
||||
$VCSdrops_one_pct[$i] = ( ($VCSdrops_one[$i] / $VCScalls_one[$i]) * 100 );
|
||||
@@ -880,7 +907,7 @@ sub calculate_drops
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$VCScalls_today[$i] = "$aryA[0]";
|
||||
$VCScalls_today[$i] = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
if ($VCScalls_today[$i] > 0)
|
||||
@@ -893,7 +920,7 @@ sub calculate_drops
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$VCSanswers_today[$i] = "$aryA[0]";
|
||||
$VCSanswers_today[$i] = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
# TODAY DROPS
|
||||
@@ -905,7 +932,7 @@ sub calculate_drops
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$VCSdrops_today[$i] = "$aryA[0]";
|
||||
$VCSdrops_today[$i] = $aryA[0];
|
||||
if ($VCSdrops_today[$i] > 0)
|
||||
{
|
||||
$VCSdrops_today_pct[$i] = ( ($VCSdrops_today[$i] / $VCScalls_today[$i]) * 100 );
|
||||
@@ -926,7 +953,7 @@ sub calculate_drops
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$VCScalls_hour[$i] = "$aryA[0]";
|
||||
$VCScalls_hour[$i] = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
if ($VCScalls_hour[$i] > 0)
|
||||
@@ -939,7 +966,7 @@ sub calculate_drops
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$VCSanswers_hour[$i] = "$aryA[0]";
|
||||
$VCSanswers_hour[$i] = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
# DROP LAST HOUR
|
||||
@@ -950,7 +977,7 @@ sub calculate_drops
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$VCSdrops_hour[$i] = "$aryA[0]";
|
||||
$VCSdrops_hour[$i] = $aryA[0];
|
||||
if ($VCSdrops_hour[$i] > 0)
|
||||
{
|
||||
$VCSdrops_hour_pct[$i] = ( ($VCSdrops_hour[$i] / $VCScalls_hour[$i]) * 100 );
|
||||
@@ -969,7 +996,7 @@ sub calculate_drops
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$VCScalls_halfhour[$i] = "$aryA[0]";
|
||||
$VCScalls_halfhour[$i] = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
if ($VCScalls_halfhour[$i] > 0)
|
||||
@@ -982,7 +1009,7 @@ sub calculate_drops
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$VCSanswers_halfhour[$i] = "$aryA[0]";
|
||||
$VCSanswers_halfhour[$i] = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
# DROPS HALFHOUR
|
||||
@@ -993,7 +1020,7 @@ sub calculate_drops
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$VCSdrops_halfhour[$i] = "$aryA[0]";
|
||||
$VCSdrops_halfhour[$i] = $aryA[0];
|
||||
if ($VCSdrops_halfhour[$i] > 0)
|
||||
{
|
||||
$VCSdrops_halfhour_pct[$i] = ( ($VCSdrops_halfhour[$i] / $VCScalls_halfhour[$i]) * 100 );
|
||||
@@ -1011,7 +1038,7 @@ sub calculate_drops
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$VCScalls_five[$i] = "$aryA[0]";
|
||||
$VCScalls_five[$i] = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
@@ -1025,7 +1052,7 @@ sub calculate_drops
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$VCSanswers_five[$i] = "$aryA[0]";
|
||||
$VCSanswers_five[$i] = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
# DROPS FIVEMINUTE
|
||||
@@ -1036,7 +1063,7 @@ sub calculate_drops
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$VCSdrops_five[$i] = "$aryA[0]";
|
||||
$VCSdrops_five[$i] = $aryA[0];
|
||||
if ($VCSdrops_five[$i] > 0)
|
||||
{
|
||||
$VCSdrops_five_pct[$i] = ( ($VCSdrops_five[$i] / $VCScalls_five[$i]) * 100 );
|
||||
@@ -1045,6 +1072,7 @@ sub calculate_drops
|
||||
}
|
||||
$sthA->finish();
|
||||
}
|
||||
$debug_camp_output .= "$campaign_id[$i]|$VCSdrops_five_pct[$i]|$VCSdrops_today_pct[$i]| |$VCSdrops_today[$i] / $VCScalls_today[$i] / $VCSanswers_today[$i]| $i\n";
|
||||
if ($DBX) {print "$campaign_id[$i]|$VCSdrops_five_pct[$i]|$VCSdrops_today_pct[$i]| |$VCSdrops_today[$i] / $VCScalls_today[$i] / $VCSanswers_today[$i]| $i\n";}
|
||||
|
||||
# DETERMINE WHETHER TO GATHER STATUS CATEGORY STATISTICS
|
||||
@@ -1058,7 +1086,7 @@ sub calculate_drops
|
||||
while ($sthArows > $rec_count)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$VSC_categories[$rec_count] = "$aryA[0]";
|
||||
$VSC_categories[$rec_count] = $aryA[0];
|
||||
$rec_count++;
|
||||
}
|
||||
$sthA->finish();
|
||||
@@ -1105,10 +1133,11 @@ sub calculate_drops
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$VSCtally = "$aryA[0]";
|
||||
$VSCtally = $aryA[0];
|
||||
}
|
||||
}
|
||||
$g++;
|
||||
$debug_camp_output .= " $campaign_id[$i]|$VSCcategory|$VSCtally|$CATstatusesSQL|\n";
|
||||
if ($DBX) {print " $campaign_id[$i]|$VSCcategory|$VSCtally|$CATstatusesSQL|\n";}
|
||||
$VSCupdateSQL .= "status_category_$g='$VSCcategory',status_category_count_$g='$VSCtally',";
|
||||
}
|
||||
@@ -1142,6 +1171,7 @@ sub calculate_drops
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$debug_camp_output .= " DROP RATE GROUP USED: $drop_rate_group[$i] $aryA[0]|$VCSdrops_answers_today_pct[$i]\n";
|
||||
if ($DBX) {print " DROP RATE GROUP USED: $drop_rate_group[$i] $aryA[0]|$VCSdrops_answers_today_pct[$i]\n";}
|
||||
$VCSdrops_answers_today_pct[$i] = $aryA[0];
|
||||
}
|
||||
@@ -1158,6 +1188,7 @@ sub calculate_drops
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$debug_camp_output .= " AGENT TIME STATS: $aryA[0] $aryA[1] $aryA[2] $aryA[3]|$stmtA\n";
|
||||
if ($DBX) {print " AGENT TIME STATS: $aryA[0] $aryA[1] $aryA[2] $aryA[3]|$stmtA\n";}
|
||||
$VCSagent_pause_today[$i] = $aryA[0];
|
||||
$VCSagent_wait_today[$i] = $aryA[1];
|
||||
@@ -1172,6 +1203,7 @@ sub calculate_drops
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$debug_camp_output .= " AGENT CALLS: $aryA[0]|$stmtA\n";
|
||||
if ($DBX) {print " AGENT CALLS: $aryA[0]|$stmtA\n";}
|
||||
$VCSagent_calls_today[$i] = $aryA[0];
|
||||
}
|
||||
@@ -1182,6 +1214,10 @@ sub calculate_drops
|
||||
$stmtA = "UPDATE vicidial_campaign_stats SET calls_today='$VCScalls_today[$i]',answers_today='$VCSanswers_today[$i]',drops_today='$VCSdrops_today[$i]',drops_today_pct='$VCSdrops_today_pct[$i]',drops_answers_today_pct='$VCSdrops_answers_today_pct[$i]',calls_hour='$VCScalls_hour[$i]',answers_hour='$VCSanswers_hour[$i]',drops_hour='$VCSdrops_hour[$i]',drops_hour_pct='$VCSdrops_hour_pct[$i]',calls_halfhour='$VCScalls_halfhour[$i]',answers_halfhour='$VCSanswers_halfhour[$i]',drops_halfhour='$VCSdrops_halfhour[$i]',drops_halfhour_pct='$VCSdrops_halfhour_pct[$i]',calls_fivemin='$VCScalls_five[$i]',answers_fivemin='$VCSanswers_five[$i]',drops_fivemin='$VCSdrops_five[$i]',drops_fivemin_pct='$VCSdrops_five_pct[$i]',calls_onemin='$VCScalls_one[$i]',answers_onemin='$VCSanswers_one[$i]',drops_onemin='$VCSdrops_one[$i]',drops_onemin_pct='$VCSdrops_one_pct[$i]',agent_non_pause_sec='$VCSagent_nonpause_time[$i]',agent_calls_today='$VCSagent_calls_today[$i]',agent_pause_today='$VCSagent_pause_today[$i]',agent_wait_today='$VCSagent_wait_today[$i]',agent_custtalk_today='$VCSagent_custtalk_today[$i]',agent_acw_today='$VCSagent_acw_today[$i]',$VSCupdateSQL where campaign_id='$campaign_id[$i]';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
if ($DBX) {print "OUTBOUND $campaign_id[$i]|$affected_rows|$stmtA|\n";}
|
||||
|
||||
$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='';
|
||||
}
|
||||
|
||||
|
||||
@@ -1201,7 +1237,7 @@ sub drop_rate_group_gather
|
||||
while ($sthArowsDR > $dr)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$DRgroup[$dr] = "$aryA[0]";
|
||||
$DRgroup[$dr] = $aryA[0];
|
||||
$dr++;
|
||||
}
|
||||
$sthA->finish();
|
||||
@@ -1293,6 +1329,7 @@ sub launch_inbound_gather
|
||||
|
||||
sub calculate_drops_inbound
|
||||
{
|
||||
$debug_ingroup_output='';
|
||||
$answer_sec_pct_rt_stat_one = '20';
|
||||
$answer_sec_pct_rt_stat_two = '30';
|
||||
# GET inbound group hold stat seconds settings
|
||||
@@ -1338,6 +1375,7 @@ sub calculate_drops_inbound
|
||||
chop($camp_ANS_STAT_SQL);
|
||||
|
||||
if ($DBX) {print " ANSWERED STATUSES: $group_id[$p]|$camp_ANS_STAT_SQL|\n";}
|
||||
$debug_ingroup_output .= " ANSWERED STATUSES: $group_id[$p]|$camp_ANS_STAT_SQL|\n";
|
||||
|
||||
#$RESETdrop_count_updater++;
|
||||
$iVCScalls_today[$p]=0;
|
||||
@@ -1359,7 +1397,7 @@ sub calculate_drops_inbound
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$iVCScalls_today[$p] = "$aryA[0]";
|
||||
$iVCScalls_today[$p] = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
if ($iVCScalls_today[$p] > 0)
|
||||
@@ -1372,7 +1410,7 @@ sub calculate_drops_inbound
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$iVCSanswers_today[$p] = "$aryA[0]";
|
||||
$iVCSanswers_today[$p] = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
# TODAY DROPS
|
||||
@@ -1384,7 +1422,7 @@ sub calculate_drops_inbound
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$iVCSdrops_today[$p] = "$aryA[0]";
|
||||
$iVCSdrops_today[$p] = $aryA[0];
|
||||
if ($iVCSdrops_today[$p] > 0)
|
||||
{
|
||||
$iVCSdrops_today_pct[$p] = ( ($iVCSdrops_today[$p] / $iVCScalls_today[$p]) * 100 );
|
||||
@@ -1454,7 +1492,6 @@ sub calculate_drops_inbound
|
||||
|
||||
|
||||
|
||||
|
||||
# DETERMINE WHETHER TO GATHER STATUS CATEGORY STATISTICS
|
||||
$VSC_categories=0;
|
||||
$VSCupdateSQL='';
|
||||
@@ -1466,7 +1503,7 @@ sub calculate_drops_inbound
|
||||
while ($sthArows > $rec_count)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$VSC_categories[$rec_count] = "$aryA[0]";
|
||||
$VSC_categories[$rec_count] = $aryA[0];
|
||||
$rec_count++;
|
||||
}
|
||||
$sthA->finish();
|
||||
@@ -1513,12 +1550,13 @@ sub calculate_drops_inbound
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$VSCtally = "$aryA[0]";
|
||||
$VSCtally = $aryA[0];
|
||||
}
|
||||
}
|
||||
$g++;
|
||||
if ($DBX) {print " $group_id[$p]|$VSCcategory|$VSCtally|$CATstatusesSQL|\n";}
|
||||
$VSCupdateSQL .= "status_category_$g='$VSCcategory',status_category_count_$g='$VSCtally',";
|
||||
$debug_ingroup_output .= " $group_id[$p]|$VSCcategory|$VSCtally|$CATstatusesSQL|";
|
||||
}
|
||||
while ($g < 4)
|
||||
{
|
||||
@@ -1535,7 +1573,7 @@ sub calculate_drops_inbound
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$vcs_exists = "$aryA[0]";
|
||||
$vcs_exists = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
@@ -1552,12 +1590,18 @@ sub calculate_drops_inbound
|
||||
|
||||
print "$p IN-GROUP: $group_id[$p] CALLS: $iVCScalls_today[$p] ANSWER: $iVCSanswers_today[$p] DROPS: $iVCSdrops_today[$p]\n";
|
||||
print " Stat1: $answer_sec_pct_rt_stat_one_PCT[$p] Stat2: $answer_sec_pct_rt_stat_two_PCT[$p] Hold: $hold_sec_queue_calls[$p]|$hold_sec_answer_calls[$p]|$hold_sec_drop_calls[$p]\n";
|
||||
$debug_ingroup_output .= "$p IN-GROUP: $group_id[$p] CALLS: $iVCScalls_today[$p] ANSWER: $iVCSanswers_today[$p] DROPS: $iVCSdrops_today[$p]\n";
|
||||
$debug_ingroup_output .= " Stat1: $answer_sec_pct_rt_stat_one_PCT[$p] Stat2: $answer_sec_pct_rt_stat_two_PCT[$p] Hold: $hold_sec_queue_calls[$p]|$hold_sec_answer_calls[$p]|$hold_sec_drop_calls[$p]\n";
|
||||
|
||||
$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);
|
||||
}
|
||||
##### END calculate_drops_inbound
|
||||
|
||||
|
||||
|
||||
|
||||
##### BEGIN calculate the proper dial level #####
|
||||
sub calculate_dial_level
|
||||
{
|
||||
$RESETdiff_ratio_updater++;
|
||||
@@ -1569,6 +1613,9 @@ sub calculate_dial_level
|
||||
$VCSagents_calc[$i]=0;
|
||||
$VCSagents_active[$i]=0;
|
||||
|
||||
$adaptive_string = "\n";
|
||||
$adaptive_string .= "CAMPAIGN: $campaign_id[$i] $i\n";
|
||||
|
||||
# COUNTS OF STATUSES OF AGENTS IN THIS CAMPAIGN
|
||||
$stmtA = "SELECT count(*),status from vicidial_live_agents where campaign_id='$campaign_id[$i]' and last_update_time > '$VDL_one' group by status;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
@@ -1578,8 +1625,8 @@ sub calculate_dial_level
|
||||
while ($sthArows > $rec_count)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$VCSagent_count[$i] = "$aryA[0]";
|
||||
$VCSagent_status[$i] = "$aryA[1]";
|
||||
$VCSagent_count[$i] = $aryA[0];
|
||||
$VCSagent_status[$i] = $aryA[1];
|
||||
$rec_count++;
|
||||
if ($VCSagent_status[$i] =~ /INCALL|QUEUE/) {$VCSINCALL[$i] = ($VCSINCALL[$i] + $VCSagent_count[$i]);}
|
||||
if ($VCSagent_status[$i] =~ /READY/) {$VCSREADY[$i] = ($VCSREADY[$i] + $VCSagent_count[$i]);}
|
||||
@@ -1592,9 +1639,28 @@ sub calculate_dial_level
|
||||
if ($available_only_ratio_tally[$i] =~ /Y/)
|
||||
{$VCSagents_calc[$i] = $VCSREADY[$i];}
|
||||
else
|
||||
{$VCSagents_calc[$i] = ($VCSINCALL[$i] + $VCSREADY[$i]);}
|
||||
{
|
||||
$VCSagents_calc[$i] = ($VCSINCALL[$i] + $VCSREADY[$i]);
|
||||
if ( ($available_only_tally_threshold[$i] =~ /LOGGED-IN_AGENTS/) && ($available_only_tally_threshold_agents[$i] > $VCSagents[$i]) )
|
||||
{
|
||||
$adaptive_string .= " !! AVAILABLE ONLY TALLY THRESHOLD triggered for LOGGED-IN_AGENTS: ($available_only_tally_threshold_agents[$i] > $VCSagents[$i])\n";
|
||||
$VCSagents_calc[$i] = $VCSREADY[$i];
|
||||
$available_only_ratio_tally[$i] = 'Y*';
|
||||
}
|
||||
if ( ($available_only_tally_threshold[$i] =~ /NON-PAUSED_AGENTS/) && ($available_only_tally_threshold_agents[$i] > $VCSagents_calc[$i]) )
|
||||
{
|
||||
$adaptive_string .= " !! AVAILABLE ONLY TALLY THRESHOLD triggered for NON-PAUSED_AGENTS: ($available_only_tally_threshold_agents[$i] > $VCSagents_calc[$i])\n";
|
||||
$VCSagents_calc[$i] = $VCSREADY[$i];
|
||||
$available_only_ratio_tally[$i] = 'Y*';
|
||||
}
|
||||
if ( ($available_only_tally_threshold[$i] =~ /WAITING_AGENTS/) && ($available_only_tally_threshold_agents[$i] > $VCSREADY[$i]) )
|
||||
{
|
||||
$adaptive_string .= " !! AVAILABLE ONLY TALLY THRESHOLD triggered for WAITING_AGENTS: ($available_only_tally_threshold_agents[$i] > $VCSREADY[$i])\n";
|
||||
$VCSagents_calc[$i] = $VCSREADY[$i];
|
||||
$available_only_ratio_tally[$i] = 'Y*';
|
||||
}
|
||||
}
|
||||
$VCSagents_active[$i] = ($VCSINCALL[$i] + $VCSREADY[$i] + $VCSCLOSER[$i]);
|
||||
|
||||
### END - GATHER STATS FOR THE vicidial_campaign_stats TABLE ###
|
||||
|
||||
if ($campaign_allow_inbound[$i] =~ /Y/)
|
||||
@@ -1608,8 +1674,8 @@ sub calculate_dial_level
|
||||
while ($sthArows > $rec_count)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$differential_onemin[$i] = "$aryA[0]";
|
||||
$agents_average_onemin[$i] = "$aryA[1]";
|
||||
$differential_onemin[$i] = $aryA[0];
|
||||
$agents_average_onemin[$i] = $aryA[1];
|
||||
$rec_count++;
|
||||
}
|
||||
$sthA->finish();
|
||||
@@ -1665,8 +1731,6 @@ sub calculate_dial_level
|
||||
else
|
||||
{$tapered_rate[$i] = ($tapered_hours_left[$i] / 1000);}
|
||||
|
||||
$adaptive_string = "\n";
|
||||
$adaptive_string .= "CAMPAIGN: $campaign_id[$i] $i\n";
|
||||
$adaptive_string .= "SETTINGS-\n";
|
||||
$adaptive_string .= " DIAL LEVEL: $auto_dial_level[$i]\n";
|
||||
$adaptive_string .= " DIAL METHOD: $dial_method[$i]\n";
|
||||
@@ -1737,6 +1801,26 @@ sub calculate_dial_level
|
||||
}
|
||||
}
|
||||
|
||||
### BEGIN Dial Level Threshold Check ###
|
||||
$VCSagents_nonpaused_temp = ($VCSINCALL[$i] + $VCSREADY[$i]);
|
||||
if ( ($dial_level_threshold[$i] =~ /LOGGED-IN_AGENTS/) && ($dial_level_threshold_agents[$i] > $VCSagents[$i]) )
|
||||
{
|
||||
$adaptive_string .= " !! DIAL LEVEL THRESHOLD triggered for LOGGED-IN_AGENTS: ($dial_level_threshold_agents[$i] > $VCSagents[$i])\n";
|
||||
$intensity_dial_level[$i] = "1.0";
|
||||
}
|
||||
if ( ($dial_level_threshold[$i] =~ /NON-PAUSED_AGENTS/) && ($dial_level_threshold_agents[$i] > $VCSagents_nonpaused_temp) )
|
||||
{
|
||||
$adaptive_string .= " !! DIAL LEVEL THRESHOLD triggered for NON-PAUSED_AGENTS: ($dial_level_threshold_agents[$i] > $VCSagents_nonpaused_temp)\n";
|
||||
$intensity_dial_level[$i] = "1.0";
|
||||
}
|
||||
if ( ($dial_level_threshold[$i] =~ /WAITING_AGENTS/) && ($dial_level_threshold_agents[$i] > $VCSREADY[$i]) )
|
||||
{
|
||||
$adaptive_string .= " !! DIAL LEVEL THRESHOLD triggered for WAITING_AGENTS: ($dial_level_threshold_agents[$i] > $VCSREADY[$i])\n";
|
||||
$intensity_dial_level[$i] = "1.0";
|
||||
}
|
||||
### END Dial Level Threshold Check ###
|
||||
|
||||
|
||||
### ALWAYS RAISE DIAL_LEVEL TO 1.0 IF IT IS LOWER ###
|
||||
if ($intensity_dial_level[$i] < 1)
|
||||
{
|
||||
@@ -1757,3 +1841,5 @@ sub calculate_dial_level
|
||||
|
||||
&adaptive_logger;
|
||||
}
|
||||
##### END calculate the proper dial level #####
|
||||
|
||||
|
||||
@@ -99,6 +99,7 @@
|
||||
# 110224-1408 - Fixed trunk reservation bug
|
||||
# 110224-1859 - Added compatibility with QM phone environment logging
|
||||
# 110303-1710 - Added clearing of ring_callerid when vicidial_auto_calls deleted
|
||||
# 110513-1745 - Added double-check for dial level difference target, and dial level and avail-only-tally features
|
||||
#
|
||||
|
||||
|
||||
@@ -114,7 +115,12 @@ if (length($ARGV[0])>1)
|
||||
|
||||
if ($args =~ /--help/i)
|
||||
{
|
||||
print "allowed run time options:\n [-t] = test\n [-debug] = verbose debug messages\n [--delay=XXX] = delay of XXX seconds per loop, default 2.5 seconds\n\n";
|
||||
print "allowed run time options:\n";
|
||||
print " [-t] = test\n";
|
||||
print " [-debug] = verbose debug messages\n";
|
||||
print " [--delay=XXX] = delay of XXX seconds per loop, default 2.5 seconds\n";
|
||||
print "\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -330,6 +336,12 @@ while($one_day_interval > 0)
|
||||
@DBIPdial_method=@MT;
|
||||
@DBIPuse_custom_cid=@MT;
|
||||
@DBIPinbound_queue_no_dial=@MT;
|
||||
@DBIPavailable_only_tally=@MT;
|
||||
@DBIPavailable_only_tally_threshold=@MT;
|
||||
@DBIPavailable_only_tally_threshold_agents=@MT;
|
||||
@DBIPdial_level_threshold=@MT;
|
||||
@DBIPdial_level_threshold_agents=@MT;
|
||||
@DBIPadaptive_dl_diff_target=@MT;
|
||||
|
||||
$active_line_counter=0;
|
||||
$user_counter=0;
|
||||
@@ -439,6 +451,8 @@ while($one_day_interval > 0)
|
||||
$user_CIPct = 0;
|
||||
foreach(@DBIPcampaign)
|
||||
{
|
||||
|
||||
$debug_string='';
|
||||
$user_counter=0;
|
||||
foreach(@DBlive_campaign)
|
||||
{
|
||||
@@ -510,6 +524,7 @@ while($one_day_interval > 0)
|
||||
$DBIPold_trunk_shortage[$user_CIPct]=0;
|
||||
|
||||
$event_string="VCSS ENTRY INSERTED: $affected_rows";
|
||||
$debug_string .= "$event_string\n";
|
||||
&event_logger;
|
||||
}
|
||||
|
||||
@@ -545,7 +560,7 @@ while($one_day_interval > 0)
|
||||
|
||||
### grab the dial_level and multiply by active agents to get your goalcalls
|
||||
$DBIPadlevel[$user_CIPct]=0;
|
||||
$stmtA = "SELECT auto_dial_level,local_call_time,dial_timeout,dial_prefix,campaign_cid,active,campaign_vdad_exten,closer_campaigns,omit_phone_code,available_only_ratio_tally,auto_alt_dial,campaign_allow_inbound,queue_priority,dial_method,use_custom_cid,inbound_queue_no_dial FROM vicidial_campaigns where campaign_id='$DBIPcampaign[$user_CIPct]'";
|
||||
$stmtA = "SELECT auto_dial_level,local_call_time,dial_timeout,dial_prefix,campaign_cid,active,campaign_vdad_exten,closer_campaigns,omit_phone_code,available_only_ratio_tally,auto_alt_dial,campaign_allow_inbound,queue_priority,dial_method,use_custom_cid,inbound_queue_no_dial,available_only_tally_threshold,available_only_tally_threshold_agents,dial_level_threshold,dial_level_threshold_agents,adaptive_dl_diff_target FROM vicidial_campaigns where campaign_id='$DBIPcampaign[$user_CIPct]'";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
@@ -565,29 +580,78 @@ while($one_day_interval > 0)
|
||||
$omit_phone_code = $aryA[8];
|
||||
if ($omit_phone_code =~ /Y/) {$DBIPomitcode[$user_CIPct] = 1;}
|
||||
else {$DBIPomitcode[$user_CIPct] = 0;}
|
||||
$available_only_ratio_tally = $aryA[9];
|
||||
if ($available_only_ratio_tally =~ /Y/)
|
||||
$DBIPavailable_only_tally[$user_CIPct] = $aryA[9];
|
||||
$DBIPautoaltdial[$user_CIPct] = $aryA[10];
|
||||
$DBIPcampaign_allow_inbound[$user_CIPct] = $aryA[11];
|
||||
$DBIPqueue_priority[$user_CIPct] = $aryA[12];
|
||||
$DBIPdial_method[$user_CIPct] = $aryA[13];
|
||||
$DBIPuse_custom_cid[$user_CIPct] = $aryA[14];
|
||||
$DBIPinbound_queue_no_dial[$user_CIPct] = $aryA[15];
|
||||
$DBIPavailable_only_tally_threshold[$user_CIPct] = $aryA[16];
|
||||
$DBIPavailable_only_tally_threshold_agents[$user_CIPct] = $aryA[17];
|
||||
$DBIPdial_level_threshold[$user_CIPct] = $aryA[18];
|
||||
$DBIPdial_level_threshold_agents[$user_CIPct] = $aryA[19];
|
||||
$DBIPadaptive_dl_diff_target[$user_CIPct] = $aryA[20];
|
||||
if ($DBIPavailable_only_tally[$user_CIPct] =~ /Y/)
|
||||
{
|
||||
$DBIPcount[$user_CIPct] = $DBIPACTIVEcount[$user_CIPct];
|
||||
$active_only=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$DBIPcount[$user_CIPct] = ($DBIPcount[$user_CIPct] - $DBIPDEADcount[$user_CIPct]);
|
||||
### Check for available only tally threshold ###
|
||||
if ( ($DBIPavailable_only_tally_threshold[$user_CIPct] =~ /LOGGED-IN_AGENTS/) && ($DBIPavailable_only_tally_threshold_agents[$user_CIPct] > $user_counter) )
|
||||
{
|
||||
$debug_string .= " !! AVAILABLE ONLY TALLY THRESHOLD triggered for LOGGED-IN_AGENTS: ($DBIPavailable_only_tally_threshold_agents[$user_CIPct] > $user_counter)\n";
|
||||
$active_only=1;
|
||||
}
|
||||
if ( ($DBIPavailable_only_tally_threshold[$user_CIPct] =~ /NON-PAUSED_AGENTS/) && ($DBIPavailable_only_tally_threshold_agents[$user_CIPct] > $DBIPcount[$user_CIPct]) )
|
||||
{
|
||||
$debug_string .= " !! AVAILABLE ONLY TALLY THRESHOLD triggered for NON-PAUSED_AGENTS: ($DBIPavailable_only_tally_threshold_agents[$user_CIPct] > $DBIPcount[$user_CIPct])\n";
|
||||
$active_only=1;
|
||||
}
|
||||
if ( ($DBIPavailable_only_tally_threshold[$user_CIPct] =~ /WAITING_AGENTS/) && ($DBIPavailable_only_tally_threshold_agents[$user_CIPct] > $DBIPACTIVEcount[$user_CIPct]) )
|
||||
{
|
||||
$debug_string .= " !! AVAILABLE ONLY TALLY THRESHOLD triggered for WAITING_AGENTS: ($DBIPavailable_only_tally_threshold_agents[$user_CIPct] > $DBIPACTIVEcount[$user_CIPct])\n";
|
||||
$active_only=1;
|
||||
}
|
||||
|
||||
if ($active_only > 0)
|
||||
{$DBIPcount[$user_CIPct] = $DBIPACTIVEcount[$user_CIPct];}
|
||||
else
|
||||
{$DBIPcount[$user_CIPct] = ($DBIPcount[$user_CIPct] - $DBIPDEADcount[$user_CIPct]);}
|
||||
|
||||
if ($DBIPcount[$user_CIPct] < 0)
|
||||
{$DBIPcount[$user_CIPct]=0;}
|
||||
}
|
||||
$DBIPautoaltdial[$user_CIPct] = $aryA[10];
|
||||
$DBIPcampaign_allow_inbound[$user_CIPct] = $aryA[11];
|
||||
$DBIPqueue_priority[$user_CIPct] = $aryA[12];
|
||||
$DBIPdial_method[$user_CIPct] = $aryA[13];
|
||||
$DBIPuse_custom_cid[$user_CIPct] = $aryA[14];
|
||||
$DBIPinbound_queue_no_dial[$user_CIPct] = $aryA[15];
|
||||
|
||||
$rec_count++;
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
### Check for dial level threshold ###
|
||||
$nonpause_agents_temp = ($DBIPACTIVEcount[$user_CIPct] + $DBIPINCALLcount[$user_CIPct]);
|
||||
if ( ($DBIPdial_level_threshold[$user_CIPct] =~ /LOGGED-IN_AGENTS/) && ($DBIPdial_level_threshold_agents[$user_CIPct] > $user_counter) )
|
||||
{
|
||||
$debug_string .= " !! DIAL LEVEL THRESHOLD triggered for LOGGED-IN_AGENTS: ($DBIPdial_level_threshold_agents[$user_CIPct] > $user_counter)\n";
|
||||
$DBIPadlevel[$user_CIPct]=1;
|
||||
}
|
||||
if ( ($DBIPdial_level_threshold[$user_CIPct] =~ /NON-PAUSED_AGENTS/) && ($DBIPdial_level_threshold_agents[$user_CIPct] > $nonpause_agents_temp) )
|
||||
{
|
||||
$debug_string .= " !! DIAL LEVEL THRESHOLD triggered for NON-PAUSED_AGENTS: ($DBIPdial_level_threshold_agents[$user_CIPct] > $nonpause_agents_temp)\n";
|
||||
$DBIPadlevel[$user_CIPct]=1;
|
||||
}
|
||||
if ( ($DBIPdial_level_threshold[$user_CIPct] =~ /WAITING_AGENTS/) && ($DBIPdial_level_threshold_agents[$user_CIPct] > $DBIPACTIVEcount[$user_CIPct]) )
|
||||
{
|
||||
$debug_string .= " !! DIAL LEVEL THRESHOLD triggered for WAITING_AGENTS: ($DBIPdial_level_threshold_agents[$user_CIPct] > $DBIPACTIVEcount[$user_CIPct])\n";
|
||||
$DBIPadlevel[$user_CIPct]=1;
|
||||
}
|
||||
|
||||
### apply dial level difference target ###
|
||||
$DBIPcount[$user_CIPct] = ($DBIPcount[$user_CIPct] + $DBIPadaptive_dl_diff_target[$user_CIPct]);
|
||||
if ($DBIPcount[$user_CIPct] < 0)
|
||||
{$DBIPcount[$user_CIPct]=0;}
|
||||
|
||||
$DBIPgoalcalls[$user_CIPct] = ($DBIPadlevel[$user_CIPct] * $DBIPcount[$user_CIPct]);
|
||||
if ($active_only > 0)
|
||||
{
|
||||
@@ -609,7 +673,8 @@ while($one_day_interval > 0)
|
||||
if ($DBIPactive[$user_CIPct] =~ /N/) {$DBIPgoalcalls[$user_CIPct] = 0;}
|
||||
$DBIPgoalcalls[$user_CIPct] = sprintf("%.0f", $DBIPgoalcalls[$user_CIPct]);
|
||||
|
||||
$event_string="$DBIPcampaign[$user_CIPct] $DBIPaddress[$user_CIPct]: agents: $DBIPcount[$user_CIPct] (READY: $DBIPcampaign_ready_agents[$user_CIPct]) dial_level: $DBIPadlevel[$user_CIPct] ($DBIPACTIVEcount[$user_CIPct]|$DBIPINCALLcount[$user_CIPct]|$DBIPDEADcount[$user_CIPct])";
|
||||
$event_string="$DBIPcampaign[$user_CIPct] $DBIPaddress[$user_CIPct]: agents: $DBIPcount[$user_CIPct] (READY: $DBIPcampaign_ready_agents[$user_CIPct]) dial_level: $DBIPadlevel[$user_CIPct] ($DBIPACTIVEcount[$user_CIPct]|$DBIPINCALLcount[$user_CIPct]|$DBIPDEADcount[$user_CIPct]) $DBIPadaptive_dl_diff_target[$user_CIPct]";
|
||||
$debug_string .= "$event_string\n";
|
||||
&event_logger;
|
||||
|
||||
|
||||
@@ -680,6 +745,7 @@ while($one_day_interval > 0)
|
||||
if ( ($DBIPcampaign_ready_agents[$user_CIPct] > 0) && ($DBIPexistcalls_IN[$user_CIPct] > 0) )
|
||||
{
|
||||
$event_string=" BLENDED-OUTBOUND-AGENTS-WAITING OVERRIDE: $DBIPcampaign[$user_CIPct] $DBIPexistcalls[$user_CIPct] [$DBIPexistcalls_IN[$user_CIPct] + $DBIPexistcalls_OUT[$user_CIPct]])";
|
||||
$debug_string .= "$event_string\n";
|
||||
&event_logger;
|
||||
|
||||
$DBIPexistcalls[$user_CIPct] = $DBIPexistcalls_OUT[$user_CIPct];
|
||||
@@ -732,6 +798,7 @@ while($one_day_interval > 0)
|
||||
{$active_line_counter = ($DBIPmakecalls[$user_CIPct] + $active_line_counter);}
|
||||
|
||||
$event_string="$DBIPcampaign[$user_CIPct] $DBIPaddress[$user_CIPct]: Calls to place: $DBIPmakecalls[$user_CIPct] ($DBIPgoalcalls[$user_CIPct] - $DBIPexistcalls[$user_CIPct] [$DBIPexistcalls_IN[$user_CIPct] + $DBIPexistcalls_OUT[$user_CIPct]|$DBIPexistcalls_IN_ALL[$user_CIPct]|$DBIPexistcalls_IN_LIVE[$user_CIPct]]) $active_line_counter $MVT_msg";
|
||||
$debug_string .= "$event_string\n";
|
||||
&event_logger;
|
||||
|
||||
### Calculate campaign-wide agent waiting and calls waiting differential
|
||||
@@ -831,6 +898,7 @@ while($one_day_interval > 0)
|
||||
$stat_differential = ($ready_diff_avg - $waiting_diff_avg);
|
||||
|
||||
$event_string="CAMPAIGN DIFFERENTIAL: $total_agents_avg $stat_differential ($ready_diff_avg - $waiting_diff_avg)";
|
||||
$debug_string .= "$event_string\n";
|
||||
&event_logger;
|
||||
|
||||
$stmtA = "UPDATE vicidial_campaign_stats SET differential_onemin='$stat_differential', agents_average_onemin='$total_agents_avg' where campaign_id='$DBIPcampaign[$user_CIPct]';";
|
||||
@@ -842,6 +910,7 @@ while($one_day_interval > 0)
|
||||
{
|
||||
$event_string="Manual Dial Override for Shortage |$DBIPadlevel[$user_CIPct]|$DBIPtrunk_shortage[$user_CIPct]|";
|
||||
&event_logger;
|
||||
$debug_string .= "$event_string\n";
|
||||
$DBIPtrunk_shortage[$user_CIPct] = 0;
|
||||
}
|
||||
$stmtA = "UPDATE vicidial_campaign_server_stats SET local_trunk_shortage='$DBIPtrunk_shortage[$user_CIPct]',update_time='$now_date' where server_ip='$server_ip' and campaign_id='$DBIPcampaign[$user_CIPct]';";
|
||||
@@ -849,8 +918,12 @@ while($one_day_interval > 0)
|
||||
}
|
||||
|
||||
$event_string="LOCAL TRUNK SHORTAGE: $DBIPtrunk_shortage[$user_CIPct]|$DBIPold_trunk_shortage[$user_CIPct] ($active_line_goal - $max_vicidial_trunks)";
|
||||
$debug_string .= "$event_string\n";
|
||||
&event_logger;
|
||||
|
||||
$stmtA="INSERT IGNORE INTO vicidial_campaign_stats_debug SET server_ip='$server_ip',campaign_id='$DBIPcampaign[$user_CIPct]',entry_time='$now_date',debug_output='$debug_string' ON DUPLICATE KEY UPDATE entry_time='$now_date',debug_output='$debug_string';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
|
||||
$user_CIPct++;
|
||||
}
|
||||
|
||||
|
||||
@@ -801,7 +801,11 @@ auto_pause_precall_code VARCHAR(6) default 'PRECAL',
|
||||
auto_resume_precall ENUM('Y','N') default 'N',
|
||||
manual_dial_cid ENUM('CAMPAIGN','AGENT_PHONE') default 'CAMPAIGN',
|
||||
post_phone_time_diff_alert VARCHAR(30) default 'DISABLED',
|
||||
custom_3way_button_transfer VARCHAR(30) default 'DISABLED'
|
||||
custom_3way_button_transfer VARCHAR(30) default 'DISABLED',
|
||||
available_only_tally_threshold ENUM('DISABLED','LOGGED-IN_AGENTS','NON-PAUSED_AGENTS','WAITING_AGENTS') default 'DISABLED',
|
||||
available_only_tally_threshold_agents SMALLINT(5) UNSIGNED default '0',
|
||||
dial_level_threshold ENUM('DISABLED','LOGGED-IN_AGENTS','NON-PAUSED_AGENTS','WAITING_AGENTS') default 'DISABLED',
|
||||
dial_level_threshold_agents SMALLINT(5) UNSIGNED default '0'
|
||||
);
|
||||
|
||||
CREATE TABLE vicidial_lists (
|
||||
@@ -823,7 +827,8 @@ xferconf_c_number VARCHAR(50) default '',
|
||||
xferconf_d_number VARCHAR(50) default '',
|
||||
xferconf_e_number VARCHAR(50) default '',
|
||||
web_form_address TEXT,
|
||||
web_form_address_two TEXT
|
||||
web_form_address_two TEXT,
|
||||
time_zone_setting ENUM('COUNTRY_AND_AREA_CODE','POSTAL_CODE','NANPA_PREFIX','OWNER_TIME_ZONE_CODE') default 'COUNTRY_AND_AREA_CODE'
|
||||
);
|
||||
|
||||
CREATE TABLE vicidial_statuses (
|
||||
@@ -2309,6 +2314,17 @@ index (user),
|
||||
index (event_date)
|
||||
);
|
||||
|
||||
CREATE TABLE vicidial_campaign_stats_debug (
|
||||
campaign_id VARCHAR(20) NOT NULL,
|
||||
server_ip VARCHAR(15) NOT NULL,
|
||||
entry_time DATETIME,
|
||||
update_time TIMESTAMP,
|
||||
debug_output TEXT,
|
||||
adapt_output TEXT,
|
||||
index (campaign_id),
|
||||
unique index campserver (campaign_id, server_ip)
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE vicidial_campaign_server_stats ENGINE=MEMORY;
|
||||
|
||||
@@ -2461,7 +2477,7 @@ ALTER TABLE vicidial_lead_search_log_archive MODIFY search_log_id INT(9) UNSIGNE
|
||||
CREATE TABLE vicidial_closer_log_archive LIKE vicidial_closer_log;
|
||||
ALTER TABLE vicidial_closer_log_archive MODIFY closecallid INT(9) UNSIGNED NOT NULL;
|
||||
|
||||
UPDATE system_settings SET db_schema_version='1274',db_schema_update_date=NOW();
|
||||
UPDATE system_settings SET db_schema_version='1275',db_schema_update_date=NOW();
|
||||
|
||||
GRANT RELOAD ON *.* TO cron@'%';
|
||||
GRANT RELOAD ON *.* TO cron@localhost;
|
||||
|
||||
@@ -756,3 +756,23 @@ UPDATE system_settings SET db_schema_version='1273',db_schema_update_date=NOW();
|
||||
ALTER TABLE vicidial_campaigns ADD custom_3way_button_transfer VARCHAR(30) default 'DISABLED';
|
||||
|
||||
UPDATE system_settings SET db_schema_version='1274',db_schema_update_date=NOW();
|
||||
|
||||
ALTER TABLE vicidial_campaigns ADD available_only_tally_threshold ENUM('DISABLED','LOGGED-IN_AGENTS','NON-PAUSED_AGENTS','WAITING_AGENTS') default 'DISABLED';
|
||||
ALTER TABLE vicidial_campaigns ADD available_only_tally_threshold_agents SMALLINT(5) UNSIGNED default '0';
|
||||
ALTER TABLE vicidial_campaigns ADD dial_level_threshold ENUM('DISABLED','LOGGED-IN_AGENTS','NON-PAUSED_AGENTS','WAITING_AGENTS') default 'DISABLED';
|
||||
ALTER TABLE vicidial_campaigns ADD dial_level_threshold_agents SMALLINT(5) UNSIGNED default '0';
|
||||
|
||||
ALTER TABLE vicidial_lists ADD time_zone_setting ENUM('COUNTRY_AND_AREA_CODE','POSTAL_CODE','NANPA_PREFIX','OWNER_TIME_ZONE_CODE') default 'COUNTRY_AND_AREA_CODE';
|
||||
|
||||
CREATE TABLE vicidial_campaign_stats_debug (
|
||||
campaign_id VARCHAR(20) NOT NULL,
|
||||
server_ip VARCHAR(15) NOT NULL,
|
||||
entry_time DATETIME,
|
||||
update_time TIMESTAMP,
|
||||
debug_output TEXT,
|
||||
adapt_output TEXT,
|
||||
index (campaign_id),
|
||||
unique index campserver (campaign_id, server_ip)
|
||||
);
|
||||
|
||||
UPDATE system_settings SET db_schema_version='1275',db_schema_update_date=NOW();
|
||||
|
||||
@@ -566,6 +566,21 @@ Phone Post Time Difference Alert||
|
||||
This manual-dial-only feature, if enabled, will display an alert if the time zone for the lead postal code, or zip code, is different from the time zone of the area code of the phone number for the lead. The OUTSIDE_CALLTIME_ONLY option will only show the alert if the two time zones are different and one of the time zones is outside of the call time selected for the campaign. OUTSIDE_CALLTIME_PHONE will only check the time zone of the phone number of the lead and alert if it is outside of the local call time. OUTSIDE_CALLTIME_POSTAL will only check the time zone of the postal code of the lead and alert if it is outside of the local call time. OUTSIDE_CALLTIME_BOTH will check the postal code and phone number for being within the local call time, even if they are in the same time zone. These alerts will show in the call log info, callbacks list info, search results info, when a lead is dialed and when a lead is previewed. Default is DISABLED||
|
||||
Custom 3-Way Button Transfer||
|
||||
This option will add a Custom Transfer button to the agent screen below the Transfer-Conf button that will allow one click three way calls using the selected preset or field. The PRESET_ options will place calls using the defined preset value. The FIELD_ options will place calls using the number in the selected field from the lead. DISABLED will not show the button on the agent screen. The PARK_ options will park the customer before dialing. Default is DISABLED||
|
||||
Auto Dial Level Threshold||
|
||||
This setting only works with an ADAPT or RATIO Dial Method, and it must be set to something other than DISABLED and the number of agents setting must be above 0. This feature allows you to set a minimum number agents that predictive algorithm will work at. If the number of agents falls below the number that you have set, then the dial level will go to 1.0 until more agents log in or go into the selected state. LOGGED-IN_AGENTS will count all agents logged into the campaign, NON-PAUSED_AGENTS will only count agents that are waiting or talking, and WAITING_AGENTS will only count agents that are waiting for a call. Default is DISABLED||
|
||||
Available Only Tally Threshold||
|
||||
This setting only works with an ADAPT or RATIO Dial Method, Available Only Tally must be set to N, this setting must be set to something other than DISABLED and the number of agents setting must be above 0. This feature allows you to set the number of agents below which Available Only Tally will be enabled. If the number of agents falls below the number that you have set, then the dial level will go to 1.0 until more agents log in or go into the selected state. LOGGED-IN_AGENTS will count all agents logged into the campaign, NON-PAUSED_AGENTS will only count agents that are waiting or talking, and WAITING_AGENTS will only count agents that are waiting for a call. Default is DISABLED||
|
||||
Time Zone Setting||
|
||||
This option allows you to set the method of maintaining the current time zone lookup for the leads within this list. This process is only done at night so any changes you make will not be immediate. COUNTRY_AND_AREA_CODE is the default, and will use the country code and area code of the phone number to determine the time zone of the lead. POSTAL_CODE will use the postal code if available to determine the time zone of the lead. NANPA_PREFIX works only in the USA and will use the area code and prefix of the phone number to determine the time zone of the lead, but this is not enabled by default in the system, so please be sure you have the NANPA prefix data loaded onto your system before selecting this option. OWNER_TIME_ZONE_CODE will use the standard time zone abbraviation loaded into the owner field of the lead to determine the time zone, in the USA examples are AST, EST, CST, MST, PST, AKST, HST. This feature must be enabled by your system administrator to go into effect||
|
||||
Dial Level Difference Target||
|
||||
This field is used to define whether you want to target having a specific number of agents waiting for calls or calls waiting for agents. For example if you would always like to have on average one agent free to take calls immediately you would set this to -1, if you would like to target always having one call on hold waiting for an agent you would set this to 1. Default is 0. This field is not used by the MANUAL or INBOUND_MAN dial methods||
|
||||
Admin Utilities||
|
||||
hidden utilities page - If you do not know what these utilities do, you probably should not use them||
|
||||
Welcome Languages Page||
|
||||
Campaign Debug Page||
|
||||
Bulk Phone Insert Page||
|
||||
Send a Call With Custom CID Page||
|
||||
Speech Voice Lab Page||
|
||||
|
||||
|
||||
admin_campaign_multi_alt.php
|
||||
@@ -573,6 +588,7 @@ AST_LISTS_campaign_stats.php
|
||||
AST_VICIDIAL_ingrouplist.php
|
||||
admin_lists_custom.php
|
||||
admin_phones_bulk_insert.php
|
||||
campaign_debug.php
|
||||
############################################################ CLIENT
|
||||
VIEW CALL LOG||
|
||||
click to dial||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,191 @@
|
||||
<?php
|
||||
# campaign_debug.php
|
||||
#
|
||||
# Copyright (C) 2011 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGES
|
||||
# 110514-1231 - First build
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
|
||||
$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
|
||||
$PHP_SELF=$_SERVER['PHP_SELF'];
|
||||
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
|
||||
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
|
||||
if (isset($_GET["group"])) {$group=$_GET["group"];}
|
||||
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
|
||||
if (isset($_GET["submit"])) {$submit=$_GET["submit"];}
|
||||
elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];}
|
||||
if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];}
|
||||
elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];}
|
||||
|
||||
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
|
||||
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and view_reports='1' and modify_campaigns='1';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
|
||||
{
|
||||
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
|
||||
Header("HTTP/1.0 401 Unauthorized");
|
||||
echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
$STARTtime = date("U");
|
||||
if (!isset($group)) {$group = '';}
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
if (!isset($server_ip)) {$server_ip = '10.10.10.15';}
|
||||
|
||||
$stmt="select campaign_id,campaign_name from vicidial_campaigns order by campaign_id;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$campaigns_to_print = mysql_num_rows($rslt);
|
||||
$i=0;
|
||||
while ($i < $campaigns_to_print)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$campaign_id[$i] =$row[0];
|
||||
$campaign_name[$i] =$row[1];
|
||||
$i++;
|
||||
}
|
||||
?>
|
||||
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<STYLE type="text/css">
|
||||
<!--
|
||||
.green {color: white; background-color: green}
|
||||
.red {color: white; background-color: red}
|
||||
.blue {color: white; background-color: blue}
|
||||
.purple {color: white; background-color: purple}
|
||||
-->
|
||||
</STYLE>
|
||||
|
||||
<?php
|
||||
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo "<TITLE>Campaign Debug</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
|
||||
$short_header=1;
|
||||
|
||||
require("admin_header.php");
|
||||
|
||||
echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
|
||||
echo "<FORM ACTION=\"$PHP_SELF\" METHOD=GET>\n";
|
||||
echo "<SELECT SIZE=1 NAME=group>\n";
|
||||
$o=0;
|
||||
while ($campaigns_to_print > $o)
|
||||
{
|
||||
if ($campaign_id[$o] == $group) {echo "<option selected value=\"$campaign_id[$o]\">$campaign_id[$o] - $campaign_name[$o]</option>\n";}
|
||||
else {echo "<option value=\"$campaign_id[$o]\">$campaign_id[$o] - $campaign_name[$o]</option>\n";}
|
||||
$o++;
|
||||
}
|
||||
echo "</SELECT>\n";
|
||||
echo "<INPUT TYPE=SUBMIT NAME=SUBMIT VALUE=SUBMIT>\n";
|
||||
echo " <a href=\"./admin.php?ADD=34&campaign_id=$group\">MODIFY</a> \n";
|
||||
echo "</FORM>\n\n";
|
||||
|
||||
echo "<PRE><FONT SIZE=2>\n\n";
|
||||
|
||||
|
||||
if (!$group)
|
||||
{
|
||||
echo "\n\n";
|
||||
echo "PLEASE SELECT A CAMPAIGN ABOVE AND CLICK SUBMIT\n";
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
|
||||
$stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$TOTALcalls = sprintf("%10s", $row[0]);
|
||||
|
||||
echo "\n";
|
||||
echo "---------- ADAPT DEBUG\n";
|
||||
echo "\n";
|
||||
|
||||
$stmt="select campaign_name,closer_campaigns from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "' limit 1;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$camps_to_print = mysql_num_rows($rslt);
|
||||
if ($camps_to_print > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$closer_campaigns = $row[1];
|
||||
|
||||
echo "Campaign Debug: $group - $row[0] $NOW_TIME\n\n";
|
||||
echo "Total leads in hopper right now: $TOTALcalls\n\n";
|
||||
}
|
||||
|
||||
$stmt="select update_time,debug_output,adapt_output from vicidial_campaign_stats_debug where campaign_id='" . mysql_real_escape_string($group) . "' and server_ip='ADAPT' limit 1;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$debugs_to_print = mysql_num_rows($rslt);
|
||||
$i=0;
|
||||
while ($debugs_to_print > $i)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
|
||||
echo "Adapt Debug: $row[0]\n";
|
||||
echo "$row[1]\n";
|
||||
echo "$row[2]\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$stmt="select update_time,server_ip,debug_output,adapt_output from vicidial_campaign_stats_debug where campaign_id='" . mysql_real_escape_string($group) . "' and server_ip!='ADAPT' order by server_ip limit 100;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$debugs_to_print = mysql_num_rows($rslt);
|
||||
$i=0;
|
||||
while ($debugs_to_print > $i)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
|
||||
echo "$row[1] Debug: $row[0]\n";
|
||||
echo "$row[2]\n";
|
||||
echo "$row[3]\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$closer_groupsSQL = preg_replace("/^ | -$/","",$closer_campaigns);
|
||||
$closer_groupsSQL = preg_replace("/ /","','",$closer_groupsSQL);
|
||||
|
||||
$stmt="select update_time,campaign_id,debug_output,adapt_output from vicidial_campaign_stats_debug where campaign_id IN('$closer_groupsSQL') and server_ip='INBOUND' order by campaign_id limit 10000;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$debugs_to_print = mysql_num_rows($rslt);
|
||||
$i=0;
|
||||
while ($debugs_to_print > $i)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
|
||||
echo "Inbound Debug: $row[1] $row[0]\n";
|
||||
echo "$row[2]\n";
|
||||
echo "$row[3]\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
</PRE>
|
||||
|
||||
</TD></TR></TABLE>
|
||||
|
||||
</BODY></HTML>
|
||||
Reference in New Issue
Block a user