Added the AUTONEXT hopper_hold_inserts campaign option

Updates for inbound email parser perl script

git-svn-id: svn://192.168.202.10@3808 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2024-02-25 19:45:59 +00:00
parent 22d6975960
commit 69b9904b2b
11 changed files with 327 additions and 95 deletions
+5 -4
View File
@@ -158,9 +158,10 @@
# 231116-0911 - Added hopper_hold_inserts option
# 231129-0901 - Added vicidial_phone_number_call_daily_counts updates/inserts
# 240219-1524 - Added daily_limit in-group parameter
# 240225-0951 - Added AUTONEXT hopper_hold_inserts option
#
$build='240219-1524';
$build='240225-0951';
$script='AST_VDauto_dial';
### begin parsing run-time options ###
if (length($ARGV[0])>1)
@@ -3297,7 +3298,7 @@ while($one_day_interval > 0)
if ($passed_24hour_call_count > 0)
{
$hopper_status='READY';
if ($VD_hopper_hold_inserts =~ /ENABLED/) {$hopper_status='RHOLD';}
if ($VD_hopper_hold_inserts =~ /ENABLED|AUTONEXT/) {$hopper_status='RHOLD';}
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$CLlead_id',campaign_id='$CLcampaign_id',status='$hopper_status',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='ALT',user='',priority='25',source='A';";
$affected_rows = $dbhA->do($stmtA);
$event_string = "-- VDH record inserted: |$affected_rows| |$stmtA|"; &event_logger;
@@ -3403,7 +3404,7 @@ while($one_day_interval > 0)
if ($passed_24hour_call_count > 0)
{
$hopper_status='READY';
if ($VD_hopper_hold_inserts =~ /ENABLED/) {$hopper_status='RHOLD';}
if ($VD_hopper_hold_inserts =~ /ENABLED|AUTONEXT/) {$hopper_status='RHOLD';}
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$CLlead_id',campaign_id='$CLcampaign_id',status='$hopper_status',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='ADDR3',user='',priority='20',source='A';";
$affected_rows = $dbhA->do($stmtA);
$event_string = "-- VDH record inserted: |$affected_rows| |$stmtA|"; &event_logger;
@@ -3555,7 +3556,7 @@ while($one_day_interval > 0)
if ($passed_24hour_call_count > 0)
{
$hopper_status='READY';
if ($VD_hopper_hold_inserts =~ /ENABLED/) {$hopper_status='RHOLD';}
if ($VD_hopper_hold_inserts =~ /ENABLED|AUTONEXT/) {$hopper_status='RHOLD';}
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$CLlead_id',campaign_id='$CLcampaign_id',status='$hopper_status',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='X$Xlast',user='',priority='15',source='A';";
$affected_rows = $dbhA->do($stmtA);
$event_string = "-- VDH record inserted: |$affected_rows| |$stmtA|X$Xlast|$VD_altdial_id|"; &event_logger;
+8 -7
View File
@@ -22,7 +22,7 @@
# - S = Standard hopper load
# - D = Campaign Drop-Run
#
# Copyright (C) 2023 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2024 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGELOG
# 50810-1613 - Added database server variable definitions lookup
@@ -110,10 +110,11 @@
# 231116-0821 - Added hopper_hold_inserts system and campaign settings options
# 231126-1748 - Added RQUEUE hopper status
# 231129-1051 - Added daily_phone_number_call_limit campaign setting
# 240225-0954 - Added AUTONEXT hopper_hold_inserts campaign option
#
# constants
$build = '231129-1051';
$build = '240225-0954';
$script='AST_VDhopper';
$DB=0; # Debug flag, set to 0 for no debug messages. Can be overriden with CLI --debug flag
$US='__';
@@ -761,7 +762,7 @@ if ($CBHOLD_count > 0)
&event_logger;
$hopper_statusSQL='';
if ($VD_hopper_hold_inserts =~ /ENABLED/) {$hopper_statusSQL = ",status='RHOLD'";}
if ($VD_hopper_hold_inserts =~ /ENABLED|AUTONEXT/) {$hopper_statusSQL = ",status='RHOLD'";}
$stmtA = "INSERT INTO $vicidial_hopper SET lead_id='$CA_lead_id[$CAu]',campaign_id='$CA_campaign_id[$CAu]',list_id='$CA_list_id[$CAu]',gmt_offset_now='$CA_gmt_offset_now[$CAu]',user='',state=\"$CA_state[$CAu]\",priority='50',source='C',vendor_lead_code=\"$CA_vendor_lead_code[$CAu]\"$hopper_statusSQL;";
$affected_rows = $dbhA->do($stmtA);
if ($DB) {print "ANYONE Scheduled Callback Inserted into hopper: $affected_rows|$CA_lead_id[$CAu]\n";}
@@ -958,7 +959,7 @@ if ($hopper_dnc_count > 0)
if ($passed_24hour_call_count > 0)
{
$hopper_status='READY';
if ($VD_hopper_hold_inserts =~ /ENABLED/) {$hopper_status='RHOLD';}
if ($VD_hopper_hold_inserts =~ /ENABLED|AUTONEXT/) {$hopper_status='RHOLD';}
$stmtA = "UPDATE $vicidial_hopper SET status='$hopper_status',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='ALT',user='',priority='25' where hopper_id='$AAD_hopper_id[$aad]';";
$affected_rows = $dbhA->do($stmtA);
if ($DB) {$event_string = "-- VDH record updated: |$affected_rows| |$stmtA|"; &event_logger;}
@@ -1068,7 +1069,7 @@ if ($hopper_dnc_count > 0)
if ($passed_24hour_call_count > 0)
{
$hopper_status='READY';
if ($VD_hopper_hold_inserts =~ /ENABLED/) {$hopper_status='RHOLD';}
if ($VD_hopper_hold_inserts =~ /ENABLED|AUTONEXT/) {$hopper_status='RHOLD';}
$stmtA = "UPDATE $vicidial_hopper SET status='$hopper_status',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='ADDR3',user='',priority='20' where hopper_id='$AAD_hopper_id[$aad]';";
$affected_rows = $dbhA->do($stmtA);
if ($DB) {$event_string = "-- VDH record updated: |$affected_rows| |$stmtA|"; &event_logger;}
@@ -1222,7 +1223,7 @@ if ($hopper_dnc_count > 0)
if ($passed_24hour_call_count > 0)
{
$hopper_status='READY';
if ($VD_hopper_hold_inserts =~ /ENABLED/) {$hopper_status='RHOLD';}
if ($VD_hopper_hold_inserts =~ /ENABLED|AUTONEXT/) {$hopper_status='RHOLD';}
$stmtA = "UPDATE $vicidial_hopper SET status='$hopper_status',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='X$Xlast',user='',priority='15' where hopper_id='$AAD_hopper_id[$aad]';";
$affected_rows = $dbhA->do($stmtA);
if ($DB) {$event_string = "-- VDH record updated: |$affected_rows| |$stmtA|X$Xlast|$VD_altdial_id|"; &event_logger;}
@@ -3659,7 +3660,7 @@ foreach(@campaign_id)
if ( ($DCCLlead == '0') && ($TFHCCLlead == '0') )
{
$hopper_status='READY';
if ($hopper_hold_inserts[$i] =~ /ENABLED/) {$hopper_status='RHOLD';}
if ($hopper_hold_inserts[$i] =~ /ENABLED|AUTONEXT/) {$hopper_status='RHOLD';}
$stmtA = "INSERT INTO $vicidial_hopper (lead_id,campaign_id,status,user,list_id,gmt_offset_now,state,priority,source,vendor_lead_code) values('$leads_to_hopper[$h]','$campaign_id[$i]','$hopper_status','','$lists_to_hopper[$h]','$gmt_to_hopper[$h]',\"$state_to_hopper[$h]\",'$hopperPRIORITY','$source_to_hopper[$h]',\"$vlc_to_hopper[$h]\");";
$affected_rows = $dbhA->do($stmtA);
$DBinserted = ($DBinserted + $affected_rows);
+60 -5
View File
@@ -10,7 +10,7 @@ use Encode qw(from_to decode encode);
use MIME::Base64;
use MIME::QuotedPrint;
# Copyright (C) 2017 Matt Florell, Joe Johnson <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2024 Matt Florell, Joe Johnson <vicidial@gmail.com> LICENSE: AGPLv2
#
# AST_inbound_email_parser.pl - This script is essential for periodically checking any active POP3 or IMAP
# email accounts set up through the Vicidial admin.
@@ -66,6 +66,7 @@ use MIME::QuotedPrint;
# 161014-2200 - Bug patch for "&nbsp;" string in email message
# 170523-1319 - file attachment patch, issue #1014
# 171026-0106 - Added optional queue_log logging
# 240225-1442 - Changes for perl module compatibility and attachment compatibility
#
# default path to astguiclient configuration file:
@@ -291,7 +292,7 @@ while (@row=$rslt->fetchrow_array) {
( Proto => 'tcp',
PeerAddr => "$VARemail_server",
PeerPort => 993, # IMAP over SSL standard port
SSL_verify_mode => 'SSL_VERIFY_NONE',
SSL_verify_mode => SSL_VERIFY_NONE,
),
);
}
@@ -479,6 +480,30 @@ while (@row=$rslt->fetchrow_array) {
case "text/plain" {$attachment_fulltype="TXT";}
case "application/vnd.oasis.opendocument.text" {$attachment_fulltype="ODT";}
case "application/vnd.oasis.opendocument.spreadsheet" {$attachment_fulltype="ODS";}
case "application/vnd.ms-excel.sheet.binary.macroenabled.12" {$attachment_fulltype="XLSB";}
case "application/vnd.ms-excel.sheet.macroenabled.12" {$attachment_fulltype="XLSM";}
case "application/vnd.ms-excel.template.macroenabled.12" {$attachment_fulltype="XLTM";}
case "application/vnd.ms-word.document.macroenabled.12" {$attachment_fulltype="DOCM";}
case "application/vnd.ms-word.template.macroenabled.12" {$attachment_fulltype="DOTM";}
case "application/vnd.openxmlformats-officedocument.presentationml.presentation" {$attachment_fulltype="PPTX";}
case "application/vnd.openxmlformats-officedocument.presentationml.slideshow" {$attachment_fulltype="PPSX";}
case "application/vnd.openxmlformats-officedocument.presentationml.template" {$attachment_fulltype="POTX";}
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" {$attachment_fulltype="XLSX";}
case "application/vnd.openxmlformats-officedocument.spreadsheetml.template" {$attachment_fulltype="XLTX";}
case "application/vnd.openxmlformats-officedocument.wordprocessingml.document" {$attachment_fulltype="DOCX";}
case "application/vnd.openxmlformats-officedocument.wordprocessingml.template" {$attachment_fulltype="DOTX";}
case "application/vnd.visio" {$attachment_fulltype="VSD";}
case "application/x-7z-compressed" {$attachment_fulltype="7Z";}
case "application/xhtml+xml" {$attachment_fulltype="XHTML";}
case "application/xml" {$attachment_fulltype="XML";}
case "application/x-msaccess" {$attachment_fulltype="MDB";}
case "application/x-mspublisher" {$attachment_fulltype="PUB";}
case "application/x-rar-compressed" {$attachment_fulltype="RAR";}
case "image/emf" {$attachment_fulltype="EMF";}
case "image/tiff" {$attachment_fulltype="TIF";}
case "image/wmf" {$attachment_fulltype="WMF";}
case "text/html" {$attachment_fulltype="HTML";}
case "text/vcard-contact" {$attachment_fulltype="VCF";}
}
if ($sub_content_disposition=~/filename\=\"?(.*?)\"?$|filename=\"[^\"]+\"/i) {$attachment_filename=$&;}
if (length($attachment_filename)==0) {
@@ -507,7 +532,7 @@ while (@row=$rslt->fetchrow_array) {
if ($DB) {print "!!!!WARNING - Found valid attachment, type $attachment_type \n Attachment does not have file name. Skipping...\n";}
}
} else {
if ($DB) {print "!!!!WARNING - Found attachment $attachment_filename, but is NOT a valid file type \n Attachment type is $attachment_type. Skipping...\n";}
if ($DB) {print "!!!!WARNING - Found attachment $attachment_filename, but is NOT a valid file type \n Attachment type is $attachment_type ($attachment_fulltype). Skipping...\n";}
}
}
# print "\n";
@@ -600,7 +625,10 @@ while (@row=$rslt->fetchrow_array) {
my @lead_id_row=$vicidial_lead_check_rslt->fetchrow_array;
$lead_id=$lead_id_row[0];
} else {
my $vicidial_list_stmt="insert into vicidial_list(list_id, email, comments, status, entry_date, phone_code) values('$default_list_id', '$email_from', '".substr($message,0,255)."', '$status', NOW(), '$SSdefault_phone_code')";
StripHTML();
$vl_message=substr($message,0,255);
$vl_message=~s/\\+$//gi;
my $vicidial_list_stmt="insert into vicidial_list(list_id, email, comments, status, entry_date, phone_code) values('$default_list_id', '$email_from', '$vl_message', '$status', NOW(), '$SSdefault_phone_code')";
if ($DBX) {print $vicidial_list_stmt;}
my $vicidial_list_rslt=$dbhA->prepare($vicidial_list_stmt);
if ($vicidial_list_rslt->execute()) {
@@ -843,6 +871,30 @@ while (@row=$rslt->fetchrow_array) {
case "text/plain" {$attachment_fulltype="TXT";}
case "application/vnd.oasis.opendocument.text" {$attachment_fulltype="ODT";}
case "application/vnd.oasis.opendocument.spreadsheet" {$attachment_fulltype="ODS";}
case "application/vnd.ms-excel.sheet.binary.macroenabled.12" {$attachment_fulltype="XLSB";}
case "application/vnd.ms-excel.sheet.macroenabled.12" {$attachment_fulltype="XLSM";}
case "application/vnd.ms-excel.template.macroenabled.12" {$attachment_fulltype="XLTM";}
case "application/vnd.ms-word.document.macroenabled.12" {$attachment_fulltype="DOCM";}
case "application/vnd.ms-word.template.macroenabled.12" {$attachment_fulltype="DOTM";}
case "application/vnd.openxmlformats-officedocument.presentationml.presentation" {$attachment_fulltype="PPTX";}
case "application/vnd.openxmlformats-officedocument.presentationml.slideshow" {$attachment_fulltype="PPSX";}
case "application/vnd.openxmlformats-officedocument.presentationml.template" {$attachment_fulltype="POTX";}
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" {$attachment_fulltype="XLSX";}
case "application/vnd.openxmlformats-officedocument.spreadsheetml.template" {$attachment_fulltype="XLTX";}
case "application/vnd.openxmlformats-officedocument.wordprocessingml.document" {$attachment_fulltype="DOCX";}
case "application/vnd.openxmlformats-officedocument.wordprocessingml.template" {$attachment_fulltype="DOTX";}
case "application/vnd.visio" {$attachment_fulltype="VSD";}
case "application/x-7z-compressed" {$attachment_fulltype="7Z";}
case "application/xhtml+xml" {$attachment_fulltype="XHTML";}
case "application/xml" {$attachment_fulltype="XML";}
case "application/x-msaccess" {$attachment_fulltype="MDB";}
case "application/x-mspublisher" {$attachment_fulltype="PUB";}
case "application/x-rar-compressed" {$attachment_fulltype="RAR";}
case "image/emf" {$attachment_fulltype="EMF";}
case "image/tiff" {$attachment_fulltype="TIF";}
case "image/wmf" {$attachment_fulltype="WMF";}
case "text/html" {$attachment_fulltype="HTML";}
case "text/vcard-contact" {$attachment_fulltype="VCF";}
}
if ($sub_content_disposition=~/filename\=\"?(.*?)\"?$|filename=\"[^\"]+\"/i) {$attachment_filename=$&;}
if (length($attachment_filename)==0) {
@@ -974,7 +1026,10 @@ while (@row=$rslt->fetchrow_array) {
my @lead_id_row=$vicidial_lead_check_rslt->fetchrow_array;
$lead_id=$lead_id_row[0];
} else {
my $vicidial_list_stmt="insert into vicidial_list(list_id, email, comments, status, entry_date, phone_code) values('$default_list_id', '$email_from', '".substr($message,0,255)."', '$status', NOW(), '$SSdefault_phone_code')";
StripHTML();
$vl_message=substr($message, 0, 255);
$vl_message=~s/\\+$//gi;
my $vicidial_list_stmt="insert into vicidial_list(list_id, email, comments, status, entry_date, phone_code) values('$default_list_id', '$email_from', '$vl_message', '$status', NOW(), '$SSdefault_phone_code')";
if ($DBX) {print $vicidial_list_stmt."\n";}
my $vicidial_list_rslt=$dbhA->prepare($vicidial_list_stmt);
if ($vicidial_list_rslt->execute()) {
+5 -4
View File
@@ -25,7 +25,7 @@
# exten => h,1,DeadAGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME})
#
#
# Copyright (C) 2023 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2024 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGELOG:
# 61010-1007 - First test build
@@ -99,6 +99,7 @@
# 230120-1557 - Added CAMPDTO dialplan variable for ^DC 3-way agent screen calls
# 231116-0846 - Added hopper_hold_inserts option
# 231118-1054 - Added hangup processing of 3-way press outside-agent calls
# 240225-0957 - Added AUTONEXT hopper_hold_inserts campaign option
#
# defaults for PreFork
@@ -2290,7 +2291,7 @@ sub process_request
if ($passed_24hour_call_count > 0)
{
$hopper_status='READY';
if ($VD_hopper_hold_inserts =~ /ENABLED/) {$hopper_status='RHOLD';}
if ($VD_hopper_hold_inserts =~ /ENABLED|AUTONEXT/) {$hopper_status='RHOLD';}
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$VD_lead_id',campaign_id='$VD_campaign_id',status='$hopper_status',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='ALT',user='',priority='25',source='A';";
$affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VDH record inserted: |$affected_rows| |$stmtA|"; &agi_output;}
@@ -2398,7 +2399,7 @@ sub process_request
if ($passed_24hour_call_count > 0)
{
$hopper_status='READY';
if ($VD_hopper_hold_inserts =~ /ENABLED/) {$hopper_status='RHOLD';}
if ($VD_hopper_hold_inserts =~ /ENABLED|AUTONEXT/) {$hopper_status='RHOLD';}
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$VD_lead_id',campaign_id='$VD_campaign_id',status='$hopper_status',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='ADDR3',user='',priority='20',source='A';";
$affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VDH record inserted: |$affected_rows| |$stmtA|"; &agi_output;}
@@ -2548,7 +2549,7 @@ sub process_request
if ($passed_24hour_call_count > 0)
{
$hopper_status='READY';
if ($VD_hopper_hold_inserts =~ /ENABLED/) {$hopper_status='RHOLD';}
if ($VD_hopper_hold_inserts =~ /ENABLED|AUTONEXT/) {$hopper_status='RHOLD';}
$stmtA = "INSERT INTO vicidial_hopper SET lead_id='$VD_lead_id',campaign_id='$VD_campaign_id',status='$hopper_status',list_id='$VD_list_id',gmt_offset_now='$VD_gmt_offset_now',state='$VD_state',alt_dial='X$Xlast',user='',priority='15',source='A';";
$affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- VDH record inserted: |$affected_rows| |$stmtA|X$Xlast|$VD_altdial_id|"; &agi_output;}