Added on-minute option to cleanup agent log
Added new preprocess filter Added DEAD/PARK status display to user status page git-svn-id: svn://192.168.202.10@1639 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
# 110224-1916 - Added compatibility with QM phone environment logging
|
||||
# 110310-2259 - Added check for PAUSEREASON if no COMPLETE record
|
||||
# 110414-0200 - Added queue_log CONNECT and PAUSEALL/UNPAUSEALL validation and fixing
|
||||
# 110415-1442 - Added one minute run option
|
||||
#
|
||||
|
||||
# constants
|
||||
@@ -56,6 +57,7 @@ if (length($ARGV[0])>1)
|
||||
print " [-more-than-24hours] = will clean up logs older than 24 hours only\n";
|
||||
print " [-last-30days] = will clean up logs for the last 30 days only\n";
|
||||
print " [-one-day-ago] = will clean up logs for the last 24-48 hours ago only\n";
|
||||
print " [-one-minute-run] = short settings for running every minute\n";
|
||||
print " [-skip-queue-log-inserts] = will skip only the queue_log missing record checks\n";
|
||||
print " [-skip-agent-log-validation] = will skip only the vicidial_agent_log validation\n";
|
||||
print " [-only-check-agent-login-lags] = will only fix queue_log missing PAUSEREASON records\n";
|
||||
@@ -123,6 +125,12 @@ if (length($ARGV[0])>1)
|
||||
$THIRTY_DAYS=1;
|
||||
if ($Q < 1) {print "\n----- LAST 30 DAYS ONLY -----\n\n";}
|
||||
}
|
||||
if ($args =~ /-one-minute-run/i)
|
||||
{
|
||||
$VAL_validate=1;
|
||||
$ONE_MINUTE=1;
|
||||
if ($Q < 1) {print "\n----- ONE MINUTE RUN -----\n\n";}
|
||||
}
|
||||
if ($args =~ /-more-than-24hours/i)
|
||||
{
|
||||
$VAL_validate=1;
|
||||
@@ -198,6 +206,24 @@ if ($ALL_TIME > 0)
|
||||
$VDCL_SQL_time = "";
|
||||
$QM_SQL_time = "";
|
||||
}
|
||||
if ($ONE_MINUTE > 0)
|
||||
{
|
||||
$MDtarget = ($secX - 60); # 1 minute in the past
|
||||
($Msec,$Mmin,$Mhour,$Mmday,$Mmon,$Myear,$Mwday,$Myday,$Misdst) = localtime($MDtarget);
|
||||
$Myear = ($Myear + 1900);
|
||||
$Mmon++;
|
||||
if ($Mmon < 10) {$Mmon = "0$Mmon";}
|
||||
if ($Mmday < 10) {$Mmday = "0$Mmday";}
|
||||
if ($Mhour < 10) {$Mhour = "0$Mhour";}
|
||||
if ($Mmin < 10) {$Mmin = "0$Mmin";}
|
||||
if ($Msec < 10) {$Msec = "0$Msec";}
|
||||
$MDSQLdate = "$Myear-$Mmon-$Mmday $Mhour:$Mmin:$Msec";
|
||||
|
||||
$VDAD_SQL_time = "and event_time < \"$MDSQLdate\" and event_time > \"$TDSQLdate\"";
|
||||
$VDCL_SQL_time = "and call_date < \"$MDSQLdate\" and call_date > \"$TDSQLdate\"";
|
||||
$QM_SQL_time = "and time_id < $MDtarget and time_id > $TDtarget";
|
||||
$QM_SQL_time_H = "and time_id < $MDtarget and time_id > $TDtarget";
|
||||
}
|
||||
if ($TWENTYFOUR_HOURS > 0)
|
||||
{
|
||||
$TDtarget = ($secX - 86400); # 24 hours in the past
|
||||
|
||||
@@ -10,14 +10,15 @@
|
||||
#
|
||||
# NOTE: the machine this is run on must have a servers entry in the database
|
||||
#
|
||||
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2011 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
#
|
||||
# CHANGES
|
||||
# 101217-0515 - First build
|
||||
# 110418-0604 - Added dccsv52 format
|
||||
#
|
||||
|
||||
$version = '101217-0515';
|
||||
$version = '110418-0604';
|
||||
|
||||
$secX = time();
|
||||
$MT[0]='';
|
||||
@@ -629,6 +630,189 @@ foreach(@FILES)
|
||||
}
|
||||
|
||||
|
||||
# This is the format for the dccsv52 lead files <multi-lead insert format>
|
||||
#"BFRAME","RECORD_TYPE","LAST_NAME","FIRST_NAME","ADDR1","ADDR2","CITY","STATE","ZIP","ZIP4","ADDR_STATUS","DATE_PLACED","DATE_ADDED","DOB","LAST_LETTER","LAST_LETTER_DATE","LAST_WORKED","NEXT_ACTION_DATE","CAPTURE_CODE","CUR_CATEGORY","TIMES_DIALED","LAST_DIALED","TOTAL_PAID","DATE_LAST_PAID","NMBR_CALLS","NMBR_CONTACTS","NMBR_TIMES_WRKD","NMBR_LETTERS","STATUS_CODE","STATUS_DATE","SCORE","TIMES_TO_SERVICER","1ST-PMT-DEFAULT","TIME_ZONE","ORIG_CREDITOR","BALANCE","HOME_PHONE","WORK_PHONE","OTHER_PHONE","ACCT_OTHTEL2","ACCT_OTHTEL3","ACCT_OTHTEL4","ACCT_OTHTEL5","REF-NAME","REF-AD1","REF-AD2","REF-CITY","REF-ST","REF-POSTAL","REF-TEL1","REF-TEL2","SSN"
|
||||
#"II ACCT/1103566666 ","P","SMITH "," SAMMY","7838 W 109TH ST APT 12 "," ","OVERLAND PARK ","KS","66212","0000","G","20091110","20091110","19661216","NOLTTR","00000000","20091214","20091219","1000","03","000","00000000","000000000.00 ","00000000","0004","0003","0004","000","ACTIVE","20091110","0648","00"," ","C","HSBC ","000000692.09 ","9135551212","0000000000","0000000000","0000000000","0000000000","0000000000","0000000000","","","",""," "," "," "," ","578888888"
|
||||
|
||||
if ( ($format =~ /dccsv52/) && ($format_set < 1) )
|
||||
{
|
||||
$number = $raw_number;
|
||||
chomp($number);
|
||||
$number =~ s/\t/\|/gi;
|
||||
$number =~ s/\'|\t|\r|\n|\l//gi;
|
||||
$number =~ s/\'|\t|\r|\n|\l//gi;
|
||||
$number =~ s/\",,,,,,,\"/\|\|\|\|\|\|\|/gi;
|
||||
$number =~ s/\",,,,,,\"/\|\|\|\|\|\|/gi;
|
||||
$number =~ s/\",,,,,\"/\|\|\|\|\|/gi;
|
||||
$number =~ s/\",,,,\"/\|\|\|\|/gi;
|
||||
$number =~ s/\",,,\"/\|\|\|/gi;
|
||||
$number =~ s/\",,\"/\|\|/gi;
|
||||
$number =~ s/\",\"/\|/gi;
|
||||
$number =~ s/,\"/\|/gi;
|
||||
$number =~ s/\",/\|/gi;
|
||||
$number =~ s/\"//gi;
|
||||
@m = split(/\|/, $number);
|
||||
|
||||
if ($DBX) {print "$a - $number\n";}
|
||||
|
||||
$vendor_lead_code = $m[0]; chomp($vendor_lead_code); $vendor_lead_code =~ s/\s+$//gi;
|
||||
$vendor_lead_code =~s/II ACCT\///gi;
|
||||
$vendor_lead_code =~s/WDRF //gi;
|
||||
while (length($vendor_lead_code) > 10) {chop($vendor_lead_code);}
|
||||
$source_id = $m[0]; chomp($source_id); $source_id =~ s/\s+$//gi;
|
||||
$list_id = '939';
|
||||
$phone_code = '1';
|
||||
$first_name = $m[3]; chomp($first_name); $first_name =~ s/^\s+|\s+$//gi;
|
||||
$middle_initial = '';
|
||||
$last_name = $m[2]; chomp($last_name); $last_name =~ s/\s+$//gi;
|
||||
$title = $m[25]; # number of contacts
|
||||
$address1 = $m[4]; $address1 =~ s/\s+$//gi;
|
||||
$address2 = $m[5]; $address2 =~ s/\s+$//gi;
|
||||
$address3 = $m[34]; # orig creditor
|
||||
$city = $m[6]; $city =~ s/\s+$//gi;
|
||||
$state = $m[7];
|
||||
$province = $m[35]; $province =~ s/\s+$//gi; # balance
|
||||
$postal_code = $m[8];
|
||||
$country = '';
|
||||
$gender = '';
|
||||
$date_of_birth = $m[13];
|
||||
$dobYYYY = substr($date_of_birth, 0, 4);
|
||||
$dobMM = substr($date_of_birth, 4, 2);
|
||||
$dobDD = substr($date_of_birth, 6, 2);
|
||||
$date_of_birth = "$dobYYYY-$dobMM-$dobDD";
|
||||
$email = $m[51]; # ssn
|
||||
$security_phrase = ''; # looked-up geographic CID will go here
|
||||
$comments = $m[43]; # ref-name
|
||||
$called_count = '0';
|
||||
$status = 'NEW';
|
||||
$insert_date = $pulldate0;
|
||||
$rank = '';
|
||||
$owner = '';
|
||||
$alt_phone = "$m[26] - $m[28]"; # number of times worked AND old status code
|
||||
$phone_number = $m[3];
|
||||
$entry_date = '';
|
||||
$multi_alt_phones = '';
|
||||
$phone_found=0;
|
||||
# remove non-digits from phone number fields
|
||||
$m[36] =~ s/\D//gi;
|
||||
$m[37] =~ s/\D//gi;
|
||||
$m[38] =~ s/\D//gi;
|
||||
$m[39] =~ s/\D//gi;
|
||||
$m[40] =~ s/\D//gi;
|
||||
$m[41] =~ s/\D//gi;
|
||||
$m[42] =~ s/\D//gi;
|
||||
$m[49] =~ s/\D//gi;
|
||||
$m[50] =~ s/\D//gi;
|
||||
|
||||
if ( (length($m[36]) > 9) && ($m[36] !~ /0000000000/) )
|
||||
{
|
||||
$phone_number = $m[36];
|
||||
$rank = '1';
|
||||
$owner = 'HOME_PHONE';
|
||||
&cid_state; # lookup state-based CID
|
||||
|
||||
print Pout "$vendor_lead_code|$source_id|$list_id|$phone_code|$phone_number|$title|$first_name|$middle|$last_name|$address1|$address2|$address3|$city|$state|$province|$postal_code|$country|$gender|$date_of_birth|$alt_phone|$email|$security_phrase|$comments|$called_count|$status|$entry_date|$rank|$owner|\n";
|
||||
$b++; $phone_found++;
|
||||
if ($DBX) {print " $b|$phone_found - $a|$phone_number|$city|$rank|$owner|$security_phrase|$vendor_lead_code|$source_id\n";}
|
||||
}
|
||||
if ( (length($m[37]) > 9) && ($m[37] !~ /0000000000/) )
|
||||
{
|
||||
$phone_number = $m[37];
|
||||
$rank = '2';
|
||||
$owner = 'WORK_PHONE';
|
||||
&cid_state; # lookup state-based CID
|
||||
|
||||
print Pout "$vendor_lead_code|$source_id|$list_id|$phone_code|$phone_number|$title|$first_name|$middle|$last_name|$address1|$address2|$address3|$city|$state|$province|$postal_code|$country|$gender|$date_of_birth|$alt_phone|$email|$security_phrase|$comments|$called_count|$status|$entry_date|$rank|$owner|\n";
|
||||
$b++; $phone_found++;
|
||||
if ($DBX) {print " $b|$phone_found - $a|$phone_number|$city|$rank|$owner|$security_phrase|$vendor_lead_code|$source_id\n";}
|
||||
}
|
||||
if ( (length($m[38]) > 9) && ($m[38] !~ /0000000000/) )
|
||||
{
|
||||
$phone_number = $m[38];
|
||||
$rank = '3';
|
||||
$owner = 'OTHER_PHONE';
|
||||
&cid_state; # lookup state-based CID
|
||||
|
||||
print Pout "$vendor_lead_code|$source_id|$list_id|$phone_code|$phone_number|$title|$first_name|$middle|$last_name|$address1|$address2|$address3|$city|$state|$province|$postal_code|$country|$gender|$date_of_birth|$alt_phone|$email|$security_phrase|$comments|$called_count|$status|$entry_date|$rank|$owner|\n";
|
||||
$b++; $phone_found++;
|
||||
if ($DBX) {print " $b|$phone_found - $a|$phone_number|$city|$rank|$owner|$security_phrase|$vendor_lead_code|$source_id\n";}
|
||||
}
|
||||
if ( (length($m[39]) > 9) && ($m[39] !~ /0000000000/) )
|
||||
{
|
||||
$phone_number = $m[39];
|
||||
$rank = '4';
|
||||
$owner = 'ACCT_OTHTEL2';
|
||||
&cid_state; # lookup state-based CID
|
||||
|
||||
print Pout "$vendor_lead_code|$source_id|$list_id|$phone_code|$phone_number|$title|$first_name|$middle|$last_name|$address1|$address2|$address3|$city|$state|$province|$postal_code|$country|$gender|$date_of_birth|$alt_phone|$email|$security_phrase|$comments|$called_count|$status|$entry_date|$rank|$owner|\n";
|
||||
$b++; $phone_found++;
|
||||
if ($DBX) {print " $b|$phone_found - $a|$phone_number|$city|$rank|$owner|$security_phrase|$vendor_lead_code|$source_id\n";}
|
||||
}
|
||||
if ( (length($m[40]) > 9) && ($m[40] !~ /0000000000/) )
|
||||
{
|
||||
$phone_number = $m[40];
|
||||
$rank = '5';
|
||||
$owner = 'ACCT_OTHTEL3';
|
||||
&cid_state; # lookup state-based CID
|
||||
|
||||
print Pout "$vendor_lead_code|$source_id|$list_id|$phone_code|$phone_number|$title|$first_name|$middle|$last_name|$address1|$address2|$address3|$city|$state|$province|$postal_code|$country|$gender|$date_of_birth|$alt_phone|$email|$security_phrase|$comments|$called_count|$status|$entry_date|$rank|$owner|\n";
|
||||
$b++; $phone_found++;
|
||||
if ($DBX) {print " $b|$phone_found - $a|$phone_number|$city|$rank|$owner|$security_phrase|$vendor_lead_code|$source_id\n";}
|
||||
}
|
||||
if ( (length($m[41]) > 9) && ($m[41] !~ /0000000000/) )
|
||||
{
|
||||
$phone_number = $m[41];
|
||||
$rank = '6';
|
||||
$owner = 'ACCT_OTHTEL4';
|
||||
&cid_state; # lookup state-based CID
|
||||
|
||||
print Pout "$vendor_lead_code|$source_id|$list_id|$phone_code|$phone_number|$title|$first_name|$middle|$last_name|$address1|$address2|$address3|$city|$state|$province|$postal_code|$country|$gender|$date_of_birth|$alt_phone|$email|$security_phrase|$comments|$called_count|$status|$entry_date|$rank|$owner|\n";
|
||||
$b++; $phone_found++;
|
||||
if ($DBX) {print " $b|$phone_found - $a|$phone_number|$city|$rank|$owner|$security_phrase|$vendor_lead_code|$source_id\n";}
|
||||
}
|
||||
if ( (length($m[42]) > 9) && ($m[42] !~ /0000000000/) )
|
||||
{
|
||||
$phone_number = $m[42];
|
||||
$rank = '7';
|
||||
$owner = 'ACCT_OTHTEL5';
|
||||
&cid_state; # lookup state-based CID
|
||||
|
||||
print Pout "$vendor_lead_code|$source_id|$list_id|$phone_code|$phone_number|$title|$first_name|$middle|$last_name|$address1|$address2|$address3|$city|$state|$province|$postal_code|$country|$gender|$date_of_birth|$alt_phone|$email|$security_phrase|$comments|$called_count|$status|$entry_date|$rank|$owner|\n";
|
||||
$b++; $phone_found++;
|
||||
if ($DBX) {print " $b|$phone_found - $a|$phone_number|$city|$rank|$owner|$security_phrase|$vendor_lead_code|$source_id\n";}
|
||||
}
|
||||
if ( (length($m[49]) > 9) && ($m[49] !~ /0000000000/) )
|
||||
{
|
||||
$phone_number = $m[49];
|
||||
$rank = '8';
|
||||
$owner = 'REF-TEL1';
|
||||
&cid_state; # lookup state-based CID
|
||||
|
||||
print Pout "$vendor_lead_code|$source_id|$list_id|$phone_code|$phone_number|$title|$first_name|$middle|$last_name|$address1|$address2|$address3|$city|$state|$province|$postal_code|$country|$gender|$date_of_birth|$alt_phone|$email|$security_phrase|$comments|$called_count|$status|$entry_date|$rank|$owner|\n";
|
||||
$b++; $phone_found++;
|
||||
if ($DBX) {print " $b|$phone_found - $a|$phone_number|$city|$rank|$owner|$security_phrase|$vendor_lead_code|$source_id\n";}
|
||||
}
|
||||
if ( (length($m[50]) > 9) && ($m[50] !~ /0000000000/) )
|
||||
{
|
||||
$phone_number = $m[50];
|
||||
$rank = '9';
|
||||
$owner = 'REF-TEL2';
|
||||
&cid_state; # lookup state-based CID
|
||||
|
||||
print Pout "$vendor_lead_code|$source_id|$list_id|$phone_code|$phone_number|$title|$first_name|$middle|$last_name|$address1|$address2|$address3|$city|$state|$province|$postal_code|$country|$gender|$date_of_birth|$alt_phone|$email|$security_phrase|$comments|$called_count|$status|$entry_date|$rank|$owner|\n";
|
||||
$b++; $phone_found++;
|
||||
if ($DBX) {print " $b|$phone_found - $a|$phone_number|$city|$rank|$owner|$security_phrase|$vendor_lead_code|$source_id\n";}
|
||||
}
|
||||
|
||||
if ($phone_found < 1)
|
||||
{
|
||||
if ($DB) {print "No-Phone entry: $a|$vendor_lead_code|$source_id\n";}
|
||||
$c++;
|
||||
}
|
||||
$format_set++;
|
||||
}
|
||||
|
||||
|
||||
# This is the format for the standard lead files
|
||||
#3857822|31022|105|01144|1625551212|MRS|B||BURTON|249 MUNDON ROAD|MALDON|ESSEX||||CM9 6PW|UK||||||COMMENTS
|
||||
if ($format_set < 1)
|
||||
@@ -785,3 +969,25 @@ if ( (length($Ealert)>5) && (length($email_list) > 3) )
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
##### SUBROUTINES #####
|
||||
|
||||
sub cid_state {
|
||||
### look up the custom CID to use for this state
|
||||
$stmtA = "select cid from vicidial_custom_cid where state='$state';";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
if($DBX){print STDERR "\n$sthArows|$stmtA|\n";}
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$security_phrase = $aryA[0];
|
||||
}
|
||||
$sthA->finish();
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
# 101108-0032 - Added ADDMEMBER queue_log code
|
||||
# 110124-1134 - Small query fix for large queue_log tables
|
||||
# 110224-2350 - Small QM logout fix
|
||||
# 110420-0344 - Added DEAD/PARK agent statuses
|
||||
#
|
||||
|
||||
header ("Content-type: text/html; charset=utf-8");
|
||||
@@ -137,6 +138,7 @@ else
|
||||
$Aextension = $row[4];
|
||||
$Astatus = $row[5];
|
||||
$Acampaign = $row[7];
|
||||
$Acallerid = $row[9];
|
||||
$Alast_call = $row[14];
|
||||
$Acl_campaigns = $row[15];
|
||||
$agent_territories = $row[27];
|
||||
@@ -159,6 +161,30 @@ else
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($Astatus == 'INCALL')
|
||||
{
|
||||
$stmtP="select count(*) from parked_channels where channel_group='$Acallerid';";
|
||||
$rsltP=mysql_query($stmtP,$link);
|
||||
$rowP=mysql_fetch_row($rsltP);
|
||||
$parked_channel = $rowP[0];
|
||||
|
||||
if ($parked_channel > 0)
|
||||
{
|
||||
$Astatus = 'PARK';
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmtP="select count(*) from vicidial_auto_calls where callerid='$Acallerid';";
|
||||
$rsltP=mysql_query($stmtP,$link);
|
||||
$rowP=mysql_fetch_row($rsltP);
|
||||
$live_channel = $rowP[0];
|
||||
|
||||
if ($live_channel < 1)
|
||||
{
|
||||
$Astatus = 'DEAD';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$stmt="select campaign_id from vicidial_campaigns;";
|
||||
|
||||
Reference in New Issue
Block a user