Added Max Inbound Calls options to Campaigns and Users to enforce a maximum number of inbound calls received per day per agent
git-svn-id: svn://192.168.202.10@2104 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -203,6 +203,9 @@ OTHER CHANGES:
|
||||
|
||||
38. Added Performance Comparison Report
|
||||
|
||||
39. Added Max Inbound Calls options to Campaigns and Users to enforce a maximum
|
||||
number of inbound calls received per day per agent.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -190,6 +190,7 @@
|
||||
# 140126-1129 - Added VMAIL_NO_INST options
|
||||
# 140215-2133 - Added several variable options for QM socket URL
|
||||
# 140312-2111 - Added CALLID as recording filename variable
|
||||
# 140417-0932 - Added max inbound calls feature
|
||||
#
|
||||
|
||||
$script = 'agi-VDAD_ALL_inbound.agi';
|
||||
@@ -201,7 +202,7 @@ $wait_prompt_runs=0;
|
||||
$at='@';
|
||||
$S='*';
|
||||
$mel=1; # Mysql Error Log enabled = 1
|
||||
$mysql_log_count=196;
|
||||
$mysql_log_count=208;
|
||||
$one_mysql_log=0;
|
||||
$dial_ingroup_flag=0;
|
||||
$called_count=1;
|
||||
@@ -1450,7 +1451,7 @@ if ( ( ( ( ($hm < $ct_default_start) || ($hm > $ct_default_stop) ) && ($hm >= $c
|
||||
|
||||
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='$uniqueid',queue='NONE',agent='NONE',verb='INFO',data1='IVRSTART',data2='$phone_number',data3='$channel_group',serverid='$queuemetrics_log_id';";
|
||||
$Baffected_rows = $dbhB->do($stmtB);
|
||||
$dbhP=$dbhB; $stmtA=$stmtB; $mysql_count='02XXX'; $MEL_aff_rows=$Baffected_rows; &mysql_error_logging;
|
||||
$dbhP=$dbhB; $stmtA=$stmtB; $mysql_count='02197'; $MEL_aff_rows=$Baffected_rows; &mysql_error_logging;
|
||||
}
|
||||
}
|
||||
if ($after_hours_action =~ /EXTENSION/)
|
||||
@@ -1721,7 +1722,7 @@ if ( ( ($no_agent_no_queue =~ /Y|NO_PAUSED/) || ($MCnanque_override > 0) ) && ($
|
||||
|
||||
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='$uniqueid',queue='NONE',agent='NONE',verb='INFO',data1='IVRSTART',data2='$phone_number',data3='$channel_group',serverid='$queuemetrics_log_id';";
|
||||
$Baffected_rows = $dbhB->do($stmtB);
|
||||
$dbhP=$dbhB; $stmtA=$stmtB; $mysql_count='02XXX'; $MEL_aff_rows=$Baffected_rows; &mysql_error_logging;
|
||||
$dbhP=$dbhB; $stmtA=$stmtB; $mysql_count='02198'; $MEL_aff_rows=$Baffected_rows; &mysql_error_logging;
|
||||
}
|
||||
}
|
||||
if ($no_agent_action =~ /VOICEMAIL|VMAIL_NO_INST/)
|
||||
@@ -3090,6 +3091,77 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override
|
||||
if ($AGILOG) {$agi_string = "-- VDLIA agent calls: |$calls_today|$VDADuser|$channel_group|"; &agi_output;}
|
||||
}
|
||||
|
||||
##### BEGIN check for user max inbound calls #####
|
||||
$max_inbound_calls=0;
|
||||
$stmtA = "SELECT max_inbound_calls FROM vicidial_users where user='$VDADuser';";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArowsMIC=$sthA->rows;
|
||||
$dbhP=$dbhA; $mysql_count='02199'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
|
||||
if ($sthArowsMIC > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$VU_max_inbound_calls = $aryA[0];
|
||||
}
|
||||
$stmtA = "SELECT max_inbound_calls FROM vicidial_campaigns where campaign_id='$log_campaign';";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArowsMIC=$sthA->rows;
|
||||
$dbhP=$dbhA; $mysql_count='02208'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
|
||||
if ($sthArowsMIC > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$CP_max_inbound_calls = $aryA[0];
|
||||
}
|
||||
|
||||
if ( ($VU_max_inbound_calls > 0) || ($CP_max_inbound_calls > 0) )
|
||||
{
|
||||
$max_inbound_calls = $CP_max_inbound_calls;
|
||||
if ($VU_max_inbound_calls > 0)
|
||||
{$max_inbound_calls = $VU_max_inbound_calls;}
|
||||
$max_inbound_count=0;
|
||||
$stmtA = "SELECT sum(calls_today) FROM vicidial_inbound_group_agents where user='$VDADuser' and group_type='C';";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArowsVIGA=$sthA->rows;
|
||||
$dbhP=$dbhA; $mysql_count='02200'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
|
||||
if ($sthArowsVIGA > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$max_inbound_count = $aryA[0];
|
||||
}
|
||||
if ($max_inbound_count >= $max_inbound_calls)
|
||||
{
|
||||
$outbound_autodial='0';
|
||||
$stmtA = "SELECT outbound_autodial FROM vicidial_live_agents where user='$VDADuser';";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArowsVLA=$sthA->rows;
|
||||
$dbhP=$dbhA; $mysql_count='02201'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
|
||||
if ($sthArowsVLA > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
if ($aryA[0] =~ /Y/)
|
||||
{$outbound_autodial = '1';}
|
||||
}
|
||||
|
||||
$stmtA = "UPDATE vicidial_live_agents set external_ingroups=' -',external_blended='$outbound_autodial',external_igb_set_user='VDIC',manager_ingroup_set='SET' where user='$VDADuser'";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$dbhP=$dbhA; $mysql_count='02202'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
|
||||
$stmtA = "DELETE FROM vicidial_live_inbound_agents where user='$VDADuser';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$dbhP=$dbhA; $mysql_count='02203'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
|
||||
$stmtA = "INSERT INTO vicidial_admin_log set event_date=NOW(), user='$VDADuser', ip_address='$VARserver_ip', event_section='USERS', event_type='MODIFY', record_id='$VDADuser', event_code='MAX IN CALLS MODIFY USER', event_sql='DELETE FROM vicidial_live_inbound_agents where user=$VDADuser', event_notes='|$max_inbound_count|$max_inbound_calls|$VDADuser|$callerid|IC|';";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$dbhP=$dbhA; $mysql_count='02204'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||
if ($AGILOG) {$agi_string = "-- MAX INBOUND AGENT CALLS TRIGGER: |$max_inbound_count|$max_inbound_calls|$VDADuser|$callerid|"; &agi_output;}
|
||||
}
|
||||
}
|
||||
##### END check for user max inbound calls #####
|
||||
|
||||
|
||||
&trigger_transfer_process;
|
||||
|
||||
if ($no_delay_call_route !~ /Y/i)
|
||||
@@ -4103,7 +4175,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override
|
||||
|
||||
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='$YqueryCID',queue='NONE',agent='NONE',verb='INFO',data1='IVRSTART',data2='$phone_number',data3='$channel_group',serverid='$queuemetrics_log_id';";
|
||||
$Baffected_rows = $dbhB->do($stmtB);
|
||||
$dbhP=$dbhB; $stmtA=$stmtB; $mysql_count='02XXX'; $MEL_aff_rows=$Baffected_rows; &mysql_error_logging;
|
||||
$dbhP=$dbhB; $stmtA=$stmtB; $mysql_count='02205'; $MEL_aff_rows=$Baffected_rows; &mysql_error_logging;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4533,7 +4605,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override
|
||||
|
||||
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='$YqueryCID',queue='NONE',agent='NONE',verb='INFO',data1='IVRSTART',data2='$phone_number',data3='$channel_group',serverid='$queuemetrics_log_id';";
|
||||
$Baffected_rows = $dbhB->do($stmtB);
|
||||
$dbhP=$dbhB; $stmtA=$stmtB; $mysql_count='02XXX'; $MEL_aff_rows=$Baffected_rows; &mysql_error_logging;
|
||||
$dbhP=$dbhB; $stmtA=$stmtB; $mysql_count='02206'; $MEL_aff_rows=$Baffected_rows; &mysql_error_logging;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4942,7 +5014,7 @@ if ( ($drop_timer > $DROP_TIME) || ($MCdrop_override > 0) )
|
||||
|
||||
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='$YqueryCID',queue='NONE',agent='NONE',verb='INFO',data1='IVRSTART',data2='$phone_number',data3='$channel_group',serverid='$queuemetrics_log_id';";
|
||||
$Baffected_rows = $dbhB->do($stmtB);
|
||||
$dbhP=$dbhB; $stmtA=$stmtB; $mysql_count='02XXX'; $MEL_aff_rows=$Baffected_rows; &mysql_error_logging;
|
||||
$dbhP=$dbhB; $stmtA=$stmtB; $mysql_count='02207'; $MEL_aff_rows=$Baffected_rows; &mysql_error_logging;
|
||||
}
|
||||
}
|
||||
if ($drop_action =~ /IN_GROUP/)
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
# agents that should appear to be logged in so that the calls can be transferred
|
||||
# out to them properly.
|
||||
#
|
||||
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2014 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGELOG:
|
||||
# 50215-0954 - First version of script
|
||||
@@ -47,6 +47,7 @@
|
||||
# 121129-1929 - Fix for issue #601, reported by Acidshock
|
||||
# 130322-1939 - Changed to auto-terminate vars to one day so it can restart for systems that don't reboot nightly
|
||||
# 131122-1104 - Small fixes and formatting changes
|
||||
# 140417-0934 - Added max inbound calls feature
|
||||
#
|
||||
|
||||
### begin parsing run-time options ###
|
||||
@@ -341,9 +342,66 @@ while($one_day_interval > 0)
|
||||
$stmtD = "INSERT IGNORE INTO vicidial_live_inbound_agents SET calls_today='1',last_call_time='$SQLdate',user='$QHuser[$w]', group_id='$QHcampaign_id[$w]' ON DUPLICATE KEY UPDATE calls_today=(calls_today + 1),last_call_time='$SQLdate';";
|
||||
$Daffected_rows = $dbhA->do($stmtD);
|
||||
|
||||
$stmtE = "INSERT IGNORE INTO vicidial_inbound_group_agents set calls_today=1,user='$QHuser[$w]',group_id='$QHcampaign_id[$w]' ON DUPLICATE KEY UPDATE calls_today=(calls_today + 1);";
|
||||
# $stmtE = "INSERT IGNORE INTO vicidial_inbound_group_agents set calls_today=1,user='$QHuser[$w]',group_id='$QHcampaign_id[$w]' ON DUPLICATE KEY UPDATE calls_today=(calls_today + 1);";
|
||||
$stmtE = "INSERT IGNORE INTO vicidial_inbound_group_agents set calls_today=1,user='$QHuser[$w]',group_id='$QHcampaign_id[$w]';";
|
||||
$Eaffected_rows = $dbhA->do($stmtE);
|
||||
|
||||
##### BEGIN check for user max inbound calls #####
|
||||
$max_inbound_calls=0;
|
||||
$stmtJ = "SELECT max_inbound_calls FROM vicidial_users where user='$QHuser[$w]';";
|
||||
$sthA = $dbhA->prepare($stmtJ) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtJ ", $dbhA->errstr;
|
||||
$sthArowsMIC=$sthA->rows;
|
||||
if ($sthArowsMIC > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$VU_max_inbound_calls = $aryA[0];
|
||||
}
|
||||
$stmtJ = "SELECT max_inbound_calls FROM vicidial_campaigns where campaign_id='$QHcampaign_id[$w]';";
|
||||
$sthA = $dbhA->prepare($stmtJ) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtJ ", $dbhA->errstr;
|
||||
$sthArowsMIC=$sthA->rows;
|
||||
if ($sthArowsMIC > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$CP_max_inbound_calls = $aryA[0];
|
||||
}
|
||||
|
||||
if ( ($VU_max_inbound_calls > 0) || ($CP_max_inbound_calls > 0) )
|
||||
{
|
||||
$max_inbound_calls = $CP_max_inbound_calls;
|
||||
if ($VU_max_inbound_calls > 0)
|
||||
{$max_inbound_calls = $VU_max_inbound_calls;}
|
||||
$max_inbound_count=0;
|
||||
$stmtJ = "SELECT sum(calls_today) FROM vicidial_inbound_group_agents where user='$QHuser[$w]' and group_type='C';";
|
||||
$sthA = $dbhA->prepare($stmtJ) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtJ ", $dbhA->errstr;
|
||||
$sthArowsVIGA=$sthA->rows;
|
||||
if ($sthArowsVIGA > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$max_inbound_count = $aryA[0];
|
||||
}
|
||||
if ($max_inbound_count >= $max_inbound_calls)
|
||||
{
|
||||
$stmtJ = "UPDATE vicidial_live_agents set closer_campaigns='' where user='$QHuser[$w]';";
|
||||
$affected_rows = $dbhA->do($stmtJ);
|
||||
|
||||
$stmtJ = "DELETE FROM vicidial_live_inbound_agents where user='$QHuser[$w]';";
|
||||
$affected_rows = $dbhA->do($stmtJ);
|
||||
|
||||
$stmtJ = "UPDATE vicidial_remote_agents set closer_campaigns='' where user_start='$QHuser[$w]';";
|
||||
$affected_rows = $dbhA->do($stmtJ);
|
||||
|
||||
$stmtJ = "INSERT INTO vicidial_admin_log set event_date=NOW(), user='$QHuser[$w]', ip_address='$VARserver_ip', event_section='USERS', event_type='MODIFY', record_id='$QHuser[$w]', event_code='MAX IN CALLS MODIFY REMOTE AGENT', event_sql='DELETE FROM vicidial_live_inbound_agents where user=$QHuser[$w]', event_notes='|$max_inbound_count|$max_inbound_calls|$QHuser[$w]|$QHcall_id[$w]|RA|';";
|
||||
$affected_rows = $dbhA->do($stmtJ);
|
||||
|
||||
if ($AGILOG) {$agi_string = "-- MAX INBOUND AGENT CALLS TRIGGER: |$max_inbound_count|$max_inbound_calls|$QHuser[$w]|$QHcall_id[$w]|"; &agi_output;}
|
||||
}
|
||||
}
|
||||
##### END check for user max inbound calls #####
|
||||
|
||||
|
||||
$stmtG = "SELECT start_call_url FROM vicidial_inbound_groups where group_id='$QHcampaign_id[$w]';";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -618,7 +618,8 @@ failed_login_count TINYINT(3) UNSIGNED default '0',
|
||||
last_login_date DATETIME default '2001-01-01 00:00:01',
|
||||
last_ip VARCHAR(15) default '',
|
||||
pass_hash VARCHAR(100) default '',
|
||||
alter_admin_interface_options ENUM('0','1') default '1'
|
||||
alter_admin_interface_options ENUM('0','1') default '1',
|
||||
max_inbound_calls SMALLINT(5) UNSIGNED default '0'
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
CREATE UNIQUE INDEX user ON vicidial_users (user);
|
||||
@@ -896,7 +897,8 @@ dead_max SMALLINT(5) UNSIGNED default '0',
|
||||
dead_max_dispo VARCHAR(6) default 'DCMX',
|
||||
dispo_max SMALLINT(5) UNSIGNED default '0',
|
||||
dispo_max_dispo VARCHAR(6) default 'DISMX',
|
||||
pause_max SMALLINT(5) UNSIGNED default '0'
|
||||
pause_max SMALLINT(5) UNSIGNED default '0',
|
||||
max_inbound_calls SMALLINT(5) UNSIGNED default '0'
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
CREATE TABLE vicidial_lists (
|
||||
@@ -1635,6 +1637,7 @@ 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',
|
||||
group_type VARCHAR(1) default 'C',
|
||||
index (group_id),
|
||||
index (user),
|
||||
unique index viga_user_group_id (user, group_id)
|
||||
@@ -3257,4 +3260,4 @@ UPDATE vicidial_configuration set value='1766' where name='qc_database_version';
|
||||
|
||||
UPDATE system_settings set vdc_agent_api_active='1';
|
||||
|
||||
UPDATE system_settings SET db_schema_version='1371',db_schema_update_date=NOW(),reload_timestamp=NOW();
|
||||
UPDATE system_settings SET db_schema_version='1372',db_schema_update_date=NOW(),reload_timestamp=NOW();
|
||||
|
||||
@@ -222,3 +222,11 @@ ALTER TABLE vicidial_did_log MODIFY did_route VARCHAR(20) default '';
|
||||
ALTER TABLE vicidial_did_agent_log MODIFY did_route VARCHAR(20) default '';
|
||||
|
||||
UPDATE system_settings SET db_schema_version='1371',db_schema_update_date=NOW() where db_schema_version < 1371;
|
||||
|
||||
ALTER TABLE vicidial_users ADD max_inbound_calls SMALLINT(5) UNSIGNED default '0';
|
||||
|
||||
ALTER TABLE vicidial_campaigns ADD max_inbound_calls SMALLINT(5) UNSIGNED default '0';
|
||||
|
||||
ALTER TABLE vicidial_inbound_group_agents ADD group_type VARCHAR(1) default 'C';
|
||||
|
||||
UPDATE system_settings SET db_schema_version='1372',db_schema_update_date=NOW() where db_schema_version < 1372;
|
||||
|
||||
@@ -273,6 +273,9 @@ Filter DNC Campaign||
|
||||
If the Filter Inbound Number field is set to DNC_CAMPAIGN then this is the specific campaign ID that the campaign DNC list belongs to||
|
||||
Filter URL DID Redirect||
|
||||
If the Filter Inbound Number field is set to URL then this setting allows the URL response to specify a system DID to redirect the call to insead of using the default action. If a 0 is returned then the default action is used. If anything other than a 0 is returned then the call will be redirected to the resulting URL response value||
|
||||
Max Inbound Calls||
|
||||
If this setting is set to a number greater than 0, then it will be the maximum number of inbound calls that an agent can handle across all inbound groups in one day. If the agent reaches their maximum number of inbound calls, then they will not be able to select inbound groups to take calls from until the next day. This setting will override the Campaign setting of the same name. Default is 0 for disabled||
|
||||
If this setting is set to a number greater than 0, then it will be the maximum number of inbound calls that an agent can handle across all inbound groups in one day. If the agent reaches their maximum number of inbound calls, then they will not be able to select inbound groups to take calls from until the next day. This setting can be overridden by the User setting of the same name. Default is 0 for disabled||
|
||||
|
||||
|
||||
########################## CHANGES TO EXISTING PHRASES IN ADMIN TRANSLATION
|
||||
|
||||
+89
-39
@@ -349,12 +349,13 @@
|
||||
# 140301-2348 - Small change for new API MANUALNEXT option
|
||||
# 140402-1750 - Formatting cleanup and MySQL logging cleanup
|
||||
# 140407-1923 - Fixed call notes logging bug when call is not answered
|
||||
# 140417-0931 - Added max inbound calls feature
|
||||
#
|
||||
|
||||
$version = '2.8-246';
|
||||
$build = '140407-1923';
|
||||
$version = '2.8-247';
|
||||
$build = '140417-0931';
|
||||
$mel=1; # Mysql Error Log enabled = 1
|
||||
$mysql_log_count=586;
|
||||
$mysql_log_count=589;
|
||||
$one_mysql_log=0;
|
||||
|
||||
require_once("dbconnect_mysqli.php");
|
||||
@@ -1079,6 +1080,48 @@ if ($ACTION == 'regCLOSER')
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt = "SELECT max_inbound_calls FROM vicidial_users where user='$user';";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00587',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($format=='debug') {echo "\n<!-- $rowx[0]|$stmt -->";}
|
||||
$vumic_ct = mysqli_num_rows($rslt);
|
||||
if ($vumic_ct > 0)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$VU_max_inbound_calls = $row[0];
|
||||
}
|
||||
$stmt = "SELECT max_inbound_calls FROM vicidial_campaigns where campaign_id='$campaign';";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00589',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($format=='debug') {echo "\n<!-- $rowx[0]|$stmt -->";}
|
||||
$vcmic_ct = mysqli_num_rows($rslt);
|
||||
if ($vcmic_ct > 0)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$CP_max_inbound_calls = $row[0];
|
||||
}
|
||||
|
||||
if ( ($VU_max_inbound_calls > 0) or ($CP_max_inbound_calls > 0) )
|
||||
{
|
||||
$max_inbound_calls = $CP_max_inbound_calls;
|
||||
if ($VU_max_inbound_calls > 0)
|
||||
{$max_inbound_calls = $VU_max_inbound_calls;}
|
||||
|
||||
$stmt = "SELECT sum(calls_today) FROM vicidial_inbound_group_agents where user='$user' and group_type='C';";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00588',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($format=='debug') {echo "\n<!-- $rowx[0]|$stmt -->";}
|
||||
$vigagt_ct = mysqli_num_rows($rslt);
|
||||
if ($vigagt_ct > 0)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$max_inbound_count = $row[0];
|
||||
|
||||
if ($max_inbound_count >= $max_inbound_calls)
|
||||
{$closer_choice = "MAXLOCK-";}
|
||||
}
|
||||
}
|
||||
|
||||
if ($closer_blended > 0)
|
||||
{$vla_autodial = 'Y';}
|
||||
else
|
||||
@@ -1086,42 +1129,49 @@ if ($ACTION == 'regCLOSER')
|
||||
if (preg_match('/INBOUND_MAN|MANUAL/',$dial_method))
|
||||
{$vla_autodial = 'N';}
|
||||
|
||||
if ($closer_choice == "MGRLOCK-")
|
||||
if ( ($closer_choice == "MGRLOCK-") or ($closer_choice == "MAXLOCK-") )
|
||||
{
|
||||
$stmt="SELECT closer_campaigns FROM vicidial_users where user='$user' LIMIT 1;";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00007',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$user_choice =$row[0];
|
||||
$user_choice = preg_replace("/ -$|^ /","",$user_choice);
|
||||
$user_choice = preg_replace("/ /","','",$user_choice);
|
||||
$user_choice = "'$user_choice'";
|
||||
|
||||
$stmt="SELECT closer_campaigns FROM vicidial_campaigns where campaign_id='$campaign' LIMIT 1;";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00536',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$camp_choice =$row[0];
|
||||
$camp_choice = preg_replace("/ -$|^ /","",$camp_choice);
|
||||
$camp_choice = preg_replace("/ /","','",$camp_choice);
|
||||
$camp_choice = "'$camp_choice'";
|
||||
|
||||
$stmt = "SELECT group_id FROM vicidial_inbound_groups where group_id IN($user_choice) and group_id IN($camp_choice) and active='Y';";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00537',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$gid_ct = mysqli_num_rows($rslt);
|
||||
$i=0;
|
||||
$closer_choice='';
|
||||
while ($i < $gid_ct)
|
||||
if ($closer_choice == "MAXLOCK-")
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$closer_choice .= " $row[0]";
|
||||
$i++;
|
||||
$closer_choice = " -";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT closer_campaigns FROM vicidial_users where user='$user' LIMIT 1;";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00007',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$user_choice =$row[0];
|
||||
$user_choice = preg_replace("/ -$|^ /","",$user_choice);
|
||||
$user_choice = preg_replace("/ /","','",$user_choice);
|
||||
$user_choice = "'$user_choice'";
|
||||
|
||||
$stmt="SELECT closer_campaigns FROM vicidial_campaigns where campaign_id='$campaign' LIMIT 1;";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00536',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$camp_choice =$row[0];
|
||||
$camp_choice = preg_replace("/ -$|^ /","",$camp_choice);
|
||||
$camp_choice = preg_replace("/ /","','",$camp_choice);
|
||||
$camp_choice = "'$camp_choice'";
|
||||
|
||||
$stmt = "SELECT group_id FROM vicidial_inbound_groups where group_id IN($user_choice) and group_id IN($camp_choice) and active='Y';";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00537',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$gid_ct = mysqli_num_rows($rslt);
|
||||
$i=0;
|
||||
$closer_choice='';
|
||||
while ($i < $gid_ct)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$closer_choice .= " $row[0]";
|
||||
$i++;
|
||||
}
|
||||
$closer_choice .= " -";
|
||||
}
|
||||
$closer_choice .= " -";
|
||||
|
||||
$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<!-- $stmt -->";}
|
||||
@@ -6510,7 +6560,7 @@ if ($ACTION == 'VDADcheckINCOMINGemail')
|
||||
|
||||
if ($email_ct==0)
|
||||
{
|
||||
# Check if there are any QUEUE calls
|
||||
# Check if there are any QUEUE emails
|
||||
$stmt = "select lead_id, email_date, email_to, email_from, subject, group_id, email_row_id from vicidial_email_list where status='QUEUE' and direction='INBOUND' and user='$user' and group_id in ($email_group_str) order by email_date asc";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
@@ -6568,7 +6618,7 @@ if ($ACTION == 'VDADcheckINCOMINGemail')
|
||||
{$calls_today ='0';}
|
||||
$calls_today++;
|
||||
|
||||
### update the agent status to INCALL in vicidial_live_agents
|
||||
### update the agent status to INCALL in vicidial_live_agents while handling email
|
||||
$stmt = "UPDATE vicidial_live_agents set status='INCALL',comments='EMAIL',last_call_time='$NOW_TIME',lead_id='$lead_id',calls_today='$calls_today',external_hangup=0,external_status='',external_pause='',external_dial='',last_state_change='$NOW_TIME',pause_code='' where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
@@ -6591,7 +6641,7 @@ if ($ACTION == 'VDADcheckINCOMINGemail')
|
||||
$stmtA = "UPDATE vicidial_live_inbound_agents set calls_today='$calls_today',last_call_time=NOW() WHERE user='$user' and group_id='$VDADchannel_group';";
|
||||
$rsltA=mysql_to_mysqli($stmtA, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtA,'00549',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$stmtA = "UPDATE vicidial_inbound_group_agents set calls_today='$calls_today' WHERE user='$user' and group_id='$VDADchannel_group';";
|
||||
$stmtA = "UPDATE vicidial_inbound_group_agents set calls_today='$calls_today',group_type='E' WHERE user='$user' and group_id='$VDADchannel_group';";
|
||||
$rsltA=mysql_to_mysqli($stmtA, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtA,'00550',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
|
||||
|
||||
+31
-6
@@ -424,12 +424,13 @@
|
||||
# 140302-1018 - Changes to allow for & and + in standard fields
|
||||
# 140312-2109 - Added CALLID as recording filename variable
|
||||
# 140403-1731 - Added recording filename API append option
|
||||
# 140418-0937 - Added max inbound calls feature
|
||||
#
|
||||
|
||||
$version = '2.8-393c';
|
||||
$build = '140403-1731';
|
||||
$version = '2.8-394c';
|
||||
$build = '140418-0937';
|
||||
$mel=1; # Mysql Error Log enabled = 1
|
||||
$mysql_log_count=79;
|
||||
$mysql_log_count=80;
|
||||
$one_mysql_log=0;
|
||||
|
||||
require_once("dbconnect_mysqli.php");
|
||||
@@ -1089,7 +1090,7 @@ else
|
||||
if($auth>0)
|
||||
{
|
||||
##### grab the full name and other settings of the agent
|
||||
$stmt="SELECT full_name,user_level,hotkeys_active,agent_choose_ingroups,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,closer_default_blended,user_group,vicidial_recording_override,alter_custphone_override,alert_enabled,agent_shift_enforcement_override,shift_override_flag,allow_alerts,closer_campaigns,agent_choose_territories,custom_one,custom_two,custom_three,custom_four,custom_five,agent_call_log_view_override,agent_choose_blended,agent_lead_search_override,preset_contact_search from vicidial_users where user='$VD_login' and active='Y';";
|
||||
$stmt="SELECT full_name,user_level,hotkeys_active,agent_choose_ingroups,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,closer_default_blended,user_group,vicidial_recording_override,alter_custphone_override,alert_enabled,agent_shift_enforcement_override,shift_override_flag,allow_alerts,closer_campaigns,agent_choose_territories,custom_one,custom_two,custom_three,custom_four,custom_five,agent_call_log_view_override,agent_choose_blended,agent_lead_search_override,preset_contact_search,max_inbound_calls from vicidial_users where user='$VD_login' and active='Y';";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01007',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
@@ -1121,6 +1122,7 @@ else
|
||||
$VU_agent_choose_blended = $row[25];
|
||||
$VU_agent_lead_search_override = $row[26];
|
||||
$VU_preset_contact_search = $row[27];
|
||||
$VU_max_inbound_calls = $row[28];
|
||||
|
||||
|
||||
if ( ($VU_alert_enabled > 0) and ($VU_allow_alerts > 0) ) {$VU_alert_enabled = 'ON';}
|
||||
@@ -1437,7 +1439,7 @@ else
|
||||
$HKstatusnames = substr("$HKstatusnames", 0, -1);
|
||||
|
||||
##### grab the campaign settings
|
||||
$stmt="SELECT park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,agent_pause_codes_active,no_hopper_leads_logins,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,xfer_groups,disable_alter_custphone,display_queue_count,manual_dial_filter,agent_clipboard_copy,use_campaign_dnc,three_way_call_cid,dial_method,three_way_dial_prefix,web_form_target,vtiger_screen_login,agent_allow_group_alias,default_group_alias,quick_transfer_button,prepopulate_transfer_preset,view_calls_in_queue,view_calls_in_queue_launch,call_requeue_button,pause_after_each_call,no_hopper_dialing,agent_dial_owner_only,agent_display_dialable_leads,web_form_address_two,agent_select_territories,crm_popup_login,crm_login_address,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,use_custom_cid,scheduled_callbacks_alert,scheduled_callbacks_count,manual_dial_override,blind_monitor_warning,blind_monitor_message,blind_monitor_filename,timer_action_destination,enable_xfer_presets,hide_xfer_number_to_dial,manual_dial_prefix,customer_3way_hangup_logging,customer_3way_hangup_seconds,customer_3way_hangup_action,ivr_park_call,manual_preview_dial,api_manual_dial,manual_dial_call_time_check,my_callback_option,per_call_notes,agent_lead_search,agent_lead_search_method,queuemetrics_phone_environment,auto_pause_precall,auto_pause_precall_code,auto_resume_precall,manual_dial_cid,custom_3way_button_transfer,callback_days_limit,disable_dispo_screen,disable_dispo_status,screen_labels,status_display_fields,pllb_grouping,pllb_grouping_limit,in_group_dial,in_group_dial_select,pause_after_next_call,owner_populate,manual_dial_lead_id,dead_max,dispo_max,pause_max,dead_max_dispo,dispo_max_dispo FROM vicidial_campaigns where campaign_id = '$VD_campaign';";
|
||||
$stmt="SELECT park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,agent_pause_codes_active,no_hopper_leads_logins,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,xfer_groups,disable_alter_custphone,display_queue_count,manual_dial_filter,agent_clipboard_copy,use_campaign_dnc,three_way_call_cid,dial_method,three_way_dial_prefix,web_form_target,vtiger_screen_login,agent_allow_group_alias,default_group_alias,quick_transfer_button,prepopulate_transfer_preset,view_calls_in_queue,view_calls_in_queue_launch,call_requeue_button,pause_after_each_call,no_hopper_dialing,agent_dial_owner_only,agent_display_dialable_leads,web_form_address_two,agent_select_territories,crm_popup_login,crm_login_address,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,use_custom_cid,scheduled_callbacks_alert,scheduled_callbacks_count,manual_dial_override,blind_monitor_warning,blind_monitor_message,blind_monitor_filename,timer_action_destination,enable_xfer_presets,hide_xfer_number_to_dial,manual_dial_prefix,customer_3way_hangup_logging,customer_3way_hangup_seconds,customer_3way_hangup_action,ivr_park_call,manual_preview_dial,api_manual_dial,manual_dial_call_time_check,my_callback_option,per_call_notes,agent_lead_search,agent_lead_search_method,queuemetrics_phone_environment,auto_pause_precall,auto_pause_precall_code,auto_resume_precall,manual_dial_cid,custom_3way_button_transfer,callback_days_limit,disable_dispo_screen,disable_dispo_status,screen_labels,status_display_fields,pllb_grouping,pllb_grouping_limit,in_group_dial,in_group_dial_select,pause_after_next_call,owner_populate,manual_dial_lead_id,dead_max,dispo_max,pause_max,dead_max_dispo,dispo_max_dispo,max_inbound_calls FROM vicidial_campaigns where campaign_id = '$VD_campaign';";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01013',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
@@ -1553,6 +1555,7 @@ else
|
||||
$pause_max = $row[108];
|
||||
$dead_max_dispo = $row[109];
|
||||
$dispo_max_dispo = $row[110];
|
||||
$CP_max_inbound_calls = $row[111];
|
||||
|
||||
if ( ($pause_max < 10) or (strlen($pause_max)<2) )
|
||||
{$pause_max=0;}
|
||||
@@ -1827,11 +1830,33 @@ else
|
||||
$VARemailgroups="''";
|
||||
if ( ($campaign_allow_inbound == 'Y') and ($dial_method != 'MANUAL') )
|
||||
{
|
||||
### validate that the agent has not exceeded their max inbound calls for today
|
||||
if ( ($VU_max_inbound_calls > 0) or ($CP_max_inbound_calls > 0) )
|
||||
{
|
||||
$max_inbound_calls = $CP_max_inbound_calls;
|
||||
if ($VU_max_inbound_calls > 0)
|
||||
{$max_inbound_calls = $VU_max_inbound_calls;}
|
||||
|
||||
$stmt = "SELECT sum(calls_today) FROM vicidial_inbound_group_agents where user='$VD_login' and group_type='C';";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01080',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "\n<!-- $rowx[0]|$stmt -->";}
|
||||
$vigagt_ct = mysqli_num_rows($rslt);
|
||||
if ($vigagt_ct > 0)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$max_inbound_count = $row[0];
|
||||
|
||||
if ($max_inbound_count >= $max_inbound_calls)
|
||||
{$closer_campaigns = "''";}
|
||||
}
|
||||
}
|
||||
|
||||
$VARingroups='';
|
||||
$VARingroup_handlers='';
|
||||
$VARphonegroups='';
|
||||
$VARemailgroups='';
|
||||
$stmt="select group_id,group_handling from vicidial_inbound_groups where active = 'Y' and group_id IN($closer_campaigns) order by group_id limit 800;";
|
||||
$stmt="SELECT group_id,group_handling from vicidial_inbound_groups where active = 'Y' and group_id IN($closer_campaigns) order by group_id limit 800;";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01015',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
|
||||
+27
-11
File diff suppressed because one or more lines are too long
@@ -11,6 +11,7 @@
|
||||
# 140126-1023 - Added VMAIL_NO_INST options
|
||||
# 140126-2254 - Added voicemail_instructions option for phones
|
||||
# 140404-1104 - Added new DID filter options
|
||||
# 140418-0915 - Added users and campaigns max_inbound_calls
|
||||
#
|
||||
|
||||
|
||||
@@ -314,6 +315,11 @@ if ($SSoutbound_autodial_active > 0)
|
||||
<BR>
|
||||
<B>Preset Contact Search -</B> 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.
|
||||
|
||||
<BR>
|
||||
<A NAME="users-max_inbound_calls">
|
||||
<BR>
|
||||
<B>Max Inbound Calls -</B> If this setting is set to a number greater than 0, then it will be the maximum number of inbound calls that an agent can handle across all inbound groups in one day. If the agent reaches their maximum number of inbound calls, then they will not be able to select inbound groups to take calls from until the next day. This setting will override the Campaign setting of the same name. Default is 0 for disabled.
|
||||
|
||||
<BR>
|
||||
<A NAME="users-campaign_ranks">
|
||||
<BR>
|
||||
@@ -1675,6 +1681,12 @@ if ($SSqc_features_active > 0)
|
||||
<BR>
|
||||
<B>Blind Monitor Filename -</B> This is the audio file that will play in the agents session at the start of someone blind monitoring them. This prompt will be played for everyone in the session including the customer if any is present. Default is empty.
|
||||
|
||||
<BR>
|
||||
<A NAME="campaigns-max_inbound_calls">
|
||||
<BR>
|
||||
<B>Max Inbound Calls -</B> If this setting is set to a number greater than 0, then it will be the maximum number of inbound calls that an agent can handle across all inbound groups in one day. If the agent reaches their maximum number of inbound calls, then they will not be able to select inbound groups to take calls from until the next day. This setting can be overridden by the User setting of the same name. Default is 0 for disabled.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user