From b11ff67093ae2b99282507b2efdf0c319010518c Mon Sep 17 00:00:00 2001 From: mattf Date: Wed, 25 Nov 2009 01:34:52 +0000 Subject: [PATCH] Fixing of issues with blended campaigns and outbound autodialing git-svn-id: svn://192.168.202.10@1264 3d104415-ff17-0410-8863-d5cf3c621b8a --- agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl | 2 +- agc_2-X/trunk/bin/AST_VDauto_dial.pl | 248 +++++++++++------- agc_2-X/trunk/bin/AST_VDremote_agents.pl | 32 ++- .../trunk/extras/MySQL_AST_CREATE_tables.sql | 4 +- agc_2-X/trunk/extras/upgrade_2.2.0.sql | 5 + agc_2-X/trunk/www/agc/vdc_db_query.php | 21 +- agc_2-X/trunk/www/agc/vicidial.php | 11 +- 7 files changed, 207 insertions(+), 116 deletions(-) diff --git a/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl b/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl index c3323cb8..40ba1e81 100644 --- a/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl +++ b/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl @@ -444,7 +444,7 @@ if ( ($AST_VDremote_agents > 0) && ($runningAST_VDremote_agents < 1) ) { if ($DB) {print "starting AST_VDremote_agents...\n";} # add a '-L' to the command below to activate logging - `/usr/bin/screen -d -m -S ASTVDremote $PATHhome/AST_VDremote_agents.pl`; + `/usr/bin/screen -d -m -S ASTVDremote $PATHhome/AST_VDremote_agents.pl --debug`; } if ( ($AST_VDadapt > 0) && ($runningAST_VDadapt < 1) ) { diff --git a/agc_2-X/trunk/bin/AST_VDauto_dial.pl b/agc_2-X/trunk/bin/AST_VDauto_dial.pl index 66e9e74a..5c2c9a90 100644 --- a/agc_2-X/trunk/bin/AST_VDauto_dial.pl +++ b/agc_2-X/trunk/bin/AST_VDauto_dial.pl @@ -86,6 +86,7 @@ # 90924-0914 - Added List callerid override option # 91026-1218 - Added AREACODE DNC option # 91108-2122 - Added LAGGED PAUSEREASON QM entry for lagged agents +# 91123-1802 - Added outbound_autodial field, and exception for outbound-only agents on blended campaign # @@ -208,18 +209,18 @@ $rec_count=0; while ($sthArows > $rec_count) { @aryA = $sthA->fetchrow_array; - $DBtelnet_host = "$aryA[0]"; - $DBtelnet_port = "$aryA[1]"; - $DBASTmgrUSERNAME = "$aryA[2]"; - $DBASTmgrSECRET = "$aryA[3]"; - $DBASTmgrUSERNAMEupdate = "$aryA[4]"; - $DBASTmgrUSERNAMElisten = "$aryA[5]"; - $DBASTmgrUSERNAMEsend = "$aryA[6]"; - $DBmax_vicidial_trunks = "$aryA[7]"; - $DBanswer_transfer_agent= "$aryA[8]"; - $DBSERVER_GMT = "$aryA[9]"; - $DBext_context = "$aryA[10]"; - $DBvd_server_logs = "$aryA[11]"; + $DBtelnet_host = $aryA[0]; + $DBtelnet_port = $aryA[1]; + $DBASTmgrUSERNAME = $aryA[2]; + $DBASTmgrSECRET = $aryA[3]; + $DBASTmgrUSERNAMEupdate = $aryA[4]; + $DBASTmgrUSERNAMElisten = $aryA[5]; + $DBASTmgrUSERNAMEsend = $aryA[6]; + $DBmax_vicidial_trunks = $aryA[7]; + $DBanswer_transfer_agent= $aryA[8]; + $DBSERVER_GMT = $aryA[9]; + $DBext_context = $aryA[10]; + $DBvd_server_logs = $aryA[11]; if ($DBtelnet_host) {$telnet_host = $DBtelnet_host;} if ($DBtelnet_port) {$telnet_port = $DBtelnet_port;} if ($DBASTmgrUSERNAME) {$ASTmgrUSERNAME = $DBASTmgrUSERNAME;} @@ -237,8 +238,8 @@ while ($sthArows > $rec_count) } $sthA->finish(); - $event_string='LOGGED INTO MYSQL SERVER ON 1 CONNECTION|'; - &event_logger; +$event_string='LOGGED INTO MYSQL SERVER ON 1 CONNECTION|'; +&event_logger; ############################################# ##### START QUEUEMETRICS LOGGING LOOKUP ##### @@ -246,18 +247,16 @@ $stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics $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) +if ($sthArows > 0) { @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]"; - $outbound_autodial_active = "$aryA[6]"; - $rec_count++; + $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]; + $outbound_autodial_active = $aryA[6]; } $sthA->finish(); ##### END QUEUEMETRICS LOGGING LOOKUP ##### @@ -297,6 +296,8 @@ while($one_day_interval > 0) @DBIPdialprefix=@MT; @DBIPcampaigncid=@MT; @DBIPexistcalls=@MT; + @DBIPexistcalls_IN=@MT; + @DBIPexistcalls_OUT=@MT; @DBIPgoalcalls=@MT; @DBIPmakecalls=@MT; @DBIPlivecalls=@MT; @@ -304,6 +305,7 @@ while($one_day_interval > 0) @DBIPomitcode=@MT; @DBIPautoaltdial=@MT; @DBIPtrunk_shortage=@MT; + @DBIPcampaign_ready_agents=@MT; @DBIPold_trunk_shortage=@MT; @DBIPserver_trunks_limit=@MT; @DBIPserver_trunks_other=@MT; @@ -332,7 +334,7 @@ while($one_day_interval > 0) if ($sthArows > 0) { @aryA = $sthA->fetchrow_array; - $outbound_calls_per_second = "$aryA[0]"; + $outbound_calls_per_second = $aryA[0]; } $sthA->finish(); @@ -353,13 +355,13 @@ while($one_day_interval > 0) if ($sthArows > 0) { @aryA = $sthA->fetchrow_array; - $outbound_autodial_active = "$aryA[0]"; + $outbound_autodial_active = $aryA[0]; } $sthA->finish(); ##### Get a listing of the users that are active and ready to take calls ##### Also get a listing of the campaigns and campaigns/serverIP that will be used - $stmtA = "SELECT user,server_ip,campaign_id,conf_exten,status FROM vicidial_live_agents where status IN($active_agents) and server_ip='$server_ip' and last_update_time > '$BDtsSQLdate' order by last_call_time"; + $stmtA = "SELECT user,server_ip,campaign_id,conf_exten,status FROM vicidial_live_agents where status IN($active_agents) and outbound_autodial='Y' and server_ip='$server_ip' and last_update_time > '$BDtsSQLdate' order by last_call_time"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -367,11 +369,11 @@ while($one_day_interval > 0) while ($sthArows > $rec_count) { @aryA = $sthA->fetchrow_array; - $DBlive_user[$user_counter] = "$aryA[0]"; - $DBlive_server_ip[$user_counter] = "$aryA[1]"; - $DBlive_campaign[$user_counter] = "$aryA[2]"; - $DBlive_conf_exten[$user_counter] = "$aryA[3]"; - $DBlive_status[$user_counter] = "$aryA[4]"; + $DBlive_user[$user_counter] = $aryA[0]; + $DBlive_server_ip[$user_counter] = $aryA[1]; + $DBlive_campaign[$user_counter] = $aryA[2]; + $DBlive_conf_exten[$user_counter] = $aryA[3]; + $DBlive_status[$user_counter] = $aryA[4]; if ($user_campaigns !~ /\|$DBlive_campaign[$user_counter]\|/i) { @@ -438,6 +440,17 @@ while($one_day_interval > 0) $user_counter++; } + ### get count of READY-status agents in this campaign + $stmtA = "SELECT count(*) FROM vicidial_live_agents where campaign_id='$DBIPcampaign[$user_CIPct]' and server_ip='$server_ip' and status='READY';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $DBIPcampaign_ready_agents[$user_CIPct] = $aryA[0]; + } + ### check for vicidial_campaign_server_stats record, if non present then create it $stmtA = "SELECT local_trunk_shortage FROM vicidial_campaign_server_stats where campaign_id='$DBIPcampaign[$user_CIPct]' and server_ip='$server_ip';"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; @@ -447,7 +460,7 @@ while($one_day_interval > 0) while ($sthArows > $rec_count) { @aryA = $sthA->fetchrow_array; - $DBIPold_trunk_shortage[$user_CIPct] = "$aryA[0]"; + $DBIPold_trunk_shortage[$user_CIPct] = $aryA[0]; $rec_count++; } if ($rec_count < 1) @@ -473,7 +486,7 @@ while($one_day_interval > 0) while ($sthArows > $rec_count) { @aryA = $sthA->fetchrow_array; - $DBIPserver_trunks_limit[$user_CIPct] = "$aryA[0]"; + $DBIPserver_trunks_limit[$user_CIPct] = $aryA[0]; $rec_count++; } $stmtA = "SELECT sum(dedicated_trunks) FROM vicidial_server_trunks where campaign_id NOT IN('$DBIPcampaign[$user_CIPct]') and server_ip='$server_ip';"; @@ -484,7 +497,7 @@ while($one_day_interval > 0) while ($sthArows > $rec_count) { @aryA = $sthA->fetchrow_array; - $DBIPserver_trunks_other[$user_CIPct] = "$aryA[0]"; + $DBIPserver_trunks_other[$user_CIPct] = $aryA[0]; $rec_count++; } @@ -502,27 +515,27 @@ while($one_day_interval > 0) while ($sthArows > $rec_count) { @aryA = $sthA->fetchrow_array; - $DBIPadlevel[$user_CIPct] = "$aryA[0]"; - $DBIPcalltime[$user_CIPct] = "$aryA[1]"; - $DBIPdialtimeout[$user_CIPct] = "$aryA[2]"; - $DBIPdialprefix[$user_CIPct] = "$aryA[3]"; - $DBIPcampaigncid[$user_CIPct] = "$aryA[4]"; - $DBIPactive[$user_CIPct] = "$aryA[5]"; - $DBIPvdadexten[$user_CIPct] = "$aryA[6]"; - $DBIPclosercamp[$user_CIPct] = "$aryA[7]"; - $omit_phone_code = "$aryA[8]"; + $DBIPadlevel[$user_CIPct] = $aryA[0]; + $DBIPcalltime[$user_CIPct] = $aryA[1]; + $DBIPdialtimeout[$user_CIPct] = $aryA[2]; + $DBIPdialprefix[$user_CIPct] = $aryA[3]; + $DBIPcampaigncid[$user_CIPct] = $aryA[4]; + $DBIPactive[$user_CIPct] = $aryA[5]; + $DBIPvdadexten[$user_CIPct] = $aryA[6]; + $DBIPclosercamp[$user_CIPct] = $aryA[7]; + $omit_phone_code = $aryA[8]; if ($omit_phone_code =~ /Y/) {$DBIPomitcode[$user_CIPct] = 1;} else {$DBIPomitcode[$user_CIPct] = 0;} - $available_only_ratio_tally = "$aryA[9]"; + $available_only_ratio_tally = $aryA[9]; if ($available_only_ratio_tally =~ /Y/) { $DBIPcount[$user_CIPct] = $DBIPACTIVEcount[$user_CIPct]; $active_only=1; } - $DBIPautoaltdial[$user_CIPct] = "$aryA[10]"; - $DBIPcampaign_allow_inbound[$user_CIPct] = "$aryA[11]"; - $DBIPqueue_priority[$user_CIPct] = "$aryA[12]"; - $DBIPdial_method[$user_CIPct] = "$aryA[13]"; + $DBIPautoaltdial[$user_CIPct] = $aryA[10]; + $DBIPcampaign_allow_inbound[$user_CIPct] = $aryA[11]; + $DBIPqueue_priority[$user_CIPct] = $aryA[12]; + $DBIPdial_method[$user_CIPct] = $aryA[13]; $rec_count++; } $sthA->finish(); @@ -539,7 +552,7 @@ while($one_day_interval > 0) if ($sthArows > 0) { @aryA = $sthA->fetchrow_array; - $tally_xfer_line_counter = "$aryA[0]"; + $tally_xfer_line_counter = $aryA[0]; } $sthA->finish(); @@ -548,11 +561,11 @@ while($one_day_interval > 0) if ($DBIPactive[$user_CIPct] =~ /N/) {$DBIPgoalcalls[$user_CIPct] = 0;} $DBIPgoalcalls[$user_CIPct] = sprintf("%.0f", $DBIPgoalcalls[$user_CIPct]); - $event_string="$DBIPcampaign[$user_CIPct] $DBIPaddress[$user_CIPct]: agents: $DBIPcount[$user_CIPct] dial_level: $DBIPadlevel[$user_CIPct]"; + $event_string="$DBIPcampaign[$user_CIPct] $DBIPaddress[$user_CIPct]: agents: $DBIPcount[$user_CIPct] (READY: $DBIPcampaign_ready_agents[$user_CIPct]) dial_level: $DBIPadlevel[$user_CIPct]"; &event_logger; - ### see how many calls are alrady active per campaign per server and + ### see how many calls are already active per campaign per server and ### subtract that number from goalcalls to determine how many new ### calls need to be placed in this loop if ($DBIPcampaign_allow_inbound[$user_CIPct] =~ /Y/) @@ -565,20 +578,41 @@ while($one_day_interval > 0) } else {$DBIPclosercamp[$user_CIPct]="''";} - $campaign_query = "( (call_type='IN' and campaign_id IN($DBIPclosercamp[$user_CIPct])) or (campaign_id='$DBIPcampaign[$user_CIPct]' and call_type IN('OUT','OUTBALANCE')) )"; + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where (call_type='IN' and campaign_id IN($DBIPclosercamp[$user_CIPct])) and server_ip='$DBIPaddress[$user_CIPct]' and status IN('SENT','RINGING','LIVE','XFER','CLOSER');"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $DBIPexistcalls_IN[$user_CIPct] = $aryA[0]; + } + $sthA->finish(); } - else {$campaign_query = "(campaign_id='$DBIPcampaign[$user_CIPct]' and call_type IN('OUT','OUTBALANCE'))";} - $stmtA = "SELECT count(*) FROM vicidial_auto_calls where $campaign_query and server_ip='$DBIPaddress[$user_CIPct]' and status IN('SENT','RINGING','LIVE','XFER','CLOSER');"; + else + {$DBIPexistcalls_IN[$user_CIPct]=0;} + + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where (campaign_id='$DBIPcampaign[$user_CIPct]' and call_type IN('OUT','OUTBALANCE')) and server_ip='$DBIPaddress[$user_CIPct]' and status IN('SENT','RINGING','LIVE','XFER','CLOSER');"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; if ($sthArows > 0) { @aryA = $sthA->fetchrow_array; - $DBIPexistcalls[$user_CIPct] = "$aryA[0]"; + $DBIPexistcalls_OUT[$user_CIPct] = $aryA[0]; } $sthA->finish(); + $DBIPexistcalls[$user_CIPct] = ($DBIPexistcalls_IN[$user_CIPct] + $DBIPexistcalls_OUT[$user_CIPct]); + + if ( ($DBIPcampaign_ready_agents[$user_CIPct] > 0) && ($DBIPexistcalls_IN[$user_CIPct] > 0) ) + { + $event_string=" BLENDED-OUTBOUND-AGENTS-WAITING OVERRIDE: $DBIPcampaign[$user_CIPct] $DBIPexistcalls[$user_CIPct] [$DBIPexistcalls_IN[$user_CIPct] + $DBIPexistcalls_OUT[$user_CIPct]])"; + &event_logger; + + $DBIPexistcalls[$user_CIPct] = $DBIPexistcalls_OUT[$user_CIPct]; + } + $active_line_goal=0; $DBIPmakecalls[$user_CIPct] = ($DBIPgoalcalls[$user_CIPct] - $DBIPexistcalls[$user_CIPct]); $DBIPmakecallsGOAL = $DBIPmakecalls[$user_CIPct]; @@ -593,13 +627,13 @@ while($one_day_interval > 0) $DBIPtrunk_shortage[$user_CIPct] = ($active_line_goal - $max_vicidial_trunks); if ($DBIPtrunk_shortage[$user_CIPct] > $DBIPmakecallsGOAL) {$DBIPtrunk_shortage[$user_CIPct] = $DBIPmakecallsGOAL} - $MVT_msg = "MVT override: $max_vicidial_trunks |$DBIPmakecalls[$user_CIPct] $DBIPtrunk_shortage[$user_CIPct]|"; + $MVT_msg = " MVT override: $max_vicidial_trunks |$DBIPmakecalls[$user_CIPct] $DBIPtrunk_shortage[$user_CIPct]|"; } if (length($DBIPserver_trunks_limit[$user_CIPct])>0) { if ($DBIPserver_trunks_limit[$user_CIPct] < $active_line_goal) { - $MVT_msg .= " TRUNK LIMIT override: $DBIPserver_trunks_limit[$user_CIPct]"; + $MVT_msg .= " TRUNK LIMIT override: $DBIPserver_trunks_limit[$user_CIPct]"; $DBIPtrunk_shortage[$user_CIPct] = ($active_line_goal - $DBIPserver_trunks_limit[$user_CIPct]); if ($DBIPtrunk_shortage[$user_CIPct] > $DBIPmakecallsGOAL) {$DBIPtrunk_shortage[$user_CIPct] = $DBIPmakecallsGOAL} @@ -613,7 +647,7 @@ while($one_day_interval > 0) { if ($DBIPserver_trunks_allowed[$user_CIPct] < $active_line_goal) { - $MVT_msg .= " OTHER LIMIT override: $DBIPserver_trunks_allowed[$user_CIPct]"; + $MVT_msg .= " OTHER LIMIT override: $DBIPserver_trunks_allowed[$user_CIPct]"; $DBIPtrunk_shortage[$user_CIPct] = ($active_line_goal - $DBIPserver_trunks_allowed[$user_CIPct]); if ($DBIPtrunk_shortage[$user_CIPct] > $DBIPmakecallsGOAL) {$DBIPtrunk_shortage[$user_CIPct] = $DBIPmakecallsGOAL} @@ -626,7 +660,8 @@ while($one_day_interval > 0) if ($DBIPmakecalls[$user_CIPct] > 0) {$active_line_counter = ($DBIPmakecalls[$user_CIPct] + $active_line_counter);} - $event_string="$DBIPcampaign[$user_CIPct] $DBIPaddress[$user_CIPct]: Calls to place: $DBIPmakecalls[$user_CIPct] ($DBIPgoalcalls[$user_CIPct] - $DBIPexistcalls[$user_CIPct]) $active_line_counter $MVT_msg"; + + $event_string="$DBIPcampaign[$user_CIPct] $DBIPaddress[$user_CIPct]: Calls to place: $DBIPmakecalls[$user_CIPct] ($DBIPgoalcalls[$user_CIPct] - $DBIPexistcalls[$user_CIPct] [$DBIPexistcalls_IN[$user_CIPct] + $DBIPexistcalls_OUT[$user_CIPct]]) $active_line_counter $MVT_msg"; &event_logger; ### Calculate campaign-wide agent waiting and calls waiting differential @@ -635,6 +670,8 @@ while($one_day_interval > 0) $total_agents=0; $ready_agents=0; $waiting_calls=0; + $waiting_calls_IN=0; + $waiting_calls_OUT=0; $stmtA = "SELECT count(*),status from vicidial_live_agents where campaign_id='$DBIPcampaign[$user_CIPct]' and last_update_time > '$halfminSQLdate' group by status;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; @@ -644,25 +681,43 @@ while($one_day_interval > 0) while ($sthArows > $rec_count) { @aryA = $sthA->fetchrow_array; - $VCSagent_count = "$aryA[0]"; - $VCSagent_status = "$aryA[1]"; + $VCSagent_count = $aryA[0]; + $VCSagent_status = $aryA[1]; $rec_count++; if ($VCSagent_status =~ /READY|DONE/) {$ready_agents = ($ready_agents + $VCSagent_count);} $total_agents = ($total_agents + $VCSagent_count); } $sthA->finish(); - $stmtA = "SELECT count(*) FROM vicidial_auto_calls where $campaign_query and status IN('LIVE');"; + if ($DBIPcampaign_allow_inbound[$user_CIPct] =~ /Y/) + { + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where (call_type='IN' and campaign_id IN($DBIPclosercamp[$user_CIPct])) and status IN('LIVE');"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $waiting_calls_IN = $aryA[0]; + } + $sthA->finish(); + } + else + {$waiting_calls_IN=0;} + + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where (campaign_id='$DBIPcampaign[$user_CIPct]' and call_type IN('OUT','OUTBALANCE')) and status IN('LIVE');"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; if ($sthArows > 0) { @aryA = $sthA->fetchrow_array; - $waiting_calls = "$aryA[0]"; + $waiting_calls_OUT = $aryA[0]; } $sthA->finish(); + $waiting_calls = ($waiting_calls_IN + $waiting_calls_OUT); + $stat_ready_agents[$user_CIPct][$stat_count] = $ready_agents; $stat_waiting_calls[$user_CIPct][$stat_count] = $waiting_calls; $stat_total_agents[$user_CIPct][$stat_count] = $total_agents; @@ -771,8 +826,8 @@ while($one_day_interval > 0) while ($sthArows > $rec_count) { @aryA = $sthA->fetchrow_array; - $lead_id = "$aryA[0]"; - $alt_dial = "$aryA[1]"; + $lead_id = $aryA[0]; + $alt_dial = $aryA[1]; $rec_count++; } $sthA->finish(); @@ -890,8 +945,8 @@ while($one_day_interval > 0) if ($sthArows > 0) { @aryA = $sthA->fetchrow_array; - $phone_code = "$aryA[0]"; - $phone_number = "$aryA[1]"; + $phone_code = $aryA[0]; + $phone_number = $aryA[1]; $phone_number =~ s/\D//gi; } $sthA->finish(); @@ -1129,8 +1184,8 @@ while($one_day_interval > 0) if ($sthArows > 0) { @aryA = $sthA->fetchrow_array; - $CLdial_timeout = "$aryA[0]"; - $CLdrop_call_seconds = "$aryA[1]"; + $CLdial_timeout = $aryA[0]; + $CLdrop_call_seconds = $aryA[1]; } $sthA->finish(); @@ -1180,7 +1235,7 @@ while($one_day_interval > 0) if ($sthArowsVL > 0) { @aryA = $sthA->fetchrow_array; - $insertVLcount = "$aryA[0]"; + $insertVLcount = $aryA[0]; } $sthA->finish(); } @@ -1196,7 +1251,7 @@ while($one_day_interval > 0) if ($sthArows > 0) { @aryA = $sthA->fetchrow_array; - $cpd_result = "$aryA[0]"; + $cpd_result = $aryA[0]; $sthA->finish(); $CPDfound=0; if ($cpd_result =~ /Busy/i) {$CLnew_status='CPDB'; $CPDfound++;} @@ -1232,7 +1287,7 @@ while($one_day_interval > 0) if ($sthArowsVLL > 0) { @aryA = $sthA->fetchrow_array; - $xCLlist_id = "$aryA[0]"; + $xCLlist_id = $aryA[0]; } $sthA->finish(); @@ -1738,10 +1793,10 @@ while($one_day_interval > 0) while ($sthArows > $rec_count) { @aryA = $sthA->fetchrow_array; - $VALOuser[$logcount] = "$aryA[0]"; - $VALOcampaign[$logcount] = "$aryA[1]"; - $VALOtimelog[$logcount] = "$aryA[2]"; - $VALOextension[$logcount] = "$aryA[3]"; + $VALOuser[$logcount] = $aryA[0]; + $VALOcampaign[$logcount] = $aryA[1]; + $VALOtimelog[$logcount] = $aryA[2]; + $VALOextension[$logcount] = $aryA[3]; $logcount++; $rec_count++; } @@ -1758,7 +1813,7 @@ while($one_day_interval > 0) while ($sthArows > $UGrec_count) { @aryA = $sthA->fetchrow_array; - $VALOuser_group = "$aryA[0]"; + $VALOuser_group = $aryA[0]; $UGrec_count++; } $sthA->finish(); @@ -1813,16 +1868,16 @@ while($one_day_interval > 0) while ($sthArows > $rec_count) { @aryA = $sthA->fetchrow_array; - $auto_call_id = "$aryA[0]"; - $CLlead_id = "$aryA[1]"; - $CLphone_number = "$aryA[2]"; - $CLstatus = "$aryA[3]"; - $CLcampaign_id = "$aryA[4]"; - $CLphone_code = "$aryA[5]"; - $CLalt_dial = "$aryA[6]"; - $CLstage = "$aryA[7]"; - $CLcallerid = "$aryA[8]"; - $CLuniqueid = "$aryA[9]"; + $auto_call_id = $aryA[0]; + $CLlead_id = $aryA[1]; + $CLphone_number = $aryA[2]; + $CLstatus = $aryA[3]; + $CLcampaign_id = $aryA[4]; + $CLphone_code = $aryA[5]; + $CLalt_dial = $aryA[6]; + $CLstage = $aryA[7]; + $CLcallerid = $aryA[8]; + $CLuniqueid = $aryA[9]; $rec_count++; } $sthA->finish(); @@ -1848,7 +1903,7 @@ while($one_day_interval > 0) if ($sthArowsVLL > 0) { @aryA = $sthA->fetchrow_array; - $xCLlist_id = "$aryA[0]"; + $xCLlist_id = $aryA[0]; } $sthA->finish(); @@ -1934,7 +1989,7 @@ while($one_day_interval > 0) while ($sthArows > $rec_count) { @aryA = $sthA->fetchrow_array; - $DBvd_server_logs = "$aryA[0]"; + $DBvd_server_logs = $aryA[0]; if ($DBvd_server_logs =~ /Y/) {$SYSLOG = '1';} else {$SYSLOG = '0';} $rec_count++; @@ -1951,12 +2006,12 @@ while($one_day_interval > 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]"; + $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(); @@ -2167,4 +2222,3 @@ sub jam_event_logger } $jam_string=''; } - diff --git a/agc_2-X/trunk/bin/AST_VDremote_agents.pl b/agc_2-X/trunk/bin/AST_VDremote_agents.pl index 7aab6152..b53fb43a 100644 --- a/agc_2-X/trunk/bin/AST_VDremote_agents.pl +++ b/agc_2-X/trunk/bin/AST_VDremote_agents.pl @@ -35,6 +35,7 @@ # 81026-1246 - Added better logging of calls and fixed the DROP bug # 90808-0247 - Added agent last_state_change field # 91013-1128 - Added full inbound compatibility with vicidial_live_inbound_agents table +# 91123-1802 - Added outbound_autodial field # ### begin parsing run-time options ### @@ -433,8 +434,8 @@ while($one_day_interval > 0) while ($sthArows > $rec_count) { @aryA = $sthA->fetchrow_array; - $Duser_start = "$aryA[1]"; - $Dnumber_of_lines = "$aryA[2]"; + $Duser_start = $aryA[1]; + $Dnumber_of_lines = $aryA[2]; $w=0; while ($w < $Dnumber_of_lines) { @@ -457,8 +458,9 @@ while($one_day_interval > 0) { if (length($DBremote_user[$h])>1) { - ### check to see if the record exists and only needs random number update - $stmtA = "SELECT count(*) FROM vicidial_live_agents where user='$DBremote_user[$h]' and server_ip='$server_ip' and campaign_id='$DBremote_campaign[$h]' and conf_exten='$DBremote_conf_exten[$h]' and closer_campaigns='$DBremote_closer[$h]';"; + $CAMPAIGN_autodial[$h] = 'Y'; + ### find the dial method of the campaign for each remote agent + $stmtA = "SELECT dial_method FROM vicidial_campaigns where campaign_id='$DBremote_campaign[$h]';"; if ($DBX) {print STDERR "|$stmtA|\n";} $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; @@ -466,7 +468,23 @@ while($one_day_interval > 0) if ($sthArows > 0) { @aryA = $sthA->fetchrow_array; - $loginexistsRANDOM[$h] = "$aryA[0]"; + $CAMPAIGN_dial_method[$h] = $aryA[0]; + + if ($CAMPAIGN_dial_method[$h] =~ /MANUAL|INBOUND_MAN/) + {$CAMPAIGN_autodial[$h] = 'N';} + } + $sthA->finish(); + + ### check to see if the record exists and only needs random number update + $stmtA = "SELECT count(*) FROM vicidial_live_agents where user='$DBremote_user[$h]' and server_ip='$server_ip' and campaign_id='$DBremote_campaign[$h]' and conf_exten='$DBremote_conf_exten[$h]' and closer_campaigns='$DBremote_closer[$h]' and outbound_autodial='$CAMPAIGN_autodial[$h]';"; + if ($DBX) {print STDERR "|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $loginexistsRANDOM[$h] = $aryA[0]; } $sthA->finish(); @@ -493,7 +511,7 @@ while($one_day_interval > 0) if ($loginexistsALL[$h] > 0) { - $stmtA = "UPDATE vicidial_live_agents set random_id='$DBremote_random[$h]',campaign_id='$DBremote_campaign[$h]',conf_exten='$DBremote_conf_exten[$h]',closer_campaigns='$DBremote_closer[$h]', status='READY',last_state_change='$SQLdate' where user='$DBremote_user[$h]' and server_ip='$server_ip';"; + $stmtA = "UPDATE vicidial_live_agents set random_id='$DBremote_random[$h]',campaign_id='$DBremote_campaign[$h]',conf_exten='$DBremote_conf_exten[$h]',closer_campaigns='$DBremote_closer[$h]',status='READY',last_state_change='$SQLdate',outbound_autodial='$CAMPAIGN_autodial[$h]' where user='$DBremote_user[$h]' and server_ip='$server_ip';"; $affected_rows = $dbhA->do($stmtA); if ($DBX) {print STDERR "$DBremote_user[$h] ALL UPDATE: $affected_rows\n";} # if ($affected_rows>0) @@ -531,7 +549,7 @@ while($one_day_interval > 0) } $sthA->finish(); - $stmtA = "INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,campaign_id,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,channel,uniqueid,callerid,user_level,comments,last_state_change) values('$DBremote_user[$h]','$server_ip','$DBremote_conf_exten[$h]','R/$DBremote_user[$h]','READY','$DBremote_campaign[$h]','$DBremote_random[$h]','$SQLdate','$FDtsSQLdate','$SQLdate','$DBremote_closer[$h]','','','','$DBuser_level[$h]','REMOTE','$SQLdate');"; + $stmtA = "INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,campaign_id,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,channel,uniqueid,callerid,user_level,comments,last_state_change,outbound_autodial) values('$DBremote_user[$h]','$server_ip','$DBremote_conf_exten[$h]','R/$DBremote_user[$h]','READY','$DBremote_campaign[$h]','$DBremote_random[$h]','$SQLdate','$FDtsSQLdate','$SQLdate','$DBremote_closer[$h]','','','','$DBuser_level[$h]','REMOTE','$SQLdate','$CAMPAIGN_autodial[$h]');"; $affected_rows = $dbhA->do($stmtA); if ($DBX) {print STDERR "$DBremote_user[$h] NEW INSERT\n";} if ($TESTrun > 0) 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 75427bfd..5a2c99bc 100644 --- a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql +++ b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql @@ -353,6 +353,8 @@ external_dial VARCHAR(100) default '', agent_log_id INT(9) UNSIGNED default '0', last_state_change DATETIME, agent_territories TEXT, +outbound_autodial ENUM('Y','N') default 'N', +manager_ingroup_set ENUM('Y','N') default 'N', index (random_id), index (last_call_time), index (last_update_time), @@ -1954,7 +1956,7 @@ CREATE INDEX phone_number on vicidial_closer_log (phone_number); CREATE INDEX date_user on vicidial_closer_log (call_date,user); CREATE INDEX comment_a on live_inbound_log (comment_a); -UPDATE system_settings SET db_schema_version='1180',db_schema_update_date=NOW(); +UPDATE system_settings SET db_schema_version='1181',db_schema_update_date=NOW(); GRANT RELOAD ON *.* TO cron@'%'; GRANT RELOAD ON *.* TO cron@localhost; diff --git a/agc_2-X/trunk/extras/upgrade_2.2.0.sql b/agc_2-X/trunk/extras/upgrade_2.2.0.sql index cc816d11..1d21b5cb 100644 --- a/agc_2-X/trunk/extras/upgrade_2.2.0.sql +++ b/agc_2-X/trunk/extras/upgrade_2.2.0.sql @@ -608,3 +608,8 @@ INSERT INTO vicidial_call_menu SET menu_id='defaultlog',menu_name='logging of al INSERT INTO vicidial_call_menu_options SET menu_id='defaultlog',option_value='TIMEOUT',option_description='hangup',option_route='HANGUP',option_route_value='vm-goodbye',option_route_value_context=''; UPDATE system_settings SET db_schema_version='1180',db_schema_update_date=NOW(); + +ALTER TABLE vicidial_live_agents ADD outbound_autodial ENUM('Y','N') default 'N'; +ALTER TABLE vicidial_live_agents ADD manager_ingroup_set ENUM('Y','N') default 'N'; + +UPDATE system_settings SET db_schema_version='1181',db_schema_update_date=NOW(); diff --git a/agc_2-X/trunk/www/agc/vdc_db_query.php b/agc_2-X/trunk/www/agc/vdc_db_query.php index 3b39706e..8a78fdff 100644 --- a/agc_2-X/trunk/www/agc/vdc_db_query.php +++ b/agc_2-X/trunk/www/agc/vdc_db_query.php @@ -221,10 +221,11 @@ # 91026-1101 - Added AREACODE DNC option # 91108-2120 - Fixed QM log issue with PAUSEREASON entries # 91112-1107 - Changed ENTERQUEUE to CALLOUTBOUND for QM logging +# 91123-1801 - Added outbound_autodial field # -$version = '2.2.0-130'; -$build = '91112-1107'; +$version = '2.2.0-131'; +$build = '91123-1801'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=256; $one_mysql_log=0; @@ -717,6 +718,13 @@ if ($ACTION == 'regCLOSER') } else { + if ($closer_blended > 0) + {$vla_autodial = 'Y';} + else + {$vla_autodial = 'N';} + if (preg_match('/INBOUND_MAN|MANUAL/',$dial_method)) + {$vla_autodial = 'N';} + if ($closer_choice == "MGRLOCK-") { $stmt="SELECT closer_campaigns FROM vicidial_users where user='$user' LIMIT 1;"; @@ -726,14 +734,14 @@ if ($ACTION == 'regCLOSER') $row=mysql_fetch_row($rslt); $closer_choice =$row[0]; - $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice',last_state_change='$NOW_TIME' where user='$user' and server_ip='$server_ip';"; + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice',last_state_change='$NOW_TIME',outbound_autodial='$vla_autodial' where user='$user' and server_ip='$server_ip';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00008',$user,$server_ip,$session_name,$one_mysql_log);} } else { - $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice',last_state_change='$NOW_TIME' where user='$user' and server_ip='$server_ip';"; + $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice',last_state_change='$NOW_TIME',outbound_autodial='$vla_autodial' where user='$user' and server_ip='$server_ip';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00009',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5044,8 +5052,11 @@ if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) } else { + $vla_autodialSQL=''; + if (preg_match('/INBOUND_MAN/',$dial_method)) + {$vla_autodialSQL = ",outbound_autodial='N'";} $random = (rand(1000000, 9999999) + 10000000); - $stmt="UPDATE vicidial_live_agents set uniqueid=0,callerid='',channel='', random_id='$random',comments='',last_state_change='$NOW_TIME' where user='$user' and server_ip='$server_ip';"; + $stmt="UPDATE vicidial_live_agents set uniqueid=0,callerid='',channel='', random_id='$random',comments='',last_state_change='$NOW_TIME' $vla_autodialSQL where user='$user' and server_ip='$server_ip';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00165',$user,$server_ip,$session_name,$one_mysql_log);} diff --git a/agc_2-X/trunk/www/agc/vicidial.php b/agc_2-X/trunk/www/agc/vicidial.php index a47939c3..4d62227f 100644 --- a/agc_2-X/trunk/www/agc/vicidial.php +++ b/agc_2-X/trunk/www/agc/vicidial.php @@ -259,10 +259,11 @@ # 90930-2243 - Added Territory selection functions # 91108-2118 - Added QM pause code entry # 91111-1433 - Fixed Gender pulldown list display for IE, remove links for recording channels in SHOW CHANNELS +# 91123-1801 - Added code for outbound_autodial field # -$version = '2.2.0-237'; -$build = '91111-1433'; +$version = '2.2.0-238'; +$build = '91123-1801'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=61; $one_mysql_log=0; @@ -1919,7 +1920,7 @@ else $closer_chooser_string=''; - $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,user_level,campaign_weight,calls_today,last_state_change) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$closer_chooser_string','$user_level','$campaign_weight','$calls_today','$NOW_TIME');"; + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,user_level,campaign_weight,calls_today,last_state_change,outbound_autodial) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$closer_chooser_string','$user_level','$campaign_weight','$calls_today','$NOW_TIME','Y');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01044',$VD_login,$server_ip,$session_name,$one_mysql_log);} @@ -1959,7 +1960,7 @@ else { print "\n"; - $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,user_level,campaign_weight,calls_today,last_state_change) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$user_level', '$campaign_weight', '$calls_today','$NOW_TIME');"; + $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,user_level,campaign_weight,calls_today,last_state_change,outbound_autodial) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$user_level', '$campaign_weight', '$calls_today','$NOW_TIME','N');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01047',$VD_login,$server_ip,$session_name,$one_mysql_log);} @@ -7564,7 +7565,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} } if (xmlhttp) { - CSCupdate_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=regCLOSER&format=text&user=" + user + "&pass=" + pass + "&comments=" + VU_agent_choose_ingroups_DV + "&closer_blended=" + VICIDiaL_closer_blended + "&campaign=" + campaign + "&closer_choice=" + CloserSelectChoices + "-"; + CSCupdate_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=regCLOSER&format=text&user=" + user + "&pass=" + pass + "&comments=" + VU_agent_choose_ingroups_DV + "&closer_blended=" + VICIDiaL_closer_blended + "&campaign=" + campaign + "&dial_method" + dial_method + "&closer_choice=" + CloserSelectChoices + "-"; xmlhttp.open('POST', 'vdc_db_query.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(CSCupdate_query);