fixed double call end queue_log entry

git-svn-id: svn://192.168.202.10@529 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2007-02-16 15:56:59 +00:00
parent 780206251f
commit 8ac4b5803a
4 changed files with 43 additions and 9 deletions
+5
View File
@@ -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
+15 -1
View File
@@ -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();
+2
View File
@@ -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.
+21 -8
View File
@@ -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);
}