From 6b7b7374f47971272a042b21b3cc8306a7af7fed Mon Sep 17 00:00:00 2001 From: mattf Date: Fri, 2 Dec 2011 18:51:29 +0000 Subject: [PATCH] Added new Grade-Random Next-Agent-Call methods that allow for agents to have a higher or lower probability of receiving the next call depending on their grade for a specific in-group or campaign. git-svn-id: svn://192.168.202.10@1759 3d104415-ff17-0410-8863-d5cf3c621b8a --- agc_2-X/trunk/UPGRADE | 4 + agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi | 114 ++++++++++--- agc_2-X/trunk/agi/agi-VDAD_ALL_outbound.agi | 133 ++++++++++++++- agc_2-X/trunk/bin/AST_VDremote_agents.pl | 10 +- .../trunk/extras/MySQL_AST_CREATE_tables.sql | 36 ++-- agc_2-X/trunk/extras/upgrade_2.4.sql | 12 ++ .../TO_BE_TRANSLATED_2.4.txt | 4 + agc_2-X/trunk/www/agc/vdc_db_query.php | 15 +- agc_2-X/trunk/www/agc/vicidial.php | 15 +- agc_2-X/trunk/www/vicidial/admin.php | 156 +++++++++++++----- 10 files changed, 400 insertions(+), 99 deletions(-) diff --git a/agc_2-X/trunk/UPGRADE b/agc_2-X/trunk/UPGRADE index 0bb7710d..e7c0d640 100644 --- a/agc_2-X/trunk/UPGRADE +++ b/agc_2-X/trunk/UPGRADE @@ -771,6 +771,10 @@ OTHER CHANGES: 176. Added new Inbound Daily Report. +177. Added new Grade-Random Next-Agent-Call methods that allow for agents to + have a higher or lower probability of receiving the next call depending + on their grade for a specific in-group or campaign. + 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 07ea0935..261710b2 100644 --- a/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi +++ b/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi @@ -170,6 +170,7 @@ # 110923-1133 - Added drop and after-hours to callmenu, and added action transfer cid setting # 111102-2014 - Added in-group max_calls_ feature # 111116-0157 - Added ALT and ADDR3 methods for CIDLOOKUP +# 111201-1457 - Added grade-random next-agent-call option for inbound # $script = 'agi-VDAD_ALL_inbound.agi'; @@ -181,7 +182,7 @@ $wait_prompt_runs=0; $at='@'; $S='*'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=189; +$mysql_log_count=191; $one_mysql_log=0; @@ -2002,6 +2003,8 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override if ($CAMP_callorder =~ /campaign_rank/i) {$agent_call_order = 'order by campaign_weight desc,last_call_finish';} if ($CAMP_callorder =~ /fewest_calls_campaign/i) {$agent_call_order = 'order by vicidial_live_agents.calls_today,vicidial_live_agents.last_call_finish';} if ($CAMP_callorder =~ /inbound_group_rank/i) {$aco_sub=1; $agent_call_order = 'order by group_weight desc,vicidial_live_inbound_agents.last_call_finish';} + if ($CAMP_callorder =~ /ingroup_grade_random/i) {$aco_sub=1; $agent_call_order = 'order by random_id';} + if ($CAMP_callorder =~ /campaign_grade_random/i) {$aco_sub=1; $agent_call_order = 'order by random_id';} if ($CAMP_callorder =~ /fewest_calls$/i) {$aco_sub=1; $agent_call_order = 'order by vicidial_live_inbound_agents.calls_today,vicidial_live_inbound_agents.last_call_finish';} if ($CAMP_callorder =~ /ring_all$/i) {$aco_sub=0; $agent_call_order = 'order by vicidial_live_agents.last_state_change';} @@ -2164,26 +2167,99 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override {$sthArows=0;} else { - $stmtA = "SELECT vicidial_live_agents.conf_exten,vicidial_live_agents.user,vicidial_live_agents.extension,vicidial_live_agents.server_ip,vicidial_live_inbound_agents.group_weight,ra_user,vicidial_live_agents.campaign_id,on_hook_agent,on_hook_ring_time from vicidial_live_agents, vicidial_live_inbound_agents WHERE vicidial_live_agents.user=vicidial_live_inbound_agents.user and status IN('CLOSER','READY') and lead_id<1 $ADUfindSQL and vicidial_live_inbound_agents.group_id='$channel_group' and last_update_time > '$BDtsSQLdate' and vicidial_live_agents.user NOT IN($ring_no_answer_agents$vlia_users) and ring_callerid='' $qp_groupWAIT_camp_SQL $agent_call_order limit 1;"; - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - $dbhP=$dbhA; $mysql_count='02058'; $MEL_aff_rows=$sthArows; &mysql_error_logging; - if ($sthArows > 0) + ### BEGIN grade random next-agent-call routing ### + if ($CAMP_callorder =~ /grade/) { - @aryA = $sthA->fetchrow_array; - $VDADconf_exten = $aryA[0]; - $VDADuser = $aryA[1]; - $VDADextension = $aryA[2]; - $VDADserver_ip = $aryA[3]; - $VDADgroup_weight = $aryA[4]; - $ra_user = $aryA[5]; - $log_campaign = $aryA[6]; - $VDADon_hook_agent = $aryA[7]; - $VDADon_hook_ring_time = $aryA[8]; + @GRADEuser=@MT; + @GRADEgrade=@MT; + @userGRADEarray=@MT; + $stmtA = "SELECT vicidial_live_agents.user,vicidial_live_inbound_agents.group_grade,vicidial_live_agents.campaign_grade from vicidial_live_agents, vicidial_live_inbound_agents WHERE vicidial_live_agents.user=vicidial_live_inbound_agents.user and status IN('CLOSER','READY') and lead_id<1 $ADUfindSQL and vicidial_live_inbound_agents.group_id='$channel_group' and last_update_time > '$BDtsSQLdate' and vicidial_live_agents.user NOT IN($ring_no_answer_agents$vlia_users) and ring_callerid='' $qp_groupWAIT_camp_SQL limit 1000;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $dbhP=$dbhA; $mysql_count='02190'; $MEL_aff_rows=$sthArows; &mysql_error_logging; + $gg=0; + $ga=0; + while ($gg < $sthArows) + { + @aryA = $sthA->fetchrow_array; + $GRADEuser[$gg] = $aryA[0]; + if ($CAMP_callorder =~ /ingroup_grade_random/) + {$GRADEgrade[$gg] = $aryA[1];} + else + {$GRADEgrade[$gg] = $aryA[2];} + if ($GRADEgrade[$gg] < 1) + {$GRADEgrade[$gg] = 1;} + $gi=0; + while ($gi < $GRADEgrade[$gg]) + { + $userGRADEarray[$ga] = $GRADEuser[$gg]; + # print STDERR " GRADE ENTRY: $userGRADEarray[$ga]|$ga|$gi|$GRADEgrade[$gg]\n"; + $gi++; + $ga++; + } + $gg++; + } + $sthA->finish(); + + $sthArows=0; + if ($ga > 0) + { + $GRADErandom = int( rand($ga)); + $userGRADEchosen = $userGRADEarray[$GRADErandom]; + + if ($AGILOG) {$agi_string = "GRADE RANDOM: $userGRADEchosen|$GRADErandom|$CAMP_callorder|$gg|$ga|$callerid"; &agi_output;} + + $stmtA = "SELECT vicidial_live_agents.conf_exten,vicidial_live_agents.user,vicidial_live_agents.extension,vicidial_live_agents.server_ip,vicidial_live_inbound_agents.group_weight,ra_user,vicidial_live_agents.campaign_id,on_hook_agent,on_hook_ring_time,vicidial_live_inbound_agents.group_grade,vicidial_live_agents.campaign_grade from vicidial_live_agents, vicidial_live_inbound_agents WHERE vicidial_live_agents.user='$userGRADEchosen' limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $dbhP=$dbhA; $mysql_count='02191'; $MEL_aff_rows=$sthArows; &mysql_error_logging; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $VDADconf_exten = $aryA[0]; + $VDADuser = $aryA[1]; + $VDADextension = $aryA[2]; + $VDADserver_ip = $aryA[3]; + $VDADgroup_weight = $aryA[4]; + $ra_user = $aryA[5]; + $log_campaign = $aryA[6]; + $VDADon_hook_agent = $aryA[7]; + $VDADon_hook_ring_time = $aryA[8]; + $group_grade = $aryA[9]; + $campaign_grade = $aryA[10]; + } + $sthA->finish(); + } + if ($AGILOG) {$agi_string = "$VDADuser|$VDADgroup_weight|$stmtA|"; &agi_output;} + } + ### END grade random next-agent-call routing ### + else + { + $stmtA = "SELECT vicidial_live_agents.conf_exten,vicidial_live_agents.user,vicidial_live_agents.extension,vicidial_live_agents.server_ip,vicidial_live_inbound_agents.group_weight,ra_user,vicidial_live_agents.campaign_id,on_hook_agent,on_hook_ring_time,vicidial_live_inbound_agents.group_grade,vicidial_live_agents.campaign_grade from vicidial_live_agents, vicidial_live_inbound_agents WHERE vicidial_live_agents.user=vicidial_live_inbound_agents.user and status IN('CLOSER','READY') and lead_id<1 $ADUfindSQL and vicidial_live_inbound_agents.group_id='$channel_group' and last_update_time > '$BDtsSQLdate' and vicidial_live_agents.user NOT IN($ring_no_answer_agents$vlia_users) and ring_callerid='' $qp_groupWAIT_camp_SQL $agent_call_order limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $dbhP=$dbhA; $mysql_count='02058'; $MEL_aff_rows=$sthArows; &mysql_error_logging; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $VDADconf_exten = $aryA[0]; + $VDADuser = $aryA[1]; + $VDADextension = $aryA[2]; + $VDADserver_ip = $aryA[3]; + $VDADgroup_weight = $aryA[4]; + $ra_user = $aryA[5]; + $log_campaign = $aryA[6]; + $VDADon_hook_agent = $aryA[7]; + $VDADon_hook_ring_time = $aryA[8]; + $group_grade = $aryA[9]; + $campaign_grade = $aryA[10]; + } + $sthA->finish(); + if ($AGILOG) {$agi_string = "$VDADuser|$VDADgroup_weight|$stmtA|"; &agi_output;} } - $sthA->finish(); - if ($AGILOG) {$agi_string = "$VDADuser|$VDADgroup_weight|$stmtA|"; &agi_output;} } ### END in-group-rank-based next-agent-call processing ### } diff --git a/agc_2-X/trunk/agi/agi-VDAD_ALL_outbound.agi b/agc_2-X/trunk/agi/agi-VDAD_ALL_outbound.agi index a005ea23..e8bd0328 100644 --- a/agc_2-X/trunk/agi/agi-VDAD_ALL_outbound.agi +++ b/agc_2-X/trunk/agi/agi-VDAD_ALL_outbound.agi @@ -91,12 +91,13 @@ # 110812-1514 - Added static tts file parsing and replacement # 110829-2324 - Added survey_recording option # 110926-1929 - Small fixes +# 111201-1751 - Added grade-random next-agent-call option # $script = 'agi-VDAD_ALL_outbound.agi'; $AGILOG = '0'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=84; +$mysql_log_count=92; $one_mysql_log=0; @@ -1696,6 +1697,7 @@ while ($drop_timer <= $DROP_TIME) if ($CAMP_callorder =~ /random/i) {$agent_call_order = 'order by random_id';} if ($CAMP_callorder =~ /campaign_rank/i) {$agent_call_order = 'order by campaign_weight desc,last_call_finish';} if ($CAMP_callorder =~ /fewest_calls/i) {$aco_sub=1; $agent_call_order = 'order by calls_today';} + if ($CAMP_callorder =~ /campaign_grade_random/i) {$aco_sub=1; $agent_call_order = 'order by random_id';} ##### Attempt to send call to an agent on this server only ##### @@ -1846,10 +1848,68 @@ while ($drop_timer <= $DROP_TIME) $rec_countWAIT = ($rec_countWAITOUT + $rec_countWAITIN); if ($rec_countWAIT < $concurrent_transfers) { - $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$CIDlead_id',uniqueid='$unique_id', channel='$channel', call_server_ip='$VARserver_ip', callerid='$callerid',comments='AUTO' where status = 'READY' and lead_id<1 and server_ip='$VARserver_ip' and ring_callerid='' and campaign_id='$VDADcampaign' and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; - $affected_rows = $dbhA->do($stmtA); - $dbhP=$dbhA; $mysql_count='01035'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; + ### BEGIN grade random next-agent-call routing ### + if ($CAMP_callorder =~ /grade/) + { + $stmtA = "LOCK TABLES vicidial_live_agents WRITE;"; + my $LOCKaffected_rows = $dbhA->do($stmtA); + $dbhP=$dbhA; $mysql_count='01085'; $MEL_aff_rows=$LOCKaffected_rows; &mysql_error_logging; + @GRADEuser=@MT; + @GRADEgrade=@MT; + @userGRADEarray=@MT; + $stmtA = "SELECT user,campaign_grade from vicidial_live_agents WHERE status='READY' and lead_id<1 and ring_callerid='' and server_ip='$VARserver_ip' and campaign_id='$VDADcampaign' and last_update_time > '$BDtsSQLdate' limit 1000;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $dbhP=$dbhA; $mysql_count='01086'; $MEL_aff_rows=$sthArows; &mysql_error_logging; + $gg=0; + $ga=0; + while ($gg < $sthArows) + { + @aryA = $sthA->fetchrow_array; + $GRADEuser[$gg] = $aryA[0]; + $GRADEgrade[$gg] = $aryA[1]; + if ($GRADEgrade[$gg] < 1) + {$GRADEgrade[$gg] = 1;} + $gi=0; + while ($gi < $GRADEgrade[$gg]) + { + $userGRADEarray[$ga] = $GRADEuser[$gg]; + # print STDERR " GRADE ENTRY: $userGRADEarray[$ga]|$ga|$gi|$GRADEgrade[$gg]\n"; + $gi++; + $ga++; + } + $gg++; + } + $sthA->finish(); + + $sthArows=0; + $affected_rows=0; + if ($ga > 0) + { + $GRADErandom = int( rand($ga)); + $userGRADEchosen = $userGRADEarray[$GRADErandom]; + + if ($AGILOG) {$agi_string = "GRADE RANDOM: $userGRADEchosen|$GRADErandom|$CAMP_callorder|$gg|$ga|$callerid"; &agi_output;} + + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$CIDlead_id',uniqueid='$unique_id', channel='$channel', call_server_ip='$VARserver_ip', callerid='$callerid',comments='AUTO' where status='READY' and lead_id<1 and ring_callerid='' and server_ip='$VARserver_ip' and campaign_id='$VDADcampaign' and last_update_time > '$BDtsSQLdate' and user='$userGRADEchosen' limit 1;"; + $affected_rows = $dbhA->do($stmtA); + $dbhP=$dbhA; $mysql_count='01087'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; + } + if ($AGILOG) {$agi_string = "$VDADuser|$VDADgroup_weight|$stmtA|"; &agi_output;} + + $stmtA = "UNLOCK TABLES;"; + my $LOCKaffected_rows = $dbhA->do($stmtA); + $dbhP=$dbhA; $mysql_count='01088'; $MEL_aff_rows=$LOCKaffected_rows; &mysql_error_logging; + } + ### END grade random next-agent-call routing ### + else + { + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$CIDlead_id',uniqueid='$unique_id', channel='$channel', call_server_ip='$VARserver_ip', callerid='$callerid',comments='AUTO' where status = 'READY' and lead_id<1 and server_ip='$VARserver_ip' and ring_callerid='' and campaign_id='$VDADcampaign' and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + $affected_rows = $dbhA->do($stmtA); + $dbhP=$dbhA; $mysql_count='01035'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; + } if ($AGILOG) {$agi_string = "-- VDAD get agent: |$affected_rows|update of vla table: $VDADcampaign|$VARserver_ip\n|$stmtA|"; &agi_output;} if ($affected_rows > 0) { @@ -2297,9 +2357,68 @@ while ($drop_timer <= $DROP_TIME) $rec_countWAITrem = ($rec_countWAITremOUT + $rec_countWAITremIN); if ($rec_countWAITrem < $concurrent_transfers) { - $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$CIDlead_id',uniqueid='$unique_id', channel='$channel', call_server_ip='$VARserver_ip', callerid='$callerid',comments='AUTO' where status = 'READY' and lead_id<1 and ring_callerid='' and campaign_id='$VDADcampaign' and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; - $affected_rows = $dbhA->do($stmtA); - $dbhP=$dbhA; $mysql_count='01042'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; + ### BEGIN grade random next-agent-call routing ### + if ($CAMP_callorder =~ /grade/) + { + $stmtA = "LOCK TABLES vicidial_live_agents WRITE;"; + my $LOCKaffected_rows = $dbhA->do($stmtA); + $dbhP=$dbhA; $mysql_count='01089'; $MEL_aff_rows=$LOCKaffected_rows; &mysql_error_logging; + + @GRADEuser=@MT; + @GRADEgrade=@MT; + @userGRADEarray=@MT; + $stmtA = "SELECT user,campaign_grade from vicidial_live_agents WHERE status='READY' and lead_id<1 and ring_callerid='' and campaign_id='$VDADcampaign' and last_update_time > '$BDtsSQLdate' limit 1000;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $dbhP=$dbhA; $mysql_count='01090'; $MEL_aff_rows=$sthArows; &mysql_error_logging; + $gg=0; + $ga=0; + while ($gg < $sthArows) + { + @aryA = $sthA->fetchrow_array; + $GRADEuser[$gg] = $aryA[0]; + $GRADEgrade[$gg] = $aryA[1]; + if ($GRADEgrade[$gg] < 1) + {$GRADEgrade[$gg] = 1;} + $gi=0; + while ($gi < $GRADEgrade[$gg]) + { + $userGRADEarray[$ga] = $GRADEuser[$gg]; + # print STDERR " GRADE ENTRY: $userGRADEarray[$ga]|$ga|$gi|$GRADEgrade[$gg]\n"; + $gi++; + $ga++; + } + $gg++; + } + $sthA->finish(); + + $sthArows=0; + $affected_rows=0; + if ($ga > 0) + { + $GRADErandom = int( rand($ga)); + $userGRADEchosen = $userGRADEarray[$GRADErandom]; + + if ($AGILOG) {$agi_string = "GRADE RANDOM: $userGRADEchosen|$GRADErandom|$CAMP_callorder|$gg|$ga|$callerid"; &agi_output;} + + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$CIDlead_id',uniqueid='$unique_id', channel='$channel', call_server_ip='$VARserver_ip', callerid='$callerid',comments='AUTO' where status='READY' and lead_id<1 and ring_callerid='' and campaign_id='$VDADcampaign' and last_update_time > '$BDtsSQLdate' and user='$userGRADEchosen' limit 1;"; + $affected_rows = $dbhA->do($stmtA); + $dbhP=$dbhA; $mysql_count='01091'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; + } + if ($AGILOG) {$agi_string = "$VDADuser|$VDADgroup_weight|$stmtA|"; &agi_output;} + + $stmtA = "UNLOCK TABLES;"; + my $LOCKaffected_rows = $dbhA->do($stmtA); + $dbhP=$dbhA; $mysql_count='01092'; $MEL_aff_rows=$LOCKaffected_rows; &mysql_error_logging; + } + ### END grade random next-agent-call routing ### + else + { + $stmtA = "UPDATE vicidial_live_agents set status='QUEUE',lead_id='$CIDlead_id',uniqueid='$unique_id', channel='$channel', call_server_ip='$VARserver_ip', callerid='$callerid',comments='AUTO' where status='READY' and lead_id<1 and ring_callerid='' and campaign_id='$VDADcampaign' and last_update_time > '$BDtsSQLdate' $agent_call_order limit 1;"; + $affected_rows = $dbhA->do($stmtA); + $dbhP=$dbhA; $mysql_count='01042'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; + } if ($AGILOG) {$agi_string = "-- VDAD get agent: |$affected_rows|update of vla table: $VDADcampaign|$VARserver_ip\n|$stmtA|"; &agi_output;} if ($affected_rows > 0) diff --git a/agc_2-X/trunk/bin/AST_VDremote_agents.pl b/agc_2-X/trunk/bin/AST_VDremote_agents.pl index e8d16bdd..cb7008ac 100644 --- a/agc_2-X/trunk/bin/AST_VDremote_agents.pl +++ b/agc_2-X/trunk/bin/AST_VDremote_agents.pl @@ -42,6 +42,7 @@ # 110304-0007 - Added agent on-hook compatibility # 110626-0030 - Added queuemetrics_pe_phone_append # 110707-1342 - Added last_inbound_call_time to next agent call options for inbound +# 111201-1428 - Added grade-random next-agent-call option for inbound # ### begin parsing run-time options ### @@ -676,7 +677,7 @@ while($one_day_interval > 0) } } } - ##### If there are selected inbound/closer groups, gather in-group rankings and insert/update if needed + ##### If there are selected inbound/closer groups, gather in-group rankings/gradings and insert/update if needed @TEMPingroups=@MT; $TEMPagentINGROUPS=''; if (length($DBremote_closer[$h]) > 1) @@ -699,7 +700,7 @@ while($one_day_interval > 0) $TEMPexistsVLIA=0; # grab the group weight and calls today of the agent in each in-group $DBuser_level[$h]='1'; - $stmtA = "SELECT group_weight,calls_today FROM vicidial_inbound_group_agents where user='$DBuser_start[$h]' and group_id='$TEMPingroups[$s]';"; + $stmtA = "SELECT group_weight,calls_today,group_grade FROM vicidial_inbound_group_agents where user='$DBuser_start[$h]' and group_id='$TEMPingroups[$s]';"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArowsVIGA=$sthA->rows; @@ -708,10 +709,11 @@ while($one_day_interval > 0) @aryA = $sthA->fetchrow_array; $TEMPagentWEIGHT = $aryA[0]; $TEMPagentCALLS = $aryA[1]; + $TEMPagentGRADE = $aryA[2]; } $sthA->finish(); - $stmtA = "SELECT count(*) FROM vicidial_live_inbound_agents where user='$DBremote_user[$h]' and group_id='$TEMPingroups[$s]' and group_weight='$TEMPagentWEIGHT';"; + $stmtA = "SELECT count(*) FROM vicidial_live_inbound_agents where user='$DBremote_user[$h]' and group_id='$TEMPingroups[$s]' and group_weight='$TEMPagentWEIGHT' and group_grade='$TEMPagentGRADE';"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArowsVLIA=$sthA->rows; @@ -728,7 +730,7 @@ while($one_day_interval > 0) if ($TEMPexistsVLIA < 1) { - $stmtA = "INSERT IGNORE INTO vicidial_live_inbound_agents SET user='$DBremote_user[$h]', group_id='$TEMPingroups[$s]', group_weight='$TEMPagentWEIGHT', calls_today='$TEMPagentCALLS', last_call_time='$SQLdate', last_call_finish='$SQLdate' ON DUPLICATE KEY UPDATE group_weight='$TEMPagentWEIGHT';"; + $stmtA = "INSERT IGNORE INTO vicidial_live_inbound_agents SET user='$DBremote_user[$h]', group_id='$TEMPingroups[$s]', group_weight='$TEMPagentWEIGHT', calls_today='$TEMPagentCALLS', last_call_time='$SQLdate', last_call_finish='$SQLdate', group_grade='$TEMPagentGRADE' ON DUPLICATE KEY UPDATE group_weight='$TEMPagentWEIGHT',group_grade='$TEMPagentGRADE';"; $affected_rows = $dbhA->do($stmtA); if ( ($DBX) && ($affected_rows > 0) ) {print STDERR "$DBremote_user[$h] VLIA UPDATE: $affected_rows|$TEMPingroups[$s]|$TEMPagentWEIGHT\n";} 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 d5b2a54d..fa7c97bb 100644 --- a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql +++ b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql @@ -295,7 +295,7 @@ source_id VARCHAR(50), list_id BIGINT(14) UNSIGNED NOT NULL DEFAULT '0', gmt_offset_now DECIMAL(4,2) DEFAULT '0.00', called_since_last_reset ENUM('Y','N','Y1','Y2','Y3','Y4','Y5','Y6','Y7','Y8','Y9','Y10') default 'N', -phone_code VARCHAR(10), +phone_code VARCHAR(10), phone_number VARCHAR(18) NOT NULL, title VARCHAR(4), first_name VARCHAR(30), @@ -334,9 +334,9 @@ index (owner) CREATE TABLE vicidial_hopper ( hopper_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, lead_id INT(9) UNSIGNED NOT NULL, -campaign_id VARCHAR(8), +campaign_id VARCHAR(8), status ENUM('READY','QUEUE','INCALL','DONE','HOLD','DNC') default 'READY', -user VARCHAR(20), +user VARCHAR(20), list_id BIGINT(14) UNSIGNED NOT NULL, gmt_offset_now DECIMAL(4,2) DEFAULT '0.00', state VARCHAR(2) default '', @@ -354,7 +354,7 @@ conf_exten VARCHAR(20), extension VARCHAR(100), status ENUM('READY','QUEUE','INCALL','PAUSED','CLOSER') default 'PAUSED', lead_id INT(9) UNSIGNED NOT NULL, -campaign_id VARCHAR(8), +campaign_id VARCHAR(8), uniqueid VARCHAR(20), callerid VARCHAR(20), channel VARCHAR(100), @@ -396,6 +396,7 @@ on_hook_ring_time SMALLINT(5) default '15', ring_callerid VARCHAR(20) default '', last_inbound_call_time DATETIME, last_inbound_call_finish DATETIME, +campaign_grade TINYINT(2) UNSIGNED default '1', index (random_id), index (last_call_time), index (last_update_time), @@ -405,7 +406,7 @@ index (last_call_finish) CREATE TABLE vicidial_auto_calls ( auto_call_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, server_ip VARCHAR(15) NOT NULL, -campaign_id VARCHAR(20), +campaign_id VARCHAR(20), status ENUM('SENT','RINGING','LIVE','XFER','PAUSED','CLOSER','BUSY','DISCONNECT','IVR') default 'PAUSED', lead_id INT(9) UNSIGNED NOT NULL, uniqueid VARCHAR(20), @@ -657,7 +658,7 @@ web_form_address TEXT, allow_closers ENUM('Y','N'), hopper_level INT(8) UNSIGNED default '1', auto_dial_level VARCHAR(6) default '0', -next_agent_call ENUM('random','oldest_call_start','oldest_call_finish','campaign_rank','overall_user_level','fewest_calls','longest_wait_time') default 'longest_wait_time', +next_agent_call ENUM('random','oldest_call_start','oldest_call_finish','campaign_rank','overall_user_level','fewest_calls','longest_wait_time','campaign_grade_random') default 'longest_wait_time', local_call_time VARCHAR(10) DEFAULT '9am-9pm', voicemail_ext VARCHAR(10), dial_timeout TINYINT UNSIGNED default '60', @@ -1170,14 +1171,14 @@ extensions_list TEXT CREATE TABLE vicidial_callbacks ( callback_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, lead_id INT(9) UNSIGNED, -list_id BIGINT(14) UNSIGNED, -campaign_id VARCHAR(8), +list_id BIGINT(14) UNSIGNED, +campaign_id VARCHAR(8), status VARCHAR(10), entry_time DATETIME, callback_time DATETIME, modify_date TIMESTAMP, user VARCHAR(20), -recipient ENUM('USERONLY','ANYONE'), +recipient ENUM('USERONLY','ANYONE'), comments VARCHAR(255), user_group VARCHAR(20), lead_status VARCHAR(6) default 'CALLBK', @@ -1191,7 +1192,7 @@ pins_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, entry_time DATETIME, phone_number VARCHAR(18), lead_id INT(9) UNSIGNED, -campaign_id VARCHAR(20), +campaign_id VARCHAR(20), product_code VARCHAR(20), user VARCHAR(20), digits VARCHAR(20), @@ -1505,7 +1506,7 @@ recording_filename VARCHAR(50), company_id VARCHAR(12), phone_number VARCHAR(18), lead_id INT(9) UNSIGNED, -campaign_id VARCHAR(20), +campaign_id VARCHAR(20), product_code VARCHAR(20), user VARCHAR(20), prompt_audio_1 VARCHAR(20), @@ -1556,11 +1557,12 @@ ALTER TABLE vicidial_ivr AUTO_INCREMENT = 1000000; CREATE TABLE vicidial_inbound_group_agents ( user VARCHAR(20), -group_id VARCHAR(20), +group_id VARCHAR(20), group_rank TINYINT(1) default '0', group_weight TINYINT(1) default '0', calls_today SMALLINT(5) UNSIGNED default '0', group_web_vars VARCHAR(255) default '', +group_grade TINYINT(2) UNSIGNED default '1', index (group_id), index (user), unique index viga_user_group_id (user, group_id) @@ -1568,11 +1570,12 @@ unique index viga_user_group_id (user, group_id) CREATE TABLE vicidial_live_inbound_agents ( user VARCHAR(20), -group_id VARCHAR(20), +group_id VARCHAR(20), group_weight TINYINT(1) default '0', calls_today SMALLINT(5) UNSIGNED default '0', last_call_time DATETIME, last_call_finish DATETIME, +group_grade TINYINT(2) UNSIGNED default '1', index (group_id), index (group_weight), unique index vlia_user_group_id (user, group_id) @@ -1580,11 +1583,12 @@ unique index vlia_user_group_id (user, group_id) CREATE TABLE vicidial_campaign_agents ( user VARCHAR(20), -campaign_id VARCHAR(20), +campaign_id VARCHAR(20), campaign_rank TINYINT(1) default '0', campaign_weight TINYINT(1) default '0', calls_today SMALLINT(5) UNSIGNED default '0', group_web_vars VARCHAR(255) default '', +campaign_grade TINYINT(2) UNSIGNED default '1', index (campaign_id), index (user) ); @@ -2140,7 +2144,7 @@ user VARCHAR(20), server_ip VARCHAR(15) NOT NULL, event_time DATETIME, lead_id INT(9) UNSIGNED, -campaign_id VARCHAR(8), +campaign_id VARCHAR(8), pause_epoch INT(10) UNSIGNED, pause_sec SMALLINT(5) UNSIGNED default '0', wait_epoch INT(10) UNSIGNED, @@ -2754,7 +2758,7 @@ CREATE TABLE vicidial_log_noanswer_archive LIKE vicidial_log_noanswer; CREATE TABLE vicidial_did_agent_log_archive LIKE vicidial_did_agent_log; CREATE UNIQUE INDEX vdala on vicidial_did_agent_log_archive (uniqueid,call_date,did_route); -UPDATE system_settings SET db_schema_version='1309',db_schema_update_date=NOW(); +UPDATE system_settings SET db_schema_version='1310',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.4.sql b/agc_2-X/trunk/extras/upgrade_2.4.sql index 28f0bef2..02eb8575 100644 --- a/agc_2-X/trunk/extras/upgrade_2.4.sql +++ b/agc_2-X/trunk/extras/upgrade_2.4.sql @@ -1205,3 +1205,15 @@ ALTER TABLE vicidial_live_agents MODIFY external_status VARCHAR(255) default ''; ALTER TABLE system_settings ADD svn_version VARCHAR(100) default ''; UPDATE system_settings SET db_schema_version='1309',db_schema_update_date=NOW() where db_schema_version < 1309; + +ALTER TABLE vicidial_live_agents ADD campaign_grade TINYINT(2) UNSIGNED default '1'; + +ALTER TABLE vicidial_inbound_group_agents ADD group_grade TINYINT(2) UNSIGNED default '1'; + +ALTER TABLE vicidial_live_inbound_agents ADD group_grade TINYINT(2) UNSIGNED default '1'; + +ALTER TABLE vicidial_campaign_agents ADD campaign_grade TINYINT(2) UNSIGNED default '1'; + +ALTER TABLE vicidial_campaigns MODIFY next_agent_call ENUM('random','oldest_call_start','oldest_call_finish','campaign_rank','overall_user_level','fewest_calls','longest_wait_time','campaign_grade_random') default 'longest_wait_time'; + +UPDATE system_settings SET db_schema_version='1310',db_schema_update_date=NOW() where db_schema_version < 1310; diff --git a/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt b/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt index 2f6293a4..f48c9522 100644 --- a/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt +++ b/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt @@ -818,6 +818,10 @@ This option must be set higher than 0 if you want to use the Max Calls Method fe Max Calls Action|| This is the action to be taken if the Max Calls Method is enabled and the number of calls exceeds what is set above in the Max Calls Count setting. The calls above that amount will be sent to either the DROP action, the AFTERHOURS action or the NO_AGENT_NO_QUEUE action and will be logged as a MAXCAL status with a MAXCALLS hangup reason. Default is NO_AGENT_NO_QUEUE|| If a CIDLOOKUP method is used with ALT, it will search the alt_phone field for the phone number if no matches are found for the main phone number. If a CIDLOOKUP method is used with ADDR3, it will search the address3 field for the phone number if no matches are found for the main phone number and optionally the alt_phone field|| +Another field in this section is GRADE, which allows for the campaign_grade_random Next Agent Call setting to be used. This grade setting will increase or decrease the probability that the agent will receive the call|| +gives a higher probability of getting a call to the higher graded agents|| +gives a higher probability of getting a call to the higher graded agents by in-group|| +gives a higher probability of getting a call to the higher graded agents by campaign|| lead_report_export.php 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 48b7aba2..31aecad8 100644 --- a/agc_2-X/trunk/www/agc/vdc_db_query.php +++ b/agc_2-X/trunk/www/agc/vdc_db_query.php @@ -300,10 +300,11 @@ # 111021-1707 - Added callback_hours_block feature # 111024-1238 - Added callback_list_calltime option # 111114-0035 - Added qm-dispo-code field to updatedispo function +# 111201-1443 - Added group_grade option # -$version = '2.4-200'; -$build = '111114-0035'; +$version = '2.4-201'; +$build = '111201-1443'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=438; $one_mysql_log=0; @@ -1017,7 +1018,7 @@ if ($ACTION == 'regCLOSER') { if (strlen($in_groups[$k])>1) { - $stmt="SELECT group_weight,calls_today FROM vicidial_inbound_group_agents where user='$user' and group_id='$in_groups[$k]';"; + $stmt="SELECT group_weight,calls_today,group_grade FROM vicidial_inbound_group_agents where user='$user' and group_id='$in_groups[$k]';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00013',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -1025,15 +1026,17 @@ if ($ACTION == 'regCLOSER') if ($viga_ct > 0) { $row=mysql_fetch_row($rslt); - $group_weight = $row[0]; + $group_weight = $row[0]; $calls_today = $row[1]; + $group_grade = $row[2]; } else { $group_weight = 0; $calls_today = 0; + $group_grade = 1; } - $stmt="INSERT INTO vicidial_live_inbound_agents set user='$user',group_id='$in_groups[$k]',group_weight='$group_weight',calls_today='$calls_today',last_call_time='$NOW_TIME',last_call_finish='$NOW_TIME';"; + $stmt="INSERT INTO vicidial_live_inbound_agents set user='$user',group_id='$in_groups[$k]',group_weight='$group_weight',calls_today='$calls_today',last_call_time='$NOW_TIME',last_call_finish='$NOW_TIME',group_grade='$group_grade';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00014',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5850,7 +5853,7 @@ if ($ACTION == 'userLOGout') $vla_delete = mysql_affected_rows($link); ##### Delete the vicidial_live_inbound_agents records for this session - $stmt="DELETE from vicidial_live_inbound_agents where user ='$user';"; + $stmt="DELETE from vicidial_live_inbound_agents where user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00131',$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 ef178a0c..34d4e1b0 100644 --- a/agc_2-X/trunk/www/agc/vicidial.php +++ b/agc_2-X/trunk/www/agc/vicidial.php @@ -371,10 +371,11 @@ # 111021-1623 - Fix for rare stuck vac issue with manual alt dial # 111024-1237 - Added callback_list_calltime option # 111114-0039 - Added scheduled callback and qm-dispo-code fields to API +# 111202-1444 - Added grade-random next-agent-call options # -$version = '2.4-338c'; -$build = '111114-0039'; +$version = '2.4-339c'; +$build = '111202-1444'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=75; $one_mysql_log=0; @@ -2523,7 +2524,7 @@ else } ##### grab the campaign_weight and number of calls today on that campaign for the agent - $stmt="SELECT campaign_weight,calls_today FROM vicidial_campaign_agents where user='$VD_login' and campaign_id = '$VD_campaign';"; + $stmt="SELECT campaign_weight,calls_today,campaign_grade FROM vicidial_campaign_agents where user='$VD_login' and campaign_id = '$VD_campaign';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01042',$VD_login,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -2533,13 +2534,15 @@ else $row=mysql_fetch_row($rslt); $campaign_weight = $row[0]; $calls_today = $row[1]; + $campaign_grade = $row[2]; $i++; } else { $campaign_weight = '0'; $calls_today = '0'; - $stmt="INSERT INTO vicidial_campaign_agents (user,campaign_id,campaign_rank,campaign_weight,calls_today) values('$VD_login','$VD_campaign','0','0','$calls_today');"; + $campaign_grade = '1'; + $stmt="INSERT INTO vicidial_campaign_agents (user,campaign_id,campaign_rank,campaign_weight,calls_today,campaign_grade) values('$VD_login','$VD_campaign','0','0','$calls_today','$campaign_grade');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01043',$VD_login,$server_ip,$session_name,$one_mysql_log);} @@ -2552,7 +2555,7 @@ else echo "\n"; $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,outbound_autodial,manager_ingroup_set,on_hook_ring_time,on_hook_agent,last_inbound_call_time,last_inbound_call_finish) 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','N','$phone_ring_timeout','$on_hook_agent','$NOW_TIME','$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,manager_ingroup_set,on_hook_ring_time,on_hook_agent,last_inbound_call_time,last_inbound_call_finish,campaign_grade) 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','N','$phone_ring_timeout','$on_hook_agent','$NOW_TIME','$NOW_TIME','$campaign_grade');"; 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);} @@ -2615,7 +2618,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,outbound_autodial,manager_ingroup_set,on_hook_ring_time,on_hook_agent) 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','N','$phone_ring_timeout','$on_hook_agent');"; + $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,manager_ingroup_set,on_hook_ring_time,on_hook_agent,campaign_grade) 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','N','$phone_ring_timeout','$on_hook_agent','$campaign_grade');"; 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);} diff --git a/agc_2-X/trunk/www/vicidial/admin.php b/agc_2-X/trunk/www/vicidial/admin.php index 216c8c92..18e08f10 100644 --- a/agc_2-X/trunk/www/vicidial/admin.php +++ b/agc_2-X/trunk/www/vicidial/admin.php @@ -3018,12 +3018,13 @@ else # 111106-1116 - Many fixes for user_group restrictions # 111116-0207 - Added ALT and ADDR3 in-group handle methods # 111122-1333 - Added Inbound Daily Report +# 111201-0939 - Added graded-random next-agent-call option # # 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.4-349a'; -$build = '111122-1333'; +$admin_version = '2.4-350a'; +$build = '111201-0939'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -3698,7 +3699,7 @@ if ( ( (strlen($ADD)>4) and ($ADD < 99998) ) or ($ADD==3) or (($ADD>20) and ($AD $campaigns_to_print = mysql_num_rows($rslt); $campaigns_list=''; $campaigns_value=''; - $RANKcampaigns_list="CAMPAIGN     RANK     CALLSWEB VARS\n"; + $RANKcampaigns_list="CAMPAIGN     RANK     GRADE     CALLSWEB VARS\n"; $o=0; while ($campaigns_to_print > $o) @@ -3715,18 +3716,19 @@ if ( ( (strlen($ADD)>4) and ($ADD < 99998) ) or ($ADD==3) or (($ADD>20) and ($AD { $group_web_vars=''; $campaign_web=''; - $stmt="SELECT campaign_rank,calls_today,group_web_vars from vicidial_campaign_agents where user='$user' and campaign_id='$campaign_id_values[$o]' $LOGallowed_campaignsSQL;"; + $stmt="SELECT campaign_rank,calls_today,group_web_vars,campaign_grade from vicidial_campaign_agents where user='$user' and campaign_id='$campaign_id_values[$o]' $LOGallowed_campaignsSQL;"; $rslt=mysql_query($stmt, $link); $ranks_to_print = mysql_num_rows($rslt); if ($ranks_to_print > 0) { $row=mysql_fetch_row($rslt); - $SELECT_campaign_rank = $row[0]; - $calls_today = $row[1]; - $group_web_vars = $row[2]; + $SELECT_campaign_rank = $row[0]; + $calls_today = $row[1]; + $group_web_vars = $row[2]; + $SELECT_campaign_grade = $row[3]; } else - {$calls_today=0; $SELECT_campaign_rank=0; $group_web_vars='';} + {$calls_today=0; $SELECT_campaign_rank=0; $SELECT_campaign_grade=1; $group_web_vars='';} if ( ($ADD=="4A") or ($ADD=="4B") ) { $stmt_grp_values=''; @@ -3734,30 +3736,37 @@ if ( ( (strlen($ADD)>4) and ($ADD < 99998) ) or ($ADD==3) or (($ADD>20) and ($AD elseif (isset($_POST["RANK_$campaign_id_values[$o]"])) {$campaign_rank=$_POST["RANK_$campaign_id_values[$o]"];} if (isset($_GET["WEB_$campaign_id_values[$o]"])) {$campaign_web=$_GET["WEB_$campaign_id_values[$o]"];} elseif (isset($_POST["WEB_$campaign_id_values[$o]"])) {$campaign_web=$_POST["WEB_$campaign_id_values[$o]"];} + if (isset($_GET["GRADE_$campaign_id_values[$o]"])) {$campaign_grade=$_GET["GRADE_$campaign_id_values[$o]"];} + elseif (isset($_POST["GRADE_$campaign_id_values[$o]"])) {$campaign_grade=$_POST["GRADE_$campaign_id_values[$o]"];} if ($non_latin < 1) { $campaign_rank = ereg_replace("[^-\_0-9]","",$campaign_rank); $campaign_web = preg_replace("/;|\"|\'/","",$campaign_web); + $campaign_grade = ereg_replace("[^-\_0-9]","",$campaign_grade); } if ($ranks_to_print > 0) { - $stmt="UPDATE vicidial_campaign_agents set campaign_rank='$campaign_rank', campaign_weight='$campaign_rank', group_web_vars='$campaign_web' where campaign_id='$campaign_id_values[$o]' and user='$user';"; + $stmt="UPDATE vicidial_campaign_agents set campaign_rank='$campaign_rank', campaign_weight='$campaign_rank', group_web_vars='$campaign_web',campaign_grade='$campaign_grade' where campaign_id='$campaign_id_values[$o]' and user='$user';"; $rslt=mysql_query($stmt, $link); $stmt_grp_values .= "$stmt|"; } else { - $stmt="INSERT INTO vicidial_campaign_agents set campaign_rank='$campaign_rank', campaign_weight='$campaign_rank', campaign_id='$campaign_id_values[$o]', user='$user', group_web_vars='$campaign_web';"; + $stmt="INSERT INTO vicidial_campaign_agents set campaign_rank='$campaign_rank', campaign_weight='$campaign_rank', campaign_id='$campaign_id_values[$o]', user='$user', group_web_vars='$campaign_web',campaign_grade='$campaign_grade';"; $rslt=mysql_query($stmt, $link); $stmt_grp_values .= "$stmt|"; } - $stmt="UPDATE vicidial_live_agents set campaign_weight='$campaign_rank' where campaign_id='$campaign_id_values[$o]' and user='$user';"; + $stmt="UPDATE vicidial_live_agents set campaign_weight='$campaign_rank',campaign_grade='$campaign_grade' where campaign_id='$campaign_id_values[$o]' and user='$user';"; $rslt=mysql_query($stmt, $link); $stmt_grp_values .= "$stmt|"; } - else {$campaign_rank = $SELECT_campaign_rank;} + else + { + $campaign_rank = $SELECT_campaign_rank; + $campaign_grade = $SELECT_campaign_grade; + } if (eregi("1$|3$|5$|7$|9$", $o)) {$bgcolor='bgcolor="#B9CBFD"';} @@ -3777,16 +3786,16 @@ if ( ( (strlen($ADD)>4) and ($ADD < 99998) ) or ($ADD==3) or (($ADD>20) and ($AD $allowed_campaigns = preg_replace("/ -$/","",$allowed_campaigns); $UGcampaigns = explode(" ", $allowed_campaigns); - $p=0; $RANK_camp_active=0; $CR_disabled = ''; + $p=0; $RANK_camp_active=0; $GRADE_camp_active=0; $CR_disabled = ''; if (eregi('-ALL-CAMPAIGNS-',$allowed_campaigns)) - {$RANK_camp_active++;} + {$RANK_camp_active++; $GRADE_camp_active++;} else { $UGcampaign_ct = count($UGcampaigns); while ($p < $UGcampaign_ct) { if ($campaign_id_values[$o] == $UGcampaigns[$p]) - {$RANK_camp_active++;} + {$RANK_camp_active++; $GRADE_camp_active++;} $p++; } } @@ -3795,7 +3804,7 @@ if ( ( (strlen($ADD)>4) and ($ADD < 99998) ) or ($ADD==3) or (($ADD>20) and ($AD $RANKcampaigns_list .= ""; $campaigns_list .= "$campaign_id_values[$o] - $campaign_name_values[$o]
\n"; $RANKcampaigns_list .= "$campaign_id_values[$o] - $campaign_name_values[$o] "; - $RANKcampaigns_list .= "     \n"; $h="9"; while ($h>=-9) { @@ -3808,6 +3817,19 @@ if ( ( (strlen($ADD)>4) and ($ADD < 99998) ) or ($ADD==3) or (($ADD>20) and ($AD if ( (strlen($campaign_web) < 1) and (strlen($group_web_vars) > 0) ) {$campaign_web=$group_web_vars;} $RANKcampaigns_list .= "\n"; + $RANKcampaigns_list .= "   \n"; $RANKcampaigns_list .= "     $calls_today\n"; $RANKcampaigns_list .= "     \n"; $o++; @@ -3873,7 +3895,7 @@ if ( ( (strlen($ADD)>4) and ($ADD < 99998) ) or ($ADD==3) or (($ADD>20) and ($AD $groups_list=''; $groups_value=''; $XFERgroups_list=''; - $RANKgroups_list="INBOUND GROUP     RANK     CALLSWEB VARS\n"; + $RANKgroups_list="INBOUND GROUP     RANK     GRADE     CALLSWEB VARS\n"; $o=0; while ($groups_to_print > $o) @@ -3889,7 +3911,7 @@ if ( ( (strlen($ADD)>4) and ($ADD < 99998) ) or ($ADD==3) or (($ADD>20) and ($AD { $group_web_vars=''; $group_web=''; - $stmt="SELECT group_rank,calls_today,group_web_vars from vicidial_inbound_group_agents where user='$user' and group_id='$group_id_values[$o]';"; + $stmt="SELECT group_rank,calls_today,group_web_vars,group_grade from vicidial_inbound_group_agents where user='$user' and group_id='$group_id_values[$o]';"; $rslt=mysql_query($stmt, $link); $ranks_to_print = mysql_num_rows($rslt); if ($ranks_to_print > 0) @@ -3898,40 +3920,48 @@ if ( ( (strlen($ADD)>4) and ($ADD < 99998) ) or ($ADD==3) or (($ADD>20) and ($AD $SELECT_group_rank = $row[0]; $calls_today = $row[1]; $group_web_vars = $row[2]; + $SELECT_group_grade = $row[3]; } else - {$calls_today=0; $SELECT_group_rank=0;} + {$calls_today=0; $SELECT_group_rank=0; $SELECT_group_grade=1;} if ( ($ADD=="4A") or ($ADD=="4B") ) { if (isset($_GET["RANK_$group_id_values[$o]"])) {$group_rank=$_GET["RANK_$group_id_values[$o]"];} elseif (isset($_POST["RANK_$group_id_values[$o]"])) {$group_rank=$_POST["RANK_$group_id_values[$o]"];} if (isset($_GET["WEB_$group_id_values[$o]"])) {$group_web=$_GET["WEB_$group_id_values[$o]"];} elseif (isset($_POST["WEB_$group_id_values[$o]"])) {$group_web=$_POST["WEB_$group_id_values[$o]"];} + if (isset($_GET["GRADE_$group_id_values[$o]"])) {$group_grade=$_GET["GRADE_$group_id_values[$o]"];} + elseif (isset($_POST["GRADE_$group_id_values[$o]"])) {$group_grade=$_POST["GRADE_$group_id_values[$o]"];} if ($non_latin < 1) { $group_rank = ereg_replace("[^-\_0-9]","",$group_rank); $group_web = preg_replace("/;|\"|\'/","",$group_web); + $group_grade = ereg_replace("[^-\_0-9]","",$group_grade); } if ($ranks_to_print > 0) { - $stmt="UPDATE vicidial_inbound_group_agents set group_rank='$group_rank', group_weight='$group_rank', group_web_vars='$group_web' where group_id='$group_id_values[$o]' and user='$user';"; + $stmt="UPDATE vicidial_inbound_group_agents set group_rank='$group_rank', group_weight='$group_rank', group_web_vars='$group_web', group_grade='$group_grade' where group_id='$group_id_values[$o]' and user='$user';"; $rslt=mysql_query($stmt, $link); $stmt_grp_values .= "$stmt|"; } else { - $stmt="INSERT INTO vicidial_inbound_group_agents set group_rank='$group_rank', group_weight='$group_rank', group_id='$group_id_values[$o]', user='$user', group_web_vars='$group_web';"; + $stmt="INSERT INTO vicidial_inbound_group_agents set group_rank='$group_rank', group_weight='$group_rank', group_id='$group_id_values[$o]', user='$user', group_web_vars='$group_web', group_grade='$group_grade';"; $rslt=mysql_query($stmt, $link); $stmt_grp_values .= "$stmt|"; } - $stmt="UPDATE vicidial_live_inbound_agents set group_weight='$group_rank' where group_id='$group_id_values[$o]' and user='$user';"; + $stmt="UPDATE vicidial_live_inbound_agents set group_weight='$group_rank', group_grade='$group_grade' where group_id='$group_id_values[$o]' and user='$user';"; $rslt=mysql_query($stmt, $link); $stmt_grp_values .= "$stmt|"; } - else {$group_rank = $SELECT_group_rank;} + else + { + $group_rank = $SELECT_group_rank; + $group_grade = $SELECT_group_grade; + } if (eregi("1$|3$|5$|7$|9$", $o)) {$bgcolor='bgcolor="#B9CBFD"';} @@ -3972,7 +4002,7 @@ if ( ( (strlen($ADD)>4) and ($ADD < 99998) ) or ($ADD==3) or (($ADD>20) and ($AD $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 .= "     \n"; $h="9"; while ($h>=-9) { @@ -3985,6 +4015,19 @@ if ( ( (strlen($ADD)>4) and ($ADD < 99998) ) or ($ADD==3) or (($ADD>20) and ($AD if ( (strlen($group_web) < 1) and (strlen($group_web_vars) > 0) ) {$group_web=$group_web_vars;} $RANKgroups_list .= "\n"; + $RANKgroups_list .= "   \n"; $RANKgroups_list .= "     $calls_today\n"; $RANKgroups_list .= "     \n"; $o++; @@ -4306,9 +4349,9 @@ if ($ADD==99999) Preset Contact Search - If the user is logged into a campaign that has Transfer Presets set to CONTACTS, then this setting can disable contact searching for this user only. Default is NOT_ACTIVE which will use whatever the campaign setting is.
- +
- Campaign Ranks - In this section you can define the rank an agent will have for each campaign. These ranks can be used to allow for preferred call routing when Next Agent Call is set to campaign_rank. Also in this section are the WEB VARs for each campaign. These allow each agent to have a different variable string that can be added to the WEB FORM or SCRIPT tab URLs by simply putting --A--web_vars--B-- as you would put any other field. + Campaign Ranks - In this section you can define the rank an agent will have for each campaign. These ranks can be used to allow for preferred call routing when Next Agent Call is set to campaign_rank. Also in this section are the WEB VARs for each campaign. These allow each agent to have a different variable string that can be added to the WEB FORM or SCRIPT tab URLs by simply putting --A--web_vars--B-- as you would put any other field. Another field in this section is GRADE, which allows for the campaign_grade_random Next Agent Call setting to be used. This grade setting will increase or decrease the probability that the agent will receive the call.
@@ -5057,6 +5100,7 @@ if ($ADD==99999)
  - oldest_call_finish: orders by the last time an agent finished a call. AKA agent waiting longest receives first call.
  - overall_user_level: orders by the user_level of the agent as defined in the vicidial_users table a higher user_level will receive more calls.
  - campaign_rank: orders by the rank given to the agent for the campaign. Highest to Lowest. +
  - campaign_grade_random: gives a higher probability of getting a call to the higher graded agents.
  - fewest_calls: orders by the number of calls received by an agent for that specific inbound group. Least calls first.
  - longest_wait_time: orders by the amount of time agent has been actively waiting for a call. @@ -5698,8 +5742,10 @@ if ($ADD==99999)
  - oldest_inbound_call_finish: orders by the last time an agent finished an inbound call. AKA agent waiting longest receives first call.
  - overall_user_level: orders by the user_level of the agent as defined in the vicidial_users table a higher user_level will receive more calls.
  - inbound_group_rank: orders by the rank given to the agent for the specific inbound group. Highest to Lowest. -
  - fewest_calls: orders by the number of calls received by an agent for that specific inbound group. Least calls first.
  - campaign_rank: orders by the rank given to the agent for the campaign. Highest to Lowest. +
  - ingroup_grade_random: gives a higher probability of getting a call to the higher graded agents by in-group. +
  - campaign_grade_random: gives a higher probability of getting a call to the higher graded agents by campaign. +
  - fewest_calls: orders by the number of calls received by an agent for that specific inbound group. Least calls first.
  - fewest_calls_campaign: orders by the number of calls received by an agent for the campaign. Least calls first.
  - longest_wait_time: orders by the amount of time agent has been actively waiting for a call.
  - ring_all: rings all available agents until one picks up the phone. @@ -8954,7 +9000,7 @@ if ($ADD==11) } echo "(0 = off)$NWB#vicidial_campaigns-auto_dial_level$NWE\n"; } - echo "Next Agent Call: $NWB#vicidial_campaigns-next_agent_call$NWE\n"; + echo "Next Agent Call: $NWB#vicidial_campaigns-next_agent_call$NWE\n"; echo "Local Call Time: $NWB#vicidial_campaigns-local_call_time$NWE\n"; @@ -9424,7 +9470,7 @@ if ($ADD==1111) echo "$NWB#vicidial_inbound_groups-user_group$NWE\n"; echo "Web Form: $NWB#vicidial_inbound_groups-web_form_address$NWE\n"; echo "Voicemail: $NWB#vicidial_inbound_groups-voicemail_ext$NWE\n"; - echo "Next Agent Call: $NWB#vicidial_inbound_groups-next_agent_call$NWE\n"; + echo "Next Agent Call: $NWB#vicidial_inbound_groups-next_agent_call$NWE\n"; echo "Fronter Display: $NWB#vicidial_inbound_groups-fronter_display$NWE\n"; echo "Script: $NWB#vicidial_users-preset_contact_search$NWE\n"; echo "Campaign Ranks: $NWB#vicidial_users-campaign_ranks$NWE
\n"; - echo "\n"; + echo "
\n"; echo "$RANKcampaigns_list"; echo "
\n"; echo "\n"; echo "Inbound Groups: $NWB#vicidial_users-closer_campaigns$NWE
\n"; - echo "\n"; + echo "
\n"; echo "$RANKgroups_list"; echo "
\n"; echo "\n"; @@ -21024,7 +21070,7 @@ if ($ADD==31) echo "Auto Alt-Number Dialing: $NWB#vicidial_campaigns-auto_alt_dial$NWE $ALTmultiLINK\n"; } - echo "Next Agent Call: $NWB#vicidial_campaigns-next_agent_call$NWE\n"; + echo "Next Agent Call: $NWB#vicidial_campaigns-next_agent_call$NWE\n"; echo "
Local Call Time: $NWB#vicidial_inbound_groups-web_form_address$NWE\n"; } - echo "Next Agent Call: $NWB#vicidial_inbound_groups-next_agent_call$NWE\n"; + echo "Next Agent Call: $NWB#vicidial_inbound_groups-next_agent_call$NWE\n"; echo "Queue Priority: \n"; + $users_output .= "