diff --git a/agi/agi-VDAD_LB_transfer.agi b/agi/agi-VDAD_LB_transfer.agi index 68f5a410..140ab592 100644 --- a/agi/agi-VDAD_LB_transfer.agi +++ b/agi/agi-VDAD_LB_transfer.agi @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# agi-VDAD_LB_transfer.agi version 0.5 *DBI-version* +# agi-VDAD_LB_transfer.agi version 2.0.3 *DBI-version* # Load Balanced - when a call comes in on this server the script looks for an agent # on any server on the network on the same campaign to send call to. # @@ -23,17 +23,18 @@ # exten => 8365,2,AGI(agi-VDAD_LB_transfer.agi,${EXTEN}) # # -# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 # -# changes: -# 51118-2102 - first build based on agi-VDADtransfer.agi script -# 60119-1408 - fixed calleridname issue with 1.2 tree for custom CID +# CHANGELOG: +# 51118-2102 - First build based on agi-VDADtransfer.agi script +# 60119-1408 - Fixed calleridname issue with 1.2 tree for custom CID # 60503-1043 - Added safe harbor and drop second options from campaign -# 60731-1441 - changed to use DBI-DBD::mysql -# - changed to use /etc/astguiclient.conf for configs -# 60816-1034 - added output options check from database -# - changed look for agent every 0.5 second for first 4 sec on hold -# 60905-1047 - changed look for agent every 0.25 second for first 4 sec on hold +# 60731-1441 - Changed to use DBI-DBD::mysql +# - Changed to use /etc/astguiclient.conf for configs +# 60816-1034 - Added output options check from database +# - Changed look for agent every 0.5 second for first 4 sec on hold +# 60905-1047 - Changed look for agent every 0.25 second for first 4 sec on hold +# 70215-1052 - Added QueueMetrics optional logging # $script = 'agi-VDAD_LB_transfer.agi'; @@ -313,6 +314,53 @@ if ($affected_rows > 0) $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDAD : |$VDADlead_id|$CIDlead_id|insert to vicidial_log: $uniqueid"; &agi_output;} + + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id 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) + { + @aryA = $sthA->fetchrow_array; + $enable_queuemetrics_logging = "$aryA[0]"; + $queuemetrics_server_ip = "$aryA[1]"; + $queuemetrics_dbname = "$aryA[2]"; + $queuemetrics_login= "$aryA[3]"; + $queuemetrics_pass = "$aryA[4]"; + $queuemetrics_log_id = "$aryA[5]"; + $rec_count++; + } + $sthA->finish(); + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + $stmtA = "SELECT phone_number FROM vicidial_auto_calls where lead_id='$CIDlead_id';"; + $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) + { + @aryA = $sthA->fetchrow_array; + $phone_number = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + + $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='$callerid',queue='$VDADcampaign',agent='NONE',verb='ENTERQUEUE',data2='$phone_number',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $dbhB->disconnect(); + } } $drop_timer=0; @@ -423,6 +471,19 @@ if ($rec_countWAIT < $DBconcurrent_transfers) $dbhA->disconnect(); + if ($enable_queuemetrics_logging > 0) + { + $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='$callerid',queue='$VDADcampaign',agent='Agent/$VDADuser',verb='CONNECT',data1='$drop_timer',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $dbhB->disconnect(); + } + ### format the remote server dialstring to get the call to the overflow agent meetme room $S='*'; $VDADremDIALstr=''; @@ -514,6 +575,19 @@ if ($drop_seconds < 1) { $drop_seconds = $DROP_TIME; + if ($enable_queuemetrics_logging > 0) + { + $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='$callerid',queue='$VDADcampaign',agent='NONE',verb='EXITWITHTIMEOUT',data1='1',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $dbhB->disconnect(); + } + if ($safe_harbor_message =~ /Y/) { $DROPexten = "$safe_harbor_exten"; diff --git a/agi/agi-VDAD_LO_transfer.agi b/agi/agi-VDAD_LO_transfer.agi index 2344496f..77df92b7 100644 --- a/agi/agi-VDAD_LO_transfer.agi +++ b/agi/agi-VDAD_LO_transfer.agi @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# agi-VDAD_LO_transfer.agi version 0.5 *DBI-version* +# agi-VDAD_LO_transfer.agi version 2.0.3 *DBI-version* # Overflow Balanced - when a call comes in on this server the script looks for an agent # on this server to send call to. If none available it looks for the next available # agent on any other server on the network on the same campaign to send call to. @@ -24,17 +24,18 @@ # exten => 8365,2,AGI(agi-VDAD_LO_transfer.agi,${EXTEN}) # # -# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 # # changes: -# 51118-2102 - first build based on agi-VDADtransfer.agi script -# 60119-1408 - fixed calleridname issue with 1.2 tree for custom CID +# 51118-2102 - First build based on agi-VDADtransfer.agi script +# 60119-1408 - Fixed calleridname issue with 1.2 tree for custom CID # 60503-1048 - Added safe harbor and drop second options from campaign -# 60731-1441 - changed to use DBI-DBD::mysql -# - changed to use /etc/astguiclient.conf for configs -# 60816-1034 - added output options check from database -# - changed look for agent every 0.5 second for first 4 sec on hold -# 60905-1047 - changed look for agent every 0.25 second for first 4 sec on hold +# 60731-1441 - Changed to use DBI-DBD::mysql +# - Changed to use /etc/astguiclient.conf for configs +# 60816-1034 - Added output options check from database +# - Changed look for agent every 0.5 second for first 4 sec on hold +# 60905-1047 - Changed look for agent every 0.25 second for first 4 sec on hold +# 70215-1052 - Added QueueMetrics optional logging # $script = 'agi-VDAD_LO_transfer.agi'; @@ -313,6 +314,53 @@ if ($affected_rows > 0) $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDAD : |$VDADlead_id|$CIDlead_id|insert to vicidial_log: $uniqueid"; &agi_output;} + + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id 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) + { + @aryA = $sthA->fetchrow_array; + $enable_queuemetrics_logging = "$aryA[0]"; + $queuemetrics_server_ip = "$aryA[1]"; + $queuemetrics_dbname = "$aryA[2]"; + $queuemetrics_login= "$aryA[3]"; + $queuemetrics_pass = "$aryA[4]"; + $queuemetrics_log_id = "$aryA[5]"; + $rec_count++; + } + $sthA->finish(); + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + $stmtA = "SELECT phone_number FROM vicidial_auto_calls where lead_id='$CIDlead_id';"; + $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) + { + @aryA = $sthA->fetchrow_array; + $phone_number = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + + $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='$callerid',queue='$VDADcampaign',agent='NONE',verb='ENTERQUEUE',data2='$phone_number',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $dbhB->disconnect(); + } } $drop_timer=0; @@ -423,6 +471,19 @@ if ($rec_countWAIT < $concurrent_transfers) $dbhA->disconnect(); + if ($enable_queuemetrics_logging > 0) + { + $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='$callerid',queue='$VDADcampaign',agent='Agent/$VDADuser',verb='CONNECT',data1='$drop_timer',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $dbhB->disconnect(); + } + if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $VDADconf_exten"; &agi_output;} print "SET CONTEXT $ext_context\n"; checkresult($result); @@ -526,6 +587,19 @@ if ($rec_countWAITrem < $concurrent_transfers) $dbhA->disconnect(); + if ($enable_queuemetrics_logging > 0) + { + $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='$callerid',queue='$VDADcampaign',agent='Agent/$VDADuser',verb='CONNECT',data1='$drop_timer',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $dbhB->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+)/ ) @@ -616,6 +690,19 @@ if ($drop_seconds < 1) { $drop_seconds = $DROP_TIME; + if ($enable_queuemetrics_logging > 0) + { + $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='$callerid',queue='$VDADcampaign',agent='NONE',verb='EXITWITHTIMEOUT',data1='1',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $dbhB->disconnect(); + } + if ($safe_harbor_message =~ /Y/) { $DROPexten = "$safe_harbor_exten"; diff --git a/agi/agi-VDADtransfer.agi b/agi/agi-VDADtransfer.agi index 2172de9a..ea30d472 100644 --- a/agi/agi-VDADtransfer.agi +++ b/agi/agi-VDADtransfer.agi @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# agi-VDADtransfer.agi version 0.7 *DBI-version* +# agi-VDADtransfer.agi version 2.0.3 *DBI-version* # # runs when a call comes in from the VICIDIAL_auto_dialer. This script will # send the calls out to the reps that are logged in. @@ -14,19 +14,20 @@ # exten => 8365,1,AGI(call_log.agi,${EXTEN}) # exten => 8365,2,AGI(agi-VDADtransfer.agi,${EXTEN}) # -# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 # -# changes: -# 50322-1246 - changed callerid handling to allow for custom callerid -# 60119-1408 - fixed calleridname issue with 1.2 tree for custom CID +# CHANGELOG: +# 50322-1246 - Changed callerid handling to allow for custom callerid +# 60119-1408 - Fixed calleridname issue with 1.2 tree for custom CID # 60503-1054 - Added safe harbor and drop second options from campaign -# 60731-1441 - changed to use DBI-DBD::mysql -# - changed to use /etc/astguiclient.conf for configs -# 60816-1036 - added output options check from database -# - changed look for agent every 0.5 second for first 4 sec on hold -# 60905-1047 - changed look for agent every 0.25 second for first 4 sec on hold -# 70109-1715 - added option for concurrent_transfers -# +# 60731-1441 - Changed to use DBI-DBD::mysql +# - Changed to use /etc/astguiclient.conf for configs +# 60816-1036 - Added output options check from database +# - Changed look for agent every 0.5 second for first 4 sec on hold +# 60905-1047 - Changed look for agent every 0.25 second for first 4 sec on hold +# 70109-1715 - Added option for concurrent_transfers +# 70214-1214 - Added QueueMetrics optional logging +# $script = 'agi-VDADtransfer.agi'; diff --git a/agi/agi-VDADtransferSURVEY.agi b/agi/agi-VDADtransferSURVEY.agi index c390b710..e6ddad23 100644 --- a/agi/agi-VDADtransferSURVEY.agi +++ b/agi/agi-VDADtransferSURVEY.agi @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# agi-VDADtransferSURVEY.agi version 0.7 *DBI-version* +# agi-VDADtransferSURVEY.agi version 2.0.3 *DBI-version* # # runs when a call comes in from the VICIDIAL auto_dialer. This script will # send the calls out to the reps that are logged in if called person presses key. @@ -14,16 +14,17 @@ # exten => 8366,1,AGI(call_log.agi,${EXTEN}) # exten => 8366,2,AGI(agi-VDADtransferSURVEY.agi,${EXTEN}) # -# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 # -# CHANGES -# 60119-1408 - fixed calleridname issue with 1.2 tree for custom CID +# CHANGELOG +# 60119-1408 - Fixed calleridname issue with 1.2 tree for custom CID # 60503-1100 - Added safe harbor and drop second options from campaign -# 60731-1441 - changed to use DBI-DBD::mysql -# - changed to use /etc/astguiclient.conf for configs -# 60816-1034 - added output options check from database -# - changed look for agent every 0.5 second for first 4 sec on hold -# 60905-1047 - changed look for agent every 0.25 second for first 4 sec on hold +# 60731-1441 - Changed to use DBI-DBD::mysql +# - Changed to use /etc/astguiclient.conf for configs +# 60816-1034 - Added output options check from database +# - Changed look for agent every 0.5 second for first 4 sec on hold +# 60905-1047 - Changed look for agent every 0.25 second for first 4 sec on hold +# 70215-1052 - Added QueueMetrics optional logging # $script = 'agi-VDADtransferSURVEY.agi'; @@ -340,6 +341,53 @@ if ($affected_rows > 0) $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDAD : |$VDADlead_id|$CIDlead_id|insert to vicidial_log: $uniqueid"; &agi_output;} + + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id 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) + { + @aryA = $sthA->fetchrow_array; + $enable_queuemetrics_logging = "$aryA[0]"; + $queuemetrics_server_ip = "$aryA[1]"; + $queuemetrics_dbname = "$aryA[2]"; + $queuemetrics_login= "$aryA[3]"; + $queuemetrics_pass = "$aryA[4]"; + $queuemetrics_log_id = "$aryA[5]"; + $rec_count++; + } + $sthA->finish(); + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + $stmtA = "SELECT phone_number FROM vicidial_auto_calls where lead_id='$CIDlead_id';"; + $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) + { + @aryA = $sthA->fetchrow_array; + $phone_number = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + + $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='$callerid',queue='$VDADcampaign',agent='NONE',verb='ENTERQUEUE',data2='$phone_number',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $dbhB->disconnect(); + } } $drop_timer=0; @@ -454,6 +502,19 @@ if ($rec_countWAIT < $DBconcurrent_transfers) $dbhA->disconnect(); + if ($enable_queuemetrics_logging > 0) + { + $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='$callerid',queue='$VDADcampaign',agent='Agent/$VDADuser',verb='CONNECT',data1='$drop_timer',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $dbhB->disconnect(); + } + if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $VDADconf_exten"; &agi_output;} print "SET CONTEXT $ext_context\n"; checkresult($result); @@ -545,6 +606,19 @@ if ($drop_seconds < 1) { $drop_seconds = $DROP_TIME; + if ($enable_queuemetrics_logging > 0) + { + $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='$callerid',queue='$VDADcampaign',agent='NONE',verb='EXITWITHTIMEOUT',data1='1',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $dbhB->disconnect(); + } + if ($safe_harbor_message =~ /Y/) { $DROPexten = "$safe_harbor_exten"; diff --git a/agi/agi-VDADtransferTEST.agi b/agi/agi-VDADtransferTEST.agi index 367c2487..dd0268e4 100644 --- a/agi/agi-VDADtransferTEST.agi +++ b/agi/agi-VDADtransferTEST.agi @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# agi-VDADtransferTEST.agi version 0.6 *DBI-version* +# agi-VDADtransferTEST.agi version 2.0.3 *DBI-version* # # !!! This is only to be used for performance testing setups !!! # @@ -16,17 +16,18 @@ # exten => 8365,1,AGI(call_log.agi,${EXTEN}) # exten => 8365,2,AGI(agi-VDADtransfer.agi,${EXTEN}) # -# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 # -# changes: -# 50322-1246 - changed callerid handling to allow for custom callerid -# 60119-1408 - fixed calleridname issue with 1.2 tree for custom CID +# CHANGELOG: +# 50322-1246 - Changed callerid handling to allow for custom callerid +# 60119-1408 - Fixed calleridname issue with 1.2 tree for custom CID # 60503-1054 - Added safe harbor and drop second options from campaign -# 60731-1441 - changed to use DBI-DBD::mysql -# - changed to use /etc/astguiclient.conf for configs -# 60816-1036 - added output options check from database -# - changed look for agent every 0.5 second for first 4 sec on hold -# 60905-1047 - changed look for agent every 0.25 second for first 4 sec on hold +# 60731-1441 - Changed to use DBI-DBD::mysql +# - Changed to use /etc/astguiclient.conf for configs +# 60816-1036 - Added output options check from database +# - Changed look for agent every 0.5 second for first 4 sec on hold +# 60905-1047 - Changed look for agent every 0.25 second for first 4 sec on hold +# 70215-1052 - Added QueueMetrics optional logging # $script = 'agi-VDADtransfer.agi'; @@ -305,6 +306,53 @@ if ($affected_rows > 0) $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDAD : |$VDADlead_id|$CIDlead_id|insert to vicidial_log: $uniqueid"; &agi_output;} + + ############################################# + ##### START QUEUEMETRICS LOGGING LOOKUP ##### + $stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id 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) + { + @aryA = $sthA->fetchrow_array; + $enable_queuemetrics_logging = "$aryA[0]"; + $queuemetrics_server_ip = "$aryA[1]"; + $queuemetrics_dbname = "$aryA[2]"; + $queuemetrics_login= "$aryA[3]"; + $queuemetrics_pass = "$aryA[4]"; + $queuemetrics_log_id = "$aryA[5]"; + $rec_count++; + } + $sthA->finish(); + ##### END QUEUEMETRICS LOGGING LOOKUP ##### + ########################################### + if ($enable_queuemetrics_logging > 0) + { + $stmtA = "SELECT phone_number FROM vicidial_auto_calls where lead_id='$CIDlead_id';"; + $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) + { + @aryA = $sthA->fetchrow_array; + $phone_number = "$aryA[0]"; + $rec_count++; + } + $sthA->finish(); + + $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='$callerid',queue='$VDADcampaign',agent='NONE',verb='ENTERQUEUE',data2='$phone_number',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $dbhB->disconnect(); + } } $drop_timer=0; @@ -418,6 +466,19 @@ if ($rec_countWAIT < $DBconcurrent_transfers) $dbhA->disconnect(); + if ($enable_queuemetrics_logging > 0) + { + $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='$callerid',queue='$VDADcampaign',agent='Agent/$VDADuser',verb='CONNECT',data1='$drop_timer',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $dbhB->disconnect(); + } + if ($AGILOG) {$agi_string = "exiting the VDAD app, transferring call to $VDADconf_exten"; &agi_output;} print "SET CONTEXT $ext_context\n"; checkresult($result); @@ -496,6 +557,19 @@ if ($drop_seconds < 1) { $drop_seconds = $DROP_TIME; + if ($enable_queuemetrics_logging > 0) + { + $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='$callerid',queue='$VDADcampaign',agent='NONE',verb='EXITWITHTIMEOUT',data1='1',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + + $dbhB->disconnect(); + } + if ($safe_harbor_message =~ /Y/) { $DROPexten = "$safe_harbor_exten"; diff --git a/bin/AST_VDadapt.pl b/bin/AST_VDadapt.pl index e73e302e..dd7e9ac8 100644 --- a/bin/AST_VDadapt.pl +++ b/bin/AST_VDadapt.pl @@ -236,7 +236,7 @@ if ($DBX) {print "CONNECTED TO DATABASE: $VARDB_server|$VARDB_database\n";} ############################################# ##### START QUEUEMETRICS LOGGING LOOKUP ##### -$stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass FROM system_settings;"; +$stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -249,6 +249,7 @@ while ($sthArows > $rec_count) $queuemetrics_dbname = "$aryA[2]"; $queuemetrics_login = "$aryA[3]"; $queuemetrics_pass = "$aryA[4]"; + $queuemetrics_log_id = "$aryA[5]"; $rec_count++; } $sthA->finish(); @@ -260,7 +261,7 @@ if ($enable_queuemetrics_logging > 0) if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";} - $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secT',call_id='NONE',queue='NONE',agent='NONE',verb='QUEUESTART',serverid='1';"; + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secT',call_id='NONE',queue='NONE',agent='NONE',verb='QUEUESTART',serverid='$queuemetrics_log_id';"; $Baffected_rows = $dbhB->do($stmtB); $dbhB->disconnect();