diff --git a/UPGRADE b/UPGRADE index a60bc7e0..bf1a9101 100644 --- a/UPGRADE +++ b/UPGRADE @@ -66,6 +66,11 @@ NOTE: Upgrading from 1.1.12-3 to 2.0.1 is at the bottom 15. Added Agent Pause Codes that are definable per campaign and allows the agent to select what they are doing when they are in pause time. +16. Added optional Asterisk-compatible queue_log logging for QueueMetrics + compatibility. See the QUEUEMETRICS.txt doc for more information + + + diff --git a/bin/FastAGI_log.pl b/bin/FastAGI_log.pl index 4f41b2c7..5e2376ce 100644 --- a/bin/FastAGI_log.pl +++ b/bin/FastAGI_log.pl @@ -621,6 +621,7 @@ sub process_request { ########################################### if ($enable_queuemetrics_logging > 0) { + $VD_agent='NONE'; $secX = time(); $VD_call_length = ($secX - $VD_start_epoch); $VD_stage =~ s/.*-//gi; @@ -631,7 +632,20 @@ sub process_request { 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='$VD_callerid',queue='$VD_campaign_id',agent='NONE',verb='COMPLETECALLER',data1='$VD_stage',data2='$VD_call_length',data3='1',serverid='$queuemetrics_log_id';"; + $stmtB = "SELECT agent from queue_log where call_id='$VD_callerid' and verb='CONNECT';"; + $sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr; + $sthB->execute or die "executing: $stmtB ", $dbhB->errstr; + $sthBrows=$sthB->rows; + $rec_count=0; + while ($sthBrows > $rec_count) + { + @aryB = $sthB->fetchrow_array; + $VD_agent = "$aryB[0]"; + $rec_count++; + } + $sthB->finish(); + + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='$VD_callerid',queue='$VD_campaign_id',agent='$VD_agent',verb='COMPLETECALLER',data1='$VD_stage',data2='$VD_call_length',data3='1',serverid='$queuemetrics_log_id';"; $Baffected_rows = $dbhB->do($stmtB); $dbhB->disconnect(); diff --git a/docs/QUEUEMETRICS.txt b/docs/QUEUEMETRICS.txt index a5be7ea1..de7c8c9a 100644 --- a/docs/QUEUEMETRICS.txt +++ b/docs/QUEUEMETRICS.txt @@ -1,5 +1,7 @@ VICIDIAL and QueueMetrics +queue_log logging was added to VICIDIAL outbound calling as an option in the 2.0.3 release tree. + This document goes over the features and needed changes made to VICIDIAL to enable it to insert activity records into the queue_log and other tables in MySQL that QueueMetrics uses for it's statistical analysis and reports. This document should not be taken as a HOWTO for proper installation steps to get QueueMetrics working. QueueMetrics is a closed-source, commercial product written by Loway Research in Italy. The writers of VICIDIAL do not support or warranty QueueMetrics or it's functionality with VICIDIAL in any way. diff --git a/www/agc/vdc_db_query.php b/www/agc/vdc_db_query.php index bfa049eb..0e75f2c9 100644 --- a/www/agc/vdc_db_query.php +++ b/www/agc/vdc_db_query.php @@ -122,10 +122,11 @@ # 70213-1431 - Added QueueMetrics PAUSE/UNPAUSE/AGENTLOGIN/AGENTLOGOFF actions # 70214-1231 - Added queuemetrics_log_id field for server_id in queue_log # 70215-1210 - Added queuemetrics COMPLETEAGENT action +# 70216-1051 - Fixed double call complete queuemetrics logging # -$version = '2.0.49'; -$build = '70215-1210'; +$version = '2.0.50'; +$build = '70216-1051'; require("dbconnect.php"); @@ -1021,18 +1022,30 @@ if ($stage == "end") $CLuniqueid = $row[9]; } - $CLstage = preg_replace("/XFER|-/",'',$CLstage); - if ($CLstage < 0.25) {$CLstage=0;} + $CLstage = preg_replace("/.*-/",'',$CLstage); + if (strlen($CLstage) < 1) {$CLstage=0;} $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='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',serverid='$queuemetrics_log_id';"; - if ($DB) {echo "$stmt\n";} - if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $stmt="SELECT count(*) from queue_log where call_id='$MDnextCID' and verb='COMPLETECALLER';"; $rslt=mysql_query($stmt, $linkB); - $affected_rows = mysql_affected_rows($linkB); + if ($DB) {echo "$stmt\n";} + $VAC_cc_ct = mysql_num_rows($rslt); + if ($VAC_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $caller_complete = $row[0]; + } + if ($caller_complete < 1) + { + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$campaign',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + } mysql_close($linkB); }