Added called_count logging to vicidial_log and vicidial_closer_log.

Fixed unanswered agent outbound call logging issue

git-svn-id: svn://192.168.202.10@2046 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2013-12-10 13:09:34 +00:00
parent f4ac431ad7
commit 3a32d5e993
8 changed files with 92 additions and 58 deletions
+9 -4
View File
@@ -115,6 +115,7 @@
# 130811-1403 - Fix for issue #690
# 131016-0659 - Fix for disable_auto_dial system option
# 131122-1233 - Added several missing sthA->finish
# 131209-1557 - Added called_count logging
#
@@ -1537,7 +1538,8 @@ while($one_day_interval > 0)
if ($insertVLcount < 1)
{
$xCLlist_id=0;
$stmtA="SELECT list_id from vicidial_list where lead_id='$CLlead_id' limit 1;";
$called_count=0;
$stmtA="SELECT list_id,called_count from vicidial_list where lead_id='$CLlead_id' limit 1;";
if ($DB) {$event_string = "|$stmtA|"; &event_logger;}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -1546,10 +1548,11 @@ while($one_day_interval > 0)
{
@aryA = $sthA->fetchrow_array;
$xCLlist_id = $aryA[0];
$called_count = $aryA[1];
}
$sthA->finish();
$stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed,length_in_sec,end_epoch,alt_dial,list_id) values('$CLuniqueid','$CLlead_id','$CLcampaign_id','$SQLdate','$now_date_epoch','$CLnew_status','$CLphone_code','$CLphone_number','$insertVLuser','N','$CLstage','$end_epoch','$CLalt_dial','$xCLlist_id')";
$stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed,length_in_sec,end_epoch,alt_dial,list_id,called_count) values('$CLuniqueid','$CLlead_id','$CLcampaign_id','$SQLdate','$now_date_epoch','$CLnew_status','$CLphone_code','$CLphone_number','$insertVLuser','N','$CLstage','$end_epoch','$CLalt_dial','$xCLlist_id','$called_count')";
if($M){print STDERR "\n|$stmtA|\n";}
$affected_rows = $dbhA->do($stmtA);
@@ -2329,7 +2332,8 @@ while($one_day_interval > 0)
if ( ($affected_rows > 0) && ($CLlead_id > 0) )
{
$xCLlist_id=0;
$stmtA="SELECT list_id from vicidial_list where lead_id='$CLlead_id' limit 1;";
$called_count=0;
$stmtA="SELECT list_id,called_count from vicidial_list where lead_id='$CLlead_id' limit 1;";
if ($DB) {$event_string = "|$stmtA|"; &event_logger;}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -2338,6 +2342,7 @@ while($one_day_interval > 0)
{
@aryA = $sthA->fetchrow_array;
$xCLlist_id = $aryA[0];
$called_count = $aryA[1];
}
$sthA->finish();
@@ -2348,7 +2353,7 @@ while($one_day_interval > 0)
if ($CLstage < 0.25) {$CLstage=0;}
$end_epoch = $now_date_epoch;
$stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed,length_in_sec,end_epoch,alt_dial,list_id) values('$CLuniqueid','$CLlead_id','$CLcampaign_id','$SQLdate','$now_date_epoch','DROP','$CLphone_code','$CLphone_number','VDAD','N','$CLstage','$end_epoch','$CLalt_dial','$xCLlist_id')";
$stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed,length_in_sec,end_epoch,alt_dial,list_id,called_count) values('$CLuniqueid','$CLlead_id','$CLcampaign_id','$SQLdate','$now_date_epoch','DROP','$CLphone_code','$CLphone_number','VDAD','N','$CLstage','$end_epoch','$CLalt_dial','$xCLlist_id','$called_count')";
if($M){print STDERR "\n|$stmtA|\n";}
$affected_rows = $dbhA->do($stmtA);
+11 -6
View File
@@ -68,6 +68,7 @@
# 130531-1619 - Fixed issue with busy agent login calls attempting to be logged
# 130802-0739 - Added CAMPCUST dialplan variable definition for outbound calls
# 130925-1820 - Added variable filter to prevent DID SQL injection attack
# 131209-1559 - Added called_count logging
#
# defaults for PreFork
@@ -957,7 +958,8 @@ sub process_request
if ($sthArows > 0)
{
$stmtA = "SELECT list_id FROM vicidial_list where lead_id='$VD_lead_id' limit 1;";
$called_count=0;
$stmtA = "SELECT list_id,called_count FROM vicidial_list where lead_id='$VD_lead_id' limit 1;";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -965,14 +967,15 @@ sub process_request
if ($sthArowsVLd > 0)
{
@aryA = $sthA->fetchrow_array;
$VD_list_id = $aryA[0];
$VD_list_id = $aryA[0];
$called_count = $aryA[1];
}
$sthA->finish();
$vl_commentsSQL = '';
if ($callerid =~ /^M\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/)
{$vl_commentsSQL=",comments='MANUAL'";}
$stmtA = "INSERT INTO vicidial_log SET uniqueid='$uniqueid',lead_id='$VD_lead_id',list_id='$VD_list_id',status='$VDL_status',campaign_id='$VD_campaign_id',call_date='$VD_call_time',start_epoch='$VD_start_epoch',phone_code='$VD_phone_code',phone_number='$VD_phone_number',user='VDAD',processed='N',length_in_sec='0',end_epoch='$VD_start_epoch',alt_dial='$VD_alt_dial' $vl_commentsSQL;";
$stmtA = "INSERT INTO vicidial_log SET uniqueid='$uniqueid',lead_id='$VD_lead_id',list_id='$VD_list_id',status='$VDL_status',campaign_id='$VD_campaign_id',call_date='$VD_call_time',start_epoch='$VD_start_epoch',phone_code='$VD_phone_code',phone_number='$VD_phone_number',user='VDAD',processed='N',length_in_sec='0',end_epoch='$VD_start_epoch',alt_dial='$VD_alt_dial',called_count='$called_count' $vl_commentsSQL;";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$VDLIaffected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VDAD vicidial_log insert: |$VDLIaffected_rows|$uniqueid|$CIDlead_id|$VDL_status|"; &agi_output;}
@@ -1284,7 +1287,8 @@ sub process_request
### BEGIN if call answers but has not reached routing AGI, then log as a PDROP
if ( ($callerid =~ /^V\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/) && ($VD_status =~ /SENT/) )
{
$stmtA = "SELECT list_id FROM vicidial_list where lead_id='$VD_lead_id' limit 1;";
$called_count = 0;
$stmtA = "SELECT list_id,called_count FROM vicidial_list where lead_id='$VD_lead_id' limit 1;";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
@@ -1292,7 +1296,8 @@ sub process_request
if ($sthArowsVLd > 0)
{
@aryA = $sthA->fetchrow_array;
$VD_list_id = $aryA[0];
$VD_list_id = $aryA[0];
$called_count = $aryA[1];
}
$sthA->finish();
@@ -1300,7 +1305,7 @@ sub process_request
$VLPDaffected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- PDROP vicidial_list update: |$VLPDaffected_rows|$uniqueid|$CIDlead_id|$VDL_status|"; &agi_output;}
$stmtA = "INSERT INTO vicidial_log SET uniqueid='$uniqueid',lead_id='$VD_lead_id',list_id='$VD_list_id',status='PDROP',campaign_id='$VD_campaign_id',call_date='$VD_call_time',start_epoch='$VD_start_epoch',phone_code='$VD_phone_code',phone_number='$VD_phone_number',user='VDAD',processed='N',length_in_sec='0',end_epoch='$VD_start_epoch',alt_dial='$VD_alt_dial';";
$stmtA = "INSERT INTO vicidial_log SET uniqueid='$uniqueid',lead_id='$VD_lead_id',list_id='$VD_list_id',status='PDROP',campaign_id='$VD_campaign_id',call_date='$VD_call_time',start_epoch='$VD_start_epoch',phone_code='$VD_phone_code',phone_number='$VD_phone_number',user='VDAD',processed='N',length_in_sec='0',end_epoch='$VD_start_epoch',alt_dial='$VD_alt_dial',called_count='$called_count';";
$VDLPDaffected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- PDROP vicidial_log insert: |$VDLPDaffected_rows|$uniqueid|$CIDlead_id|$VDL_status|"; &agi_output;}