diff --git a/agi/agi-VDAD_ALL_inbound.agi b/agi/agi-VDAD_ALL_inbound.agi
index f47dd701..dfa19b56 100644
--- a/agi/agi-VDAD_ALL_inbound.agi
+++ b/agi/agi-VDAD_ALL_inbound.agi
@@ -213,6 +213,7 @@
# 170527-2240 - Fix for rare inbound logging issue #1017
# 170621-2031 - Added missing list_id in log inserts
# 170816-2245 - Added ask survey options
+# 170903-0929 - Added additional xfer_log details
#
$script = 'agi-VDAD_ALL_inbound.agi';
@@ -2126,7 +2127,7 @@ $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$dbhP=$dbhA; $mysql_count='02022'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
- while ($sthArows > $vci)
+while ($sthArows > $vci)
{
@aryA = $sthA->fetchrow_array;
if ($vci==0) {$INBOUNDcampsSQL .= "'$aryA[0]'";}
@@ -2158,7 +2159,32 @@ if ($call_handle_method =~ /DIGITID$/)
$insert_xfer_id=0;
if ($call_handle_method =~ /CLOSER|DIGITID$/)
{
- $stmtA = "INSERT INTO vicidial_xfer_log (lead_id,campaign_id,call_date,phone_code,phone_number,user,closer,list_id) values('$insert_lead_id','$channel_group','$SQLdate','$phone_code','$phone_number','$fronter','VDXL','$list_id')";
+ ### find uniqueid of originating call ###
+ $front_uniqueid='';
+ $epochFOURhoursAGO = ($now_date_epoch - 14400);
+ ($Ssec,$Smin,$Shour,$Smday,$Smon,$Syear,$Swday,$Syday,$Sisdst) = localtime($epochFOURhoursAGO);
+ $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";}
+ $timeFOURhoursAGO = "$Syear-$Smon-$Smday $Shour:$Smin:$Ssec";
+
+ $stmtA = "SELECT uniqueid FROM vicidial_log_extended where call_date <= \"$SQLdate\" and call_date > \"$timeFOURhoursAGO\" and lead_id='$insert_lead_id' order by call_date desc limit 1;";
+ $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
+ $sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
+ $sthArows=$sthA->rows;
+ $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
+ if ($sthArows > 0)
+ {
+ @aryA = $sthA->fetchrow_array;
+ $front_uniqueid = $aryA[0];
+ }
+ $sthA->finish();
+
+ ### insert into xfer log ###
+ $stmtA = "INSERT INTO vicidial_xfer_log (lead_id,campaign_id,call_date,phone_code,phone_number,user,closer,list_id,front_uniqueid,close_uniqueid) values('$insert_lead_id','$channel_group','$SQLdate','$phone_code','$phone_number','$fronter','VDXL','$list_id','$front_uniqueid','$uniqueid')";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$affected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='02024'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
diff --git a/bin/ADMIN_archive_log_tables.pl b/bin/ADMIN_archive_log_tables.pl
index 54c6324b..e8ab855d 100644
--- a/bin/ADMIN_archive_log_tables.pl
+++ b/bin/ADMIN_archive_log_tables.pl
@@ -50,6 +50,7 @@
# 170508-1212 - Added vicidial_rt_monitor_log table rolling
# 170809-1926 - Added rolling of user_call_log if over 1000000 records
# 170817-1318 - Added rolling of vicidial_inbound_survey_log
+# 170825-2243 - Added rolling of vicidial_xfer_log
#
$CALC_TEST=0;
@@ -75,7 +76,6 @@ if (length($ARGV[0])>1)
print " [--vlog-daily] = will also archive the vicidial_log table when --daily is run\n";
print " [--days=XX] = number of days to archive past, default is 732(2 years)\n";
print " [--months=XX] = number of months to archive past, default is 24(2 years) If 'days' used then 'months' ignored\n";
- print " [--closer-log] = archive vicidial_closer_log records\n";
print " [--queue-log] = archive QM queue_log records\n";
print " [--only-trim-archive-level-one] = will not perform normal archive process, instead this will only delete records\n";
print " that are older than XX months from least important log archive tables:\n";
@@ -83,7 +83,7 @@ if (length($ARGV[0])>1)
print " [--only-trim-archive-level-two] = same as --only-trim-archive-level-one, except includes tables:\n";
print " vicidial_carrier_log_archive, vicidial_api_log_archive, vicidial_rt_monitor_log_archive\n";
print " [--only-trim-archive-level-three] = same as --only-trim-archive-level-two, except includes tables:\n";
- print " vicidial_log_archive, vicidial_agent_log_archive, vicidial_closer_log_archive\n";
+ print " vicidial_log_archive, vicidial_agent_log_archive, vicidial_closer_log_archive, vicidial_xfer_log_archive\n";
print " [--recording-log-days=XX] = OPTIONAL, number of days to archive recording_log table only past\n";
print " [--cpd-log-purge-days=XX] = OPTIONAL, number of days to purge vicidial_cpd_log table only past\n";
print " [--quiet] = quiet\n";
@@ -147,12 +147,6 @@ if (length($ARGV[0])>1)
if ($Q < 1)
{print "\n----- DAYS OVERRIDE: $CLIdays -----\n\n";}
}
- if ($args =~ /--closer-log/i)
- {
- $closer_log=1;
- if ($Q < 1)
- {print "\n----- CLOSER LOG ARCHIVE -----\n\n";}
- }
if ($args =~ /--queue-log/i)
{
$queue_log=1;
@@ -346,7 +340,7 @@ if (!$T)
# LEVEL 2:
# vicidial_carrier_log_archive, vicidial_api_log_archive
# LEVEL 3:
- # vicidial_log_archive, vicidial_agent_log_archive, vicidial_closer_log_archive
+ # vicidial_log_archive, vicidial_agent_log_archive, vicidial_closer_log_archive, vicidial_xfer_log_archive
# NOTE: script will exit once trim process has completed
if (!$Q) {print "\nONLY-TRIM-ARCHIVE PROCESS LAUNCHING, GOING TO LEVEL: $only_trim_archive\n";}
@@ -678,6 +672,35 @@ if (!$T)
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
}
##### END vicidial_closer_log_archive trim processing #####
+
+ ##### BEGIN vicidial_xfer_log_archive trim processing #####
+ $stmtA = "SELECT count(*) from vicidial_xfer_log_archive;";
+ $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;
+ $vicidial_xfer_log_archive_count = $aryA[0];
+ }
+ $sthA->finish();
+
+ if (!$Q) {print "Trimming vicidial_xfer_log_archive table... ($vicidial_xfer_log_archive_count)\n";}
+
+ $rv = $sthA->err();
+ if (!$rv)
+ {
+ $stmtA = "DELETE FROM vicidial_xfer_log_archive WHERE call_date < '$del_time';";
+ $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
+ $sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
+ $sthArows = $sthA->rows;
+ if (!$Q) {print "$sthArows rows deleted from vicidial_xfer_log_archive table \n";}
+
+ $stmtA = "optimize table vicidial_xfer_log_archive;";
+ $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
+ $sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
+ }
+ ##### END vicidial_xfer_log_archive trim processing #####
}
if (!$Q) {print "Trim process complete, exiting...\n";}
@@ -1335,6 +1358,55 @@ if (!$T)
}
+ ##### vicidial_xfer_log
+ $stmtA = "SELECT count(*) from vicidial_xfer_log;";
+ $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;
+ $vicidial_xfer_log_count = $aryA[0];
+ }
+ $sthA->finish();
+
+ $stmtA = "SELECT count(*) from vicidial_xfer_log_archive;";
+ $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;
+ $vicidial_xfer_log_archive_count = $aryA[0];
+ }
+ $sthA->finish();
+
+ if (!$Q) {print "\nProcessing vicidial_xfer_log table... ($vicidial_xfer_log_count|$vicidial_xfer_log_archive_count)\n";}
+ $stmtA = "INSERT IGNORE INTO vicidial_xfer_log_archive SELECT * from vicidial_xfer_log;";
+ $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
+ $sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
+
+ $sthArows = $sthA->rows;
+ if (!$Q) {print "$sthArows rows inserted into vicidial_xfer_log_archive table \n";}
+
+ $rv = $sthA->err();
+ if (!$rv)
+ {
+ $stmtA = "DELETE FROM vicidial_xfer_log WHERE call_date < '$del_time';";
+ $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
+ $sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
+ $sthArows = $sthA->rows;
+ if (!$Q) {print "$sthArows rows deleted from vicidial_xfer_log table \n";}
+
+ $stmtA = "optimize table vicidial_xfer_log;";
+ $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
+ $sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
+
+ $stmtA = "optimize table vicidial_xfer_log_archive;";
+ $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
+ $sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
+ }
+
##### vicidial_log_extended
$stmtA = "SELECT count(*) from vicidial_log_extended;";
diff --git a/extras/MySQL_AST_CREATE_tables.sql b/extras/MySQL_AST_CREATE_tables.sql
index 31d08f2d..9a366c7c 100644
--- a/extras/MySQL_AST_CREATE_tables.sql
+++ b/extras/MySQL_AST_CREATE_tables.sql
@@ -530,6 +530,8 @@ phone_code VARCHAR(10),
phone_number VARCHAR(18),
user VARCHAR(20),
closer VARCHAR(20),
+front_uniqueid VARCHAR(50) default '',
+close_uniqueid VARCHAR(50) default '',
index (lead_id),
index (call_date)
) ENGINE=MyISAM;
@@ -2630,6 +2632,7 @@ noanswer_processed ENUM('N','Y','U') default 'N'
) ENGINE=MyISAM;
CREATE INDEX call_date on vicidial_log_extended (call_date);
+CREATE INDEX vle_lead_id on vicidial_log_extended(lead_id);
CREATE TABLE vicidial_lists_fields (
field_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
@@ -3951,6 +3954,9 @@ 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;
+CREATE TABLE vicidial_xfer_log_archive LIKE vicidial_xfer_log;
+ALTER TABLE vicidial_xfer_log_archive MODIFY xfercallid INT(9) UNSIGNED NOT NULL;
+
CREATE TABLE vicidial_outbound_ivr_log_archive LIKE vicidial_outbound_ivr_log;
CREATE TABLE vicidial_log_extended_archive LIKE vicidial_log_extended;
@@ -4065,4 +4071,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='1514',db_schema_update_date=NOW(),reload_timestamp=NOW();
+UPDATE system_settings SET db_schema_version='1515',db_schema_update_date=NOW(),reload_timestamp=NOW();
diff --git a/extras/upgrade_2.14.sql b/extras/upgrade_2.14.sql
index 215adf75..9e965c02 100644
--- a/extras/upgrade_2.14.sql
+++ b/extras/upgrade_2.14.sql
@@ -360,3 +360,13 @@ ALTER TABLE vicidial_automated_reports ADD filename_override VARCHAR(255) defaul
ALTER TABLE vicidial_automated_reports MODIFY report_times VARCHAR(255) default '';
UPDATE system_settings SET db_schema_version='1514',db_schema_update_date=NOW() where db_schema_version < 1514;
+
+CREATE INDEX vle_lead_id on vicidial_log_extended(lead_id);
+
+ALTER TABLE vicidial_xfer_log ADD front_uniqueid VARCHAR(50) default '';
+ALTER TABLE vicidial_xfer_log ADD close_uniqueid VARCHAR(50) default '';
+
+CREATE TABLE vicidial_xfer_log_archive LIKE vicidial_xfer_log;
+ALTER TABLE vicidial_xfer_log_archive MODIFY xfercallid INT(9) UNSIGNED NOT NULL;
+
+UPDATE system_settings SET db_schema_version='1515',db_schema_update_date=NOW() where db_schema_version < 1515;
diff --git a/www/vicidial/AST_CLOSER_service_level.php b/www/vicidial/AST_CLOSER_service_level.php
index 9e3ba947..2ef74618 100644
--- a/www/vicidial/AST_CLOSER_service_level.php
+++ b/www/vicidial/AST_CLOSER_service_level.php
@@ -38,6 +38,7 @@
# 170323-2247 - Added debug variable
# 170409-1559 - Added IP List validation code
# 170602-1008 - Added 8am-5pm shift
+# 170829-0040 - Added screen color settings
#
$startMS = microtime();
@@ -345,10 +346,10 @@ $HEADER.="
"._QXZ("$report_name").""._QXZ("$report_name")." $NWB#CLOSER_service_level$NWE\n";
-$MAIN.="