diff --git a/agc_2-X/trunk/agi/VD_hangup.agi b/agc_2-X/trunk/agi/VD_hangup.agi index ea26776b..9fdd98c4 100644 --- a/agc_2-X/trunk/agi/VD_hangup.agi +++ b/agc_2-X/trunk/agi/VD_hangup.agi @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# VD_hangup.agi version 0.4 *DBI-version* +# VD_hangup.agi version 0.5 *DBI-version* # # NOTE: This script is only needed on Asterisk 1.2.X and higher systems # @@ -29,6 +29,7 @@ # 60719-1118 - changed to use DBI-DBD::mysql # - changed to use /etc/astguiclient.conf for configs # 60815-1210 - added output options check from database +# 60905-1113 - fixed Closer dropped call issue, added queue_seconds to VDCL # $script = 'VD_hangup.agi'; @@ -354,7 +355,7 @@ if (!$epc_countCUSTDATA) $sthArows=$sthA->rows; $epc_countCUSTDATA=0; $VD_closecallid=''; - while ($sthArows > $rec_countCUSTDATA) + while ($sthArows > $epc_countCUSTDATA) { @aryA = $sthA->fetchrow_array; $VD_start_epoch = "$aryA[0]"; @@ -397,9 +398,14 @@ if (length($VD_closecallid) < 1) if ($AGILOG) {$agi_string = "no VDCL record found: $uniqueid $calleridname $VD_lead_id $uniqueid"; &agi_output;} exit; } +if ($VD_status =~ /^DONE$|^INCALL$|^XFER$/) + {$VDCLSQL_status = "";} +else + {$VDCLSQL_status = "status='DROP',queue_seconds='$VD_seconds',";} + $VD_seconds = ($now_date_epoch - $VD_start_epoch); -$stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$VD_seconds' where closecallid = '$VD_closecallid';"; - if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} +$stmtA = "UPDATE vicidial_closer_log set $VDCLSQL_status end_epoch='$now_date_epoch',length_in_sec='$VD_seconds' where closecallid = '$VD_closecallid';"; + if ($AGILOG) {$agi_string = "|$VDCLSQL_status|$VD_status|\n|$stmtA|"; &agi_output;} $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDCL update: |$affected_rows|$uniqueid|$VD_closecallid|"; &agi_output;} diff --git a/agc_2-X/trunk/agi/agi-VDAD_LB_closer.agi b/agc_2-X/trunk/agi/agi-VDAD_LB_closer.agi index 2ed57094..c58674ef 100644 --- a/agc_2-X/trunk/agi/agi-VDAD_LB_closer.agi +++ b/agc_2-X/trunk/agi/agi-VDAD_LB_closer.agi @@ -414,8 +414,6 @@ if ($channel_status < 1) $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDXL XFER vicidial_xfer_log update: |$affected_rows|$CIDlead_id|$VDADuser\n|$stmtA|"; &agi_output;} - $dbhA->disconnect(); - ### format the remote server dialstring to get the call to the overflow agent meetme room $S='*'; $VDADremDIALstr=''; @@ -446,6 +444,12 @@ if ($channel_status < 1) if ($min < 10) {$min = "0$min";} if ($sec < 10) {$sec = "0$sec";} + $stmtA = "UPDATE vicidial_closer_log set queue_seconds='$drop_timer' where lead_id = '$CIDlead_id' and call_date='$SQLdate';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$CIDlead_id|\n|$stmtA|"; &agi_output;} + + $dbhA->disconnect(); + $now_date_epoch = time(); $now_date = "$year-$mon-$mday $hour:$min:$sec"; if ($AGILOG) {$agi_string = "XXXXX VDAD transferred: start|stop $start_time|$now_date"; &agi_output;} @@ -565,7 +569,7 @@ if ($drop_seconds < 1) $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDCL vac record deleted: |$affected_rows| $VDADcampaign|"; &agi_output;} - $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where lead_id = '$CIDlead_id' order by start_epoch desc limit 1;"; + $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds',queue_seconds='$drop_seconds' where lead_id = '$CIDlead_id' order by start_epoch desc limit 1;"; $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$CIDlead_id|\n|$stmtA|"; &agi_output;} diff --git a/agc_2-X/trunk/agi/agi-VDAD_LB_closer_inbound.agi b/agc_2-X/trunk/agi/agi-VDAD_LB_closer_inbound.agi index ae3705f3..12813b0d 100644 --- a/agc_2-X/trunk/agi/agi-VDAD_LB_closer_inbound.agi +++ b/agc_2-X/trunk/agi/agi-VDAD_LB_closer_inbound.agi @@ -463,8 +463,6 @@ if ($channel_status < 1) my $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- closer log : |$affected_rows|$new_lead_id\n|$stmtA|"; &agi_output;} - $dbhA->disconnect(); - ### format the remote server dialstring to get the call to the overflow agent meetme room $S='*'; if( ($VDADserver_ip =~ m/(\S+)\.(\S+)\.(\S+)\.(\S+)/) && ($VDADserver_ip !~ /$VARserver_ip/) ) @@ -494,6 +492,12 @@ if ($channel_status < 1) if ($min < 10) {$min = "0$min";} if ($sec < 10) {$sec = "0$sec";} + $stmtA = "UPDATE vicidial_closer_log set queue_seconds='$drop_timer' where lead_id = '$new_lead_id' and call_date='$SQLdate';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$new_lead_id|\n|$stmtA|"; &agi_output;} + + $dbhA->disconnect(); + $now_date_epoch = time(); $now_date = "$year-$mon-$mday $hour:$min:$sec"; if ($AGILOG) {$agi_string = "XXXXX VDAD transferred: start|stop $start_time|$now_date"; &agi_output;} @@ -615,7 +619,7 @@ if ($drop_seconds < 1) $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDCL vac record deleted: |$affected_rows| $VDADcampaign|"; &agi_output;} - $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where lead_id = '$new_lead_id' order by start_epoch desc limit 1;"; + $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds',queue_seconds='$drop_seconds' where lead_id = '$new_lead_id' order by start_epoch desc limit 1;"; $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$new_lead_id|\n|$stmtA|"; &agi_output;} diff --git a/agc_2-X/trunk/agi/agi-VDAD_LO_closer.agi b/agc_2-X/trunk/agi/agi-VDAD_LO_closer.agi index 8f531fba..b650dd1f 100644 --- a/agc_2-X/trunk/agi/agi-VDAD_LO_closer.agi +++ b/agc_2-X/trunk/agi/agi-VDAD_LO_closer.agi @@ -414,8 +414,6 @@ if ($channel_status < 1) $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDXL XFER vicidial_xfer_log update: |$affected_rows|$CIDlead_id|$VDADuser\n|$stmtA|"; &agi_output;} - $dbhA->disconnect(); - if ($AGILOG) {$agi_string = "exiting VDAD app, transferring call to $VDADconf_exten"; &agi_output;} print "SET CONTEXT $ext_context\n"; checkresult($result); @@ -433,6 +431,12 @@ if ($channel_status < 1) if ($min < 10) {$min = "0$min";} if ($sec < 10) {$sec = "0$sec";} + $stmtA = "UPDATE vicidial_closer_log set queue_seconds='$drop_timer' where lead_id = '$CIDlead_id' and call_date='$SQLdate';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$CIDlead_id|\n|$stmtA|"; &agi_output;} + + $dbhA->disconnect(); + $now_date_epoch = time(); $now_date = "$year-$mon-$mday $hour:$min:$sec"; if ($AGILOG) {$agi_string = "XXXXX VDAD transferred: start|stop $start_time|$now_date"; &agi_output;} @@ -499,8 +503,6 @@ if ($channel_status < 1) $stmtA = "UPDATE vicidial_xfer_log set closer='$VDADuser' where lead_id = '$CIDlead_id' order by call_date desc limit 1;"; my $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDXL vicidial_xfer_log update: |$affected_rows|$new_lead_id|$VDADuser\n|$stmtA|"; &agi_output;} - - $dbhA->disconnect(); ### format the remote server dialstring to get the call to the overflow agent meetme room $S='*'; @@ -531,6 +533,12 @@ if ($channel_status < 1) if ($min < 10) {$min = "0$min";} if ($sec < 10) {$sec = "0$sec";} + $stmtA = "UPDATE vicidial_closer_log set queue_seconds='$drop_timer' where lead_id = '$CIDlead_id' and call_date='$SQLdate';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$CIDlead_id|\n|$stmtA|"; &agi_output;} + + $dbhA->disconnect(); + $now_date_epoch = time(); $now_date = "$year-$mon-$mday $hour:$min:$sec"; if ($AGILOG) {$agi_string = "XXXXX VDAD transferred: start|stop $start_time|$now_date"; &agi_output;} @@ -650,7 +658,7 @@ if ($drop_seconds < 1) $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDCL vac record deleted: |$affected_rows| $VDADcampaign|"; &agi_output;} - $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where lead_id = '$CIDlead_id' order by start_epoch desc limit 1;"; + $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds',queue_seconds='$drop_seconds' where lead_id = '$CIDlead_id' order by start_epoch desc limit 1;"; $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$CIDlead_id|\n|$stmtA|"; &agi_output;} diff --git a/agc_2-X/trunk/agi/agi-VDAD_LO_closer_inbound.agi b/agc_2-X/trunk/agi/agi-VDAD_LO_closer_inbound.agi index c22cedc8..fa4ac35d 100644 --- a/agc_2-X/trunk/agi/agi-VDAD_LO_closer_inbound.agi +++ b/agc_2-X/trunk/agi/agi-VDAD_LO_closer_inbound.agi @@ -464,8 +464,6 @@ if ($channel_status < 1) my $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- closer log : |$affected_rows|$new_lead_id\n|$stmtA|"; &agi_output;} - $dbhA->disconnect(); - if ($AGILOG) {$agi_string = "exiting VDAD app, transferring call to $VDADconf_exten"; &agi_output;} print "SET CONTEXT $ext_context\n"; checkresult($result); @@ -483,6 +481,12 @@ if ($channel_status < 1) if ($min < 10) {$min = "0$min";} if ($sec < 10) {$sec = "0$sec";} + $stmtA = "UPDATE vicidial_closer_log set queue_seconds='$drop_timer' where lead_id = '$new_lead_id' and call_date='$SQLdate';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$new_lead_id|\n|$stmtA|"; &agi_output;} + + $dbhA->disconnect(); + $now_date_epoch = time(); $now_date = "$year-$mon-$mday $hour:$min:$sec"; if ($AGILOG) {$agi_string = "XXXXX VDAD transferred: start|stop $start_time|$now_date"; &agi_output;} @@ -553,8 +557,6 @@ if ($channel_status < 1) my $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- closer log : |$affected_rows|update of vcl table: $new_lead_id\n|$stmtA|"; &agi_output;} - $dbhA->disconnect(); - ### format the remote server dialstring to get the call to the overflow agent meetme room $S='*'; if( $VDADserver_ip =~ m/(\S+)\.(\S+)\.(\S+)\.(\S+)/ ) @@ -584,6 +586,12 @@ if ($channel_status < 1) if ($min < 10) {$min = "0$min";} if ($sec < 10) {$sec = "0$sec";} + $stmtA = "UPDATE vicidial_closer_log set queue_seconds='$drop_timer' where lead_id = '$new_lead_id' and call_date='$SQLdate';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$new_lead_id|\n|$stmtA|"; &agi_output;} + + $dbhA->disconnect(); + $now_date_epoch = time(); $now_date = "$year-$mon-$mday $hour:$min:$sec"; if ($AGILOG) {$agi_string = "XXXXX VDAD transferred: start|stop $start_time|$now_date"; &agi_output;} @@ -703,7 +711,7 @@ if ($drop_seconds < 1) $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDCL vac record deleted: |$affected_rows| $VDADcampaign|"; &agi_output;} - $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where lead_id = '$new_lead_id' order by start_epoch desc limit 1;"; + $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds',queue_seconds='$drop_seconds' where lead_id = '$new_lead_id' order by start_epoch desc limit 1;"; $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$new_lead_id|\n|$stmtA|"; &agi_output;} diff --git a/agc_2-X/trunk/agi/agi-VDADcloser.agi b/agc_2-X/trunk/agi/agi-VDADcloser.agi index 5f3f7799..7ca72602 100644 --- a/agc_2-X/trunk/agi/agi-VDADcloser.agi +++ b/agc_2-X/trunk/agi/agi-VDADcloser.agi @@ -408,8 +408,6 @@ if ($channel_status < 1) $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDXL XFER vicidial_xfer_log update: |$affected_rows|$CIDlead_id|$VDADuser\n|$stmtA|"; &agi_output;} - $dbhA->disconnect(); - if ($AGILOG) {$agi_string = "exiting VDAD app, transferring call to $VDADconf_exten"; &agi_output;} print "SET CONTEXT $ext_context\n"; checkresult($result); @@ -427,6 +425,12 @@ if ($channel_status < 1) if ($min < 10) {$min = "0$min";} if ($sec < 10) {$sec = "0$sec";} + $stmtA = "UPDATE vicidial_closer_log set queue_seconds='$drop_timer' where lead_id = '$CIDlead_id' and call_date='$SQLdate';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$CIDlead_id|\n|$stmtA|"; &agi_output;} + + $dbhA->disconnect(); + $now_date_epoch = time(); $now_date = "$year-$mon-$mday $hour:$min:$sec"; if ($AGILOG) {$agi_string = "XXXXX VDAD transferred: start|stop $start_time|$now_date"; &agi_output;} @@ -546,7 +550,7 @@ if ($drop_seconds < 1) $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDCL vac record deleted: |$affected_rows| $VDADcampaign|"; &agi_output;} - $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where lead_id = '$CIDlead_id' order by start_epoch desc limit 1;"; + $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds',queue_seconds='$drop_seconds' where lead_id = '$CIDlead_id' order by start_epoch desc limit 1;"; $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$CIDlead_id|\n|$stmtA|"; &agi_output;} diff --git a/agc_2-X/trunk/agi/agi-VDADcloser_PHONE.agi b/agc_2-X/trunk/agi/agi-VDADcloser_PHONE.agi index e52683e9..5991be29 100644 --- a/agc_2-X/trunk/agi/agi-VDADcloser_PHONE.agi +++ b/agc_2-X/trunk/agi/agi-VDADcloser_PHONE.agi @@ -452,8 +452,6 @@ if ($channel_status < 1) $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDXL XFER vicidial_xfer_log update: |$affected_rows|$CIDlead_id|$VDADuser\n|$stmtA|"; &agi_output;} - $dbhA->disconnect(); - if ($AGILOG) {$agi_string = "exiting VDAD app, transferring call to $VDADconf_exten"; &agi_output;} print "SET CONTEXT $ext_context\n"; checkresult($result); @@ -471,6 +469,12 @@ if ($channel_status < 1) if ($min < 10) {$min = "0$min";} if ($sec < 10) {$sec = "0$sec";} + $stmtA = "UPDATE vicidial_closer_log set queue_seconds='$drop_timer' where lead_id = '$CIDlead_id' and call_date='$SQLdate';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$CIDlead_id|\n|$stmtA|"; &agi_output;} + + $dbhA->disconnect(); + $now_date_epoch = time(); $now_date = "$year-$mon-$mday $hour:$min:$sec"; if ($AGILOG) {$agi_string = "XXXXX VDAD transferred: start|stop $start_time|$now_date"; &agi_output;} @@ -590,7 +594,7 @@ if ($drop_seconds < 1) $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDCL vac record deleted: |$affected_rows| $VDADcampaign|"; &agi_output;} - $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where lead_id = '$CIDlead_id' order by start_epoch desc limit 1;"; + $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds',queue_seconds='$drop_seconds' where lead_id = '$CIDlead_id' order by start_epoch desc limit 1;"; $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$CIDlead_id|\n|$stmtA|"; &agi_output;} diff --git a/agc_2-X/trunk/agi/agi-VDADcloser_inbound.agi b/agc_2-X/trunk/agi/agi-VDADcloser_inbound.agi index 3680a069..7e85c12e 100644 --- a/agc_2-X/trunk/agi/agi-VDADcloser_inbound.agi +++ b/agc_2-X/trunk/agi/agi-VDADcloser_inbound.agi @@ -462,8 +462,6 @@ if ($channel_status < 1) $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- closer log : |$affected_rows|$new_lead_id\n|$stmtA|"; &agi_output;} - $dbhA->disconnect(); - if ($AGILOG) {$agi_string = "exiting VDAD app, transferring call to $VDADconf_exten"; &agi_output;} print "SET CONTEXT $ext_context\n"; checkresult($result); @@ -481,6 +479,12 @@ if ($channel_status < 1) if ($min < 10) {$min = "0$min";} if ($sec < 10) {$sec = "0$sec";} + $stmtA = "UPDATE vicidial_closer_log set queue_seconds='$drop_timer' where lead_id = '$new_lead_id' and call_date='$SQLdate';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$new_lead_id|\n|$stmtA|"; &agi_output;} + + $dbhA->disconnect(); + $now_date_epoch = time(); $now_date = "$year-$mon-$mday $hour:$min:$sec"; if ($AGILOG) {$agi_string = "XXXXX VDAD transferred: start|stop $start_time|$now_date"; &agi_output;} @@ -600,7 +604,7 @@ if ($drop_seconds < 1) $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDCL vac record deleted: |$affected_rows| $VDADcampaign|"; &agi_output;} - $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where lead_id = '$new_lead_id' order by start_epoch desc limit 1;"; + $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds',queue_seconds='$drop_seconds' where lead_id = '$new_lead_id' order by start_epoch desc limit 1;"; $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$new_lead_id|\n|$stmtA|"; &agi_output;} diff --git a/agc_2-X/trunk/agi/agi-VDADcloser_inboundANI.agi b/agc_2-X/trunk/agi/agi-VDADcloser_inboundANI.agi index 0e2ac660..5d723c3d 100644 --- a/agc_2-X/trunk/agi/agi-VDADcloser_inboundANI.agi +++ b/agc_2-X/trunk/agi/agi-VDADcloser_inboundANI.agi @@ -447,8 +447,6 @@ if ($channel_status < 1) $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- closer log : |$affected_rows|$new_lead_id\n|$stmtA|"; &agi_output;} - $dbhA->disconnect(); - if ($AGILOG) {$agi_string = "exiting VDAD app, transferring call to $VDADconf_exten"; &agi_output;} print "SET CONTEXT $ext_context\n"; checkresult($result); @@ -466,6 +464,12 @@ if ($channel_status < 1) if ($min < 10) {$min = "0$min";} if ($sec < 10) {$sec = "0$sec";} + $stmtA = "UPDATE vicidial_closer_log set queue_seconds='$drop_timer' where lead_id = '$new_lead_id' and call_date='$SQLdate';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$new_lead_id|\n|$stmtA|"; &agi_output;} + + $dbhA->disconnect(); + $now_date_epoch = time(); $now_date = "$year-$mon-$mday $hour:$min:$sec"; if ($AGILOG) {$agi_string = "XXXXX VDAD transferred: start|stop $start_time|$now_date"; &agi_output;} @@ -585,7 +589,7 @@ if ($drop_seconds < 1) $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDCL vac record deleted: |$affected_rows| $VDADcampaign|"; &agi_output;} - $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where lead_id = '$new_lead_id' order by start_epoch desc limit 1;"; + $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds',queue_seconds='$drop_seconds' where lead_id = '$new_lead_id' order by start_epoch desc limit 1;"; $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$new_lead_id|\n|$stmtA|"; &agi_output;} diff --git a/agc_2-X/trunk/agi/agi-VDADcloser_inboundCID.agi b/agc_2-X/trunk/agi/agi-VDADcloser_inboundCID.agi index 9b82ecb6..f448d413 100644 --- a/agc_2-X/trunk/agi/agi-VDADcloser_inboundCID.agi +++ b/agc_2-X/trunk/agi/agi-VDADcloser_inboundCID.agi @@ -463,8 +463,6 @@ if ($channel_status < 1) $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- closer log : |$affected_rows|$new_lead_id\n|$stmtA|"; &agi_output;} - $dbhA->disconnect(); - if ($AGILOG) {$agi_string = "exiting VDAD app, transferring call to $VDADconf_exten"; &agi_output;} print "SET CONTEXT $ext_context\n"; checkresult($result); @@ -482,6 +480,12 @@ if ($channel_status < 1) if ($min < 10) {$min = "0$min";} if ($sec < 10) {$sec = "0$sec";} + $stmtA = "UPDATE vicidial_closer_log set queue_seconds='$drop_timer' where lead_id = '$new_lead_id' and call_date='$SQLdate';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$new_lead_id|\n|$stmtA|"; &agi_output;} + + $dbhA->disconnect(); + $now_date_epoch = time(); $now_date = "$year-$mon-$mday $hour:$min:$sec"; if ($AGILOG) {$agi_string = "XXXXX VDAD transferred: start|stop $start_time|$now_date"; &agi_output;} @@ -601,7 +605,7 @@ if ($drop_seconds < 1) $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDCL vac record deleted: |$affected_rows| $VDADcampaign|"; &agi_output;} - $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where lead_id = '$new_lead_id' order by start_epoch desc limit 1;"; + $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds',queue_seconds='$drop_seconds' where lead_id = '$new_lead_id' order by start_epoch desc limit 1;"; $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$new_lead_id|\n|$stmtA|"; &agi_output;} diff --git a/agc_2-X/trunk/agi/agi-VDADcloser_inboundCIDlookup.agi b/agc_2-X/trunk/agi/agi-VDADcloser_inboundCIDlookup.agi index c396fbc6..45103b90 100644 --- a/agc_2-X/trunk/agi/agi-VDADcloser_inboundCIDlookup.agi +++ b/agc_2-X/trunk/agi/agi-VDADcloser_inboundCIDlookup.agi @@ -485,8 +485,6 @@ if ($channel_status < 1) $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- closer log : |$affected_rows|$new_lead_id\n|$stmtA|"; &agi_output;} - $dbhA->disconnect(); - if ($AGILOG) {$agi_string = "exiting VDAD app, transferring call to $VDADconf_exten"; &agi_output;} print "SET CONTEXT $ext_context\n"; checkresult($result); @@ -504,6 +502,12 @@ if ($channel_status < 1) if ($min < 10) {$min = "0$min";} if ($sec < 10) {$sec = "0$sec";} + $stmtA = "UPDATE vicidial_closer_log set queue_seconds='$drop_timer' where lead_id = '$new_lead_id' and call_date='$SQLdate';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$new_lead_id|\n|$stmtA|"; &agi_output;} + + $dbhA->disconnect(); + $now_date_epoch = time(); $now_date = "$year-$mon-$mday $hour:$min:$sec"; if ($AGILOG) {$agi_string = "XXXXX VDAD transferred: start|stop $start_time|$now_date"; &agi_output;} @@ -623,7 +627,7 @@ if ($drop_seconds < 1) $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDCL vac record deleted: |$affected_rows| $VDADcampaign|"; &agi_output;} - $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where lead_id = '$new_lead_id' order by start_epoch desc limit 1;"; + $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds',queue_seconds='$drop_seconds' where lead_id = '$new_lead_id' order by start_epoch desc limit 1;"; $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$new_lead_id|\n|$stmtA|"; &agi_output;} diff --git a/agc_2-X/trunk/agi/agi-VDADcloser_inbound_5ID.agi b/agc_2-X/trunk/agi/agi-VDADcloser_inbound_5ID.agi index d8e50813..cd13fd54 100644 --- a/agc_2-X/trunk/agi/agi-VDADcloser_inbound_5ID.agi +++ b/agc_2-X/trunk/agi/agi-VDADcloser_inbound_5ID.agi @@ -460,8 +460,6 @@ if ($channel_status < 1) $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- closer log : |$affected_rows|$new_lead_id\n|$stmtA|"; &agi_output;} - $dbhA->disconnect(); - if ($AGILOG) {$agi_string = "exiting VDAD app, transferring call to $VDADconf_exten"; &agi_output;} print "SET CONTEXT $ext_context\n"; checkresult($result); @@ -479,6 +477,12 @@ if ($channel_status < 1) if ($min < 10) {$min = "0$min";} if ($sec < 10) {$sec = "0$sec";} + $stmtA = "UPDATE vicidial_closer_log set queue_seconds='$drop_timer' where lead_id = '$new_lead_id' and call_date='$SQLdate';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$new_lead_id|\n|$stmtA|"; &agi_output;} + + $dbhA->disconnect(); + $now_date_epoch = time(); $now_date = "$year-$mon-$mday $hour:$min:$sec"; if ($AGILOG) {$agi_string = "XXXXX VDAD transferred: start|stop $start_time|$now_date"; &agi_output;} @@ -598,7 +602,7 @@ if ($drop_seconds < 1) $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDCL vac record deleted: |$affected_rows| $VDADcampaign|"; &agi_output;} - $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where lead_id = '$new_lead_id' order by start_epoch desc limit 1;"; + $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds',queue_seconds='$drop_seconds' where lead_id = '$new_lead_id' order by start_epoch desc limit 1;"; $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$new_lead_id|\n|$stmtA|"; &agi_output;} diff --git a/agc_2-X/trunk/agi/agi-VDADcloser_inbound_NOCID.agi b/agc_2-X/trunk/agi/agi-VDADcloser_inbound_NOCID.agi index c756eac8..a64c4198 100644 --- a/agc_2-X/trunk/agi/agi-VDADcloser_inbound_NOCID.agi +++ b/agc_2-X/trunk/agi/agi-VDADcloser_inbound_NOCID.agi @@ -459,8 +459,6 @@ if ($channel_status < 1) $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- closer log : |$affected_rows|$new_lead_id\n|$stmtA|"; &agi_output;} - $dbhA->disconnect(); - if ($AGILOG) {$agi_string = "exiting VDAD app, transferring call to $VDADconf_exten"; &agi_output;} print "SET CONTEXT $ext_context\n"; checkresult($result); @@ -478,6 +476,12 @@ if ($channel_status < 1) if ($min < 10) {$min = "0$min";} if ($sec < 10) {$sec = "0$sec";} + $stmtA = "UPDATE vicidial_closer_log set queue_seconds='$drop_timer' where lead_id = '$new_lead_id' and call_date='$SQLdate';"; + $affected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$new_lead_id|\n|$stmtA|"; &agi_output;} + + $dbhA->disconnect(); + $now_date_epoch = time(); $now_date = "$year-$mon-$mday $hour:$min:$sec"; if ($AGILOG) {$agi_string = "XXXXX VDAD transferred: start|stop $start_time|$now_date"; &agi_output;} @@ -597,7 +601,7 @@ if ($drop_seconds < 1) $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDCL vac record deleted: |$affected_rows| $VDADcampaign|"; &agi_output;} - $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds' where lead_id = '$new_lead_id' order by start_epoch desc limit 1;"; + $stmtA = "UPDATE vicidial_closer_log set status='DROP',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds',queue_seconds='$drop_seconds' where lead_id = '$new_lead_id' order by start_epoch desc limit 1;"; $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$new_lead_id|\n|$stmtA|"; &agi_output;} diff --git a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql index 35a93d6f..7028396b 100644 --- a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql +++ b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql @@ -357,6 +357,7 @@ phone_number VARCHAR(12), user VARCHAR(20), comments VARCHAR(255), processed ENUM('Y','N'), +queue_seconds DECIMAL(7,2) default '0', index (lead_id), index (call_date) ); diff --git a/agc_2-X/trunk/extras/upgrade_2.0.1.sql b/agc_2-X/trunk/extras/upgrade_2.0.1.sql index f6209fe3..bc27592d 100644 --- a/agc_2-X/trunk/extras/upgrade_2.0.1.sql +++ b/agc_2-X/trunk/extras/upgrade_2.0.1.sql @@ -28,3 +28,5 @@ ALTER TABLE vicidial_campaigns ADD adaptive_dl_diff_target SMALLINT(3) default ' ALTER TABLE vicidial_campaign_stats ADD differential_onemin VARCHAR(20) default '0'; ALTER TABLE vicidial_campaign_stats ADD agents_average_onemin VARCHAR(20) default '0'; + +ALTER TABLE vicidial_closer_log ADD queue_seconds DECIMAL(7,2) default '0';