Various formatting fixes
Added more logging to emergency agent logout processes changed start_asterisk_boot.pl script to launch unique astshell screen sessions git-svn-id: svn://192.168.202.10@1275 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
+1573
-1568
File diff suppressed because it is too large
Load Diff
@@ -1820,6 +1820,37 @@ while($one_day_interval > 0)
|
||||
$stmtA = "INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$VALOuser[$logrun]','LOGOUT','$VALOcampaign[$logrun]','$SQLdate','$now_date_epoch','$VALOuser_group');";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
|
||||
if ($enable_queuemetrics_logging > 0)
|
||||
{
|
||||
$secX = time();
|
||||
$dbhB = DBI->connect("DBI:mysql:$queuemetrics_dbname:$queuemetrics_server_ip:3306", "$queuemetrics_login", "$queuemetrics_pass")
|
||||
or die "Couldn't connect to database: " . DBI->errstr;
|
||||
|
||||
if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";}
|
||||
|
||||
$agents='@agents';
|
||||
$time_logged_in='';
|
||||
$stmtB = "SELECT time_id FROM queue_log where agent='Agent/$VALOuser[$logrun]' and verb='AGENTLOGIN' order by time_id desc limit 1;";
|
||||
$sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr;
|
||||
$sthB->execute or die "executing: $stmtA ", $dbhB->errstr;
|
||||
$sthBrows=$sthB->rows;
|
||||
if ($sthBrows > 0)
|
||||
{
|
||||
@aryB = $sthB->fetchrow_array;
|
||||
$time_logged_in = $aryB[0];
|
||||
}
|
||||
$sthB->finish();
|
||||
|
||||
$time_logged_in = ($secX - $logintime);
|
||||
if ($time_logged_in > 1000000) {$time_logged_in=1;}
|
||||
$LOGOFFtime = ($secX + 1);
|
||||
|
||||
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$LOGOFFtime',call_id='NONE',queue='NONE',agent='Agent/$VALOuser[$logrun]',verb='AGENTLOGOFF',serverid='$queuemetrics_log_id',data1='$VALOuser[$logrun]$agents',data2='$time_logged_in';";
|
||||
$Baffected_rows = $dbhB->do($stmtB);
|
||||
|
||||
$dbhB->disconnect();
|
||||
}
|
||||
|
||||
$event_string = "| lagged agent LOGOUT entry inserted $VALOuser[$logrun]|$VALOcampaign[$logrun]|$VALOextension[$logcount]|";
|
||||
&event_logger;
|
||||
|
||||
|
||||
@@ -148,8 +148,7 @@ $stmtA = "SELECT vd_server_logs,local_gmt FROM servers where server_ip = '$VARse
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
$rec_count=0;
|
||||
while ($sthArows > $rec_count)
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$DBvd_server_logs = "$aryA[0]";
|
||||
@@ -157,7 +156,6 @@ while ($sthArows > $rec_count)
|
||||
if ($DBvd_server_logs =~ /Y/) {$SYSLOG = '1';}
|
||||
else {$SYSLOG = '0';}
|
||||
if (length($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;}
|
||||
$rec_count++;
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
# 81208-0133 - Added portion to check for more missing queue_log entries
|
||||
# 90330-2128 - Minor code fixes and restricted queue_log actions to VICIDIAL-defined serverid records
|
||||
# 91112-1100 - Added fixing for more QM issues, added CALLOUTBOUND checking with ENTERQUEUE
|
||||
# 91209-0956 - Added PAUSEREASON-LAGGED queue_log correction during live call
|
||||
# 91210-0609 - Added LOGOFF queue_log correction during live call
|
||||
#
|
||||
|
||||
# constants
|
||||
@@ -362,18 +364,148 @@ if ($enable_queuemetrics_logging > 0)
|
||||
$h++;
|
||||
}
|
||||
|
||||
@time_id=@MT;
|
||||
@agent=@MT;
|
||||
|
||||
##############################################################
|
||||
##### grab all queue_log entries with a PAUSEREASON of LAGGED to validate
|
||||
$stmtB = "SELECT time_id,agent FROM queue_log where verb='PAUSEREASON' and data1='LAGGED' $QM_SQL_time_H order by time_id;";
|
||||
$sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr;
|
||||
$sthB->execute or die "executing: $stmtB ", $dbhB->errstr;
|
||||
$P_lagged_records=$sthB->rows;
|
||||
if ($DB) {print "LAGGED Records: $P_lagged_records|$stmtB|\n\n";}
|
||||
$h=0;
|
||||
while ($P_lagged_records > $h)
|
||||
{
|
||||
@aryB = $sthB->fetchrow_array;
|
||||
$time_id[$h] = $aryB[0];
|
||||
$agent[$h] = $aryB[1];
|
||||
$h++;
|
||||
}
|
||||
$sthB->finish();
|
||||
|
||||
$h=0;
|
||||
while ($P_lagged_records > $h)
|
||||
{
|
||||
$NEXTtime=0;
|
||||
$NEXTverb='';
|
||||
$NEXTqueue='';
|
||||
$NEXTcall_id='';
|
||||
##### find the next queue_log record after the PAUSEREASON record
|
||||
$stmtB = "SELECT time_id,verb,queue,call_id FROM queue_log where agent='$agent[$h]' and time_id > '$time_id[$h]' order by time_id limit 1;";
|
||||
$sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr;
|
||||
$sthB->execute or die "executing: $stmtB ", $dbhB->errstr;
|
||||
$PL_records=$sthB->rows;
|
||||
if ($PL_records > 0)
|
||||
{
|
||||
@aryB = $sthB->fetchrow_array;
|
||||
$NEXTtime = $aryB[0];
|
||||
$NEXTverb = $aryB[1];
|
||||
$NEXTqueue = $aryB[2];
|
||||
$NEXTcall_id = $aryB[3];
|
||||
}
|
||||
$sthB->finish();
|
||||
|
||||
if ( ($PL_records > 0) && ($NEXTverb =~ /CALLSTATUS|COMPLETECALLER|COMPLETEAGENT/) )
|
||||
{
|
||||
$NEXTtimePAUSE = ($NEXTtime + 1);
|
||||
if ($DB) {print "LAGGED PAUSE DURING CALL: $h|$time_id[$h]|$agent[$h]|$NEXTtime|$NEXTverb|$NEXTqueue|$NEXTcall_id\n";}
|
||||
|
||||
##### update the PAUSEREASON LAGGED record in the queue_log to one second after the end of the call
|
||||
$stmtB = "UPDATE queue_log SET time_id='$NEXTtimePAUSE' where agent='$agent[$h]' and time_id='$time_id[$h]' and verb='PAUSEREASON' and data1='LAGGED' limit 1;";
|
||||
if ($TEST < 1)
|
||||
{
|
||||
$Baffected_rows = $dbhB->do($stmtB);
|
||||
}
|
||||
if ($DB) {print " PAUSEREASON record updated: $Baffected_rows|$stmtB|\n";}
|
||||
|
||||
$event_string = "LAGGED DURING CALL: $h|$PL_records|$time_id[$h]|$agent[$h]|$NEXTtimePAUSE|$NEXTverb|$NEXTqueue|$NEXTcall_id|$Baffected_rows|$stmtB";
|
||||
&event_logger;
|
||||
}
|
||||
|
||||
$h++;
|
||||
}
|
||||
|
||||
|
||||
@time_id=@MT;
|
||||
@agent=@MT;
|
||||
|
||||
##############################################################
|
||||
##### grab all queue_log entries with a verb of AGENTLOGOFF to validate
|
||||
$stmtB = "SELECT time_id,agent FROM queue_log where verb='AGENTLOGOFF' $QM_SQL_time_H order by time_id;";
|
||||
$sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr;
|
||||
$sthB->execute or die "executing: $stmtB ", $dbhB->errstr;
|
||||
$A_logoff_records=$sthB->rows;
|
||||
if ($DB) {print "AGENTLOGOFF Records: $A_logoff_records|$stmtB|\n\n";}
|
||||
$h=0;
|
||||
while ($A_logoff_records > $h)
|
||||
{
|
||||
@aryB = $sthB->fetchrow_array;
|
||||
$time_id[$h] = $aryB[0];
|
||||
$agent[$h] = $aryB[1];
|
||||
$h++;
|
||||
}
|
||||
$sthB->finish();
|
||||
|
||||
$h=0;
|
||||
while ($A_logoff_records > $h)
|
||||
{
|
||||
$NEXTtime=0;
|
||||
$NEXTverb='';
|
||||
$NEXTqueue='';
|
||||
$NEXTcall_id='';
|
||||
##### find the next queue_log record after the PAUSEREASON record
|
||||
$stmtB = "SELECT time_id,verb,queue,call_id FROM queue_log where agent='$agent[$h]' and time_id > '$time_id[$h]' order by time_id limit 1;";
|
||||
$sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr;
|
||||
$sthB->execute or die "executing: $stmtB ", $dbhB->errstr;
|
||||
$AL_records=$sthB->rows;
|
||||
if ($AL_records > 0)
|
||||
{
|
||||
@aryB = $sthB->fetchrow_array;
|
||||
$NEXTtime = $aryB[0];
|
||||
$NEXTverb = $aryB[1];
|
||||
$NEXTqueue = $aryB[2];
|
||||
$NEXTcall_id = $aryB[3];
|
||||
}
|
||||
$sthB->finish();
|
||||
|
||||
if ( ($AL_records > 0) && ($NEXTverb =~ /CALLSTATUS|COMPLETECALLER|COMPLETEAGENT/) )
|
||||
{
|
||||
$NEXTtimeLOGOFF = ($NEXTtime + 1);
|
||||
if ($DB) {print "LOGOFF DURING CALL: $h|$time_id[$h]|$agent[$h]|$NEXTtime|$NEXTverb|$NEXTqueue|$NEXTcall_id\n";}
|
||||
|
||||
##### update the AGENTLOGOFF record in the queue_log to one second after the end of the call
|
||||
$stmtB = "UPDATE queue_log SET time_id='$NEXTtimeLOGOFF' where agent='$agent[$h]' and time_id='$time_id[$h]' and verb='AGENTLOGOFF' limit 1;";
|
||||
if ($TEST < 1)
|
||||
{
|
||||
$Baffected_rows = $dbhB->do($stmtB);
|
||||
}
|
||||
if ($DB) {print " AGENTLOGOFF record updated: $Baffected_rows|$stmtB|\n";}
|
||||
|
||||
$event_string = "AGENTLOGOFF DURING CALL: $h|$AL_records|$time_id[$h]|$agent[$h]|$NEXTtimeLOGOFF|$NEXTverb|$NEXTqueue|$NEXTcall_id|$Baffected_rows|$stmtB";
|
||||
&event_logger;
|
||||
}
|
||||
|
||||
$h++;
|
||||
}
|
||||
|
||||
if ($qm_live_call_check > 0)
|
||||
{
|
||||
exit;
|
||||
}
|
||||
}
|
||||
### END CHECKING ENTERQUEUE/CALLOUTBOUND ENTRIES FOR LIVE CALLS
|
||||
### END CHECKING ENTERQUEUE/CALLOUTBOUND ENTRIES FOR LIVE CALLS AND PAUSEREASON-LAGGED/LOGOFF ENTRIES FOR LIVE AGENTS
|
||||
|
||||
|
||||
|
||||
### BEGIN FIX LOGIN/LAGGED PAUSEREASON ENTRIES (not a recurring process that needs to be run)
|
||||
if ( ($enable_queuemetrics_logging > 0) && ($login_lagged_check > 0) )
|
||||
{
|
||||
@time_id=@MT;
|
||||
@agent=@MT;
|
||||
@verb=@MT;
|
||||
@serverid=@MT;
|
||||
|
||||
if ($DB) {print " - Checking for LOGIN and LAGGED pausereason records in queue_log\n";}
|
||||
|
||||
$PAUSEREASONinsert=0;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
# 90309-0905 - mattf - Added deleting of asterisk command files
|
||||
# 90325-2238 - mattf - Rewrote launching of Asterisk, removed command files
|
||||
# 90506-1443 - mikec - Added the T option to the asterisk command. This enables timestamping.
|
||||
# 91210-1500 - mattf - Added datetimestamp to astshell screen
|
||||
#
|
||||
|
||||
# default path to astguiclient configuration file:
|
||||
@@ -40,6 +41,17 @@ foreach(@conf)
|
||||
$i++;
|
||||
}
|
||||
|
||||
$secX = time();
|
||||
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($secX);
|
||||
$mon++;
|
||||
$year = ($year + 1900);
|
||||
if ($mon < 10) {$mon = "0$mon";}
|
||||
if ($mday < 10) {$mday = "0$mday";}
|
||||
if ($hour < 10) {$hour = "0$hour";}
|
||||
if ($min < 10) {$min = "0$min";}
|
||||
if ($sec < 10) {$sec = "0$sec";}
|
||||
$launch_date = "$year$mon$mday$hour$min$sec";
|
||||
|
||||
`PERL5LIB="$PATHhome/libs"; export PERL5LIB`;
|
||||
|
||||
use DBI;
|
||||
@@ -48,38 +60,36 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA
|
||||
or die "Couldn't connect to database: " . DBI->errstr;
|
||||
|
||||
### Grab Server values from the database
|
||||
$stmtA = "SELECT vd_server_logs FROM servers where server_ip = '$VARserver_ip';";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
$rec_count=0;
|
||||
while ($sthArows > $rec_count)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$DBvd_server_logs = "$aryA[0]";
|
||||
if ($DBvd_server_logs =~ /Y/) {$SYSLOG = '1';}
|
||||
else {$SYSLOG = '0';}
|
||||
$rec_count++;
|
||||
}
|
||||
$sthA->finish();
|
||||
$stmtA = "SELECT vd_server_logs FROM servers where server_ip = '$VARserver_ip';";
|
||||
$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;
|
||||
$DBvd_server_logs = $aryA[0];
|
||||
if ($DBvd_server_logs =~ /Y/) {$SYSLOG = '1';}
|
||||
else {$SYSLOG = '0';}
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
`ulimit -n 65536`;
|
||||
|
||||
if ($SYSLOG)
|
||||
{
|
||||
`/usr/bin/screen -d -m -S astershell /usr/bin/screen -S astshell`;
|
||||
`/usr/bin/screen -d -m -S astershell$launch_date /usr/bin/screen -S astshell$launch_date`;
|
||||
print "started screen\n";
|
||||
|
||||
sleep(1);
|
||||
`screen -XS astshell eval 'stuff "cd /var/log/astguiclient\015"'`;
|
||||
`screen -XS astshell$launch_date eval 'stuff "cd /var/log/astguiclient\015"'`;
|
||||
print "changed directory\n";
|
||||
|
||||
sleep(1);
|
||||
`screen -XS astshell eval 'stuff "screen -L -S asterisk\015"'`;
|
||||
`screen -XS astshell$launch_date eval 'stuff "screen -L -S asterisk\015"'`;
|
||||
print "started new screen session\n";
|
||||
|
||||
sleep(1);
|
||||
`screen -d astshell`;
|
||||
`screen -d astshell$launch_date`;
|
||||
`screen -d asterisk`;
|
||||
print "detached screens\n";
|
||||
|
||||
@@ -93,7 +103,7 @@ if ($SYSLOG)
|
||||
}
|
||||
else
|
||||
{
|
||||
`/usr/bin/screen -d -m -S astershell /usr/bin/screen -S asterisk`;
|
||||
`/usr/bin/screen -d -m -S astershell$launch_date /usr/bin/screen -S asterisk`;
|
||||
print "started screen\n";
|
||||
|
||||
sleep(1);
|
||||
@@ -111,8 +121,8 @@ else
|
||||
|
||||
|
||||
### Set the conf files to automatically update
|
||||
$stmtA = "UPDATE servers SET rebuild_conf_files='Y' where server_ip = '$VARserver_ip';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$stmtA = "UPDATE servers SET rebuild_conf_files='Y' where server_ip = '$VARserver_ip';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
|
||||
|
||||
exit;
|
||||
|
||||
@@ -433,6 +433,8 @@ PHASE 6: ADDING CRONTAB ENTRIES FOR ASTGUICLIENT/VICIDIAL SCRIPTS
|
||||
50 0 * * * /usr/share/astguiclient/AST_cleanup_agent_log.pl --last-24hours
|
||||
## uncomment below if using QueueMetrics
|
||||
#*/5 * * * * /usr/share/astguiclient/AST_cleanup_agent_log.pl --only-qm-live-call-check
|
||||
|
||||
## uncomment below if using Vtiger
|
||||
#1 1 * * * /usr/share/astguiclient/Vtiger_optimize_all_tables.pl --quiet
|
||||
|
||||
### updater for VICIDIAL hopper
|
||||
|
||||
@@ -345,10 +345,10 @@ How to install Queue Metrics on OpenSuSE v.11.1 (32 or 64 bit) with a system tha
|
||||
3) cd /usr/src
|
||||
4) wget http://queuemetrics.com/download/QueueMetrics-1.5.3-trial.tar.gz
|
||||
5) mkdir tars (incase it doesn't exist)
|
||||
6) tar -xzf QueueMetrics-1.5.3-trial.tar.gz
|
||||
7) mv QueueMetrics-1.5.3-trial.tar.gz ./tars/
|
||||
6) tar -xzf QueueMetrics-1.5.5-trial.tar.gz
|
||||
7) mv QueueMetrics-1.5.5-trial.tar.gz ./tars/
|
||||
8) mkdir /srv/tomcat6/webapps/QM
|
||||
9) cp -r queuemetrics-1.5.3/* /srv/tomcat6/webapps/QM/
|
||||
9) cp -r queuemetrics-1.5.5/* /srv/tomcat6/webapps/QM/
|
||||
10) zypper in mysql-connector-java
|
||||
11) cp /usr/share/java/mysql-connector-java.jar /srv/tomcat6/webapps/QM/WEB-INF/lib/
|
||||
12) chkconfig tomcat6 on
|
||||
|
||||
@@ -13,7 +13,7 @@ make
|
||||
make install
|
||||
|
||||
cd /usr/local/
|
||||
wget http://mirror.trouble-free.net/mysql_mirror/Downloads/MySQL-5.0/mysql-5.0.67.tar.gz
|
||||
wget http://files.directadmin.com/services/all/mysql/mysql-5.0.67.tar.gz
|
||||
gunzip mysql-5.0.67.tar.gz
|
||||
tar xvf mysql-5.0.67.tar
|
||||
cd mysql-5.0.67
|
||||
|
||||
@@ -91,15 +91,13 @@ header ("Pragma: no-cache"); // HTTP/1.0
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin FROM system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03001',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03001',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$qm_conf_ct = mysql_num_rows($rslt);
|
||||
$i=0;
|
||||
while ($i < $qm_conf_ct)
|
||||
if ($qm_conf_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
$i++;
|
||||
}
|
||||
##### END SETTINGS LOOKUP #####
|
||||
###########################################
|
||||
|
||||
@@ -1994,11 +1994,12 @@ else
|
||||
# 91125-0628 - Added conf_secret for servers
|
||||
# 91204-1652 - Added recording_filename and recording_id as script variables
|
||||
# 91205-2231 - Added delete_vm_after_email voicemail option to phones and extra voicemail sections
|
||||
# 91210-2038 - Added better logging of Campaign emergency logout
|
||||
#
|
||||
# make sure you have added a user to the vicidial_users MySQL table with at least user_level 8 to access this page the first time
|
||||
|
||||
$admin_version = '2.2.0-226';
|
||||
$build = '91205-2231';
|
||||
$admin_version = '2.2.0-227';
|
||||
$build = '91210-2038';
|
||||
|
||||
$STARTtime = date("U");
|
||||
$SQLdate = date("Y-m-d H:i:s");
|
||||
@@ -13451,7 +13452,7 @@ if ($ADD==52)
|
||||
else
|
||||
{
|
||||
echo "<br><B>AGENT LOGOUT CONFIRMATION: $campaign_id</B>\n";
|
||||
echo "<br><br><a href=\"$PHP_SELF?ADD=62&campaign_id=$campaign_id&CoNfIrM=YES\">Click here to log all agents out of $campaign_id</a><br><br><br>\n";
|
||||
echo "<br><br><a href=\"$PHP_SELF?ADD=62&campaign_id=$campaign_id&CoNfIrM=YES&DB=$DB\">Click here to log all agents out of $campaign_id</a><br><br><br>\n";
|
||||
}
|
||||
|
||||
$ADD='31'; # go to campaign modification below
|
||||
@@ -14108,8 +14109,174 @@ if ($ADD==62)
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="DELETE from vicidial_live_agents where campaign_id='$campaign_id';";
|
||||
$now_date_epoch = date('U');
|
||||
$inactive_epoch = ($now_date_epoch - 60);
|
||||
$stmt = "SELECT user,campaign_id,UNIX_TIMESTAMP(last_update_time) from vicidial_live_agents where campaign_id='$campaign_id';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "<BR>$stmt\n";}
|
||||
$vla_ct = mysql_num_rows($rslt);
|
||||
$k=0;
|
||||
while ($vla_ct > $k)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$VLA_user[$k] = $row[0];
|
||||
$VLA_campaign_id[$k] = $row[1];
|
||||
$VLA_update_time[$k] = $row[2];
|
||||
$k++;
|
||||
}
|
||||
|
||||
$k=0;
|
||||
while ($vla_ct > $k)
|
||||
{
|
||||
if ($VLA_update_time[$k] > $inactive_epoch)
|
||||
{
|
||||
$lead_active=0;
|
||||
$stmt = "SELECT agent_log_id,user,server_ip,event_time,lead_id,campaign_id,pause_epoch,pause_sec,wait_epoch,wait_sec,talk_epoch,talk_sec,dispo_epoch,dispo_sec,status,user_group,comments,sub_status,dead_epoch,dead_sec from vicidial_agent_log where user='$VLA_user[$k]' order by agent_log_id desc LIMIT 1;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "<BR>$stmt\n";}
|
||||
$val_ct = mysql_num_rows($rslt);
|
||||
if ($val_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$VAL_agent_log_id = $row[0];
|
||||
$VAL_user = $row[1];
|
||||
$VAL_server_ip = $row[2];
|
||||
$VAL_event_time = $row[3];
|
||||
$VAL_lead_id = $row[4];
|
||||
$VAL_campaign_id = $row[5];
|
||||
$VAL_pause_epoch = $row[6];
|
||||
$VAL_pause_sec = $row[7];
|
||||
$VAL_wait_epoch = $row[8];
|
||||
$VAL_wait_sec = $row[9];
|
||||
$VAL_talk_epoch = $row[10];
|
||||
$VAL_talk_sec = $row[11];
|
||||
$VAL_dispo_epoch = $row[12];
|
||||
$VAL_dispo_sec = $row[13];
|
||||
$VAL_status = $row[14];
|
||||
$VAL_user_group = $row[15];
|
||||
$VAL_comments = $row[16];
|
||||
$VAL_sub_status = $row[17];
|
||||
$VAL_dead_epoch = $row[18];
|
||||
$VAL_dead_sec = $row[19];
|
||||
|
||||
if ($DB) {echo "\n<BR>VAL VALUES: $VAL_agent_log_id|$VAL_status|$VAL_lead_id\n";}
|
||||
|
||||
if ( ($VAL_wait_epoch < 1) || ( ($VAL_status == 'PAUSE') && ($VAL_dispo_epoch < 1) ) )
|
||||
{
|
||||
$VAL_pause_sec = ( ($now_date_epoch - $VAL_pause_epoch) + $VAL_pause_sec);
|
||||
$stmt = "UPDATE vicidial_agent_log SET wait_epoch='$now_date_epoch', pause_sec='$VAL_pause_sec' where agent_log_id='$VAL_agent_log_id';";
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($VAL_talk_epoch < 1)
|
||||
{
|
||||
$VAL_wait_sec = ( ($now_date_epoch - $VAL_wait_epoch) + $VAL_wait_sec);
|
||||
$stmt = "UPDATE vicidial_agent_log SET talk_epoch='$now_date_epoch', wait_sec='$VAL_wait_sec' where agent_log_id='$VAL_agent_log_id';";
|
||||
}
|
||||
else
|
||||
{
|
||||
$lead_active++;
|
||||
$status_update_SQL='';
|
||||
if ( ( (strlen($VAL_status) < 1) or ($VAL_status == 'NULL') ) and ($VAL_lead_id > 0) )
|
||||
{
|
||||
$status_update_SQL = ", status='PU'";
|
||||
$stmt="UPDATE vicidial_list SET status='PU' where lead_id='$VAL_lead_id';";
|
||||
if ($DB) {echo "<BR>$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
}
|
||||
if ($VAL_dispo_epoch < 1)
|
||||
{
|
||||
$VAL_talk_sec = ($now_date_epoch - $VAL_talk_epoch);
|
||||
$stmt = "UPDATE vicidial_agent_log SET dispo_epoch='$now_date_epoch', talk_sec='$VAL_talk_sec'$status_update_SQL where agent_log_id='$VAL_agent_log_id';";
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($VAL_dispo_sec < 1)
|
||||
{
|
||||
$VAL_dispo_sec = ($now_date_epoch - $VAL_dispo_epoch);
|
||||
$stmt = "UPDATE vicidial_agent_log SET dispo_sec='$VAL_dispo_sec' where agent_log_id='$VAL_agent_log_id';";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($DB) {echo "<BR>$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
}
|
||||
}
|
||||
|
||||
$stmt="DELETE from vicidial_live_agents where user='$VLA_user[$k]';";
|
||||
if ($DB) {echo "<BR>$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
|
||||
if (strlen($VAL_user_group) < 1)
|
||||
{
|
||||
$stmt = "SELECT user_group FROM vicidial_users where user='$VLA_user[$k]';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "<BR>$stmt\n";}
|
||||
$val_ct = mysql_num_rows($rslt);
|
||||
if ($val_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$VAL_user_group = $row[0];
|
||||
}
|
||||
}
|
||||
|
||||
$stmt = "INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$VLA_user[$k]','LOGOUT','$VLA_campaign_id[$k]','$NOW_TIME','$now_date_epoch','$VAL_user_group');";
|
||||
if ($DB) {echo "<BR>$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
|
||||
|
||||
#############################################
|
||||
##### START QUEUEMETRICS LOGGING LOOKUP #####
|
||||
$stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "<BR>$stmt\n";}
|
||||
$qm_conf_ct = mysql_num_rows($rslt);
|
||||
if ($qm_conf_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$enable_queuemetrics_logging = $row[0];
|
||||
$queuemetrics_server_ip = $row[1];
|
||||
$queuemetrics_dbname = $row[2];
|
||||
$queuemetrics_login = $row[3];
|
||||
$queuemetrics_pass = $row[4];
|
||||
$queuemetrics_log_id = $row[5];
|
||||
}
|
||||
##### END QUEUEMETRICS LOGGING LOOKUP #####
|
||||
###########################################
|
||||
if ($enable_queuemetrics_logging > 0)
|
||||
{
|
||||
$linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass");
|
||||
mysql_select_db("$queuemetrics_dbname", $linkB);
|
||||
|
||||
$agents='@agents';
|
||||
$agent_logged_in='';
|
||||
$time_logged_in='';
|
||||
|
||||
$stmtB = "SELECT agent,time_id FROM queue_log where agent='Agent/$VLA_user[$k]' and verb='AGENTLOGIN' order by time_id desc limit 1;";
|
||||
$rsltB=mysql_query($stmtB, $linkB);
|
||||
if ($DB) {echo "<BR>$stmtB\n";}
|
||||
$qml_ct = mysql_num_rows($rsltB);
|
||||
if ($qml_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rsltB);
|
||||
$agent_logged_in = $row[0];
|
||||
$time_logged_in = $row[1];
|
||||
}
|
||||
|
||||
$time_logged_in = ($now_date_epoch - $time_logged_in);
|
||||
if ($time_logged_in > 1000000) {$time_logged_in=1;}
|
||||
|
||||
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='NONE',queue='NONE',agent='$agent_logged_in',verb='AGENTLOGOFF',serverid='$queuemetrics_log_id',data1='$VLA_user[$k]$agents',data2='$time_logged_in';";
|
||||
if ($DB) {echo "<BR>$stmtB\n";}
|
||||
$rsltB=mysql_query($stmtB, $linkB);
|
||||
}
|
||||
|
||||
echo "<!-- Agent $VLA_user[$k] has been emergency logged out, make sure they close their web browser<BR> -->\n";
|
||||
|
||||
$k++;
|
||||
}
|
||||
|
||||
### LOG INSERTION Admin Log Table ###
|
||||
$SQL_log = "$stmt|";
|
||||
@@ -14175,7 +14342,7 @@ if ($ADD==63)
|
||||
if (eregi('IN',$stage))
|
||||
{$ADD='3111';}
|
||||
else
|
||||
{$ADD='31';}
|
||||
{$ADD='31';}
|
||||
}
|
||||
|
||||
|
||||
@@ -17054,8 +17221,8 @@ if ($ADD==31)
|
||||
if ($SUB < 1)
|
||||
{
|
||||
echo "<BR><BR>\n";
|
||||
echo "<a href=\"$PHP_SELF?ADD=52&campaign_id=$campaign_id\">LOG ALL AGENTS OUT OF THIS CAMPAIGN</a><BR><BR>\n";
|
||||
echo "<a href=\"$PHP_SELF?ADD=53&campaign_id=$campaign_id\">EMERGENCY VDAC CLEAR FOR THIS CAMPAIGN</a><BR><BR>\n";
|
||||
echo "<a href=\"$PHP_SELF?ADD=52&campaign_id=$campaign_id&DB=$DB\">LOG ALL AGENTS OUT OF THIS CAMPAIGN</a><BR><BR>\n";
|
||||
echo "<a href=\"$PHP_SELF?ADD=53&campaign_id=$campaign_id&DB=$DB\">EMERGENCY VDAC CLEAR FOR THIS CAMPAIGN</a><BR><BR>\n";
|
||||
|
||||
if ($LOGdelete_campaigns > 0)
|
||||
{
|
||||
@@ -17637,7 +17804,7 @@ if ($ADD==34)
|
||||
echo "</table></center><br>\n";
|
||||
|
||||
|
||||
echo "<a href=\"$PHP_SELF?ADD=52&campaign_id=$campaign_id\">LOG ALL AGENTS OUT OF THIS CAMPAIGN</a><BR><BR>\n";
|
||||
echo "<a href=\"$PHP_SELF?ADD=52&campaign_id=$campaign_id&DB=$DB\">LOG ALL AGENTS OUT OF THIS CAMPAIGN</a><BR><BR>\n";
|
||||
|
||||
|
||||
if ($LOGdelete_campaigns > 0)
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# 90508-0644 - Changed to PHP long tags
|
||||
# 91012-0536 - Added selected territories display
|
||||
# 91130-2039 - Added user closer log manager flag display
|
||||
# 91212-0656 - Added more complete logging of Emergency Logout process
|
||||
#
|
||||
|
||||
header ("Content-type: text/html; charset=utf-8");
|
||||
@@ -45,15 +46,13 @@ $stmt = "SELECT use_non_latin,webroot_writable,outbound_autodial_active,user_ter
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$qm_conf_ct = mysql_num_rows($rslt);
|
||||
$i=0;
|
||||
while ($i < $qm_conf_ct)
|
||||
if ($qm_conf_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
$webroot_writable = $row[1];
|
||||
$SSoutbound_autodial_active = $row[2];
|
||||
$user_territories_active = $row[3];
|
||||
$i++;
|
||||
}
|
||||
##### END SETTINGS LOOKUP #####
|
||||
###########################################
|
||||
@@ -89,7 +88,6 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if($auth>0)
|
||||
{
|
||||
$stmt="SELECT full_name,change_agent_campaign,modify_timeclock_log from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'";
|
||||
@@ -226,10 +224,170 @@ if ($stage == "live_campaign_change")
|
||||
##### EMERGENCY LOGOUT OF AN AGENT #####
|
||||
if ($stage == "log_agent_out")
|
||||
{
|
||||
$stmt="DELETE from vicidial_live_agents where user='" . mysql_real_escape_string($user) . "';";
|
||||
$now_date_epoch = date('U');
|
||||
$inactive_epoch = ($now_date_epoch - 60);
|
||||
$stmt = "SELECT user,campaign_id,UNIX_TIMESTAMP(last_update_time) from vicidial_live_agents where user='" . mysql_real_escape_string($user) . "';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "<BR>$stmt\n";}
|
||||
$vla_ct = mysql_num_rows($rslt);
|
||||
if ($vla_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$VLA_user = $row[0];
|
||||
$VLA_campaign_id = $row[1];
|
||||
$VLA_update_time = $row[2];
|
||||
|
||||
echo "Agent $user - $full_name has been emergency logged out, make sure they close their web browser<BR>\n";
|
||||
if ($VLA_update_time > $inactive_epoch)
|
||||
{
|
||||
$lead_active=0;
|
||||
$stmt = "SELECT agent_log_id,user,server_ip,event_time,lead_id,campaign_id,pause_epoch,pause_sec,wait_epoch,wait_sec,talk_epoch,talk_sec,dispo_epoch,dispo_sec,status,user_group,comments,sub_status,dead_epoch,dead_sec from vicidial_agent_log where user='$VLA_user' order by agent_log_id desc LIMIT 1;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "<BR>$stmt\n";}
|
||||
$val_ct = mysql_num_rows($rslt);
|
||||
if ($val_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$VAL_agent_log_id = $row[0];
|
||||
$VAL_user = $row[1];
|
||||
$VAL_server_ip = $row[2];
|
||||
$VAL_event_time = $row[3];
|
||||
$VAL_lead_id = $row[4];
|
||||
$VAL_campaign_id = $row[5];
|
||||
$VAL_pause_epoch = $row[6];
|
||||
$VAL_pause_sec = $row[7];
|
||||
$VAL_wait_epoch = $row[8];
|
||||
$VAL_wait_sec = $row[9];
|
||||
$VAL_talk_epoch = $row[10];
|
||||
$VAL_talk_sec = $row[11];
|
||||
$VAL_dispo_epoch = $row[12];
|
||||
$VAL_dispo_sec = $row[13];
|
||||
$VAL_status = $row[14];
|
||||
$VAL_user_group = $row[15];
|
||||
$VAL_comments = $row[16];
|
||||
$VAL_sub_status = $row[17];
|
||||
$VAL_dead_epoch = $row[18];
|
||||
$VAL_dead_sec = $row[19];
|
||||
|
||||
if ($DB) {echo "\n<BR>VAL VALUES: $VAL_agent_log_id|$VAL_status|$VAL_lead_id\n";}
|
||||
|
||||
if ( ($VAL_wait_epoch < 1) || ( ($VAL_status == 'PAUSE') && ($VAL_dispo_epoch < 1) ) )
|
||||
{
|
||||
$VAL_pause_sec = ( ($now_date_epoch - $VAL_pause_epoch) + $VAL_pause_sec);
|
||||
$stmt = "UPDATE vicidial_agent_log SET wait_epoch='$now_date_epoch', pause_sec='$VAL_pause_sec' where agent_log_id='$VAL_agent_log_id';";
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($VAL_talk_epoch < 1)
|
||||
{
|
||||
$VAL_wait_sec = ( ($now_date_epoch - $VAL_wait_epoch) + $VAL_wait_sec);
|
||||
$stmt = "UPDATE vicidial_agent_log SET talk_epoch='$now_date_epoch', wait_sec='$VAL_wait_sec' where agent_log_id='$VAL_agent_log_id';";
|
||||
}
|
||||
else
|
||||
{
|
||||
$lead_active++;
|
||||
$status_update_SQL='';
|
||||
if ( ( (strlen($VAL_status) < 1) or ($VAL_status == 'NULL') ) and ($VAL_lead_id > 0) )
|
||||
{
|
||||
$status_update_SQL = ", status='PU'";
|
||||
$stmt="UPDATE vicidial_list SET status='PU' where lead_id='$VAL_lead_id';";
|
||||
if ($DB) {echo "<BR>$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
}
|
||||
if ($VAL_dispo_epoch < 1)
|
||||
{
|
||||
$VAL_talk_sec = ($now_date_epoch - $VAL_talk_epoch);
|
||||
$stmt = "UPDATE vicidial_agent_log SET dispo_epoch='$now_date_epoch', talk_sec='$VAL_talk_sec'$status_update_SQL where agent_log_id='$VAL_agent_log_id';";
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($VAL_dispo_sec < 1)
|
||||
{
|
||||
$VAL_dispo_sec = ($now_date_epoch - $VAL_dispo_epoch);
|
||||
$stmt = "UPDATE vicidial_agent_log SET dispo_sec='$VAL_dispo_sec' where agent_log_id='$VAL_agent_log_id';";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($DB) {echo "<BR>$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
}
|
||||
}
|
||||
|
||||
$stmt="DELETE from vicidial_live_agents where user='" . mysql_real_escape_string($user) . "';";
|
||||
if ($DB) {echo "<BR>$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
|
||||
if (strlen($VAL_user_group) < 1)
|
||||
{
|
||||
$stmt = "SELECT user_group FROM vicidial_users where user='$VLA_user';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "<BR>$stmt\n";}
|
||||
$val_ct = mysql_num_rows($rslt);
|
||||
if ($val_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$VAL_user_group = $row[0];
|
||||
}
|
||||
}
|
||||
|
||||
$stmt = "INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$VLA_user','LOGOUT','$VLA_campaign_id','$NOW_TIME','$now_date_epoch','$VAL_user_group');";
|
||||
if ($DB) {echo "<BR>$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
|
||||
|
||||
#############################################
|
||||
##### START QUEUEMETRICS LOGGING LOOKUP #####
|
||||
$stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "<BR>$stmt\n";}
|
||||
$qm_conf_ct = mysql_num_rows($rslt);
|
||||
if ($qm_conf_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$enable_queuemetrics_logging = $row[0];
|
||||
$queuemetrics_server_ip = $row[1];
|
||||
$queuemetrics_dbname = $row[2];
|
||||
$queuemetrics_login = $row[3];
|
||||
$queuemetrics_pass = $row[4];
|
||||
$queuemetrics_log_id = $row[5];
|
||||
}
|
||||
##### END QUEUEMETRICS LOGGING LOOKUP #####
|
||||
###########################################
|
||||
if ($enable_queuemetrics_logging > 0)
|
||||
{
|
||||
$linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass");
|
||||
mysql_select_db("$queuemetrics_dbname", $linkB);
|
||||
|
||||
$agents='@agents';
|
||||
$agent_logged_in='';
|
||||
$time_logged_in='';
|
||||
|
||||
$stmtB = "SELECT agent,time_id FROM queue_log where agent='Agent/" . mysql_real_escape_string($user) . "' and verb='AGENTLOGIN' order by time_id desc limit 1;";
|
||||
$rsltB=mysql_query($stmtB, $linkB);
|
||||
if ($DB) {echo "<BR>$stmtB\n";}
|
||||
$qml_ct = mysql_num_rows($rsltB);
|
||||
if ($qml_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rsltB);
|
||||
$agent_logged_in = $row[0];
|
||||
$time_logged_in = $row[1];
|
||||
}
|
||||
|
||||
$time_logged_in = ($now_date_epoch - $time_logged_in);
|
||||
if ($time_logged_in > 1000000) {$time_logged_in=1;}
|
||||
|
||||
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='NONE',queue='NONE',agent='$agent_logged_in',verb='AGENTLOGOFF',serverid='$queuemetrics_log_id',data1='" . mysql_real_escape_string($user) . "$agents',data2='$time_logged_in';";
|
||||
if ($DB) {echo "<BR>$stmtB\n";}
|
||||
$rsltB=mysql_query($stmtB, $linkB);
|
||||
}
|
||||
|
||||
echo "Agent $user - $full_name has been emergency logged out, make sure they close their web browser<BR>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Agent $user is not logged in<BR>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user