From dbec4b65f73e62b667ce78f5abc0f31a683af7f5 Mon Sep 17 00:00:00 2001 From: mattf Date: Tue, 10 May 2022 15:26:38 +0000 Subject: [PATCH] Added pre_filter_recent_call DID settings and Inbound DID Detail Report git-svn-id: svn://192.168.202.10@3598 3d104415-ff17-0410-8863-d5cf3c621b8a --- agc_2-X/trunk/UPGRADE | 6 + agc_2-X/trunk/agi/agi-DID_route.agi | 296 +++++++++++++++++- .../trunk/extras/MySQL_AST_CREATE_tables.sql | 4 +- agc_2-X/trunk/extras/upgrade_2.14.sql | 5 + agc_2-X/trunk/www/vicidial/admin.php | 78 ++++- .../trunk/www/vicidial/help_documentation.txt | 5 +- 6 files changed, 381 insertions(+), 13 deletions(-) diff --git a/agc_2-X/trunk/UPGRADE b/agc_2-X/trunk/UPGRADE index 52199973..305ecfdf 100644 --- a/agc_2-X/trunk/UPGRADE +++ b/agc_2-X/trunk/UPGRADE @@ -716,6 +716,12 @@ OTHER CHANGES: 200. Added List CID Group Override to the List Modification admin screen. +201. Added "Pre-Filter Recent Call" DID feature, to be able to filter out + inbound calls based on the caller phone number and whether it had been + called(or had called in) within the last X number of days. + +202. Added the "Inbound DID Detail Report" to the Admin Utilities page. + diff --git a/agc_2-X/trunk/agi/agi-DID_route.agi b/agc_2-X/trunk/agi/agi-DID_route.agi index 9c2ec833..0f32750b 100644 --- a/agc_2-X/trunk/agi/agi-DID_route.agi +++ b/agc_2-X/trunk/agi/agi-DID_route.agi @@ -13,7 +13,7 @@ # ;inbound DID catch-all: #exten => _X.,1,AGI(agi-DID_route.agi) # -# Copyright (C) 2021 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2022 Matt Florell LICENSE: AGPLv2 # # changes: # 81007-0324 - First Build @@ -48,6 +48,7 @@ # 200623-2258 - Added Answer Signal options # 201112-0834 - Fix for AGENT routing, check for availability, issue #1211 # 210315-1132 - Fix for multiple filter_clean_cid_number actions, added 'T' filter action, Issue #1247 +# 220507-0811 - Added pre_filter_recent_call function # @@ -57,6 +58,7 @@ $at='@'; $S='*'; $US='_'; $route_type='DID'; +$DBX=1; # set to 1 for extra debugging output ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); $year = ($year + 1900); @@ -220,7 +222,7 @@ $extension =~ s/\'|\"|\\\\|\\\|\\|\\;|\\\;|\;|;//gi; if ($SSdid_system_filter > 0) { if ($AGILOG) {$agi_string = "-- DID SYSTEM FILTER ENABLED: |$SSdid_system_filter|"; &agi_output;} - $stmtA = "SELECT did_id,did_pattern,did_description,did_active,did_route,extension,exten_context,voicemail_ext,phone,server_ip,user,user_unavailable_action,user_route_settings_ingroup,menu_id,record_call,filter_inbound_number,filter_phone_group_id,filter_url,filter_action,filter_extension,filter_exten_context,filter_voicemail_ext,filter_phone,filter_server_ip,filter_user,filter_user_unavailable_action,filter_user_route_settings_ingroup,filter_group_id,filter_call_handle_method,filter_agent_search_method,filter_list_id,filter_campaign_id,filter_phone_code,filter_menu_id,filter_clean_cid_number,group_id,filter_dnc_campaign,filter_url_did_redirect,no_agent_ingroup_redirect,no_agent_ingroup_id,no_agent_ingroup_extension,pre_filter_phone_group_id,pre_filter_extension,max_queue_ingroup_calls,max_queue_ingroup_id,max_queue_ingroup_extension,inbound_route_answer FROM vicidial_inbound_dids where did_pattern = 'did_system_filter' and did_active='Y';"; + $stmtA = "SELECT did_id,did_pattern,did_description,did_active,did_route,extension,exten_context,voicemail_ext,phone,server_ip,user,user_unavailable_action,user_route_settings_ingroup,menu_id,record_call,filter_inbound_number,filter_phone_group_id,filter_url,filter_action,filter_extension,filter_exten_context,filter_voicemail_ext,filter_phone,filter_server_ip,filter_user,filter_user_unavailable_action,filter_user_route_settings_ingroup,filter_group_id,filter_call_handle_method,filter_agent_search_method,filter_list_id,filter_campaign_id,filter_phone_code,filter_menu_id,filter_clean_cid_number,group_id,filter_dnc_campaign,filter_url_did_redirect,no_agent_ingroup_redirect,no_agent_ingroup_id,no_agent_ingroup_extension,pre_filter_phone_group_id,pre_filter_extension,max_queue_ingroup_calls,max_queue_ingroup_id,max_queue_ingroup_extension,inbound_route_answer,pre_filter_recent_call,pre_filter_recent_extension FROM vicidial_inbound_dids where did_pattern = 'did_system_filter' and did_active='Y';"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -274,6 +276,8 @@ if ($SSdid_system_filter > 0) $max_queue_ingroup_id = $aryA[44]; $max_queue_ingroup_extension = $aryA[45]; $inbound_route_answer = $aryA[46]; + $pre_filter_recent_call = $aryA[47]; + $pre_filter_recent_extension = $aryA[48]; } else { @@ -679,7 +683,7 @@ if ($SSdid_system_filter > 0) ### Grab DID values from the database $DIDs_in_system=0; -$stmtA = "SELECT did_id,did_pattern,did_description,did_active,did_route,extension,exten_context,voicemail_ext,phone,server_ip,user,user_unavailable_action,user_route_settings_ingroup,menu_id,record_call,filter_inbound_number,filter_phone_group_id,filter_url,filter_action,filter_extension,filter_exten_context,filter_voicemail_ext,filter_phone,filter_server_ip,filter_user,filter_user_unavailable_action,filter_user_route_settings_ingroup,filter_group_id,filter_call_handle_method,filter_agent_search_method,filter_list_id,filter_campaign_id,filter_phone_code,filter_menu_id,filter_clean_cid_number,group_id,filter_dnc_campaign,filter_url_did_redirect,no_agent_ingroup_redirect,no_agent_ingroup_id,no_agent_ingroup_extension,pre_filter_phone_group_id,pre_filter_extension,max_queue_ingroup_calls,max_queue_ingroup_id,max_queue_ingroup_extension,inbound_route_answer FROM vicidial_inbound_dids where did_pattern = '$extension' and did_active='Y';"; +$stmtA = "SELECT did_id,did_pattern,did_description,did_active,did_route,extension,exten_context,voicemail_ext,phone,server_ip,user,user_unavailable_action,user_route_settings_ingroup,menu_id,record_call,filter_inbound_number,filter_phone_group_id,filter_url,filter_action,filter_extension,filter_exten_context,filter_voicemail_ext,filter_phone,filter_server_ip,filter_user,filter_user_unavailable_action,filter_user_route_settings_ingroup,filter_group_id,filter_call_handle_method,filter_agent_search_method,filter_list_id,filter_campaign_id,filter_phone_code,filter_menu_id,filter_clean_cid_number,group_id,filter_dnc_campaign,filter_url_did_redirect,no_agent_ingroup_redirect,no_agent_ingroup_id,no_agent_ingroup_extension,pre_filter_phone_group_id,pre_filter_extension,max_queue_ingroup_calls,max_queue_ingroup_id,max_queue_ingroup_extension,inbound_route_answer,pre_filter_recent_call,pre_filter_recent_extension FROM vicidial_inbound_dids where did_pattern = '$extension' and did_active='Y';"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -733,6 +737,8 @@ if ($sthArows > 0) $max_queue_ingroup_id = $aryA[44]; $max_queue_ingroup_extension = $aryA[45]; $inbound_route_answer = $aryA[46]; + $pre_filter_recent_call = $aryA[47]; + $pre_filter_recent_extension = $aryA[48]; $DIDs_in_system++; } @@ -741,7 +747,7 @@ $sthA->finish(); if ($sthArows < 1) { ### Grab DID values from the database for a default DID pattern if there is one - $stmtA = "SELECT did_id,did_pattern,did_description,did_active,did_route,extension,exten_context,voicemail_ext,phone,server_ip,user,user_unavailable_action,user_route_settings_ingroup,menu_id,record_call,filter_inbound_number,filter_phone_group_id,filter_url,filter_action,filter_extension,filter_exten_context,filter_voicemail_ext,filter_phone,filter_server_ip,filter_user,filter_user_unavailable_action,filter_user_route_settings_ingroup,filter_group_id,filter_call_handle_method,filter_agent_search_method,filter_list_id,filter_campaign_id,filter_phone_code,filter_menu_id,filter_clean_cid_number,group_id,filter_dnc_campaign,filter_url_did_redirect,no_agent_ingroup_redirect,no_agent_ingroup_id,no_agent_ingroup_extension,pre_filter_phone_group_id,pre_filter_extension,max_queue_ingroup_calls,max_queue_ingroup_id,max_queue_ingroup_extension,inbound_route_answer FROM vicidial_inbound_dids where did_pattern = 'default' and did_active='Y';"; + $stmtA = "SELECT did_id,did_pattern,did_description,did_active,did_route,extension,exten_context,voicemail_ext,phone,server_ip,user,user_unavailable_action,user_route_settings_ingroup,menu_id,record_call,filter_inbound_number,filter_phone_group_id,filter_url,filter_action,filter_extension,filter_exten_context,filter_voicemail_ext,filter_phone,filter_server_ip,filter_user,filter_user_unavailable_action,filter_user_route_settings_ingroup,filter_group_id,filter_call_handle_method,filter_agent_search_method,filter_list_id,filter_campaign_id,filter_phone_code,filter_menu_id,filter_clean_cid_number,group_id,filter_dnc_campaign,filter_url_did_redirect,no_agent_ingroup_redirect,no_agent_ingroup_id,no_agent_ingroup_extension,pre_filter_phone_group_id,pre_filter_extension,max_queue_ingroup_calls,max_queue_ingroup_id,max_queue_ingroup_extension,inbound_route_answer,pre_filter_recent_call,pre_filter_recent_extension FROM vicidial_inbound_dids where did_pattern = 'default' and did_active='Y';"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $DIDs_in_system=$sthA->rows; @@ -795,6 +801,8 @@ if ($sthArows < 1) $max_queue_ingroup_id = $aryA[44]; $max_queue_ingroup_extension = $aryA[45]; $inbound_route_answer = $aryA[46]; + $pre_filter_recent_call = $aryA[47]; + $pre_filter_recent_extension = $aryA[48]; } $sthA->finish(); } @@ -988,6 +996,286 @@ if ( (length($pre_filter_phone_group_id)>0) && (length($pre_filter_extension)>0) ##### END pre-filtering process ##### +##### BEGIN pre-filter recent call process ##### +$pre_filter_recent_outbound_found=0; +$pre_filter_recent_inbound_found=0; +$outbound_searchSQL=''; +$inbound_searchSQL=''; +if ( (length($pre_filter_recent_call)>0) && (length($pre_filter_recent_extension)>0) ) + { + if ($AGILOG) {$agi_string = "pre-filter recent call active: |$extension|$pre_filter_recent_call|$pre_filter_recent_extension|$filter_clean_cid_number|$callerid"; &agi_output;} + + $temp_cid_test = $callerid; + if (length($callerid)<1) {$temp_cid_test = 'BLANK';} + + ### BEGIN gather settings container details for pre-filter recent call + $CQcontainer_entry=''; + $stmtA = "SELECT container_entry FROM vicidial_settings_containers where container_id='$pre_filter_recent_call';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + $outbound_recent_call_check_type=''; + $outbound_recent_call_days=0; + $outbound_recent_call_campaigns=''; + $outbound_recent_call_statuses=''; + $inbound_recent_call_check_type=''; + $inbound_recent_call_days=0; + $inbound_recent_call_groups=''; + $inbound_recent_call_statuses=''; + @aryA = $sthA->fetchrow_array; + $RCcontainer_entry = $aryA[0]; + $RCcontainer_entry =~ s/\r|\t|\'|\"//gi; + @RCfilter_settings = split(/\n/,$RCcontainer_entry); + $sea=0; + foreach (@RCfilter_settings) + { + if ($DBX > 0) {print STDERR "RC DEBUG 0: $sea|$RCfilter_settings[$sea]|\n";} + if ($RCfilter_settings[$sea] =~ /^outbound_recent_call_check_type => /) + { + # outbound_recent_call_check_type => lead-x-y-days-range (or 'log-x-y-days-range') + $RCfilter_settings[$sea] =~ s/^outbound_recent_call_check_type => //gi; + $outbound_recent_call_check_type = $RCfilter_settings[$sea]; + if ($DBX > 0) {print STDERR "RC DEBUG 2: outbound_recent_call_check_type FOUND: |$outbound_recent_call_check_type| $sea|$RCfilter_settings[$sea]|\n";} + } + if ($RCfilter_settings[$sea] =~ /^outbound_recent_call_days => /) + { + # outbound_recent_call_days => 0-21 + $RCfilter_settings[$sea] =~ s/^outbound_recent_call_days => //gi; + $outbound_recent_call_days = $RCfilter_settings[$sea]; + $outbound_recent_call_days =~ s/[^-0-9]//gi; + if ($DBX > 0) {print STDERR "RC DEBUG 2: outbound_recent_call_days FOUND: |$outbound_recent_call_days| $sea|$RCfilter_settings[$sea]|\n";} + } + if ($RCfilter_settings[$sea] =~ /^outbound_recent_call_campaigns => /) + { + # outbound_recent_call_campaigns => --ALL-- (or pipe-delimited list of campaign IDs: "TESTCAMP|TEST2|TEST3") + $RCfilter_settings[$sea] =~ s/^outbound_recent_call_campaigns => //gi; + $outbound_recent_call_campaigns = $RCfilter_settings[$sea]; + if ($DBX > 0) {print STDERR "RC DEBUG 3: outbound_recent_call_campaigns FOUND: |$outbound_recent_call_campaigns| $sea|$RCfilter_settings[$sea]|\n";} + } + if ($RCfilter_settings[$sea] =~ /^outbound_recent_call_statuses => /) + { + # outbound_recent_call_statuses => --ALL-- (or pipe-delimited list of statuses: "DNC|NI|LIT") + $RCfilter_settings[$sea] =~ s/^outbound_recent_call_statuses => //gi; + $outbound_recent_call_statuses = $RCfilter_settings[$sea]; + if ($DBX > 0) {print STDERR "RC DEBUG 4: outbound_recent_call_statuses FOUND: |$outbound_recent_call_statuses| $sea|$RCfilter_settings[$sea]|\n";} + } + + if ($RCfilter_settings[$sea] =~ /^inbound_recent_call_check_type => /) + { + # inbound_recent_call_check_type => lead-x-y-days-range (or 'log-x-y-days-range') + $RCfilter_settings[$sea] =~ s/^inbound_recent_call_check_type => //gi; + $inbound_recent_call_check_type = $RCfilter_settings[$sea]; + if ($DBX > 0) {print STDERR "RC DEBUG 5: inbound_recent_call_check_type FOUND: |$inbound_recent_call_check_type| $sea|$RCfilter_settings[$sea]|\n";} + } + if ($RCfilter_settings[$sea] =~ /^inbound_recent_call_days => /) + { + # inbound_recent_call_days => 21-999 + $RCfilter_settings[$sea] =~ s/^inbound_recent_call_days => //gi; + $inbound_recent_call_days = $RCfilter_settings[$sea]; + $inbound_recent_call_days =~ s/[^-0-9]//gi; + if ($DBX > 0) {print STDERR "RC DEBUG 6: inbound_recent_call_days FOUND: |$inbound_recent_call_days| $sea|$RCfilter_settings[$sea]|\n";} + } + if ($RCfilter_settings[$sea] =~ /^inbound_recent_call_groups => /) + { + # inbound_recent_call_groups => --ALL-- (or pipe-delimited list of inbound group IDs: "TEST_IN|TEST_IN2|TEST_IN3") + # NOTE: if using a 'lead' check type, this field should be a list of campaign IDs to check within the campaign lists + $RCfilter_settings[$sea] =~ s/^inbound_recent_call_groups => //gi; + $inbound_recent_call_groups = $RCfilter_settings[$sea]; + if ($DBX > 0) {print STDERR "RC DEBUG 7: inbound_recent_call_groups FOUND: |$inbound_recent_call_groups| $sea|$RCfilter_settings[$sea]|\n";} + } + if ($RCfilter_settings[$sea] =~ /^inbound_recent_call_statuses => /) + { + # inbound_recent_call_statuses => --ALL-- (or pipe-delimited list of statuses: "DNC|NI|LIT") + $RCfilter_settings[$sea] =~ s/^inbound_recent_call_statuses => //gi; + $inbound_recent_call_statuses = $RCfilter_settings[$sea]; + if ($DBX > 0) {print STDERR "RC DEBUG 8: inbound_recent_call_statuses FOUND: |$inbound_recent_call_statuses| $sea|$RCfilter_settings[$sea]|\n";} + } + $sea++; + } + + # OUTBOUND validate and build SQL segments based on settings above + $outbound_search_table = 'vicidial_log'; + $outbound_search_date = 'call_date'; + if ( ($outbound_recent_call_check_type =~ /x-y-days-range/i) && ($outbound_recent_call_check_type =~ /lead|log/i) && (length($outbound_recent_call_campaigns) > 1) && (length($outbound_recent_call_statuses) > 0) ) + { + if ( (length($outbound_recent_call_days) > 2) && ($outbound_recent_call_days =~ /\d-\d/) ) + { + if ($outbound_recent_call_check_type =~ /lead/i) + { + $outbound_search_table = 'vicidial_list'; + $outbound_search_date = 'last_local_call_time'; + } + + @outbound_recent_call_days_ARY = split(/-/,$outbound_recent_call_days); + $temp_days_start = $outbound_recent_call_days_ARY[0]; + $temp_days_end = $outbound_recent_call_days_ARY[1]; + $temp_days_start =~ s/\D//gi; + $temp_days_end =~ s/\D//gi; + if ( (length($temp_days_start) > 0) && (length($temp_days_start) > 0) ) + { + $outbound_searchSQL = "and ($outbound_search_date <= CONCAT(DATE_ADD(CURDATE(), INTERVAL -$temp_days_start DAY),' 23:59:59')) and ($outbound_search_date >= CONCAT(DATE_ADD(CURDATE(), INTERVAL -$temp_days_end DAY),' 00:00:00'))"; + } + + if ($outbound_recent_call_campaigns !~ /--ALL--/) + { + $outbound_recent_call_campaigns =~ s/\|/','/gi; + if ($outbound_recent_call_check_type =~ /lead/i) + { + $temp_lists=''; + # gather all lists within the defined campaigns + $cl=0; + $stmtA = "SELECT list_id FROM vicidial_lists where campaign_id IN('$outbound_recent_call_campaigns');"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + while ($sthArows > $cl) + { + @aryA = $sthA->fetchrow_array; + if ($cl > 0) {$temp_lists .= ",";} + $temp_lists .= "'$aryA[0]'"; + $cl++; + } + $sthA->finish(); + if (length($temp_lists) < 3) + {$temp_lists = "'99999999999999999999'";} + $outbound_searchSQL .= " and list_id IN($temp_lists)"; + } + else + { + $outbound_searchSQL .= " and campaign_id IN('$outbound_recent_call_campaigns')"; + } + } + + if ($outbound_recent_call_statuses !~ /--ALL--/) + { + $outbound_recent_call_statuses =~ s/\|/','/gi; + $outbound_searchSQL .= " and status IN('$outbound_recent_call_statuses')"; + } + } + } + + # INBOUND validate and build SQL segments based on settings above + $inbound_search_table = 'vicidial_closer_log'; + $inbound_search_date = 'call_date'; + if ( ($inbound_recent_call_check_type =~ /x-y-days-range/i) && ($inbound_recent_call_check_type =~ /lead|log/i) && (length($inbound_recent_call_groups) > 1) && (length($inbound_recent_call_statuses) > 0) ) + { + if ( (length($inbound_recent_call_days) > 2) && ($inbound_recent_call_days =~ /\d-\d/) ) + { + if ($inbound_recent_call_check_type =~ /lead/i) + { + $inbound_search_table = 'vicidial_list'; + $inbound_search_date = 'last_local_call_time'; + } + + @inbound_recent_call_days_ARY = split(/-/,$inbound_recent_call_days); + $temp_days_start = $inbound_recent_call_days_ARY[0]; + $temp_days_end = $inbound_recent_call_days_ARY[1]; + $temp_days_start =~ s/\D//gi; + $temp_days_end =~ s/\D//gi; + if ( (length($temp_days_start) > 0) && (length($temp_days_start) > 0) ) + { + $inbound_searchSQL = "and ($inbound_search_date <= CONCAT(DATE_ADD(CURDATE(), INTERVAL -$temp_days_start DAY),' 23:59:59')) and ($inbound_search_date >= CONCAT(DATE_ADD(CURDATE(), INTERVAL -$temp_days_end DAY),' 00:00:00'))"; + } + + if ($inbound_recent_call_groups !~ /--ALL--/) + { + $inbound_recent_call_groups =~ s/\|/','/gi; + if ($inbound_recent_call_check_type =~ /lead/i) + { + $temp_lists=''; + # gather all lists within the defined campaigns + $cl=0; + $stmtA = "SELECT list_id FROM vicidial_lists where campaign_id IN('$inbound_recent_call_groups');"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + while ($sthArows > $cl) + { + @aryA = $sthA->fetchrow_array; + if ($cl > 0) {$temp_lists .= ",";} + $temp_lists .= "'$aryA[0]'"; + $cl++; + } + $sthA->finish(); + if (length($temp_lists) < 3) + {$temp_lists = "'99999999999999999999'";} + $inbound_searchSQL .= " and list_id IN($temp_lists)"; + } + else + { + $inbound_searchSQL .= " and campaign_id IN('$inbound_recent_call_groups')"; + } + } + + if ($inbound_recent_call_statuses !~ /--ALL--/) + { + $inbound_recent_call_statuses =~ s/\|/','/gi; + $inbound_searchSQL .= " and status IN('$inbound_recent_call_statuses')"; + } + } + } + + } + $sthA->finish(); + ### END gather settings container details for pre-filter recent call + + # check for outbound call match + if (length($outbound_searchSQL) > 10) + { + $stmtA = "SELECT count(*) FROM $outbound_search_table where phone_number='$temp_cid_test' $outbound_searchSQL;"; + $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; + $pre_filter_recent_outbound_found = $aryA[0]; + } + if ($AGILOG) {$agi_string = "-- DID RECENT OUTBOUND CALL SEARCH : |$pre_filter_recent_outbound_found|$stmtA|"; &agi_output;} + } + + # check for inbound call match + if (length($inbound_searchSQL) > 10) + { + $stmtA = "SELECT count(*) FROM $inbound_search_table where phone_number='$temp_cid_test' $inbound_searchSQL;"; + $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; + $pre_filter_recent_inbound_found = $aryA[0]; + } + if ($AGILOG) {$agi_string = "-- DID RECENT INBOUND CALL SEARCH : |$pre_filter_recent_inbound_found|$stmtA|"; &agi_output;} + } + + $sthA->finish(); + if ( ($pre_filter_recent_inbound_found > 0) || ($pre_filter_recent_outbound_found) ) + { + $did_route='DID'; + $did_extension = $pre_filter_recent_extension; + $filter_match_found = $pre_filter_recent_extension; + $exten_context = 'trunkinbound'; + $route_type = 'PRERECENT'; + + if ($AGILOG) {$agi_string = "PRE-Filter Recent Call match found: |$pre_filter_recent_outbound_found|$pre_filter_recent_inbound_found|$pre_filter_recent_call|$pre_filter_recent_extension|$did_route|"; &agi_output;} + + ### Update the call in vicidial_did_log + $stmtA = "UPDATE vicidial_did_log SET did_route='PFR_$did_route' where uniqueid='$uniqueid' and channel='$channel' and server_ip='$VARserver_ip' and caller_id_number='$callerid' and call_date='$SQLdate';"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rowsL = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- DID UPDATE LOG : |$affected_rowsL|$stmtA|"; &agi_output;} + } + else + { + if ($AGILOG) {$agi_string = "-- DID NO RECENT CALL FOUND : |$outbound_searchSQL|$inbound_searchSQL|"; &agi_output;} + } + } +##### END pre-filter recent call process ##### + + ##### BEGIN filtering process ##### if ( ($filter_inbound_number =~ /GROUP|URL|DNC_INTERNAL|DNC_CAMPAIGN/) && ($pre_filter_match_found < 1) ) { diff --git a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql index e03fa056..26ed406f 100644 --- a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql +++ b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql @@ -2279,6 +2279,8 @@ max_queue_ingroup_id VARCHAR(20) default '', max_queue_ingroup_extension VARCHAR(50) default '9998811112', did_carrier_description VARCHAR(255) default '', inbound_route_answer ENUM('Y','N') DEFAULT 'Y', +pre_filter_recent_call VARCHAR(20) default '', +pre_filter_recent_extension VARCHAR(50) default '', unique index (did_pattern), index (group_id) ) ENGINE=MyISAM; @@ -5080,4 +5082,4 @@ INSERT INTO vicidial_settings_containers(container_id,container_notes,container_ UPDATE system_settings set vdc_agent_api_active='1'; -UPDATE system_settings SET db_schema_version='1658',db_schema_update_date=NOW(),reload_timestamp=NOW(); +UPDATE system_settings SET db_schema_version='1659',db_schema_update_date=NOW(),reload_timestamp=NOW(); diff --git a/agc_2-X/trunk/extras/upgrade_2.14.sql b/agc_2-X/trunk/extras/upgrade_2.14.sql index 3ff820d3..8794d2ca 100644 --- a/agc_2-X/trunk/extras/upgrade_2.14.sql +++ b/agc_2-X/trunk/extras/upgrade_2.14.sql @@ -1921,3 +1921,8 @@ UPDATE system_settings SET db_schema_version='1657',db_schema_update_date=NOW() ALTER TABLE vicidial_campaigns ADD ig_xfer_list_sort ENUM('GROUP_ID_UP','GROUP_ID_DOWN','GROUP_NAME_UP','GROUP_NAME_DOWN','PRIORITY_UP','PRIORITY_DOWN') default 'GROUP_ID_UP'; UPDATE system_settings SET db_schema_version='1658',db_schema_update_date=NOW() where db_schema_version < 1658; + +ALTER TABLE vicidial_inbound_dids ADD pre_filter_recent_call VARCHAR(20) default ''; +ALTER TABLE vicidial_inbound_dids ADD pre_filter_recent_extension VARCHAR(50) default ''; + +UPDATE system_settings SET db_schema_version='1659',db_schema_update_date=NOW() where db_schema_version < 1659; diff --git a/agc_2-X/trunk/www/vicidial/admin.php b/agc_2-X/trunk/www/vicidial/admin.php index c099bada..76cb22ad 100644 --- a/agc_2-X/trunk/www/vicidial/admin.php +++ b/agc_2-X/trunk/www/vicidial/admin.php @@ -125,9 +125,9 @@ $PHP_SELF = preg_replace('/\.php.*/i','.php',$PHP_SELF); $QUERY_STRING = getenv("QUERY_STRING"); $groups=array(); -$Vreports = 'NONE, Real-Time Main Report, Real-Time Campaign Summary, Real-Time Whiteboard Report, Inbound Report, Inbound Report by DID, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound Daily Report, Inbound DID Report, Inbound DID Summary Report, Agent DID Report, Inbound IVR Report, Inbound Forecasting Report, Advanced Forecasting Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Callmenu Survey Report, Outbound Lead Source Report, Fronter - Closer Report, Fronter - Closer Detail Report, Lists Campaign Statuses Report, Lists Statuses Report, Campaign Status List Report, Export Calls Report, Export Leads Report, Agent Time Detail, Agent Status Detail, Agent Inbound Status Summary, Agent Performance Detail, Team Performance Detail, Performance Comparison Report, Single Agent Daily, Single Agent Daily Time, User Group Login Report, User Group Hourly Report, User Group Detail Hourly Report, User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report, Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Dialer Inventory Report, Maximum System Stats, Maximum Stats Detail, Search Leads Logs, Email Log Report, Carrier Log Report, Campaign Debug, Shared Debug, Asterisk Debug, Hangup Cause Report, Lists Pass Report, Called Counts List IDs Report, Agent Debug Log Report, Agent Parked Call Report, Agent-Manager Chat Log, Recording Access Log Report, API Log Report, Real-Time Monitoring Log Report, AMD Log Report, SIP Event Report, Caller ID Log Report, Quality Control Report, Settings Compare, Phone Stats'; +$Vreports = 'NONE, Real-Time Main Report, Real-Time Campaign Summary, Real-Time Whiteboard Report, Inbound Report, Inbound Report by DID, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound Daily Report, Inbound DID Report, Inbound DID Summary Report, Agent DID Report, Inbound DID Detail Report, Inbound IVR Report, Inbound Forecasting Report, Advanced Forecasting Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Callmenu Survey Report, Outbound Lead Source Report, Fronter - Closer Report, Fronter - Closer Detail Report, Lists Campaign Statuses Report, Lists Statuses Report, Campaign Status List Report, Export Calls Report, Export Leads Report, Agent Time Detail, Agent Status Detail, Agent Inbound Status Summary, Agent Performance Detail, Team Performance Detail, Performance Comparison Report, Single Agent Daily, Single Agent Daily Time, User Group Login Report, User Group Hourly Report, User Group Detail Hourly Report, User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report, Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Dialer Inventory Report, Maximum System Stats, Maximum Stats Detail, Search Leads Logs, Email Log Report, Carrier Log Report, Campaign Debug, Shared Debug, Asterisk Debug, Hangup Cause Report, Lists Pass Report, Called Counts List IDs Report, Agent Debug Log Report, Agent Parked Call Report, Agent-Manager Chat Log, Recording Access Log Report, API Log Report, Real-Time Monitoring Log Report, AMD Log Report, SIP Event Report, Caller ID Log Report, Quality Control Report, Settings Compare, Phone Stats'; -$UGreports = 'ALL REPORTS, NONE, Real-Time Main Report, Real-Time Campaign Summary, Real-Time Whiteboard Report, Inbound Report, Inbound Report by DID, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound Daily Report, Inbound DID Report, Inbound DID Summary Report, Agent DID Report, Inbound Email Report, Inbound Chat Report, Inbound IVR Report, Inbound Forecasting Report, Advanced Forecasting Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Callmenu Survey Report, Outbound Lead Source Report, Fronter - Closer Report, Fronter - Closer Detail Report, Lists Campaign Statuses Report, Lists Statuses Report, Campaign Status List Report, Export Calls Report, Export Leads Report, Agent Time Detail, Agent Status Detail, Agent Inbound Status Summary, Agent Performance Detail, Team Performance Detail, Performance Comparison Report, Single Agent Daily, Single Agent Daily Time, User Group Login Report, User Group Hourly Report, User Group Detail Hourly Report, User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report, Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Dialer Inventory Report, Custom Reports Links, CallCard Search, Maximum System Stats, Maximum Stats Detail, Search Leads Logs, Email Log Report, Lists Pass Report, Called Counts List IDs Report, Front Page System Summary, Report Page Servers Summary, Admin Utilities Page, Agent Debug Log Report, Agent Parked Call Report, Agent-Manager Chat Log, Recording Access Log Report, API Log Report, Real-Time Monitoring Log Report, AMD Log Report, SIP Event Report, Caller ID Log Report, Quality Control Report, Settings Compare, Phone Stats, VERM QA Links'; +$UGreports = 'ALL REPORTS, NONE, Real-Time Main Report, Real-Time Campaign Summary, Real-Time Whiteboard Report, Inbound Report, Inbound Report by DID, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound Daily Report, Inbound DID Report, Inbound DID Summary Report, Agent DID Report, Inbound DID Detail Report, Inbound Email Report, Inbound Chat Report, Inbound IVR Report, Inbound Forecasting Report, Advanced Forecasting Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Callmenu Survey Report, Outbound Lead Source Report, Fronter - Closer Report, Fronter - Closer Detail Report, Lists Campaign Statuses Report, Lists Statuses Report, Campaign Status List Report, Export Calls Report, Export Leads Report, Agent Time Detail, Agent Status Detail, Agent Inbound Status Summary, Agent Performance Detail, Team Performance Detail, Performance Comparison Report, Single Agent Daily, Single Agent Daily Time, User Group Login Report, User Group Hourly Report, User Group Detail Hourly Report, User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report, Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Dialer Inventory Report, Custom Reports Links, CallCard Search, Maximum System Stats, Maximum Stats Detail, Search Leads Logs, Email Log Report, Lists Pass Report, Called Counts List IDs Report, Front Page System Summary, Report Page Servers Summary, Admin Utilities Page, Agent Debug Log Report, Agent Parked Call Report, Agent-Manager Chat Log, Recording Access Log Report, API Log Report, Real-Time Monitoring Log Report, AMD Log Report, SIP Event Report, Caller ID Log Report, Quality Control Report, Settings Compare, Phone Stats, VERM QA Links'; $Vtables = 'NONE,log_noanswer,did_agent_log,contact_information'; @@ -2706,6 +2706,10 @@ if (isset($_GET["allow_web_debug"])) {$allow_web_debug=$_GET["allow_web_debug" elseif (isset($_POST["allow_web_debug"])) {$allow_web_debug=$_POST["allow_web_debug"];} if (isset($_GET["ig_xfer_list_sort"])) {$ig_xfer_list_sort=$_GET["ig_xfer_list_sort"];} elseif (isset($_POST["ig_xfer_list_sort"])) {$ig_xfer_list_sort=$_POST["ig_xfer_list_sort"];} +if (isset($_GET["pre_filter_recent_call"])) {$pre_filter_recent_call=$_GET["pre_filter_recent_call"];} + elseif (isset($_POST["pre_filter_recent_call"])) {$pre_filter_recent_call=$_POST["pre_filter_recent_call"];} +if (isset($_GET["pre_filter_recent_extension"])) {$pre_filter_recent_extension=$_GET["pre_filter_recent_extension"];} + elseif (isset($_POST["pre_filter_recent_extension"])) {$pre_filter_recent_extension=$_POST["pre_filter_recent_extension"];} $DB=preg_replace("/[^0-9a-zA-Z]/","",$DB); @@ -3838,6 +3842,8 @@ if ($non_latin < 1) $call_limit_24hour_override = preg_replace('/[^-_0-9a-zA-Z]/','',$call_limit_24hour_override); $in_queue_nanque_exceptions = preg_replace('/[^-_0-9a-zA-Z]/','',$in_queue_nanque_exceptions); $queue_group = preg_replace('/[^-_0-9a-zA-Z]/','',$queue_group); + $pre_filter_recent_call = preg_replace('/[^-_0-9a-zA-Z]/','',$pre_filter_recent_call); + $pre_filter_recent_extension = preg_replace('/[^-_0-9a-zA-Z]/','',$pre_filter_recent_extension); ### ALPHA-NUMERIC and underscore $qc_statuses_id = preg_replace('/[^_0-9a-zA-Z]/','',$qc_statuses_id); @@ -4554,6 +4560,8 @@ else $call_limit_24hour_override = preg_replace('/[^-_0-9\p{L}]/u','',$call_limit_24hour_override); $in_queue_nanque_exceptions = preg_replace('/[^-_0-9\p{L}]/u','',$in_queue_nanque_exceptions); $queue_group = preg_replace('/[^-_0-9\p{L}]/u','',$queue_group); + $pre_filter_recent_call = preg_replace('/[^-_0-9\p{L}]/u','',$pre_filter_recent_call); + $pre_filter_recent_extension = preg_replace('/[^-_0-9\p{L}]/u','',$pre_filter_recent_extension); ### ALPHA-NUMERIC and underscore and dash and slash and dot $menu_timeout_prompt = preg_replace('/[^-\/\|\._0-9\p{L}]/u','',$menu_timeout_prompt); @@ -5891,12 +5899,13 @@ if ($SSscript_remove_js > 0) # 220328-1420 - Disallow adding 'INCALL','QUEUE' statuses in Auto-Alt-Dial and Lead Recycling # 220429-1111 - Code cleanup and more optional DB output for queries # 220506-0905 - Added ig_xfer_list_sort campaign setting +# 220510-0822 - Added pre_filter_recent_call DID settings and Inbound DID Detail Report # # make sure you have added a user to the vicidial_users MySQL table with at least user_level 9 to access this page the first time -$admin_version = '2.14-855a'; -$build = '220506-0905'; +$admin_version = '2.14-856a'; +$build = '220510-0822'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -11156,6 +11165,7 @@ if ($ADD==192111111111) + @@ -13565,7 +13575,7 @@ if ($ADD==2411) } else { - $stmtA="INSERT INTO vicidial_inbound_dids (did_pattern,did_description,did_active,did_route,extension,exten_context,voicemail_ext,phone,server_ip,user,user_unavailable_action,user_route_settings_ingroup,group_id,call_handle_method,agent_search_method,list_id,campaign_id,phone_code,menu_id,record_call,filter_inbound_number,filter_phone_group_id,filter_url,filter_action,filter_extension,filter_exten_context,filter_voicemail_ext,filter_phone,filter_server_ip,filter_user,filter_user_unavailable_action,filter_user_route_settings_ingroup,filter_group_id,filter_call_handle_method,filter_agent_search_method,filter_list_id,filter_campaign_id,filter_phone_code,filter_menu_id,filter_clean_cid_number,custom_one,custom_two,custom_three,custom_four,custom_five,user_group,filter_dnc_campaign,filter_url_did_redirect,no_agent_ingroup_redirect,no_agent_ingroup_id,no_agent_ingroup_extension,pre_filter_phone_group_id,pre_filter_extension,entry_list_id,filter_entry_list_id,max_queue_ingroup_calls,max_queue_ingroup_id,max_queue_ingroup_extension,did_carrier_description,inbound_route_answer) SELECT \"$did_pattern\",\"$did_description\",did_active,did_route,extension,exten_context,voicemail_ext,phone,server_ip,user,user_unavailable_action,user_route_settings_ingroup,group_id,call_handle_method,agent_search_method,list_id,campaign_id,phone_code,menu_id,record_call,filter_inbound_number,filter_phone_group_id,filter_url,filter_action,filter_extension,filter_exten_context,filter_voicemail_ext,filter_phone,filter_server_ip,filter_user,filter_user_unavailable_action,filter_user_route_settings_ingroup,filter_group_id,filter_call_handle_method,filter_agent_search_method,filter_list_id,filter_campaign_id,filter_phone_code,filter_menu_id,filter_clean_cid_number,custom_one,custom_two,custom_three,custom_four,custom_five,user_group,filter_dnc_campaign,filter_url_did_redirect,no_agent_ingroup_redirect,no_agent_ingroup_id,no_agent_ingroup_extension,pre_filter_phone_group_id,pre_filter_extension,entry_list_id,filter_entry_list_id,max_queue_ingroup_calls,max_queue_ingroup_id,max_queue_ingroup_extension,did_carrier_description,inbound_route_answer from vicidial_inbound_dids where did_id=\"$source_did\";"; + $stmtA="INSERT INTO vicidial_inbound_dids (did_pattern,did_description,did_active,did_route,extension,exten_context,voicemail_ext,phone,server_ip,user,user_unavailable_action,user_route_settings_ingroup,group_id,call_handle_method,agent_search_method,list_id,campaign_id,phone_code,menu_id,record_call,filter_inbound_number,filter_phone_group_id,filter_url,filter_action,filter_extension,filter_exten_context,filter_voicemail_ext,filter_phone,filter_server_ip,filter_user,filter_user_unavailable_action,filter_user_route_settings_ingroup,filter_group_id,filter_call_handle_method,filter_agent_search_method,filter_list_id,filter_campaign_id,filter_phone_code,filter_menu_id,filter_clean_cid_number,custom_one,custom_two,custom_three,custom_four,custom_five,user_group,filter_dnc_campaign,filter_url_did_redirect,no_agent_ingroup_redirect,no_agent_ingroup_id,no_agent_ingroup_extension,pre_filter_phone_group_id,pre_filter_extension,entry_list_id,filter_entry_list_id,max_queue_ingroup_calls,max_queue_ingroup_id,max_queue_ingroup_extension,did_carrier_description,inbound_route_answer,pre_filter_recent_call,pre_filter_recent_extension) SELECT \"$did_pattern\",\"$did_description\",did_active,did_route,extension,exten_context,voicemail_ext,phone,server_ip,user,user_unavailable_action,user_route_settings_ingroup,group_id,call_handle_method,agent_search_method,list_id,campaign_id,phone_code,menu_id,record_call,filter_inbound_number,filter_phone_group_id,filter_url,filter_action,filter_extension,filter_exten_context,filter_voicemail_ext,filter_phone,filter_server_ip,filter_user,filter_user_unavailable_action,filter_user_route_settings_ingroup,filter_group_id,filter_call_handle_method,filter_agent_search_method,filter_list_id,filter_campaign_id,filter_phone_code,filter_menu_id,filter_clean_cid_number,custom_one,custom_two,custom_three,custom_four,custom_five,user_group,filter_dnc_campaign,filter_url_did_redirect,no_agent_ingroup_redirect,no_agent_ingroup_id,no_agent_ingroup_extension,pre_filter_phone_group_id,pre_filter_extension,entry_list_id,filter_entry_list_id,max_queue_ingroup_calls,max_queue_ingroup_id,max_queue_ingroup_extension,did_carrier_description,inbound_route_answer,pre_filter_recent_call,pre_filter_recent_extension from vicidial_inbound_dids where did_id=\"$source_did\";"; $rslt=mysql_to_mysqli($stmtA, $link); $stmt="SELECT did_id from vicidial_inbound_dids where did_pattern='$did_pattern';"; @@ -18130,7 +18140,7 @@ if ($ADD==4311) } echo "
"._QXZ("DID MODIFIED").": $did_pattern\n"; - $stmt="UPDATE vicidial_inbound_dids set did_pattern='$did_pattern',did_description='$did_description',did_active='$did_active',did_route='$did_route',extension='$extension',exten_context='$exten_context',voicemail_ext='$voicemail_ext',phone='$phone',server_ip='$server_ip',user='$user',user_unavailable_action='$user_unavailable_action',user_route_settings_ingroup='$user_route_settings_ingroup',group_id='$group_id',call_handle_method='$call_handle_method',agent_search_method='$agent_search_method',list_id='$list_id',campaign_id='$campaign_id',phone_code='$phone_code',menu_id='$menu_id',record_call='$record_call',filter_inbound_number='$filter_inbound_number',filter_phone_group_id='$filter_phone_group_id',filter_url='" . mysqli_real_escape_string($link, $filter_url) . "',filter_action='$filter_action',filter_extension='$filter_extension',filter_exten_context='$filter_exten_context',filter_voicemail_ext='$filter_voicemail_ext',filter_phone='$filter_phone',filter_server_ip='$filter_server_ip',filter_user='$filter_user',filter_user_unavailable_action='$filter_user_unavailable_action',filter_user_route_settings_ingroup='$filter_user_route_settings_ingroup',filter_group_id='$filter_group_id',filter_call_handle_method='$filter_call_handle_method',filter_agent_search_method='$filter_agent_search_method',filter_list_id='$filter_list_id',filter_campaign_id='$filter_campaign_id',filter_phone_code='$filter_phone_code',filter_menu_id='$filter_menu_id',filter_clean_cid_number='$filter_clean_cid_number',custom_one='$custom_one',custom_two='$custom_two',custom_three='$custom_three',custom_four='$custom_four',custom_five='$custom_five',user_group='$user_group',filter_dnc_campaign='$filter_dnc_campaign',filter_url_did_redirect='$filter_url_did_redirect',no_agent_ingroup_redirect='$no_agent_ingroup_redirect',no_agent_ingroup_id='$no_agent_ingroup_id',no_agent_ingroup_extension='$no_agent_ingroup_extension',pre_filter_phone_group_id='$pre_filter_phone_group_id',pre_filter_extension='$pre_filter_extension',max_queue_ingroup_calls='$max_queue_ingroup_calls',max_queue_ingroup_id='$max_queue_ingroup_id',max_queue_ingroup_extension='$max_queue_ingroup_extension',did_carrier_description='$did_carrier_description',inbound_route_answer='$inbound_route_answer'$did_entry_list_idSQL where did_id='$did_id';"; + $stmt="UPDATE vicidial_inbound_dids set did_pattern='$did_pattern',did_description='$did_description',did_active='$did_active',did_route='$did_route',extension='$extension',exten_context='$exten_context',voicemail_ext='$voicemail_ext',phone='$phone',server_ip='$server_ip',user='$user',user_unavailable_action='$user_unavailable_action',user_route_settings_ingroup='$user_route_settings_ingroup',group_id='$group_id',call_handle_method='$call_handle_method',agent_search_method='$agent_search_method',list_id='$list_id',campaign_id='$campaign_id',phone_code='$phone_code',menu_id='$menu_id',record_call='$record_call',filter_inbound_number='$filter_inbound_number',filter_phone_group_id='$filter_phone_group_id',filter_url='" . mysqli_real_escape_string($link, $filter_url) . "',filter_action='$filter_action',filter_extension='$filter_extension',filter_exten_context='$filter_exten_context',filter_voicemail_ext='$filter_voicemail_ext',filter_phone='$filter_phone',filter_server_ip='$filter_server_ip',filter_user='$filter_user',filter_user_unavailable_action='$filter_user_unavailable_action',filter_user_route_settings_ingroup='$filter_user_route_settings_ingroup',filter_group_id='$filter_group_id',filter_call_handle_method='$filter_call_handle_method',filter_agent_search_method='$filter_agent_search_method',filter_list_id='$filter_list_id',filter_campaign_id='$filter_campaign_id',filter_phone_code='$filter_phone_code',filter_menu_id='$filter_menu_id',filter_clean_cid_number='$filter_clean_cid_number',custom_one='$custom_one',custom_two='$custom_two',custom_three='$custom_three',custom_four='$custom_four',custom_five='$custom_five',user_group='$user_group',filter_dnc_campaign='$filter_dnc_campaign',filter_url_did_redirect='$filter_url_did_redirect',no_agent_ingroup_redirect='$no_agent_ingroup_redirect',no_agent_ingroup_id='$no_agent_ingroup_id',no_agent_ingroup_extension='$no_agent_ingroup_extension',pre_filter_phone_group_id='$pre_filter_phone_group_id',pre_filter_extension='$pre_filter_extension',max_queue_ingroup_calls='$max_queue_ingroup_calls',max_queue_ingroup_id='$max_queue_ingroup_id',max_queue_ingroup_extension='$max_queue_ingroup_extension',did_carrier_description='$did_carrier_description',inbound_route_answer='$inbound_route_answer',pre_filter_recent_call='$pre_filter_recent_call',pre_filter_recent_extension='$pre_filter_recent_extension'$did_entry_list_idSQL where did_id='$did_id';"; $rslt=mysql_to_mysqli($stmt, $link); ### LOG INSERTION Admin Log Table ### @@ -35511,7 +35521,7 @@ if ($ADD==3311) $didSQL = "did_id='$did_id'"; if ( (strlen($did_id)<1) and (strlen($did_pattern)>0) ) {$didSQL = "did_pattern='$did_pattern'";} - $stmt="SELECT did_id,did_pattern,did_description,did_active,did_route,extension,exten_context,voicemail_ext,phone,server_ip,user,user_unavailable_action,user_route_settings_ingroup,group_id,call_handle_method,agent_search_method,list_id,campaign_id,phone_code,menu_id,record_call,filter_inbound_number,filter_phone_group_id,filter_url,filter_action,filter_extension,filter_exten_context,filter_voicemail_ext,filter_phone,filter_server_ip,filter_user,filter_user_unavailable_action,filter_user_route_settings_ingroup,filter_group_id,filter_call_handle_method,filter_agent_search_method,filter_list_id,filter_campaign_id,filter_phone_code,filter_menu_id,filter_clean_cid_number,custom_one,custom_two,custom_three,custom_four,custom_five,user_group,filter_dnc_campaign,filter_url_did_redirect,no_agent_ingroup_redirect,no_agent_ingroup_id,no_agent_ingroup_extension,pre_filter_phone_group_id,pre_filter_extension,entry_list_id,filter_entry_list_id,max_queue_ingroup_calls,max_queue_ingroup_id,max_queue_ingroup_extension,did_carrier_description,inbound_route_answer from vicidial_inbound_dids where $didSQL $LOGadmin_viewable_groupsSQL;"; + $stmt="SELECT did_id,did_pattern,did_description,did_active,did_route,extension,exten_context,voicemail_ext,phone,server_ip,user,user_unavailable_action,user_route_settings_ingroup,group_id,call_handle_method,agent_search_method,list_id,campaign_id,phone_code,menu_id,record_call,filter_inbound_number,filter_phone_group_id,filter_url,filter_action,filter_extension,filter_exten_context,filter_voicemail_ext,filter_phone,filter_server_ip,filter_user,filter_user_unavailable_action,filter_user_route_settings_ingroup,filter_group_id,filter_call_handle_method,filter_agent_search_method,filter_list_id,filter_campaign_id,filter_phone_code,filter_menu_id,filter_clean_cid_number,custom_one,custom_two,custom_three,custom_four,custom_five,user_group,filter_dnc_campaign,filter_url_did_redirect,no_agent_ingroup_redirect,no_agent_ingroup_id,no_agent_ingroup_extension,pre_filter_phone_group_id,pre_filter_extension,entry_list_id,filter_entry_list_id,max_queue_ingroup_calls,max_queue_ingroup_id,max_queue_ingroup_extension,did_carrier_description,inbound_route_answer,pre_filter_recent_call,pre_filter_recent_extension from vicidial_inbound_dids where $didSQL $LOGadmin_viewable_groupsSQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); $row=mysqli_fetch_row($rslt); @@ -35578,6 +35588,8 @@ if ($ADD==3311) $max_queue_ingroup_extension = $row[58]; $did_carrier_description = $row[59]; $inbound_route_answer = $row[60]; + $pre_filter_recent_call = $row[61]; + $pre_filter_recent_extension = $row[62]; $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns $whereLOGallowed_campaignsSQL order by campaign_id;"; $rslt=mysql_to_mysqli($stmt, $link); @@ -35927,6 +35939,39 @@ if ($ADD==3311) echo ""._QXZ("Pre-Filter Phone Group ID").": $NWB#inbound_dids-pre_filter_phone_group_id$NWE\n"; echo ""._QXZ("Pre-Filter Phone Group DID").": $NWB#inbound_dids-pre_filter_extension$NWE\n"; + + + ##### get container listings for dynamic DID_RECENT_CALL container pulldown menu + $stmt="SELECT container_id,container_notes from vicidial_settings_containers where container_type='DID_RECENT_CALL' $LOGadmin_viewable_groupsSQL order by container_id;"; + $rslt=mysql_to_mysqli($stmt, $link); + $dtlc_to_print = mysqli_num_rows($rslt); + $pre_filter_recent_call_menu=''; + $dtlc_selected=0; + $o=0; + while ($dtlc_to_print > $o) + { + $rowx=mysqli_fetch_row($rslt); + if (mb_strlen($rowx[1],'utf-8')>40) + {$rowx[1] = mb_substr($rowx[1],0,40,'utf-8') . '...';} + $pre_filter_recent_call_menu .= "\n"; + $o++; + } + + echo ""; + if ($dtlc_selected > 0) + {echo ""._QXZ("Pre-Filter Recent Call")."";} + else + {echo _QXZ("Pre-Filter Recent Call");} + echo ": $NWB#inbound_dids-pre_filter_recent_call$NWE\n"; + + echo ""._QXZ("Pre-Filter Recent Call DID").": $NWB#inbound_dids-pre_filter_recent_extension$NWE\n"; + } echo ""._QXZ("Filter Inbound Number").": $NWB#inbound_dids-filter_inbound_number$NWE\n"; @@ -40751,6 +40796,7 @@ if ($ADD==392111111111) + @@ -40824,6 +40870,23 @@ if ($ADD==392111111111) echo "
\n"; + echo ""._QXZ("INBOUND DIDS USING THIS SETTINGS CONTAINER").":
\n"; + echo "\n"; + + $stmt="SELECT did_pattern,did_description,did_id from vicidial_inbound_dids where ( (pre_filter_recent_call='$container_id') or (pre_filter_recent_call='$container_id') ) $LOGadmin_viewable_groupsSQL;"; + $rslt=mysql_to_mysqli($stmt, $link); + $did_to_print = mysqli_num_rows($rslt); + if ($DB > 0) {echo "$did_to_print|$stmt
\n";} + $o=0; + while ($did_to_print > $o) + { + $row=mysqli_fetch_row($rslt); + echo "\n"; + $o++; + } + + echo "
$row[0] $row[1]

\n"; + } if ($LOGast_delete_phones > 0) @@ -48638,6 +48701,7 @@ if ($ADD==999994) echo "
  • "._QXZ("Hangup Cause Report")."\n"; echo "
  • "._QXZ("SIP Event Report")."\n"; echo "
  • "._QXZ("AMD Log Report")."\n"; + echo "
  • "._QXZ("Inbound DID Detail Report")."\n"; if ($KHOMP_enabled > 0) {echo "
  • "._QXZ("Dialer KHOMP Admin Tool")."\n";} echo "
  • "._QXZ("Asterisk Debug Page")."\n"; diff --git a/agc_2-X/trunk/www/vicidial/help_documentation.txt b/agc_2-X/trunk/www/vicidial/help_documentation.txt index b5720d66..b980fbf9 100644 --- a/agc_2-X/trunk/www/vicidial/help_documentation.txt +++ b/agc_2-X/trunk/www/vicidial/help_documentation.txt @@ -1,4 +1,4 @@ -# version: 20220506091101 +# version: 20220508100901 users-user User ID 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. users-pass Password This field is where you put the users password. Must be at least 2 characters in length. Only letters and numbers are allowed in user passwords. 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. users-force_change_password Force Change Password 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 or the agent screen. Default is N. @@ -686,6 +686,8 @@ inbound_dids-max_queue_ingroup_id Max Queue In-Group ID For the Max Queue I inbound_dids-max_queue_ingroup_extension Max Queue In-Group Extension For the Max Queue In-Group Calls feature above to work properly, an Extension must be set in this field. Default is 9998811112. Directly above, in the No-Agent In-Group Extension description, you will see some examples of default extensions that you can use in the system to terminate calls to. inbound_dids-pre_filter_phone_group_id Pre-Filter Phone Group ID This option allows you to filter calls through a Filter Phone Group before going through the standard filtering process below. If a match is found then the call is redirected to the Pre-Filter Phone Group DID as defined below. Default is blank for disabled. inbound_dids-pre_filter_extension Pre-Filter Phone Group DID For the Pre-Filter Phone Group ID feature above to work properly, a DID Pattern must be set in this field. Default is blank for disabled. It is recommended that you confirm the DID you enter here is properly set in the system before assigning it. +inbound_dids-pre_filter_recent_call Pre-Filter Recent Call The Pre-Filter Recent Call feature allows for the filtering of inbound phone calls by whether the phone number has previously been an outbound and-or inbound phone call in the system. This setting requires that a Settings Container of the type DID_RECENT_CALL be set up to specify the settings for how it will search for a previous call. In this settings container you can configure it for outbound calls or inbound calls or both. There are 4 settings for each outbound and inbound that you must use:
    outbound_recent_call_check_type - can be set to lead-x-y-days-range or log-x-y-days-range, the difference being if the leads database is searched using the last_local_call_time field or if the logs are searched using the call_time field.
    outbound_recent_call_days - must be a range of days going back from today, with the start and end days separated by a dash. The start day will start at 00:00:00 and the end day would end at 23:59:59 local server time, so if 0-0 is set, it would search today for the full 24-hours of today.
    outbound_recent_call_campaigns - can be set to --ALL-- to have no campaign restrictions, or can be set to a pipe-delimited list of campaign IDs. For inbound, this setting is called inbound_recent_call_groups and if the log method is used it should be a list of inbound group IDs if --ALL-- is not used.
    outbound_recent_call_statuses - can be set to --ALL-- to have no status restrictions, or can be set to a pipe-delimited list of statuses.

    Here are examples of both outbound and inbound reccent call filtering settings:

    outbound_recent_call_check_type => lead-x-y-days-range
    outbound_recent_call_days => 0-14
    outbound_recent_call_campaigns => --ALL--
    outbound_recent_call_statuses => --ALL--

    inbound_recent_call_check_type => log-x-y-days-range
    inbound_recent_call_days => 21-999
    inbound_recent_call_groups => TEST_IN|TEST_IN2|TEST_IN3
    inbound_recent_call_statuses => DNC|NI|LIT

    WARNING: Using this feature may cause load problems and slow down your system.
    +inbound_dids-pre_filter_recent_extension Pre-Filter Recent Call DID If the Pre-Filter Recent Call feature above is active and set to a valid Settings Container, then this field is the internal DID that the call would be sent to if there is a match for a recent call. inbound_dids-filter_inbound_number Filter Inbound Number This option if enabled allows you to filter calls coming into this DID and send them to an alternative action if they match a phone number that is in the filter phone group or a URL response if you have configured one. Default is DISABLED. GROUP will search in a Filter Phone Group. URL will send a URL and will match if a 1 is sent back. DNC_INTERNAL will search by the internal DNC list. DNC_CAMPAIGN will search by one specific campaign DNC list. If the option has AREACODE at the end, then the number and an entry for that numbers 3 digit areacode will be searched for. Both DNC options already have areacode searching built in. inbound_dids-filter_phone_group_id Filter Phone Group ID If the Filter Inbound Number field is set to GROUP then this is the ID of the Filter Phone Group that will have its numbers searched looking for a match to the caller ID number of the incoming call. inbound_dids-filter_url Filter URL If the Filter Inbound Number field is set to URL then this is the web address of a script that will search a remote system and return a 1 for a match and a 0 for no match. Only two variables are available in the address if you use the VAR prefix like with webform addresses in campaigns, --A--phone_number--B-- and --A--did_pattern--B-- can be used in the URL to indicate the caller ID of the caller and the DID that the customer called in on. @@ -1337,6 +1339,7 @@ dialer_inventory_report Dialer Inventory Report This report gives statistic DIDstats Inbound DID Report This report breaks down activity for a DID or a list of DIDs over a given time interval.

    CURRENT ROUTE = Where the DID is currently directed when a call reaches it.

    CALLS = Number of calls the DIDs/servers/time frames (depending on which sub-report you are viewing) received during the specific date range.

    LOST = Number of calls that were supposed to be routed to an INGROUP/AGENT/CALLMENU but do not show log records in the appropriate log tables, suggesting the caller hung up.

    TRANSFERS = Number of calls sent to PHONE/VOICEMAIL/EXTEN during the specific date range.

    ROUTED = Number of calls sent to INGROUP/AGENT/CALLMENU with corresponding log records showing outcome. DIDsummary Inbound DID Summary Report This report breaks down activity for a DID or a list of DIDs over a given time interval.

    CALLS = Number of calls the DIDs/servers/time frames (depending on which sub-report you are viewing) received during the specific date range.

    MINUTES = Cumulative length of time of all calls made to the DID.

    ROUTE = Where the DID is currently directed when a call reaches it. agentDIDstats Agent DID Report This report breaks down agent call handling activity for a DID or a group of DIDs over a given time interval. The results will show the number of calls handled for each agent per day and per week, with column breakdowns for each DID using the DID name for the column header. +DIDdetail Inbound DID Detail Report This report displays the details for every call received for a DID or a list of DIDs over a given time interval.

    CALL DATE = The date and time the call arrived on your system.

    DID EXTEN = The DID number your carrier sent this call to.

    DID PATTERN = The DID pattern that your system used to route the call.

    SERVER = The server that received the call on your system.

    UNIQUEID = The server unique ID of the call.

    CALL ROUTE = Where the call was routed. If there is a prefix of F_, PF_, PFR_ on this value, then the call matched one of the filters set on the DID and it was routed accordingly. A prefix of MQ_ indicates the DID Max Call Queue settings triggered. A prefix of NA_ indicated the No Available Agents settings triggered.

    DID ROUTE = Where the DID is currently routed to when a call reaches it.


    DID ID = The internal system ID of the DID.

    CID NUMBER = The CallerID Number as received from your carrier.

    CID NAME = The CallerID Name as received from your carrier.

    CHANNEL = The server channel ID of the call. email_log_report Email Log Report This report gives a detailed log report of any emails handled by the dialer, including links to the full text of received emails. It will display the date the email was received, the address and name of the sender, a bit of the beginning of the emails text (with a link to the full text), and the status that the agent dispositioned the email as. inbound_daily_report Inbound Daily Report This report will give a daily or hourly, weekly, monthly, and quarterly count on all calls received by the in-groups selected for the given date range.
    TOTAL CALLS OFFERED = Total calls taken by the in-group.
    TOTAL CALLS ANSWERED = Total calls answered by the in-group.
    TOTAL AGENTS ANSWERED = Total number of distinct agents who fielded calls to this in-group.
    TOTAL CALLS ABANDONED = Total calls ended in queue (dropped).
    TOTAL ABANDON PERCENT = Percentage of calls abandoned (TOTAL CALLS ABANDONED / TOTAL CALLS OFFERED).
    AVG ABANDON TIME = Average amount of time a caller waited in queue before abandoning the call.
    AVG ANSWER SPEED = Average amount of time a caller waited in queue before an agent answered.
    AVG TALK TIME = Average amount of time an agent remained on the line with the caller before the call was hung up - does not include caller queue time.
    TOTAL TALK TIME = Total amount of time agents remained on the line with callers before calls ended - does not include caller queue time.
    TOTAL WRAP TIME = Total amount of time agents used to -wrap- the call - assumed to be 15 second per answered call.
    TOTAL CALL TIME = Total talk time plus total wrap time. IVRstats Inbound IVR Report This report shows a breakdown of IVR paths followed by callers on selected IVRs based on the date range.
    IVR CALLS = Total calls taken by or made through the selected IVRs that follow the -CALL PATH-.
    QUEUE CALLS = Total inbound calls taken by the selected IVRs that follow the -CALL PATH-.
    QUEUE DROP CALLS = Total inbound calls taken by the selected IVRs that follow the -CALL PATH- that were dropped.
    QUEUE DROP PERCENT = Percentage of dropped inbound calls taken by the selected IVRs (QUEUE DROP CALLS / QUEUE CALLS).
    IVR AVG TIME = Average amount of time spent in-call, taken by dividing IVR CALLS by the total time spent in the selected IVRs.
    TOTAL AVG TIME = Total call time spent in the selected IVRs.
    CALL PATH = The specific call path followed on the IVR - report will display each distinct path followed by all the selected IVRs for the selected date range.