diff --git a/agc_2-X/trunk/UPGRADE b/agc_2-X/trunk/UPGRADE index 8b7a1a07..b8c3f9e4 100644 --- a/agc_2-X/trunk/UPGRADE +++ b/agc_2-X/trunk/UPGRADE @@ -19,6 +19,21 @@ NOTE: Upgrading from 1.1.12-3 to 2.0.1 is at the bottom \. /path/from/root/extras/upgrade_2.0.5.sql quit +3. Several of the MySQL tables have been changed to a HEAP type to reside in + memory to improve performance. + +4. Added the ability for inbound and blended agents to choose their selected + in-groups without logging out. The new GROUPS link at the top of the + agent screen(vicidial.php) can be used when an agent is Paused to + change their selected groups and whether they are set to do Blended + calling or not. There is also a new log with the details of what + groups an agent has selected each time in the user stats page. + +5. The start of a new QC (Quality Control) feature [non functional right now] + +6. Queue Priority has been added allowing for the prioritization of one in-group + over another in-group or outbound campaign(when in blended mode) + diff --git a/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi b/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi index b54ed407..3c7ceed3 100644 --- a/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi +++ b/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi @@ -55,6 +55,7 @@ # 71116-1045 - added fewest_calls_campaign agent call routing option # 71128-1758 - added CIDLOOKUPRC method to search all lists within a campaign # 80109-2348 - added option to trigger a system process when the call is sent to an agent +# 80227-0335 - added queue priority functionality # $script = 'agi-VDAD_ALL_inbound.agi'; @@ -341,7 +342,7 @@ $sthA->finish(); ### Grab inbound groups values from the database $cbc=0; -$stmtA = "SELECT call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,drop_call_seconds,drop_message,drop_exten,next_agent_call,voicemail_ext FROM vicidial_inbound_groups where group_id = '$channel_group';"; +$stmtA = "SELECT call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,drop_call_seconds,drop_message,drop_exten,next_agent_call,voicemail_ext,queue_priority FROM vicidial_inbound_groups where group_id = '$channel_group';"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -367,6 +368,7 @@ while ($sthArows > $cbc) $CAMP_callorder = "$aryA[14]"; $VDADvoicemail_ext = "$aryA[15]"; $VDADvoicemail_ext =~ s/\D//gi; + $queue_priority = "$aryA[16]"; $cbc++; } $sthA->finish(); @@ -665,7 +667,7 @@ if ($call_handle_method =~ /CLOSER|DIGITID$/) } ### insert a LIVE record to the vicidial_auto_calls table -$stmtA = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,uniqueid,callerid,channel,phone_code,phone_number,call_time,call_type,stage) values('$VARserver_ip','$channel_group','LIVE','$insert_lead_id','$uniqueid','$callerid','$channel','$phone_code','$phone_number','$SQLdate','IN','LIVE-0')"; +$stmtA = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,uniqueid,callerid,channel,phone_code,phone_number,call_time,call_type,stage,queue_priority) values('$VARserver_ip','$channel_group','LIVE','$insert_lead_id','$uniqueid','$callerid','$channel','$phone_code','$phone_number','$SQLdate','IN','LIVE-0','$queue_priority')"; if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} $affected_rows = $dbhA->do($stmtA); @@ -690,6 +692,9 @@ $drop_seconds=0; $hold_message_counter=($prompt_interval - 10); $hold_tone_counter=0; + +############################################ +### Loop to try to send call to an agent ### while ($drop_timer <= $DROP_TIME) { $channel_status = $AGI->channel_status("$channel"); @@ -711,6 +716,8 @@ if ($channel_status < 1) $rec_countCUSTDATA=0; $rec_countWAIT=0; + $gsp_countWAIT=0; + $qp_countWAIT=0; $cbc=0; $aco_sub=0; $agent_call_order='order by last_call_finish'; @@ -724,16 +731,32 @@ if ($channel_status < 1) if ($CAMP_callorder =~ /fewest_calls/i) {$aco_sub=1; $agent_call_order = 'order by calls_today';} +$vci=0; +$INBOUNDcampsSQL=''; +$stmtA = "SELECT campaign_id FROM vicidial_campaigns where active='Y' and campaign_allow_inbound='Y';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; + while ($sthArows > $vci) + { + @aryA = $sthA->fetchrow_array; + if ($vci==0) {$INBOUNDcampsSQL .= "'$aryA[0]'";} + else {$INBOUNDcampsSQL .= ",'$aryA[0]'";} + $vci++; + } +$sthA->finish(); + +################################################################ ##### Attempt to send call to an agent on this server only ##### if ($agent_search_method =~ /^SO|^LO/) { + ### Get count of number of calls in this group that are ahead of this call $stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and server_ip='$VARserver_ip' and campaign_id = '$channel_group' and call_time < \"$SQLdateBEGIN\" and lead_id != '$insert_lead_id';"; if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; - - while ($sthArows > $cbc) + if ($sthArows > 0) { @aryA = $sthA->fetchrow_array; $rec_countWAIT = "$aryA[0]"; @@ -743,12 +766,61 @@ if ($agent_search_method =~ /^SO|^LO/) if ($rec_countWAIT < 1) { + $qp_countWAIT=0; + ### Get count of number of waiting calls in higher priority groups than this call or the same priority with longer wait time + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and server_ip='$VARserver_ip' and lead_id != '$insert_lead_id' and ( (queue_priority > '$queue_priority') or (queue_priority = '$queue_priority' and call_time < \"$SQLdateBEGIN\"));"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $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; + $qp_countWAIT = "$aryA[0]"; + } + $sthA->finish(); + + $qp_groupWAIT=''; + $qp_groupWAIT_SQL=''; + $qp_groupWAIT_aco=''; + $qp_groupWAIT_aco_SQL=''; + $qp_groupWAIT_camp_SQL=''; + if ($qp_countWAIT > 0) + { + ### Get group/campaign ids of calls in higher priority groups than this call or the same priority with longer wait time + $stmtA = "SELECT distinct campaign_id FROM vicidial_auto_calls where status = 'LIVE' and server_ip='$VARserver_ip' and lead_id != '$insert_lead_id' and ( (queue_priority > '$queue_priority') or (queue_priority = '$queue_priority' and call_time < \"$SQLdateBEGIN\") );"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $dbc=0; + $qp_groupWAIT=''; + while ($sthArows > $dbc) + { + @aryA = $sthA->fetchrow_array; + $qp_groupWAIT_aco .= "'$aryA[0]',"; + if ($dbc > 0) + { + $qp_groupWAIT .= "and "; + } + $qp_groupWAIT .= "closer_campaigns NOT LIKE \"% $aryA[0] %\" "; + $dbc++; + } + chop($qp_groupWAIT_aco); + + $qp_groupWAIT_SQL = "and ($qp_groupWAIT)"; + $qp_groupWAIT_aco_SQL = "and vicidial_live_inbound_agents.group_id NOT IN($qp_groupWAIT_aco)"; + $qp_groupWAIT_camp_SQL = "and campaign_id NOT IN($qp_groupWAIT_aco)"; + + $sthA->finish(); + } + if ($aco_sub>0) { $stmtA = "LOCK TABLES vicidial_live_agents WRITE, vicidial_live_inbound_agents WRITE;"; my $LOCKaffected_rows = $dbhA->do($stmtA); - $stmtA = "SELECT vicidial_live_agents.conf_exten,vicidial_live_agents.user,vicidial_live_agents.extension from vicidial_live_agents JOIN vicidial_live_inbound_agents ON vicidial_live_agents.user=vicidial_live_inbound_agents.user WHERE status IN('CLOSER','READY') and server_ip='$VARserver_ip' and vicidial_live_inbound_agents.group_id='$channel_group' and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + $stmtA = "SELECT vicidial_live_agents.conf_exten,vicidial_live_agents.user,vicidial_live_agents.extension from vicidial_live_agents JOIN vicidial_live_inbound_agents ON vicidial_live_agents.user=vicidial_live_inbound_agents.user WHERE status IN('CLOSER','READY') and server_ip='$VARserver_ip' and vicidial_live_inbound_agents.group_id='$channel_group' and last_update_time > '$BDtsSQLdate' $qp_groupWAIT_aco_SQL $qp_groupWAIT_camp_SQL $agent_call_order 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; @@ -779,7 +851,7 @@ if ($agent_search_method =~ /^SO|^LO/) } else { - $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$insert_lead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid' where status IN('CLOSER','READY') and server_ip='$VARserver_ip' and campaign_id IN($INBOUNDcampsSQL) and closer_campaigns LIKE \"% $channel_group %\" and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$insert_lead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid' where status IN('CLOSER','READY') and server_ip='$VARserver_ip' and campaign_id IN($INBOUNDcampsSQL) and closer_campaigns LIKE \"% $channel_group %\" and last_update_time > '$BDtsSQLdate' $qp_groupWAIT_SQL $qp_groupWAIT_camp_SQL $agent_call_order limit 1;"; my $affected_rows = $dbhA->do($stmtA); $found_agents=$affected_rows; } @@ -813,7 +885,7 @@ if ($agent_search_method =~ /^SO|^LO/) if ($AGILOG) {$agi_string = "-- VDCL XFER : |$affected_rows|$callerid\n|$stmtA|"; &agi_output;} if ($affected_rows < 1) { - $stmtA = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,uniqueid,callerid,channel,phone_code,phone_number,call_time,call_type,stage) values('$VARserver_ip','$channel_group','CLOSER','$insert_lead_id','$uniqueid','$callerid','$channel','$phone_code','$phone_number','$SQLdate','IN','CLOSER-$drop_timer')"; + $stmtA = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,uniqueid,callerid,channel,phone_code,phone_number,call_time,call_type,stage,queue_priority) values('$VARserver_ip','$channel_group','CLOSER','$insert_lead_id','$uniqueid','$callerid','$channel','$phone_code','$phone_number','$SQLdate','IN','CLOSER-$drop_timer','$queue_priority')"; $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "$affected_rows|VDAC-reinsert|$stmtA|"; &agi_output;} } @@ -938,12 +1010,13 @@ if ($agent_search_method =~ /^LO|^LB/) ##### Attempt to send call to an agent on any server ##### $cbc=0; $rec_countWAITrem=0; + ### Get count of number of calls in this group that are ahead of this call $stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and campaign_id = '$channel_group' and call_time < \"$SQLdateBEGIN\" and lead_id != '$insert_lead_id';"; if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; - while ($sthArows > $cbc) + if ($sthArows > 0) { @aryA = $sthA->fetchrow_array; $rec_countWAITrem = "$aryA[0]"; @@ -953,12 +1026,63 @@ if ($agent_search_method =~ /^LO|^LB/) if ($rec_countWAITrem < 1) { + $qp_countWAIT=0; + ### Get count of number of waiting calls in higher priority groups than this call or the same priority with longer wait time + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and lead_id != '$insert_lead_id' and ( (queue_priority > '$queue_priority') or (queue_priority = '$queue_priority' and call_time < \"$SQLdateBEGIN\") );"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $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; + $qp_countWAIT = "$aryA[0]"; + } + $sthA->finish(); + + $qp_groupWAIT=''; + $qp_groupWAIT_SQL=''; + $qp_groupWAIT_aco=''; + $qp_groupWAIT_aco_SQL=''; + $qp_groupWAIT_camp_SQL=''; + if ($qp_countWAIT > 0) + { + ### Get group/campaign ids of calls in higher priority groups than this call or the same priority with longer wait time + $stmtA = "SELECT distinct campaign_id FROM vicidial_auto_calls where status = 'LIVE' and lead_id != '$insert_lead_id' and ( (queue_priority > '$queue_priority') or (queue_priority = '$queue_priority' and call_time < \"$SQLdateBEGIN\") );"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $dbc=0; + $qp_groupWAIT=''; + while ($sthArows > $dbc) + { + @aryA = $sthA->fetchrow_array; + $qp_groupWAIT_aco .= "'$aryA[0]',"; + if ($dbc > 0) + { + $qp_groupWAIT .= "and "; + } + $qp_groupWAIT .= "closer_campaigns NOT LIKE \"% $aryA[0] %\" "; + $dbc++; + } + chop($qp_groupWAIT_aco); + + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + + $qp_groupWAIT_SQL = "and ($qp_groupWAIT)"; + $qp_groupWAIT_aco_SQL = "and vicidial_live_inbound_agents.group_id NOT IN($qp_groupWAIT_aco)"; + $qp_groupWAIT_camp_SQL = "and campaign_id NOT IN($qp_groupWAIT_aco)"; + + $sthA->finish(); + } + if ($aco_sub>0) { $stmtA = "LOCK TABLES vicidial_live_agents WRITE, vicidial_live_inbound_agents WRITE;"; my $LOCKaffected_rows = $dbhA->do($stmtA); - $stmtA = "SELECT vicidial_live_agents.conf_exten,vicidial_live_agents.user,vicidial_live_agents.extension,vicidial_live_agents.server_ip from vicidial_live_agents JOIN vicidial_live_inbound_agents ON vicidial_live_agents.user=vicidial_live_inbound_agents.user WHERE status IN('CLOSER','READY') and vicidial_live_inbound_agents.group_id='$channel_group' and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + $stmtA = "SELECT vicidial_live_agents.conf_exten,vicidial_live_agents.user,vicidial_live_agents.extension,vicidial_live_agents.server_ip from vicidial_live_agents JOIN vicidial_live_inbound_agents ON vicidial_live_agents.user=vicidial_live_inbound_agents.user WHERE status IN('CLOSER','READY') and vicidial_live_inbound_agents.group_id='$channel_group' and last_update_time > '$BDtsSQLdate' $qp_groupWAIT_aco_SQL $qp_groupWAIT_camp_SQL $agent_call_order 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; @@ -991,7 +1115,7 @@ if ($agent_search_method =~ /^LO|^LB/) } else { - $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$insert_lead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid', call_server_ip='$VARserver_ip' where status IN('CLOSER','READY') and campaign_id IN($INBOUNDcampsSQL) and closer_campaigns LIKE \"% $channel_group %\" and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$insert_lead_id',uniqueid='$unique_id', channel='$channel', callerid='$callerid', call_server_ip='$VARserver_ip' where status IN('CLOSER','READY') and campaign_id IN($INBOUNDcampsSQL) and closer_campaigns LIKE \"% $channel_group %\" and last_update_time > '$BDtsSQLdate' $qp_groupWAIT_SQL $qp_groupWAIT_camp_SQL $agent_call_order limit 1;"; my $affected_rows = $dbhA->do($stmtA); $found_agents=$affected_rows; } @@ -1023,7 +1147,7 @@ if ($agent_search_method =~ /^LO|^LB/) if ($AGILOG) {$agi_string = "-- VDCL XFER REMOTE: |$affected_rows|update of vac table: $callerid\n|$stmtA|"; &agi_output;} if ($affected_rows < 1) { - $stmtA = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,uniqueid,callerid,channel,phone_code,phone_number,call_time,call_type,stage) values('$VARserver_ip','$channel_group','CLOSER','$insert_lead_id','$uniqueid','$callerid','$channel','$phone_code','$phone_number','$SQLdate','IN','CLOSER-$drop_timer')"; + $stmtA = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,uniqueid,callerid,channel,phone_code,phone_number,call_time,call_type,stage,queue_priority) values('$VARserver_ip','$channel_group','CLOSER','$insert_lead_id','$uniqueid','$callerid','$channel','$phone_code','$phone_number','$SQLdate','IN','CLOSER-$drop_timer','$queue_priority')"; $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "$affected_rows|VDAC-reinsert|$stmtA|"; &agi_output;} } @@ -1191,7 +1315,7 @@ $stmtA = "UPDATE vicidial_auto_calls set stage='LIVE-$drop_timer' where callerid $affected_rows = $dbhA->do($stmtA); if ($affected_rows < 1) { - $stmtA = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,uniqueid,callerid,channel,phone_code,phone_number,call_time,call_type,stage) values('$VARserver_ip','$channel_group','CLOSER','$insert_lead_id','$uniqueid','$callerid','$channel','$phone_code','$phone_number','$SQLdate','IN','CLOSER-$drop_timer')"; + $stmtA = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,uniqueid,callerid,channel,phone_code,phone_number,call_time,call_type,stage,queue_priority) values('$VARserver_ip','$channel_group','CLOSER','$insert_lead_id','$uniqueid','$callerid','$channel','$phone_code','$phone_number','$SQLdate','IN','CLOSER-$drop_timer','$queue_priority')"; $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "$affected_rows|VDAC-reinsert|$stmtA|"; &agi_output;} } diff --git a/agc_2-X/trunk/bin/AST_VDauto_dial.pl b/agc_2-X/trunk/bin/AST_VDauto_dial.pl index ae4822bc..c2995f78 100644 --- a/agc_2-X/trunk/bin/AST_VDauto_dial.pl +++ b/agc_2-X/trunk/bin/AST_VDauto_dial.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# AST_VDauto_dial.pl version 2.0.3 *DBI-version* +# AST_VDauto_dial.pl version 2.0.5 *DBI-version* # # DESCRIPTION: # Places auto_dial calls on the VICIDIAL dialer system @@ -25,7 +25,7 @@ # It is good practice to keep this program running by placing the associated # KEEPALIVE script running every minute to ensure this program is always running # -# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 +# Copyright (C) 2008 Matt Florell LICENSE: GPLv2 # # CHANGELOG: # 50125-1201 - Changed dial timeout to 120 seconds from 180 seconds @@ -65,6 +65,7 @@ # 70320-1458 - Fixed several errors in calculating trunk shortage for campaigns # 71029-1909 - Changed CLOSER-type campaign_id restriction # 71030-2054 - Added hopper priority sorting +# 80227-0406 - added queue_priority # @@ -287,6 +288,7 @@ while($one_day_interval > 0) @DBIPserver_trunks_limit=@MT; @DBIPserver_trunks_other=@MT; @DBIPserver_trunks_allowed=@MT; + @DBIPqueue_priority=@MT; $active_line_counter=0; $user_counter=0; @@ -439,7 +441,7 @@ while($one_day_interval > 0) ### grab the dial_level and multiply by active agents to get your goalcalls $DBIPadlevel[$user_CIPct]=0; - $stmtA = "SELECT auto_dial_level,local_call_time,dial_timeout,dial_prefix,campaign_cid,active,campaign_vdad_exten,closer_campaigns,omit_phone_code,available_only_ratio_tally,auto_alt_dial,campaign_allow_inbound FROM vicidial_campaigns where campaign_id='$DBIPcampaign[$user_CIPct]'"; + $stmtA = "SELECT auto_dial_level,local_call_time,dial_timeout,dial_prefix,campaign_cid,active,campaign_vdad_exten,closer_campaigns,omit_phone_code,available_only_ratio_tally,auto_alt_dial,campaign_allow_inbound,queue_priority FROM vicidial_campaigns where campaign_id='$DBIPcampaign[$user_CIPct]'"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -467,6 +469,7 @@ while($one_day_interval > 0) } $DBIPautoaltdial[$user_CIPct] = "$aryA[10]"; $DBIPcampaign_allow_inbound[$user_CIPct] = "$aryA[11]"; + $DBIPqueue_priority[$user_CIPct] = "$aryA[12]"; $rec_count++; } $sthA->finish(); @@ -844,7 +847,7 @@ while($one_day_interval > 0) &event_logger; ### insert a SENT record to the vicidial_auto_calls table - $stmtA = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type,alt_dial) values('$DBIPaddress[$user_CIPct]','$DBIPcampaign[$user_CIPct]','SENT','$lead_id','$VqueryCID','$phone_code','$phone_number','$SQLdate','OUT','$alt_dial')"; + $stmtA = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type,alt_dial,queue_priority) values('$DBIPaddress[$user_CIPct]','$DBIPcampaign[$user_CIPct]','SENT','$lead_id','$VqueryCID','$phone_code','$phone_number','$SQLdate','OUT','$alt_dial','$DBIPqueue_priority[$user_CIPct]')"; $affected_rows = $dbhA->do($stmtA); ### sleep for a tenth of a second to not flood the server with new calls diff --git a/agc_2-X/trunk/bin/AST_VDauto_dial_FILL.pl b/agc_2-X/trunk/bin/AST_VDauto_dial_FILL.pl index 43207096..42beb56b 100644 --- a/agc_2-X/trunk/bin/AST_VDauto_dial_FILL.pl +++ b/agc_2-X/trunk/bin/AST_VDauto_dial_FILL.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# AST_VDauto_dial_FILL.pl version 2.0.3 *DBI-version* +# AST_VDauto_dial_FILL.pl version 2.0.5 *DBI-version* # # DESCRIPTION: # Places auto_dial calls on the VICIDIAL dialer system across all servers only @@ -12,7 +12,7 @@ # # Should only be run on one server in a multi-server Asterisk/VICIDIAL cluster # -# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# Copyright (C) 2008 Matt Florell LICENSE: GPLv2 # # CHANGELOG: # 61115-1246 - First build, framework setup, non-functional @@ -20,7 +20,8 @@ # 70205-1425 - Added code for last called date update # 71030-2054 - Added hopper priority sorting # 71111-2349 - fixed overdialing bug -# +# 80227-0406 - fixed auto-alt-dial and added queue_priority +# ### begin parsing run-time options ### @@ -220,6 +221,7 @@ while($one_day_interval > 0) @DBIPserver_trunks_limit=@MT; @DBIPserver_trunks_other=@MT; @DBIPserver_trunks_allowed=@MT; + @DBIPqueue_priority=@MT; $active_line_counter=0; $camp_counter=0; @@ -281,7 +283,7 @@ while($one_day_interval > 0) ### grab the dial_level and multiply by active agents to get your goalcalls $DBIPadlevel[$camp_CIPct]=0; - $stmtA = "SELECT dial_timeout,dial_prefix,campaign_cid,active,campaign_vdad_exten,omit_phone_code FROM vicidial_campaigns where campaign_id='$DBfill_campaign[$camp_CIPct]'"; + $stmtA = "SELECT dial_timeout,dial_prefix,campaign_cid,active,campaign_vdad_exten,omit_phone_code,auto_alt_dial,queue_priority FROM vicidial_campaigns where campaign_id='$DBfill_campaign[$camp_CIPct]'"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -298,6 +300,9 @@ while($one_day_interval > 0) $omit_phone_code = "$aryA[5]"; if ($omit_phone_code =~ /Y/) {$DBIPomitcode[$camp_CIPct] = 1;} else {$DBIPomitcode[$camp_CIPct] = 0;} + $DBIPautoaltdial[$camp_CIPct] = "$aryA[6]"; + $DBIPqueue_priority[$camp_CIPct] = "$aryA[7]"; + $rec_count++; } $sthA->finish(); @@ -553,7 +558,7 @@ while($one_day_interval > 0) $lead_id=''; $phone_code=''; $phone_number=''; $called_count=''; while ($call_CMPIPct < $UDaffected_rows) { - $stmtA = "SELECT lead_id FROM vicidial_hopper where campaign_id='$DBfill_campaign[$camp_CIPct]' and status='QUEUE' and user='VDAD_$DB_camp_server_server_ip[$server_CIPct]' order by priority desc,hopper_id LIMIT 1"; + $stmtA = "SELECT lead_id,alt_dial FROM vicidial_hopper where campaign_id='$DBfill_campaign[$camp_CIPct]' and status='QUEUE' and user='VDAD_$DB_camp_server_server_ip[$server_CIPct]' order by priority desc,hopper_id LIMIT 1"; print "|$stmtA|\n"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; @@ -564,6 +569,7 @@ while($one_day_interval > 0) { @aryA = $sthA->fetchrow_array; $lead_id = "$aryA[0]"; + $alt_dial = "$aryA[1]"; $rec_count++; } $sthA->finish(); @@ -600,6 +606,8 @@ while($one_day_interval > 0) $called_since_last_reset = "$aryA[9]"; $phone_code = "$aryA[10]"; $phone_number = "$aryA[11]"; + $address3 = "$aryA[18]"; + $alt_phone = "$aryA[26]"; $called_count = "$aryA[30]"; $rec_countCUSTDATA++; @@ -623,7 +631,24 @@ while($one_day_interval > 0) } else {$CSLR = 'Y';} + if ( ($alt_dial =~ /ALT|ADDR3/) && ($DBIPautoaltdial[$camp_CIPct] =~ /ALT|ADDR/) ) + { + if ( ($alt_dial =~ /ALT/) && ($DBIPautoaltdial[$camp_CIPct] =~ /ALT/) ) + { + $alt_phone =~ s/\D//gi; + $phone_number = $alt_phone; + } + if ( ($alt_dial =~ /ADDR3/) && ($DBIPautoaltdial[$camp_CIPct] =~ /ADDR3/) ) + { + $address3 =~ s/\D//gi; + $phone_number = $address3; + } + $stmtA = "UPDATE vicidial_list set called_since_last_reset='$CSLR',user='VDAD' where lead_id='$lead_id'"; + } + else + { $stmtA = "UPDATE vicidial_list set called_since_last_reset='$CSLR', called_count='$called_count',user='VDAD' where lead_id='$lead_id'"; + } $affected_rows = $dbhA->do($stmtA); $stmtA = "DELETE FROM vicidial_hopper where lead_id='$lead_id'"; @@ -669,11 +694,11 @@ while($one_day_interval > 0) $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$DB_camp_server_server_ip[$server_CIPct]','','Originate','$VqueryCID','Exten: $VDAD_dial_exten','Context: $ext_context','Channel: $local_DEF$Ndialstring$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','')"; $affected_rows = $dbhA->do($stmtA); - $event_string = "| number call dialed|$DBfill_campaign[$camp_CIPct]|$VqueryCID|$stmtA|$gmt_offset_now|"; + $event_string = "| number call dialed|$DBfill_campaign[$camp_CIPct]|$VqueryCID|$stmtA|$gmt_offset_now|$alt_dial|"; &event_logger; ### insert a SENT record to the vicidial_auto_calls table - $stmtA = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('$DB_camp_server_server_ip[$server_CIPct]','$DBfill_campaign[$camp_CIPct]','SENT','$lead_id','$VqueryCID','$phone_code','$phone_number','$SQLdate','OUTBALANCE')"; + $stmtA = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type,alt_dial,queue_priority) values('$DB_camp_server_server_ip[$server_CIPct]','$DBfill_campaign[$camp_CIPct]','SENT','$lead_id','$VqueryCID','$phone_code','$phone_number','$SQLdate','OUTBALANCE','$alt_dial','$DBIPqueue_priority[$camp_CIPct]')"; $affected_rows = $dbhA->do($stmtA); ### sleep for a tenth of a second to not flood the server with new calls diff --git a/agc_2-X/trunk/docs/conf_examples/extensions.conf.sample b/agc_2-X/trunk/docs/conf_examples/extensions.conf.sample index fc6d7470..a3ca677c 100644 --- a/agc_2-X/trunk/docs/conf_examples/extensions.conf.sample +++ b/agc_2-X/trunk/docs/conf_examples/extensions.conf.sample @@ -306,9 +306,8 @@ exten => _*NXXNXXXXXX*3429,6,Voicemail,u2000 ; BE SURE TO CHANGE THESE FOR YOUR IP ADDRESS! exten => _010*010*010*015*8600XXX,1,Goto(default,${EXTEN:16},1) -exten => _010*010*010*015*8600XXX*.,1,Goto(default,${EXTEN:16},1) exten => _010*010*010*015*78600XXX,1,Goto(default,${EXTEN:16},1) -exten => _010*010*010*015*78600XXX*.,1,Goto(default,${EXTEN:16},1) +exten => _010*010*010*015*.,1,Goto(default,${EXTEN:16},1) exten => _8600XXX*.,1,AGI(agi-VDADfixCXFER.agi) exten => _78600XXX*.,1,AGI(agi-VDADfixCXFER.agi) diff --git a/agc_2-X/trunk/extras/upgrade_2.0.5.sql b/agc_2-X/trunk/extras/upgrade_2.0.5.sql index a0f8904c..459aa50d 100644 --- a/agc_2-X/trunk/extras/upgrade_2.0.5.sql +++ b/agc_2-X/trunk/extras/upgrade_2.0.5.sql @@ -61,3 +61,10 @@ ALTER TABLE vicidial_log DROP INDEX uniqueid; ALTER TABLE vicidial_log MODIFY uniqueid VARCHAR(20) PRIMARY KEY UNIQUE NOT NULL; UPDATE system_settings SET db_schema_version='1075'; + +ALTER TABLE vicidial_auto_calls ADD queue_priority TINYINT(2) default '0'; +ALTER TABLE vicidial_campaigns ADD queue_priority TINYINT(2) default '50'; +ALTER TABLE vicidial_inbound_groups ADD queue_priority TINYINT(2) default '0'; + +UPDATE system_settings SET db_schema_version='1076'; + diff --git a/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt b/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt index be082b89..1a6c1c32 100644 --- a/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt +++ b/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt @@ -24,6 +24,8 @@ USERS CAN QC ANY CAMPAIGN|| USERS CAN QC ANY INBOUND GROUP|| QC Allowed Campaigns: || QC Allowed Inbound Groups: || +Queue Priority -<\/B> This setting is used to define the order in which the calls from this outbound campaign should be answered in relation to the inbound calls if this campaign is in blended mode|| +Queue Priority: || ############################################################ CLIENT diff --git a/agc_2-X/trunk/www/vicidial/AST_timeonVDADall.php b/agc_2-X/trunk/www/vicidial/AST_timeonVDADall.php index a6afbf6b..4910a2b8 100644 --- a/agc_2-X/trunk/www/vicidial/AST_timeonVDADall.php +++ b/agc_2-X/trunk/www/vicidial/AST_timeonVDADall.php @@ -1,7 +1,7 @@ LICENSE: GPLv2 +# Copyright (C) 2008 Matt Florell LICENSE: GPLv2 # # live real-time stats for the VICIDIAL Auto-Dialer all servers # @@ -28,7 +28,8 @@ # 70206-1140 - Added call-type statuses to display(A-Auto, M-Manual, I-Inbound/Closer) # 70619-1339 - Added Status Category tally display # 71029-1900 - Changed CLOSER-type to not require campaign_id restriction -# +# 80227-0418 - Added priority to waiting calls display +# header ("Content-type: text/html; charset=utf-8"); @@ -515,18 +516,18 @@ if ($campaign_allow_inbound > 0) $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); $closer_campaigns = "'$closer_campaigns'"; - $stmtB="from vicidial_auto_calls where status NOT IN('XFER') and ( (call_type='IN' and campaign_id IN($closer_campaigns)) or (campaign_id='" . mysql_real_escape_string($group) . "' and call_type IN('OUT','OUTBALANCE')) ) order by campaign_id,call_time;"; + $stmtB="from vicidial_auto_calls where status NOT IN('XFER') and ( (call_type='IN' and campaign_id IN($closer_campaigns)) or (campaign_id='" . mysql_real_escape_string($group) . "' and call_type IN('OUT','OUTBALANCE')) ) order by queue_priority desc,campaign_id,call_time;"; } else { if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';} else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";} - $stmtB="from vicidial_auto_calls where status NOT IN('XFER') $groupSQL order by campaign_id,call_time;"; + $stmtB="from vicidial_auto_calls where status NOT IN('XFER') $groupSQL order by queue_priority desc,campaign_id,call_time;"; } if ($CALLSdisplay > 0) { - $stmtA = "SELECT status,campaign_id,phone_number,server_ip,UNIX_TIMESTAMP(call_time),call_type"; + $stmtA = "SELECT status,campaign_id,phone_number,server_ip,UNIX_TIMESTAMP(call_time),call_type,queue_priority"; } else { @@ -565,6 +566,7 @@ $parked_to_print = mysql_num_rows($rslt); $CDserver_ip[$k] = $row[3]; $CDcall_time[$k] = $row[4]; $CDcall_type[$k] = $row[5]; + $CDqueue_priority[$k] = $row[6]; $k++; } } @@ -606,9 +608,9 @@ $parked_to_print = mysql_num_rows($rslt); $Cecho = ''; $Cecho .= "VICIDIAL: Calls Waiting $NOW_TIME\n"; -$Cecho .= "+--------+--------------+--------------+-----------------+---------+------------+\n"; -$Cecho .= "| STATUS | CAMPAIGN | PHONE NUMBER | SERVER_IP | DIALTIME| CALL TYPE |\n"; -$Cecho .= "+--------+--------------+--------------+-----------------+---------+------------+\n"; +$Cecho .= "+--------+--------------+--------------+-----------------+---------+------------+----------+\n"; +$Cecho .= "| STATUS | CAMPAIGN | PHONE NUMBER | SERVER_IP | DIALTIME| CALL TYPE | PRIORITY |\n"; +$Cecho .= "+--------+--------------+--------------+-----------------+---------+------------+----------+\n"; $p=0; while($p<$k) @@ -618,6 +620,7 @@ while($p<$k) $Cphone_number = sprintf("%-12s", $CDphone_number[$p]); $Cserver_ip = sprintf("%-15s", $CDserver_ip[$p]); $Ccall_type = sprintf("%-10s", $CDcall_type[$p]); + $Cqueue_priority = sprintf("%8s", $CDqueue_priority[$p]); $Ccall_time_S = ($STARTtime - $CDcall_time[$p]); $Ccall_time_M = ($Ccall_time_S / 60); @@ -635,11 +638,11 @@ while($p<$k) { $G=""; $EG=''; } - $Cecho .= "| $G$Cstatus$EG | $G$Ccampaign_id$EG | $G$Cphone_number$EG | $G$Cserver_ip$EG | $G$Ccall_time_MS$EG | $G$Ccall_type$EG |\n"; + $Cecho .= "| $G$Cstatus$EG | $G$Ccampaign_id$EG | $G$Cphone_number$EG | $G$Cserver_ip$EG | $G$Ccall_time_MS$EG | $G$Ccall_type$EG | $G$Cqueue_priority$EG |\n"; $p++; } -$Cecho .= "+--------+--------------+--------------+-----------------+---------+------------+\n\n"; +$Cecho .= "+--------+--------------+--------------+-----------------+---------+------------+----------+\n"; if ($p<1) {$Cecho='';} @@ -921,6 +924,7 @@ $talking_to_print = mysql_num_rows($rslt); else { echo " NO AGENTS ON CALLS \n"; + echo "
$Cecho";
 	}
 
 ?>
diff --git a/agc_2-X/trunk/www/vicidial/admin.php b/agc_2-X/trunk/www/vicidial/admin.php
index 3353f3e0..ef5ef963 100644
--- a/agc_2-X/trunk/www/vicidial/admin.php
+++ b/agc_2-X/trunk/www/vicidial/admin.php
@@ -683,6 +683,8 @@ if (isset($_GET["qc_campaigns"]))				{$qc_campaigns=$_GET["qc_campaigns"];}
 	elseif (isset($_POST["qc_campaigns"]))		{$qc_campaigns=$_POST["qc_campaigns"];}
 if (isset($_GET["qc_groups"]))					{$qc_groups=$_GET["qc_groups"];}
 	elseif (isset($_POST["qc_groups"]))			{$qc_groups=$_POST["qc_groups"];}
+if (isset($_GET["queue_priority"]))				{$queue_priority=$_GET["queue_priority"];}
+	elseif (isset($_POST["queue_priority"]))	{$queue_priority=$_POST["queue_priority"];}
 
 
 	if (isset($script_id)) {$script_id= strtoupper($script_id);}
@@ -830,6 +832,7 @@ $qc_commit = ereg_replace("[^0-9]","",$qc_commit);
 ### DIGITS and DASHES
 $group_rank = ereg_replace("[^-0-9]","",$group_rank);
 $campaign_rank = ereg_replace("[^-0-9]","",$campaign_rank);
+$queue_priority = ereg_replace("[^-0-9]","",$queue_priority);
 
 ### Y or N ONLY ###
 $active = ereg_replace("[^NY]","",$active);
@@ -1163,12 +1166,12 @@ $list_mix_container = ereg_replace(";","",$list_mix_container);
 # 80107-1204 - Started framework for new QC section
 # 80112-0242 - Added more options for lead order
 # 80211-1901 - Added DB Schema Version to system settings display
-#
+# 80224-1334 - Added Queue Priority to in-groups and campaigns
 # 
 # make sure you have added a user to the vicidial_users MySQL table with at least user_level 8 to access this page the first time
 
-$admin_version = '2.0.5-121';
-$build = '80211-1901';
+$admin_version = '2.0.5-122';
+$build = '80224-1334';
 
 $STARTtime = date("U");
 $SQLdate = date("Y-m-d H:i:s");
@@ -1763,7 +1766,12 @@ if ( ( (strlen($ADD)>4) && ($ADD < 99998) ) or ($ADD==3) or (($ADD>20) and ($ADD
 				}
 			$p++;
 			}
-		$groups_list .= "> $group_id_values[$o] - $group_name_values[$o] 
\n"; + $stmt="SELECT queue_priority from vicidial_inbound_groups where group_id='$group_id_values[$o]';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $VIG_priority = $row[0]; + + $groups_list .= "> $group_id_values[$o] - $group_name_values[$o] - $VIG_priority
\n"; $XFERgroups_list .= "> $group_id_values[$o] - $group_name_values[$o]
\n"; $RANKgroups_list .= "> $group_id_values[$o] - $group_name_values[$o] "; $RANKgroups_list .= "     $NWB#vicidial_campaigns-concurrent_transfers$NWE\n"; + echo "Queue Priority: $NWB#vicidial_campaigns-queue_priority$NWE\n"; echo "Auto Alt-Number Dialing: $NWB#vicidial_campaigns-auto_alt_dial$NWE\n"; @@ -11069,6 +11103,7 @@ if ($ADD==3111) $agent_alert_exten = $row[26]; $agent_alert_delay = $row[27]; $default_xfer_group = $row[28]; + $queue_priority = $row[29]; ##### get in-groups listings for dynamic pulldown $stmt="SELECT group_id,group_name from vicidial_inbound_groups order by group_id"; @@ -11105,6 +11140,22 @@ if ($ADD==3111) echo "Active: $NWB#vicidial_inbound_groups-active$NWE\n"; echo "Web Form: $NWB#vicidial_inbound_groups-web_form_address$NWE\n"; echo "Next Agent Call: $NWB#vicidial_inbound_groups-next_agent_call$NWE\n"; + + echo "Queue Priority: $NWB#vicidial_inbound_groups-queue_priority$NWE\n"; + echo "Fronter Display: $NWB#vicidial_inbound_groups-fronter_display$NWE\n"; echo "Script: