Added call_quota_lead_ranking features, EXPERIMENTAL FOR NOW!
git-svn-id: svn://192.168.202.10@3122 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -119,6 +119,7 @@
|
|||||||
# 170930-0913 - Added extension append options
|
# 170930-0913 - Added extension append options
|
||||||
# 180926-2350 - Added _wait_time options for next_agent_call
|
# 180926-2350 - Added _wait_time options for next_agent_call
|
||||||
# 190531-0901 - Changed dialplan inputs to accept connected-line name for CIDname validation, added SIP event processing
|
# 190531-0901 - Changed dialplan inputs to accept connected-line name for CIDname validation, added SIP event processing
|
||||||
|
# 190713-1045 - Added Call Quota logging
|
||||||
#
|
#
|
||||||
|
|
||||||
$script = 'agi-VDAD_ALL_outbound.agi';
|
$script = 'agi-VDAD_ALL_outbound.agi';
|
||||||
@@ -127,6 +128,7 @@ $mel=1; # Mysql Error Log enabled = 1
|
|||||||
$mysql_log_count=140;
|
$mysql_log_count=140;
|
||||||
$one_mysql_log=0;
|
$one_mysql_log=0;
|
||||||
|
|
||||||
|
use Time::Local;
|
||||||
use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second
|
use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second
|
||||||
($START_s_hires, $START_usec) = gettimeofday();
|
($START_s_hires, $START_usec) = gettimeofday();
|
||||||
|
|
||||||
@@ -237,14 +239,15 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA
|
|||||||
|
|
||||||
#############################################
|
#############################################
|
||||||
##### Gather system_settings #####
|
##### Gather system_settings #####
|
||||||
$stmtA = "SELECT sip_event_logging FROM system_settings;";
|
$stmtA = "SELECT sip_event_logging,call_quota_lead_ranking FROM system_settings;";
|
||||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
$sthArows=$sthA->rows;
|
$sthArows=$sthA->rows;
|
||||||
if ($sthArows > 0)
|
if ($sthArows > 0)
|
||||||
{
|
{
|
||||||
@aryA = $sthA->fetchrow_array;
|
@aryA = $sthA->fetchrow_array;
|
||||||
$SSsip_event_logging = $aryA[0];
|
$SSsip_event_logging = $aryA[0];
|
||||||
|
$SScall_quota_lead_ranking = $aryA[1];
|
||||||
}
|
}
|
||||||
$sthA->finish();
|
$sthA->finish();
|
||||||
###########################################
|
###########################################
|
||||||
@@ -574,6 +577,12 @@ if ( ($channel =~ /Local/i) && ($AST_ver !~ /^1\.0\.8|^1\.0\.9/) )
|
|||||||
$affected_rows = $dbhA->do($stmtA);
|
$affected_rows = $dbhA->do($stmtA);
|
||||||
$dbhP=$dbhA; $mysql_count='01104'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
$dbhP=$dbhA; $mysql_count='01104'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||||
if ($AGILOG) {$agi_string = "-- LRERR VLE insert: |$affected_rows|\n|$stmtA|"; &agi_output;}
|
if ($AGILOG) {$agi_string = "-- LRERR VLE insert: |$affected_rows|\n|$stmtA|"; &agi_output;}
|
||||||
|
|
||||||
|
if ( ($SScall_quota_lead_ranking > 0) && ($VD_call_quota_lead_ranking !~ /^DISABLED$/i) )
|
||||||
|
{
|
||||||
|
$temp_status = 'LRERR';
|
||||||
|
&call_quota_logging;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@@ -765,7 +774,7 @@ if ($VDACaffected_rows > 0)
|
|||||||
##### END - Max call stats
|
##### END - Max call stats
|
||||||
|
|
||||||
### Grab campaign values from the database
|
### Grab campaign values from the database
|
||||||
$stmtA = "SELECT drop_call_seconds,drop_action,safe_harbor_exten,concurrent_transfers,next_agent_call,voicemail_ext,drop_inbound_group,use_internal_dnc,use_campaign_dnc,cpd_amd_action,am_message_exten,three_way_call_cid,campaign_cid,survey_first_audio_file,survey_opt_in_audio_file,survey_ni_audio_file,survey_third_audio_file,survey_fourth_audio_file,extension_appended_cidname,queue_priority,closer_campaigns,queuemetrics_phone_environment,campaign_recording,campaign_rec_filename,safe_harbor_audio,safe_harbor_menu_id,survey_recording,safe_harbor_audio_field,use_other_campaign_dnc,cpd_unknown_action,routing_initiated_recordings,campaign_rec_exten FROM vicidial_campaigns where campaign_id = '$VDADcampaign';";
|
$stmtA = "SELECT drop_call_seconds,drop_action,safe_harbor_exten,concurrent_transfers,next_agent_call,voicemail_ext,drop_inbound_group,use_internal_dnc,use_campaign_dnc,cpd_amd_action,am_message_exten,three_way_call_cid,campaign_cid,survey_first_audio_file,survey_opt_in_audio_file,survey_ni_audio_file,survey_third_audio_file,survey_fourth_audio_file,extension_appended_cidname,queue_priority,closer_campaigns,queuemetrics_phone_environment,campaign_recording,campaign_rec_filename,safe_harbor_audio,safe_harbor_menu_id,survey_recording,safe_harbor_audio_field,use_other_campaign_dnc,cpd_unknown_action,routing_initiated_recordings,campaign_rec_exten,call_quota_lead_ranking FROM vicidial_campaigns where campaign_id = '$VDADcampaign';";
|
||||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
$sthArows=$sthA->rows;
|
$sthArows=$sthA->rows;
|
||||||
@@ -808,6 +817,7 @@ if ($VDACaffected_rows > 0)
|
|||||||
$cpd_unknown_action = $aryA[29];
|
$cpd_unknown_action = $aryA[29];
|
||||||
$routing_initiated_recordings = $aryA[30];
|
$routing_initiated_recordings = $aryA[30];
|
||||||
$campaign_rec_exten = $aryA[31];
|
$campaign_rec_exten = $aryA[31];
|
||||||
|
$VD_call_quota_lead_ranking = $aryA[32];
|
||||||
if (length($closer_campaigns) > 2)
|
if (length($closer_campaigns) > 2)
|
||||||
{
|
{
|
||||||
$closer_campaigns =~ s/^ | -$//gi;
|
$closer_campaigns =~ s/^ | -$//gi;
|
||||||
@@ -1156,6 +1166,11 @@ if ($VDACaffected_rows > 0)
|
|||||||
$dbhP=$dbhA; $mysql_count='01067'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
$dbhP=$dbhA; $mysql_count='01067'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||||
if ($AGILOG) {$agi_string = "-- VDAD VLE insert: |$affected_rows|\n|$stmtA|"; &agi_output;}
|
if ($AGILOG) {$agi_string = "-- VDAD VLE insert: |$affected_rows|\n|$stmtA|"; &agi_output;}
|
||||||
|
|
||||||
|
if ( ($SScall_quota_lead_ranking > 0) && ($VD_call_quota_lead_ranking !~ /^DISABLED$/i) )
|
||||||
|
{
|
||||||
|
$temp_status = $vdlog_status;
|
||||||
|
&call_quota_logging;
|
||||||
|
}
|
||||||
|
|
||||||
#############################################
|
#############################################
|
||||||
##### START QUEUEMETRICS LOGGING LOOKUP #####
|
##### START QUEUEMETRICS LOGGING LOOKUP #####
|
||||||
@@ -1535,6 +1550,12 @@ if ($call_handle_method =~ /SURVEY/)
|
|||||||
if ($AGILOG) {$agi_string = "$affected_rows|$stmtA|"; &agi_output;}
|
if ($AGILOG) {$agi_string = "$affected_rows|$stmtA|"; &agi_output;}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ($SScall_quota_lead_ranking > 0) && ($VD_call_quota_lead_ranking !~ /^DISABLED$/i) )
|
||||||
|
{
|
||||||
|
$temp_status = $survey_ni_status;
|
||||||
|
&call_quota_logging;
|
||||||
|
}
|
||||||
|
|
||||||
$AGI->hangup();
|
$AGI->hangup();
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
@@ -1643,6 +1664,12 @@ if ($call_handle_method =~ /SURVEY/)
|
|||||||
if ($AGILOG) {$agi_string = "$affected_rows|$stmtA|"; &agi_output;}
|
if ($AGILOG) {$agi_string = "$affected_rows|$stmtA|"; &agi_output;}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ($SScall_quota_lead_ranking > 0) && ($VD_call_quota_lead_ranking !~ /^DISABLED$/i) )
|
||||||
|
{
|
||||||
|
$temp_status = $survey_third_status;
|
||||||
|
&call_quota_logging;
|
||||||
|
}
|
||||||
|
|
||||||
if (length($survey_third_exten) > 0)
|
if (length($survey_third_exten) > 0)
|
||||||
{
|
{
|
||||||
if ($AGILOG) {$agi_string = "exiting the VDAD SURVEY app, transferring call to $survey_third_exten"; &agi_output;}
|
if ($AGILOG) {$agi_string = "exiting the VDAD SURVEY app, transferring call to $survey_third_exten"; &agi_output;}
|
||||||
@@ -1766,6 +1793,12 @@ if ($call_handle_method =~ /SURVEY/)
|
|||||||
if ($AGILOG) {$agi_string = "$affected_rows|$stmtA|"; &agi_output;}
|
if ($AGILOG) {$agi_string = "$affected_rows|$stmtA|"; &agi_output;}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ($SScall_quota_lead_ranking > 0) && ($VD_call_quota_lead_ranking !~ /^DISABLED$/i) )
|
||||||
|
{
|
||||||
|
$temp_status = $survey_fourth_status;
|
||||||
|
&call_quota_logging;
|
||||||
|
}
|
||||||
|
|
||||||
if (length($survey_fourth_exten) > 0)
|
if (length($survey_fourth_exten) > 0)
|
||||||
{
|
{
|
||||||
if ($AGILOG) {$agi_string = "exiting the VDAD SURVEY app, transferring call to $survey_fourth_exten"; &agi_output;}
|
if ($AGILOG) {$agi_string = "exiting the VDAD SURVEY app, transferring call to $survey_fourth_exten"; &agi_output;}
|
||||||
@@ -1902,6 +1935,12 @@ if ($call_handle_method =~ /SURVEY/)
|
|||||||
&agi_output;
|
&agi_output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ($SScall_quota_lead_ranking > 0) && ($VD_call_quota_lead_ranking !~ /^DISABLED$/i) )
|
||||||
|
{
|
||||||
|
$temp_status = $survey_status;
|
||||||
|
&call_quota_logging;
|
||||||
|
}
|
||||||
|
|
||||||
if ($enable_queuemetrics_logging > 0)
|
if ($enable_queuemetrics_logging > 0)
|
||||||
{
|
{
|
||||||
$qm_call_time = ($now_date_epoch - $start_time_epoch);
|
$qm_call_time = ($now_date_epoch - $start_time_epoch);
|
||||||
@@ -2137,6 +2176,12 @@ if ($call_handle_method =~ /SURVEY/)
|
|||||||
&agi_output;
|
&agi_output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ($SScall_quota_lead_ranking > 0) && ($VD_call_quota_lead_ranking !~ /^DISABLED$/i) )
|
||||||
|
{
|
||||||
|
$temp_status = $survey_status;
|
||||||
|
&call_quota_logging;
|
||||||
|
}
|
||||||
|
|
||||||
$AGI->hangup();
|
$AGI->hangup();
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
@@ -2180,6 +2225,12 @@ if ($call_handle_method =~ /SURVEY/)
|
|||||||
$agi_string = "-- VDAD survey no-response go to campaign DROP |$drop_timer|$DROP_TIME|";
|
$agi_string = "-- VDAD survey no-response go to campaign DROP |$drop_timer|$DROP_TIME|";
|
||||||
&agi_output;
|
&agi_output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ($SScall_quota_lead_ranking > 0) && ($VD_call_quota_lead_ranking !~ /^DISABLED$/i) )
|
||||||
|
{
|
||||||
|
$temp_status = 'PM';
|
||||||
|
&call_quota_logging;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
################################################################################
|
################################################################################
|
||||||
@@ -3909,6 +3960,12 @@ if ($drop_timer > $DROP_TIME)
|
|||||||
if ($AGILOG) {$agi_string = "-- VDAD vac record deleted: |$affected_rows|$VDADcampaign|"; &agi_output;}
|
if ($AGILOG) {$agi_string = "-- VDAD vac record deleted: |$affected_rows|$VDADcampaign|"; &agi_output;}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ($SScall_quota_lead_ranking > 0) && ($VD_call_quota_lead_ranking !~ /^DISABLED$/i) )
|
||||||
|
{
|
||||||
|
$temp_status = $drop_status;
|
||||||
|
&call_quota_logging;
|
||||||
|
}
|
||||||
|
|
||||||
if ($drop_action =~ /AUDIO/)
|
if ($drop_action =~ /AUDIO/)
|
||||||
{
|
{
|
||||||
if ($safe_harbor_audio_field !~ /DISABLED/)
|
if ($safe_harbor_audio_field !~ /DISABLED/)
|
||||||
@@ -3930,8 +3987,8 @@ if ($drop_timer > $DROP_TIME)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sthA->finish();
|
$sthA->finish();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$DROPexten='';
|
$DROPexten='';
|
||||||
if ($AGILOG) {$agi_string = "playing drop message: $safe_harbor_audio"; &agi_output;}
|
if ($AGILOG) {$agi_string = "playing drop message: $safe_harbor_audio"; &agi_output;}
|
||||||
|
|
||||||
@@ -3957,7 +4014,6 @@ if ($drop_timer > $DROP_TIME)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (length($DROPexten)>0)
|
if (length($DROPexten)>0)
|
||||||
{
|
{
|
||||||
### if DROP extension is defined then send the dropped call there instead of hangup
|
### if DROP extension is defined then send the dropped call there instead of hangup
|
||||||
@@ -4144,6 +4200,321 @@ sub mysql_error_logging
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
##### BEGIN Call Quota Lead Ranking logging #####
|
||||||
|
sub call_quota_logging
|
||||||
|
{
|
||||||
|
# Gather settings container for Call Quota Lead Ranking
|
||||||
|
$CQcontainer_entry='';
|
||||||
|
$stmtA = "SELECT container_entry FROM vicidial_settings_containers where container_id='$VD_call_quota_lead_ranking';";
|
||||||
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
|
$sthArows=$sthA->rows;
|
||||||
|
if ($sthArows > 0)
|
||||||
|
{
|
||||||
|
@aryA = $sthA->fetchrow_array;
|
||||||
|
$CQcontainer_entry = $aryA[0];
|
||||||
|
$CQcontainer_entry =~ s/\\//gi;
|
||||||
|
}
|
||||||
|
$sthA->finish();
|
||||||
|
|
||||||
|
# Define variables for Call Quota settings
|
||||||
|
$session_one='';
|
||||||
|
$session_two='';
|
||||||
|
$session_three='';
|
||||||
|
$session_four='';
|
||||||
|
$session_five='';
|
||||||
|
$session_six='';
|
||||||
|
$settings_session_score=0;
|
||||||
|
$zero_rank_after_call=0;
|
||||||
|
|
||||||
|
if (length($CQcontainer_entry) > 5)
|
||||||
|
{
|
||||||
|
@container_lines = split(/\n/,$CQcontainer_entry);
|
||||||
|
$c=0;
|
||||||
|
foreach(@container_lines)
|
||||||
|
{
|
||||||
|
$container_lines[$c] =~ s/;.*|\r|\t| //gi;
|
||||||
|
if (length($container_lines[$c]) > 5)
|
||||||
|
{
|
||||||
|
# define core settings
|
||||||
|
if ($container_lines[$c] =~ /^zero_rank_after_call/i)
|
||||||
|
{
|
||||||
|
$container_lines[$c] =~ s/zero_rank_after_call=>//gi;
|
||||||
|
if ( ($container_lines[$c] >= 0) && ($container_lines[$c] <= 1) )
|
||||||
|
{
|
||||||
|
$zero_rank_after_call = $container_lines[$c];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# define sessions
|
||||||
|
if ($container_lines[$c] =~ /^session_one/i)
|
||||||
|
{
|
||||||
|
$session_one_valid=0; $session_one_start=''; $session_one_end='';
|
||||||
|
$session_one = $container_lines[$c];
|
||||||
|
$session_one =~ s/session_one=>//gi;
|
||||||
|
if ( (length($session_one) > 0) && (length($session_one) <= 9) && ($session_one =~ /,/) )
|
||||||
|
{
|
||||||
|
@session_oneARY = split(/,/,$session_one);
|
||||||
|
$session_one_start = $session_oneARY[0];
|
||||||
|
$session_one_end = $session_oneARY[1];
|
||||||
|
if ( (length($session_one_start) >= 4) && (length($session_one_end) >= 4) && ($session_one_start < $session_one_end) && ($session_one_end <= 2400) )
|
||||||
|
{
|
||||||
|
$settings_session_score++;
|
||||||
|
$session_one_valid++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($container_lines[$c] =~ /^session_two/i)
|
||||||
|
{
|
||||||
|
$session_two_valid=0; $session_two_start=''; $session_two_end='';
|
||||||
|
$session_two = $container_lines[$c];
|
||||||
|
$session_two =~ s/session_two=>//gi;
|
||||||
|
if ( (length($session_two) > 0) && (length($session_two) <= 9) && ($session_two =~ /,/) )
|
||||||
|
{
|
||||||
|
@session_twoARY = split(/,/,$session_two);
|
||||||
|
$session_two_start = $session_twoARY[0];
|
||||||
|
$session_two_end = $session_twoARY[1];
|
||||||
|
if ( (length($session_two_start) >= 4) && (length($session_two_end) >= 4) && ($session_one_valid > 0) && ($session_one_end <= $session_two_start) && ($session_two_start < $session_two_end) && ($session_two_end <= 2400) )
|
||||||
|
{
|
||||||
|
$settings_session_score++;
|
||||||
|
$session_two_valid++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($container_lines[$c] =~ /^session_three/i)
|
||||||
|
{
|
||||||
|
$session_three_valid=0; $session_three_start=''; $session_three_end='';
|
||||||
|
$session_three = $container_lines[$c];
|
||||||
|
$session_three =~ s/session_three=>//gi;
|
||||||
|
if ( (length($session_three) > 0) && (length($session_three) <= 9) && ($session_three =~ /,/) )
|
||||||
|
{
|
||||||
|
@session_threeARY = split(/,/,$session_three);
|
||||||
|
$session_three_start = $session_threeARY[0];
|
||||||
|
$session_three_end = $session_threeARY[1];
|
||||||
|
if ( (length($session_three_start) >= 4) && (length($session_three_end) >= 4) && ($session_two_valid > 0) && ($session_two_end <= $session_three_start) && ($session_three_start < $session_three_end) && ($session_three_end <= 2400) )
|
||||||
|
{
|
||||||
|
$settings_session_score++;
|
||||||
|
$session_three_valid++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($container_lines[$c] =~ /^session_four/i)
|
||||||
|
{
|
||||||
|
$session_four_valid=0; $session_four_start=''; $session_four_end='';
|
||||||
|
$session_four = $container_lines[$c];
|
||||||
|
$session_four =~ s/session_four=>//gi;
|
||||||
|
if ( (length($session_four) > 0) && (length($session_four) <= 9) && ($session_four =~ /,/) )
|
||||||
|
{
|
||||||
|
@session_fourARY = split(/,/,$session_four);
|
||||||
|
$session_four_start = $session_fourARY[0];
|
||||||
|
$session_four_end = $session_fourARY[1];
|
||||||
|
if ( (length($session_four_start) >= 4) && (length($session_four_end) >= 4) && ($session_three_valid > 0) && ($session_three_end <= $session_four_start) && ($session_four_start < $session_four_end) && ($session_four_end <= 2400) )
|
||||||
|
{
|
||||||
|
$settings_session_score++;
|
||||||
|
$session_four_valid++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($container_lines[$c] =~ /^session_five/i)
|
||||||
|
{
|
||||||
|
$session_five_valid=0; $session_five_start=''; $session_five_end='';
|
||||||
|
$session_five = $container_lines[$c];
|
||||||
|
$session_five =~ s/session_five=>//gi;
|
||||||
|
if ( (length($session_five) > 0) && (length($session_five) <= 9) && ($session_five =~ /,/) )
|
||||||
|
{
|
||||||
|
@session_fiveARY = split(/,/,$session_five);
|
||||||
|
$session_five_start = $session_fiveARY[0];
|
||||||
|
$session_five_end = $session_fiveARY[1];
|
||||||
|
if ( (length($session_five_start) >= 4) && (length($session_five_end) >= 4) && ($session_four_valid > 0) && ($session_four_end <= $session_five_start) && ($session_five_start < $session_five_end) && ($session_five_end <= 2400) )
|
||||||
|
{
|
||||||
|
$settings_session_score++;
|
||||||
|
$session_five_valid++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($container_lines[$c] =~ /^session_six/i)
|
||||||
|
{
|
||||||
|
$session_six_valid=0; $session_six_start=''; $session_six_end='';
|
||||||
|
$session_six = $container_lines[$c];
|
||||||
|
$session_six =~ s/session_six=>//gi;
|
||||||
|
if ( (length($session_six) > 0) && (length($session_six) <= 9) && ($session_six =~ /,/) )
|
||||||
|
{
|
||||||
|
@session_sixARY = split(/,/,$session_six);
|
||||||
|
$session_six_start = $session_sixARY[0];
|
||||||
|
$session_six_end = $session_sixARY[1];
|
||||||
|
if ( (length($session_six_start) >= 4) && (length($session_six_end) >= 4) && ($session_five_valid > 0) && ($session_five_end <= $session_six_start) && ($session_six_start < $session_six_end) && ($session_six_end <= 2400) )
|
||||||
|
{
|
||||||
|
$settings_session_score++;
|
||||||
|
$session_six_valid++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{if ($DBX > 0) {print " blank line: $c|$container_lines[$c]|\n";}}
|
||||||
|
$c++;
|
||||||
|
}
|
||||||
|
if ($settings_session_score >= 1)
|
||||||
|
{
|
||||||
|
$stmtA = "SELECT list_id,called_count,rank FROM vicidial_list where lead_id='$CIDlead_id';";
|
||||||
|
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
|
||||||
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
|
$sthArows=$sthA->rows;
|
||||||
|
if ($sthArows > 0)
|
||||||
|
{
|
||||||
|
@aryA = $sthA->fetchrow_array;
|
||||||
|
$VLlist_id = $aryA[0];
|
||||||
|
$VLcalled_count = $aryA[1];
|
||||||
|
$VLrank = $aryA[2];
|
||||||
|
$tempVLrank = $VLrank;
|
||||||
|
if ( ($zero_rank_after_call > 0) && ($VLrank > 0) ) {$tempVLrank=0;}
|
||||||
|
}
|
||||||
|
$sthA->finish();
|
||||||
|
|
||||||
|
$secX = time();
|
||||||
|
$CQtarget = ($secX - 14400); # look back 4 hours
|
||||||
|
($CQsec,$CQmin,$CQhour,$CQmday,$CQmon,$CQyear,$CQwday,$CQyday,$CQisdst) = localtime($CQtarget);
|
||||||
|
$CQyear = ($CQyear + 1900);
|
||||||
|
$CQmon++;
|
||||||
|
if ($CQmon < 10) {$CQmon = "0$CQmon";}
|
||||||
|
if ($CQmday < 10) {$CQmday = "0$CQmday";}
|
||||||
|
if ($CQhour < 10) {$CQhour = "0$CQhour";}
|
||||||
|
if ($CQmin < 10) {$CQmin = "0$CQmin";}
|
||||||
|
if ($CQsec < 10) {$CQsec = "0$CQsec";}
|
||||||
|
$CQSQLdate = "$CQyear-$CQmon-$CQmday $CQhour:$CQmin:$CQsec";
|
||||||
|
|
||||||
|
$VDL_call_datetime='';
|
||||||
|
$stmtA = "SELECT call_date from vicidial_dial_log where lead_id='$CIDlead_id' and call_date > \"$CQSQLdate\" and caller_code LIKE \"%$CIDlead_id\" order by call_date desc limit 1;";
|
||||||
|
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
|
||||||
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
|
$sthArows=$sthA->rows;
|
||||||
|
if ($sthArows > 0)
|
||||||
|
{
|
||||||
|
@aryA = $sthA->fetchrow_array;
|
||||||
|
$VDLcall_datetime = $aryA[0];
|
||||||
|
@VDLcall_datetimeARY = split(/ /,$VDLcall_datetime);
|
||||||
|
@VDLcall_timeARY = split(/:/,$VDLcall_datetimeARY[1]);
|
||||||
|
$VDLcall_hourmin = "$VDLcall_timeARY[0]$VDLcall_timeARY[1]";
|
||||||
|
|
||||||
|
if ( ($session_one_start <= $VDLcall_hourmin) and ($session_one_end > $VDLcall_hourmin) )
|
||||||
|
{
|
||||||
|
$call_in_session=1;
|
||||||
|
$session_newSQL=",session_one_calls='1',session_one_today_calls='1'";
|
||||||
|
$session_updateSQL=",session_one_calls=(session_one_calls + 1),session_one_today_calls=(session_one_today_calls + 1)";
|
||||||
|
}
|
||||||
|
if ( ($session_two_start <= $VDLcall_hourmin) and ($session_two_end > $VDLcall_hourmin) )
|
||||||
|
{
|
||||||
|
$call_in_session=2;
|
||||||
|
$session_newSQL=",session_two_calls='1',session_two_today_calls='1'";
|
||||||
|
$session_updateSQL=",session_two_calls=(session_two_calls + 1),session_two_today_calls=(session_two_today_calls + 1)";
|
||||||
|
}
|
||||||
|
if ( ($session_three_start <= $VDLcall_hourmin) and ($session_three_end > $VDLcall_hourmin) )
|
||||||
|
{
|
||||||
|
$call_in_session=3;
|
||||||
|
$session_newSQL=",session_three_calls='1',session_three_today_calls='1'";
|
||||||
|
$session_updateSQL=",session_three_calls=(session_three_calls + 1),session_three_today_calls=(session_three_today_calls + 1)";
|
||||||
|
}
|
||||||
|
if ( ($session_four_start <= $VDLcall_hourmin) and ($session_four_end > $VDLcall_hourmin) )
|
||||||
|
{
|
||||||
|
$call_in_session=4;
|
||||||
|
$session_newSQL=",session_four_calls='1',session_four_today_calls='1'";
|
||||||
|
$session_updateSQL=",session_four_calls=(session_four_calls + 1),session_four_today_calls=(session_four_today_calls + 1)";
|
||||||
|
}
|
||||||
|
if ( ($session_five_start <= $VDLcall_hourmin) and ($session_five_end > $VDLcall_hourmin) )
|
||||||
|
{
|
||||||
|
$call_in_session=5;
|
||||||
|
$session_newSQL=",session_five_calls='1',session_five_today_calls='1'";
|
||||||
|
$session_updateSQL=",session_five_calls=(session_five_calls + 1),session_five_today_calls=(session_five_today_calls + 1)";
|
||||||
|
}
|
||||||
|
if ( ($session_six_start <= $VDLcall_hourmin) and ($session_six_end > $VDLcall_hourmin) )
|
||||||
|
{
|
||||||
|
$call_in_session=6;
|
||||||
|
$session_newSQL=",session_six_calls='1',session_six_today_calls='1'";
|
||||||
|
$session_updateSQL=",session_six_calls=(session_six_calls + 1),session_six_today_calls=(session_six_today_calls + 1)";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($AGILOG) {$agi_string = "CQ-Debug 2: $VDLcall_datetime|$VDLcall_hourmin|$timeclock_end_of_day|$session_one_start|$session_one_end|$call_in_session|"; &agi_output;}
|
||||||
|
|
||||||
|
if ($call_in_session > 0)
|
||||||
|
{
|
||||||
|
if (length($timeclock_end_of_day) < 1) {$timeclock_end_of_day='0000';}
|
||||||
|
$timeclock_end_of_day_hour = (substr($timeclock_end_of_day, 0, 2) + 0);
|
||||||
|
$timeclock_end_of_day_min = (substr($timeclock_end_of_day, 2, 2) + 0);
|
||||||
|
|
||||||
|
$today_start_epoch = timelocal('0',$timeclock_end_of_day_min,$timeclock_end_of_day_hour,$mday,($mon-1),$year);
|
||||||
|
if ($timeclock_end_of_day > $VDLcall_hourmin)
|
||||||
|
{$today_start_epoch = ($today_start_epoch - 86400);}
|
||||||
|
$day_two_start_epoch = ($today_start_epoch - (86400 * 1));
|
||||||
|
$day_three_start_epoch = ($today_start_epoch - (86400 * 2));
|
||||||
|
$day_four_start_epoch = ($today_start_epoch - (86400 * 3));
|
||||||
|
$day_five_start_epoch = ($today_start_epoch - (86400 * 4));
|
||||||
|
$day_six_start_epoch = ($today_start_epoch - (86400 * 5));
|
||||||
|
$day_seven_start_epoch = ($today_start_epoch - (86400 * 6));
|
||||||
|
|
||||||
|
# Gather the details on existing vicidial_lead_call_quota_counts for this lead, if there is one
|
||||||
|
$stmtA = "SELECT first_call_date,UNIX_TIMESTAMP(first_call_date),last_call_date from vicidial_lead_call_quota_counts where lead_id='$CIDlead_id' and list_id='$VLlist_id';";
|
||||||
|
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
|
||||||
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
|
$VLCQCinfo_ct=$sthA->rows;
|
||||||
|
if ($VLCQCinfo_ct > 0)
|
||||||
|
{
|
||||||
|
@aryA = $sthA->fetchrow_array;
|
||||||
|
$VLCQCfirst_call_datetime = $aryA[0];
|
||||||
|
$VLCQCfirst_call_epoch = $aryA[1];
|
||||||
|
$VLCQClast_call_date = $aryA[2];
|
||||||
|
|
||||||
|
if ($VDLcall_datetime ne $VLCQClast_call_date)
|
||||||
|
{
|
||||||
|
if ($VLCQCfirst_call_epoch >= $today_start_epoch)
|
||||||
|
{$day_updateSQL=',day_one_calls=(day_one_calls+1)';}
|
||||||
|
if ( ($VLCQCfirst_call_epoch >= $day_two_start_epoch) and ($VLCQCfirst_call_epoch < $today_start_epoch) )
|
||||||
|
{$day_updateSQL=',day_two_calls=(day_two_calls+1)';}
|
||||||
|
if ( ($VLCQCfirst_call_epoch >= $day_three_start_epoch) and ($VLCQCfirst_call_epoch < $day_two_start_epoch) )
|
||||||
|
{$day_updateSQL=',day_three_calls=(day_three_calls+1)';}
|
||||||
|
if ( ($VLCQCfirst_call_epoch >= $day_four_start_epoch) and ($VLCQCfirst_call_epoch < $day_three_start_epoch) )
|
||||||
|
{$day_updateSQL=',day_four_calls=(day_four_calls+1)';}
|
||||||
|
if ( ($VLCQCfirst_call_epoch >= $day_five_start_epoch) and ($VLCQCfirst_call_epoch < $day_four_start_epoch) )
|
||||||
|
{$day_updateSQL=',day_five_calls=(day_five_calls+1)';}
|
||||||
|
if ( ($VLCQCfirst_call_epoch >= $day_six_start_epoch) and ($VLCQCfirst_call_epoch < $day_five_start_epoch) )
|
||||||
|
{$day_updateSQL=',day_six_calls=(day_six_calls+1)';}
|
||||||
|
if ( ($VLCQCfirst_call_epoch >= $day_seven_start_epoch) and ($VLCQCfirst_call_epoch < $day_six_start_epoch) )
|
||||||
|
{$day_updateSQL=',day_seven_calls=(day_seven_calls+1)';}
|
||||||
|
# Update in the vicidial_lead_call_quota_counts table for this lead
|
||||||
|
$stmtA="UPDATE vicidial_lead_call_quota_counts SET last_call_date='$VDLcall_datetime',status='$temp_status',called_count='$VLcalled_count',rank='$tempVLrank',modify_date=NOW() $session_updateSQL $day_updateSQL where lead_id='$CIDlead_id' and list_id='$VLlist_id' and modify_date < NOW();";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# Update in the vicidial_lead_call_quota_counts table for this lead
|
||||||
|
$stmtA="UPDATE vicidial_lead_call_quota_counts SET status='$temp_status',called_count='$VLcalled_count',rank='$tempVLrank',modify_date=NOW() where lead_id='$CIDlead_id' and list_id='$VLlist_id';";
|
||||||
|
}
|
||||||
|
$VLCQCaffected_rows_update = $dbhA->do($stmtA);
|
||||||
|
if ($AGILOG) {$agi_string = "-- VLCQC record updated: |$VLCQCaffected_rows_update| |$stmtA|"; &agi_output;}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# Insert new record into vicidial_lead_call_quota_counts table for this lead
|
||||||
|
$stmtA="INSERT INTO vicidial_lead_call_quota_counts SET lead_id='$CIDlead_id',list_id='$VLlist_id',first_call_date='$VDLcall_datetime',last_call_date='$VDLcall_datetime',status='$temp_status',called_count='$VLcalled_count',day_one_calls='1',rank='$tempVLrank',modify_date=NOW() $session_newSQL;";
|
||||||
|
$VLCQCaffected_rows_update = $dbhA->do($stmtA);
|
||||||
|
if ($AGILOG) {$agi_string = "-- VLCQC record inserted: |$VLCQCaffected_rows_update| |$stmtA|"; &agi_output;}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ($zero_rank_after_call > 0) && ($VLrank > 0) )
|
||||||
|
{
|
||||||
|
# Update this lead to rank=0
|
||||||
|
$stmtA="UPDATE vicidial_list SET rank='0' where lead_id='$CIDlead_id';";
|
||||||
|
$VLCQCaffected_rows_zero_rank = $dbhA->do($stmtA);
|
||||||
|
if ($AGILOG) {$agi_string = "-- VLCQC lead rank zero: |$VLCQCaffected_rows_zero_rank| |$stmtA|"; &agi_output;}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$sthA->finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
##### END Call Quota Lead Ranking logging #####
|
||||||
|
|
||||||
|
|
||||||
##### CPD call progress AMD end call process #####
|
##### CPD call progress AMD end call process #####
|
||||||
sub cpd_end_call
|
sub cpd_end_call
|
||||||
@@ -4261,6 +4632,11 @@ sub cpd_end_call
|
|||||||
$affected_rows = $dbhA->do($stmtA);
|
$affected_rows = $dbhA->do($stmtA);
|
||||||
$dbhP=$dbhA; $mysql_count='01055'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
$dbhP=$dbhA; $mysql_count='01055'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
|
||||||
|
|
||||||
|
if ( ($SScall_quota_lead_ranking > 0) && ($VD_call_quota_lead_ranking !~ /^DISABLED$/i) )
|
||||||
|
{
|
||||||
|
$temp_status = $vdad_result;
|
||||||
|
&call_quota_logging;
|
||||||
|
}
|
||||||
|
|
||||||
### use STDOUT to send call to proper DROP location
|
### use STDOUT to send call to proper DROP location
|
||||||
$VHqueryCID = "VH$CIDdate$VDADconf_exten";
|
$VHqueryCID = "VH$CIDdate$VDADconf_exten";
|
||||||
|
|||||||
+174
-2
@@ -136,9 +136,10 @@
|
|||||||
# 181028-1451 - Added vicidial_list stuck QUEUE reset at TEoD
|
# 181028-1451 - Added vicidial_list stuck QUEUE reset at TEoD
|
||||||
# 190220-2258 - Added flushing of vicidial_sessions_recent table
|
# 190220-2258 - Added flushing of vicidial_sessions_recent table
|
||||||
# 190530-1411 - Added SIP logger code
|
# 190530-1411 - Added SIP logger code
|
||||||
|
# 190713-0900 - Added vicidial_lead_call_quota_counts log archiving
|
||||||
#
|
#
|
||||||
|
|
||||||
$build = '190530-1411';
|
$build = '190713-0900';
|
||||||
|
|
||||||
$DB=0; # Debug flag
|
$DB=0; # Debug flag
|
||||||
$teodDB=0; # flag to log Timeclock End of Day processes to log file
|
$teodDB=0; # flag to log Timeclock End of Day processes to log file
|
||||||
@@ -167,6 +168,7 @@ $today_start = "$year-$mon-$mday 00:00:00";
|
|||||||
$today_date = "$year-$mon-$mday";
|
$today_date = "$year-$mon-$mday";
|
||||||
$reset_test = "$hour$min";
|
$reset_test = "$hour$min";
|
||||||
$wday_now = $wday;
|
$wday_now = $wday;
|
||||||
|
$min_test = $min;
|
||||||
|
|
||||||
### calculate the date and time for slightly less than 24 hours ago
|
### calculate the date and time for slightly less than 24 hours ago
|
||||||
$secX = time();
|
$secX = time();
|
||||||
@@ -210,6 +212,19 @@ if ($SDsec < 10) {$SDsec = "0$SDsec";}
|
|||||||
$SDSQLdate = "$SDyear-$SDmon-$SDmday $SDhour:$SDmin:$SDsec";
|
$SDSQLdate = "$SDyear-$SDmon-$SDmday $SDhour:$SDmin:$SDsec";
|
||||||
$SDdate = "$SDyear-$SDmon-$SDmday";
|
$SDdate = "$SDyear-$SDmon-$SDmday";
|
||||||
|
|
||||||
|
### calculate the date and time for 6 days ago
|
||||||
|
$SXtarget = ($secX - 604800); # 6 days ago
|
||||||
|
($SXsec,$SXmin,$SXhour,$SXmday,$SXmon,$SXyear,$SXwday,$SXyday,$SXisdst) = localtime($SXtarget);
|
||||||
|
$SXyear = ($SXyear + 1900);
|
||||||
|
$SXmon++;
|
||||||
|
if ($SXmon < 10) {$SXmon = "0$SXmon";}
|
||||||
|
if ($SXmday < 10) {$SXmday = "0$SXmday";}
|
||||||
|
if ($SXhour < 10) {$SXhour = "0$SXhour";}
|
||||||
|
if ($SXmin < 10) {$SXmin = "0$SXmin";}
|
||||||
|
if ($SXsec < 10) {$SXsec = "0$SXsec";}
|
||||||
|
$SXSQLdate = "$SXyear-$SXmon-$SXmday $SXhour:$SXmin:$SXsec";
|
||||||
|
$SXdate = "$SXyear-$SXmon-$SXmday";
|
||||||
|
|
||||||
|
|
||||||
### begin parsing run-time options ###
|
### begin parsing run-time options ###
|
||||||
if (length($ARGV[0])>1)
|
if (length($ARGV[0])>1)
|
||||||
@@ -406,7 +421,7 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA
|
|||||||
|
|
||||||
|
|
||||||
##### Get the settings from system_settings #####
|
##### Get the settings from system_settings #####
|
||||||
$stmtA = "SELECT sounds_central_control_active,active_voicemail_server,custom_dialplan_entry,default_codecs,generate_cross_server_exten,voicemail_timezones,default_voicemail_timezone,call_menu_qualify_enabled,allow_voicemail_greeting,reload_timestamp,meetme_enter_login_filename,meetme_enter_leave3way_filename,allow_chats,enable_auto_reports,enable_drop_lists,expired_lists_inactive,sip_event_logging FROM system_settings;";
|
$stmtA = "SELECT sounds_central_control_active,active_voicemail_server,custom_dialplan_entry,default_codecs,generate_cross_server_exten,voicemail_timezones,default_voicemail_timezone,call_menu_qualify_enabled,allow_voicemail_greeting,reload_timestamp,meetme_enter_login_filename,meetme_enter_leave3way_filename,allow_chats,enable_auto_reports,enable_drop_lists,expired_lists_inactive,sip_event_logging,call_quota_lead_ranking FROM system_settings;";
|
||||||
# print "$stmtA\n";
|
# print "$stmtA\n";
|
||||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
@@ -431,6 +446,7 @@ if ($sthArows > 0)
|
|||||||
$SSenable_drop_lists = $aryA[14];
|
$SSenable_drop_lists = $aryA[14];
|
||||||
$SSexpired_lists_inactive = $aryA[15];
|
$SSexpired_lists_inactive = $aryA[15];
|
||||||
$SSsip_event_logging = $aryA[16];
|
$SSsip_event_logging = $aryA[16];
|
||||||
|
$SScall_quota_lead_ranking = $aryA[17];
|
||||||
}
|
}
|
||||||
$sthA->finish();
|
$sthA->finish();
|
||||||
if ($DBXXX > 0) {print "SYSTEM SETTINGS: $sounds_central_control_active|$active_voicemail_server|$SScustom_dialplan_entry|$SSdefault_codecs\n";}
|
if ($DBXXX > 0) {print "SYSTEM SETTINGS: $sounds_central_control_active|$active_voicemail_server|$SScustom_dialplan_entry|$SSdefault_codecs\n";}
|
||||||
@@ -1954,6 +1970,76 @@ if ($timeclock_end_of_day_NOW > 0)
|
|||||||
if ($teodDB) {&teod_logger;}
|
if ($teodDB) {&teod_logger;}
|
||||||
}
|
}
|
||||||
##### END roll sip_event logs into one of the 7-day archive tables
|
##### END roll sip_event logs into one of the 7-day archive tables
|
||||||
|
|
||||||
|
|
||||||
|
##### BEGIN roll Call Quota Lead Ranking logs into the archive table after 7 days
|
||||||
|
if ($SScall_quota_lead_ranking > 0)
|
||||||
|
{
|
||||||
|
if (!$Q) {print "\nProcessing vicidial_lead_call_quota_counts table...\n";}
|
||||||
|
$stmtA = "INSERT IGNORE INTO vicidial_lead_call_quota_counts_archive SELECT * from vicidial_lead_call_quota_counts where ( (first_call_date < \"$SXSQLdate\") or (first_call_date IS NULL) );";
|
||||||
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
|
$sthArows = $sthA->rows;
|
||||||
|
$event_string = "$sthArows rows inserted into vicidial_lead_call_quota_counts_archive table ($SXSQLdate) |$stmtA|";
|
||||||
|
if (!$Q) {print "$event_string \n";}
|
||||||
|
if ($teodDB) {&teod_logger;}
|
||||||
|
|
||||||
|
$rv = $sthA->err();
|
||||||
|
if (!$rv)
|
||||||
|
{
|
||||||
|
# Gather list of the leads that were just archived, set rank=0
|
||||||
|
$stmtA = "SELECT lead_id from vicidial_lead_call_quota_counts where ( (first_call_date < \"$SXSQLdate\") or (first_call_date IS NULL) );";
|
||||||
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
|
$sthArowsDLISTS=$sthA->rows;
|
||||||
|
if ($DB > 0) {print "CALL QUOTA LEADS BEING ARCHIVED TO SET TO 0 RANK: |$sthArowsDLISTS| \n";}
|
||||||
|
$e=0;
|
||||||
|
while ($sthArowsDLISTS > $e)
|
||||||
|
{
|
||||||
|
@aryA = $sthA->fetchrow_array;
|
||||||
|
$DLISTlead_id[$e] = $aryA[0];
|
||||||
|
$e++;
|
||||||
|
}
|
||||||
|
$sthA->finish();
|
||||||
|
|
||||||
|
$e=0;
|
||||||
|
$e_update_ct=0;
|
||||||
|
while ($sthArowsDLISTS > $e)
|
||||||
|
{
|
||||||
|
$stmtA = "UPDATE vicidial_list SET rank=0 where lead_id='$DLISTlead_id[$e]';";
|
||||||
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
|
$sthArows = $sthA->rows;
|
||||||
|
if ($DBX) {print "$sthArows|$event_string|$stmtA| \n";}
|
||||||
|
$e_update_ct = ($e_update_ct + $sthArows);
|
||||||
|
$e++;
|
||||||
|
}
|
||||||
|
$event_string = "$e_update_ct($e) leads updated to 0 rank";
|
||||||
|
if ($DBX) {print "$event_string \n";}
|
||||||
|
if ($teodDB) {&teod_logger;}
|
||||||
|
|
||||||
|
$stmtA = "DELETE FROM vicidial_lead_call_quota_counts where ( (first_call_date < \"$SXSQLdate\") or (first_call_date IS NULL) );";
|
||||||
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
|
$sthArows = $sthA->rows;
|
||||||
|
$event_string = "$sthArows rows deleted from vicidial_lead_call_quota_counts table ($SXSQLdate) |$stmtA|";
|
||||||
|
if (!$Q) {print "$event_string \n";}
|
||||||
|
if ($teodDB) {&teod_logger;}
|
||||||
|
|
||||||
|
$stmtA = "optimize table vicidial_lead_call_quota_counts;";
|
||||||
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmtA = "UPDATE vicidial_lead_call_quota_counts SET session_one_today_calls='0',session_two_today_calls='0',session_three_today_calls='0',session_four_today_calls='0',session_five_today_calls='0',session_six_today_calls='0';";
|
||||||
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
|
$sthArows = $sthA->rows;
|
||||||
|
$event_string = "$sthArows rows reset today session counts vicidial_lead_call_quota_counts table ($SXSQLdate)";
|
||||||
|
if (!$Q) {print "$event_string \n";}
|
||||||
|
if ($teodDB) {&teod_logger;}
|
||||||
|
}
|
||||||
|
##### END roll Call Quota Lead Ranking logs into the archive table after 7 days
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4499,6 +4585,92 @@ if ($SSenable_drop_lists > 0)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
##### BEGIN Call Quota Lead Ranking recycling process
|
||||||
|
################################################################################
|
||||||
|
if ( ($SScall_quota_lead_ranking > 0) && ($THISserver_voicemail > 0) )
|
||||||
|
{
|
||||||
|
$stmtA = "SELECT campaign_id,call_quota_lead_ranking FROM vicidial_campaigns where active='Y' and call_quota_lead_ranking!='DISABLED' limit 1000;";
|
||||||
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
|
$sthBrows=$sthA->rows;
|
||||||
|
if ($DB) {print "Checking for Call Quota campaigns: |$sthBrows|$stmtA|\n";}
|
||||||
|
$r=0;
|
||||||
|
while ($sthBrows > $r)
|
||||||
|
{
|
||||||
|
@aryA = $sthA->fetchrow_array;
|
||||||
|
$CQcampaign_idARY[$r] = $aryA[0];
|
||||||
|
$CQcall_quota_lead_rankingARY[$r] = $aryA[1];
|
||||||
|
$r++;
|
||||||
|
}
|
||||||
|
$sthA->finish();
|
||||||
|
|
||||||
|
if ($sthBrows > 0)
|
||||||
|
{
|
||||||
|
$r=0;
|
||||||
|
while ($sthBrows > $r)
|
||||||
|
{
|
||||||
|
$call_quota_run_time='';
|
||||||
|
$stmtA = "SELECT container_entry FROM vicidial_settings_containers where container_id='$CQcall_quota_lead_rankingARY[$r]';";
|
||||||
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
|
$sthSCrows=$sthA->rows;
|
||||||
|
if ($DB) {print "Checking for Call Quota campaigns: |$sthSCrows|$stmtA|\n";}
|
||||||
|
if ($sthSCrows > 0)
|
||||||
|
{
|
||||||
|
@aryA = $sthA->fetchrow_array;
|
||||||
|
$TEMPcontainer_entry = $aryA[0];
|
||||||
|
$TEMPcontainer_entry =~ s/\\//gi;
|
||||||
|
if (length($TEMPcontainer_entry) > 5)
|
||||||
|
{
|
||||||
|
@container_lines = split(/\n/,$TEMPcontainer_entry);
|
||||||
|
$c=0;
|
||||||
|
foreach(@container_lines)
|
||||||
|
{
|
||||||
|
$container_lines[$c] =~ s/;.*|\r|\t| //gi;
|
||||||
|
if (length($container_lines[$c]) > 5)
|
||||||
|
{
|
||||||
|
# define call_quota_run_time settings
|
||||||
|
if ($container_lines[$c] =~ /^call_quota_run_time/i)
|
||||||
|
{
|
||||||
|
$call_quota_run_time = $container_lines[$c];
|
||||||
|
$call_quota_run_time =~ s/call_quota_run_time=>//gi;
|
||||||
|
if ( (length($call_quota_run_time) > 0) && (length($call_quota_run_time) <= 70) )
|
||||||
|
{
|
||||||
|
$TESTcall_quota_run_time = ",$call_quota_run_time,";
|
||||||
|
}
|
||||||
|
else {$call_quota_run_time='';}
|
||||||
|
if ($DBX) {print "Call Quota DEBUG: $c|$CQcampaign_idARY[$r]|$CQcall_quota_lead_rankingARY[$r]|$TESTcall_quota_run_time|$call_quota_run_time|$min_test|\n";}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$c++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$sthA->finish();
|
||||||
|
|
||||||
|
if ( (length($TESTcall_quota_run_time) >= 4) && ($TESTcall_quota_run_time =~ /,$min_test,/) )
|
||||||
|
{
|
||||||
|
$temp_campaign = $CQcampaign_idARY[$r];
|
||||||
|
$cq_command = "$PATHhome/AST_VDcall_quotas.pl --debug --log-to-adminlog --campaign=$temp_campaign ";
|
||||||
|
|
||||||
|
if ($DB) {print "starting call quota lead ranking process in a screen... |CQ$temp_campaign| |$call_quota_run_time|$min_test|\n";}
|
||||||
|
`/usr/bin/screen -d -m -S CQ$temp_campaign $cq_command `;
|
||||||
|
}
|
||||||
|
$r++;
|
||||||
|
}
|
||||||
|
if ($DB) {print "Call Quota Lead Ranking process launching DONE: $r\n";}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
################################################################################
|
||||||
|
##### END Call Quota Lead Ranking recycling process
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
##### BEGIN Reset per-hour hopper dial counts for users
|
##### BEGIN Reset per-hour hopper dial counts for users
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|||||||
+337
-14
@@ -25,7 +25,7 @@
|
|||||||
# It is good practice to keep this program running by placing the associated
|
# It is good practice to keep this program running by placing the associated
|
||||||
# KEEPALIVE script running every minute to ensure this program is always running
|
# KEEPALIVE script running every minute to ensure this program is always running
|
||||||
#
|
#
|
||||||
# Copyright (C) 2018 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
# Copyright (C) 2019 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||||
#
|
#
|
||||||
# CHANGELOG:
|
# CHANGELOG:
|
||||||
# 50125-1201 - Changed dial timeout to 120 seconds from 180 seconds
|
# 50125-1201 - Changed dial timeout to 120 seconds from 180 seconds
|
||||||
@@ -129,6 +129,7 @@
|
|||||||
# 180214-1559 - Added CID Group functionality
|
# 180214-1559 - Added CID Group functionality
|
||||||
# 180301-1338 - Small changes for Inbound Queue No Dial
|
# 180301-1338 - Small changes for Inbound Queue No Dial
|
||||||
# 180812-1026 - Added code for scheduled_callbacks_auto_reschedule campaign feature
|
# 180812-1026 - Added code for scheduled_callbacks_auto_reschedule campaign feature
|
||||||
|
# 190709-2239 - Added Call Quota logging
|
||||||
#
|
#
|
||||||
|
|
||||||
### begin parsing run-time options ###
|
### begin parsing run-time options ###
|
||||||
@@ -298,7 +299,7 @@ $event_string='LOGGED INTO MYSQL SERVER ON 1 CONNECTION|';
|
|||||||
|
|
||||||
#############################################
|
#############################################
|
||||||
##### START QUEUEMETRICS LOGGING LOOKUP #####
|
##### START QUEUEMETRICS LOGGING LOOKUP #####
|
||||||
$stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,outbound_autodial_active,queuemetrics_loginout,queuemetrics_addmember_enabled,queuemetrics_pause_type,enable_drop_lists FROM system_settings;";
|
$stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,outbound_autodial_active,queuemetrics_loginout,queuemetrics_addmember_enabled,queuemetrics_pause_type,enable_drop_lists,call_quota_lead_ranking,timeclock_end_of_day FROM system_settings;";
|
||||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
$sthArows=$sthA->rows;
|
$sthArows=$sthA->rows;
|
||||||
@@ -316,6 +317,8 @@ if ($sthArows > 0)
|
|||||||
$queuemetrics_addmember_enabled = $aryA[8];
|
$queuemetrics_addmember_enabled = $aryA[8];
|
||||||
$queuemetrics_pause_type = $aryA[9];
|
$queuemetrics_pause_type = $aryA[9];
|
||||||
$enable_drop_lists = $aryA[10];
|
$enable_drop_lists = $aryA[10];
|
||||||
|
$SScall_quota_lead_ranking = $aryA[11];
|
||||||
|
$timeclock_end_of_day = $aryA[12];
|
||||||
}
|
}
|
||||||
$sthA->finish();
|
$sthA->finish();
|
||||||
##### END QUEUEMETRICS LOGGING LOOKUP #####
|
##### END QUEUEMETRICS LOGGING LOOKUP #####
|
||||||
@@ -642,7 +645,7 @@ while($one_day_interval > 0)
|
|||||||
|
|
||||||
### grab the dial_level and multiply by active agents to get your goalcalls
|
### grab the dial_level and multiply by active agents to get your goalcalls
|
||||||
$DBIPadlevel[$user_CIPct]=0;
|
$DBIPadlevel[$user_CIPct]=0;
|
||||||
$stmtA = "SELECT auto_dial_level,local_call_time,dial_timeout,dial_prefix,campaign_cid,active,campaign_vdad_exten,closer_campaigns,omit_phone_code,available_only_ratio_tally,auto_alt_dial,campaign_allow_inbound,queue_priority,dial_method,use_custom_cid,inbound_queue_no_dial,available_only_tally_threshold,available_only_tally_threshold_agents,dial_level_threshold,dial_level_threshold_agents,adaptive_dl_diff_target,dl_diff_target_method,inbound_no_agents_no_dial_container,inbound_no_agents_no_dial_threshold,cid_group_id,scheduled_callbacks_auto_reschedule FROM vicidial_campaigns where campaign_id='$DBIPcampaign[$user_CIPct]'";
|
$stmtA = "SELECT auto_dial_level,local_call_time,dial_timeout,dial_prefix,campaign_cid,active,campaign_vdad_exten,closer_campaigns,omit_phone_code,available_only_ratio_tally,auto_alt_dial,campaign_allow_inbound,queue_priority,dial_method,use_custom_cid,inbound_queue_no_dial,available_only_tally_threshold,available_only_tally_threshold_agents,dial_level_threshold,dial_level_threshold_agents,adaptive_dl_diff_target,dl_diff_target_method,inbound_no_agents_no_dial_container,inbound_no_agents_no_dial_threshold,cid_group_id,scheduled_callbacks_auto_reschedule,call_quota_lead_ranking FROM vicidial_campaigns where campaign_id='$DBIPcampaign[$user_CIPct]'";
|
||||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
$sthArows=$sthA->rows;
|
$sthArows=$sthA->rows;
|
||||||
@@ -679,6 +682,7 @@ while($one_day_interval > 0)
|
|||||||
$DBIPinbound_no_agents_no_dial_threshold[$user_CIPct] = $aryA[23];
|
$DBIPinbound_no_agents_no_dial_threshold[$user_CIPct] = $aryA[23];
|
||||||
$DBIPcid_group_id[$user_CIPct] = $aryA[24];
|
$DBIPcid_group_id[$user_CIPct] = $aryA[24];
|
||||||
$DBIPscheduled_callbacks_auto_reschedule[$user_CIPct] = $aryA[25];
|
$DBIPscheduled_callbacks_auto_reschedule[$user_CIPct] = $aryA[25];
|
||||||
|
$DBIPcall_quota_lead_ranking[$user_CIPct] = $aryA[26];
|
||||||
|
|
||||||
if ($DBIPdl_diff_target_method[$user_CIPct] =~ /ADAPT_CALC_ONLY/)
|
if ($DBIPdl_diff_target_method[$user_CIPct] =~ /ADAPT_CALC_ONLY/)
|
||||||
{
|
{
|
||||||
@@ -1514,18 +1518,18 @@ while($one_day_interval > 0)
|
|||||||
|
|
||||||
### insert a NEW record to the vicidial_manager table to be processed
|
### insert a NEW record to the vicidial_manager table to be processed
|
||||||
$stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$DBIPaddress[$user_CIPct]','','Originate','$VqueryCID','Exten: $VDAD_dial_exten','Context: $ext_context','Channel: $local_DEF$Ndialstring$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','VDACnote: $DBIPcampaign[$user_CIPct]|$lead_id|$phone_code|$phone_number|OUT|$alt_dial|$DBIPqueue_priority[$user_CIPct]')";
|
$stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$DBIPaddress[$user_CIPct]','','Originate','$VqueryCID','Exten: $VDAD_dial_exten','Context: $ext_context','Channel: $local_DEF$Ndialstring$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','VDACnote: $DBIPcampaign[$user_CIPct]|$lead_id|$phone_code|$phone_number|OUT|$alt_dial|$DBIPqueue_priority[$user_CIPct]')";
|
||||||
$affected_rows = $dbhA->do($stmtA);
|
$affected_rowsA = $dbhA->do($stmtA);
|
||||||
|
|
||||||
$event_string = "| number call dialed|$DBIPcampaign[$user_CIPct]|$VqueryCID|$stmtA|$gmt_offset_now|$alt_dial|";
|
|
||||||
&event_logger;
|
|
||||||
|
|
||||||
### insert a SENT record to the vicidial_auto_calls table
|
### insert a SENT record to the vicidial_auto_calls table
|
||||||
$stmtA = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type,alt_dial,queue_priority,last_update_time) values('$DBIPaddress[$user_CIPct]','$DBIPcampaign[$user_CIPct]','SENT','$lead_id','$VqueryCID','$phone_code','$phone_number','$SQLdate','OUT','$alt_dial','$DBIPqueue_priority[$user_CIPct]','$SQLdate')";
|
$stmtB = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type,alt_dial,queue_priority,last_update_time) values('$DBIPaddress[$user_CIPct]','$DBIPcampaign[$user_CIPct]','SENT','$lead_id','$VqueryCID','$phone_code','$phone_number','$SQLdate','OUT','$alt_dial','$DBIPqueue_priority[$user_CIPct]','$SQLdate')";
|
||||||
$affected_rows = $dbhA->do($stmtA);
|
$affected_rowsB = $dbhA->do($stmtB);
|
||||||
|
|
||||||
### insert log record into vicidial_dial_log table
|
### insert log record into vicidial_dial_log table
|
||||||
$stmtA = "INSERT INTO vicidial_dial_log SET caller_code='$VqueryCID',lead_id='$lead_id',server_ip='$DBIPaddress[$user_CIPct]',call_date='$SQLdate',extension='$VDAD_dial_exten',channel='$local_DEF$Ndialstring$local_AMP$ext_context',timeout='$Local_dial_timeout',outbound_cid='$CIDstring',context='$ext_context';";
|
$stmtC = "INSERT INTO vicidial_dial_log SET caller_code='$VqueryCID',lead_id='$lead_id',server_ip='$DBIPaddress[$user_CIPct]',call_date='$SQLdate',extension='$VDAD_dial_exten',channel='$local_DEF$Ndialstring$local_AMP$ext_context',timeout='$Local_dial_timeout',outbound_cid='$CIDstring',context='$ext_context';";
|
||||||
$affected_rows = $dbhA->do($stmtA);
|
$affected_rowsC = $dbhA->do($stmtC);
|
||||||
|
|
||||||
|
$event_string = "| number call dialed|$DBIPcampaign[$user_CIPct]|$VqueryCID|$affected_rowsA|$stmtA|$gmt_offset_now|$alt_dial|$affected_rowsB|$affected_rowsC|";
|
||||||
|
&event_logger;
|
||||||
|
|
||||||
### sleep for a five hundredths of a second to not flood the server with new calls
|
### sleep for a five hundredths of a second to not flood the server with new calls
|
||||||
# usleep(1*50*1000);
|
# usleep(1*50*1000);
|
||||||
@@ -1959,11 +1963,11 @@ while($one_day_interval > 0)
|
|||||||
$dbhB->disconnect();
|
$dbhB->disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
##### BEGIN AUTO ALT PHONE DIAL SECTION #####
|
### check to see if campaign has alt_dial or call quotas enabled
|
||||||
### check to see if campaign has alt_dial enabled
|
|
||||||
$VD_auto_alt_dial = 'NONE';
|
$VD_auto_alt_dial = 'NONE';
|
||||||
$VD_auto_alt_dial_statuses='';
|
$VD_auto_alt_dial_statuses='';
|
||||||
$stmtA="SELECT auto_alt_dial,auto_alt_dial_statuses,use_internal_dnc,use_campaign_dnc,use_other_campaign_dnc FROM vicidial_campaigns where campaign_id='$CLcampaign_id';";
|
$VD_call_quota_lead_ranking='DISABLED';
|
||||||
|
$stmtA="SELECT auto_alt_dial,auto_alt_dial_statuses,use_internal_dnc,use_campaign_dnc,use_other_campaign_dnc,call_quota_lead_ranking FROM vicidial_campaigns where campaign_id='$CLcampaign_id';";
|
||||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
$sthArows=$sthA->rows;
|
$sthArows=$sthA->rows;
|
||||||
@@ -1975,8 +1979,327 @@ while($one_day_interval > 0)
|
|||||||
$VD_use_internal_dnc = $aryA[2];
|
$VD_use_internal_dnc = $aryA[2];
|
||||||
$VD_use_campaign_dnc = $aryA[3];
|
$VD_use_campaign_dnc = $aryA[3];
|
||||||
$VD_use_other_campaign_dnc = $aryA[4];
|
$VD_use_other_campaign_dnc = $aryA[4];
|
||||||
|
$VD_call_quota_lead_ranking = $aryA[5];
|
||||||
}
|
}
|
||||||
$sthA->finish();
|
$sthA->finish();
|
||||||
|
|
||||||
|
##### BEGIN Call Quota Lead Ranking logging #####
|
||||||
|
if ( ($SScall_quota_lead_ranking > 0) && ($VD_call_quota_lead_ranking !~ /^DISABLED$/i) )
|
||||||
|
{
|
||||||
|
# Gather settings container for Call Quota Lead Ranking
|
||||||
|
$CQcontainer_entry='';
|
||||||
|
$stmtA = "SELECT container_entry FROM vicidial_settings_containers where container_id='$VD_call_quota_lead_ranking';";
|
||||||
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
|
$sthArows=$sthA->rows;
|
||||||
|
if ($sthArows > 0)
|
||||||
|
{
|
||||||
|
@aryA = $sthA->fetchrow_array;
|
||||||
|
$CQcontainer_entry = $aryA[0];
|
||||||
|
$CQcontainer_entry =~ s/\\//gi;
|
||||||
|
}
|
||||||
|
$sthA->finish();
|
||||||
|
|
||||||
|
# Define variables for Call Quota settings
|
||||||
|
$session_one='';
|
||||||
|
$session_two='';
|
||||||
|
$session_three='';
|
||||||
|
$session_four='';
|
||||||
|
$session_five='';
|
||||||
|
$session_six='';
|
||||||
|
$settings_session_score=0;
|
||||||
|
$zero_rank_after_call=0;
|
||||||
|
|
||||||
|
if (length($CQcontainer_entry) > 5)
|
||||||
|
{
|
||||||
|
@container_lines = split(/\n/,$CQcontainer_entry);
|
||||||
|
$c=0;
|
||||||
|
foreach(@container_lines)
|
||||||
|
{
|
||||||
|
$container_lines[$c] =~ s/;.*|\r|\t| //gi;
|
||||||
|
if (length($container_lines[$c]) > 5)
|
||||||
|
{
|
||||||
|
# define core settings
|
||||||
|
if ($container_lines[$c] =~ /^zero_rank_after_call/i)
|
||||||
|
{
|
||||||
|
$container_lines[$c] =~ s/zero_rank_after_call=>//gi;
|
||||||
|
if ( ($container_lines[$c] >= 0) && ($container_lines[$c] <= 1) )
|
||||||
|
{
|
||||||
|
$zero_rank_after_call = $container_lines[$c];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# define sessions
|
||||||
|
if ($container_lines[$c] =~ /^session_one/i)
|
||||||
|
{
|
||||||
|
$session_one_valid=0; $session_one_start=''; $session_one_end='';
|
||||||
|
$session_one = $container_lines[$c];
|
||||||
|
$session_one =~ s/session_one=>//gi;
|
||||||
|
if ( (length($session_one) > 0) && (length($session_one) <= 9) && ($session_one =~ /,/) )
|
||||||
|
{
|
||||||
|
@session_oneARY = split(/,/,$session_one);
|
||||||
|
$session_one_start = $session_oneARY[0];
|
||||||
|
$session_one_end = $session_oneARY[1];
|
||||||
|
if ( (length($session_one_start) >= 4) && (length($session_one_end) >= 4) && ($session_one_start < $session_one_end) && ($session_one_end <= 2400) )
|
||||||
|
{
|
||||||
|
$settings_session_score++;
|
||||||
|
$session_one_valid++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($container_lines[$c] =~ /^session_two/i)
|
||||||
|
{
|
||||||
|
$session_two_valid=0; $session_two_start=''; $session_two_end='';
|
||||||
|
$session_two = $container_lines[$c];
|
||||||
|
$session_two =~ s/session_two=>//gi;
|
||||||
|
if ( (length($session_two) > 0) && (length($session_two) <= 9) && ($session_two =~ /,/) )
|
||||||
|
{
|
||||||
|
@session_twoARY = split(/,/,$session_two);
|
||||||
|
$session_two_start = $session_twoARY[0];
|
||||||
|
$session_two_end = $session_twoARY[1];
|
||||||
|
if ( (length($session_two_start) >= 4) && (length($session_two_end) >= 4) && ($session_one_valid > 0) && ($session_one_end <= $session_two_start) && ($session_two_start < $session_two_end) && ($session_two_end <= 2400) )
|
||||||
|
{
|
||||||
|
$settings_session_score++;
|
||||||
|
$session_two_valid++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($container_lines[$c] =~ /^session_three/i)
|
||||||
|
{
|
||||||
|
$session_three_valid=0; $session_three_start=''; $session_three_end='';
|
||||||
|
$session_three = $container_lines[$c];
|
||||||
|
$session_three =~ s/session_three=>//gi;
|
||||||
|
if ( (length($session_three) > 0) && (length($session_three) <= 9) && ($session_three =~ /,/) )
|
||||||
|
{
|
||||||
|
@session_threeARY = split(/,/,$session_three);
|
||||||
|
$session_three_start = $session_threeARY[0];
|
||||||
|
$session_three_end = $session_threeARY[1];
|
||||||
|
if ( (length($session_three_start) >= 4) && (length($session_three_end) >= 4) && ($session_two_valid > 0) && ($session_two_end <= $session_three_start) && ($session_three_start < $session_three_end) && ($session_three_end <= 2400) )
|
||||||
|
{
|
||||||
|
$settings_session_score++;
|
||||||
|
$session_three_valid++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($container_lines[$c] =~ /^session_four/i)
|
||||||
|
{
|
||||||
|
$session_four_valid=0; $session_four_start=''; $session_four_end='';
|
||||||
|
$session_four = $container_lines[$c];
|
||||||
|
$session_four =~ s/session_four=>//gi;
|
||||||
|
if ( (length($session_four) > 0) && (length($session_four) <= 9) && ($session_four =~ /,/) )
|
||||||
|
{
|
||||||
|
@session_fourARY = split(/,/,$session_four);
|
||||||
|
$session_four_start = $session_fourARY[0];
|
||||||
|
$session_four_end = $session_fourARY[1];
|
||||||
|
if ( (length($session_four_start) >= 4) && (length($session_four_end) >= 4) && ($session_three_valid > 0) && ($session_three_end <= $session_four_start) && ($session_four_start < $session_four_end) && ($session_four_end <= 2400) )
|
||||||
|
{
|
||||||
|
$settings_session_score++;
|
||||||
|
$session_four_valid++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($container_lines[$c] =~ /^session_five/i)
|
||||||
|
{
|
||||||
|
$session_five_valid=0; $session_five_start=''; $session_five_end='';
|
||||||
|
$session_five = $container_lines[$c];
|
||||||
|
$session_five =~ s/session_five=>//gi;
|
||||||
|
if ( (length($session_five) > 0) && (length($session_five) <= 9) && ($session_five =~ /,/) )
|
||||||
|
{
|
||||||
|
@session_fiveARY = split(/,/,$session_five);
|
||||||
|
$session_five_start = $session_fiveARY[0];
|
||||||
|
$session_five_end = $session_fiveARY[1];
|
||||||
|
if ( (length($session_five_start) >= 4) && (length($session_five_end) >= 4) && ($session_four_valid > 0) && ($session_four_end <= $session_five_start) && ($session_five_start < $session_five_end) && ($session_five_end <= 2400) )
|
||||||
|
{
|
||||||
|
$settings_session_score++;
|
||||||
|
$session_five_valid++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($container_lines[$c] =~ /^session_six/i)
|
||||||
|
{
|
||||||
|
$session_six_valid=0; $session_six_start=''; $session_six_end='';
|
||||||
|
$session_six = $container_lines[$c];
|
||||||
|
$session_six =~ s/session_six=>//gi;
|
||||||
|
if ( (length($session_six) > 0) && (length($session_six) <= 9) && ($session_six =~ /,/) )
|
||||||
|
{
|
||||||
|
@session_sixARY = split(/,/,$session_six);
|
||||||
|
$session_six_start = $session_sixARY[0];
|
||||||
|
$session_six_end = $session_sixARY[1];
|
||||||
|
if ( (length($session_six_start) >= 4) && (length($session_six_end) >= 4) && ($session_five_valid > 0) && ($session_five_end <= $session_six_start) && ($session_six_start < $session_six_end) && ($session_six_end <= 2400) )
|
||||||
|
{
|
||||||
|
$settings_session_score++;
|
||||||
|
$session_six_valid++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{if ($DBX > 0) {print " blank line: $c|$container_lines[$c]|\n";}}
|
||||||
|
$c++;
|
||||||
|
}
|
||||||
|
if ($settings_session_score >= 1)
|
||||||
|
{
|
||||||
|
$stmtA = "SELECT list_id,called_count,rank FROM vicidial_list where lead_id='$CLlead_id';";
|
||||||
|
$event_string = "|$stmtA|"; &event_logger;
|
||||||
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
|
$sthArows=$sthA->rows;
|
||||||
|
if ($sthArows > 0)
|
||||||
|
{
|
||||||
|
@aryA = $sthA->fetchrow_array;
|
||||||
|
$VLlist_id = $aryA[0];
|
||||||
|
$VLcalled_count = $aryA[1];
|
||||||
|
$VLrank = $aryA[2];
|
||||||
|
$tempVLrank = $VLrank;
|
||||||
|
if ( ($zero_rank_after_call > 0) && ($VLrank > 0) ) {$tempVLrank=0;}
|
||||||
|
}
|
||||||
|
$sthA->finish();
|
||||||
|
|
||||||
|
$secX = time();
|
||||||
|
$CQtarget = ($secX - 14400); # look back 4 hours
|
||||||
|
($CQsec,$CQmin,$CQhour,$CQmday,$CQmon,$CQyear,$CQwday,$CQyday,$CQisdst) = localtime($CQtarget);
|
||||||
|
$CQyear = ($CQyear + 1900);
|
||||||
|
$CQmon++;
|
||||||
|
if ($CQmon < 10) {$CQmon = "0$CQmon";}
|
||||||
|
if ($CQmday < 10) {$CQmday = "0$CQmday";}
|
||||||
|
if ($CQhour < 10) {$CQhour = "0$CQhour";}
|
||||||
|
if ($CQmin < 10) {$CQmin = "0$CQmin";}
|
||||||
|
if ($CQsec < 10) {$CQsec = "0$CQsec";}
|
||||||
|
$CQSQLdate = "$CQyear-$CQmon-$CQmday $CQhour:$CQmin:$CQsec";
|
||||||
|
|
||||||
|
$VDL_call_datetime='';
|
||||||
|
$stmtA = "SELECT call_date from vicidial_dial_log where lead_id='$CLlead_id' and call_date > \"$CQSQLdate\" and caller_code LIKE \"%$CLlead_id\" order by call_date desc limit 1;";
|
||||||
|
$event_string = "|$stmtA|"; &event_logger;
|
||||||
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
|
$sthArows=$sthA->rows;
|
||||||
|
if ($sthArows > 0)
|
||||||
|
{
|
||||||
|
@aryA = $sthA->fetchrow_array;
|
||||||
|
$VDLcall_datetime = $aryA[0];
|
||||||
|
@VDLcall_datetimeARY = split(/ /,$VDLcall_datetime);
|
||||||
|
@VDLcall_timeARY = split(/:/,$VDLcall_datetimeARY[1]);
|
||||||
|
$VDLcall_hourmin = "$VDLcall_timeARY[0]$VDLcall_timeARY[1]";
|
||||||
|
|
||||||
|
if ( ($session_one_start <= $VDLcall_hourmin) and ($session_one_end > $VDLcall_hourmin) )
|
||||||
|
{
|
||||||
|
$call_in_session=1;
|
||||||
|
$session_newSQL=",session_one_calls='1',session_one_today_calls='1'";
|
||||||
|
$session_updateSQL=",session_one_calls=(session_one_calls + 1),session_one_today_calls=(session_one_today_calls + 1)";
|
||||||
|
}
|
||||||
|
if ( ($session_two_start <= $VDLcall_hourmin) and ($session_two_end > $VDLcall_hourmin) )
|
||||||
|
{
|
||||||
|
$call_in_session=2;
|
||||||
|
$session_newSQL=",session_two_calls='1',session_two_today_calls='1'";
|
||||||
|
$session_updateSQL=",session_two_calls=(session_two_calls + 1),session_two_today_calls=(session_two_today_calls + 1)";
|
||||||
|
}
|
||||||
|
if ( ($session_three_start <= $VDLcall_hourmin) and ($session_three_end > $VDLcall_hourmin) )
|
||||||
|
{
|
||||||
|
$call_in_session=3;
|
||||||
|
$session_newSQL=",session_three_calls='1',session_three_today_calls='1'";
|
||||||
|
$session_updateSQL=",session_three_calls=(session_three_calls + 1),session_three_today_calls=(session_three_today_calls + 1)";
|
||||||
|
}
|
||||||
|
if ( ($session_four_start <= $VDLcall_hourmin) and ($session_four_end > $VDLcall_hourmin) )
|
||||||
|
{
|
||||||
|
$call_in_session=4;
|
||||||
|
$session_newSQL=",session_four_calls='1',session_four_today_calls='1'";
|
||||||
|
$session_updateSQL=",session_four_calls=(session_four_calls + 1),session_four_today_calls=(session_four_today_calls + 1)";
|
||||||
|
}
|
||||||
|
if ( ($session_five_start <= $VDLcall_hourmin) and ($session_five_end > $VDLcall_hourmin) )
|
||||||
|
{
|
||||||
|
$call_in_session=5;
|
||||||
|
$session_newSQL=",session_five_calls='1',session_five_today_calls='1'";
|
||||||
|
$session_updateSQL=",session_five_calls=(session_five_calls + 1),session_five_today_calls=(session_five_today_calls + 1)";
|
||||||
|
}
|
||||||
|
if ( ($session_six_start <= $VDLcall_hourmin) and ($session_six_end > $VDLcall_hourmin) )
|
||||||
|
{
|
||||||
|
$call_in_session=6;
|
||||||
|
$session_newSQL=",session_six_calls='1',session_six_today_calls='1'";
|
||||||
|
$session_updateSQL=",session_six_calls=(session_six_calls + 1),session_six_today_calls=(session_six_today_calls + 1)";
|
||||||
|
}
|
||||||
|
|
||||||
|
$event_string = "CQ-Debug 2: $VDLcall_datetime|$VDLcall_hourmin|$timeclock_end_of_day|$session_one_start|$session_one_end|$call_in_session|"; &event_logger;
|
||||||
|
|
||||||
|
if ($call_in_session > 0)
|
||||||
|
{
|
||||||
|
if (length($timeclock_end_of_day) < 1) {$timeclock_end_of_day='0000';}
|
||||||
|
$timeclock_end_of_day_hour = (substr($timeclock_end_of_day, 0, 2) + 0);
|
||||||
|
$timeclock_end_of_day_min = (substr($timeclock_end_of_day, 2, 2) + 0);
|
||||||
|
|
||||||
|
$today_start_epoch = timelocal('0',$timeclock_end_of_day_min,$timeclock_end_of_day_hour,$mday,($mon-1),$year);
|
||||||
|
if ($timeclock_end_of_day > $VDLcall_hourmin)
|
||||||
|
{$today_start_epoch = ($today_start_epoch - 86400);}
|
||||||
|
$day_two_start_epoch = ($today_start_epoch - (86400 * 1));
|
||||||
|
$day_three_start_epoch = ($today_start_epoch - (86400 * 2));
|
||||||
|
$day_four_start_epoch = ($today_start_epoch - (86400 * 3));
|
||||||
|
$day_five_start_epoch = ($today_start_epoch - (86400 * 4));
|
||||||
|
$day_six_start_epoch = ($today_start_epoch - (86400 * 5));
|
||||||
|
$day_seven_start_epoch = ($today_start_epoch - (86400 * 6));
|
||||||
|
|
||||||
|
# Gather the details on existing vicidial_lead_call_quota_counts for this lead, if there is one
|
||||||
|
$stmtA = "SELECT first_call_date,UNIX_TIMESTAMP(first_call_date),last_call_date from vicidial_lead_call_quota_counts where lead_id='$CLlead_id' and list_id='$VLlist_id';";
|
||||||
|
$event_string = "|$stmtA|"; &event_logger;
|
||||||
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
|
$VLCQCinfo_ct=$sthA->rows;
|
||||||
|
if ($VLCQCinfo_ct > 0)
|
||||||
|
{
|
||||||
|
@aryA = $sthA->fetchrow_array;
|
||||||
|
$VLCQCfirst_call_datetime = $aryA[0];
|
||||||
|
$VLCQCfirst_call_epoch = $aryA[1];
|
||||||
|
$VLCQClast_call_date = $aryA[2];
|
||||||
|
|
||||||
|
if ($VDLcall_datetime ne $VLCQClast_call_date)
|
||||||
|
{
|
||||||
|
if ($VLCQCfirst_call_epoch >= $today_start_epoch)
|
||||||
|
{$day_updateSQL=',day_one_calls=(day_one_calls+1)';}
|
||||||
|
if ( ($VLCQCfirst_call_epoch >= $day_two_start_epoch) and ($VLCQCfirst_call_epoch < $today_start_epoch) )
|
||||||
|
{$day_updateSQL=',day_two_calls=(day_two_calls+1)';}
|
||||||
|
if ( ($VLCQCfirst_call_epoch >= $day_three_start_epoch) and ($VLCQCfirst_call_epoch < $day_two_start_epoch) )
|
||||||
|
{$day_updateSQL=',day_three_calls=(day_three_calls+1)';}
|
||||||
|
if ( ($VLCQCfirst_call_epoch >= $day_four_start_epoch) and ($VLCQCfirst_call_epoch < $day_three_start_epoch) )
|
||||||
|
{$day_updateSQL=',day_four_calls=(day_four_calls+1)';}
|
||||||
|
if ( ($VLCQCfirst_call_epoch >= $day_five_start_epoch) and ($VLCQCfirst_call_epoch < $day_four_start_epoch) )
|
||||||
|
{$day_updateSQL=',day_five_calls=(day_five_calls+1)';}
|
||||||
|
if ( ($VLCQCfirst_call_epoch >= $day_six_start_epoch) and ($VLCQCfirst_call_epoch < $day_five_start_epoch) )
|
||||||
|
{$day_updateSQL=',day_six_calls=(day_six_calls+1)';}
|
||||||
|
if ( ($VLCQCfirst_call_epoch >= $day_seven_start_epoch) and ($VLCQCfirst_call_epoch < $day_six_start_epoch) )
|
||||||
|
{$day_updateSQL=',day_seven_calls=(day_seven_calls+1)';}
|
||||||
|
# Update in the vicidial_lead_call_quota_counts table for this lead
|
||||||
|
$stmtA="UPDATE vicidial_lead_call_quota_counts SET last_call_date='$VDLcall_datetime',status='$CLnew_status',called_count='$VLcalled_count',rank='$tempVLrank',modify_date=NOW() $session_updateSQL $day_updateSQL where lead_id='$CLlead_id' and list_id='$VLlist_id' and modify_date < NOW();";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# Update in the vicidial_lead_call_quota_counts table for this lead
|
||||||
|
$stmtA="UPDATE vicidial_lead_call_quota_counts SET status='$CLnew_status',called_count='$VLcalled_count',rank='$tempVLrank',modify_date=NOW() where lead_id='$CLlead_id' and list_id='$VLlist_id';";
|
||||||
|
}
|
||||||
|
$VLCQCaffected_rows_update = $dbhA->do($stmtA);
|
||||||
|
$event_string = "-- VLCQC record updated: |$VLCQCaffected_rows_update| |$stmtA|"; &event_logger;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# Insert new record into vicidial_lead_call_quota_counts table for this lead
|
||||||
|
$stmtA="INSERT INTO vicidial_lead_call_quota_counts SET lead_id='$CLlead_id',list_id='$VLlist_id',first_call_date='$VDLcall_datetime',last_call_date='$VDLcall_datetime',status='$CLnew_status',called_count='$VLcalled_count',day_one_calls='1',rank='$tempVLrank',modify_date=NOW() $session_newSQL;";
|
||||||
|
$VLCQCaffected_rows_update = $dbhA->do($stmtA);
|
||||||
|
$event_string = "-- VLCQC record inserted: |$VLCQCaffected_rows_update| |$stmtA|"; &event_logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ($zero_rank_after_call > 0) && ($VLrank > 0) )
|
||||||
|
{
|
||||||
|
# Update this lead to rank=0
|
||||||
|
$stmtA="UPDATE vicidial_list SET rank='0' where lead_id='$CLlead_id';";
|
||||||
|
$VLCQCaffected_rows_zero_rank = $dbhA->do($stmtA);
|
||||||
|
$event_string = "-- VLCQC lead rank zero: |$VLCQCaffected_rows_zero_rank| |$stmtA|"; &event_logger;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$sthA->finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
##### END Call Quota Lead Ranking logging #####
|
||||||
|
|
||||||
|
|
||||||
|
##### BEGIN AUTO ALT PHONE DIAL SECTION #####
|
||||||
$event_string = "|$stmtA|$VD_auto_alt_dial|$VD_auto_alt_dial_statuses|$CLnew_status|$CLlead_id|$CLalt_dial"; &event_logger;
|
$event_string = "|$stmtA|$VD_auto_alt_dial|$VD_auto_alt_dial_statuses|$CLnew_status|$CLlead_id|$CLalt_dial"; &event_logger;
|
||||||
if ( ($VD_auto_alt_dial_statuses =~ / $CLnew_status /) && ($CLlead_id > 0) )
|
if ( ($VD_auto_alt_dial_statuses =~ / $CLnew_status /) && ($CLlead_id > 0) )
|
||||||
{
|
{
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
+394
-53
@@ -11,7 +11,7 @@
|
|||||||
# agents that should appear to be logged in so that the calls can be transferred
|
# agents that should appear to be logged in so that the calls can be transferred
|
||||||
# out to them properly.
|
# out to them properly.
|
||||||
#
|
#
|
||||||
# Copyright (C) 2017 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
# Copyright (C) 2019 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||||
#
|
#
|
||||||
# CHANGELOG:
|
# CHANGELOG:
|
||||||
# 50215-0954 - First version of script
|
# 50215-0954 - First version of script
|
||||||
@@ -52,6 +52,7 @@
|
|||||||
# 141113-1559 - Added concurrency check
|
# 141113-1559 - Added concurrency check
|
||||||
# 161102-1032 - Fixed QM partition problem
|
# 161102-1032 - Fixed QM partition problem
|
||||||
# 170527-2348 - Fix for rare inbound logging issue #1017
|
# 170527-2348 - Fix for rare inbound logging issue #1017
|
||||||
|
# 190716-1628 - Added code for Call Quotas
|
||||||
#
|
#
|
||||||
|
|
||||||
### begin parsing run-time options ###
|
### begin parsing run-time options ###
|
||||||
@@ -169,11 +170,28 @@ if (!$VDRLOGfile) {$VDRLOGfile = "$PATHlogs/remoteagent.$year-$mon-$mday";}
|
|||||||
if (!$VARDB_port) {$VARDB_port='3306';}
|
if (!$VARDB_port) {$VARDB_port='3306';}
|
||||||
|
|
||||||
use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second
|
use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second
|
||||||
|
use Time::Local;
|
||||||
use DBI;
|
use DBI;
|
||||||
|
|
||||||
$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass")
|
$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass")
|
||||||
or die "Couldn't connect to database: " . DBI->errstr;
|
or die "Couldn't connect to database: " . DBI->errstr;
|
||||||
|
|
||||||
|
|
||||||
|
#############################################
|
||||||
|
##### Gather system_settings #####
|
||||||
|
$stmtA = "SELECT sip_event_logging,call_quota_lead_ranking FROM system_settings;";
|
||||||
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
|
$sthArows=$sthA->rows;
|
||||||
|
if ($sthArows > 0)
|
||||||
|
{
|
||||||
|
@aryA = $sthA->fetchrow_array;
|
||||||
|
$SSsip_event_logging = $aryA[0];
|
||||||
|
$SScall_quota_lead_ranking = $aryA[1];
|
||||||
|
}
|
||||||
|
$sthA->finish();
|
||||||
|
###########################################
|
||||||
|
|
||||||
### Grab Server values from the database
|
### Grab Server values from the database
|
||||||
$stmtA = "SELECT vd_server_logs,local_gmt,ext_context FROM servers where server_ip = '$VARserver_ip';";
|
$stmtA = "SELECT vd_server_logs,local_gmt,ext_context FROM servers where server_ip = '$VARserver_ip';";
|
||||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
@@ -367,63 +385,63 @@ while($one_day_interval > 0)
|
|||||||
$stmtE = "INSERT IGNORE INTO vicidial_inbound_group_agents set calls_today=1,user='$QHuser[$w]',group_id='$QHcampaign_id[$w]';";
|
$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);
|
$Eaffected_rows = $dbhA->do($stmtE);
|
||||||
|
|
||||||
##### BEGIN check for user max inbound calls #####
|
##### BEGIN check for user max inbound calls #####
|
||||||
$max_inbound_calls=0;
|
$max_inbound_calls=0;
|
||||||
$stmtJ = "SELECT max_inbound_calls FROM vicidial_users where user='$QHuser[$w]';";
|
$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 = $dbhA->prepare($stmtJ) or die "preparing: ",$dbhA->errstr;
|
||||||
$sthA->execute or die "executing: $stmtJ ", $dbhA->errstr;
|
$sthA->execute or die "executing: $stmtJ ", $dbhA->errstr;
|
||||||
$sthArowsVIGA=$sthA->rows;
|
$sthArowsMIC=$sthA->rows;
|
||||||
if ($sthArowsVIGA > 0)
|
if ($sthArowsMIC > 0)
|
||||||
{
|
{
|
||||||
@aryA = $sthA->fetchrow_array;
|
@aryA = $sthA->fetchrow_array;
|
||||||
$max_inbound_count = $aryA[0];
|
$VU_max_inbound_calls = $aryA[0];
|
||||||
}
|
}
|
||||||
if ($max_inbound_count >= $max_inbound_calls)
|
$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)
|
||||||
{
|
{
|
||||||
$stmtJ = "UPDATE vicidial_live_agents set closer_campaigns='' where user='$QHuser[$w]';";
|
@aryA = $sthA->fetchrow_array;
|
||||||
$affected_rows = $dbhA->do($stmtJ);
|
$CP_max_inbound_calls = $aryA[0];
|
||||||
|
|
||||||
$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 #####
|
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);
|
||||||
|
|
||||||
|
$event_string = "-- MAX INBOUND AGENT CALLS TRIGGER: |$max_inbound_count|$max_inbound_calls|$QHuser[$w]|$QHcall_id[$w]|"; &event_logger;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
##### END check for user max inbound calls #####
|
||||||
|
|
||||||
|
|
||||||
$stmtG = "SELECT start_call_url FROM vicidial_inbound_groups where group_id='$QHcampaign_id[$w]';";
|
$stmtG = "SELECT start_call_url,'DISABLED' FROM vicidial_inbound_groups where group_id='$QHcampaign_id[$w]';";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -433,7 +451,7 @@ while($one_day_interval > 0)
|
|||||||
$Daffected_rows=0;
|
$Daffected_rows=0;
|
||||||
$Eaffected_rows=0;
|
$Eaffected_rows=0;
|
||||||
|
|
||||||
$stmtG = "SELECT start_call_url FROM vicidial_campaigns where campaign_id='$QHcampaign_id[$w]';";
|
$stmtG = "SELECT start_call_url,call_quota_lead_ranking FROM vicidial_campaigns where campaign_id='$QHcampaign_id[$w]';";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sthA = $dbhA->prepare($stmtG) or die "preparing: ",$dbhA->errstr;
|
$sthA = $dbhA->prepare($stmtG) or die "preparing: ",$dbhA->errstr;
|
||||||
@@ -442,10 +460,17 @@ while($one_day_interval > 0)
|
|||||||
if ($start_url_ct > 0)
|
if ($start_url_ct > 0)
|
||||||
{
|
{
|
||||||
@aryA = $sthA->fetchrow_array;
|
@aryA = $sthA->fetchrow_array;
|
||||||
$start_call_url = $aryA[0];
|
$start_call_url = $aryA[0];
|
||||||
|
$VD_call_quota_lead_ranking = $aryA[1];
|
||||||
}
|
}
|
||||||
$sthA->finish();
|
$sthA->finish();
|
||||||
|
|
||||||
|
if ( ($SScall_quota_lead_ranking > 0) && ($VD_call_quota_lead_ranking !~ /^DISABLED$/i) )
|
||||||
|
{
|
||||||
|
$CIDlead_id = $QHlead_id[$w];
|
||||||
|
$temp_status = 'XFER';
|
||||||
|
&call_quota_logging;
|
||||||
|
}
|
||||||
|
|
||||||
##### BEGIN remote agent concurrent call calculation and updating
|
##### BEGIN remote agent concurrent call calculation and updating
|
||||||
$concurrent_calls=0;
|
$concurrent_calls=0;
|
||||||
@@ -482,14 +507,14 @@ while($one_day_interval > 0)
|
|||||||
|
|
||||||
$stmtA = "UPDATE vicidial_daily_ra_stats SET update_time=NOW(),total_calls=(total_calls + 1)$update_SQL where user='$QHra_user[$w]' and stats_flag='OPEN';";
|
$stmtA = "UPDATE vicidial_daily_ra_stats SET update_time=NOW(),total_calls=(total_calls + 1)$update_SQL where user='$QHra_user[$w]' and stats_flag='OPEN';";
|
||||||
$affected_rows = $dbhA->do($stmtA);
|
$affected_rows = $dbhA->do($stmtA);
|
||||||
if ($AGILOG) {$agi_string = "DAILY STATS UPDATE $channel_group|$affected_rows|$stmtA|\n"; &agi_output;}
|
$event_string = "DAILY STATS UPDATE $channel_group|$affected_rows|$stmtA|"; &event_logger;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sthA->finish();
|
$sthA->finish();
|
||||||
$stmtA = "INSERT INTO vicidial_daily_ra_stats SET stats_date='$YMD',update_time=NOW(),max_calls='$incalls_count',user='$QHra_user[$w]',stats_flag='OPEN',total_calls=1;";
|
$stmtA = "INSERT INTO vicidial_daily_ra_stats SET stats_date='$YMD',update_time=NOW(),max_calls='$incalls_count',user='$QHra_user[$w]',stats_flag='OPEN',total_calls=1;";
|
||||||
$affected_rows = $dbhA->do($stmtA);
|
$affected_rows = $dbhA->do($stmtA);
|
||||||
if ($AGILOG) {$agi_string = "DAILY STATS INSERT $channel_group|$affected_rows|$stmtA|"; &agi_output;}
|
$event_string = "DAILY STATS INSERT $channel_group|$affected_rows|$stmtA|"; &event_logger;
|
||||||
}
|
}
|
||||||
##### END remote agent concurrent call calculation and updating
|
##### END remote agent concurrent call calculation and updating
|
||||||
|
|
||||||
@@ -1288,3 +1313,319 @@ sub event_logger
|
|||||||
}
|
}
|
||||||
$event_string='';
|
$event_string='';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
##### BEGIN Call Quota Lead Ranking logging #####
|
||||||
|
sub call_quota_logging
|
||||||
|
{
|
||||||
|
# Gather settings container for Call Quota Lead Ranking
|
||||||
|
$CQcontainer_entry='';
|
||||||
|
$stmtA = "SELECT container_entry FROM vicidial_settings_containers where container_id='$VD_call_quota_lead_ranking';";
|
||||||
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
|
$sthArows=$sthA->rows;
|
||||||
|
if ($sthArows > 0)
|
||||||
|
{
|
||||||
|
@aryA = $sthA->fetchrow_array;
|
||||||
|
$CQcontainer_entry = $aryA[0];
|
||||||
|
$CQcontainer_entry =~ s/\\//gi;
|
||||||
|
}
|
||||||
|
$sthA->finish();
|
||||||
|
|
||||||
|
# Define variables for Call Quota settings
|
||||||
|
$session_one='';
|
||||||
|
$session_two='';
|
||||||
|
$session_three='';
|
||||||
|
$session_four='';
|
||||||
|
$session_five='';
|
||||||
|
$session_six='';
|
||||||
|
$settings_session_score=0;
|
||||||
|
$zero_rank_after_call=0;
|
||||||
|
|
||||||
|
if (length($CQcontainer_entry) > 5)
|
||||||
|
{
|
||||||
|
@container_lines = split(/\n/,$CQcontainer_entry);
|
||||||
|
$c=0;
|
||||||
|
foreach(@container_lines)
|
||||||
|
{
|
||||||
|
$container_lines[$c] =~ s/;.*|\r|\t| //gi;
|
||||||
|
if (length($container_lines[$c]) > 5)
|
||||||
|
{
|
||||||
|
# define core settings
|
||||||
|
if ($container_lines[$c] =~ /^zero_rank_after_call/i)
|
||||||
|
{
|
||||||
|
$container_lines[$c] =~ s/zero_rank_after_call=>//gi;
|
||||||
|
if ( ($container_lines[$c] >= 0) && ($container_lines[$c] <= 1) )
|
||||||
|
{
|
||||||
|
$zero_rank_after_call = $container_lines[$c];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# define sessions
|
||||||
|
if ($container_lines[$c] =~ /^session_one/i)
|
||||||
|
{
|
||||||
|
$session_one_valid=0; $session_one_start=''; $session_one_end='';
|
||||||
|
$session_one = $container_lines[$c];
|
||||||
|
$session_one =~ s/session_one=>//gi;
|
||||||
|
if ( (length($session_one) > 0) && (length($session_one) <= 9) && ($session_one =~ /,/) )
|
||||||
|
{
|
||||||
|
@session_oneARY = split(/,/,$session_one);
|
||||||
|
$session_one_start = $session_oneARY[0];
|
||||||
|
$session_one_end = $session_oneARY[1];
|
||||||
|
if ( (length($session_one_start) >= 4) && (length($session_one_end) >= 4) && ($session_one_start < $session_one_end) && ($session_one_end <= 2400) )
|
||||||
|
{
|
||||||
|
$settings_session_score++;
|
||||||
|
$session_one_valid++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($container_lines[$c] =~ /^session_two/i)
|
||||||
|
{
|
||||||
|
$session_two_valid=0; $session_two_start=''; $session_two_end='';
|
||||||
|
$session_two = $container_lines[$c];
|
||||||
|
$session_two =~ s/session_two=>//gi;
|
||||||
|
if ( (length($session_two) > 0) && (length($session_two) <= 9) && ($session_two =~ /,/) )
|
||||||
|
{
|
||||||
|
@session_twoARY = split(/,/,$session_two);
|
||||||
|
$session_two_start = $session_twoARY[0];
|
||||||
|
$session_two_end = $session_twoARY[1];
|
||||||
|
if ( (length($session_two_start) >= 4) && (length($session_two_end) >= 4) && ($session_one_valid > 0) && ($session_one_end <= $session_two_start) && ($session_two_start < $session_two_end) && ($session_two_end <= 2400) )
|
||||||
|
{
|
||||||
|
$settings_session_score++;
|
||||||
|
$session_two_valid++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($container_lines[$c] =~ /^session_three/i)
|
||||||
|
{
|
||||||
|
$session_three_valid=0; $session_three_start=''; $session_three_end='';
|
||||||
|
$session_three = $container_lines[$c];
|
||||||
|
$session_three =~ s/session_three=>//gi;
|
||||||
|
if ( (length($session_three) > 0) && (length($session_three) <= 9) && ($session_three =~ /,/) )
|
||||||
|
{
|
||||||
|
@session_threeARY = split(/,/,$session_three);
|
||||||
|
$session_three_start = $session_threeARY[0];
|
||||||
|
$session_three_end = $session_threeARY[1];
|
||||||
|
if ( (length($session_three_start) >= 4) && (length($session_three_end) >= 4) && ($session_two_valid > 0) && ($session_two_end <= $session_three_start) && ($session_three_start < $session_three_end) && ($session_three_end <= 2400) )
|
||||||
|
{
|
||||||
|
$settings_session_score++;
|
||||||
|
$session_three_valid++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($container_lines[$c] =~ /^session_four/i)
|
||||||
|
{
|
||||||
|
$session_four_valid=0; $session_four_start=''; $session_four_end='';
|
||||||
|
$session_four = $container_lines[$c];
|
||||||
|
$session_four =~ s/session_four=>//gi;
|
||||||
|
if ( (length($session_four) > 0) && (length($session_four) <= 9) && ($session_four =~ /,/) )
|
||||||
|
{
|
||||||
|
@session_fourARY = split(/,/,$session_four);
|
||||||
|
$session_four_start = $session_fourARY[0];
|
||||||
|
$session_four_end = $session_fourARY[1];
|
||||||
|
if ( (length($session_four_start) >= 4) && (length($session_four_end) >= 4) && ($session_three_valid > 0) && ($session_three_end <= $session_four_start) && ($session_four_start < $session_four_end) && ($session_four_end <= 2400) )
|
||||||
|
{
|
||||||
|
$settings_session_score++;
|
||||||
|
$session_four_valid++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($container_lines[$c] =~ /^session_five/i)
|
||||||
|
{
|
||||||
|
$session_five_valid=0; $session_five_start=''; $session_five_end='';
|
||||||
|
$session_five = $container_lines[$c];
|
||||||
|
$session_five =~ s/session_five=>//gi;
|
||||||
|
if ( (length($session_five) > 0) && (length($session_five) <= 9) && ($session_five =~ /,/) )
|
||||||
|
{
|
||||||
|
@session_fiveARY = split(/,/,$session_five);
|
||||||
|
$session_five_start = $session_fiveARY[0];
|
||||||
|
$session_five_end = $session_fiveARY[1];
|
||||||
|
if ( (length($session_five_start) >= 4) && (length($session_five_end) >= 4) && ($session_four_valid > 0) && ($session_four_end <= $session_five_start) && ($session_five_start < $session_five_end) && ($session_five_end <= 2400) )
|
||||||
|
{
|
||||||
|
$settings_session_score++;
|
||||||
|
$session_five_valid++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($container_lines[$c] =~ /^session_six/i)
|
||||||
|
{
|
||||||
|
$session_six_valid=0; $session_six_start=''; $session_six_end='';
|
||||||
|
$session_six = $container_lines[$c];
|
||||||
|
$session_six =~ s/session_six=>//gi;
|
||||||
|
if ( (length($session_six) > 0) && (length($session_six) <= 9) && ($session_six =~ /,/) )
|
||||||
|
{
|
||||||
|
@session_sixARY = split(/,/,$session_six);
|
||||||
|
$session_six_start = $session_sixARY[0];
|
||||||
|
$session_six_end = $session_sixARY[1];
|
||||||
|
if ( (length($session_six_start) >= 4) && (length($session_six_end) >= 4) && ($session_five_valid > 0) && ($session_five_end <= $session_six_start) && ($session_six_start < $session_six_end) && ($session_six_end <= 2400) )
|
||||||
|
{
|
||||||
|
$settings_session_score++;
|
||||||
|
$session_six_valid++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{if ($DBX > 0) {print " blank line: $c|$container_lines[$c]|\n";}}
|
||||||
|
$c++;
|
||||||
|
}
|
||||||
|
if ($settings_session_score >= 1)
|
||||||
|
{
|
||||||
|
$stmtA = "SELECT list_id,called_count,rank FROM vicidial_list where lead_id='$CIDlead_id';";
|
||||||
|
$event_string = "|$stmtA|"; &event_logger;
|
||||||
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
|
$sthArows=$sthA->rows;
|
||||||
|
if ($sthArows > 0)
|
||||||
|
{
|
||||||
|
@aryA = $sthA->fetchrow_array;
|
||||||
|
$VLlist_id = $aryA[0];
|
||||||
|
$VLcalled_count = $aryA[1];
|
||||||
|
$VLrank = $aryA[2];
|
||||||
|
$tempVLrank = $VLrank;
|
||||||
|
if ( ($zero_rank_after_call > 0) && ($VLrank > 0) ) {$tempVLrank=0;}
|
||||||
|
}
|
||||||
|
$sthA->finish();
|
||||||
|
|
||||||
|
$secX = time();
|
||||||
|
$CQtarget = ($secX - 14400); # look back 4 hours
|
||||||
|
($CQsec,$CQmin,$CQhour,$CQmday,$CQmon,$CQyear,$CQwday,$CQyday,$CQisdst) = localtime($CQtarget);
|
||||||
|
$CQyear = ($CQyear + 1900);
|
||||||
|
$CQmon++;
|
||||||
|
if ($CQmon < 10) {$CQmon = "0$CQmon";}
|
||||||
|
if ($CQmday < 10) {$CQmday = "0$CQmday";}
|
||||||
|
if ($CQhour < 10) {$CQhour = "0$CQhour";}
|
||||||
|
if ($CQmin < 10) {$CQmin = "0$CQmin";}
|
||||||
|
if ($CQsec < 10) {$CQsec = "0$CQsec";}
|
||||||
|
$CQSQLdate = "$CQyear-$CQmon-$CQmday $CQhour:$CQmin:$CQsec";
|
||||||
|
|
||||||
|
$VDL_call_datetime='';
|
||||||
|
$stmtA = "SELECT call_date from vicidial_dial_log where lead_id='$CIDlead_id' and call_date > \"$CQSQLdate\" and caller_code LIKE \"%$CIDlead_id\" order by call_date desc limit 1;";
|
||||||
|
$event_string = "|$stmtA|"; &event_logger;
|
||||||
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
|
$sthArows=$sthA->rows;
|
||||||
|
if ($sthArows > 0)
|
||||||
|
{
|
||||||
|
@aryA = $sthA->fetchrow_array;
|
||||||
|
$VDLcall_datetime = $aryA[0];
|
||||||
|
@VDLcall_datetimeARY = split(/ /,$VDLcall_datetime);
|
||||||
|
@VDLcall_timeARY = split(/:/,$VDLcall_datetimeARY[1]);
|
||||||
|
$VDLcall_hourmin = "$VDLcall_timeARY[0]$VDLcall_timeARY[1]";
|
||||||
|
|
||||||
|
if ( ($session_one_start <= $VDLcall_hourmin) and ($session_one_end > $VDLcall_hourmin) )
|
||||||
|
{
|
||||||
|
$call_in_session=1;
|
||||||
|
$session_newSQL=",session_one_calls='1',session_one_today_calls='1'";
|
||||||
|
$session_updateSQL=",session_one_calls=(session_one_calls + 1),session_one_today_calls=(session_one_today_calls + 1)";
|
||||||
|
}
|
||||||
|
if ( ($session_two_start <= $VDLcall_hourmin) and ($session_two_end > $VDLcall_hourmin) )
|
||||||
|
{
|
||||||
|
$call_in_session=2;
|
||||||
|
$session_newSQL=",session_two_calls='1',session_two_today_calls='1'";
|
||||||
|
$session_updateSQL=",session_two_calls=(session_two_calls + 1),session_two_today_calls=(session_two_today_calls + 1)";
|
||||||
|
}
|
||||||
|
if ( ($session_three_start <= $VDLcall_hourmin) and ($session_three_end > $VDLcall_hourmin) )
|
||||||
|
{
|
||||||
|
$call_in_session=3;
|
||||||
|
$session_newSQL=",session_three_calls='1',session_three_today_calls='1'";
|
||||||
|
$session_updateSQL=",session_three_calls=(session_three_calls + 1),session_three_today_calls=(session_three_today_calls + 1)";
|
||||||
|
}
|
||||||
|
if ( ($session_four_start <= $VDLcall_hourmin) and ($session_four_end > $VDLcall_hourmin) )
|
||||||
|
{
|
||||||
|
$call_in_session=4;
|
||||||
|
$session_newSQL=",session_four_calls='1',session_four_today_calls='1'";
|
||||||
|
$session_updateSQL=",session_four_calls=(session_four_calls + 1),session_four_today_calls=(session_four_today_calls + 1)";
|
||||||
|
}
|
||||||
|
if ( ($session_five_start <= $VDLcall_hourmin) and ($session_five_end > $VDLcall_hourmin) )
|
||||||
|
{
|
||||||
|
$call_in_session=5;
|
||||||
|
$session_newSQL=",session_five_calls='1',session_five_today_calls='1'";
|
||||||
|
$session_updateSQL=",session_five_calls=(session_five_calls + 1),session_five_today_calls=(session_five_today_calls + 1)";
|
||||||
|
}
|
||||||
|
if ( ($session_six_start <= $VDLcall_hourmin) and ($session_six_end > $VDLcall_hourmin) )
|
||||||
|
{
|
||||||
|
$call_in_session=6;
|
||||||
|
$session_newSQL=",session_six_calls='1',session_six_today_calls='1'";
|
||||||
|
$session_updateSQL=",session_six_calls=(session_six_calls + 1),session_six_today_calls=(session_six_today_calls + 1)";
|
||||||
|
}
|
||||||
|
|
||||||
|
$event_string = "CQ-Debug 2: $VDLcall_datetime|$VDLcall_hourmin|$timeclock_end_of_day|$session_one_start|$session_one_end|$call_in_session|"; &event_logger;
|
||||||
|
|
||||||
|
if ($call_in_session > 0)
|
||||||
|
{
|
||||||
|
if (length($timeclock_end_of_day) < 1) {$timeclock_end_of_day='0000';}
|
||||||
|
$timeclock_end_of_day_hour = (substr($timeclock_end_of_day, 0, 2) + 0);
|
||||||
|
$timeclock_end_of_day_min = (substr($timeclock_end_of_day, 2, 2) + 0);
|
||||||
|
|
||||||
|
$today_start_epoch = timelocal('0',$timeclock_end_of_day_min,$timeclock_end_of_day_hour,$mday,($mon-1),$year);
|
||||||
|
if ($timeclock_end_of_day > $VDLcall_hourmin)
|
||||||
|
{$today_start_epoch = ($today_start_epoch - 86400);}
|
||||||
|
$day_two_start_epoch = ($today_start_epoch - (86400 * 1));
|
||||||
|
$day_three_start_epoch = ($today_start_epoch - (86400 * 2));
|
||||||
|
$day_four_start_epoch = ($today_start_epoch - (86400 * 3));
|
||||||
|
$day_five_start_epoch = ($today_start_epoch - (86400 * 4));
|
||||||
|
$day_six_start_epoch = ($today_start_epoch - (86400 * 5));
|
||||||
|
$day_seven_start_epoch = ($today_start_epoch - (86400 * 6));
|
||||||
|
|
||||||
|
# Gather the details on existing vicidial_lead_call_quota_counts for this lead, if there is one
|
||||||
|
$stmtA = "SELECT first_call_date,UNIX_TIMESTAMP(first_call_date),last_call_date from vicidial_lead_call_quota_counts where lead_id='$CIDlead_id' and list_id='$VLlist_id';";
|
||||||
|
$event_string = "|$stmtA|"; &event_logger;
|
||||||
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
|
$VLCQCinfo_ct=$sthA->rows;
|
||||||
|
if ($VLCQCinfo_ct > 0)
|
||||||
|
{
|
||||||
|
@aryA = $sthA->fetchrow_array;
|
||||||
|
$VLCQCfirst_call_datetime = $aryA[0];
|
||||||
|
$VLCQCfirst_call_epoch = $aryA[1];
|
||||||
|
$VLCQClast_call_date = $aryA[2];
|
||||||
|
|
||||||
|
if ($VDLcall_datetime ne $VLCQClast_call_date)
|
||||||
|
{
|
||||||
|
if ($VLCQCfirst_call_epoch >= $today_start_epoch)
|
||||||
|
{$day_updateSQL=',day_one_calls=(day_one_calls+1)';}
|
||||||
|
if ( ($VLCQCfirst_call_epoch >= $day_two_start_epoch) and ($VLCQCfirst_call_epoch < $today_start_epoch) )
|
||||||
|
{$day_updateSQL=',day_two_calls=(day_two_calls+1)';}
|
||||||
|
if ( ($VLCQCfirst_call_epoch >= $day_three_start_epoch) and ($VLCQCfirst_call_epoch < $day_two_start_epoch) )
|
||||||
|
{$day_updateSQL=',day_three_calls=(day_three_calls+1)';}
|
||||||
|
if ( ($VLCQCfirst_call_epoch >= $day_four_start_epoch) and ($VLCQCfirst_call_epoch < $day_three_start_epoch) )
|
||||||
|
{$day_updateSQL=',day_four_calls=(day_four_calls+1)';}
|
||||||
|
if ( ($VLCQCfirst_call_epoch >= $day_five_start_epoch) and ($VLCQCfirst_call_epoch < $day_four_start_epoch) )
|
||||||
|
{$day_updateSQL=',day_five_calls=(day_five_calls+1)';}
|
||||||
|
if ( ($VLCQCfirst_call_epoch >= $day_six_start_epoch) and ($VLCQCfirst_call_epoch < $day_five_start_epoch) )
|
||||||
|
{$day_updateSQL=',day_six_calls=(day_six_calls+1)';}
|
||||||
|
if ( ($VLCQCfirst_call_epoch >= $day_seven_start_epoch) and ($VLCQCfirst_call_epoch < $day_six_start_epoch) )
|
||||||
|
{$day_updateSQL=',day_seven_calls=(day_seven_calls+1)';}
|
||||||
|
# Update in the vicidial_lead_call_quota_counts table for this lead
|
||||||
|
$stmtA="UPDATE vicidial_lead_call_quota_counts SET last_call_date='$VDLcall_datetime',status='$temp_status',called_count='$VLcalled_count',rank='$tempVLrank',modify_date=NOW() $session_updateSQL $day_updateSQL where lead_id='$CIDlead_id' and list_id='$VLlist_id';";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# Update in the vicidial_lead_call_quota_counts table for this lead
|
||||||
|
$stmtA="UPDATE vicidial_lead_call_quota_counts SET status='$temp_status',called_count='$VLcalled_count',rank='$tempVLrank',modify_date=NOW() where lead_id='$CIDlead_id' and list_id='$VLlist_id';";
|
||||||
|
}
|
||||||
|
$VLCQCaffected_rows_update = $dbhA->do($stmtA);
|
||||||
|
$event_string = "-- VLCQC record updated: |$VLCQCaffected_rows_update| |$stmtA|"; &event_logger;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# Insert new record into vicidial_lead_call_quota_counts table for this lead
|
||||||
|
$stmtA="INSERT INTO vicidial_lead_call_quota_counts SET lead_id='$CIDlead_id',list_id='$VLlist_id',first_call_date='$VDLcall_datetime',last_call_date='$VDLcall_datetime',status='$temp_status',called_count='$VLcalled_count',day_one_calls='1',rank='$tempVLrank',modify_date=NOW() $session_newSQL;";
|
||||||
|
$VLCQCaffected_rows_update = $dbhA->do($stmtA);
|
||||||
|
$event_string = "-- VLCQC record inserted: |$VLCQCaffected_rows_update| |$stmtA|"; &event_logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ($zero_rank_after_call > 0) && ($VLrank > 0) )
|
||||||
|
{
|
||||||
|
# Update this lead to rank=0
|
||||||
|
$stmtA="UPDATE vicidial_list SET rank='0' where lead_id='$CIDlead_id';";
|
||||||
|
$VLCQCaffected_rows_zero_rank = $dbhA->do($stmtA);
|
||||||
|
$event_string = "-- VLCQC lead rank zero: |$VLCQCaffected_rows_zero_rank| |$stmtA|"; &event_logger;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$sthA->finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
##### END Call Quota Lead Ranking logging #####
|
||||||
|
|||||||
+363
-6
@@ -25,7 +25,7 @@
|
|||||||
# exten => h,1,DeadAGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME})
|
# exten => h,1,DeadAGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME})
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Copyright (C) 2018 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
# Copyright (C) 2019 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||||
#
|
#
|
||||||
# CHANGELOG:
|
# CHANGELOG:
|
||||||
# 61010-1007 - First test build
|
# 61010-1007 - First test build
|
||||||
@@ -83,6 +83,7 @@
|
|||||||
# 180521-1153 - Changed closer log logging to use agent if call was AGENTDIRECT
|
# 180521-1153 - Changed closer log logging to use agent if call was AGENTDIRECT
|
||||||
# 180919-1729 - Fix for rare non-NA-set-as-NA call logging issue
|
# 180919-1729 - Fix for rare non-NA-set-as-NA call logging issue
|
||||||
# 190626-1100 - Added more logging for Auto-Alt-Dial debug
|
# 190626-1100 - Added more logging for Auto-Alt-Dial debug
|
||||||
|
# 190709-2240 - Added Call Quota logging
|
||||||
#
|
#
|
||||||
|
|
||||||
# defaults for PreFork
|
# defaults for PreFork
|
||||||
@@ -182,6 +183,7 @@ use vars qw(@ISA);
|
|||||||
use Net::Server::PreFork; # any personality will do
|
use Net::Server::PreFork; # any personality will do
|
||||||
@ISA = qw(Net::Server::PreFork);
|
@ISA = qw(Net::Server::PreFork);
|
||||||
use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second
|
use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second
|
||||||
|
use Time::Local;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1071,6 +1073,28 @@ sub process_request
|
|||||||
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
|
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
|
||||||
$VDLXaffected_rows = $dbhA->do($stmtA);
|
$VDLXaffected_rows = $dbhA->do($stmtA);
|
||||||
if ($AGILOG) {$agi_string = "-- VDAD vicidial_extended_log insert: |$VDLXaffected_rows|$uniqueid|$CIDlead_id|$VDL_status|"; &agi_output;}
|
if ($AGILOG) {$agi_string = "-- VDAD vicidial_extended_log insert: |$VDLXaffected_rows|$uniqueid|$CIDlead_id|$VDL_status|"; &agi_output;}
|
||||||
|
|
||||||
|
if ($SScall_quota_lead_ranking > 0)
|
||||||
|
{
|
||||||
|
### check to see if campaign call quotas enabled
|
||||||
|
$VD_call_quota_lead_ranking='DISABLED';
|
||||||
|
$stmtA="SELECT call_quota_lead_ranking FROM vicidial_campaigns where campaign_id='$VD_campaign_id';";
|
||||||
|
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
|
||||||
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
|
$sthArows=$sthA->rows;
|
||||||
|
if ($sthArows > 0)
|
||||||
|
{
|
||||||
|
@aryA = $sthA->fetchrow_array;
|
||||||
|
$VD_call_quota_lead_ranking = $aryA[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($VD_call_quota_lead_ranking !~ /^DISABLED$/i)
|
||||||
|
{
|
||||||
|
$temp_status = $VDL_status;
|
||||||
|
&call_quota_logging;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ($CPDfound > 0) && ($VDL_status !~ /AA/) )
|
if ( ($CPDfound > 0) && ($VDL_status !~ /AA/) )
|
||||||
@@ -1400,14 +1424,16 @@ sub process_request
|
|||||||
|
|
||||||
#############################################
|
#############################################
|
||||||
##### SYSTEM SETTINGS LOOKUP #####
|
##### SYSTEM SETTINGS LOOKUP #####
|
||||||
$stmtA = "SELECT enable_drop_lists FROM system_settings;";
|
$stmtA = "SELECT enable_drop_lists,call_quota_lead_ranking,timeclock_end_of_day FROM system_settings;";
|
||||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
$sthArows=$sthA->rows;
|
$sthArows=$sthA->rows;
|
||||||
if ($sthArows > 0)
|
if ($sthArows > 0)
|
||||||
{
|
{
|
||||||
@aryA = $sthA->fetchrow_array;
|
@aryA = $sthA->fetchrow_array;
|
||||||
$enable_drop_lists = $aryA[0];
|
$enable_drop_lists = $aryA[0];
|
||||||
|
$SScall_quota_lead_ranking = $aryA[1];
|
||||||
|
$timeclock_end_of_day = $aryA[2];
|
||||||
}
|
}
|
||||||
$sthA->finish();
|
$sthA->finish();
|
||||||
##### END SYSTEM SETTINGS LOOKUP #####
|
##### END SYSTEM SETTINGS LOOKUP #####
|
||||||
@@ -1494,6 +1520,8 @@ sub process_request
|
|||||||
}
|
}
|
||||||
$sthA->finish();
|
$sthA->finish();
|
||||||
|
|
||||||
|
if (length($VDL_status) < 1) {$VDL_status='PDROP';}
|
||||||
|
|
||||||
$stmtA = "UPDATE vicidial_list SET status='PDROP' where lead_id='$VD_lead_id';";
|
$stmtA = "UPDATE vicidial_list SET status='PDROP' where lead_id='$VD_lead_id';";
|
||||||
$VLPDaffected_rows = $dbhA->do($stmtA);
|
$VLPDaffected_rows = $dbhA->do($stmtA);
|
||||||
if ($AGILOG) {$agi_string = "-- PDROP vicidial_list update: |$VLPDaffected_rows|$uniqueid|$CIDlead_id|$VDL_status|"; &agi_output;}
|
if ($AGILOG) {$agi_string = "-- PDROP vicidial_list update: |$VLPDaffected_rows|$uniqueid|$CIDlead_id|$VDL_status|"; &agi_output;}
|
||||||
@@ -1532,6 +1560,7 @@ sub process_request
|
|||||||
{$VDLSQL_term_reason = '';}
|
{$VDLSQL_term_reason = '';}
|
||||||
}
|
}
|
||||||
$SQL_status = "status='DROP',$VDLSQL_term_reason";
|
$SQL_status = "status='DROP',$VDLSQL_term_reason";
|
||||||
|
if (length($VDL_status) < 1) {$VDL_status='DROP';}
|
||||||
|
|
||||||
########## FIND AND UPDATE vicidial_list ##########
|
########## FIND AND UPDATE vicidial_list ##########
|
||||||
$stmtA = "UPDATE vicidial_list set status='DROP' where lead_id = '$VD_lead_id';";
|
$stmtA = "UPDATE vicidial_list set status='DROP' where lead_id = '$VD_lead_id';";
|
||||||
@@ -1583,6 +1612,7 @@ sub process_request
|
|||||||
{
|
{
|
||||||
$VDCLSQL_status = "status='DROP',";
|
$VDCLSQL_status = "status='DROP',";
|
||||||
$VDCLSQL_queue_seconds = "queue_seconds='$VD_seconds',";
|
$VDCLSQL_queue_seconds = "queue_seconds='$VD_seconds',";
|
||||||
|
if (length($VDL_status) < 1) {$VDL_status='DROP';}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1637,11 +1667,11 @@ sub process_request
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
##### BEGIN AUTO ALT PHONE DIAL SECTION #####
|
### check to see if campaign has alt_dial or call quotas enabled
|
||||||
### check to see if campaign has alt_dial enabled
|
|
||||||
$VD_auto_alt_dial = 'NONE';
|
$VD_auto_alt_dial = 'NONE';
|
||||||
$VD_auto_alt_dial_statuses='';
|
$VD_auto_alt_dial_statuses='';
|
||||||
$stmtA="SELECT auto_alt_dial,auto_alt_dial_statuses,use_internal_dnc,use_campaign_dnc,use_other_campaign_dnc FROM vicidial_campaigns where campaign_id='$VD_campaign_id';";
|
$VD_call_quota_lead_ranking='DISABLED';
|
||||||
|
$stmtA="SELECT auto_alt_dial,auto_alt_dial_statuses,use_internal_dnc,use_campaign_dnc,use_other_campaign_dnc,call_quota_lead_ranking FROM vicidial_campaigns where campaign_id='$VD_campaign_id';";
|
||||||
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
|
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
|
||||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
@@ -1655,8 +1685,22 @@ sub process_request
|
|||||||
$VD_use_internal_dnc = $aryA[2];
|
$VD_use_internal_dnc = $aryA[2];
|
||||||
$VD_use_campaign_dnc = $aryA[3];
|
$VD_use_campaign_dnc = $aryA[3];
|
||||||
$VD_use_other_campaign_dnc = $aryA[4];
|
$VD_use_other_campaign_dnc = $aryA[4];
|
||||||
|
$VD_call_quota_lead_ranking = $aryA[5];
|
||||||
$epc_countCAMPDATA++;
|
$epc_countCAMPDATA++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
##### BEGIN Call Quota Lead Ranking logging #####
|
||||||
|
if ( ($SScall_quota_lead_ranking > 0) && ($VD_call_quota_lead_ranking !~ /^DISABLED$/i) )
|
||||||
|
{
|
||||||
|
$temp_status=$VDL_status;
|
||||||
|
if ( (length($VDL_status) < 1) || ($VDL_status =~ /^LIVE/i) ) {$temp_status=$VD_status;}
|
||||||
|
if ($temp_status =~ /^LIVE/i) {$temp_status='PU';}
|
||||||
|
&call_quota_logging;
|
||||||
|
}
|
||||||
|
##### END Call Quota Lead Ranking logging #####
|
||||||
|
|
||||||
|
|
||||||
|
##### BEGIN AUTO ALT PHONE DIAL SECTION #####
|
||||||
$sthA->finish();
|
$sthA->finish();
|
||||||
# if ($AGILOG) {$agi_string = "AUTO-ALT TEST: |$VD_status|$VDL_status|$VD_auto_alt_dial_statuses|$VD_auto_alt_dial|"; &agi_output;}
|
# if ($AGILOG) {$agi_string = "AUTO-ALT TEST: |$VD_status|$VDL_status|$VD_auto_alt_dial_statuses|$VD_auto_alt_dial|"; &agi_output;}
|
||||||
if ($VD_auto_alt_dial_statuses =~ / $VD_status | $VDL_status /)
|
if ($VD_auto_alt_dial_statuses =~ / $VD_status | $VDL_status /)
|
||||||
@@ -2012,6 +2056,319 @@ exit;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### BEGIN Call Quota Lead Ranking logging #####
|
||||||
|
sub call_quota_logging
|
||||||
|
{
|
||||||
|
# Gather settings container for Call Quota Lead Ranking
|
||||||
|
$CQcontainer_entry='';
|
||||||
|
$stmtA = "SELECT container_entry FROM vicidial_settings_containers where container_id='$VD_call_quota_lead_ranking';";
|
||||||
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
|
$sthArows=$sthA->rows;
|
||||||
|
if ($sthArows > 0)
|
||||||
|
{
|
||||||
|
@aryA = $sthA->fetchrow_array;
|
||||||
|
$CQcontainer_entry = $aryA[0];
|
||||||
|
$CQcontainer_entry =~ s/\\//gi;
|
||||||
|
}
|
||||||
|
$sthA->finish();
|
||||||
|
|
||||||
|
# Define variables for Call Quota settings
|
||||||
|
$session_one='';
|
||||||
|
$session_two='';
|
||||||
|
$session_three='';
|
||||||
|
$session_four='';
|
||||||
|
$session_five='';
|
||||||
|
$session_six='';
|
||||||
|
$settings_session_score=0;
|
||||||
|
$zero_rank_after_call=0;
|
||||||
|
|
||||||
|
if (length($CQcontainer_entry) > 5)
|
||||||
|
{
|
||||||
|
@container_lines = split(/\n/,$CQcontainer_entry);
|
||||||
|
$c=0;
|
||||||
|
foreach(@container_lines)
|
||||||
|
{
|
||||||
|
$container_lines[$c] =~ s/;.*|\r|\t| //gi;
|
||||||
|
if (length($container_lines[$c]) > 5)
|
||||||
|
{
|
||||||
|
# define core settings
|
||||||
|
if ($container_lines[$c] =~ /^zero_rank_after_call/i)
|
||||||
|
{
|
||||||
|
$container_lines[$c] =~ s/zero_rank_after_call=>//gi;
|
||||||
|
if ( ($container_lines[$c] >= 0) && ($container_lines[$c] <= 1) )
|
||||||
|
{
|
||||||
|
$zero_rank_after_call = $container_lines[$c];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# define sessions
|
||||||
|
if ($container_lines[$c] =~ /^session_one/i)
|
||||||
|
{
|
||||||
|
$session_one_valid=0; $session_one_start=''; $session_one_end='';
|
||||||
|
$session_one = $container_lines[$c];
|
||||||
|
$session_one =~ s/session_one=>//gi;
|
||||||
|
if ( (length($session_one) > 0) && (length($session_one) <= 9) && ($session_one =~ /,/) )
|
||||||
|
{
|
||||||
|
@session_oneARY = split(/,/,$session_one);
|
||||||
|
$session_one_start = $session_oneARY[0];
|
||||||
|
$session_one_end = $session_oneARY[1];
|
||||||
|
if ( (length($session_one_start) >= 4) && (length($session_one_end) >= 4) && ($session_one_start < $session_one_end) && ($session_one_end <= 2400) )
|
||||||
|
{
|
||||||
|
$settings_session_score++;
|
||||||
|
$session_one_valid++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($container_lines[$c] =~ /^session_two/i)
|
||||||
|
{
|
||||||
|
$session_two_valid=0; $session_two_start=''; $session_two_end='';
|
||||||
|
$session_two = $container_lines[$c];
|
||||||
|
$session_two =~ s/session_two=>//gi;
|
||||||
|
if ( (length($session_two) > 0) && (length($session_two) <= 9) && ($session_two =~ /,/) )
|
||||||
|
{
|
||||||
|
@session_twoARY = split(/,/,$session_two);
|
||||||
|
$session_two_start = $session_twoARY[0];
|
||||||
|
$session_two_end = $session_twoARY[1];
|
||||||
|
if ( (length($session_two_start) >= 4) && (length($session_two_end) >= 4) && ($session_one_valid > 0) && ($session_one_end <= $session_two_start) && ($session_two_start < $session_two_end) && ($session_two_end <= 2400) )
|
||||||
|
{
|
||||||
|
$settings_session_score++;
|
||||||
|
$session_two_valid++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($container_lines[$c] =~ /^session_three/i)
|
||||||
|
{
|
||||||
|
$session_three_valid=0; $session_three_start=''; $session_three_end='';
|
||||||
|
$session_three = $container_lines[$c];
|
||||||
|
$session_three =~ s/session_three=>//gi;
|
||||||
|
if ( (length($session_three) > 0) && (length($session_three) <= 9) && ($session_three =~ /,/) )
|
||||||
|
{
|
||||||
|
@session_threeARY = split(/,/,$session_three);
|
||||||
|
$session_three_start = $session_threeARY[0];
|
||||||
|
$session_three_end = $session_threeARY[1];
|
||||||
|
if ( (length($session_three_start) >= 4) && (length($session_three_end) >= 4) && ($session_two_valid > 0) && ($session_two_end <= $session_three_start) && ($session_three_start < $session_three_end) && ($session_three_end <= 2400) )
|
||||||
|
{
|
||||||
|
$settings_session_score++;
|
||||||
|
$session_three_valid++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($container_lines[$c] =~ /^session_four/i)
|
||||||
|
{
|
||||||
|
$session_four_valid=0; $session_four_start=''; $session_four_end='';
|
||||||
|
$session_four = $container_lines[$c];
|
||||||
|
$session_four =~ s/session_four=>//gi;
|
||||||
|
if ( (length($session_four) > 0) && (length($session_four) <= 9) && ($session_four =~ /,/) )
|
||||||
|
{
|
||||||
|
@session_fourARY = split(/,/,$session_four);
|
||||||
|
$session_four_start = $session_fourARY[0];
|
||||||
|
$session_four_end = $session_fourARY[1];
|
||||||
|
if ( (length($session_four_start) >= 4) && (length($session_four_end) >= 4) && ($session_three_valid > 0) && ($session_three_end <= $session_four_start) && ($session_four_start < $session_four_end) && ($session_four_end <= 2400) )
|
||||||
|
{
|
||||||
|
$settings_session_score++;
|
||||||
|
$session_four_valid++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($container_lines[$c] =~ /^session_five/i)
|
||||||
|
{
|
||||||
|
$session_five_valid=0; $session_five_start=''; $session_five_end='';
|
||||||
|
$session_five = $container_lines[$c];
|
||||||
|
$session_five =~ s/session_five=>//gi;
|
||||||
|
if ( (length($session_five) > 0) && (length($session_five) <= 9) && ($session_five =~ /,/) )
|
||||||
|
{
|
||||||
|
@session_fiveARY = split(/,/,$session_five);
|
||||||
|
$session_five_start = $session_fiveARY[0];
|
||||||
|
$session_five_end = $session_fiveARY[1];
|
||||||
|
if ( (length($session_five_start) >= 4) && (length($session_five_end) >= 4) && ($session_four_valid > 0) && ($session_four_end <= $session_five_start) && ($session_five_start < $session_five_end) && ($session_five_end <= 2400) )
|
||||||
|
{
|
||||||
|
$settings_session_score++;
|
||||||
|
$session_five_valid++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($container_lines[$c] =~ /^session_six/i)
|
||||||
|
{
|
||||||
|
$session_six_valid=0; $session_six_start=''; $session_six_end='';
|
||||||
|
$session_six = $container_lines[$c];
|
||||||
|
$session_six =~ s/session_six=>//gi;
|
||||||
|
if ( (length($session_six) > 0) && (length($session_six) <= 9) && ($session_six =~ /,/) )
|
||||||
|
{
|
||||||
|
@session_sixARY = split(/,/,$session_six);
|
||||||
|
$session_six_start = $session_sixARY[0];
|
||||||
|
$session_six_end = $session_sixARY[1];
|
||||||
|
if ( (length($session_six_start) >= 4) && (length($session_six_end) >= 4) && ($session_five_valid > 0) && ($session_five_end <= $session_six_start) && ($session_six_start < $session_six_end) && ($session_six_end <= 2400) )
|
||||||
|
{
|
||||||
|
$settings_session_score++;
|
||||||
|
$session_six_valid++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{if ($DBX > 0) {print " blank line: $c|$container_lines[$c]|\n";}}
|
||||||
|
$c++;
|
||||||
|
}
|
||||||
|
if ($settings_session_score >= 1)
|
||||||
|
{
|
||||||
|
$stmtA = "SELECT list_id,called_count,rank FROM vicidial_list where lead_id='$VD_lead_id';";
|
||||||
|
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
|
||||||
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
|
$sthArows=$sthA->rows;
|
||||||
|
if ($sthArows > 0)
|
||||||
|
{
|
||||||
|
@aryA = $sthA->fetchrow_array;
|
||||||
|
$VLlist_id = $aryA[0];
|
||||||
|
$VLcalled_count = $aryA[1];
|
||||||
|
$VLrank = $aryA[2];
|
||||||
|
$tempVLrank = $VLrank;
|
||||||
|
if ( ($zero_rank_after_call > 0) && ($VLrank > 0) ) {$tempVLrank=0;}
|
||||||
|
}
|
||||||
|
$sthA->finish();
|
||||||
|
|
||||||
|
$secX = time();
|
||||||
|
$CQtarget = ($secX - 14400); # look back 4 hours
|
||||||
|
($CQsec,$CQmin,$CQhour,$CQmday,$CQmon,$CQyear,$CQwday,$CQyday,$CQisdst) = localtime($CQtarget);
|
||||||
|
$CQyear = ($CQyear + 1900);
|
||||||
|
$CQmon++;
|
||||||
|
if ($CQmon < 10) {$CQmon = "0$CQmon";}
|
||||||
|
if ($CQmday < 10) {$CQmday = "0$CQmday";}
|
||||||
|
if ($CQhour < 10) {$CQhour = "0$CQhour";}
|
||||||
|
if ($CQmin < 10) {$CQmin = "0$CQmin";}
|
||||||
|
if ($CQsec < 10) {$CQsec = "0$CQsec";}
|
||||||
|
$CQSQLdate = "$CQyear-$CQmon-$CQmday $CQhour:$CQmin:$CQsec";
|
||||||
|
|
||||||
|
$VDL_call_datetime='';
|
||||||
|
$stmtA = "SELECT call_date from vicidial_dial_log where lead_id='$VD_lead_id' and call_date > \"$CQSQLdate\" and caller_code LIKE \"%$VD_lead_id\" order by call_date desc limit 1;";
|
||||||
|
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
|
||||||
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
|
$sthArows=$sthA->rows;
|
||||||
|
if ($sthArows > 0)
|
||||||
|
{
|
||||||
|
@aryA = $sthA->fetchrow_array;
|
||||||
|
$VDLcall_datetime = $aryA[0];
|
||||||
|
@VDLcall_datetimeARY = split(/ /,$VDLcall_datetime);
|
||||||
|
@VDLcall_timeARY = split(/:/,$VDLcall_datetimeARY[1]);
|
||||||
|
$VDLcall_hourmin = "$VDLcall_timeARY[0]$VDLcall_timeARY[1]";
|
||||||
|
|
||||||
|
if ( ($session_one_start <= $VDLcall_hourmin) and ($session_one_end > $VDLcall_hourmin) )
|
||||||
|
{
|
||||||
|
$call_in_session=1;
|
||||||
|
$session_newSQL=",session_one_calls='1',session_one_today_calls='1'";
|
||||||
|
$session_updateSQL=",session_one_calls=(session_one_calls + 1),session_one_today_calls=(session_one_today_calls + 1)";
|
||||||
|
}
|
||||||
|
if ( ($session_two_start <= $VDLcall_hourmin) and ($session_two_end > $VDLcall_hourmin) )
|
||||||
|
{
|
||||||
|
$call_in_session=2;
|
||||||
|
$session_newSQL=",session_two_calls='1',session_two_today_calls='1'";
|
||||||
|
$session_updateSQL=",session_two_calls=(session_two_calls + 1),session_two_today_calls=(session_two_today_calls + 1)";
|
||||||
|
}
|
||||||
|
if ( ($session_three_start <= $VDLcall_hourmin) and ($session_three_end > $VDLcall_hourmin) )
|
||||||
|
{
|
||||||
|
$call_in_session=3;
|
||||||
|
$session_newSQL=",session_three_calls='1',session_three_today_calls='1'";
|
||||||
|
$session_updateSQL=",session_three_calls=(session_three_calls + 1),session_three_today_calls=(session_three_today_calls + 1)";
|
||||||
|
}
|
||||||
|
if ( ($session_four_start <= $VDLcall_hourmin) and ($session_four_end > $VDLcall_hourmin) )
|
||||||
|
{
|
||||||
|
$call_in_session=4;
|
||||||
|
$session_newSQL=",session_four_calls='1',session_four_today_calls='1'";
|
||||||
|
$session_updateSQL=",session_four_calls=(session_four_calls + 1),session_four_today_calls=(session_four_today_calls + 1)";
|
||||||
|
}
|
||||||
|
if ( ($session_five_start <= $VDLcall_hourmin) and ($session_five_end > $VDLcall_hourmin) )
|
||||||
|
{
|
||||||
|
$call_in_session=5;
|
||||||
|
$session_newSQL=",session_five_calls='1',session_five_today_calls='1'";
|
||||||
|
$session_updateSQL=",session_five_calls=(session_five_calls + 1),session_five_today_calls=(session_five_today_calls + 1)";
|
||||||
|
}
|
||||||
|
if ( ($session_six_start <= $VDLcall_hourmin) and ($session_six_end > $VDLcall_hourmin) )
|
||||||
|
{
|
||||||
|
$call_in_session=6;
|
||||||
|
$session_newSQL=",session_six_calls='1',session_six_today_calls='1'";
|
||||||
|
$session_updateSQL=",session_six_calls=(session_six_calls + 1),session_six_today_calls=(session_six_today_calls + 1)";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($AGILOG) {$agi_string = "CQ-Debug 2: $VDLcall_datetime|$VDLcall_hourmin|$timeclock_end_of_day|$session_one_start|$session_one_end|$call_in_session|"; &agi_output;}
|
||||||
|
|
||||||
|
if ($call_in_session > 0)
|
||||||
|
{
|
||||||
|
if (length($timeclock_end_of_day) < 1) {$timeclock_end_of_day='0000';}
|
||||||
|
$timeclock_end_of_day_hour = (substr($timeclock_end_of_day, 0, 2) + 0);
|
||||||
|
$timeclock_end_of_day_min = (substr($timeclock_end_of_day, 2, 2) + 0);
|
||||||
|
|
||||||
|
$today_start_epoch = timelocal('0',$timeclock_end_of_day_min,$timeclock_end_of_day_hour,$mday,($mon-1),$year);
|
||||||
|
if ($timeclock_end_of_day > $VDLcall_hourmin)
|
||||||
|
{$today_start_epoch = ($today_start_epoch - 86400);}
|
||||||
|
$day_two_start_epoch = ($today_start_epoch - (86400 * 1));
|
||||||
|
$day_three_start_epoch = ($today_start_epoch - (86400 * 2));
|
||||||
|
$day_four_start_epoch = ($today_start_epoch - (86400 * 3));
|
||||||
|
$day_five_start_epoch = ($today_start_epoch - (86400 * 4));
|
||||||
|
$day_six_start_epoch = ($today_start_epoch - (86400 * 5));
|
||||||
|
$day_seven_start_epoch = ($today_start_epoch - (86400 * 6));
|
||||||
|
|
||||||
|
# Gather the details on existing vicidial_lead_call_quota_counts for this lead, if there is one
|
||||||
|
$stmtA = "SELECT first_call_date,UNIX_TIMESTAMP(first_call_date),last_call_date from vicidial_lead_call_quota_counts where lead_id='$VD_lead_id' and list_id='$VLlist_id';";
|
||||||
|
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
|
||||||
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
|
$VLCQCinfo_ct=$sthA->rows;
|
||||||
|
if ($VLCQCinfo_ct > 0)
|
||||||
|
{
|
||||||
|
@aryA = $sthA->fetchrow_array;
|
||||||
|
$VLCQCfirst_call_datetime = $aryA[0];
|
||||||
|
$VLCQCfirst_call_epoch = $aryA[1];
|
||||||
|
$VLCQClast_call_date = $aryA[2];
|
||||||
|
|
||||||
|
if ($VDLcall_datetime ne $VLCQClast_call_date)
|
||||||
|
{
|
||||||
|
if ($VLCQCfirst_call_epoch >= $today_start_epoch)
|
||||||
|
{$day_updateSQL=',day_one_calls=(day_one_calls+1)';}
|
||||||
|
if ( ($VLCQCfirst_call_epoch >= $day_two_start_epoch) and ($VLCQCfirst_call_epoch < $today_start_epoch) )
|
||||||
|
{$day_updateSQL=',day_two_calls=(day_two_calls+1)';}
|
||||||
|
if ( ($VLCQCfirst_call_epoch >= $day_three_start_epoch) and ($VLCQCfirst_call_epoch < $day_two_start_epoch) )
|
||||||
|
{$day_updateSQL=',day_three_calls=(day_three_calls+1)';}
|
||||||
|
if ( ($VLCQCfirst_call_epoch >= $day_four_start_epoch) and ($VLCQCfirst_call_epoch < $day_three_start_epoch) )
|
||||||
|
{$day_updateSQL=',day_four_calls=(day_four_calls+1)';}
|
||||||
|
if ( ($VLCQCfirst_call_epoch >= $day_five_start_epoch) and ($VLCQCfirst_call_epoch < $day_four_start_epoch) )
|
||||||
|
{$day_updateSQL=',day_five_calls=(day_five_calls+1)';}
|
||||||
|
if ( ($VLCQCfirst_call_epoch >= $day_six_start_epoch) and ($VLCQCfirst_call_epoch < $day_five_start_epoch) )
|
||||||
|
{$day_updateSQL=',day_six_calls=(day_six_calls+1)';}
|
||||||
|
if ( ($VLCQCfirst_call_epoch >= $day_seven_start_epoch) and ($VLCQCfirst_call_epoch < $day_six_start_epoch) )
|
||||||
|
{$day_updateSQL=',day_seven_calls=(day_seven_calls+1)';}
|
||||||
|
# Update in the vicidial_lead_call_quota_counts table for this lead
|
||||||
|
$stmtA="UPDATE vicidial_lead_call_quota_counts SET last_call_date='$VDLcall_datetime',status='$temp_status',called_count='$VLcalled_count',rank='$tempVLrank',modify_date=NOW() $session_updateSQL $day_updateSQL where lead_id='$VD_lead_id' and list_id='$VLlist_id' and modify_date < NOW();";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# Update in the vicidial_lead_call_quota_counts table for this lead
|
||||||
|
$stmtA="UPDATE vicidial_lead_call_quota_counts SET status='$temp_status',called_count='$VLcalled_count',rank='$tempVLrank',modify_date=NOW() where lead_id='$VD_lead_id' and list_id='$VLlist_id';";
|
||||||
|
}
|
||||||
|
$VLCQCaffected_rows_update = $dbhA->do($stmtA);
|
||||||
|
if ($AGILOG) {$agi_string = "-- VLCQC record updated: |$VLCQCaffected_rows_update| |$stmtA|"; &agi_output;}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# Insert new record into vicidial_lead_call_quota_counts table for this lead
|
||||||
|
$stmtA="INSERT INTO vicidial_lead_call_quota_counts SET lead_id='$VD_lead_id',list_id='$VLlist_id',first_call_date='$VDLcall_datetime',last_call_date='$VDLcall_datetime',status='$temp_status',called_count='$VLcalled_count',day_one_calls='1',rank='$tempVLrank',modify_date=NOW() $session_newSQL;";
|
||||||
|
$VLCQCaffected_rows_update = $dbhA->do($stmtA);
|
||||||
|
if ($AGILOG) {$agi_string = "-- VLCQC record inserted: |$VLCQCaffected_rows_update| |$stmtA|"; &agi_output;}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ($zero_rank_after_call > 0) && ($VLrank > 0) )
|
||||||
|
{
|
||||||
|
# Update this lead to rank=0
|
||||||
|
$stmtA="UPDATE vicidial_list SET rank='0' where lead_id='$VD_lead_id';";
|
||||||
|
$VLCQCaffected_rows_zero_rank = $dbhA->do($stmtA);
|
||||||
|
if ($AGILOG) {$agi_string = "-- VLCQC lead rank zero: |$VLCQCaffected_rows_zero_rank| |$stmtA|"; &agi_output;}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$sthA->finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sub agi_output
|
sub agi_output
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,276 @@
|
|||||||
|
CALL QUOTA LEAD RANKING Started: 2019-07-01 Updated: 2019-07-19
|
||||||
|
|
||||||
|
!!!! THIS IS AN EXPERIMENTAL FEATURE, PLEASE READ ALL IMPORTANT NOTES !!!!
|
||||||
|
(If you plan on using this feature-set in production, you should read and understand everything in this document)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
This document will go over the details of the new Call Quota Lead Ranking lead recycling features that were added to VICIdial
|
||||||
|
|
||||||
|
The purpose of this set of features is to allow for structured recycle dialing of leads where no contact is made over set time periods over a number of consecutive days. This feature set was built specifically for one client that has two main requirements:
|
||||||
|
- To be able to dial leads that do not connect to a customer at least 6 times over 2 concurrent days with at least one attempt made in each of 3 time periods during the day.
|
||||||
|
- To be able to automatically set an inactive list to active when the number of dialable NEW leads in the already active lists was about to be exhausted
|
||||||
|
|
||||||
|
While the feature-set that was built offers more flexibility than the requirements that were specified above, these were the parameters that we specifically tested to ensure this set of features was working properly.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IMPORTANT VICIDIAL VERSION NOTE!!!
|
||||||
|
|
||||||
|
You will need to be running VICIdial svn/trunk revision 3122 or newer on all of the servers in your cluster in order to use these new features
|
||||||
|
|
||||||
|
|
||||||
|
IMPORTANT FEATURE ENABLING NOTE!!!
|
||||||
|
|
||||||
|
To enable the Call Quota Lead Ranking feature set, you must enable it in "Admin -> System Settings -> Call Quota Lead Ranking" and the "Call Quota Lead Ranking" campaign setting must also be set to a valid CALL_QUOTA Settings Container for any campaigns that you want to use it on.
|
||||||
|
|
||||||
|
|
||||||
|
IMPORTANT DATABASE LOAD NOTE!!!
|
||||||
|
|
||||||
|
This set of features may impact your database performance if you have a large number of leads in the lists of the campaigns that you enable this feature for. For this reason, we recommend putting lists that you are not dialing on today into a separate inactive campaign that does not have these features enabled on it.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
NOTE:
|
||||||
|
The Call Quota Lead Ranking features are not designed to work with standard campaign outbound Auto-Alt-Dialing. If you need to dial multiple numbers per account, please look into using the MULTI_LEAD auto-alt-dialing option, which can work with these call quota features.
|
||||||
|
|
||||||
|
NOTE:
|
||||||
|
We do not recommend using Call Quota Lead Ranking on the same statuses that you have enabled campaign Lead Recycling for. It is best not to use campaign Lead Recycling at all.
|
||||||
|
|
||||||
|
NOTE:
|
||||||
|
We do not recommend resetting your Lists, or using the List "Reset Time" feature, while using Call Quota Lead Ranking on a campaign. The Call Quota Lead Ranking process has a component that automatically resets individual leads so they can be dialed again when they have their rank updated, if the rank is above 0.
|
||||||
|
|
||||||
|
NOTE:
|
||||||
|
The lead ranking is performed on a per-lead-per-list basis, so if you move a lead to a different list, then the counts for the call quota lead ranking will be reset for that lead.
|
||||||
|
|
||||||
|
NOTE:
|
||||||
|
The Call Quota logs per-lead that are needed for this process to work correctly are archived after 7 days, so all Call Quota Lead Ranking recycling operations for a lead need to be set for 7 days or less.
|
||||||
|
|
||||||
|
NOTE:
|
||||||
|
If Call Quota Lead Ranking is enabled on a campaign, then the campaign's "List Order" setting will be overridden by the Call Quota Settings Container settings.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------------- END OF "IMPORTANT NOTES" SECTION -----------------------------
|
||||||
|
|
||||||
|
|
||||||
|
How the "Auto Active List New" feature works:
|
||||||
|
|
||||||
|
This feature will automatically set an inactive list to active when it contains dialable NEW status leads and the campaign has less than this setting's number of NEW status leads to be dialed. The order in which the next list is set to active is determined by the Lists' Auto Active List Rank. This feature will only work if there has been calling on this campaign within the last hour. If no leads have been dialed within the last hour in this campaign, then this feature will not function. The default campaign setting for this feature is DISABLED.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
How the "Call Quota Lead Ranking" feature works:
|
||||||
|
|
||||||
|
This feature works on a per-campaign basis, the campaign setting will allow you to choose a Settings Container which has the settings you want to use for Call Quota Lead Ranking(see the example setting container below)
|
||||||
|
|
||||||
|
Example Settings Container Entry:
|
||||||
|
|
||||||
|
redial_statuses => A,N,NA,VM,NSC,DROP,PDROP
|
||||||
|
total_goal => 6
|
||||||
|
daily_goal => 3
|
||||||
|
daily_max => 5
|
||||||
|
session_goal => 2
|
||||||
|
session_day_max => 2
|
||||||
|
new_shuffle => 3
|
||||||
|
min_consecutive_days => 2
|
||||||
|
active_days_of_week => 0123456
|
||||||
|
zero_rank_after_call => 1
|
||||||
|
call_quota_run_time => 01,31
|
||||||
|
session_one => 0800,1200
|
||||||
|
session_two => 1200,1600
|
||||||
|
session_three => 1600,2000
|
||||||
|
session_four =>
|
||||||
|
session_five =>
|
||||||
|
session_six =>
|
||||||
|
|
||||||
|
For the Call Quota Settings Container to be valid, the first 11 core settings listed above must be set to valid values, see below:
|
||||||
|
- redial_statuses: a comma-delimited list of the statuses that you want to recycle-dial
|
||||||
|
- total_goal: must be set to a number from 1 to 100, goal total number of calls during min_consecutive_days
|
||||||
|
- daily_goal: must be set to a number from 1 to 20, goal number of calls per day
|
||||||
|
- daily_max: must be set to a number from 1 to 20, maximum number of calls per day
|
||||||
|
- session_goal: must be set to a number from 1 to 20, goal number of calls during session, total across all days
|
||||||
|
- session_day_max: must be set to a number from 1 to 20, maximum number of calls during each session for current day
|
||||||
|
- new_shuffle: must be set to a number from 0 to 6, 0 is no NEW lead shuffle, '1' is assumed to be '2' for every-other lead
|
||||||
|
- min_consecutive_days: must be set to a number from 1 to 7, this is the number of days allowed to reach the "total_goal"
|
||||||
|
- active_days_of_week: must be from one to seven digits, one for each day of the week, Sunday=0, example: "0123456" for all 7 days of the week
|
||||||
|
- zero_rank_after_call: set to 0 or 1, if set to 1, the lead's rank will be set to 0 when the call is completed, if the lead's rank is above 0
|
||||||
|
- call_quota_run_time: a comma-delimited list of the "minutes" of each hour when the call quota lead ranking process is to be run, we recommend 1-4 times an hour
|
||||||
|
NOTE: If you are using Call Quotas on multiple campaigns, we recommend you schedule their run times to not overlap
|
||||||
|
|
||||||
|
There are also up to 6 sessions that can be defined, they all follow the same format and must be put in chronological order.
|
||||||
|
All times are based on server time, not the customer time.
|
||||||
|
It is assumed that the session times will cover all possible dialing times for the campaign.
|
||||||
|
For the 'day X of dialing' determination, the "System Settings -> Timeclock End of Day" setting is used to determine when each day begins
|
||||||
|
You must define at least one session.
|
||||||
|
Sessions are not designed to start earler than "0000", or go past "2400".
|
||||||
|
4-digit starting time(in 24 hour format with zero-padding), 4-digit ending time(in 24 hour format with zero-padding)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
TIPS & SUGGESTIONS:
|
||||||
|
- Set the campaign's hopper level to the number of leads your campaign dials in 1-3 minutes, so that the updated rankings will be most effective, especially at session time boundaries
|
||||||
|
- Deactivate lists after all leads have been called your desired amount of times. You can see that by looking at the data table on the List Modify page at the bottom
|
||||||
|
- Set your call quota sessions to be equal lengths of time, and make sure all of your calling hours are covered by your sessions
|
||||||
|
- Do not change your sessions after you have started calling on your campaign
|
||||||
|
- Keep less than 400,000 leads in the lists of a single campaign. Move your unused lists to an inactive campaign
|
||||||
|
- When you start a brand-new campaign, you will have to dial only NEW leads, but after the first day, you should remove NEW from your campaign dialing statuses and use the Call Quota "new_shuffle" setting to shuffle in NEW leads instead. As your campaign progresses, you should be able to change new_shuffle from 2 down to 4, 5 or 6.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------------- SCRIPTS INVOLVED IN THIS FEATURE -----------------------------
|
||||||
|
|
||||||
|
Scripts modified/added:
|
||||||
|
- bin/AST_VDcall_quotas.pl * new script
|
||||||
|
- bin/FastAGI_log.pl
|
||||||
|
- bin/AST_VDauto_dial.pl
|
||||||
|
- bin/AST_VDremote_agents.pl
|
||||||
|
- bin/ADMIN_keepalive_ALL.pl
|
||||||
|
- agi/agi-VDAD_ALL_outbound.agi
|
||||||
|
- www/agc/vdc_db_query.php
|
||||||
|
- www/vicidial/campaign_debug.php
|
||||||
|
|
||||||
|
|
||||||
|
There are two operating modes for the new "AST_VDcall_quotas.pl" script:
|
||||||
|
1. To populate the Call Quota logs for a campaign that has been placing outbound calls but is just now having Call Quotas enabled on it. This needs to be run manually from one of the dialers like this:
|
||||||
|
/usr/share/astguiclient/AST_VDcall_quotas.pl --debugX --populate-call-quota-logs --campaign=TESTCAMP
|
||||||
|
|
||||||
|
2. To perform the ranking of leads within the campaigns where Call Quotas are being used. This is run automatically at least once an hour(as defined in the "call_quota_run_time" Settings Container specified for the campaign) by the system at set intervals on the "Active Voicemail Server" as defined in "System Settings"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The Campaign Debug report(accessible to level 9 users by going to "Reports -> Admin Utilities") will show you debug output from the last time the AST_VDcall_quotas.pl process ran for the campaign at the bottom of the page. Example output:
|
||||||
|
|
||||||
|
Call Quota Lead Ranking Debug: 2019-07-18 09:36:54
|
||||||
|
TESTCAMP CAMPAIGN ACTIVE DIALABLE NEW LEADS COUNT: 17588
|
||||||
|
TESTCAMP CAMPAIGN LISTS RECENTLY DIALED COUNT: 2
|
||||||
|
TESTCAMP CAMPAIGN LEAD RANK UPDATES: 10756
|
||||||
|
TESTCAMP CAMPAIGN LEAD CALLED RESET UPDATES: 3639 (19128)
|
||||||
|
LIST CACHE STATS UPDATED: 99899 TOTAL: 60000 NEW: 17581 DIALABLE NEW: 17581
|
||||||
|
LIST CACHE STATS UPDATED: 107 TOTAL: 59904 NEW: 7 DIALABLE NEW: 7
|
||||||
|
LIST CACHE STATS UPDATED: 222 TOTAL: 1 NEW: 1 DIALABLE NEW: 1
|
||||||
|
LIST CACHE STATS UPDATED: 303 TOTAL: 1 NEW: 1 DIALABLE NEW: 1
|
||||||
|
LIST CACHE STATS UPDATED: 888 TOTAL: 5 NEW: 5 DIALABLE NEW: 5
|
||||||
|
LIST CACHE STATS UPDATED: 929 TOTAL: 0 NEW: 0 DIALABLE NEW: 0
|
||||||
|
LIST CACHE STATS UPDATED: 992 TOTAL: 10 NEW: 0 DIALABLE NEW: 0
|
||||||
|
LIST CACHE STATS UPDATED: 998 TOTAL: 101 NEW: 23 DIALABLE NEW: 8
|
||||||
|
LIST CACHE STATS UPDATED: 1101 TOTAL: 761 NEW: 761 DIALABLE NEW: 761
|
||||||
|
LIST CACHE STATS UPDATED: 10000 TOTAL: 0 NEW: 0 DIALABLE NEW: 0
|
||||||
|
LIST CACHE STATS UPDATED: 10001 TOTAL: 14 NEW: 14 DIALABLE NEW: 14
|
||||||
|
LIST CACHE STATS UPDATED: 10002 TOTAL: 7 NEW: 7 DIALABLE NEW: 7
|
||||||
|
LIST CACHE STATS UPDATED: 10003 TOTAL: 0 NEW: 0 DIALABLE NEW: 0
|
||||||
|
LIST CACHE STATS UPDATED: 10004 TOTAL: 0 NEW: 0 DIALABLE NEW: 0
|
||||||
|
LIST CACHE STATS UPDATED: 11091 TOTAL: 10 NEW: 10 DIALABLE NEW: 10
|
||||||
|
LIST CACHE STATS UPDATED: 89106 TOTAL: 13 NEW: 0 DIALABLE NEW: 0
|
||||||
|
LIST CACHE STATS UPDATED: 223344 TOTAL: 7 NEW: 3 DIALABLE NEW: 3
|
||||||
|
LIST CACHE STATS UPDATED: 334455 TOTAL: 1 NEW: 0 DIALABLE NEW: 0
|
||||||
|
LIST CACHE STATS UPDATED: 373737 TOTAL: 0 NEW: 0 DIALABLE NEW: 0
|
||||||
|
LIST CACHE STATS UPDATED: 999888 TOTAL: 6104 NEW: 0 DIALABLE NEW: 0
|
||||||
|
LIST CACHE STATS UPDATED: 3333301 TOTAL: 15 NEW: 14 DIALABLE NEW: 14
|
||||||
|
LIST CACHE STATS UPDATED: 3333302 TOTAL: 42 NEW: 42 DIALABLE NEW: 42
|
||||||
|
LIST CACHE STATS UPDATED: 3333304 TOTAL: 0 NEW: 0 DIALABLE NEW: 0
|
||||||
|
LIST CACHE STATS UPDATED: 12345678 TOTAL: 3 NEW: 0 DIALABLE NEW: 0
|
||||||
|
LIST CACHE STATS UPDATED: 100000010 TOTAL: 60000 NEW: 59999 DIALABLE NEW: 59999
|
||||||
|
LIST CACHE STATS UPDATED: 100000011 TOTAL: 60000 NEW: 59995 DIALABLE NEW: 59995
|
||||||
|
LIST CACHE STATS UPDATED: 999888999777 TOTAL: 0 NEW: 0 DIALABLE NEW: 0
|
||||||
|
Call Quota run time: 56 seconds
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-------- SQL CHANGES FOR DOCUMENTATION PURPOSES ONLY !!!!!!!!!! DO NOT RUN THESE!!!!! ----------------
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE system_settings ADD call_quota_lead_ranking ENUM('0','1','2') default '0';
|
||||||
|
|
||||||
|
ALTER TABLE vicidial_campaigns ADD auto_active_list_new VARCHAR(20) default 'DISABLED';
|
||||||
|
ALTER TABLE vicidial_campaigns ADD call_quota_lead_ranking VARCHAR(20) default 'DISABLED';
|
||||||
|
ALTER TABLE vicidial_campaigns ADD call_quota_process_running TINYINT(3) default '0';
|
||||||
|
ALTER TABLE vicidial_campaigns ADD call_quota_last_run_date DATETIME;
|
||||||
|
|
||||||
|
ALTER TABLE vicidial_lists ADD auto_active_list_rank SMALLINT(5) default '0';
|
||||||
|
ALTER TABLE vicidial_lists ADD cache_count INT(9) UNSIGNED default '0';
|
||||||
|
ALTER TABLE vicidial_lists ADD cache_count_new INT(9) UNSIGNED default '0';
|
||||||
|
ALTER TABLE vicidial_lists ADD cache_count_dialable_new INT(9) UNSIGNED default '0';
|
||||||
|
ALTER TABLE vicidial_lists ADD cache_date DATETIME;
|
||||||
|
|
||||||
|
CREATE TABLE vicidial_lead_call_quota_counts (
|
||||||
|
lead_id INT(9) UNSIGNED NOT NULL,
|
||||||
|
list_id BIGINT(14) UNSIGNED DEFAULT '0',
|
||||||
|
first_call_date DATETIME,
|
||||||
|
last_call_date DATETIME,
|
||||||
|
status VARCHAR(6),
|
||||||
|
called_count SMALLINT(5) UNSIGNED default '0',
|
||||||
|
session_one_calls TINYINT(3) default '0',
|
||||||
|
session_two_calls TINYINT(3) default '0',
|
||||||
|
session_three_calls TINYINT(3) default '0',
|
||||||
|
session_four_calls TINYINT(3) default '0',
|
||||||
|
session_five_calls TINYINT(3) default '0',
|
||||||
|
session_six_calls TINYINT(3) default '0',
|
||||||
|
day_one_calls TINYINT(3) default '0',
|
||||||
|
day_two_calls TINYINT(3) default '0',
|
||||||
|
day_three_calls TINYINT(3) default '0',
|
||||||
|
day_four_calls TINYINT(3) default '0',
|
||||||
|
day_five_calls TINYINT(3) default '0',
|
||||||
|
day_six_calls TINYINT(3) default '0',
|
||||||
|
day_seven_calls TINYINT(3) default '0',
|
||||||
|
session_one_today_calls TINYINT(3) default '0',
|
||||||
|
session_two_today_calls TINYINT(3) default '0',
|
||||||
|
session_three_today_calls TINYINT(3) default '0',
|
||||||
|
session_four_today_calls TINYINT(3) default '0',
|
||||||
|
session_five_today_calls TINYINT(3) default '0',
|
||||||
|
session_six_today_calls TINYINT(3) default '0',
|
||||||
|
rank SMALLINT(5) NOT NULL default '0',
|
||||||
|
modify_date DATETIME,
|
||||||
|
unique index vlcqc_lead_list (lead_id, list_id),
|
||||||
|
index(last_call_date),
|
||||||
|
index(list_id),
|
||||||
|
index(modify_date)
|
||||||
|
) ENGINE=MyISAM;
|
||||||
|
|
||||||
|
CREATE TABLE vicidial_lead_call_quota_counts_archive (
|
||||||
|
lead_id INT(9) UNSIGNED NOT NULL,
|
||||||
|
list_id BIGINT(14) UNSIGNED DEFAULT '0',
|
||||||
|
first_call_date DATETIME,
|
||||||
|
last_call_date DATETIME,
|
||||||
|
status VARCHAR(6),
|
||||||
|
called_count SMALLINT(5) UNSIGNED default '0',
|
||||||
|
session_one_calls TINYINT(3) default '0',
|
||||||
|
session_two_calls TINYINT(3) default '0',
|
||||||
|
session_three_calls TINYINT(3) default '0',
|
||||||
|
session_four_calls TINYINT(3) default '0',
|
||||||
|
session_five_calls TINYINT(3) default '0',
|
||||||
|
session_six_calls TINYINT(3) default '0',
|
||||||
|
day_one_calls TINYINT(3) default '0',
|
||||||
|
day_two_calls TINYINT(3) default '0',
|
||||||
|
day_three_calls TINYINT(3) default '0',
|
||||||
|
day_four_calls TINYINT(3) default '0',
|
||||||
|
day_five_calls TINYINT(3) default '0',
|
||||||
|
day_six_calls TINYINT(3) default '0',
|
||||||
|
day_seven_calls TINYINT(3) default '0',
|
||||||
|
session_one_today_calls TINYINT(3) default '0',
|
||||||
|
session_two_today_calls TINYINT(3) default '0',
|
||||||
|
session_three_today_calls TINYINT(3) default '0',
|
||||||
|
session_four_today_calls TINYINT(3) default '0',
|
||||||
|
session_five_today_calls TINYINT(3) default '0',
|
||||||
|
session_six_today_calls TINYINT(3) default '0',
|
||||||
|
rank SMALLINT(5) NOT NULL default '0',
|
||||||
|
modify_date DATETIME,
|
||||||
|
unique index vlcqc_lead_date (lead_id, first_call_date),
|
||||||
|
index(first_call_date)
|
||||||
|
) ENGINE=MyISAM;
|
||||||
|
|
||||||
@@ -35,8 +35,8 @@ dtmf_send_extension VARCHAR(100) default 'local/8500998@default',
|
|||||||
call_out_number_group VARCHAR(100) default 'Zap/g2/',
|
call_out_number_group VARCHAR(100) default 'Zap/g2/',
|
||||||
client_browser VARCHAR(100) default '/usr/bin/mozilla',
|
client_browser VARCHAR(100) default '/usr/bin/mozilla',
|
||||||
install_directory VARCHAR(100) default '/usr/local/perl_TK',
|
install_directory VARCHAR(100) default '/usr/local/perl_TK',
|
||||||
local_web_callerID_URL VARCHAR(255) default 'http://astguiclient.sf.net/test_callerid_output.php',
|
local_web_callerID_URL VARCHAR(255) default 'http://www.vicidial.org/test_callerid_output.php',
|
||||||
VICIDIAL_web_URL VARCHAR(255) default 'http://astguiclient.sf.net/test_VICIDIAL_output.php',
|
VICIDIAL_web_URL VARCHAR(255) default 'http://www.vicidial.org/test_VICIDIAL_output.php',
|
||||||
AGI_call_logging_enabled ENUM('0','1') default '1',
|
AGI_call_logging_enabled ENUM('0','1') default '1',
|
||||||
user_switching_enabled ENUM('0','1') default '1',
|
user_switching_enabled ENUM('0','1') default '1',
|
||||||
conferencing_enabled ENUM('0','1') default '1',
|
conferencing_enabled ENUM('0','1') default '1',
|
||||||
@@ -1019,7 +1019,11 @@ scheduled_callbacks_timezones_container VARCHAR(40) default 'DISABLED',
|
|||||||
three_way_volume_buttons VARCHAR(20) default 'ENABLED',
|
three_way_volume_buttons VARCHAR(20) default 'ENABLED',
|
||||||
callback_dnc ENUM('ENABLED','DISABLED') default 'DISABLED',
|
callback_dnc ENUM('ENABLED','DISABLED') default 'DISABLED',
|
||||||
manual_dial_validation ENUM('Y','N') default 'N',
|
manual_dial_validation ENUM('Y','N') default 'N',
|
||||||
mute_recordings ENUM('Y','N') default 'N'
|
mute_recordings ENUM('Y','N') default 'N',
|
||||||
|
auto_active_list_new VARCHAR(20) default 'DISABLED',
|
||||||
|
call_quota_lead_ranking VARCHAR(20) default 'DISABLED',
|
||||||
|
call_quota_process_running TINYINT(3) default '0',
|
||||||
|
call_quota_last_run_date DATETIME
|
||||||
) ENGINE=MyISAM;
|
) ENGINE=MyISAM;
|
||||||
|
|
||||||
CREATE TABLE vicidial_lists (
|
CREATE TABLE vicidial_lists (
|
||||||
@@ -1053,7 +1057,11 @@ user_new_lead_limit SMALLINT(5) default '-1',
|
|||||||
inbound_list_script_override VARCHAR(20),
|
inbound_list_script_override VARCHAR(20),
|
||||||
default_xfer_group VARCHAR(20) default '---NONE---',
|
default_xfer_group VARCHAR(20) default '---NONE---',
|
||||||
daily_reset_limit SMALLINT(5) default '-1',
|
daily_reset_limit SMALLINT(5) default '-1',
|
||||||
resets_today SMALLINT(5) UNSIGNED default '0'
|
resets_today SMALLINT(5) UNSIGNED default '0',
|
||||||
|
auto_active_list_rank SMALLINT(5) default '0',
|
||||||
|
cache_count INT(9) UNSIGNED default '0',
|
||||||
|
cache_count_new INT(9) UNSIGNED default '0',
|
||||||
|
cache_date DATETIME
|
||||||
) ENGINE=MyISAM;
|
) ENGINE=MyISAM;
|
||||||
|
|
||||||
CREATE TABLE vicidial_statuses (
|
CREATE TABLE vicidial_statuses (
|
||||||
@@ -1815,7 +1823,8 @@ manual_dial_validation ENUM('0','1','2','3','4') default '0',
|
|||||||
mute_recordings ENUM('1','0') default '0',
|
mute_recordings ENUM('1','0') default '0',
|
||||||
user_admin_redirect ENUM('1','0') default '0',
|
user_admin_redirect ENUM('1','0') default '0',
|
||||||
list_status_modification_confirmation ENUM('1','0') default '0',
|
list_status_modification_confirmation ENUM('1','0') default '0',
|
||||||
sip_event_logging ENUM('0','1','2','3','4','5','6','7') default '0'
|
sip_event_logging ENUM('0','1','2','3','4','5','6','7') default '0',
|
||||||
|
call_quota_lead_ranking ENUM('0','1','2') default '0'
|
||||||
) ENGINE=MyISAM;
|
) ENGINE=MyISAM;
|
||||||
|
|
||||||
CREATE TABLE vicidial_campaigns_list_mix (
|
CREATE TABLE vicidial_campaigns_list_mix (
|
||||||
@@ -4099,6 +4108,72 @@ index(call_date),
|
|||||||
index(caller_code)
|
index(caller_code)
|
||||||
) ENGINE=MyISAM;
|
) ENGINE=MyISAM;
|
||||||
|
|
||||||
|
CREATE TABLE vicidial_lead_call_quota_counts (
|
||||||
|
lead_id INT(9) UNSIGNED NOT NULL,
|
||||||
|
list_id BIGINT(14) UNSIGNED DEFAULT '0',
|
||||||
|
first_call_date DATETIME,
|
||||||
|
last_call_date DATETIME,
|
||||||
|
status VARCHAR(6),
|
||||||
|
called_count SMALLINT(5) UNSIGNED default '0',
|
||||||
|
session_one_calls TINYINT(3) default '0',
|
||||||
|
session_two_calls TINYINT(3) default '0',
|
||||||
|
session_three_calls TINYINT(3) default '0',
|
||||||
|
session_four_calls TINYINT(3) default '0',
|
||||||
|
session_five_calls TINYINT(3) default '0',
|
||||||
|
session_six_calls TINYINT(3) default '0',
|
||||||
|
day_one_calls TINYINT(3) default '0',
|
||||||
|
day_two_calls TINYINT(3) default '0',
|
||||||
|
day_three_calls TINYINT(3) default '0',
|
||||||
|
day_four_calls TINYINT(3) default '0',
|
||||||
|
day_five_calls TINYINT(3) default '0',
|
||||||
|
day_six_calls TINYINT(3) default '0',
|
||||||
|
day_seven_calls TINYINT(3) default '0',
|
||||||
|
session_one_today_calls TINYINT(3) default '0',
|
||||||
|
session_two_today_calls TINYINT(3) default '0',
|
||||||
|
session_three_today_calls TINYINT(3) default '0',
|
||||||
|
session_four_today_calls TINYINT(3) default '0',
|
||||||
|
session_five_today_calls TINYINT(3) default '0',
|
||||||
|
session_six_today_calls TINYINT(3) default '0',
|
||||||
|
rank SMALLINT(5) NOT NULL default '0',
|
||||||
|
modify_date DATETIME,
|
||||||
|
unique index vlcqc_lead_list (lead_id, list_id),
|
||||||
|
index(last_call_date),
|
||||||
|
index(list_id),
|
||||||
|
index(modify_date)
|
||||||
|
) ENGINE=MyISAM;
|
||||||
|
|
||||||
|
CREATE TABLE vicidial_lead_call_quota_counts_archive (
|
||||||
|
lead_id INT(9) UNSIGNED NOT NULL,
|
||||||
|
list_id BIGINT(14) UNSIGNED DEFAULT '0',
|
||||||
|
first_call_date DATETIME,
|
||||||
|
last_call_date DATETIME,
|
||||||
|
status VARCHAR(6),
|
||||||
|
called_count SMALLINT(5) UNSIGNED default '0',
|
||||||
|
session_one_calls TINYINT(3) default '0',
|
||||||
|
session_two_calls TINYINT(3) default '0',
|
||||||
|
session_three_calls TINYINT(3) default '0',
|
||||||
|
session_four_calls TINYINT(3) default '0',
|
||||||
|
session_five_calls TINYINT(3) default '0',
|
||||||
|
session_six_calls TINYINT(3) default '0',
|
||||||
|
day_one_calls TINYINT(3) default '0',
|
||||||
|
day_two_calls TINYINT(3) default '0',
|
||||||
|
day_three_calls TINYINT(3) default '0',
|
||||||
|
day_four_calls TINYINT(3) default '0',
|
||||||
|
day_five_calls TINYINT(3) default '0',
|
||||||
|
day_six_calls TINYINT(3) default '0',
|
||||||
|
day_seven_calls TINYINT(3) default '0',
|
||||||
|
session_one_today_calls TINYINT(3) default '0',
|
||||||
|
session_two_today_calls TINYINT(3) default '0',
|
||||||
|
session_three_today_calls TINYINT(3) default '0',
|
||||||
|
session_four_today_calls TINYINT(3) default '0',
|
||||||
|
session_five_today_calls TINYINT(3) default '0',
|
||||||
|
session_six_today_calls TINYINT(3) default '0',
|
||||||
|
rank SMALLINT(5) NOT NULL default '0',
|
||||||
|
modify_date DATETIME,
|
||||||
|
unique index vlcqc_lead_date (lead_id, first_call_date),
|
||||||
|
index(first_call_date)
|
||||||
|
) ENGINE=MyISAM;
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE vicidial_email_list MODIFY message text character set utf8;
|
ALTER TABLE vicidial_email_list MODIFY message text character set utf8;
|
||||||
|
|
||||||
@@ -4421,4 +4496,4 @@ INSERT INTO vicidial_settings_containers(container_id,container_notes,container_
|
|||||||
|
|
||||||
UPDATE system_settings set vdc_agent_api_active='1';
|
UPDATE system_settings set vdc_agent_api_active='1';
|
||||||
|
|
||||||
UPDATE system_settings SET db_schema_version='1572',db_schema_update_date=NOW(),reload_timestamp=NOW();
|
UPDATE system_settings SET db_schema_version='1573',db_schema_update_date=NOW(),reload_timestamp=NOW();
|
||||||
|
|||||||
@@ -932,3 +932,84 @@ CREATE INDEX vicidial_email_xfer_key on vicidial_email_list (xfercallid);
|
|||||||
ALTER TABLE vicidial_campaigns MODIFY agent_screen_time_display VARCHAR(40) default 'DISABLED';
|
ALTER TABLE vicidial_campaigns MODIFY agent_screen_time_display VARCHAR(40) default 'DISABLED';
|
||||||
|
|
||||||
UPDATE system_settings SET db_schema_version='1572',db_schema_update_date=NOW() where db_schema_version < 1572;
|
UPDATE system_settings SET db_schema_version='1572',db_schema_update_date=NOW() where db_schema_version < 1572;
|
||||||
|
|
||||||
|
ALTER TABLE system_settings ADD call_quota_lead_ranking ENUM('0','1','2') default '0';
|
||||||
|
|
||||||
|
ALTER TABLE vicidial_campaigns ADD auto_active_list_new VARCHAR(20) default 'DISABLED';
|
||||||
|
ALTER TABLE vicidial_campaigns ADD call_quota_lead_ranking VARCHAR(20) default 'DISABLED';
|
||||||
|
ALTER TABLE vicidial_campaigns ADD call_quota_process_running TINYINT(3) default '0';
|
||||||
|
ALTER TABLE vicidial_campaigns ADD call_quota_last_run_date DATETIME;
|
||||||
|
|
||||||
|
ALTER TABLE vicidial_lists ADD auto_active_list_rank SMALLINT(5) default '0';
|
||||||
|
ALTER TABLE vicidial_lists ADD cache_count INT(9) UNSIGNED default '0';
|
||||||
|
ALTER TABLE vicidial_lists ADD cache_count_new INT(9) UNSIGNED default '0';
|
||||||
|
ALTER TABLE vicidial_lists ADD cache_count_dialable_new INT(9) UNSIGNED default '0';
|
||||||
|
ALTER TABLE vicidial_lists ADD cache_date DATETIME;
|
||||||
|
|
||||||
|
CREATE TABLE vicidial_lead_call_quota_counts (
|
||||||
|
lead_id INT(9) UNSIGNED NOT NULL,
|
||||||
|
list_id BIGINT(14) UNSIGNED DEFAULT '0',
|
||||||
|
first_call_date DATETIME,
|
||||||
|
last_call_date DATETIME,
|
||||||
|
status VARCHAR(6),
|
||||||
|
called_count SMALLINT(5) UNSIGNED default '0',
|
||||||
|
session_one_calls TINYINT(3) default '0',
|
||||||
|
session_two_calls TINYINT(3) default '0',
|
||||||
|
session_three_calls TINYINT(3) default '0',
|
||||||
|
session_four_calls TINYINT(3) default '0',
|
||||||
|
session_five_calls TINYINT(3) default '0',
|
||||||
|
session_six_calls TINYINT(3) default '0',
|
||||||
|
day_one_calls TINYINT(3) default '0',
|
||||||
|
day_two_calls TINYINT(3) default '0',
|
||||||
|
day_three_calls TINYINT(3) default '0',
|
||||||
|
day_four_calls TINYINT(3) default '0',
|
||||||
|
day_five_calls TINYINT(3) default '0',
|
||||||
|
day_six_calls TINYINT(3) default '0',
|
||||||
|
day_seven_calls TINYINT(3) default '0',
|
||||||
|
session_one_today_calls TINYINT(3) default '0',
|
||||||
|
session_two_today_calls TINYINT(3) default '0',
|
||||||
|
session_three_today_calls TINYINT(3) default '0',
|
||||||
|
session_four_today_calls TINYINT(3) default '0',
|
||||||
|
session_five_today_calls TINYINT(3) default '0',
|
||||||
|
session_six_today_calls TINYINT(3) default '0',
|
||||||
|
rank SMALLINT(5) NOT NULL default '0',
|
||||||
|
modify_date DATETIME,
|
||||||
|
unique index vlcqc_lead_list (lead_id, list_id),
|
||||||
|
index(last_call_date),
|
||||||
|
index(list_id),
|
||||||
|
index(modify_date)
|
||||||
|
) ENGINE=MyISAM;
|
||||||
|
|
||||||
|
CREATE TABLE vicidial_lead_call_quota_counts_archive (
|
||||||
|
lead_id INT(9) UNSIGNED NOT NULL,
|
||||||
|
list_id BIGINT(14) UNSIGNED DEFAULT '0',
|
||||||
|
first_call_date DATETIME,
|
||||||
|
last_call_date DATETIME,
|
||||||
|
status VARCHAR(6),
|
||||||
|
called_count SMALLINT(5) UNSIGNED default '0',
|
||||||
|
session_one_calls TINYINT(3) default '0',
|
||||||
|
session_two_calls TINYINT(3) default '0',
|
||||||
|
session_three_calls TINYINT(3) default '0',
|
||||||
|
session_four_calls TINYINT(3) default '0',
|
||||||
|
session_five_calls TINYINT(3) default '0',
|
||||||
|
session_six_calls TINYINT(3) default '0',
|
||||||
|
day_one_calls TINYINT(3) default '0',
|
||||||
|
day_two_calls TINYINT(3) default '0',
|
||||||
|
day_three_calls TINYINT(3) default '0',
|
||||||
|
day_four_calls TINYINT(3) default '0',
|
||||||
|
day_five_calls TINYINT(3) default '0',
|
||||||
|
day_six_calls TINYINT(3) default '0',
|
||||||
|
day_seven_calls TINYINT(3) default '0',
|
||||||
|
session_one_today_calls TINYINT(3) default '0',
|
||||||
|
session_two_today_calls TINYINT(3) default '0',
|
||||||
|
session_three_today_calls TINYINT(3) default '0',
|
||||||
|
session_four_today_calls TINYINT(3) default '0',
|
||||||
|
session_five_today_calls TINYINT(3) default '0',
|
||||||
|
session_six_today_calls TINYINT(3) default '0',
|
||||||
|
rank SMALLINT(5) NOT NULL default '0',
|
||||||
|
modify_date DATETIME,
|
||||||
|
unique index vlcqc_lead_date (lead_id, first_call_date),
|
||||||
|
index(first_call_date)
|
||||||
|
) ENGINE=MyISAM;
|
||||||
|
|
||||||
|
UPDATE system_settings SET db_schema_version='1573',db_schema_update_date=NOW() where db_schema_version < 1573;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
+272
-4
@@ -475,10 +475,11 @@
|
|||||||
# 190524-1142 - Added gmt_offset population to new manual dialed leads
|
# 190524-1142 - Added gmt_offset population to new manual dialed leads
|
||||||
# 190531-1045 - Added sip_event_logging
|
# 190531-1045 - Added sip_event_logging
|
||||||
# 190627-1535 - Added new options for campaign agent_screen_time_display feature
|
# 190627-1535 - Added new options for campaign agent_screen_time_display feature
|
||||||
|
# 190709-1846 - Added Call Quota logging
|
||||||
#
|
#
|
||||||
|
|
||||||
$version = '2.14-369';
|
$version = '2.14-370';
|
||||||
$build = '190627-1535';
|
$build = '190709-1846';
|
||||||
$php_script = 'vdc_db_query.php';
|
$php_script = 'vdc_db_query.php';
|
||||||
$mel=1; # Mysql Error Log enabled = 1
|
$mel=1; # Mysql Error Log enabled = 1
|
||||||
$mysql_log_count=797;
|
$mysql_log_count=797;
|
||||||
@@ -954,7 +955,7 @@ $sip_hangup_cause_dictionary = array(
|
|||||||
|
|
||||||
#############################################
|
#############################################
|
||||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||||
$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db,qc_features_active,allow_emails,callback_time_24hour,enable_languages,language_method,agent_debug_logging,default_language,active_modules,allow_chats,default_phone_code,user_new_lead_limit,sip_event_logging FROM system_settings;";
|
$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db,qc_features_active,allow_emails,callback_time_24hour,enable_languages,language_method,agent_debug_logging,default_language,active_modules,allow_chats,default_phone_code,user_new_lead_limit,sip_event_logging,call_quota_lead_ranking FROM system_settings;";
|
||||||
$rslt=mysql_to_mysqli($stmt, $link);
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log);}
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
if ($DB) {echo "$stmt\n";}
|
if ($DB) {echo "$stmt\n";}
|
||||||
@@ -982,6 +983,7 @@ if ($qm_conf_ct > 0)
|
|||||||
$default_phone_code = $row[17];
|
$default_phone_code = $row[17];
|
||||||
$SSuser_new_lead_limit = $row[18];
|
$SSuser_new_lead_limit = $row[18];
|
||||||
$SSsip_event_logging = $row[19];
|
$SSsip_event_logging = $row[19];
|
||||||
|
$SScall_quota_lead_ranking = $row[20];
|
||||||
}
|
}
|
||||||
##### END SETTINGS LOOKUP #####
|
##### END SETTINGS LOOKUP #####
|
||||||
###########################################
|
###########################################
|
||||||
@@ -12186,7 +12188,7 @@ if ($ACTION == 'updateDISPO')
|
|||||||
}
|
}
|
||||||
### END Call Notes Logging ###
|
### END Call Notes Logging ###
|
||||||
|
|
||||||
$stmt="SELECT auto_alt_dial_statuses,use_internal_dnc,use_campaign_dnc,api_manual_dial,use_other_campaign_dnc from vicidial_campaigns where campaign_id='$campaign';";
|
$stmt="SELECT auto_alt_dial_statuses,use_internal_dnc,use_campaign_dnc,api_manual_dial,use_other_campaign_dnc,call_quota_lead_ranking from vicidial_campaigns where campaign_id='$campaign';";
|
||||||
$rslt=mysql_to_mysqli($stmt, $link);
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00155',$user,$server_ip,$session_name,$one_mysql_log);}
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00155',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
$row=mysqli_fetch_row($rslt);
|
$row=mysqli_fetch_row($rslt);
|
||||||
@@ -12195,7 +12197,272 @@ if ($ACTION == 'updateDISPO')
|
|||||||
$use_campaign_dnc = $row[2];
|
$use_campaign_dnc = $row[2];
|
||||||
$api_manual_dial = $row[3];
|
$api_manual_dial = $row[3];
|
||||||
$use_other_campaign_dnc = $row[4];
|
$use_other_campaign_dnc = $row[4];
|
||||||
|
$call_quota_lead_ranking = $row[5];
|
||||||
|
|
||||||
|
|
||||||
|
### BEGIN Call Quota Lead Renking logging ###
|
||||||
|
$fp = fopen ("./CQdebug_log.txt", "a");
|
||||||
|
fwrite ($fp, "$NOW_TIME CQ-Debug 0: $call_quota_lead_ranking|$call_type|\n");
|
||||||
|
fclose($fp);
|
||||||
|
if ( ($call_quota_lead_ranking != 'DISABLED') and ($call_type == 'OUT') and ($SScall_quota_lead_ranking > 0) )
|
||||||
|
{
|
||||||
|
$call_quota_sessions_valid=0;
|
||||||
|
$call_in_session=0;
|
||||||
|
$zero_rank_after_call=0;
|
||||||
|
# Gather details on the campaign's Call Quota settings container
|
||||||
|
$stmt = "SELECT container_entry FROM vicidial_settings_containers where container_id='$call_quota_lead_ranking';";
|
||||||
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
if ($DB) {echo "$stmt\n";}
|
||||||
|
$SCinfo_ct = mysqli_num_rows($rslt);
|
||||||
|
if ($SCinfo_ct > 0)
|
||||||
|
{
|
||||||
|
$row=mysqli_fetch_row($rslt);
|
||||||
|
$CQcontainer_entry = $row[0];
|
||||||
|
$CQcontainer_entry = preg_replace("/\r|\t|\'|\"| /",'',$CQcontainer_entry);
|
||||||
|
$call_quota_settings = explode("\n",$CQcontainer_entry);
|
||||||
|
$call_quota_settings_ct = count($call_quota_settings);
|
||||||
|
$cql=0;
|
||||||
|
while ($call_quota_settings_ct >= $cql)
|
||||||
|
{
|
||||||
|
if (preg_match("/^zero_rank_after_call=>/",$call_quota_settings[$cql]))
|
||||||
|
{
|
||||||
|
$call_quota_settings[$cql] = preg_replace("/zero_rank_after_call=>/",'',$call_quota_settings[$cql]);
|
||||||
|
$zero_rank_after_call = $call_quota_settings[$cql];
|
||||||
|
}
|
||||||
|
if (preg_match("/^session_one=>/",$call_quota_settings[$cql]))
|
||||||
|
{
|
||||||
|
$call_quota_settings[$cql] = preg_replace("/^session_one=>/",'',$call_quota_settings[$cql]);
|
||||||
|
$call_quota_line = explode(",",$call_quota_settings[$cql]);
|
||||||
|
$session_one_start = $call_quota_line[0];
|
||||||
|
$session_one_end = $call_quota_line[1];
|
||||||
|
$call_quota_sessions_valid++;
|
||||||
|
}
|
||||||
|
if (preg_match("/^session_two=>/",$call_quota_settings[$cql]))
|
||||||
|
{
|
||||||
|
$call_quota_settings[$cql] = preg_replace("/^session_two=>/",'',$call_quota_settings[$cql]);
|
||||||
|
$call_quota_line = explode(",",$call_quota_settings[$cql]);
|
||||||
|
$session_two_start = $call_quota_line[0];
|
||||||
|
$session_two_end = $call_quota_line[1];
|
||||||
|
$call_quota_sessions_valid++;
|
||||||
|
}
|
||||||
|
if (preg_match("/^session_three=>/",$call_quota_settings[$cql]))
|
||||||
|
{
|
||||||
|
$call_quota_settings[$cql] = preg_replace("/^session_three=>/",'',$call_quota_settings[$cql]);
|
||||||
|
$call_quota_line = explode(",",$call_quota_settings[$cql]);
|
||||||
|
$session_three_start = $call_quota_line[0];
|
||||||
|
$session_three_end = $call_quota_line[1];
|
||||||
|
$call_quota_sessions_valid++;
|
||||||
|
}
|
||||||
|
if (preg_match("/^session_four=>/",$call_quota_settings[$cql]))
|
||||||
|
{
|
||||||
|
$call_quota_settings[$cql] = preg_replace("/^session_four=>/",'',$call_quota_settings[$cql]);
|
||||||
|
$call_quota_line = explode(",",$call_quota_settings[$cql]);
|
||||||
|
$session_four_start = $call_quota_line[0];
|
||||||
|
$session_four_end = $call_quota_line[1];
|
||||||
|
$call_quota_sessions_valid++;
|
||||||
|
}
|
||||||
|
if (preg_match("/^session_five=>/",$call_quota_settings[$cql]))
|
||||||
|
{
|
||||||
|
$call_quota_settings[$cql] = preg_replace("/^session_five=>/",'',$call_quota_settings[$cql]);
|
||||||
|
$call_quota_line = explode(",",$call_quota_settings[$cql]);
|
||||||
|
$session_five_start = $call_quota_line[0];
|
||||||
|
$session_five_end = $call_quota_line[1];
|
||||||
|
$call_quota_sessions_valid++;
|
||||||
|
}
|
||||||
|
if (preg_match("/^session_six=>/",$call_quota_settings[$cql]))
|
||||||
|
{
|
||||||
|
$call_quota_settings[$cql] = preg_replace("/^session_six=>/",'',$call_quota_settings[$cql]);
|
||||||
|
$call_quota_line = explode(",",$call_quota_settings[$cql]);
|
||||||
|
$session_six_start = $call_quota_line[0];
|
||||||
|
$session_six_end = $call_quota_line[1];
|
||||||
|
$call_quota_sessions_valid++;
|
||||||
|
}
|
||||||
|
$cql++;
|
||||||
|
}
|
||||||
|
$fp = fopen ("./CQdebug_log.txt", "a");
|
||||||
|
fwrite ($fp, "$NOW_TIME CQ-Debug 1: $call_quota_settings_ct|$call_quota_lead_ranking|$call_quota_sessions_valid|\n");
|
||||||
|
fclose($fp);
|
||||||
|
|
||||||
|
if ($call_quota_sessions_valid > 0)
|
||||||
|
{
|
||||||
|
# Gather list ID and called count for this lead
|
||||||
|
$stmt = "SELECT list_id,called_count,rank FROM vicidial_list where lead_id='$lead_id';";
|
||||||
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
if ($DB) {echo "$stmt\n";}
|
||||||
|
$VLinfo_ct = mysqli_num_rows($rslt);
|
||||||
|
if ($VLinfo_ct > 0)
|
||||||
|
{
|
||||||
|
$row=mysqli_fetch_row($rslt);
|
||||||
|
$VLlist_id = $row[0];
|
||||||
|
$VLcalled_count = $row[1];
|
||||||
|
$VLrank = $row[2];
|
||||||
|
$tempVLrank = $VLrank;
|
||||||
|
if ( ($zero_rank_after_call > 0) and ($VLrank > 0) ) {$tempVLrank=0;}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Gather the date/time this call was dialed
|
||||||
|
$stmt = "SELECT call_date from vicidial_dial_log where lead_id='$lead_id' and call_date > \"$four_hours_ago\" and caller_code LIKE \"%$lead_id\" order by call_date desc limit 1;";
|
||||||
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
if ($DB) {echo "$stmt\n";}
|
||||||
|
$VDLinfo_ct = mysqli_num_rows($rslt);
|
||||||
|
if ($VDLinfo_ct > 0)
|
||||||
|
{
|
||||||
|
$row=mysqli_fetch_row($rslt);
|
||||||
|
$VDLcall_datetime = $row[0];
|
||||||
|
|
||||||
|
$VDLcall_datetimeARY = explode(" ",$VDLcall_datetime);
|
||||||
|
$VDLcall_timeARY = explode(":",$VDLcall_datetimeARY[1]);
|
||||||
|
$VDLcall_hourmin = "$VDLcall_timeARY[0]$VDLcall_timeARY[1]";
|
||||||
|
|
||||||
|
if ( ($session_one_start <= $VDLcall_hourmin) and ($session_one_end > $VDLcall_hourmin) )
|
||||||
|
{
|
||||||
|
$call_in_session=1;
|
||||||
|
$session_newSQL=",session_one_calls='1',session_one_today_calls='1'";
|
||||||
|
$session_updateSQL=",session_one_calls=(session_one_calls + 1),session_one_today_calls=(session_one_today_calls + 1)";
|
||||||
|
}
|
||||||
|
if ( ($session_two_start <= $VDLcall_hourmin) and ($session_two_end > $VDLcall_hourmin) )
|
||||||
|
{
|
||||||
|
$call_in_session=2;
|
||||||
|
$session_newSQL=",session_two_calls='1',session_two_today_calls='1'";
|
||||||
|
$session_updateSQL=",session_two_calls=(session_two_calls + 1),session_two_today_calls=(session_two_today_calls + 1)";
|
||||||
|
}
|
||||||
|
if ( ($session_three_start <= $VDLcall_hourmin) and ($session_three_end > $VDLcall_hourmin) )
|
||||||
|
{
|
||||||
|
$call_in_session=3;
|
||||||
|
$session_newSQL=",session_three_calls='1',session_three_today_calls='1'";
|
||||||
|
$session_updateSQL=",session_three_calls=(session_three_calls + 1),session_three_today_calls=(session_three_today_calls + 1)";
|
||||||
|
}
|
||||||
|
if ( ($session_four_start <= $VDLcall_hourmin) and ($session_four_end > $VDLcall_hourmin) )
|
||||||
|
{
|
||||||
|
$call_in_session=4;
|
||||||
|
$session_newSQL=",session_four_calls='1',session_four_today_calls='1'";
|
||||||
|
$session_updateSQL=",session_four_calls=(session_four_calls + 1),session_four_today_calls=(session_four_today_calls + 1)";
|
||||||
|
}
|
||||||
|
if ( ($session_five_start <= $VDLcall_hourmin) and ($session_five_end > $VDLcall_hourmin) )
|
||||||
|
{
|
||||||
|
$call_in_session=5;
|
||||||
|
$session_newSQL=",session_five_calls='1',session_five_today_calls='1'";
|
||||||
|
$session_updateSQL=",session_five_calls=(session_five_calls + 1),session_five_today_calls=(session_five_today_calls + 1)";
|
||||||
|
}
|
||||||
|
if ( ($session_six_start <= $VDLcall_hourmin) and ($session_six_end > $VDLcall_hourmin) )
|
||||||
|
{
|
||||||
|
$call_in_session=6;
|
||||||
|
$session_newSQL=",session_six_calls='1',session_six_today_calls='1'";
|
||||||
|
$session_updateSQL=",session_six_calls=(session_six_calls + 1),session_six_today_calls=(session_six_today_calls + 1)";
|
||||||
|
}
|
||||||
|
|
||||||
|
$fp = fopen ("./CQdebug_log.txt", "a");
|
||||||
|
fwrite ($fp, "$NOW_TIME CQ-Debug 2: $VDLcall_datetime|$VDLcall_hourmin|$timeclock_end_of_day|$session_one_start|$session_one_end|$call_in_session|\n");
|
||||||
|
fclose($fp);
|
||||||
|
|
||||||
|
if ($call_in_session > 0)
|
||||||
|
{
|
||||||
|
if (strlen($timeclock_end_of_day) < 1) {$timeclock_end_of_day='0000';}
|
||||||
|
$timeclock_end_of_day_hour = (substr($timeclock_end_of_day, 0, 2) + 0);
|
||||||
|
$timeclock_end_of_day_min = (substr($timeclock_end_of_day, 2, 2) + 0);
|
||||||
|
$today_start_epoch = mktime($timeclock_end_of_day_hour,$timeclock_end_of_day_min,date("s"),date("m"),date("d"),date("Y"));
|
||||||
|
if ($timeclock_end_of_day > $VDLcall_hourmin)
|
||||||
|
{$today_start_epoch = mktime($timeclock_end_of_day_hour,$timeclock_end_of_day_min,date("s"),date("m"),date("d")-1,date("Y"));}
|
||||||
|
$day_two_start_epoch = ($today_start_epoch - (86400 * 1));
|
||||||
|
$day_three_start_epoch = ($today_start_epoch - (86400 * 2));
|
||||||
|
$day_four_start_epoch = ($today_start_epoch - (86400 * 3));
|
||||||
|
$day_five_start_epoch = ($today_start_epoch - (86400 * 4));
|
||||||
|
$day_six_start_epoch = ($today_start_epoch - (86400 * 5));
|
||||||
|
$day_seven_start_epoch = ($today_start_epoch - (86400 * 6));
|
||||||
|
|
||||||
|
# Gather the details on existing vicidial_lead_call_quota_counts for this lead, if there is one
|
||||||
|
$stmt = "SELECT first_call_date,UNIX_TIMESTAMP(first_call_date),last_call_date from vicidial_lead_call_quota_counts where lead_id='$lead_id' and list_id='$VLlist_id';";
|
||||||
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
if ($DB) {echo "$stmt\n";}
|
||||||
|
$VLCQCinfo_ct = mysqli_num_rows($rslt);
|
||||||
|
if ($VLCQCinfo_ct > 0)
|
||||||
|
{
|
||||||
|
$row=mysqli_fetch_row($rslt);
|
||||||
|
$VLCQCfirst_call_datetime = $row[0];
|
||||||
|
$VLCQCfirst_call_epoch = $row[1];
|
||||||
|
$VLCQClast_call_date = $row[2];
|
||||||
|
if (strcmp($VDLcall_datetime, $VLCQClast_call_date) !== 0)
|
||||||
|
{
|
||||||
|
if ($VLCQCfirst_call_epoch >= $today_start_epoch)
|
||||||
|
{$day_updateSQL=',day_one_calls=(day_one_calls+1)';}
|
||||||
|
if ( ($VLCQCfirst_call_epoch >= $day_two_start_epoch) and ($VLCQCfirst_call_epoch < $today_start_epoch) )
|
||||||
|
{$day_updateSQL=',day_two_calls=(day_two_calls+1)';}
|
||||||
|
if ( ($VLCQCfirst_call_epoch >= $day_three_start_epoch) and ($VLCQCfirst_call_epoch < $day_two_start_epoch) )
|
||||||
|
{$day_updateSQL=',day_three_calls=(day_three_calls+1)';}
|
||||||
|
if ( ($VLCQCfirst_call_epoch >= $day_four_start_epoch) and ($VLCQCfirst_call_epoch < $day_three_start_epoch) )
|
||||||
|
{$day_updateSQL=',day_four_calls=(day_four_calls+1)';}
|
||||||
|
if ( ($VLCQCfirst_call_epoch >= $day_five_start_epoch) and ($VLCQCfirst_call_epoch < $day_four_start_epoch) )
|
||||||
|
{$day_updateSQL=',day_five_calls=(day_five_calls+1)';}
|
||||||
|
if ( ($VLCQCfirst_call_epoch >= $day_six_start_epoch) and ($VLCQCfirst_call_epoch < $day_five_start_epoch) )
|
||||||
|
{$day_updateSQL=',day_six_calls=(day_six_calls+1)';}
|
||||||
|
if ( ($VLCQCfirst_call_epoch >= $day_seven_start_epoch) and ($VLCQCfirst_call_epoch < $day_six_start_epoch) )
|
||||||
|
{$day_updateSQL=',day_seven_calls=(day_seven_calls+1)';}
|
||||||
|
# Update in the vicidial_lead_call_quota_counts table for this lead
|
||||||
|
$stmt="UPDATE vicidial_lead_call_quota_counts SET last_call_date='$VDLcall_datetime',status='$dispo_choice',called_count='$VLcalled_count',rank='$tempVLrank',modify_date=NOW() $session_updateSQL $day_updateSQL where lead_id='$lead_id' and list_id='$VLlist_id';";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# Update in the vicidial_lead_call_quota_counts table for this lead
|
||||||
|
$stmt="UPDATE vicidial_lead_call_quota_counts SET status='$dispo_choice',called_count='$VLcalled_count',rank='$tempVLrank',modify_date=NOW() where lead_id='$lead_id' and list_id='$VLlist_id';";
|
||||||
|
}
|
||||||
|
if ($DB) {echo "$stmt\n";}
|
||||||
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
$VLCQCaffected_rows_update = mysqli_affected_rows($link);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# Insert new record into vicidial_lead_call_quota_counts table for this lead
|
||||||
|
$stmt="INSERT INTO vicidial_lead_call_quota_counts SET lead_id='$lead_id',list_id='$VLlist_id',first_call_date='$VDLcall_datetime',last_call_date='$VDLcall_datetime',status='$dispo_choice',called_count='$VLcalled_count',day_one_calls='1',rank='$tempVLrank',modify_date=NOW() $session_newSQL;";
|
||||||
|
if ($DB) {echo "$stmt\n";}
|
||||||
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
$VLCQCaffected_rows_update = mysqli_affected_rows($link);
|
||||||
|
}
|
||||||
|
|
||||||
|
$VLCQCaffected_rows_zero_rank=0; $stmtR='';
|
||||||
|
if ( ($zero_rank_after_call > 0) and ($VLrank > 0) )
|
||||||
|
{
|
||||||
|
# Update this lead to rank=0
|
||||||
|
$stmtR="UPDATE vicidial_list SET rank='0' where lead_id='$lead_id';";
|
||||||
|
if ($DB) {echo "$stmt\n";}
|
||||||
|
$rslt=mysql_to_mysqli($stmtR, $link);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtR,'00XXX',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
$VLCQCaffected_rows_zero_rank = mysqli_affected_rows($link);
|
||||||
|
}
|
||||||
|
|
||||||
|
$fp = fopen ("./CQdebug_log.txt", "a");
|
||||||
|
fwrite ($fp, "$NOW_TIME CQ-Debug 3: $VLCQCaffected_rows_update|$stmt|$VLCQCaffected_rows_zero_rank|$stmtR|\n");
|
||||||
|
fclose($fp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# Call does not fit into any defined session
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# No dial date/time found for this call
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# Call Quota settings container is invalid, no sessions defined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# Call Quota settings container does not exist
|
||||||
|
}
|
||||||
|
}
|
||||||
|
### END Call Quota Lead Renking logging ###
|
||||||
|
|
||||||
|
|
||||||
|
### BEGIN Auto-Alt-Dial call dispo processing ###
|
||||||
if ( ($auto_dial_level > 0) and (preg_match("/\s$dispo_choice\s/",$VC_auto_alt_dial_statuses)) )
|
if ( ($auto_dial_level > 0) and (preg_match("/\s$dispo_choice\s/",$VC_auto_alt_dial_statuses)) )
|
||||||
{
|
{
|
||||||
$stmt = "SELECT count(*) from vicidial_hopper where lead_id='$lead_id' and status='HOLD';";
|
$stmt = "SELECT count(*) from vicidial_hopper where lead_id='$lead_id' and status='HOLD';";
|
||||||
@@ -12298,6 +12565,7 @@ if ($ACTION == 'updateDISPO')
|
|||||||
$rslt=mysql_to_mysqli($stmt, $link);
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00363',$user,$server_ip,$session_name,$one_mysql_log);}
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00363',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
}
|
}
|
||||||
|
### END Auto-Alt-Dial call dispo processing ###
|
||||||
|
|
||||||
####### START Vtiger Call Logging #######
|
####### START Vtiger Call Logging #######
|
||||||
$stmt = "SELECT enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url FROM system_settings;";
|
$stmt = "SELECT enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url FROM system_settings;";
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
# AST_VICIDIAL_hopperlist.php
|
# AST_VICIDIAL_hopperlist.php
|
||||||
#
|
#
|
||||||
# Copyright (C) 2018 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
# Copyright (C) 2019 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||||
#
|
#
|
||||||
# CHANGES
|
# CHANGES
|
||||||
#
|
#
|
||||||
@@ -26,6 +26,7 @@
|
|||||||
# 161026-0931 - Added links to leads and lists, added phone code, age, last call columns
|
# 161026-0931 - Added links to leads and lists, added phone code, age, last call columns
|
||||||
# 170409-1544 - Added IP List validation code
|
# 170409-1544 - Added IP List validation code
|
||||||
# 180310-2250 - Added optional source_id display
|
# 180310-2250 - Added optional source_id display
|
||||||
|
# 190716-2119 - Added rank
|
||||||
#
|
#
|
||||||
|
|
||||||
$startMS = microtime();
|
$startMS = microtime();
|
||||||
@@ -345,11 +346,11 @@ else
|
|||||||
}
|
}
|
||||||
echo "\n";
|
echo "\n";
|
||||||
echo "---------- "._QXZ("LEADS IN HOPPER")."\n";
|
echo "---------- "._QXZ("LEADS IN HOPPER")."\n";
|
||||||
echo "+------+--------+-----------+------------+-------------+---------+-------+--------+-------+--------+-------+-------+----------------------$SIDhead+----------+-----------+\n";
|
echo "+------+--------+-----------+------------+-------------+---------+-------+--------+-------+--------+--------+-------+-------+----------------------$SIDhead+----------+-----------+\n";
|
||||||
echo "|"._QXZ("ORDER",5)." |"._QXZ("PRIORITY",8)."| "._QXZ("LEAD ID",9)." | "._QXZ("LIST ID",10)." | "._QXZ("PHONE NUM",11)." | "._QXZ("PH CODE",7)." | "._QXZ("STATE",5)." | "._QXZ("STATUS",6)." | "._QXZ("COUNT",5)." | "._QXZ("GMT",6)." | "._QXZ("ALT",5)." | "._QXZ("SOURCE",6)."| "._QXZ("VENDOR LEAD CODE",20)." $SIDline| "._QXZ("AGE DAYS",8)." | "._QXZ("LAST CALL",9)." |\n";
|
echo "|"._QXZ("ORDER",5)." |"._QXZ("PRIORITY",8)."| "._QXZ("LEAD ID",9)." | "._QXZ("LIST ID",10)." | "._QXZ("PHONE NUM",11)." | "._QXZ("PH CODE",7)." | "._QXZ("STATE",5)." | "._QXZ("STATUS",6)." | "._QXZ("COUNT",5)." | "._QXZ("GMT",6)." | "._QXZ("RANK",6)." | "._QXZ("ALT",5)." | "._QXZ("SOURCE",6)."| "._QXZ("VENDOR LEAD CODE",20)." $SIDline| "._QXZ("AGE DAYS",8)." | "._QXZ("LAST CALL",9)." |\n";
|
||||||
echo "+------+--------+-----------+------------+-------------+---------+-------+--------+-------+--------+-------+-------+----------------------$SIDhead+----------+-----------+\n";
|
echo "+------+--------+-----------+------------+-------------+---------+-------+--------+-------+--------+--------+-------+-------+----------------------$SIDhead+----------+-----------+\n";
|
||||||
|
|
||||||
$stmt="select vicidial_hopper.lead_id,phone_number,vicidial_hopper.state,vicidial_list.status,called_count,vicidial_hopper.gmt_offset_now,hopper_id,alt_dial,vicidial_hopper.list_id,vicidial_hopper.priority,vicidial_hopper.source,vicidial_hopper.vendor_lead_code, phone_code,UNIX_TIMESTAMP(entry_date),UNIX_TIMESTAMP(last_local_call_time),source_id from vicidial_hopper,vicidial_list where vicidial_hopper.campaign_id='" . mysqli_real_escape_string($link, $group) . "' and vicidial_hopper.status='READY' and vicidial_hopper.lead_id=vicidial_list.lead_id $LOGallowed_campaignsSQL order by priority desc,hopper_id limit 5000;";
|
$stmt="select vicidial_hopper.lead_id,phone_number,vicidial_hopper.state,vicidial_list.status,called_count,vicidial_hopper.gmt_offset_now,hopper_id,alt_dial,vicidial_hopper.list_id,vicidial_hopper.priority,vicidial_hopper.source,vicidial_hopper.vendor_lead_code, phone_code,UNIX_TIMESTAMP(entry_date),UNIX_TIMESTAMP(last_local_call_time),source_id,vicidial_list.rank from vicidial_hopper,vicidial_list where vicidial_hopper.campaign_id='" . mysqli_real_escape_string($link, $group) . "' and vicidial_hopper.status='READY' and vicidial_hopper.lead_id=vicidial_list.lead_id $LOGallowed_campaignsSQL order by priority desc,hopper_id limit 5000;";
|
||||||
$rslt=mysql_to_mysqli($stmt, $link);
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
if ($DB) {echo "$stmt\n";}
|
if ($DB) {echo "$stmt\n";}
|
||||||
$users_to_print = mysqli_num_rows($rslt);
|
$users_to_print = mysqli_num_rows($rslt);
|
||||||
@@ -402,6 +403,7 @@ else
|
|||||||
$entry_epoch = $row[13];
|
$entry_epoch = $row[13];
|
||||||
$last_call_epoch = $row[14];
|
$last_call_epoch = $row[14];
|
||||||
$source_id_TEXT = "| ".sprintf("%-20s", $row[15])." ";
|
$source_id_TEXT = "| ".sprintf("%-20s", $row[15])." ";
|
||||||
|
$rank = sprintf("%-6s", $row[16]);
|
||||||
|
|
||||||
$lead_age = intval(($STARTtime - $entry_epoch) / 86400);
|
$lead_age = intval(($STARTtime - $entry_epoch) / 86400);
|
||||||
$lead_age = sprintf("%-8s", $lead_age);
|
$lead_age = sprintf("%-8s", $lead_age);
|
||||||
@@ -444,13 +446,13 @@ else
|
|||||||
if ($SSsource_id_display < 1)
|
if ($SSsource_id_display < 1)
|
||||||
{$source_id_TEXT='';}
|
{$source_id_TEXT='';}
|
||||||
|
|
||||||
if ($DB) {echo "| $FMT_i | $priority | <a href='./admin_modify_lead.php?lead_id=$lead_id_ns&archive_search=No&archive_log=0'>$lead_id</a> | <a href='./admin.php?ADD=311&list_id=$list_id_ns'>$list_id</a> | $phone_number $phone_code || $state | $status | $count | $gmt | $alt_dial | $source | $vendor_lead_code | $lead_age | $last_call_age_TEXT | $hopper_id |\n";}
|
if ($DB) {echo "| $FMT_i | $priority | <a href='./admin_modify_lead.php?lead_id=$lead_id_ns&archive_search=No&archive_log=0'>$lead_id</a> | <a href='./admin.php?ADD=311&list_id=$list_id_ns'>$list_id</a> | $phone_number $phone_code || $state | $status | $count | $gmt | $rank | $alt_dial | $source | $vendor_lead_code | $lead_age | $last_call_age_TEXT | $hopper_id |\n";}
|
||||||
else {echo "| $FMT_i | $priority | <a href='./admin_modify_lead.php?lead_id=$lead_id_ns&archive_search=No&archive_log=0'>$lead_id</a> | <a href='./admin.php?ADD=311&list_id=$list_id_ns'>$list_id</a> | $phone_number | $phone_code | $state | $status | $count | $gmt | $alt_dial | $source | $vendor_lead_code $source_id_TEXT| $lead_age | $last_call_age_TEXT |\n";}
|
else {echo "| $FMT_i | $priority | <a href='./admin_modify_lead.php?lead_id=$lead_id_ns&archive_search=No&archive_log=0'>$lead_id</a> | <a href='./admin.php?ADD=311&list_id=$list_id_ns'>$list_id</a> | $phone_number | $phone_code | $state | $status | $count | $gmt | $rank | $alt_dial | $source | $vendor_lead_code $source_id_TEXT| $lead_age | $last_call_age_TEXT |\n";}
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "+------+--------+-----------+------------+-------------+---------+-------+--------+-------+--------+-------+-------+----------------------$SIDhead+----------+-----------+\n";
|
echo "+------+--------+-----------+------------+-------------+---------+-------+--------+-------+--------+--------+-------+-------+----------------------$SIDhead+----------+-----------+\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($db_source == 'S')
|
if ($db_source == 'S')
|
||||||
|
|||||||
+79
-13
File diff suppressed because one or more lines are too long
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
# campaign_debug.php
|
# campaign_debug.php
|
||||||
#
|
#
|
||||||
# Copyright (C) 2018 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
# Copyright (C) 2019 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||||
#
|
#
|
||||||
# CHANGES
|
# CHANGES
|
||||||
# 110514-1231 - First build
|
# 110514-1231 - First build
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
# 141229-2042 - Added code for on-the-fly language translations display
|
# 141229-2042 - Added code for on-the-fly language translations display
|
||||||
# 170409-1534 - Added IP List validation code
|
# 170409-1534 - Added IP List validation code
|
||||||
# 180201-1245 - Added live call and shortage counts per server tables
|
# 180201-1245 - Added live call and shortage counts per server tables
|
||||||
|
# 190716-0909 - Added Call Quota process output
|
||||||
#
|
#
|
||||||
|
|
||||||
$startMS = microtime();
|
$startMS = microtime();
|
||||||
@@ -306,7 +307,7 @@ else
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt="select update_time,server_ip,debug_output,adapt_output from vicidial_campaign_stats_debug where campaign_id='" . mysqli_real_escape_string($link, $group) . "' and server_ip!='ADAPT' order by server_ip limit 100;";
|
$stmt="select update_time,server_ip,debug_output,adapt_output from vicidial_campaign_stats_debug where campaign_id='" . mysqli_real_escape_string($link, $group) . "' and server_ip NOT IN('ADAPT','CALLQUOTA') order by server_ip limit 100;";
|
||||||
$rslt=mysql_to_mysqli($stmt, $link);
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
if ($DB) {echo "$stmt\n";}
|
if ($DB) {echo "$stmt\n";}
|
||||||
$debugs_to_print = mysqli_num_rows($rslt);
|
$debugs_to_print = mysqli_num_rows($rslt);
|
||||||
@@ -387,6 +388,21 @@ else
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$stmt="select update_time,debug_output,adapt_output from vicidial_campaign_stats_debug where campaign_id='" . mysqli_real_escape_string($link, $group) . "' and server_ip='CALLQUOTA' limit 1;";
|
||||||
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
|
if ($DB) {echo "$stmt\n";}
|
||||||
|
$callquotas_to_print = mysqli_num_rows($rslt);
|
||||||
|
$i=0;
|
||||||
|
while ($callquotas_to_print > $i)
|
||||||
|
{
|
||||||
|
$row=mysqli_fetch_row($rslt);
|
||||||
|
|
||||||
|
echo _QXZ("Call Quota Lead Ranking Debug").": $row[0]\n";
|
||||||
|
echo "$row[1]\n";
|
||||||
|
echo "$row[2]\n";
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($db_source == 'S')
|
if ($db_source == 'S')
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# version: 20190628131101
|
# version: 20190708131101
|
||||||
users-user User ID <QXZ>This field is where you put the users ID number, can be up to 8 digits in length, Must be at least 2 characters in length.</QXZ>
|
users-user User ID <QXZ>This field is where you put the users ID number, can be up to 8 digits in length, Must be at least 2 characters in length.</QXZ>
|
||||||
users-pass Password <QXZ>This field is where you put the users password. Must be at least 2 characters in length. A medium strength user password will be at least 10 characters in length, and a strong user password will be at least 20 characters in length and have letters as well as at least one number. It is recommended that you use a longer password if possible, stringing together several unrelated words with no spaces, and a number somewhere in the string. The maximum size of a password is 100 characters.</QXZ>
|
users-pass Password <QXZ>This field is where you put the users password. Must be at least 2 characters in length. A medium strength user password will be at least 10 characters in length, and a strong user password will be at least 20 characters in length and have letters as well as at least one number. It is recommended that you use a longer password if possible, stringing together several unrelated words with no spaces, and a number somewhere in the string. The maximum size of a password is 100 characters.</QXZ>
|
||||||
users-force_change_password Force Change Password <QXZ>If this option is set to Y then the user will be prompted to change their password the next time they log in to the administration webpage. Default is N.</QXZ>
|
users-force_change_password Force Change Password <QXZ>If this option is set to Y then the user will be prompted to change their password the next time they log in to the administration webpage. Default is N.</QXZ>
|
||||||
@@ -129,6 +129,10 @@ campaigns-auto_trim_hopper Auto Trim Hopper <QXZ>Setting this to Y will allow th
|
|||||||
campaigns-hopper_vlc_dup_check Hopper VLC Dup Check <QXZ>Setting this to Y will result in every lead being inserted into the hopper being checked by vendor_lead_code to make sure there are no duplicate leads inserted with the same vendor_lead_code. This is most useful when Auto-Alt-Dialing with MULTI_LEAD. Default is N.</QXZ>
|
campaigns-hopper_vlc_dup_check Hopper VLC Dup Check <QXZ>Setting this to Y will result in every lead being inserted into the hopper being checked by vendor_lead_code to make sure there are no duplicate leads inserted with the same vendor_lead_code. This is most useful when Auto-Alt-Dialing with MULTI_LEAD. Default is N.</QXZ>
|
||||||
campaigns-manual_dial_hopper_check Manual Dial Hopper Check <QXZ>Setting this to Y will mean that any manually dialed campaign phone call through the agent screen will first check for a lead in the hopper with the same phone number, and if one exists it will be deleted before the manual dial call is placed. Default is N.</QXZ>
|
campaigns-manual_dial_hopper_check Manual Dial Hopper Check <QXZ>Setting this to Y will mean that any manually dialed campaign phone call through the agent screen will first check for a lead in the hopper with the same phone number, and if one exists it will be deleted before the manual dial call is placed. Default is N.</QXZ>
|
||||||
campaigns-lead_filter_id Lead Filter <QXZ>This is a method of filtering your leads using a fragment of a SQL query. Use this feature with caution, it is easy to stop dialing accidentally with the slightest alteration to the SQL statement. Default is NONE.</QXZ>
|
campaigns-lead_filter_id Lead Filter <QXZ>This is a method of filtering your leads using a fragment of a SQL query. Use this feature with caution, it is easy to stop dialing accidentally with the slightest alteration to the SQL statement. Default is NONE.</QXZ>
|
||||||
|
|
||||||
|
campaigns-auto_active_list_new Auto Active List New <QXZ>This setting will automatically set an inactive list to active when it contains dialable NEW status leads and the campaign has less than this setting number of NEW status leads to be dialed. The order in which the next list is set to active is determined by the List Auto Active List Rank. This feature will only work if there has been calling on this campaign within the last hour. If no leads have been dialed within the last hour in this campaign, then this feature will not function. Default is DISABLED. This feature will only work if the Call Quota Lead Ranking feature is also enabled.</QXZ>
|
||||||
|
campaigns-call_quota_lead_ranking Call Quota Lead Ranking <QXZ>This setting will allow you to choose a Settings Container which has the settings you want to use for Call Quota Lead Ranking. Default is DISABLED.</QXZ>
|
||||||
|
|
||||||
campaigns-call_count_limit Call Count Limit <QXZ>This enforces a limit on the number of call attempts for the leads dialed in this campaign. A lead may go over this limit slightly if Lead Recycling or Auto-Alt-Dialing is enabled. Default is 0 for no limit.</QXZ>
|
campaigns-call_count_limit Call Count Limit <QXZ>This enforces a limit on the number of call attempts for the leads dialed in this campaign. A lead may go over this limit slightly if Lead Recycling or Auto-Alt-Dialing is enabled. Default is 0 for no limit.</QXZ>
|
||||||
campaigns-call_count_target Call Count Target <QXZ>This option is only used for reporting purposes and has no effect on leads dialed. Default is 3.</QXZ>
|
campaigns-call_count_target Call Count Target <QXZ>This option is only used for reporting purposes and has no effect on leads dialed. Default is 3.</QXZ>
|
||||||
campaigns-drop_lockout_time Drop Lockout Time <QXZ>This is a number of hours that DROP abandon calls will be prevented from being dialed, to disable set to 0. This setting is very useful in countries like the UK where there are regulations preventing the attempted calling of customers within 72 hours of an Abandon, or DROP. Default is 0.</QXZ>
|
campaigns-drop_lockout_time Drop Lockout Time <QXZ>This is a number of hours that DROP abandon calls will be prevented from being dialed, to disable set to 0. This setting is very useful in countries like the UK where there are regulations preventing the attempted calling of customers within 72 hours of an Abandon, or DROP. Default is 0.</QXZ>
|
||||||
@@ -383,6 +387,7 @@ lists-na_call_url No Agent Call URL <QXZ>This web URL address is not seen by the
|
|||||||
lists-xferconf_a_dtmf Xfer-Conf Number Override <QXZ>These five fields allow for you to override the Transfer Conference number presets when the lead is from this list. Default is blank.</QXZ>
|
lists-xferconf_a_dtmf Xfer-Conf Number Override <QXZ>These five fields allow for you to override the Transfer Conference number presets when the lead is from this list. Default is blank.</QXZ>
|
||||||
lists-user_new_lead_limit User New Lead Limit <QXZ>This setting will limit the number of new leads any user can dial in this list per day. This feature will only work properly if the campaign is set to either the MANUAL or INBOUND_MAN Dial Method and No Hopper dialing is enabled. Default is -1 for disabled.</QXZ>
|
lists-user_new_lead_limit User New Lead Limit <QXZ>This setting will limit the number of new leads any user can dial in this list per day. This feature will only work properly if the campaign is set to either the MANUAL or INBOUND_MAN Dial Method and No Hopper dialing is enabled. Default is -1 for disabled.</QXZ>
|
||||||
lists-default_xfer_group Default Transfer Group <QXZ>This field is the default In-Group that will be automatically selected when the agent opens the transfer-conference frame in their agent interface. If set to NONE, then the campaign or in-group Default Transfer Group will be used. Default is NONE.</QXZ>
|
lists-default_xfer_group Default Transfer Group <QXZ>This field is the default In-Group that will be automatically selected when the agent opens the transfer-conference frame in their agent interface. If set to NONE, then the campaign or in-group Default Transfer Group will be used. Default is NONE.</QXZ>
|
||||||
|
lists-auto_active_list_rank Auto Active List Rank <QXZ>If the Auto Active List New setting is enabled for this campaign, then this is the order in which inactive lists will be set to active as each list runs out of NEW status leads to dial. The order is from highest number to the lowest. Default is 0.</QXZ>
|
||||||
lists-inventory_report Inventory Report <QXZ>If the Inventory Report is enabled on your system, this option will determine whether this list is included in the report or not. Default is Y for yes.</QXZ>
|
lists-inventory_report Inventory Report <QXZ>If the Inventory Report is enabled on your system, this option will determine whether this list is included in the report or not. Default is Y for yes.</QXZ>
|
||||||
lists-time_zone_setting Time Zone Setting <QXZ>This option allows you to set the method of maintaining the current time zone lookup for the leads within this list. This process is only done at night so any changes you make will not be immediate. COUNTRY_AND_AREA_CODE is the default, and will use the country code and area code of the phone number to determine the time zone of the lead. POSTAL_CODE will use the postal code if available to determine the time zone of the lead. NANPA_PREFIX works only in the USA and will use the area code and prefix of the phone number to determine the time zone of the lead, but this is not enabled by default in the system, so please be sure you have the NANPA prefix data loaded onto your system before selecting this option. OWNER_TIME_ZONE_CODE will use the standard time zone abbreviation loaded into the owner field of the lead to determine the time zone, in the USA examples are AST, EST, CST, MST, PST, AKST, HST. This feature must be enabled by your system administrator to go into effect.</QXZ>
|
lists-time_zone_setting Time Zone Setting <QXZ>This option allows you to set the method of maintaining the current time zone lookup for the leads within this list. This process is only done at night so any changes you make will not be immediate. COUNTRY_AND_AREA_CODE is the default, and will use the country code and area code of the phone number to determine the time zone of the lead. POSTAL_CODE will use the postal code if available to determine the time zone of the lead. NANPA_PREFIX works only in the USA and will use the area code and prefix of the phone number to determine the time zone of the lead, but this is not enabled by default in the system, so please be sure you have the NANPA prefix data loaded onto your system before selecting this option. OWNER_TIME_ZONE_CODE will use the standard time zone abbreviation loaded into the owner field of the lead to determine the time zone, in the USA examples are AST, EST, CST, MST, PST, AKST, HST. This feature must be enabled by your system administrator to go into effect.</QXZ>
|
||||||
internal_list-dnc Internal DNC List <QXZ>This Do Not Call list contains every lead that has been set to a status of DNC in the system. Through the LISTS - ADD NUMBER TO DNC page you are able to manually add numbers to this list so that they will not be called by campaigns that use the internal DNC list. There is also the option to add leads to the campaign-specific DNC lists for those campaigns that have them. If you have the active DNC option set to AREACODE then you can also use area code wildcard entries like this 201XXXXXXX to block all calls to the 201 areacode when enabled.</QXZ>
|
internal_list-dnc Internal DNC List <QXZ>This Do Not Call list contains every lead that has been set to a status of DNC in the system. Through the LISTS - ADD NUMBER TO DNC page you are able to manually add numbers to this list so that they will not be called by campaigns that use the internal DNC list. There is also the option to add leads to the campaign-specific DNC lists for those campaigns that have them. If you have the active DNC option set to AREACODE then you can also use area code wildcard entries like this 201XXXXXXX to block all calls to the 201 areacode when enabled.</QXZ>
|
||||||
@@ -1010,6 +1015,7 @@ settings-callcard_enabled Enable CallCard <QXZ>This setting enables the CallCard
|
|||||||
settings-test_campaign_calls Enable Campaign Test Calls <QXZ>This setting enables the ability to enter a phone code and phone number into fields at the bottom of the Campaign Detail screen and place a phone call to that number as if it were a lead being auto-dialed in the system. The phone number will be stored as a new lead in the manual dial list ID list. The campaign must be active for this feature to be enabled, and it is recommended that the lists assigned to the campaign all be set to inactive. The dial prefix, dial timeout and all other dialing related features, except for DNC and call time options, will affect the dialing of the test number. The phone call will be placed on the server selected as the voicemail server in the system settings. Default is 0 for disabled.</QXZ>
|
settings-test_campaign_calls Enable Campaign Test Calls <QXZ>This setting enables the ability to enter a phone code and phone number into fields at the bottom of the Campaign Detail screen and place a phone call to that number as if it were a lead being auto-dialed in the system. The phone number will be stored as a new lead in the manual dial list ID list. The campaign must be active for this feature to be enabled, and it is recommended that the lists assigned to the campaign all be set to inactive. The dial prefix, dial timeout and all other dialing related features, except for DNC and call time options, will affect the dialing of the test number. The phone call will be placed on the server selected as the voicemail server in the system settings. Default is 0 for disabled.</QXZ>
|
||||||
settings-did_system_filter DID System Filter <QXZ>This setting enables the special did_system_filter DID entry. The filter settings in this DID entry will be applied to all incoming calls to the system, prior to any other actions on the call. This feature is commonly used for system-wide inbound blacklists, or filtering of do-not-contact phone numbers. Default is 0 for disabled.</QXZ>
|
settings-did_system_filter DID System Filter <QXZ>This setting enables the special did_system_filter DID entry. The filter settings in this DID entry will be applied to all incoming calls to the system, prior to any other actions on the call. This feature is commonly used for system-wide inbound blacklists, or filtering of do-not-contact phone numbers. Default is 0 for disabled.</QXZ>
|
||||||
settings-user_new_lead_limit New Leads Per List Limit <QXZ>This setting enables the new lead limits per list to be set on the list modify page and the user list new lead limit page. This feature will only work properly if the campaign is set to either the MANUAL or INBOUND_MAN Dial Method and No Hopper dialing is enabled. Default is 0 for disabled.</QXZ>
|
settings-user_new_lead_limit New Leads Per List Limit <QXZ>This setting enables the new lead limits per list to be set on the list modify page and the user list new lead limit page. This feature will only work properly if the campaign is set to either the MANUAL or INBOUND_MAN Dial Method and No Hopper dialing is enabled. Default is 0 for disabled.</QXZ>
|
||||||
|
settings-call_quota_lead_ranking Call Quota Lead Ranking <QXZ>This setting allows you to use the campaign setting for Call Quota Lead Ranking, which allows for a complex set of recycle dialing priorities for non-contact calls. Default is 0 for disabled.</QXZ>
|
||||||
settings-custom_fields_enabled Enable Custom List Fields <QXZ>This setting enables the custom list fields feature that allows for custom data fields to be defined in the administration web interface on a per-list basis and then have those fields available in a FORM tab to the agent in the agent web interface. Default is 0 for disabled.</QXZ>
|
settings-custom_fields_enabled Enable Custom List Fields <QXZ>This setting enables the custom list fields feature that allows for custom data fields to be defined in the administration web interface on a per-list basis and then have those fields available in a FORM tab to the agent in the agent web interface. Default is 0 for disabled.</QXZ>
|
||||||
settings-expanded_list_stats Enable Expanded List Stats <QXZ>This setting enables two additional columns to be displayed on most of the List status breakdown tables on the list modification and campaign modification pages. Penetration is defined as the percent of leads that are at or above the campaign Call Count Limit and-or the status is marked as Completed. Default is 1 for enabled.</QXZ>
|
settings-expanded_list_stats Enable Expanded List Stats <QXZ>This setting enables two additional columns to be displayed on most of the List status breakdown tables on the list modification and campaign modification pages. Penetration is defined as the percent of leads that are at or above the campaign Call Count Limit and-or the status is marked as Completed. Default is 1 for enabled.</QXZ>
|
||||||
settings-hide_inactive_lists Hide Inactive Lists <QXZ>This setting allows you to hide inactive lists from the Lists Listing page. Similar to the default Users feature, a link to display all lists will be available at the top of the listings section. Default is 0 for disabled.</QXZ>
|
settings-hide_inactive_lists Hide Inactive Lists <QXZ>This setting allows you to hide inactive lists from the Lists Listing page. Similar to the default Users feature, a link to display all lists will be available at the top of the listings section. Default is 0 for disabled.</QXZ>
|
||||||
|
|||||||
Reference in New Issue
Block a user