Added manual_dial_cid option to campaigns

Added another specialized agent log cleanup function to that process

git-svn-id: svn://192.168.202.10@1645 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2011-04-29 00:42:55 +00:00
parent 56516d3a13
commit 392ac076ce
6 changed files with 126 additions and 13 deletions
+79
View File
@@ -32,6 +32,7 @@
# 110310-2259 - Added check for PAUSEREASON if no COMPLETE record
# 110414-0200 - Added queue_log CONNECT and PAUSEALL/UNPAUSEALL validation and fixing
# 110415-1442 - Added one minute run option
# 110425-1345 - Added check-complete-pauses option
#
# constants
@@ -58,6 +59,7 @@ if (length($ARGV[0])>1)
print " [-last-30days] = will clean up logs for the last 30 days only\n";
print " [-one-day-ago] = will clean up logs for the last 24-48 hours ago only\n";
print " [-one-minute-run] = short settings for running every minute\n";
print " [-check-complete-pauses] = make sure every complete with a pause has a pausereason\n";
print " [-skip-queue-log-inserts] = will skip only the queue_log missing record checks\n";
print " [-skip-agent-log-validation] = will skip only the vicidial_agent_log validation\n";
print " [-only-check-agent-login-lags] = will only fix queue_log missing PAUSEREASON records\n";
@@ -131,6 +133,11 @@ if (length($ARGV[0])>1)
$ONE_MINUTE=1;
if ($Q < 1) {print "\n----- ONE MINUTE RUN -----\n\n";}
}
if ($args =~ /-check-complete-pauses/i)
{
$check_complete_pauses=1;
if ($Q < 1) {print "\n----- CHECK COMPLETE PAUSES -----\n\n";}
}
if ($args =~ /-more-than-24hours/i)
{
$VAL_validate=1;
@@ -1760,6 +1767,78 @@ if ($enable_queuemetrics_logging > 0)
}
$PRadded=0;
if ($check_complete_pauses > 0)
{
##############################################################
##### grab all queue_log entries for COMPLETECALLER verb to validate a pausereason is present
$stmtB = "SELECT time_id,call_id,queue,agent,serverid,data4 FROM queue_log where verb='COMPLETECALLER' and serverid='$queuemetrics_log_id' $QM_SQL_time order by time_id;";
$sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr;
$sthB->execute or die "executing: $stmtB ", $dbhB->errstr;
$CCP_records=$sthB->rows;
if ($DB) {print "COMPLETECALLER Records: $EQ_records|$stmtB|\n\n";}
$h=0;
while ($CCP_records > $h)
{
@aryB = $sthB->fetchrow_array;
$time_id[$h] = $aryB[0];
$call_id[$h] = $aryB[1];
$queue[$h] = $aryB[2];
$agent[$h] = $aryB[3];
$serverid[$h] = $aryB[4];
$data4[$h] = $aryB[5];
$h++;
}
$sthB->finish();
$h=0;
while ($CCP_records > $h)
{
$unpause_time_id[$h] = ($time_id[$h] + 1);
$pausereason_count[$h] = 0;
##### find time_id of the next unpauseall event
$stmtB = "SELECT time_id FROM queue_log WHERE verb='UNPAUSEALL' and serverid='$queuemetrics_log_id' and agent='$agent[$h]' and time_id >= $time_id[$h] order by time_id limit 1;";
$sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr;
$sthB->execute or die "executing: $stmtB ", $dbhB->errstr;
$MXC_records=$sthB->rows;
if ($MXC_records > 0)
{
@aryB = $sthB->fetchrow_array;
$unpause_time_id[$h] = $aryB[0];
}
$sthB->finish();
##### find if there is a pausereason record during the pause time
$stmtB = "SELECT count(*) FROM queue_log WHERE verb='PAUSEREASON' and serverid='$queuemetrics_log_id' and agent='$agent[$h]' and time_id >= $time_id[$h] and time_id <= $unpause_time_id[$h];";
$sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr;
$sthB->execute or die "executing: $stmtB ", $dbhB->errstr;
$MXD_records=$sthB->rows;
if ($MXD_records > 0)
{
@aryB = $sthB->fetchrow_array;
$pausereason_count[$h] = $aryB[0];
}
$sthB->finish();
if ($pausereason_count[$h] < 1)
{
##### add new PAUSEREASON record
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$time_id[$h]',call_id='$call_id[$h]',queue='NONE',agent='$agent[$h]',verb='PAUSEREASON',data1='$queuemetrics_dispo_pause',serverid='$Cserverid[$h]';";
if ($TEST < 1)
{
$Baffected_rows = $dbhB->do($stmtB);
$PRadded = ($PRadded + $Baffected_rows);
}
if ($DB) {print "PAUSEREASON Record Added: $Baffected_rows|$PRadded|$stmtB|\n\n";}
}
$h++;
}
if ($DB) {print "COMPLETECALLER pause reason validation records: $PRadded\n";}
}
$dbhB->disconnect();
}
+3 -2
View File
@@ -798,7 +798,8 @@ agent_lead_search_method VARCHAR(30) default 'CAMPLISTS_ALL',
queuemetrics_phone_environment VARCHAR(20) default '',
auto_pause_precall ENUM('Y','N') default 'N',
auto_pause_precall_code VARCHAR(6) default 'PRECAL',
auto_resume_precall ENUM('Y','N') default 'N'
auto_resume_precall ENUM('Y','N') default 'N',
manual_dial_cid ENUM('CAMPAIGN','AGENT_PHONE') default 'CAMPAIGN'
);
CREATE TABLE vicidial_lists (
@@ -2455,7 +2456,7 @@ ALTER TABLE vicidial_call_notes_archive MODIFY notesid INT(9) UNSIGNED NOT NULL;
CREATE TABLE vicidial_lead_search_log_archive LIKE vicidial_lead_search_log;
ALTER TABLE vicidial_lead_search_log_archive MODIFY search_log_id INT(9) UNSIGNED NOT NULL;
UPDATE system_settings SET db_schema_version='1270',db_schema_update_date=NOW();
UPDATE system_settings SET db_schema_version='1271',db_schema_update_date=NOW();
GRANT RELOAD ON *.* TO cron@'%';
GRANT RELOAD ON *.* TO cron@localhost;
+4
View File
@@ -739,3 +739,7 @@ UPDATE system_settings SET db_schema_version='1269',db_schema_update_date=NOW();
ALTER TABLE vicidial_phone_codes ADD tz_code VARCHAR(4) default '';
UPDATE system_settings SET db_schema_version='1270',db_schema_update_date=NOW();
ALTER TABLE vicidial_campaigns ADD manual_dial_cid ENUM('CAMPAIGN','AGENT_PHONE') default 'CAMPAIGN';
UPDATE system_settings SET db_schema_version='1271',db_schema_update_date=NOW();
@@ -559,6 +559,9 @@ Multi-Alt-Settings||
Reload Dialplan On Servers||
This option allows you to force a reload of the dialplan on all Asterisk servers in the cluster. If you made changes in the Custom Dialplan Entry above you should set this to 1 and submit to have those changes go into effect on the servers||
Using MULTI_LEAD allows you to use a separate lead for each number on a customer account that all share a common vendor_lead_code, and the type of phone number for each is defined with a label in the Owner field. This option will disable some options on the Modify Campaign screen and show a link to the Multi-Alt Settings page which allows you to set which phone number types, defined by the label of each lead, will be dialed and in what order. This will create a special lead filter and will alter the Rank field of all of the leads inside the lists set to this campaign in order to call them in the order you have specified||
Manual Dial CID||
This defines whether an agent making manual dial calls will have the campaign callerID settings used, or their agent phone callerID settings used. Default is CAMPAIGN||
If the Use Custom CID campaign option is enabled or the list Campaign CID Override setting is used, this setting will be ignored||
admin_campaign_multi_alt.php
+20 -6
View File
@@ -345,10 +345,11 @@
# 110322-0923 - Allowed hiding of gender pulldown
# 110413-1244 - Added ALT dialing from scheduled callback list, and other formatting changes
# 110420-1211 - Added web_vars variable
# 110428-1549 - Added use of manual_dial_cid setting
#
$version = '2.4-322c';
$build = '110420-1211';
$version = '2.4-323c';
$build = '110428-1549';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=72;
$one_mysql_log=0;
@@ -1339,7 +1340,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 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 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";}
@@ -1436,6 +1437,7 @@ else
$auto_pause_precall = $row[89];
$auto_pause_precall_code = $row[90];
$auto_resume_precall = $row[91];
$manual_dial_cid = $row[92];
if ( ($VU_agent_lead_search_override == 'ENABLED') or ($VU_agent_lead_search_override == 'DISABLED') )
{$agent_lead_search = $VU_agent_lead_search_override;}
@@ -3315,6 +3317,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
var auto_resume_precall='<?php echo $auto_resume_precall ?>';
var trigger_ready=0;
var hide_gender='<?php echo $hide_gender ?>';
var manual_dial_cid='<?php echo $manual_dial_cid ?>';
var DiaLControl_auto_HTML = "<img src=\"./images/vdc_LB_pause_OFF.gif\" border=\"0\" alt=\" Pause \" /><a href=\"#\" onclick=\"AutoDial_ReSume_PauSe('VDADready');\"><img src=\"./images/vdc_LB_resume.gif\" border=\"0\" alt=\"Resume\" /></a>";
var DiaLControl_auto_HTML_ready = "<a href=\"#\" onclick=\"AutoDial_ReSume_PauSe('VDADpause');\"><img src=\"./images/vdc_LB_pause.gif\" border=\"0\" alt=\" Pause \" /></a><img src=\"./images/vdc_LB_resume_OFF.gif\" border=\"0\" alt=\"Resume\" />";
var DiaLControl_auto_HTML_OFF = "<img src=\"./images/vdc_LB_pause_OFF.gif\" border=\"0\" alt=\" Pause \" /><img src=\"./images/vdc_LB_resume_OFF.gif\" border=\"0\" alt=\"Resume\" />";
@@ -3620,6 +3623,9 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
{
var manual_number = document.vicidial_form.xfernumber.value;
var manual_string = manual_number.toString();
var threeway_cid='1';
if (manual_dial_cid == 'AGENT_PHONE')
{threeway_cid = outbound_cid;}
}
var regXFvars = new RegExp("XFER","g");
if (manual_string.match(regXFvars))
@@ -3647,7 +3653,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
if (taskFromConf == 'YES')
{basic_originate_call(manual_string,'NO','YES',dial_conf_exten,'NO',taskFromConf,threeway_cid,sending_group_alias,'',sending_preset_name,call_variables);}
else
{basic_originate_call(manual_string,'NO','NO','','','','1',sending_group_alias,sending_preset_name,call_variables);}
{basic_originate_call(manual_string,'NO','NO','','','',threeway_cid,sending_group_alias,sending_preset_name,call_variables);}
MD_ring_secondS=0;
}
@@ -6089,7 +6095,11 @@ function set_length(SLnumber,SLlength_goal,SLdirection)
if (cid_choice.length > 3)
{var call_cid = cid_choice;}
else
{var call_cid = campaign_cid;}
{
var call_cid = campaign_cid;
if (manual_dial_cid == 'AGENT_PHONE')
{call_cid = outbound_cid;}
}
if (prefix_choice.length > 0)
{var call_prefix = prefix_choice;}
else
@@ -6586,7 +6596,11 @@ function set_length(SLnumber,SLlength_goal,SLdirection)
usegroupalias=1;
}
else
{var call_cid = campaign_cid;}
{
var call_cid = campaign_cid;
if (manual_dial_cid == 'AGENT_PHONE')
{call_cid = outbound_cid;}
}
if (prefix_choice.length > 0)
{var call_prefix = prefix_choice;}
else
+17 -5
View File
File diff suppressed because one or more lines are too long