Added Phone Login Load Balancing Grouping campaign settings to allow smaller campaigns to have their agents on the same server to allow for more efficient dialing on outbound campaigns.

Fixed rare in-group remote agent recording issue

git-svn-id: svn://192.168.202.10@1723 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2011-09-20 19:18:12 +00:00
parent e1bb2b6802
commit 2058927eab
7 changed files with 165 additions and 31 deletions
+6
View File
@@ -698,6 +698,12 @@ OTHER CHANGES:
160. Added Agent API function logout to log an agent out of their session
161. Added Phone Login Load Balancing Grouping campaign settings to allow
smaller campaigns to have their agents on the same server to allow for
more efficient dialing on outbound campaigns. Must have more than one
agent server and phone aliases enabled for this feature to work.
+2 -1
View File
@@ -156,6 +156,7 @@
# 110731-0141 - Added call_id variable to add_lead_url function calls
# 110801-0841 - Added on_hook_cid option and group_calldate field
# 110822-1256 - Added optional did_agent_log logging
# 110920-1426 - Small fix for rare remote agent recording issue
#
$script = 'agi-VDAD_ALL_inbound.agi';
@@ -2599,7 +2600,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) )
### get the recording settings for the campaign that this remote agent is logged into
if ( (length($extension_campaign_id) > 0) && ($ingroup_recording_override =~ /DISABLED/) )
if ( (length($extension_campaign_id) > 0) && ( ($ingroup_recording_override =~ /DISABLED/) || (length($campaign_rec_filename) < 8) ) )
{
$stmtA = "SELECT campaign_recording,campaign_rec_filename FROM vicidial_campaigns where campaign_id='$extension_campaign_id';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
@@ -821,7 +821,9 @@ disable_dispo_status VARCHAR(6) default '',
screen_labels VARCHAR(20) default '--SYSTEM-SETTINGS--',
status_display_fields VARCHAR(30) default 'CALLID',
na_call_url TEXT,
survey_recording ENUM('Y','N') default 'N'
survey_recording ENUM('Y','N') default 'N',
pllb_grouping ENUM('DISABLED','ONE_SERVER_ONLY','CASCADING') default 'DISABLED',
pllb_grouping_limit SMALLINT(5) default '50'
);
CREATE TABLE vicidial_lists (
@@ -1430,7 +1432,8 @@ alt_log_login VARCHAR(50) default '',
alt_log_pass VARCHAR(50) default '',
tables_use_alt_log_db VARCHAR(2000) default '',
did_agent_log ENUM('Y','N') default 'N',
campaign_cid_areacodes_enabled ENUM('0','1') default '1'
campaign_cid_areacodes_enabled ENUM('0','1') default '1',
pllb_grouping_limit SMALLINT(5) default '100'
);
CREATE TABLE vicidial_campaigns_list_mix (
@@ -2638,7 +2641,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='1295',db_schema_update_date=NOW();
UPDATE system_settings SET db_schema_version='1296',db_schema_update_date=NOW();
GRANT RELOAD ON *.* TO cron@'%';
GRANT RELOAD ON *.* TO cron@localhost;
+7
View File
@@ -1025,3 +1025,10 @@ index (areacode)
CREATE UNIQUE INDEX campareacode on vicidial_campaign_cid_areacodes (campaign_id, areacode, outbound_cid);
UPDATE system_settings SET db_schema_version='1295',db_schema_update_date=NOW() where db_schema_version < 1295;
ALTER TABLE system_settings ADD pllb_grouping_limit SMALLINT(5) default '100';
ALTER TABLE vicidial_campaigns ADD pllb_grouping ENUM('DISABLED','ONE_SERVER_ONLY','CASCADING') default 'DISABLED';
ALTER TABLE vicidial_campaigns ADD pllb_grouping_limit SMALLINT(5) default '50';
UPDATE system_settings SET db_schema_version='1296',db_schema_update_date=NOW() where db_schema_version < 1296;
@@ -720,6 +720,11 @@ When set to AREACODE you have the ability to go into the AC-CID submenu and defi
Enable Campaign Areacode CID||
This setting enables the ability to set specific outbound callerid numbers to be used per campaign. Default is 1 for enabled||
If the System Setting for Areacode CIDs is enabled and the Campaign setting for Use Custom CallerID is set to AREACODE then you have the ability to define Areacode CIDs that will be used when outbound calling to leads in this specific campaign. You can add multiple callerIDs per areacode and you can activate and deactivate them each in real time. If more than one callerID is active for a specific areacode then the system will use the callerid that has been used the least number of times today. If no callerIDs are active for the areacode then the campaign CallerID or list override CallerID will be used||
PLLB Grouping||
Phone Login Load Balancing Grouping, only allowed if there are multiple agent servers and phone aliases are present on the system. If set to ONE_SERVER_ONLY it will force all agents for this campaign to login to the same server. If set to CASCADING it will group logged in agents on the same server until PLLB Grouping Limit number of agents are reached, then the next agent will login to the next server with the least number of agents. If set to DISABLED the standard Phone Aliases behavior of each agent finding the server with the least number of non-remote agents logged into it will be used. Default is DISABLED||
PLLB Grouping Limit||
Phone Login Load Balancing Grouping Limit. If PLLB Grouping is set to CASCADING then this setting will determine the number of agents acceptable in each server for this campaign. Default is 50||
Phone Login Load Balancing Grouping Limit. If PLLB Grouping is set to CASCADING at the campaign level then this setting will determine the number of agents acceptable on each server across all campaigns. Default is 100||
lead_report_export.php
+78 -19
View File
@@ -365,12 +365,13 @@
# 110802-0122 - Added call_id variable
# 110911-1604 - Added API logout function
# 110916-1514 - Fixed dial timeout to check for dial_timeout setting and greater than 49 seconds
# 110919-1603 - Added Phone login load balancing grouping options
#
$version = '2.4-332c';
$build = '110916-1514';
$version = '2.4-333c';
$build = '110919-1603';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=73;
$mysql_log_count=75;
$one_mysql_log=0;
require("dbconnect.php");
@@ -453,7 +454,7 @@ $random = (rand(1000000, 9999999) + 10000000);
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,webroot_writable,timeclock_end_of_day,vtiger_url,enable_vtiger_integration,outbound_autodial_active,enable_second_webform,user_territories_active,static_agent_url,custom_fields_enabled FROM system_settings;";
$stmt = "SELECT use_non_latin,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,webroot_writable,timeclock_end_of_day,vtiger_url,enable_vtiger_integration,outbound_autodial_active,enable_second_webform,user_territories_active,static_agent_url,custom_fields_enabled,pllb_grouping_limit FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01001',$VD_login,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
@@ -474,6 +475,7 @@ if ($qm_conf_ct > 0)
$user_territories_active = $row[10];
$static_agent_url = $row[11];
$custom_fields_enabled = $row[12];
$SSpllb_grouping_limit = $row[13];
}
##### END SETTINGS LOOKUP #####
###########################################
@@ -1206,8 +1208,7 @@ else
$VDdisplayMESSAGE.= "<input type=\"submit\" name=\"submit\" value=\"Submit\" /></form>\n";
}
}
### END - CHECK TO SEE IF SHIFT ENFORCEMENT IS ENABLED AND AGENT IS OUTSIDE OF THEIR SHIFTS, IF SO, OUTPUT ERROR
### END - CHECK TO SEE IF SHIFT ENFORCEMENT IS ENABLED AND AGENT IS OUTSIDE OF THEIR SHIFTS, IF SO, OUTPUT ERROR
if ($WeBRooTWritablE > 0)
@@ -1359,7 +1360,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 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 FROM vicidial_campaigns where campaign_id = '$VD_campaign';";
$rslt=mysql_query($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";}
@@ -1463,6 +1464,8 @@ else
$disable_dispo_status = $row[96];
$screen_labels = $row[97];
$status_display_fields = $row[98];
$pllb_grouping = $row[99];
$pllb_grouping_limit = $row[100];
if ( ($queuemetrics_pe_phone_append > 0) and (strlen($qm_phone_environment)>0) )
{$qm_phone_environment .= "-$qm_extension";}
@@ -1896,7 +1899,7 @@ else
if ($alias_ct > 0)
{
$row=mysql_fetch_row($rslt);
$alias_found = "$row[0]";
$alias_found = $row[0];
}
if ($alias_found > 0)
{
@@ -1907,8 +1910,8 @@ else
if ($alias_ct > 0)
{
$row=mysql_fetch_row($rslt);
$alias_name = "$row[0]";
$phone_login = "$row[1]";
$alias_name = $row[0];
$phone_login = $row[1];
}
}
@@ -1974,8 +1977,9 @@ else
}
else
{
### go through the entered phones to figure out which server has fewest agents
### logged in and use that phone login account
##### BEGIN phone login load balancing functions #####
### go through the phones logins list to figure out which server has
### fewest non-remote agents logged in and use that phone login account
if ($pa > 0)
{
$pb=0;
@@ -1983,7 +1987,9 @@ else
$pb_server_ip='';
$pb_count=0;
$pb_log='';
while($pb < $phones_auto_ct)
$pb_valid_server_ips='';
$pb_force_set=0;
while ( ($pb < $phones_auto_ct) and ($pb_force_set < 1) )
{
### find the server_ip of each phone_login
$stmtx="SELECT server_ip from phones where login = '$phones_auto[$pb]';";
@@ -1994,7 +2000,7 @@ else
$rowx=mysql_fetch_row($rslt);
### get number of agents logged in to each server
$stmt="SELECT count(*) from vicidial_live_agents where server_ip = '$rowx[0]';";
$stmt="SELECT count(*) from vicidial_live_agents where server_ip = '$rowx[0]' and extension NOT LIKE \"R%\";";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01022',$VD_login,$server_ip,$session_name,$one_mysql_log);}
@@ -2036,22 +2042,75 @@ else
if ( ($rowy[0] > 0) and ($rowz[0] > 0) and ($twin_not_live < 1) )
{
if ( ($pb_count >= $row[0]) or (strlen($pb_server_ip) < 4) )
if ( ($pllb_grouping == 'ONE_SERVER_ONLY') or ($pllb_grouping == 'CASCADING') )
{
$pb_count=$row[0];
$pb_server_ip=$rowx[0];
$phone_login=$phones_auto[$pb];
if ($pllb_grouping == 'ONE_SERVER_ONLY')
{
### one-server-only plib check
### get number of agents logged in to each server
$stmt="SELECT count(*) from vicidial_live_agents where server_ip = '$rowx[0]' and campaign_id='$VD_campaign' and extension NOT LIKE \"R%\";";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01074',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$rowG=mysql_fetch_row($rslt);
if ($rowG[0] > 0)
{
$pb_count=$row[0];
$pb_server_ip=$rowx[0];
$phone_login=$phones_auto[$pb];
$pb_force_set++;
echo "<!-- PLLB: ONE_SERVER_ONLY|$pb_server_ip|$pb_count| -->\n";
}
}
else
{
### cascading plib check
### get number of agents logged in to each server
$stmt="SELECT count(*) from vicidial_live_agents where server_ip = '$rowx[0]' and campaign_id='$VD_campaign' and extension NOT LIKE \"R%\";";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01075',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$rowG=mysql_fetch_row($rslt);
echo "<!-- PLLB CASCADING CHECK: |$pllb_grouping|$rowx[0]|$rowG[0]|$pllb_grouping_limit| |$row[0]|$SSpllb_grouping_limit| -->\n";
if ( ($rowG[0] > 0) and ($rowG[0] < $pllb_grouping_limit) and ($row[0] < $SSpllb_grouping_limit) )
{
$pb_count=$row[0];
$pb_server_ip=$rowx[0];
$phone_login=$phones_auto[$pb];
$pb_force_set++;
echo "<!-- PLLB: CASCADING|$pb_server_ip|$pb_count| -->\n";
}
}
}
if ($pb_force_set < 1)
{
if ( ($pb_count >= $row[0]) or (strlen($pb_server_ip) < 4) )
{
$pb_count=$row[0];
$pb_server_ip=$rowx[0];
$phone_login=$phones_auto[$pb];
}
}
}
$pb++;
}
echo "<!-- Phones balance selection: $phone_login|$pb_server_ip|$past_minutes_date| |$pb_log -->\n";
}
##### END phone login load balancing functions #####
echo "<title>Agent web client</title>\n";
$stmt="SELECT extension,dialplan_number,voicemail_id,phone_ip,computer_ip,server_ip,login,pass,status,active,phone_type,fullname,company,picture,messages,old_messages,protocol,local_gmt,ASTmgrUSERNAME,ASTmgrSECRET,login_user,login_pass,login_campaign,park_on_extension,conf_on_extension,VICIDIAL_park_on_extension,VICIDIAL_park_on_filename,monitor_prefix,recording_exten,voicemail_exten,voicemail_dump_exten,ext_context,dtmf_send_extension,call_out_number_group,client_browser,install_directory,local_web_callerID_URL,VICIDIAL_web_URL,AGI_call_logging_enabled,user_switching_enabled,conferencing_enabled,admin_hangup_enabled,admin_hijack_enabled,admin_monitor_enabled,call_parking_enabled,updater_check_enabled,AFLogging_enabled,QUEUE_ACTION_enabled,CallerID_popup_enabled,voicemail_button_enabled,enable_fast_refresh,fast_refresh_rate,enable_persistant_mysql,auto_dial_next_number,VDstop_rec_after_each_call,DBX_server,DBX_database,DBX_user,DBX_pass,DBX_port,DBY_server,DBY_database,DBY_user,DBY_pass,DBY_port,outbound_cid,enable_sipsak_messages,email,template_id,conf_override,phone_context,phone_ring_timeout,conf_secret,is_webphone,use_external_server_ip,codecs_list,webphone_dialpad,phone_ring_timeout,on_hook_agent,webphone_auto_answer from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01025',$VD_login,$server_ip,$session_name,$one_mysql_log);}
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01025',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
$extension=$row[0];
$dialplan_number=$row[1];
File diff suppressed because one or more lines are too long