Added queuemetrics_loginout option in system settings

git-svn-id: svn://192.168.202.10@1364 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2010-03-09 11:31:41 +00:00
parent 1d13a4fbc8
commit 57d8c45a38
11 changed files with 134 additions and 55 deletions
+15 -9
View File
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# AST_VDauto_dial.pl version 2.2.0 *DBI-version*
# AST_VDauto_dial.pl version 2.4
#
# DESCRIPTION:
# Places auto_dial calls on the VICIDIAL dialer system
@@ -25,7 +25,7 @@
# It is good practice to keep this program running by placing the associated
# KEEPALIVE script running every minute to ensure this program is always running
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGELOG:
# 50125-1201 - Changed dial timeout to 120 seconds from 180 seconds
@@ -88,6 +88,7 @@
# 91108-2122 - Added LAGGED PAUSEREASON QM entry for lagged agents
# 91123-1802 - Added outbound_autodial field, and exception for outbound-only agents on blended campaign
# 91213-1856 - Added queue_position to queue_log ABANDON records
# 100309-0551 - Added queuemetrics_loginout option
#
@@ -242,7 +243,7 @@ $event_string='LOGGED INTO MYSQL SERVER ON 1 CONNECTION|';
#############################################
##### START QUEUEMETRICS LOGGING LOOKUP #####
$stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,outbound_autodial_active FROM system_settings;";
$stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,outbound_autodial_active,queuemetrics_loginout FROM system_settings;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
@@ -256,6 +257,7 @@ if ($sthArows > 0)
$queuemetrics_pass = $aryA[4];
$queuemetrics_log_id = $aryA[5];
$outbound_autodial_active = $aryA[6];
$queuemetrics_loginout = $aryA[7];
}
$sthA->finish();
##### END QUEUEMETRICS LOGGING LOOKUP #####
@@ -1872,6 +1874,10 @@ while($one_day_interval > 0)
if ($enable_queuemetrics_logging > 0)
{
$QM_LOGOFF = 'AGENTLOGOFF';
if ($queuemetrics_loginout =~ /CALLBACK/)
{$QM_LOGOFF = 'AGENTCALLBACKLOGOFF';}
$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;
@@ -1880,7 +1886,7 @@ while($one_day_interval > 0)
$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;";
$stmtB = "SELECT time_id,data1 FROM queue_log where agent='Agent/$VALOuser[$logrun]' and verb IN('AGENTLOGIN','AGENTCALLBACKLOGIN') 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;
@@ -1888,6 +1894,7 @@ while($one_day_interval > 0)
{
@aryB = $sthB->fetchrow_array;
$time_logged_in = $aryB[0];
$phone_logged_in = $aryB[1];
}
$sthB->finish();
@@ -1895,7 +1902,7 @@ while($one_day_interval > 0)
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';";
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$LOGOFFtime',call_id='NONE',queue='NONE',agent='Agent/$VALOuser[$logrun]',verb='$QM_LOGOFF',serverid='$queuemetrics_log_id',data1='$phone_logged_in',data2='$time_logged_in';";
$Baffected_rows = $dbhB->do($stmtB);
$dbhB->disconnect();
@@ -2118,12 +2125,11 @@ while($one_day_interval > 0)
#############################################
##### START QUEUEMETRICS LOGGING LOOKUP #####
$stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;";
$stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_loginout FROM system_settings;";
$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;
$enable_queuemetrics_logging = $aryA[0];
@@ -2132,7 +2138,7 @@ while($one_day_interval > 0)
$queuemetrics_login= $aryA[3];
$queuemetrics_pass = $aryA[4];
$queuemetrics_log_id = $aryA[5];
$rec_count++;
$queuemetrics_loginout = $aryA[6];
}
$sthA->finish();
##### END QUEUEMETRICS LOGGING LOOKUP #####
+19 -10
View File
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# AST_VDremote_agents.pl version 2.2.0 *DBI-version*
# AST_VDremote_agents.pl version 2.4
#
# SUMMARY:
# This program was designed for people using the Asterisk PBX with VICIDIAL
@@ -16,7 +16,7 @@
# It is good practice to keep this program running by placing the associated
# KEEPALIVE script running every minute to ensure this program is always running
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGELOG:
# 50215-0954 - First version of script
@@ -36,6 +36,7 @@
# 90808-0247 - Added agent last_state_change field
# 91013-1128 - Added full inbound compatibility with vicidial_live_inbound_agents table
# 91123-1802 - Added outbound_autodial field
# 100309-0555 - Added queuemetrics_loginout option
#
### begin parsing run-time options ###
@@ -209,12 +210,11 @@ while($one_day_interval > 0)
#############################################
##### START QUEUEMETRICS LOGGING LOOKUP #####
$stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;";
$stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_loginout FROM system_settings;";
$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;
$enable_queuemetrics_logging = $aryA[0];
@@ -223,7 +223,7 @@ while($one_day_interval > 0)
$queuemetrics_login = $aryA[3];
$queuemetrics_pass = $aryA[4];
$queuemetrics_log_id = $aryA[5];
$rec_count++;
$queuemetrics_loginout = $aryA[6];
}
$sthA->finish();
##### END QUEUEMETRICS LOGGING LOOKUP #####
@@ -578,12 +578,16 @@ while($one_day_interval > 0)
{
if ($enable_queuemetrics_logging > 0)
{
$QM_LOGIN = 'AGENTLOGIN';
if ($queuemetrics_loginout =~ /CALLBACK/)
{$QM_LOGIN = 'AGENTCALLBACKLOGIN';}
$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";}
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='NONE',queue='$DBremote_campaign[$h]',agent='Agent/$DBremote_user[$h]',verb='AGENTLOGIN',data1='$DBremote_user[$h]$agents',serverid='$queuemetrics_log_id';";
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='NONE',queue='$DBremote_campaign[$h]',agent='Agent/$DBremote_user[$h]',verb='$QM_LOGIN',data1='$DBremote_user[$h]$agents',serverid='$queuemetrics_log_id';";
$Baffected_rows = $dbhB->do($stmtB);
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='NONE',queue='$DBremote_campaign[$h]',agent='Agent/$DBremote_user[$h]',verb='UNPAUSE',serverid='$queuemetrics_log_id';";
@@ -712,6 +716,10 @@ while($one_day_interval > 0)
{
if ($enable_queuemetrics_logging > 0)
{
$QM_LOGOFF = 'AGENTLOGOFF';
if ($queuemetrics_loginout =~ /CALLBACK/)
{$QM_LOGOFF = 'AGENTCALLBACKLOGOFF';}
$dbhB = DBI->connect("DBI:mysql:$queuemetrics_dbname:$queuemetrics_server_ip:3306", "$queuemetrics_login", "$queuemetrics_pass")
or die "Couldn't connect to database: " . DBI->errstr;
@@ -720,7 +728,7 @@ while($one_day_interval > 0)
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='NONE',queue='NONE',agent='Agent/$VD_user[$z]',verb='PAUSEALL',serverid='$queuemetrics_log_id';";
$Baffected_rows = $dbhB->do($stmtB);
$stmtB = "SELECT time_id FROM queue_log where agent='Agent/$VD_user[$z]' and verb='AGENTLOGIN' order by time_id desc limit 1;";
$stmtB = "SELECT time_id,data1 FROM queue_log where agent='Agent/$VD_user[$z]' and verb IN('AGENTLOGIN','AGENTCALLBACKLOGIN') order by time_id desc limit 1;";
$sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr;
$sthB->execute or die "executing: $stmtB ", $dbhB->errstr;
$sthBrows=$sthB->rows;
@@ -728,7 +736,8 @@ while($one_day_interval > 0)
while ($sthBrows > $rec_count)
{
@aryB = $sthB->fetchrow_array;
$logintime = $aryB[0];
$logintime = $aryB[0];
$phone_logged_in = $aryB[1];
$rec_count++;
}
$sthB->finish();
@@ -737,7 +746,7 @@ while($one_day_interval > 0)
$time_logged_in = ($secX - $logintime);
if ($time_logged_in > 1000000) {$time_logged_in=1;}
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='NONE',queue='$VD_campaign_id[$z]',agent='Agent/$VD_user[$z]',verb='AGENTLOGOFF',data1='$VD_user[$z]$agents',data2='$time_logged_in',serverid='$queuemetrics_log_id';";
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='NONE',queue='$VD_campaign_id[$z]',agent='Agent/$VD_user[$z]',verb='$QM_LOGOFF',data1='$phone_logged_in',data2='$time_logged_in',serverid='$queuemetrics_log_id';";
$Baffected_rows = $dbhB->do($stmtB);
$dbhB->disconnect();
+11 -9
View File
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# AST_cleanup_agent_log.pl version 2.2.0
# AST_cleanup_agent_log.pl version 2.4
#
# DESCRIPTION:
# to be run frequently to clean up the vicidial_agent_log to fix erroneous time
@@ -24,6 +24,7 @@
# 91210-0609 - Added LOGOFF queue_log correction during live call
# 91214-0933 - Added queue_position to queue_log COMPLETE... and ABANDON records
# 100203-1110 - Added fix for vicidial_closer_log records with 0 length
# 100309-0555 - Added queuemetrics_loginout option
#
# constants
@@ -251,7 +252,7 @@ or die "Couldn't connect to database: " . DBI->errstr;
#############################################
##### START QUEUEMETRICS LOGGING LOOKUP #####
$stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_eq_prepend FROM system_settings;";
$stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_eq_prepend,queuemetrics_loginout FROM system_settings;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
@@ -265,6 +266,7 @@ if ($sthArows > 0)
$queuemetrics_pass = $aryA[4];
$queuemetrics_log_id = $aryA[5];
$queuemetrics_eq_prepend = $aryA[6];
$queuemetrics_loginout = $aryA[7];
}
$sthA->finish();
##### END QUEUEMETRICS LOGGING LOOKUP #####
@@ -467,7 +469,7 @@ if ($enable_queuemetrics_logging > 0)
##############################################################
##### 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;";
$stmtB = "SELECT time_id,agent FROM queue_log where verb IN('AGENTLOGOFF','AGENTCALLBACKLOGOFF') $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;
@@ -510,7 +512,7 @@ if ($enable_queuemetrics_logging > 0)
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;";
$stmtB = "UPDATE queue_log SET time_id='$NEXTtimeLOGOFF' where agent='$agent[$h]' and time_id='$time_id[$h]' and verb IN('AGENTLOGOFF','AGENTCALLBACKLOGOFF') limit 1;";
if ($TEST < 1)
{
$Baffected_rows = $dbhB->do($stmtB);
@@ -547,7 +549,7 @@ if ( ($enable_queuemetrics_logging > 0) && ($login_lagged_check > 0) )
$PAUSEREASONinsert=0;
##############################################################
##### grab all queue_log entries for AGENTLOGIN verb to validate
$stmtB = "SELECT time_id,agent,verb,serverid FROM queue_log where verb='AGENTLOGIN' and serverid='$queuemetrics_log_id' $QM_SQL_time order by time_id;";
$stmtB = "SELECT time_id,agent,verb,serverid FROM queue_log where verb IN('AGENTLOGIN','AGENTCALLBACKLOGIN') and serverid='$queuemetrics_log_id' $QM_SQL_time order by time_id;";
$sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr;
$sthB->execute or die "executing: $stmtB ", $dbhB->errstr;
$EQ_records=$sthB->rows;
@@ -556,10 +558,10 @@ if ( ($enable_queuemetrics_logging > 0) && ($login_lagged_check > 0) )
while ($EQ_records > $h)
{
@aryB = $sthB->fetchrow_array;
$time_id[$h] = "$aryB[0]";
$agent[$h] = "$aryB[1]";
$verb[$h] = "$aryB[2]";
$serverid[$h] = "$aryB[3]";
$time_id[$h] = $aryB[0];
$agent[$h] = $aryB[1];
$verb[$h] = $aryB[2];
$serverid[$h] = $aryB[3];
$h++;
}
$sthB->finish();
+6 -2
View File
@@ -21,6 +21,8 @@ As of 2009-05-30, live montoring and playback of archived recordings through the
As of 2009-11-23, DID and IVR logging through QueueMetrics queue_log is now part of the code. DID entries for the queue will be counted only for calls that actually enter the queue or are sent to an agent through a ViciDial in-group. For IVR entries, only the last Call Menu will be counted in the QueueMetrics reports.
As of 2010-03-09, queuemetrics_loginout system settings option was added to allow for slightly different logging of logins and logouts. STANDARD will use standard AGENTLOGIN AGENTLOGOFF, CALLBACK will use AGENTCALLBACKLOGIN and AGENTCALLBACKLOGOFF that QM will parse differently.
Entries you should have in your crontab on one server:
### fix the vicidial_agent_log once every hour and the full day run at night
@@ -180,8 +182,10 @@ system actions - used by the AST_VDadapt.pl script when starting up
QUEUESTART
agent actions - used by vicidial.php, vdc_db_query.php and AST_VDremote_agents.pl
AGENTLOGIN(channel)
AGENTLOGOFF(channel|logintime)
AGENTLOGIN(agent phone channel)
AGENTLOGOFF(agent phone channel|logintime)
AGENTCALLBACKLOGIN(agent phone channel)
AGENTCALLBACKLOGOFF(agent phone channel|logintime)
PAUSEALL
PAUSE
UNPAUSEALL
@@ -1213,7 +1213,8 @@ webphone_url VARCHAR(255) default '',
static_agent_url VARCHAR(255) default '',
default_phone_code VARCHAR(8) default '1',
enable_agc_dispo_log ENUM('0','1') default '0',
custom_dialplan_entry TEXT
custom_dialplan_entry TEXT,
queuemetrics_loginout ENUM('STANDARD','CALLBACK') default 'STANDARD'
);
CREATE TABLE vicidial_campaigns_list_mix (
@@ -2076,7 +2077,7 @@ ALTER TABLE vicidial_agent_log_archive MODIFY agent_log_id INT(9) UNSIGNED NOT N
CREATE TABLE vicidial_carrier_log_archive LIKE vicidial_carrier_log;
UPDATE system_settings SET db_schema_version='1204',db_schema_update_date=NOW();
UPDATE system_settings SET db_schema_version='1205',db_schema_update_date=NOW();
GRANT RELOAD ON *.* TO cron@'%';
GRANT RELOAD ON *.* TO cron@localhost;
+4
View File
@@ -94,3 +94,7 @@ UPDATE system_settings SET db_schema_version='1203',db_schema_update_date=NOW();
ALTER TABLE vicidial_campaigns ADD scheduled_callbacks_alert ENUM('NONE','BLINK','RED','BLINK_RED') default 'NONE';
UPDATE system_settings SET db_schema_version='1204',db_schema_update_date=NOW();
ALTER TABLE system_settings ADD queuemetrics_loginout ENUM('STANDARD','CALLBACK') default 'STANDARD';
UPDATE system_settings SET db_schema_version='1205',db_schema_update_date=NOW();
@@ -38,6 +38,8 @@ When set to Y, this option allows you to use the security_phrase field in the vi
CUSTOM_CID will use the Custom CID that is defined in the security_phrase field of the vicidial_list table for the lead||
Scheduled Callbacks Alert||
This option allows the callbacks status line in the agent interface to be red, blink or blink red when there are AGENTONLY scheduled callbacks that have hit their trigger time and date. Default is NONE for standard status line||
QueueMetrics Login-Out||
This option affects how vicidial will log the logins and logouts of an agent in the queue_log. Default is STANDARD to use standard AGENTLOGIN AGENTLOGOFF, CALLBACK will use AGENTCALLBACKLOGIN and AGENTCALLBACKLOGOFF that QM will parse differently||
############################################################ CLIENT
+12 -5
View File
@@ -239,10 +239,11 @@
# 100220-1041 - Added CALLLOGview and LEADINFOview functions
# 100221-1105 - Added custom CID use compatibility
# 100301-1342 - Changed Available agents output for AGENTDIRECT selection
# 100309-0535 - Added queuemetrics_loginout option
#
$version = '2.4-146';
$build = '100301-1342';
$version = '2.4-147';
$build = '100309-0535';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=314;
$one_mysql_log=0;
@@ -4673,7 +4674,7 @@ if ($ACTION == 'userLOGout')
{
#############################################
##### START QUEUEMETRICS LOGGING LOOKUP #####
$stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,allow_sipsak_messages FROM system_settings;";
$stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,allow_sipsak_messages,queuemetrics_loginout FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00138',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
@@ -4688,6 +4689,7 @@ if ($ACTION == 'userLOGout')
$queuemetrics_pass = $row[4];
$queuemetrics_log_id = $row[5];
$allow_sipsak_messages = $row[6];
$queuemetrics_loginout = $row[7];
}
##### END QUEUEMETRICS LOGGING LOOKUP #####
###########################################
@@ -4699,6 +4701,10 @@ if ($ACTION == 'userLOGout')
if ($enable_queuemetrics_logging > 0)
{
$QM_LOGOFF = 'AGENTLOGOFF';
if ($queuemetrics_loginout=='CALLBACK')
{$QM_LOGOFF = 'AGENTCALLBACKLOGOFF';}
$linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass");
mysql_select_db("$queuemetrics_dbname", $linkB);
@@ -4708,7 +4714,7 @@ if ($ACTION == 'userLOGout')
# $rslt=mysql_query($stmt, $linkB);
# $affected_rows = mysql_affected_rows($linkB);
$stmt = "SELECT time_id FROM queue_log where agent='Agent/$user' and verb='AGENTLOGIN' order by time_id desc limit 1;";
$stmt = "SELECT time_id,data1 FROM queue_log where agent='Agent/$user' and verb IN('AGENTLOGIN','AGENTCALLBACKLOGIN') order by time_id desc limit 1;";
$rslt=mysql_query($stmt, $linkB);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00139',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
@@ -4719,13 +4725,14 @@ if ($ACTION == 'userLOGout')
{
$row=mysql_fetch_row($rslt);
$logintime = $row[0];
$loginphone = $row[1];
$i++;
}
$time_logged_in = ($StarTtime - $logintime);
if ($time_logged_in > 1000000) {$time_logged_in=1;}
$stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='AGENTLOGOFF',data1='$user$agents',data2='$time_logged_in',serverid='$queuemetrics_log_id';";
$stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='$QM_LOGOFF',data1='$loginphone',data2='$time_logged_in',serverid='$queuemetrics_log_id';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $linkB);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00140',$user,$server_ip,$session_name,$one_mysql_log);}
+23 -7
View File
@@ -281,10 +281,11 @@
# 100301-1330 - Changed AGENTDIRECT user selection launching to AGENTS link next to number-to-dial field
# 100302-2145 - Added scheduled callbacks alert feature
# 100306-0852 - Added options.php optional file for setting interface options that will survive upgrade
# 100309-0525 - Added queuemetrics_loginout option
#
$version = '2.4-259';
$build = '100306-0852';
$version = '2.4-260';
$build = '100309-0525';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=64;
$one_mysql_log=0;
@@ -1940,7 +1941,7 @@ else
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,vicidial_agent_disable,allow_sipsak_messages FROM system_settings;";
$stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,vicidial_agent_disable,allow_sipsak_messages,queuemetrics_loginout FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01040',$VD_login,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
@@ -1956,6 +1957,7 @@ else
$queuemetrics_log_id = $row[5];
$vicidial_agent_disable = $row[6];
$allow_sipsak_messages = $row[7];
$queuemetrics_loginout = $row[8];
}
##### END QUEUEMETRICS LOGGING LOOKUP #####
###########################################
@@ -2061,15 +2063,22 @@ else
if ($enable_queuemetrics_logging > 0)
{
$QM_LOGIN = 'AGENTLOGIN';
$QM_PHONE = "$VD_login@agents";
if ($queuemetrics_loginout=='CALLBACK')
{
$QM_LOGIN = 'AGENTCALLBACKLOGIN';
$QM_PHONE = "$SIP_user_DiaL";
}
$linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass");
mysql_select_db("$queuemetrics_dbname", $linkB);
$stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='AGENTLOGIN',data1='$VD_login@agents',serverid='$queuemetrics_log_id';";
$stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='$QM_LOGIN',data1='$QM_PHONE',serverid='$queuemetrics_log_id';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $linkB);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'01045',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$affected_rows = mysql_affected_rows($linkB);
echo "<!-- queue_log AGENTLOGIN entry added: $VD_login|$affected_rows -->\n";
echo "<!-- queue_log $QM_LOGIN entry added: $VD_login|$affected_rows|$QM_PHONE -->\n";
$stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSEALL',serverid='$queuemetrics_log_id';";
if ($DB) {echo "$stmt\n";}
@@ -2101,15 +2110,22 @@ else
if ($enable_queuemetrics_logging > 0)
{
$QM_LOGIN = 'AGENTLOGIN';
$QM_PHONE = "$VD_login@agents";
if ($queuemetrics_loginout=='CALLBACK')
{
$QM_LOGIN = 'AGENTCALLBACKLOGIN';
$QM_PHONE = "$SIP_user_DiaL";
}
$linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass");
mysql_select_db("$queuemetrics_dbname", $linkB);
$stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='$VD_campaign',agent='Agent/$VD_login',verb='AGENTLOGIN',data1='$VD_login@agents',serverid='$queuemetrics_log_id';";
$stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='$VD_campaign',agent='Agent/$VD_login',verb='$QM_LOGIN',data1='$QM_PHONE',serverid='$queuemetrics_log_id';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $linkB);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'01048',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$affected_rows = mysql_affected_rows($linkB);
echo "<!-- queue_log AGENTLOGIN entry added: $VD_login|$affected_rows -->\n";
echo "<!-- queue_log $QM_LOGIN entry added: $VD_login|$affected_rows|$QM_PHONE -->\n";
$stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSEALL',serverid='$queuemetrics_log_id';";
if ($DB) {echo "$stmt\n";}
+28 -7
View File
@@ -1193,6 +1193,8 @@ if (isset($_GET["use_custom_cid"])) {$use_custom_cid=$_GET["use_custom_cid"];
elseif (isset($_POST["use_custom_cid"])) {$use_custom_cid=$_POST["use_custom_cid"];}
if (isset($_GET["scheduled_callbacks_alert"])) {$scheduled_callbacks_alert=$_GET["scheduled_callbacks_alert"];}
elseif (isset($_POST["scheduled_callbacks_alert"])) {$scheduled_callbacks_alert=$_POST["scheduled_callbacks_alert"];}
if (isset($_GET["queuemetrics_loginout"])) {$queuemetrics_loginout=$_GET["queuemetrics_loginout"];}
elseif (isset($_POST["queuemetrics_loginout"])) {$queuemetrics_loginout=$_POST["queuemetrics_loginout"];}
if (isset($script_id)) {$script_id= strtoupper($script_id);}
@@ -1516,6 +1518,7 @@ if ($non_latin < 1)
$status_id = ereg_replace("[^0-9a-zA-Z]","",$status_id);
$agent_call_log_view = ereg_replace("[^0-9a-zA-Z]","",$agent_call_log_view);
$agent_call_log_view_override = ereg_replace("[^0-9a-zA-Z]","",$agent_call_log_view_override);
$queuemetrics_loginout = ereg_replace("[^0-9a-zA-Z]","",$queuemetrics_loginout);
### DIGITS and Dots
$server_ip = ereg_replace("[^\.0-9]","",$server_ip);
@@ -2094,11 +2097,12 @@ else
# 100220-1411 - Added system settings and servers custom_dialplan_entry
# 100221-0924 - Added Custom CallerID capability in Campaign settings
# 100302-2133 - Added Scheduled Callbacks Alert option
# 100309-0510 - Added queuemetrics_loginout option
#
# 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.4-242';
$build = '100302-2133';
$admin_version = '2.4-243';
$build = '100309-0510';
$STARTtime = date("U");
$SQLdate = date("Y-m-d H:i:s");
@@ -6103,6 +6107,11 @@ if ($ADD==99999)
<BR>
<B>QueueMetrics EnterQueue Prepend -</B> This field is used to allow for prepending of one of the vicidial_list data fields in front of the phone number of the customer for customized QueueMetrics reports. Default is NONE to not populate anything.
<BR>
<A NAME="settings-queuemetrics_loginout">
<BR>
<B>QueueMetrics Login-Out -</B> This option affects how vicidial will log the logins and logouts of an agent in the queue_log. Default is STANDARD to use standard AGENTLOGIN AGENTLOGOFF, CALLBACK will use AGENTCALLBACKLOGIN and AGENTCALLBACKLOGOFF that QM will parse differently.
<BR>
<A NAME="settings-enable_vtiger_integration">
<BR>
@@ -13532,7 +13541,7 @@ if ($ADD==411111111111111)
echo "<br>VICIDIAL SYSTEM SETTINGS MODIFIED\n";
$stmt="UPDATE system_settings set use_non_latin='$use_non_latin',webroot_writable='$webroot_writable',enable_queuemetrics_logging='$enable_queuemetrics_logging',queuemetrics_server_ip='$queuemetrics_server_ip',queuemetrics_dbname='$queuemetrics_dbname',queuemetrics_login='$queuemetrics_login',queuemetrics_pass='$queuemetrics_pass',queuemetrics_url='$queuemetrics_url',queuemetrics_log_id='$queuemetrics_log_id',queuemetrics_eq_prepend='$queuemetrics_eq_prepend',vicidial_agent_disable='$vicidial_agent_disable',allow_sipsak_messages='$allow_sipsak_messages',admin_home_url='$admin_home_url',enable_agc_xfer_log='$enable_agc_xfer_log',timeclock_end_of_day='$timeclock_end_of_day',vdc_header_date_format='$vdc_header_date_format',vdc_customer_date_format='$vdc_customer_date_format',vdc_header_phone_format='$vdc_header_phone_format',vdc_agent_api_active='$vdc_agent_api_active',enable_vtiger_integration='$enable_vtiger_integration',vtiger_server_ip='$vtiger_server_ip',vtiger_dbname='$vtiger_dbname',vtiger_login='$vtiger_login',vtiger_pass='$vtiger_pass',vtiger_url='$vtiger_url',qc_features_active='$qc_features_active',outbound_autodial_active='$outbound_autodial_active',outbound_calls_per_second='$outbound_calls_per_second',enable_tts_integration='$enable_tts_integration',agentonly_callback_campaign_lock='$agentonly_callback_campaign_lock',sounds_central_control_active='$sounds_central_control_active',sounds_web_server='$sounds_web_server',sounds_web_directory='$sounds_web_directory',active_voicemail_server='$active_voicemail_server',auto_dial_limit='$auto_dial_limit',user_territories_active='$user_territories_active',allow_custom_dialplan='$allow_custom_dialplan',enable_second_webform='$enable_second_webform',default_webphone='$default_webphone',default_external_server_ip='$default_external_server_ip',webphone_url='$webphone_url',enable_agc_dispo_log='$enable_agc_dispo_log',custom_dialplan_entry='$custom_dialplan_entry';";
$stmt="UPDATE system_settings set use_non_latin='$use_non_latin',webroot_writable='$webroot_writable',enable_queuemetrics_logging='$enable_queuemetrics_logging',queuemetrics_server_ip='$queuemetrics_server_ip',queuemetrics_dbname='$queuemetrics_dbname',queuemetrics_login='$queuemetrics_login',queuemetrics_pass='$queuemetrics_pass',queuemetrics_url='$queuemetrics_url',queuemetrics_log_id='$queuemetrics_log_id',queuemetrics_eq_prepend='$queuemetrics_eq_prepend',vicidial_agent_disable='$vicidial_agent_disable',allow_sipsak_messages='$allow_sipsak_messages',admin_home_url='$admin_home_url',enable_agc_xfer_log='$enable_agc_xfer_log',timeclock_end_of_day='$timeclock_end_of_day',vdc_header_date_format='$vdc_header_date_format',vdc_customer_date_format='$vdc_customer_date_format',vdc_header_phone_format='$vdc_header_phone_format',vdc_agent_api_active='$vdc_agent_api_active',enable_vtiger_integration='$enable_vtiger_integration',vtiger_server_ip='$vtiger_server_ip',vtiger_dbname='$vtiger_dbname',vtiger_login='$vtiger_login',vtiger_pass='$vtiger_pass',vtiger_url='$vtiger_url',qc_features_active='$qc_features_active',outbound_autodial_active='$outbound_autodial_active',outbound_calls_per_second='$outbound_calls_per_second',enable_tts_integration='$enable_tts_integration',agentonly_callback_campaign_lock='$agentonly_callback_campaign_lock',sounds_central_control_active='$sounds_central_control_active',sounds_web_server='$sounds_web_server',sounds_web_directory='$sounds_web_directory',active_voicemail_server='$active_voicemail_server',auto_dial_limit='$auto_dial_limit',user_territories_active='$user_territories_active',allow_custom_dialplan='$allow_custom_dialplan',enable_second_webform='$enable_second_webform',default_webphone='$default_webphone',default_external_server_ip='$default_external_server_ip',webphone_url='$webphone_url',enable_agc_dispo_log='$enable_agc_dispo_log',custom_dialplan_entry='$custom_dialplan_entry',queuemetrics_loginout='$queuemetrics_loginout';";
$rslt=mysql_query($stmt, $link);
### LOG INSERTION Admin Log Table ###
@@ -14605,7 +14614,7 @@ if ($ADD==62)
#############################################
##### START QUEUEMETRICS LOGGING LOOKUP #####
$stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;";
$stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_loginout FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "<BR>$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -14618,11 +14627,16 @@ if ($ADD==62)
$queuemetrics_login = $row[3];
$queuemetrics_pass = $row[4];
$queuemetrics_log_id = $row[5];
$queuemetrics_loginout = $row[6];
}
##### END QUEUEMETRICS LOGGING LOOKUP #####
###########################################
if ($enable_queuemetrics_logging > 0)
{
$QM_LOGOFF = 'AGENTLOGOFF';
if ($queuemetrics_loginout=='CALLBACK')
{$QM_LOGOFF = 'AGENTCALLBACKLOGOFF';}
$linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass");
mysql_select_db("$queuemetrics_dbname", $linkB);
@@ -14630,7 +14644,7 @@ if ($ADD==62)
$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;";
$stmtB = "SELECT agent,time_id,data1 FROM queue_log where agent='Agent/$VLA_user[$k]' and verb IN('AGENTLOGIN','AGENTCALLBACKLOGIN') order by time_id desc limit 1;";
$rsltB=mysql_query($stmtB, $linkB);
if ($DB) {echo "<BR>$stmtB\n";}
$qml_ct = mysql_num_rows($rsltB);
@@ -14639,12 +14653,13 @@ if ($ADD==62)
$row=mysql_fetch_row($rsltB);
$agent_logged_in = $row[0];
$time_logged_in = $row[1];
$phone_logged_in = $row[2];
}
$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';";
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='NONE',queue='NONE',agent='$agent_logged_in',verb='$QM_LOGOFF',serverid='$queuemetrics_log_id',data1='$phone_logged_in',data2='$time_logged_in';";
if ($DB) {echo "<BR>$stmtB\n";}
$rsltB=mysql_query($stmtB, $linkB);
}
@@ -22483,7 +22498,7 @@ if ($ADD==311111111111111)
echo "<TABLE><TR><TD>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
$stmt="SELECT version,install_date,use_non_latin,webroot_writable,enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_url,queuemetrics_log_id,queuemetrics_eq_prepend,vicidial_agent_disable,allow_sipsak_messages,admin_home_url,enable_agc_xfer_log,db_schema_version,auto_user_add_value,timeclock_end_of_day,timeclock_last_reset_date,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,vdc_agent_api_active,qc_last_pull_time,enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url,qc_features_active,outbound_autodial_active,outbound_calls_per_second,enable_tts_integration,agentonly_callback_campaign_lock,sounds_central_control_active,sounds_web_server,sounds_web_directory,active_voicemail_server,auto_dial_limit,user_territories_active,allow_custom_dialplan,db_schema_update_date,enable_second_webform,default_webphone,default_external_server_ip,webphone_url,enable_agc_dispo_log,custom_dialplan_entry from system_settings;";
$stmt="SELECT version,install_date,use_non_latin,webroot_writable,enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_url,queuemetrics_log_id,queuemetrics_eq_prepend,vicidial_agent_disable,allow_sipsak_messages,admin_home_url,enable_agc_xfer_log,db_schema_version,auto_user_add_value,timeclock_end_of_day,timeclock_last_reset_date,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,vdc_agent_api_active,qc_last_pull_time,enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url,qc_features_active,outbound_autodial_active,outbound_calls_per_second,enable_tts_integration,agentonly_callback_campaign_lock,sounds_central_control_active,sounds_web_server,sounds_web_directory,active_voicemail_server,auto_dial_limit,user_territories_active,allow_custom_dialplan,db_schema_update_date,enable_second_webform,default_webphone,default_external_server_ip,webphone_url,enable_agc_dispo_log,custom_dialplan_entry,queuemetrics_loginout from system_settings;";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$version = $row[0];
@@ -22536,6 +22551,7 @@ if ($ADD==311111111111111)
$webphone_url = $row[47];
$enable_agc_dispo_log = $row[48];
$custom_dialplan_entry = $row[49];
$queuemetrics_loginout = $row[50];
echo "<br>MODIFY VICIDIAL SYSTEM SETTINGS<form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=ADD value=411111111111111>\n";
@@ -22716,6 +22732,11 @@ if ($ADD==311111111111111)
echo "<option value=\"security_phrase\">security_phrase</option>\n";
echo "<option selected value=\"$queuemetrics_eq_prepend\">$queuemetrics_eq_prepend</option>\n";
echo "</select>$NWB#settings-queuemetrics_eq_prepend$NWE</td></tr>\n";
echo "<tr bgcolor=#99FFCC><td align=right>QueueMetrics Login-Out: </td><td align=left><select size=1 name=queuemetrics_loginout>\n";
echo "<option value=\"STANDARD\">STANDARD</option>\n";
echo "<option value=\"CALLBACK\">CALLBACK</option>\n";
echo "<option selected value=\"$queuemetrics_loginout\">$queuemetrics_loginout</option>\n";
echo "</select>$NWB#settings-queuemetrics_loginout$NWE</td></tr>\n";
echo "<tr bgcolor=#CCFFFF><td align=right>Enable Vtiger Integration: </td><td align=left><select size=1 name=enable_vtiger_integration><option>1</option><option>0</option><option selected>$enable_vtiger_integration</option></select>$NWB#settings-enable_vtiger_integration$NWE\n";
echo " &nbsp; <a href=\"./vtiger_user.php\" target=\"_blank\">Click here to Synchronize users with Vtiger</a>\n";
+11 -4
View File
@@ -1,7 +1,7 @@
<?php
# user_status.php
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGES
#
@@ -14,6 +14,7 @@
# 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
# 100309-0544 - Added queuemetrics_loginout option
#
header ("Content-type: text/html; charset=utf-8");
@@ -338,7 +339,7 @@ if ($stage == "log_agent_out")
#############################################
##### START QUEUEMETRICS LOGGING LOOKUP #####
$stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;";
$stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_loginout FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "<BR>$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -351,11 +352,16 @@ if ($stage == "log_agent_out")
$queuemetrics_login = $row[3];
$queuemetrics_pass = $row[4];
$queuemetrics_log_id = $row[5];
$queuemetrics_loginout = $row[6];
}
##### END QUEUEMETRICS LOGGING LOOKUP #####
###########################################
if ($enable_queuemetrics_logging > 0)
{
$QM_LOGOFF = 'AGENTLOGOFF';
if ($queuemetrics_loginout=='CALLBACK')
{$QM_LOGOFF = 'AGENTCALLBACKLOGOFF';}
$linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass");
mysql_select_db("$queuemetrics_dbname", $linkB);
@@ -363,7 +369,7 @@ if ($stage == "log_agent_out")
$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;";
$stmtB = "SELECT agent,time_id,data1 FROM queue_log where agent='Agent/" . mysql_real_escape_string($user) . "' and verb IN('AGENTLOGIN','AGENTCALLBACKLOGIN') order by time_id desc limit 1;";
$rsltB=mysql_query($stmtB, $linkB);
if ($DB) {echo "<BR>$stmtB\n";}
$qml_ct = mysql_num_rows($rsltB);
@@ -372,12 +378,13 @@ if ($stage == "log_agent_out")
$row=mysql_fetch_row($rsltB);
$agent_logged_in = $row[0];
$time_logged_in = $row[1];
$phone_logged_in = $row[2];
}
$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';";
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='NONE',queue='NONE',agent='$agent_logged_in',verb='$QM_LOGOFF',serverid='$queuemetrics_log_id',data1='$phone_logged_in',data2='$time_logged_in';";
if ($DB) {echo "<BR>$stmtB\n";}
$rsltB=mysql_query($stmtB, $linkB);
}