Added Call Time after-hours filename override options used by inbound groups

Added Campaign setting for inbound queue no dial that will prohibit outbound auto-dialing if there are any allowed in-group calls in queue if enabled

git-svn-id: svn://192.168.202.10@1436 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2010-05-18 11:19:12 +00:00
parent 606c1a191a
commit ab2b1ff4ec
7 changed files with 383 additions and 251 deletions
+10
View File
@@ -23,6 +23,11 @@ REQUIRED STEPS!!!
\. /path/from/root/extras/upgrade_2.4.sql
quit
3. For each of your ViciDial servers, go the Admin -> Servers -> Modify Server
page and set each one to "Rebuild conf files = Y" and click submit.
This will rebuild the conf files to ensure any changes are updated.
OTHER CHANGES:
1. Changed "After hours", "No agent no queue" and "drop timeout reached" DROPs
@@ -139,6 +144,11 @@ OTHER CHANGES:
32. Added several PRESS-1 options to the Hold Time Option settings for In-Groups
33. Added Call Time after-hours filename override option used by inbound groups
34. Added Campaign setting for inbound queue no dial that will prohibit outbound
auto-dialing if there are any allowed in-group calls in queue if enabled
+22 -12
View File
@@ -128,6 +128,7 @@
# 100429-1457 - Remote agent fixes
# 100512-2118 - Added several press-1 hold time options
# 100513-2338 - Changed hold time callback filename to after press filename and now plays after all PRESS-1
# 100518-0710 - Added call time after hours override options
#
$script = 'agi-VDAD_ALL_inbound.agi';
@@ -610,25 +611,27 @@ while ($sthArows > $cbc)
}
$sthA->finish();
if ($wday==0) {$daySQL=',ct_sunday_start,ct_sunday_stop';}
if ($wday==1) {$daySQL=',ct_monday_start,ct_monday_stop';}
if ($wday==2) {$daySQL=',ct_tuesday_start,ct_tuesday_stop';}
if ($wday==3) {$daySQL=',ct_wednesday_start,ct_wednesday_stop';}
if ($wday==4) {$daySQL=',ct_thursday_start,ct_thursday_stop';}
if ($wday==5) {$daySQL=',ct_friday_start,ct_friday_stop';}
if ($wday==6) {$daySQL=',ct_saturday_start,ct_saturday_stop';}
if ($wday==0) {$daySQL=',ct_sunday_start,ct_sunday_stop,sunday_afterhours_filename_override';}
if ($wday==1) {$daySQL=',ct_monday_start,ct_monday_stop,monday_afterhours_filename_override';}
if ($wday==2) {$daySQL=',ct_tuesday_start,ct_tuesday_stop,tuesday_afterhours_filename_override';}
if ($wday==3) {$daySQL=',ct_wednesday_start,ct_wednesday_stop,wednesday_afterhours_filename_override';}
if ($wday==4) {$daySQL=',ct_thursday_start,ct_thursday_stop,thursday_afterhours_filename_override';}
if ($wday==5) {$daySQL=',ct_friday_start,ct_friday_stop,friday_afterhours_filename_override';}
if ($wday==6) {$daySQL=',ct_saturday_start,ct_saturday_stop,saturday_afterhours_filename_override';}
### Grab call_times values from the database
$stmtA = "SELECT ct_default_start,ct_default_stop $daySQL FROM vicidial_call_times where call_time_id = '$call_time_id';";
$stmtA = "SELECT ct_default_start,ct_default_stop,default_afterhours_filename_override $daySQL FROM vicidial_call_times where call_time_id = '$call_time_id';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$dbhP=$dbhA; $mysql_count='02006'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
@aryA = $sthA->fetchrow_array;
$ct_default_start = $aryA[0];
$ct_default_stop = $aryA[1];
$ct_day_start = $aryA[2];
$ct_day_stop = $aryA[3];
$ct_default_start = $aryA[0];
$ct_default_stop = $aryA[1];
$deafult_afterhours_filename_override = $aryA[2];
$ct_day_start = $aryA[3];
$ct_day_stop = $aryA[4];
$day_afterhours_filename_override = $aryA[5];
$sthA->finish();
if ( ($ct_day_start > 0) || ($ct_day_stop > 0) )
@@ -637,6 +640,11 @@ if ( ($ct_day_start > 0) || ($ct_day_stop > 0) )
$ct_default_stop = $ct_day_stop;
}
if ( (length($deafult_afterhours_filename_override) > 0) && ($deafult_afterhours_filename_override !~ /---NONE---/) )
{$after_hours_message_filename = $deafult_afterhours_filename_override;}
if ( (length($day_afterhours_filename_override) > 0) && ($day_afterhours_filename_override !~ /---NONE---/) )
{$after_hours_message_filename = $day_afterhours_filename_override;}
$AGI->stream_file('sip-silence');
$AGI->stream_file('sip-silence');
@@ -849,6 +857,7 @@ if ( ($hm < $ct_default_start) || ($hm > $ct_default_stop) )
$affected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='02019'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
if ($AGILOG) {$agi_string = "-- AH VDCL vac record deleted: |$affected_rows| $VDADcampaign|"; &agi_output;}
if ($AGILOG) {$agi_string = "-- AH action: |$$after_hours_action|$after_hours_exten|$after_hours_message_filename|$after_hours_voicemail|"; &agi_output;}
if ($after_hours_action =~ /EXTENSION|VOICEMAIL|IN_GROUP/)
{
@@ -2990,6 +2999,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) )
if ($drop_timer >= 2) {$drop_timer = ($drop_timer + 10);} # add prompt play time to total queue time
$AGI->stream_file('sip-silence'); # stop music-on-hold process
$AGI->stream_file('sip-silence'); # stop music-on-hold process
$AGI->stream_file('sip-silence'); # stop music-on-hold process
+254 -218
View File
@@ -299,6 +299,8 @@ while($one_day_interval > 0)
@DBIPcampaigncid=@MT;
@DBIPexistcalls=@MT;
@DBIPexistcalls_IN=@MT;
@DBIPexistcalls_IN_ALL=@MT;
@DBIPexistcalls_IN_LIVE=@MT;
@DBIPexistcalls_OUT=@MT;
@DBIPgoalcalls=@MT;
@DBIPmakecalls=@MT;
@@ -315,6 +317,7 @@ while($one_day_interval > 0)
@DBIPqueue_priority=@MT;
@DBIPdial_method=@MT;
@DBIPuse_custom_cid=@MT;
@DBIPinbound_queue_no_dial=@MT;
$active_line_counter=0;
$user_counter=0;
@@ -509,7 +512,7 @@ while($one_day_interval > 0)
### grab the dial_level and multiply by active agents to get your goalcalls
$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 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 FROM vicidial_campaigns where campaign_id='$DBIPcampaign[$user_CIPct]'";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
@@ -540,6 +543,7 @@ while($one_day_interval > 0)
$DBIPqueue_priority[$user_CIPct] = $aryA[12];
$DBIPdial_method[$user_CIPct] = $aryA[13];
$DBIPuse_custom_cid[$user_CIPct] = $aryA[14];
$DBIPinbound_queue_no_dial[$user_CIPct] = $aryA[15];
$rec_count++;
}
@@ -593,6 +597,28 @@ while($one_day_interval > 0)
$DBIPexistcalls_IN[$user_CIPct] = $aryA[0];
}
$sthA->finish();
$stmtA = "SELECT count(*) FROM vicidial_auto_calls where (call_type='IN' and campaign_id IN($DBIPclosercamp[$user_CIPct])) and status IN('SENT','RINGING','LIVE','XFER','CLOSER');";
$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;
$DBIPexistcalls_IN_ALL[$user_CIPct] = $aryA[0];
}
$sthA->finish();
$stmtA = "SELECT count(*) FROM vicidial_auto_calls where call_type='IN' and campaign_id IN($DBIPclosercamp[$user_CIPct]) and status IN('LIVE');";
$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;
$DBIPexistcalls_IN_LIVE[$user_CIPct] = $aryA[0];
}
$sthA->finish();
}
else
{$DBIPexistcalls_IN[$user_CIPct]=0;}
@@ -609,6 +635,8 @@ while($one_day_interval > 0)
$sthA->finish();
$DBIPexistcalls[$user_CIPct] = ($DBIPexistcalls_IN[$user_CIPct] + $DBIPexistcalls_OUT[$user_CIPct]);
if ($DBIPinbound_queue_no_dial[$user_CIPct] =~ /ALL_SERVERS/)
{$DBIPexistcalls[$user_CIPct] = ($DBIPexistcalls_IN_ALL[$user_CIPct] + $DBIPexistcalls_OUT[$user_CIPct]);}
if ( ($DBIPcampaign_ready_agents[$user_CIPct] > 0) && ($DBIPexistcalls_IN[$user_CIPct] > 0) )
{
@@ -666,7 +694,7 @@ while($one_day_interval > 0)
if ($DBIPmakecalls[$user_CIPct] > 0)
{$active_line_counter = ($DBIPmakecalls[$user_CIPct] + $active_line_counter);}
$event_string="$DBIPcampaign[$user_CIPct] $DBIPaddress[$user_CIPct]: Calls to place: $DBIPmakecalls[$user_CIPct] ($DBIPgoalcalls[$user_CIPct] - $DBIPexistcalls[$user_CIPct] [$DBIPexistcalls_IN[$user_CIPct] + $DBIPexistcalls_OUT[$user_CIPct]]) $active_line_counter $MVT_msg";
$event_string="$DBIPcampaign[$user_CIPct] $DBIPaddress[$user_CIPct]: Calls to place: $DBIPmakecalls[$user_CIPct] ($DBIPgoalcalls[$user_CIPct] - $DBIPexistcalls[$user_CIPct] [$DBIPexistcalls_IN[$user_CIPct] + $DBIPexistcalls_OUT[$user_CIPct]|$DBIPexistcalls_IN_ALL[$user_CIPct]|$DBIPexistcalls_IN_LIVE[$user_CIPct]]) $active_line_counter $MVT_msg";
&event_logger;
### Calculate campaign-wide agent waiting and calls waiting differential
@@ -804,236 +832,244 @@ while($one_day_interval > 0)
}
else
{
$event_string="$DBIPcampaign[$user_CIPct] $DBIPaddress[$user_CIPct]: CALLING";
&event_logger;
$call_CMPIPct=0;
$lead_id_call_list='|';
my $UDaffected_rows=0;
if ($call_CMPIPct < $DBIPmakecalls[$user_CIPct])
if ( ($DBIPinbound_queue_no_dial[$user_CIPct] =~ /ENABLED/) && ($DBIPexistcalls_IN_LIVE[$user_CIPct] > 0) )
{
$stmtA = "UPDATE vicidial_hopper set status='QUEUE', user='VDAD_$server_ip' where campaign_id='$DBIPcampaign[$user_CIPct]' and status='READY' order by priority desc,hopper_id LIMIT $DBIPmakecalls[$user_CIPct]";
print "|$stmtA|\n";
$UDaffected_rows = $dbhA->do($stmtA);
print "hopper rows updated to QUEUE: |$UDaffected_rows|\n";
if ($UDaffected_rows)
$event_string="$DBIPcampaign[$user_CIPct] $DBIPexistcalls_IN_LIVE[$user_CIPct]: INBOUND QUEUE NO DIAL, NO DIALING";
&event_logger;
}
else
{
$event_string="$DBIPcampaign[$user_CIPct] $DBIPaddress[$user_CIPct]: CALLING";
&event_logger;
$call_CMPIPct=0;
$lead_id_call_list='|';
my $UDaffected_rows=0;
if ($call_CMPIPct < $DBIPmakecalls[$user_CIPct])
{
$lead_id=''; $phone_code=''; $phone_number=''; $called_count='';
while ($call_CMPIPct < $UDaffected_rows)
$stmtA = "UPDATE vicidial_hopper set status='QUEUE', user='VDAD_$server_ip' where campaign_id='$DBIPcampaign[$user_CIPct]' and status='READY' order by priority desc,hopper_id LIMIT $DBIPmakecalls[$user_CIPct]";
print "|$stmtA|\n";
$UDaffected_rows = $dbhA->do($stmtA);
print "hopper rows updated to QUEUE: |$UDaffected_rows|\n";
if ($UDaffected_rows)
{
$stmtA = "SELECT lead_id,alt_dial FROM vicidial_hopper where campaign_id='$DBIPcampaign[$user_CIPct]' and status='QUEUE' and user='VDAD_$server_ip' order by priority desc,hopper_id LIMIT 1";
print "|$stmtA|\n";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_count=0;
$rec_countCUSTDATA=0;
while ($sthArows > $rec_count)
$lead_id=''; $phone_code=''; $phone_number=''; $called_count='';
while ($call_CMPIPct < $UDaffected_rows)
{
@aryA = $sthA->fetchrow_array;
$lead_id = $aryA[0];
$alt_dial = $aryA[1];
$rec_count++;
}
$sthA->finish();
if ($lead_id_call_list =~ /\|$lead_id\|/)
{
print "!!!!!!!!!!!!!!!!duplicate lead_id for this run: |$lead_id| $lead_id_call_list\n";
if ($SYSLOG)
{
open(DUPout, ">>$PATHlogs/VDAD_DUPLICATE.$file_date")
|| die "Can't open $PATHlogs/VDAD_DUPLICATE.$file_date: $!\n";
print DUPout "$now_date-----$lead_id_call_list-----$lead_id\n";
close(DUPout);
}
}
else
{
$stmtA = "UPDATE vicidial_hopper set status='INCALL' where lead_id='$lead_id'";
print "|$stmtA|\n";
$UQaffected_rows = $dbhA->do($stmtA);
print "hopper row updated to INCALL: |$UQaffected_rows|$lead_id|\n";
### Gather lead data
$stmtA = "SELECT list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,address3,alt_phone,called_count,security_phrase FROM vicidial_list where lead_id='$lead_id';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_count=0;
$rec_countCUSTDATA=0;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$list_id = $aryA[0];
$gmt_offset_now = $aryA[1];
$called_since_last_reset = $aryA[2];
$phone_code = $aryA[3];
$phone_number = $aryA[4];
$address3 = $aryA[5];
$alt_phone = $aryA[6];
$called_count = $aryA[7];
$security_phrase = $aryA[8];
$rec_countCUSTDATA++;
$rec_count++;
}
$sthA->finish();
if ($rec_countCUSTDATA)
{
$campaign_cid_override='';
### gather list_id overrides
$stmtA = "SELECT campaign_cid_override FROM vicidial_lists where list_id='$list_id';";
$stmtA = "SELECT lead_id,alt_dial FROM vicidial_hopper where campaign_id='$DBIPcampaign[$user_CIPct]' and status='QUEUE' and user='VDAD_$server_ip' order by priority desc,hopper_id LIMIT 1";
print "|$stmtA|\n";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArowsL=$sthA->rows;
if ($sthArowsL > 0)
$sthArows=$sthA->rows;
$rec_count=0;
$rec_countCUSTDATA=0;
while ($sthArows > $rec_count)
{
@aryA = $sthA->fetchrow_array;
$campaign_cid_override = $aryA[0];
$lead_id = $aryA[0];
$alt_dial = $aryA[1];
$rec_count++;
}
$sthA->finish();
### update called_count
$called_count++;
if ($called_since_last_reset =~ /^Y/)
if ($lead_id_call_list =~ /\|$lead_id\|/)
{
print "!!!!!!!!!!!!!!!!duplicate lead_id for this run: |$lead_id| $lead_id_call_list\n";
if ($SYSLOG)
{
if ($called_since_last_reset =~ /^Y$/) {$CSLR = 'Y1';}
else
{
$called_since_last_reset =~ s/^Y//gi;
$called_since_last_reset++;
$CSLR = "Y$called_since_last_reset";
}
}
else {$CSLR = 'Y';}
$LLCT_DATE_offset = ($LOCAL_GMT_OFF - $gmt_offset_now);
$LLCT_DATE_offset_epoch = ( $secX - ($LLCT_DATE_offset * 3600) );
($Lsec,$Lmin,$Lhour,$Lmday,$Lmon,$Lyear,$Lwday,$Lyday,$Lisdst) = localtime($LLCT_DATE_offset_epoch);
$Lyear = ($Lyear + 1900);
$Lmon++;
if ($Lmon < 10) {$Lmon = "0$Lmon";}
if ($Lmday < 10) {$Lmday = "0$Lmday";}
if ($Lhour < 10) {$Lhour = "0$Lhour";}
if ($Lmin < 10) {$Lmin = "0$Lmin";}
if ($Lsec < 10) {$Lsec = "0$Lsec";}
$LLCT_DATE = "$Lyear-$Lmon-$Lmday $Lhour:$Lmin:$Lsec";
if ( ($alt_dial =~ /ALT|ADDR3|X/) && ($DBIPautoaltdial[$user_CIPct] =~ /ALT|ADDR|X/) )
{
if ( ($alt_dial =~ /ALT/) && ($DBIPautoaltdial[$user_CIPct] =~ /ALT/) )
{
$alt_phone =~ s/\D//gi;
$phone_number = $alt_phone;
}
if ( ($alt_dial =~ /ADDR3/) && ($DBIPautoaltdial[$user_CIPct] =~ /ADDR3/) )
{
$address3 =~ s/\D//gi;
$phone_number = $address3;
}
if ( ($alt_dial =~ /X/) && ($DBIPautoaltdial[$user_CIPct] =~ /X/) )
{
if ($alt_dial =~ /LAST/)
{
$stmtA = "SELECT phone_code,phone_number FROM vicidial_list_alt_phones where lead_id='$lead_id' order by alt_phone_count desc limit 1;";
}
else
{
$Talt_dial = $alt_dial;
$Talt_dial =~ s/\D//gi;
$stmtA = "SELECT phone_code,phone_number FROM vicidial_list_alt_phones where lead_id='$lead_id' and alt_phone_count='$Talt_dial';";
}
$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;
$phone_code = $aryA[0];
$phone_number = $aryA[1];
$phone_number =~ s/\D//gi;
}
$sthA->finish();
}
$stmtA = "UPDATE vicidial_list set called_since_last_reset='$CSLR',called_count='$called_count',user='VDAD',last_local_call_time='$LLCT_DATE' where lead_id='$lead_id'";
}
else
{
$stmtA = "UPDATE vicidial_list set called_since_last_reset='$CSLR', called_count='$called_count',user='VDAD',last_local_call_time='$LLCT_DATE' where lead_id='$lead_id'";
}
$affected_rows = $dbhA->do($stmtA);
$stmtA = "DELETE FROM vicidial_hopper where lead_id='$lead_id'";
$affected_rows = $dbhA->do($stmtA);
$CCID_on=0; $CCID='';
$local_DEF = 'Local/';
$local_AMP = '@';
$Local_out_prefix = '9';
$Local_dial_timeout = '60';
if ($DBIPdialtimeout[$user_CIPct] > 4) {$Local_dial_timeout = $DBIPdialtimeout[$user_CIPct];}
$Local_dial_timeout = ($Local_dial_timeout * 1000);
if (length($DBIPdialprefix[$user_CIPct]) > 0) {$Local_out_prefix = "$DBIPdialprefix[$user_CIPct]";}
if (length($DBIPvdadexten[$user_CIPct]) > 0) {$VDAD_dial_exten = "$DBIPvdadexten[$user_CIPct]";}
else {$VDAD_dial_exten = "$answer_transfer_agent";}
if (length($DBIPcampaigncid[$user_CIPct]) > 6) {$CCID = "$DBIPcampaigncid[$user_CIPct]"; $CCID_on++;}
if (length($campaign_cid_override) > 6) {$CCID = "$campaign_cid_override"; $CCID_on++;}
if ($DBIPuse_custom_cid[$user_CIPct] =~ /Y/)
{
$temp_CID = $security_phrase;
$temp_CID =~ s/\D//gi;
if (length($temp_CID) > 6)
{$CCID = "$temp_CID"; $CCID_on++;}
}
if ($DBIPdialprefix[$user_CIPct] =~ /x/i) {$Local_out_prefix = '';}
if ($RECcount)
{
if ( (length($RECprefix)>0) && ($called_count < $RECcount) )
{$Local_out_prefix .= "$RECprefix";}
}
$PADlead_id = sprintf("%09s", $lead_id); while (length($PADlead_id) > 9) {chop($PADlead_id);}
if ($lists_update !~ /'$list_id'/) {$lists_update .= "'$list_id',"; $LUcount++;}
$lead_id_call_list .= "$lead_id|";
if (length($alt_dial)<1) {$alt_dial='MAIN';}
### whether to omit phone_code or not
if ($DBIPomitcode[$user_CIPct] > 0)
{$Ndialstring = "$Local_out_prefix$phone_number";}
else
{$Ndialstring = "$Local_out_prefix$phone_code$phone_number";}
if (length($ext_context) < 1) {$ext_context='default';}
### use manager middleware-app to connect the next call to the meetme room
# VmmddhhmmssLLLLLLLLL
$VqueryCID = "V$CIDdate$PADlead_id";
if ($CCID_on) {$CIDstring = "\"$VqueryCID\" <$CCID>";}
else {$CIDstring = "$VqueryCID";}
### 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','','','','')";
$affected_rows = $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
$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) values('$DBIPaddress[$user_CIPct]','$DBIPcampaign[$user_CIPct]','SENT','$lead_id','$VqueryCID','$phone_code','$phone_number','$SQLdate','OUT','$alt_dial','$DBIPqueue_priority[$user_CIPct]')";
$affected_rows = $dbhA->do($stmtA);
### sleep for a five hundredths of a second to not flood the server with new calls
# usleep(1*50*1000);
usleep(1*$per_call_delay*1000);
open(DUPout, ">>$PATHlogs/VDAD_DUPLICATE.$file_date")
|| die "Can't open $PATHlogs/VDAD_DUPLICATE.$file_date: $!\n";
print DUPout "$now_date-----$lead_id_call_list-----$lead_id\n";
close(DUPout);
}
}
$call_CMPIPct++;
else
{
$stmtA = "UPDATE vicidial_hopper set status='INCALL' where lead_id='$lead_id'";
print "|$stmtA|\n";
$UQaffected_rows = $dbhA->do($stmtA);
print "hopper row updated to INCALL: |$UQaffected_rows|$lead_id|\n";
### Gather lead data
$stmtA = "SELECT list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,address3,alt_phone,called_count,security_phrase FROM vicidial_list where lead_id='$lead_id';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_count=0;
$rec_countCUSTDATA=0;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$list_id = $aryA[0];
$gmt_offset_now = $aryA[1];
$called_since_last_reset = $aryA[2];
$phone_code = $aryA[3];
$phone_number = $aryA[4];
$address3 = $aryA[5];
$alt_phone = $aryA[6];
$called_count = $aryA[7];
$security_phrase = $aryA[8];
$rec_countCUSTDATA++;
$rec_count++;
}
$sthA->finish();
if ($rec_countCUSTDATA)
{
$campaign_cid_override='';
### gather list_id overrides
$stmtA = "SELECT campaign_cid_override FROM vicidial_lists where list_id='$list_id';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArowsL=$sthA->rows;
if ($sthArowsL > 0)
{
@aryA = $sthA->fetchrow_array;
$campaign_cid_override = $aryA[0];
}
$sthA->finish();
### update called_count
$called_count++;
if ($called_since_last_reset =~ /^Y/)
{
if ($called_since_last_reset =~ /^Y$/) {$CSLR = 'Y1';}
else
{
$called_since_last_reset =~ s/^Y//gi;
$called_since_last_reset++;
$CSLR = "Y$called_since_last_reset";
}
}
else {$CSLR = 'Y';}
$LLCT_DATE_offset = ($LOCAL_GMT_OFF - $gmt_offset_now);
$LLCT_DATE_offset_epoch = ( $secX - ($LLCT_DATE_offset * 3600) );
($Lsec,$Lmin,$Lhour,$Lmday,$Lmon,$Lyear,$Lwday,$Lyday,$Lisdst) = localtime($LLCT_DATE_offset_epoch);
$Lyear = ($Lyear + 1900);
$Lmon++;
if ($Lmon < 10) {$Lmon = "0$Lmon";}
if ($Lmday < 10) {$Lmday = "0$Lmday";}
if ($Lhour < 10) {$Lhour = "0$Lhour";}
if ($Lmin < 10) {$Lmin = "0$Lmin";}
if ($Lsec < 10) {$Lsec = "0$Lsec";}
$LLCT_DATE = "$Lyear-$Lmon-$Lmday $Lhour:$Lmin:$Lsec";
if ( ($alt_dial =~ /ALT|ADDR3|X/) && ($DBIPautoaltdial[$user_CIPct] =~ /ALT|ADDR|X/) )
{
if ( ($alt_dial =~ /ALT/) && ($DBIPautoaltdial[$user_CIPct] =~ /ALT/) )
{
$alt_phone =~ s/\D//gi;
$phone_number = $alt_phone;
}
if ( ($alt_dial =~ /ADDR3/) && ($DBIPautoaltdial[$user_CIPct] =~ /ADDR3/) )
{
$address3 =~ s/\D//gi;
$phone_number = $address3;
}
if ( ($alt_dial =~ /X/) && ($DBIPautoaltdial[$user_CIPct] =~ /X/) )
{
if ($alt_dial =~ /LAST/)
{
$stmtA = "SELECT phone_code,phone_number FROM vicidial_list_alt_phones where lead_id='$lead_id' order by alt_phone_count desc limit 1;";
}
else
{
$Talt_dial = $alt_dial;
$Talt_dial =~ s/\D//gi;
$stmtA = "SELECT phone_code,phone_number FROM vicidial_list_alt_phones where lead_id='$lead_id' and alt_phone_count='$Talt_dial';";
}
$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;
$phone_code = $aryA[0];
$phone_number = $aryA[1];
$phone_number =~ s/\D//gi;
}
$sthA->finish();
}
$stmtA = "UPDATE vicidial_list set called_since_last_reset='$CSLR',called_count='$called_count',user='VDAD',last_local_call_time='$LLCT_DATE' where lead_id='$lead_id'";
}
else
{
$stmtA = "UPDATE vicidial_list set called_since_last_reset='$CSLR', called_count='$called_count',user='VDAD',last_local_call_time='$LLCT_DATE' where lead_id='$lead_id'";
}
$affected_rows = $dbhA->do($stmtA);
$stmtA = "DELETE FROM vicidial_hopper where lead_id='$lead_id'";
$affected_rows = $dbhA->do($stmtA);
$CCID_on=0; $CCID='';
$local_DEF = 'Local/';
$local_AMP = '@';
$Local_out_prefix = '9';
$Local_dial_timeout = '60';
if ($DBIPdialtimeout[$user_CIPct] > 4) {$Local_dial_timeout = $DBIPdialtimeout[$user_CIPct];}
$Local_dial_timeout = ($Local_dial_timeout * 1000);
if (length($DBIPdialprefix[$user_CIPct]) > 0) {$Local_out_prefix = "$DBIPdialprefix[$user_CIPct]";}
if (length($DBIPvdadexten[$user_CIPct]) > 0) {$VDAD_dial_exten = "$DBIPvdadexten[$user_CIPct]";}
else {$VDAD_dial_exten = "$answer_transfer_agent";}
if (length($DBIPcampaigncid[$user_CIPct]) > 6) {$CCID = "$DBIPcampaigncid[$user_CIPct]"; $CCID_on++;}
if (length($campaign_cid_override) > 6) {$CCID = "$campaign_cid_override"; $CCID_on++;}
if ($DBIPuse_custom_cid[$user_CIPct] =~ /Y/)
{
$temp_CID = $security_phrase;
$temp_CID =~ s/\D//gi;
if (length($temp_CID) > 6)
{$CCID = "$temp_CID"; $CCID_on++;}
}
if ($DBIPdialprefix[$user_CIPct] =~ /x/i) {$Local_out_prefix = '';}
if ($RECcount)
{
if ( (length($RECprefix)>0) && ($called_count < $RECcount) )
{$Local_out_prefix .= "$RECprefix";}
}
$PADlead_id = sprintf("%09s", $lead_id); while (length($PADlead_id) > 9) {chop($PADlead_id);}
if ($lists_update !~ /'$list_id'/) {$lists_update .= "'$list_id',"; $LUcount++;}
$lead_id_call_list .= "$lead_id|";
if (length($alt_dial)<1) {$alt_dial='MAIN';}
### whether to omit phone_code or not
if ($DBIPomitcode[$user_CIPct] > 0)
{$Ndialstring = "$Local_out_prefix$phone_number";}
else
{$Ndialstring = "$Local_out_prefix$phone_code$phone_number";}
if (length($ext_context) < 1) {$ext_context='default';}
### use manager middleware-app to connect the next call to the meetme room
# VmmddhhmmssLLLLLLLLL
$VqueryCID = "V$CIDdate$PADlead_id";
if ($CCID_on) {$CIDstring = "\"$VqueryCID\" <$CCID>";}
else {$CIDstring = "$VqueryCID";}
### 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','','','','')";
$affected_rows = $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
$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) values('$DBIPaddress[$user_CIPct]','$DBIPcampaign[$user_CIPct]','SENT','$lead_id','$VqueryCID','$phone_code','$phone_number','$SQLdate','OUT','$alt_dial','$DBIPqueue_priority[$user_CIPct]')";
$affected_rows = $dbhA->do($stmtA);
### sleep for a five hundredths of a second to not flood the server with new calls
# usleep(1*50*1000);
usleep(1*$per_call_delay*1000);
}
}
$call_CMPIPct++;
}
}
}
}
+12 -3
View File
@@ -746,7 +746,8 @@ scheduled_callbacks_count ENUM('LIVE','ALL_ACTIVE') default 'ALL_ACTIVE',
manual_dial_override ENUM('NONE','ALLOW_ALL','DISABLE_ALL') default 'NONE',
blind_monitor_warning ENUM('DISABLED','ALERT','NOTICE','AUDIO','ALERT_NOTICE','ALERT_AUDIO','NOTICE_AUDIO','ALL') default 'DISABLED',
blind_monitor_message VARCHAR(255) default 'Someone is blind monitoring your session',
blind_monitor_filename VARCHAR(100) default ''
blind_monitor_filename VARCHAR(100) default '',
inbound_queue_no_dial ENUM('DISABLED','ENABLED','ALL_SERVERS') default 'DISABLED'
);
CREATE TABLE vicidial_lists (
@@ -1078,7 +1079,15 @@ ct_friday_start SMALLINT(4) unsigned default '0',
ct_friday_stop SMALLINT(4) unsigned default '0',
ct_saturday_start SMALLINT(4) unsigned default '0',
ct_saturday_stop SMALLINT(4) unsigned default '0',
ct_state_call_times TEXT default ''
ct_state_call_times TEXT default '',
default_afterhours_filename_override VARCHAR(255) default '',
sunday_afterhours_filename_override VARCHAR(255) default '',
monday_afterhours_filename_override VARCHAR(255) default '',
tuesday_afterhours_filename_override VARCHAR(255) default '',
wednesday_afterhours_filename_override VARCHAR(255) default '',
thursday_afterhours_filename_override VARCHAR(255) default '',
friday_afterhours_filename_override VARCHAR(255) default '',
saturday_afterhours_filename_override VARCHAR(255) default ''
);
CREATE TABLE vicidial_state_call_times (
@@ -2232,7 +2241,7 @@ ALTER TABLE vicidial_agent_log_archive MODIFY agent_log_id INT(9) UNSIGNED NOT N
CREATE TABLE vicidial_carrier_log_archive LIKE vicidial_carrier_log;
UPDATE system_settings SET db_schema_version='1222',db_schema_update_date=NOW();
UPDATE system_settings SET db_schema_version='1223',db_schema_update_date=NOW();
GRANT RELOAD ON *.* TO cron@'%';
GRANT RELOAD ON *.* TO cron@localhost;
+16
View File
@@ -330,3 +330,19 @@ UPDATE vicidial_inbound_groups SET hold_time_option_press_filename='to-be-called
UPDATE system_settings SET db_schema_version='1222',db_schema_update_date=NOW();
ALTER TABLE vicidial_campaigns ADD inbound_queue_no_dial ENUM('DISABLED','ENABLED','ALL_SERVERS') default 'DISABLED';
ALTER TABLE vicidial_call_times ADD default_afterhours_filename_override VARCHAR(255) default '';
ALTER TABLE vicidial_call_times ADD sunday_afterhours_filename_override VARCHAR(255) default '';
ALTER TABLE vicidial_call_times ADD monday_afterhours_filename_override VARCHAR(255) default '';
ALTER TABLE vicidial_call_times ADD tuesday_afterhours_filename_override VARCHAR(255) default '';
ALTER TABLE vicidial_call_times ADD wednesday_afterhours_filename_override VARCHAR(255) default '';
ALTER TABLE vicidial_call_times ADD thursday_afterhours_filename_override VARCHAR(255) default '';
ALTER TABLE vicidial_call_times ADD friday_afterhours_filename_override VARCHAR(255) default '';
ALTER TABLE vicidial_call_times ADD saturday_afterhours_filename_override VARCHAR(255) default '';
UPDATE system_settings SET db_schema_version='1223',db_schema_update_date=NOW();
@@ -190,6 +190,10 @@ If Hold Time Option is set to one of the PRESS_ options, this is the filename pr
If one of the PRESS_ options is selected, it will play the Press Filename defined below and give the customer the option to press 1 on their phone to leave the queue and run the selected option||
Hold Time Option After Press Filename||
If Hold Time Option is set to one of the PRESS_ options or CALLERID_CALLBACK, this is the filename prompt that is played after the customer has pressed 1 or the call has been added to the callback list||
Inbound Queue No Dial||
This feature if set to ENABLED allows you to prevent outbound auto-dialing of this campaign if there are any inbound calls waiting in queue that are part of the allowed inbound groups set in this campaign. Setting this to ALL_SERVERS will change the algorithm to calculate all inbound calls as active calls on this server even if they are on another server which will reduce the chance of placing unnecessary outbound calls if you have calls coming in on another server. Default is DISABLED||
After Hours Filename Override||
These fields allow you to override the After Hours message for inbound groups if it is set to something. Default is empty||
AST_VICIDIAL_ingrouplist.php
+65 -18
View File
File diff suppressed because one or more lines are too long