diff --git a/AST_VDhopper.pl b/AST_VDhopper.pl index 965ad5b..2d78bba 100644 --- a/AST_VDhopper.pl +++ b/AST_VDhopper.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# AST_VDhopper.pl version 0.5 +# AST_VDhopper.pl version 0.7 # # DESCRIPTION: # uses Net::MySQL to update the VICIDIAL leads hopper for the new streamlined @@ -31,6 +31,7 @@ # 60228-1735 - Added hopper gmt validation to remove gmt outside of time range # 60320-0932 - Added inactive lead list hopper deletion (Thanks Vic Jolin) # 60322-1030 - Added super debug output +# 60418-0947 - Added lead filter per campaign # # constants @@ -38,6 +39,10 @@ $DB=0; # Debug flag, set to 0 for no debug messages, On an active system this w $US='__'; $MT[0]=''; +# options +$insert_auto_CB_to_hopper = 1; # set to 1 to automatically insert ANYONE callbacks into the hopper + + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); $year = ($year + 1900); $mon++; @@ -206,7 +211,7 @@ if ($inactive_lists_count > 0) ### BEGIN Change CBHOLD status leads to CALLBK if their vicidial_callbacks time has passed -$stmtA = "SELECT count(*) FROM vicidial_callbacks where callback_time <= '$now_date' and status='ACTIVE' and recipient='ANYONE';"; +$stmtA = "SELECT count(*) FROM vicidial_callbacks where callback_time <= '$now_date' and status='ACTIVE';"; $dbhA->query("$stmtA"); if ($dbhA->has_selected_record) { @@ -222,16 +227,26 @@ if ($dbhA->has_selected_record) if ($CBHOLD_count > 0) { $update_leads=''; - $stmtA = "SELECT lead_id FROM vicidial_callbacks where callback_time <= '$now_date' and status='ACTIVE' and recipient='ANYONE';"; + $stmtA = "SELECT vicidial_callbacks.lead_id,recipient,campaign_id,vicidial_callbacks.list_id,gmt_offset_now FROM vicidial_callbacks,vicidial_list where callback_time <= '$now_date' and vicidial_callbacks.status='ACTIVE' and vicidial_callbacks.lead_id=vicidial_list.lead_id;"; $dbhA->query("$stmtA"); if ($dbhA->has_selected_record) { $iter=$dbhA->create_record_iterator; $cbc=0; + $cba=0; while ( $record = $iter->each) { $lead_ids[$cbc] = $record->[0]; + $recipient = $record->[1]; $update_leads .= "'$lead_ids[$cbc]',"; + if ($recipient == 'ANYONE') + { + $CA_lead_id[$cba] = $record->[0]; + $CA_campaign_id[$cba] = $record->[2]; + $CA_list_id[$cba] = $record->[3]; + $CA_gmt_offset_now[$cba] = $record->[4]; + $cba++; + } $cbc++; } } @@ -254,6 +269,20 @@ if ($CBHOLD_count > 0) &event_logger; } + ### INSERT ANYONE CALLBACKS INTO HOPPER DIRECTLY ### + if ( ($cba > 0) && ($insert_auto_CB_to_hopper) ) + { + if ($DB) {print "ANYONE Scheduled Callbacks Inserted into hopper: $cba\n";} + $event_string = "|ANYONE CB HOPPER |$cba|"; + &event_logger; + $CAu=0; + foreach(@CA_lead_id) + { + $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]';"; + $dbhA->query("$stmtA"); + $CAu++; + } + } } ### END Change CBHOLD status leads to CALLBK if their vicidial_callbacks time has passed @@ -289,6 +318,7 @@ if ($dbhA->has_selected_record) else {$hopper_level[$rec_count] = "$CLIlevel";} $local_call_time[$rec_count] = "$record->[16]"; + $lead_filter_id[$rec_count] = "$record->[35]"; $rec_count++; } } @@ -407,6 +437,7 @@ foreach(@campaign_id) { if ($DB) {print " hopper too low ($hopper_ready_count|$hopper_level[$i]) starting hopper dump\n";} + ### Get list of the lists in the campaign ### $stmtA = "SELECT list_id FROM vicidial_lists where campaign_id='$campaign_id[$i]' and active='Y';"; $dbhA->query("$stmtA"); if ($dbhA->has_selected_record) @@ -424,7 +455,33 @@ foreach(@campaign_id) if ($DB) {print " campaign lists count: $rec_countLISTS | $camp_lists\n";} if ($DBX) {print " |$stmtA|\n";} - $stmtA = "SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and status IN('$dial_status_a[$i]','$dial_status_b[$i]','$dial_status_c[$i]','$dial_status_d[$i]','$dial_status_e[$i]') and list_id IN($camp_lists) and gmt_offset_now IN($GMT_allowed);"; + if ( ($lead_filter_id[$i] !~ /NONE/) && (length($lead_filter_id[$i])>0) ) + { + ### Get SQL of lead filter for the campaign ### + $stmtA = "SELECT lead_filter_sql FROM vicidial_lead_filters where lead_filter_id='$lead_filter_id[$i]';"; + $dbhA->query("$stmtA"); + if ($dbhA->has_selected_record) + { + $iter=$dbhA->create_record_iterator; + while ( $record = $iter->each) + { + $lead_filter_sql[$i] = "$record->[0]"; + } + } + $lead_filter_sql[$i] =~ s/^and|and$|^or|or$|^ and|and $|^ or|or $//gi; + $lead_filter_sql[$i] = "and $lead_filter_sql[$i]"; + if ($DB) {print " campaign lists count: $rec_countLISTS | $camp_lists\n";} + if ($DB) {print " lead filter $lead_filter_id[$i] defined for $campaign_id[$i]\n";} + if ($DBX) {print " |$lead_filter_sql[$i]|\n";} + } + else + { + $lead_filter_sql[$i] = ''; + if ($DB) {print " no lead filter defined for campaign: $campaign_id[$i]\n";} + if ($DBX) {print " |$lead_filter_id[$i]|\n";} + } + + $stmtA = "SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and status IN('$dial_status_a[$i]','$dial_status_b[$i]','$dial_status_c[$i]','$dial_status_d[$i]','$dial_status_e[$i]') and list_id IN($camp_lists) and gmt_offset_now IN($GMT_allowed) $lead_filter_sql[$i];"; $dbhA->query("$stmtA"); $campaign_leads_to_call=0; if ($dbhA->has_selected_record) @@ -439,7 +496,7 @@ foreach(@campaign_id) } if ( ($lead_order[$i] eq "DOWN COUNT 2nd NEW") or ($lead_order[$i] eq "DOWN COUNT 3rd NEW") or ($lead_order[$i] eq "DOWN COUNT 4th NEW") ) { - $stmtA = "SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and status IN('NEW') and list_id IN($camp_lists) and gmt_offset_now IN($GMT_allowed);"; + $stmtA = "SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and status IN('NEW') and list_id IN($camp_lists) and gmt_offset_now IN($GMT_allowed) $lead_filter_sql[$i];"; $dbhA->query("$stmtA"); $NEW_campaign_leads_to_call=0; if ($dbhA->has_selected_record) @@ -509,7 +566,7 @@ foreach(@campaign_id) $order_stmt = 'order by called_count, lead_id asc'; if ($DB) {print " looking for $NEW_level NEW leads mixed in with $OTHER_level other leads\n";} - $stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state FROM vicidial_list where called_since_last_reset='N' and status IN('NEW') and list_id IN($camp_lists) and lead_id NOT IN($lead_id_lists) and gmt_offset_now IN($GMT_allowed) $order_stmt limit $NEW_level;"; + $stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state FROM vicidial_list where called_since_last_reset='N' and status IN('NEW') and list_id IN($camp_lists) and lead_id NOT IN($lead_id_lists) and gmt_offset_now IN($GMT_allowed) $lead_filter_sql[$i] $order_stmt limit $NEW_level;"; if ($DBX) {print " |$stmtA|\n";} $dbhA->query("$stmtA"); if ($dbhA->has_selected_record) @@ -535,7 +592,7 @@ foreach(@campaign_id) if ($DB) {print " lead call order: $order_stmt\n";} - $stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state FROM vicidial_list where called_since_last_reset='N' and status IN('$dial_status_a[$i]','$dial_status_b[$i]','$dial_status_c[$i]','$dial_status_d[$i]','$dial_status_e[$i]') and list_id IN($camp_lists) and lead_id NOT IN($lead_id_lists) and gmt_offset_now IN($GMT_allowed) $order_stmt limit $OTHER_level;"; + $stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state FROM vicidial_list where called_since_last_reset='N' and status IN('$dial_status_a[$i]','$dial_status_b[$i]','$dial_status_c[$i]','$dial_status_d[$i]','$dial_status_e[$i]') and list_id IN($camp_lists) and lead_id NOT IN($lead_id_lists) and gmt_offset_now IN($GMT_allowed) $lead_filter_sql[$i] $order_stmt limit $OTHER_level;"; if ($DBX) {print " |$stmtA|\n";} $dbhA->query("$stmtA"); if ($dbhA->has_selected_record) diff --git a/DTMF_sounds/buzz.gsm b/DTMF_sounds/buzz.gsm new file mode 100644 index 0000000..9549d64 Binary files /dev/null and b/DTMF_sounds/buzz.gsm differ diff --git a/DTMF_sounds/ding.gsm b/DTMF_sounds/ding.gsm new file mode 100644 index 0000000..2680c52 Binary files /dev/null and b/DTMF_sounds/ding.gsm differ diff --git a/MySQL_AST_CREATE_tables.sql b/MySQL_AST_CREATE_tables.sql index 5897764..8c5e2ef 100644 --- a/MySQL_AST_CREATE_tables.sql +++ b/MySQL_AST_CREATE_tables.sql @@ -446,7 +446,10 @@ amd_send_to_vmx ENUM('Y','N') default 'N', xferconf_a_dtmf VARCHAR(50), xferconf_a_number VARCHAR(50), xferconf_b_dtmf VARCHAR(50), -xferconf_b_number VARCHAR(50) +xferconf_b_number VARCHAR(50), +alt_number_dialing ENUM('Y','N') default 'N', +scheduled_callbacks ENUM('Y','N') default 'N', +lead_filter_id VARCHAR(10) default 'NONE' ); CREATE TABLE vicidial_lists ( @@ -645,3 +648,10 @@ index (lead_id), index (phone_number), index (entry_time) ); + + CREATE TABLE vicidial_lead_filters ( +lead_filter_id VARCHAR(10) PRIMARY KEY NOT NULL, +lead_filter_name VARCHAR(30) NOT NULL, +lead_filter_comments VARCHAR(255), +lead_filter_sql TEXT +); diff --git a/TO_BE_TRANSLATED.txt b/TO_BE_TRANSLATED.txt new file mode 100644 index 0000000..0c10831 --- /dev/null +++ b/TO_BE_TRANSLATED.txt @@ -0,0 +1,73 @@ +############################################################ ADMIN + +Add New Filter +New Filter Addition +Modify Filter +Delete Filter +Filters +Filter ID - This is the short name of a Vicidial Lead Filter. This needs to be a unique identifier. Do not use any spaces or punctuation for this field. max 10 characters, minimum of 2 characters +Filter Name - This is a more descriptive name of the Filter. This is a short summary of the filter. max 30 characters, minimum of 2 characters +Filter Comments - This is where you can place comments for a Vicidial Filter such as -calls all California leads-. max 255 characters, minimum of 2 characters +Filter SQL - This is where you place the SQL query fragment that you want to filter by. do not begin or end with an AND, that will be added by the hopper cron script automatically. an example SQL query that would work here is- called_count > 4 and called_count < 8 - +ADD NEW FILTER +Filter ID: +Filter Name: +Filter Comments: +Filter SQL: +short description of the filter +FILTER NOT ADDED - there is already a filter entry with this ID +Please go back and look at the data you entered +FILTER NOT ADDED +FILTER NOT MODIFIED +FILTER NOT DELETED +Filter ID, name and SQL must be at least 2 characters in length +FILTER ADDED: +FILTER MODIFIED +Filter ID must be at least 2 characters in length +Click here to delete filter +FILTER DELETION COMPLETED: +MODIFY A FILTER +DELETE THIS FILTER +LEAD FILTER LISTINGS: +VIEW FILTERS +Lead Filter: +Lead Filter - 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 +Agent Alt Num Dialing: +Agent Alt Num Dialing - This option allows an agent to manually dial the alternate phone number or address3 field after the main number has been called +Scheduled Callbacks - This option allows an agent to disposition a call as CALLBK and choose the data and time at which the lead will be re-activated +Agent-Only Callbacks - This option allows an agent to set a callback so that they are the only Agent that can call the customer back. This also allows the agent to see their callback listings and call them back any time they want to +Agent Call Manual - This option allows an agent to manually enter a new lead into the system and call them. This also allows the calling of any phone number from their vicidial screen and puts that call into their session. Use this option with caution +Vicidial Recording - This option can prevent an agent from doing any recordings after they log in to vicidial. This option must be on for vicidial to follow the campaign recording session +Vicidial Transfers - This option can prevent an agent from opening the transfer - conference session of vicidial. If this is disabled, the agent cannot third party call or blind transfer any calls +Delete Filters - This option allows the user to be able to delete vicidial lead filters from the system +Scheduled Callbacks: +Agent-Only Callbacks: + + +############################################################ CLIENT + +Hangup Again +Go Back +Call Agent Again +Finish and Disposition Call +MY CALLBACK ONLY +MANUAL DIAL +ACTIVE CALLBACKS +CALLBACKS FOR AGENT +Click on a callback below to call the customer back now. If you click on a record below to call it, it will be removed from the list +YOU MUST BE PAUSED TO CHECK CALLBACKS IN AUTO-DIAL MODE +YOU CANNOT SKIP A CALLBACK OR MANUAL DIAL, YOU MUST DIAL THE LEAD +YOU MUST BE PAUSED TO MANUAL DIAL A NEW LEAD IN AUTO-DIAL MODE +NEW MANUAL DIAL LEAD FOR +Enter information below for the new lead you wish to call +Note: a dial prefix of +with be added to the beginning of this number +This is usually a 1 in the USA-Canada +Dial Code: +10 digits max - digits only +Note: all new manual dial leads will go into list 999 +If you want to dial a number and have it NOT be added as a new lead, enter in the exact dialstring that you want to call in the Dial Override field below. To hangup this call you will have to open the CALLS IN THIS SESSION link at the bottom of the screen and hang it up by clicking on its channel link there +Dial Override +digits only please +Dial Now +YOU DO NOT HAVE PERMISSIONS TO TRANSFER CALLS diff --git a/VICIDIAL_web/admin.php b/VICIDIAL_web/admin.php index 269da19..f905ab9 100644 --- a/VICIDIAL_web/admin.php +++ b/VICIDIAL_web/admin.php @@ -95,8 +95,17 @@ $modify_leads=$_GET["modify_leads"]; if (!$modify_leads) {$modify_leads=$_POST[ $hotkeys_active=$_GET["hotkeys_active"]; if (!$hotkeys_active) {$hotkeys_active=$_POST["hotkeys_active"];} $change_agent_campaign=$_GET["change_agent_campaign"]; if (!$change_agent_campaign) {$change_agent_campaign=$_POST["change_agent_campaign"];} $agent_choose_ingroups=$_GET["agent_choose_ingroups"]; if (!$agent_choose_ingroups) {$agent_choose_ingroups=$_POST["agent_choose_ingroups"];} - - +$alt_number_dialing=$_GET["alt_number_dialing"]; if (!$alt_number_dialing) {$alt_number_dialing=$_POST["alt_number_dialing"];} +$scheduled_callbacks=$_GET["scheduled_callbacks"]; if (!$scheduled_callbacks) {$scheduled_callbacks=$_POST["scheduled_callbacks"];} +$lead_filter_id=$_GET["lead_filter_id"]; if (!$lead_filter_id) {$lead_filter_id=$_POST["lead_filter_id"];} +$lead_filter_name=$_GET["lead_filter_name"]; if (!$lead_filter_name) {$lead_filter_name=$_POST["lead_filter_name"];} +$lead_filter_comments=$_GET["lead_filter_comments"]; if (!$lead_filter_comments) {$lead_filter_comments=$_POST["lead_filter_comments"];} +$lead_filter_sql=$_GET["lead_filter_sql"]; if (!$lead_filter_sql) {$lead_filter_sql=$_POST["lead_filter_sql"];} +$agentonly_callbacks=$_GET["agentonly_callbacks"]; if (!$agentonly_callbacks) {$agentonly_callbacks=$_POST["agentonly_callbacks"];} +$agentcall_manual=$_GET["agentcall_manual"]; if (!$agentcall_manual) {$agentcall_manual=$_POST["agentcall_manual"];} +$vicidial_recording=$_GET["vicidial_recording"]; if (!$vicidial_recording) {$vicidial_recording=$_POST["vicidial_recording"];} +$vicidial_transfers=$_GET["vicidial_transfers"]; if (!$vicidial_transfers) {$vicidial_transfers=$_POST["vicidial_transfers"];} +$delete_filters=$_GET["delete_filters"]; if (!$delete_filters) {$delete_filters=$_POST["delete_filters"];} ### AST GUI database administration @@ -133,12 +142,18 @@ $agent_choose_ingroups=$_GET["agent_choose_ingroups"]; if (!$agent_choose_ingrou ### 60227-1226 - Fixed vicidial_inbound_groups insert bug ### 60413-1308 - Fixed list display to have 1 row/status: count and time zone tables ### - Added status name in selected dial statuses in campaign screen +### 60417-1416 - Added vicidial_lead_filters sections +### - Changed the header links to color-coded sectional with sublinks below +### - Added filter name and script name to campaign and in-group modify sections +### - Added callback and alt dial options to campaigns section +### - Added callback, alt dial and other options to users section +### 60419-1628 - Alter Callbacks display to include status and LIVE listings, reordered ### ### make sure you have added a user to the vicidial_users MySQL table with at least user_level 8 to access this page the first time -$version = '1.1.10-6'; -$build = '60413-1308'; +$version = '1.1.10-8'; +$build = '60419-1628'; $STARTtime = date("U"); @@ -194,6 +209,7 @@ $browser = getenv("HTTP_USER_AGENT"); $LOGload_leads =$row[14]; $LOGcampaign_detail =$row[15]; $LOGdelete_scripts =$row[18]; + $LOGdelete_filters =$row[29]; if ($WeBRooTWritablE > 0) { @@ -217,71 +233,78 @@ echo "
\n"; echo "\n"; echo "