From 6e6609f993528b1298970a9574915c945b65b964 Mon Sep 17 00:00:00 2001 From: mattf Date: Tue, 21 Oct 2025 13:16:28 +0000 Subject: [PATCH] Added code for recording_dtmf_muting, fix for Stereo Call Recording on multi-server clusters git-svn-id: svn://192.168.202.10@3949 3d104415-ff17-0410-8863-d5cf3c621b8a --- agc_2-X/trunk/UPGRADE | 4 + agc_2-X/trunk/agi/VD_amd.agi | 50 +- agc_2-X/trunk/agi/agi-DID_route.agi | 22 +- .../agi/agi-IVR_recording_verification.agi | 30 +- agc_2-X/trunk/agi/agi-NVA_recording.agi | 69 +- agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi | 127 +- agc_2-X/trunk/agi/agi-VDAD_ALL_outbound.agi | 244 ++- agc_2-X/trunk/agi/agi-VDAD_RINGALL.agi | 50 +- agc_2-X/trunk/bin/ADMIN_archive_log_tables.pl | 50 + .../bin/ADMIN_central_lead_repository.pl | 1795 +++++++++++++++++ agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl | 78 +- .../trunk/bin/AST_CRON_audio_1_move_mix.pl | 7 +- agc_2-X/trunk/bin/AST_flush_DBqueue.pl | 50 +- agc_2-X/trunk/bin/AST_manager_listen_AMI2.pl | 123 +- agc_2-X/trunk/bin/AST_update_AMI2.pl | 126 +- agc_2-X/trunk/docs/STEREO_CALL_RECORDINGS.txt | 61 +- .../trunk/extras/MySQL_AST_CREATE_tables.sql | 23 +- agc_2-X/trunk/extras/upgrade_2.14.sql | 51 +- agc_2-X/trunk/www/agc/manager_send.php | 90 +- agc_2-X/trunk/www/agc/vdc_db_query.php | 96 +- agc_2-X/trunk/www/agc/vicidial.php | 27 +- agc_2-X/trunk/www/vicidial/admin.php | 70 +- .../trunk/www/vicidial/admin_modify_lead.php | 50 +- .../trunk/www/vicidial/help_documentation.txt | 10 +- 24 files changed, 3029 insertions(+), 274 deletions(-) create mode 100644 agc_2-X/trunk/bin/ADMIN_central_lead_repository.pl diff --git a/agc_2-X/trunk/UPGRADE b/agc_2-X/trunk/UPGRADE index f8c25942..e3b25676 100644 --- a/agc_2-X/trunk/UPGRADE +++ b/agc_2-X/trunk/UPGRADE @@ -886,6 +886,10 @@ OTHER CHANGES: to be sent out from the Agent Screen while the agent is talking to the customer, based on the number of seconds they have been talking. +253. Added Recording DTMF Muting, allowing for the muting of call recordings + for X seconds if any DTMF signal is detected on the call. Configurable + in Campaigns, In-Groups and system-wide. + diff --git a/agc_2-X/trunk/agi/VD_amd.agi b/agc_2-X/trunk/agi/VD_amd.agi index 175ba8d0..abf2c6f5 100644 --- a/agc_2-X/trunk/agi/VD_amd.agi +++ b/agc_2-X/trunk/agi/VD_amd.agi @@ -71,15 +71,17 @@ # 230726-0932 - Added manual_vm_status_updates campaign option # 240906-2228 - Added AMD minimum length handling to increase short call durations # 250924-2152 - Added code for deprecation of "Monitor" application after Asterisk 20 +# 251006-0903 - If recording_dtmf_muting enabled, force use of MixMonitor for recording # $script = 'VD_amd.agi'; -$build = '250924-2152'; +$build = '251006-0903'; $A = 1; # set to 1 for AMD output messages mode $AMD_LOG = 3; # set to 1 for logfile and 2 forDB log, 3 for both $wav='.wav'; $US='_'; +$recording_dtmf_muting=0; ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); $year = ($year + 1900); @@ -148,7 +150,7 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA ############################################# ##### Gather system_settings ##### -$stmtA = "SELECT sip_event_logging,call_quota_lead_ranking FROM system_settings;"; +$stmtA = "SELECT sip_event_logging,call_quota_lead_ranking,recording_dtmf_muting,recording_dtmf_detection FROM system_settings;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -157,6 +159,8 @@ if ($sthArows > 0) @aryA = $sthA->fetchrow_array; $SSsip_event_logging = $aryA[0]; $SScall_quota_lead_ranking = $aryA[1]; + $SSrecording_dtmf_muting = $aryA[2]; + $SSrecording_dtmf_detection = $aryA[3]; } $sthA->finish(); ########################################### @@ -534,7 +538,7 @@ else $selected_campaign=''; ### Grab vmail forward message values from the database - $stmtA = "SELECT am_message_exten,amd_send_to_vmx,waitforsilence_options,survey_recording,campaign_rec_filename,cpd_amd_action,amd_inbound_group,amd_callmenu,cpd_unknown_action,campaign_id,am_message_wildcards,call_quota_lead_ranking,vmm_daily_limit,manual_vm_status_updates FROM vicidial_campaigns where campaign_id = '$VD_campaign_id' limit 1;"; + $stmtA = "SELECT am_message_exten,amd_send_to_vmx,waitforsilence_options,survey_recording,campaign_rec_filename,cpd_amd_action,amd_inbound_group,amd_callmenu,cpd_unknown_action,campaign_id,am_message_wildcards,call_quota_lead_ranking,vmm_daily_limit,manual_vm_status_updates,recording_dtmf_muting FROM vicidial_campaigns where campaign_id = '$VD_campaign_id' limit 1;"; if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; @@ -556,6 +560,7 @@ else $VD_call_quota_lead_ranking = $aryA[11]; $vmm_daily_limit = $aryA[12]; $manual_vm_status_updates = $aryA[13]; + $recording_dtmf_muting = $aryA[14]; $sthA->finish(); } else @@ -563,7 +568,7 @@ else $sthA->finish(); ### Grab vmail forward message values from the database $SQL_group_id=$VD_campaign_id; $SQL_group_id =~ s/_/\\_/gi; - $stmtA = "SELECT am_message_exten,amd_send_to_vmx,waitforsilence_options,survey_recording,campaign_rec_filename,cpd_amd_action,amd_inbound_group,amd_callmenu,cpd_unknown_action,campaign_id,am_message_wildcards,vmm_daily_limit,manual_vm_status_updates FROM vicidial_campaigns where closer_campaigns LIKE \"% $SQL_group_id %\" order by active,campaign_id limit 1;"; + $stmtA = "SELECT am_message_exten,amd_send_to_vmx,waitforsilence_options,survey_recording,campaign_rec_filename,cpd_amd_action,amd_inbound_group,amd_callmenu,cpd_unknown_action,campaign_id,am_message_wildcards,vmm_daily_limit,manual_vm_status_updates,recording_dtmf_muting FROM vicidial_campaigns where closer_campaigns LIKE \"% $SQL_group_id %\" order by active,campaign_id limit 1;"; if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; @@ -585,6 +590,7 @@ else $VD_call_quota_lead_ranking = 'DISABLED'; $vmm_daily_limit = $aryA[12]; $manual_vm_status_updates = $aryA[13]; + $recording_dtmf_muting = $aryA[14]; $sthA->finish(); if ($AGILOG) {$agi_string = "-- Inbound call, settings gathered from: |$selected_campaign|$DB_am_message_exten|$DB_amd_send_to_vmx|$waitforsilence_options"; &agi_output;} } @@ -710,25 +716,49 @@ else %ast_ver_str = parse_asterisk_version($asterisk_version); if (( $ast_ver_str{major} = 1 ) && ($ast_ver_str{minor} < 6)) { - $AGI->exec("Monitor wav|/var/spool/asterisk/monitor/MIX/$campaign_rec_filename"); + $AGI->exec("Monitor wav|/var/spool/asterisk/monitor/MIX/AMD$campaign_rec_filename"); } else { - if ($ast_ver_str{major} > 20) + if ( ($ast_ver_str{major} > 20) || ($SSrecording_dtmf_muting > 0) ) { # Deprecation of "Monitor" application after Asterisk 20 - $AGI->exec("MixMonitor",",r($PATHmonitor/MIX/$campaign_rec_filename-in.wav)t($PATHmonitor/MIX/$campaign_rec_filename-out.wav)"); + $AGI->exec("MixMonitor",",r($PATHmonitor/MIX/AMD$campaign_rec_filename-in.wav)t($PATHmonitor/MIX/AMD$campaign_rec_filename-out.wav)"); } else { - $AGI->exec("Monitor","wav,/var/spool/asterisk/monitor/MIX/$campaign_rec_filename"); + $AGI->exec("Monitor","wav,/var/spool/asterisk/monitor/MIX/AMD$campaign_rec_filename"); } } ### insert record into recording_log table ### - $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,length_in_sec,filename,lead_id,user,location,vicidial_id) values('$channel','$VARserver_ip','$VD_phone_number','$now_date','$now_date_epoch','0','$campaign_rec_filename','$VD_lead_id','VDAD','$campaign_rec_filename','$uniqueid');"; + $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,length_in_sec,filename,lead_id,user,location,vicidial_id) values('$channel','$VARserver_ip','$VD_phone_number','$now_date','$now_date_epoch','0','AMD$campaign_rec_filename','$VD_lead_id','VDAD','AMD$campaign_rec_filename','$uniqueid');"; $SRaffected_rows = $dbhA->do($stmtA); - if ($AGILOG) {$agi_string = "-- AMD RECORDING STARTED : |$SRaffected_rows|$campaign_rec_filename|$stmtA|"; &agi_output;} + + $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; + $sthA = $dbhA->prepare($stmtB) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $recording_id = $aryA[0]; + } + $sthA->finish(); + + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + { + if ($SSrecording_dtmf_muting > 1) + { + $recording_dtmf_muting = $SSrecording_dtmf_muting; + } + } + + ### insert record into recording_live table ### + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','MONO_LEGACY_AMD','$VARserver_ip','$now_date','$channel','AMD$campaign_rec_filename','$VD_lead_id','VDAD','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; + $rLIVEaffected_rows = $dbhA->do($stmtD); + + if ($AGILOG) {$agi_string = "-- AMD RECORDING STARTED : |$SRaffected_rows|$rLIVEaffected_rows|$recording_id|AMD$campaign_rec_filename|$stmtA|"; &agi_output;} } } diff --git a/agc_2-X/trunk/agi/agi-DID_route.agi b/agc_2-X/trunk/agi/agi-DID_route.agi index fbfa72b7..ab2a1f6c 100644 --- a/agc_2-X/trunk/agi/agi-DID_route.agi +++ b/agc_2-X/trunk/agi/agi-DID_route.agi @@ -52,6 +52,7 @@ # 230124-1228 - Added logging of VICIrecGatewayID channel variable, and vicidial_did_gateway_log table # 241208-1748 - Changed DID filter_phone_group_id & pre_filter_phone_group_id to multi-selects # 250924-2156 - Added code for deprecation of "Monitor" application after Asterisk 20 +# 251006-0905 - If recording_dtmf_muting enabled, force use of MixMonitor for recording # @@ -154,7 +155,7 @@ $sthA->finish(); ############################################# ##### START SYSTEM SETTINGS LOOKUP ##### -$stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_eq_prepend,did_agent_log,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db,did_system_filter,inbound_answer_config FROM system_settings;"; +$stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_eq_prepend,did_agent_log,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db,did_system_filter,inbound_answer_config,recording_dtmf_muting,recording_dtmf_detection FROM system_settings;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -176,6 +177,8 @@ if ($sthArows > 0) $tables_use_alt_log_db = $aryA[12]; $SSdid_system_filter = $aryA[13]; $SSinbound_answer_config = $aryA[14]; + $SSrecording_dtmf_muting = $aryA[15]; + $SSrecording_dtmf_detection = $aryA[16]; } $sthA->finish(); ##### END SYSTEM SETTINGS LOOKUP ##### @@ -880,7 +883,7 @@ if ($record_call =~ /Y/) } else { - if ($ast_ver_str{major} > 20) + if ( ($ast_ver_str{major} > 20) || ($SSrecording_dtmf_muting > 0) ) { # Deprecation of "Monitor" application after Asterisk 20 $AGI->exec("MixMonitor",",r($PATHmonitor/MIX/$filename-in.wav)t($PATHmonitor/MIX/$filename-out.wav)"); @@ -908,7 +911,20 @@ if ($record_call =~ /Y/) $sthA->finish(); } - if ($AGILOG) {$did_string = "-- RECORDING LOG : |$affected_rowsR|$insert_recording_id|$stmtA|"; &did_output;} + $recording_dtmf_muting=0; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + { + if ($SSrecording_dtmf_muting > 1) + { + $recording_dtmf_muting = $SSrecording_dtmf_muting; + } + } + + ### insert record into recording_live table ### + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$insert_recording_id','MONO_LEGACY_DID','$VARserver_ip','$now_date','$channel','$filename','$lead_id','$user','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; + $rLIVEaffected_rows = $dbhA->do($stmtD); + + if ($AGILOG) {$did_string = "-- RECORDING LOG : |$affected_rowsR|$rLIVEaffected_rows|$insert_recording_id|$stmtA|"; &did_output;} } ### Grab Server values from the database diff --git a/agc_2-X/trunk/agi/agi-IVR_recording_verification.agi b/agc_2-X/trunk/agi/agi-IVR_recording_verification.agi index eff0c54c..e7a2def4 100644 --- a/agc_2-X/trunk/agi/agi-IVR_recording_verification.agi +++ b/agc_2-X/trunk/agi/agi-IVR_recording_verification.agi @@ -54,6 +54,7 @@ # 120430-2214 - Converted call to Monitor app to be asterisk 1.8 compatible # 130108-1816 - Changes for Asterisk 1.8 compatibility # 250924-2158 - Added code for deprecation of "Monitor" application after Asterisk 20 +# 251006-0901 - If recording_dtmf_muting enabled, force use of MixMonitor for recording # &get_time_now; @@ -119,6 +120,21 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA or die "Couldn't connect to database: " . DBI->errstr; +############################################# +##### Gather system_settings ##### +$stmtA = "SELECT recording_dtmf_muting,recording_dtmf_detection FROM system_settings;"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $SSrecording_dtmf_muting = $aryA[0]; + $SSrecording_dtmf_detection = $aryA[1]; + } +$sthA->finish(); +########################################### + ### Grab Server values from the database $stmtA = "SELECT agi_output,ext_context,asterisk_version FROM servers where server_ip = '$VARserver_ip';"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; @@ -387,7 +403,7 @@ if ($record_call =~ /Y/) } else { - if ($ast_ver_str{major} > 20) + if ( ($ast_ver_str{major} > 20) || ($SSrecording_dtmf_muting > 0) ) { # Deprecation of "Monitor" application after Asterisk 20 $AGI->exec("MixMonitor",",r($PATHmonitor/MIX/$filename-in.wav)t($PATHmonitor/MIX/$filename-out.wav)"); @@ -418,6 +434,18 @@ if ($record_call =~ /Y/) if ($AGILOG) {$agi_string = "RECORDING- $recording_id $ivr_id START filename: $filename"; &agi_output;} $affected_rows = $dbhA->do($stmtA); + $recording_dtmf_muting=0; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + { + if ($SSrecording_dtmf_muting > 1) + { + $recording_dtmf_muting = $SSrecording_dtmf_muting; + } + } + + ### insert record into recording_live table ### + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','MONO_LEGACY_VERIF','$server_ip','$now_date','$channel','$filename','$lead_id','$user','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; + $rLIVEaffected_rows = $dbhA->do($stmtD); } diff --git a/agc_2-X/trunk/agi/agi-NVA_recording.agi b/agc_2-X/trunk/agi/agi-NVA_recording.agi index 49bc1a47..6765a42c 100644 --- a/agc_2-X/trunk/agi/agi-NVA_recording.agi +++ b/agc_2-X/trunk/agi/agi-NVA_recording.agi @@ -61,6 +61,7 @@ # 151214-2148 - Added more variables to be used by nva url feature # 151220-1521 - Added phone NVA List ID option for not found phone numbers # 250924-2137 - Added code for deprecation of "Monitor" application after Asterisk 20 +# 251006-0904 - If recording_dtmf_muting enabled, force use of MixMonitor for recording # &get_time_now; @@ -82,6 +83,7 @@ $now_date = "$year-$mon-$mday $hour:$min:$sec"; $filedate = "$year$mon$mday$hour$min$sec"; $US='_'; +$VLAcampaign=''; # default path to astguiclient configuration file: @@ -126,6 +128,21 @@ $AGI = new Asterisk::AGI; $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") or die "Couldn't connect to database: " . DBI->errstr; +############################################# +##### Gather system_settings ##### +$stmtA = "SELECT recording_dtmf_muting,recording_dtmf_detection FROM system_settings;"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $SSrecording_dtmf_muting = $aryA[0]; + $SSrecording_dtmf_detection = $aryA[1]; + } +$sthA->finish(); +########################################### + ### Grab Server values from the database $stmtA = "SELECT agi_output,ext_context,asterisk_version FROM servers where server_ip = '$VARserver_ip';"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; @@ -405,7 +422,7 @@ if ($record_call =~ /Y/) } else { - if ($ast_ver_str{major} > 20) + if ( ($ast_ver_str{major} > 20) || ($SSrecording_dtmf_muting > 0) ) { # Deprecation of "Monitor" application after Asterisk 20 $AGI->exec("MixMonitor",",r(/var/spool/asterisk/monitor/MIX/$filename-in.wav)t(/var/spool/asterisk/monitor/MIX/$filename-out.wav)"); @@ -415,6 +432,56 @@ if ($record_call =~ /Y/) $AGI->exec("Monitor","wav,/var/spool/asterisk/monitor/MIX/$filename"); } } + + ### get campaign settings for DTMF muting, if enabled on this system + $recording_dtmf_muting=0; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + { + if ($SSrecording_dtmf_muting > 1) + { + $recording_dtmf_muting = $SSrecording_dtmf_muting; + } + else + { + if (length($VLAcampaign) < 1) + { + $stmtA = "SELECT list_id FROM vicidial_list where lead_id='$lead_id' limit 1;"; + $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; + $VLAlist_id = $aryA[0]; + + $stmtA = "SELECT campaign_id FROM vicidial_lists where list_id='$VLAlist_id' limit 1;"; + $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; + $VLAcampaign = $aryA[0]; + } + } + } + + $stmtA = "SELECT recording_dtmf_muting FROM vicidial_campaigns where campaign_id='$VLAcampaign' limit 1;"; + $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; + $recording_dtmf_muting = $aryA[0]; + } + } + if ($AGILOG) {$agi_string = "DTMF Muting check: $recording_dtmf_muting|$SSrecording_dtmf_muting|$VLAcampaign($lead_id)"; &agi_output;} + } + + ### insert record into recording_live table ### + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','MONO_LEGACY_NVA','$VARserver_ip','$now_date','$channel','$filename','$lead_id','$accountcode','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; + $rLIVEaffected_rows = $dbhA->do($stmtD); } if ( ($phone_url =~ /Y/) && (length($nva_call_url) > 8) ) diff --git a/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi b/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi index 8baef744..8d7cbc82 100644 --- a/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi +++ b/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi @@ -268,6 +268,7 @@ # 250825-1824 - Added stereo_recording code # 250924-2147 - Added code for deprecation of "Monitor" application after Asterisk 20 # 251001-1836 - Fix for rare Stereo recording filename issue +# 251020-0836 - Added code for recording_dtmf_muting, fix for stereo call recording # $script = 'agi-VDAD_ALL_inbound.agi'; @@ -436,7 +437,7 @@ $sthA->finish(); ############################################# ##### START SYSTEM SETTINGS LOOKUP ##### -$stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_eq_prepend,queuemetrics_pe_phone_append,did_agent_log,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db,did_ra_extensions_enabled,queuemetrics_socket,queuemetrics_socket_url,enable_did_entry_list_id,enable_drop_lists,inbound_answer_config,agent_search_method,abandon_check_queue,inbound_credits,stereo_recording,stereo_parallel_recording FROM system_settings;"; +$stmtA = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_eq_prepend,queuemetrics_pe_phone_append,did_agent_log,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db,did_ra_extensions_enabled,queuemetrics_socket,queuemetrics_socket_url,enable_did_entry_list_id,enable_drop_lists,inbound_answer_config,agent_search_method,abandon_check_queue,inbound_credits,stereo_recording,stereo_parallel_recording,recording_dtmf_detection,recording_dtmf_muting FROM system_settings;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -469,6 +470,8 @@ if ($sthArows > 0) $SSinbound_credits = $aryA[22]; $SSstereo_recording = $aryA[23]; $SSstereo_parallel_recording = $aryA[24]; + $SSrecording_dtmf_detection = $aryA[25]; + $SSrecording_dtmf_muting = $aryA[26]; } $sthA->finish(); ##### END SYSTEM SETTINGS LOOKUP ##### @@ -907,7 +910,7 @@ $affected_rows = $dbhA->do($stmtA); ### Grab inbound groups values from the database $cbc=0; -$stmtA = "SELECT call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,drop_call_seconds,drop_action,drop_exten,next_agent_call,voicemail_ext,queue_priority,drop_inbound_group,afterhours_xfer_group,play_place_in_line,play_estimate_hold_time,hold_time_option,hold_time_option_seconds,hold_time_option_exten,hold_time_option_voicemail,hold_time_option_xfer_group,hold_time_option_callback_filename,hold_time_option_callback_list_id,hold_recall_xfer_group,no_delay_call_route,play_welcome_message,no_agent_no_queue,no_agent_action,no_agent_action_value,extension_appended_cidname,uniqueid_status_display,uniqueid_status_prefix,hold_time_option_minimum,hold_time_option_press_filename,hold_time_option_callmenu,onhold_prompt_no_block,onhold_prompt_seconds,hold_time_option_no_block,hold_time_option_prompt_seconds,hold_time_second_option,hold_time_third_option,wait_hold_option_priority,wait_time_option,wait_time_second_option,wait_time_third_option,wait_time_option_seconds,wait_time_option_exten,wait_time_option_voicemail,wait_time_option_xfer_group,wait_time_option_callmenu,wait_time_option_callback_filename,wait_time_option_callback_list_id,wait_time_option_press_filename,wait_time_option_no_block,wait_time_option_prompt_seconds,active,calculate_estimated_hold_seconds,add_lead_url,eht_minimum_prompt_filename,eht_minimum_prompt_no_block,eht_minimum_prompt_seconds,on_hook_ring_time,ingroup_recording_override,ingroup_rec_filename,on_hook_cid,action_xfer_cid,drop_callmenu,after_hours_callmenu,max_calls_method,max_calls_count,max_calls_action,populate_lead_ingroup,na_call_url,drop_lead_reset,after_hours_lead_reset,nanq_lead_reset,wait_time_lead_reset,hold_time_lead_reset,routing_initiated_recordings,on_hook_cid_number,populate_lead_province,areacode_filter,areacode_filter_seconds,areacode_filter_action,areacode_filter_action_value,populate_state_areacode,inbound_survey,inbound_survey_filename,inbound_survey_accept_digit,closing_time_action,closing_time_now_trigger,closing_time_filename,closing_time_end_filename,closing_time_lead_reset,closing_time_option_exten,closing_time_option_callmenu,closing_time_option_voicemail,closing_time_option_xfer_group,closing_time_option_callback_list_id,add_lead_timezone,populate_lead_source,populate_lead_vendor,enter_ingroup_url,cid_cb_confirm_number,cid_cb_invalid_filter_phone_group,cid_cb_valid_length,cid_cb_valid_filename,cid_cb_confirmed_filename,cid_cb_enter_filename,cid_cb_you_entered_filename,cid_cb_press_to_confirm_filename,cid_cb_invalid_filename,cid_cb_reenter_filename,cid_cb_error_filename,place_in_line_caller_number_filename,place_in_line_you_next_filename,answer_signal,no_agent_delay,agent_search_method,populate_lead_comments,drop_call_seconds_override,populate_lead_owner,in_queue_nanque,in_queue_nanque_exceptions,second_alert_trigger,second_alert_trigger_seconds,second_alert_filename,second_alert_delay,second_alert_container,second_alert_only,third_alert_trigger,third_alert_trigger_seconds,third_alert_filename,third_alert_delay,third_alert_container,third_alert_only,stereo_recording,stereo_recording_agent,stereo_rec_filename,stereo_parallel_recording,parallel_rec_co_filename,parallel_rec_cm_filename,parallel_rec_fr_filename FROM vicidial_inbound_groups where group_id = '$channel_group';"; +$stmtA = "SELECT call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,drop_call_seconds,drop_action,drop_exten,next_agent_call,voicemail_ext,queue_priority,drop_inbound_group,afterhours_xfer_group,play_place_in_line,play_estimate_hold_time,hold_time_option,hold_time_option_seconds,hold_time_option_exten,hold_time_option_voicemail,hold_time_option_xfer_group,hold_time_option_callback_filename,hold_time_option_callback_list_id,hold_recall_xfer_group,no_delay_call_route,play_welcome_message,no_agent_no_queue,no_agent_action,no_agent_action_value,extension_appended_cidname,uniqueid_status_display,uniqueid_status_prefix,hold_time_option_minimum,hold_time_option_press_filename,hold_time_option_callmenu,onhold_prompt_no_block,onhold_prompt_seconds,hold_time_option_no_block,hold_time_option_prompt_seconds,hold_time_second_option,hold_time_third_option,wait_hold_option_priority,wait_time_option,wait_time_second_option,wait_time_third_option,wait_time_option_seconds,wait_time_option_exten,wait_time_option_voicemail,wait_time_option_xfer_group,wait_time_option_callmenu,wait_time_option_callback_filename,wait_time_option_callback_list_id,wait_time_option_press_filename,wait_time_option_no_block,wait_time_option_prompt_seconds,active,calculate_estimated_hold_seconds,add_lead_url,eht_minimum_prompt_filename,eht_minimum_prompt_no_block,eht_minimum_prompt_seconds,on_hook_ring_time,ingroup_recording_override,ingroup_rec_filename,on_hook_cid,action_xfer_cid,drop_callmenu,after_hours_callmenu,max_calls_method,max_calls_count,max_calls_action,populate_lead_ingroup,na_call_url,drop_lead_reset,after_hours_lead_reset,nanq_lead_reset,wait_time_lead_reset,hold_time_lead_reset,routing_initiated_recordings,on_hook_cid_number,populate_lead_province,areacode_filter,areacode_filter_seconds,areacode_filter_action,areacode_filter_action_value,populate_state_areacode,inbound_survey,inbound_survey_filename,inbound_survey_accept_digit,closing_time_action,closing_time_now_trigger,closing_time_filename,closing_time_end_filename,closing_time_lead_reset,closing_time_option_exten,closing_time_option_callmenu,closing_time_option_voicemail,closing_time_option_xfer_group,closing_time_option_callback_list_id,add_lead_timezone,populate_lead_source,populate_lead_vendor,enter_ingroup_url,cid_cb_confirm_number,cid_cb_invalid_filter_phone_group,cid_cb_valid_length,cid_cb_valid_filename,cid_cb_confirmed_filename,cid_cb_enter_filename,cid_cb_you_entered_filename,cid_cb_press_to_confirm_filename,cid_cb_invalid_filename,cid_cb_reenter_filename,cid_cb_error_filename,place_in_line_caller_number_filename,place_in_line_you_next_filename,answer_signal,no_agent_delay,agent_search_method,populate_lead_comments,drop_call_seconds_override,populate_lead_owner,in_queue_nanque,in_queue_nanque_exceptions,second_alert_trigger,second_alert_trigger_seconds,second_alert_filename,second_alert_delay,second_alert_container,second_alert_only,third_alert_trigger,third_alert_trigger_seconds,third_alert_filename,third_alert_delay,third_alert_container,third_alert_only,stereo_recording,stereo_recording_agent,stereo_rec_filename,stereo_parallel_recording,parallel_rec_co_filename,parallel_rec_cm_filename,parallel_rec_fr_filename,recording_dtmf_muting FROM vicidial_inbound_groups where group_id = '$channel_group';"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -1070,6 +1073,9 @@ if ($sthArows > 0) $parallel_rec_co_filename = $aryA[145]; $parallel_rec_cm_filename = $aryA[146]; $parallel_rec_fr_filename = $aryA[147]; + $recording_dtmf_muting = $aryA[148]; + if ( ($SSrecording_dtmf_detection < 1) || ($SSrecording_dtmf_muting < 1) ) + {$recording_dtmf_muting=0;} if ( (length($place_in_line_caller_number_filename) < 1) || ($place_in_line_caller_number_filename =~ /^NULL$/i) ) {$place_in_line_caller_number_filename='queue-thereare';} @@ -2693,7 +2699,7 @@ if ( ($CLchannel_group =~ /DID_INBOUND/) && (length($CLend_epoch) < 5) ) } else { - if ($ast_ver_str{major} > 20) + if ( ($ast_ver_str{major} > 20) || ($SSrecording_dtmf_muting > 0) ) { # Deprecation of "Monitor" application after Asterisk 20 $AGI->exec("StopMixMonitor",""); @@ -2704,7 +2710,6 @@ if ( ($CLchannel_group =~ /DID_INBOUND/) && (length($CLend_epoch) < 5) ) } } - $stmtA = "UPDATE recording_log set end_time='$now_date',end_epoch='$now_date_epoch',length_in_sec=$CLlength_in_sec,length_in_min='$CLlength_in_min' where recording_id='$CLrecording_id'"; $affected_rowsRL = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "Recording stopped: $CLstart_epoch|$now_date_epoch|$affected_rowsRL|$stmtA|"; &agi_output;} @@ -3459,7 +3464,9 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override $affected_rowsC = $dbhA->do($stmtC); $dbhP=$dbhA; $mysql_count='02217'; $MEL_aff_rows=$affected_rowsC; &mysql_error_logging; - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','MONO_LEGACY_RIR','$VARserver_ip','$now_date','$channel','$campaign_rec_filename','$insert_lead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','MONO_LEGACY_RIR','$VDADserver_ip','$now_date','$channelrec','$campaign_rec_filename','$insert_lead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -3489,7 +3496,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override $PATHmonitorT = $PATHmonitorP; ### insert record into recording_log_parallel table ### - $stmtA = "INSERT INTO recording_log_parallel (channel,server_ip,extension,start_time,length_in_sec,filename,lead_id,user,vicidial_id,recording_status) values('$channel','$VDADserver_ip','','$now_date','0','PL$stereo_rec_filename','$insert_lead_id','$VDADuser','$insert_close_id','START');"; + $stmtA = "INSERT INTO recording_log_parallel (channel,server_ip,extension,start_time,length_in_sec,filename,lead_id,user,vicidial_id,recording_status) values('$channel','$VARserver_ip','','$now_date','0','PL$stereo_rec_filename','$insert_lead_id','$VDADuser','$insert_close_id','START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -3529,7 +3536,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override $temp_parallel_rec_co_filename =~ s/\"|\'//gi; } ### insert a record into the recording_log table - $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VDADserver_ip','SPCO','$now_date','$now_date_epoch','$temp_parallel_rec_co_filename','$insert_lead_id','$VDADuser','$insert_close_id')"; + $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VARserver_ip','SPCO','$now_date','$now_date_epoch','$temp_parallel_rec_co_filename','$insert_lead_id','$VDADuser','$insert_close_id')"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -3554,11 +3561,13 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override } ### insert record into recording_log_stereo table ### - $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VDADserver_ip','$now_date','0','$temp_parallel_rec_co_filename','$insert_lead_id','$channel_group STEREO_PARALLEL CUSTOMER-ONLY $stereo_recording','start: $now_date|vicidial_id: $insert_close_id|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; + $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VARserver_ip','$now_date','0','$temp_parallel_rec_co_filename','$insert_lead_id','$channel_group STEREO_PARALLEL CUSTOMER-ONLY $stereo_recording','start: $now_date|vicidial_id: $insert_close_id|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO_PARALLEL CUSTOMER-ONLY','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_co_filename','$insert_lead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO_PARALLEL CUSTOMER-ONLY','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_co_filename','$insert_lead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -3584,7 +3593,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override $temp_parallel_rec_cm_filename =~ s/\"|\'//gi; } ### insert a record into the recording_log table - $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VDADserver_ip','SPCM','$now_date','$now_date_epoch','$temp_parallel_rec_cm_filename','$insert_lead_id','$VDADuser','$insert_close_id')"; + $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VARserver_ip','SPCM','$now_date','$now_date_epoch','$temp_parallel_rec_cm_filename','$insert_lead_id','$VDADuser','$insert_close_id')"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -3609,11 +3618,13 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override } ### insert record into recording_log_stereo table ### - $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VDADserver_ip','$now_date','0','$temp_parallel_rec_cm_filename','$insert_lead_id','$channel_group STEREO_PARALLEL CUSTOMER-MUTED $stereo_recording','start: $now_date|vicidial_id: $insert_close_id|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; + $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VARserver_ip','$now_date','0','$temp_parallel_rec_cm_filename','$insert_lead_id','$channel_group STEREO_PARALLEL CUSTOMER-MUTED $stereo_recording','start: $now_date|vicidial_id: $insert_close_id|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO_PARALLEL CUSTOMER-MUTED','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_cm_filename','$insert_lead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO_PARALLEL CUSTOMER-MUTED','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_cm_filename','$insert_lead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -3639,7 +3650,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override $temp_parallel_rec_fr_filename =~ s/\"|\'//gi; } ### insert a record into the recording_log table - $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VDADserver_ip','SPFR','$now_date','$now_date_epoch','$temp_parallel_rec_fr_filename','$insert_lead_id','$VDADuser','$insert_close_id')"; + $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VARserver_ip','SPFR','$now_date','$now_date_epoch','$temp_parallel_rec_fr_filename','$insert_lead_id','$VDADuser','$insert_close_id')"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -3664,11 +3675,13 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override } ### insert record into recording_log_stereo table ### - $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VDADserver_ip','$now_date','0','$temp_parallel_rec_fr_filename','$insert_lead_id','$channel_group STEREO_PARALLEL FULL-RECORDING $stereo_recording','start: $now_date|vicidial_id: $insert_close_id|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; + $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VARserver_ip','$now_date','0','$temp_parallel_rec_fr_filename','$insert_lead_id','$channel_group STEREO_PARALLEL FULL-RECORDING $stereo_recording','start: $now_date|vicidial_id: $insert_close_id|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO_PARALLEL FULL-RECORDING','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_fr_filename','$insert_lead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO_PARALLEL FULL-RECORDING','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_fr_filename','$insert_lead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -3680,7 +3693,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override { $temp_parallel_rec_ag_filename = $stereo_rec_filename; ### insert a record into the recording_log table - $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VDADserver_ip','SPACI','$now_date','$now_date_epoch','$temp_parallel_rec_ag_filename','$insert_lead_id','$VDADuser','$insert_close_id')"; + $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VARserver_ip','SPACI','$now_date','$now_date_epoch','$temp_parallel_rec_ag_filename','$insert_lead_id','$VDADuser','$insert_close_id')"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -3705,7 +3718,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override } ### insert record into recording_log_stereo table ### - $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VDADserver_ip','$now_date','0','$temp_parallel_rec_ag_filename','$insert_lead_id','$channel_group STEREO_PARALLEL AGENT-CONTROLLED RIR $stereo_recording $stereo_recording_agent','start: $now_date|vicidial_id: $insert_close_id|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; + $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VARserver_ip','$now_date','0','$temp_parallel_rec_ag_filename','$insert_lead_id','$channel_group STEREO_PARALLEL AGENT-CONTROLLED RIR $stereo_recording $stereo_recording_agent','start: $now_date|vicidial_id: $insert_close_id|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; @@ -3713,7 +3726,9 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override $affected_rowsB = $dbhA->do($stmtB); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rowsB; &mysql_error_logging; - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO_PARALLEL AGENT-CONTROLLED RIR','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_ag_filename','$insert_lead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO_PARALLEL AGENT-CONTROLLED RIR','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_ag_filename','$insert_lead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -3725,8 +3740,14 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override ## Start NON-parallel stereo call recording ## if ($stereo_recording_agent =~ /ALLCALLS|ALLFORCE/) { + $rl_exten='SACIBC'; + if ($stereo_recording =~ /CUSTOMER_ONLY/i) + {$rl_exten='SACICO';} + if ($stereo_recording =~ /CUSTOMER_MUTE/i) + {$rl_exten='SACICM';} + # insert a record into the recording_log table - $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VDADserver_ip','SACI','$now_date','$now_date_epoch','$stereo_rec_filename','$insert_lead_id','$VDADuser','$insert_close_id')"; + $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VARserver_ip','$rl_exten','$now_date','$now_date_epoch','$stereo_rec_filename','$insert_lead_id','$VDADuser','$insert_close_id')"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -3754,7 +3775,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override $retval = $AGI->exec("MixMonitor",",r($PATHmonitorT/$stereo_rec_filename-out.wav)t($PATHmonitorT/$stereo_rec_filename-in.wav)"); ### insert record into recording_log_stereo table ### - $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,recording_status) values('$recording_id','$VDADserver_ip','$now_date','0','$stereo_rec_filename','$insert_lead_id','$channel_group STEREO AGENT-CONTROLLED $stereo_recording $stereo_recording_agent','start: $now_date|vicidial_id: $insert_close_id|user: $VDADuser|channel: $channel|','STEREO START');"; + $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,recording_status) values('$recording_id','$VARserver_ip','$now_date','0','$stereo_rec_filename','$insert_lead_id','$channel_group STEREO AGENT-CONTROLLED $stereo_recording $stereo_recording_agent','start: $now_date|vicidial_id: $insert_close_id|user: $VDADuser|channel: $channel|','STEREO START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; @@ -3762,7 +3783,9 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override $affected_rowsB = $dbhA->do($stmtB); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rowsB; &mysql_error_logging; - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO AGENT-CONTROLLED RIR','$VARserver_ip','$now_date','$channel','$stereo_rec_filename','$insert_lead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO AGENT-CONTROLLED RIR $rl_exten','$VARserver_ip','$now_date','$channel','$stereo_rec_filename','$insert_lead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -3770,14 +3793,14 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override if ($stereo_recording =~ /CUSTOMER_ONLY/i) { $vmgr_callerid = substr($stereo_rec_filename, 0, 16) . 'M...'; - $stmtE="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VDADserver_ip','','MixMonitorMute','$vmgr_callerid','ActionID: $vmgr_callerid','Channel: $channel','Direction: write','State: 1','','','','','','');"; + $stmtE="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VARserver_ip','','MixMonitorMute','$vmgr_callerid','ActionID: $vmgr_callerid','Channel: $channel','Direction: write','State: 1','','','','','','');"; $mLIVEaffected_rows = $dbhA->do($stmtE); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$mLIVEaffected_rows; &mysql_error_logging; } if ($stereo_recording =~ /CUSTOMER_MUTE/i) { $vmgr_callerid = substr($stereo_rec_filename, 0, 16) . 'M...'; - $stmtE="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VDADserver_ip','','MixMonitorMute','$vmgr_callerid','ActionID: $vmgr_callerid','Channel: $channel','Direction: read','State: 1','','','','','','');"; + $stmtE="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VARserver_ip','','MixMonitorMute','$vmgr_callerid','ActionID: $vmgr_callerid','Channel: $channel','Direction: read','State: 1','','','','','','');"; $mLIVEaffected_rows = $dbhA->do($stmtE); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$mLIVEaffected_rows; &mysql_error_logging; } @@ -5017,7 +5040,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override } else { - if ($ast_ver_str{major} > 20) + if ( ($ast_ver_str{major} > 20) || ($SSrecording_dtmf_muting > 0) ) { # Deprecation of "Monitor" application after Asterisk 20 $retval = $AGI->exec("MixMonitor",",r($PATHmonitor/MIX/$campaign_rec_filename-in.wav)t($PATHmonitor/MIX/$campaign_rec_filename-out.wav)"); @@ -5053,7 +5076,9 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override $dbhP=$dbhA; $mysql_count='02214'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; } - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','MONO_LEGACY_REMOTE','$VARserver_ip','$now_date','$channel','$campaign_rec_filename','$insert_lead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','MONO_LEGACY_REMOTE','$VARserver_ip','$now_date','$channel','$campaign_rec_filename','$insert_lead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -5082,7 +5107,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override $PATHmonitorT = $PATHmonitorP; ### insert record into recording_log_parallel table ### - $stmtA = "INSERT INTO recording_log_parallel (channel,server_ip,extension,start_time,length_in_sec,filename,lead_id,user,vicidial_id,recording_status) values('$channel','$VDADserver_ip','','$now_date','0','PL$stereo_rec_filename','$insert_lead_id','$VDADuser','$insert_close_id','START');"; + $stmtA = "INSERT INTO recording_log_parallel (channel,server_ip,extension,start_time,length_in_sec,filename,lead_id,user,vicidial_id,recording_status) values('$channel','$VARserver_ip','','$now_date','0','PL$stereo_rec_filename','$insert_lead_id','$VDADuser','$insert_close_id','START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -5122,7 +5147,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override $temp_parallel_rec_co_filename =~ s/\"|\'//gi; } ### insert a record into the recording_log table - $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VDADserver_ip','SPCOR','$now_date','$now_date_epoch','$temp_parallel_rec_co_filename','$insert_lead_id','$VDADuser','$insert_close_id')"; + $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VARserver_ip','SPCOR','$now_date','$now_date_epoch','$temp_parallel_rec_co_filename','$insert_lead_id','$VDADuser','$insert_close_id')"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -5147,11 +5172,13 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override } ### insert record into recording_log_stereo table ### - $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VDADserver_ip','$now_date','0','$temp_parallel_rec_co_filename','$insert_lead_id','$channel_group STEREO_PARALLEL CUSTOMER-ONLY REMOTE $stereo_recording','start: $now_date|vicidial_id: $insert_close_id|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; + $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VARserver_ip','$now_date','0','$temp_parallel_rec_co_filename','$insert_lead_id','$channel_group STEREO_PARALLEL CUSTOMER-ONLY REMOTE $stereo_recording','start: $now_date|vicidial_id: $insert_close_id|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO_PARALLEL CUSTOMER-ONLY REMOTE','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_co_filename','$insert_lead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO_PARALLEL CUSTOMER-ONLY REMOTE','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_co_filename','$insert_lead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -5177,7 +5204,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override $temp_parallel_rec_cm_filename =~ s/\"|\'//gi; } ### insert a record into the recording_log table - $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VDADserver_ip','SPCMR','$now_date','$now_date_epoch','$temp_parallel_rec_cm_filename','$insert_lead_id','$VDADuser','$insert_close_id')"; + $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VARserver_ip','SPCMR','$now_date','$now_date_epoch','$temp_parallel_rec_cm_filename','$insert_lead_id','$VDADuser','$insert_close_id')"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -5202,11 +5229,13 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override } ### insert record into recording_log_stereo table ### - $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VDADserver_ip','$now_date','0','$temp_parallel_rec_cm_filename','$insert_lead_id','$channel_group STEREO_PARALLEL CUSTOMER-MUTED REMOTE $stereo_recording','start: $now_date|vicidial_id: $insert_close_id|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; + $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VARserver_ip','$now_date','0','$temp_parallel_rec_cm_filename','$insert_lead_id','$channel_group STEREO_PARALLEL CUSTOMER-MUTED REMOTE $stereo_recording','start: $now_date|vicidial_id: $insert_close_id|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO_PARALLEL CUSTOMER-MUTED REMOTE','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_cm_filename','$insert_lead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO_PARALLEL CUSTOMER-MUTED REMOTE','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_cm_filename','$insert_lead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -5232,7 +5261,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override $temp_parallel_rec_fr_filename =~ s/\"|\'//gi; } ### insert a record into the recording_log table - $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VDADserver_ip','SPFRR','$now_date','$now_date_epoch','$temp_parallel_rec_fr_filename','$insert_lead_id','$VDADuser','$insert_close_id')"; + $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VARserver_ip','SPFRR','$now_date','$now_date_epoch','$temp_parallel_rec_fr_filename','$insert_lead_id','$VDADuser','$insert_close_id')"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -5257,11 +5286,13 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override } ### insert record into recording_log_stereo table ### - $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VDADserver_ip','$now_date','0','$temp_parallel_rec_fr_filename','$insert_lead_id','$channel_group STEREO_PARALLEL FULL-RECORDING REMOTE $stereo_recording','start: $now_date|vicidial_id: $insert_close_id|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; + $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VARserver_ip','$now_date','0','$temp_parallel_rec_fr_filename','$insert_lead_id','$channel_group STEREO_PARALLEL FULL-RECORDING REMOTE $stereo_recording','start: $now_date|vicidial_id: $insert_close_id|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO_PARALLEL FULL-RECORDING REMOTE','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_fr_filename','$insert_lead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO_PARALLEL FULL-RECORDING REMOTE','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_fr_filename','$insert_lead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -5273,7 +5304,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override { $temp_parallel_rec_ag_filename = $stereo_rec_filename; ### insert a record into the recording_log table - $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VDADserver_ip','SPACR','$now_date','$now_date_epoch','$temp_parallel_rec_ag_filename','$insert_lead_id','$VDADuser','$insert_close_id')"; + $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VARserver_ip','SPACR','$now_date','$now_date_epoch','$temp_parallel_rec_ag_filename','$insert_lead_id','$VDADuser','$insert_close_id')"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -5298,11 +5329,13 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override } ### insert record into recording_log_stereo table ### - $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VDADserver_ip','$now_date','0','$temp_parallel_rec_ag_filename','$insert_lead_id','$channel_group STEREO_PARALLEL AGENT-CONTROLLED REMOTE $stereo_recording $stereo_recording_agent','start: $now_date|vicidial_id: $insert_close_id|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; + $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VARserver_ip','$now_date','0','$temp_parallel_rec_ag_filename','$insert_lead_id','$channel_group STEREO_PARALLEL AGENT-CONTROLLED REMOTE $stereo_recording $stereo_recording_agent','start: $now_date|vicidial_id: $insert_close_id|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO_PARALLEL AGENT-CONTROLLED REMOTE','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_ag_filename','$insert_lead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO_PARALLEL AGENT-CONTROLLED REMOTE','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_ag_filename','$insert_lead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -5314,8 +5347,14 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override ## Start NON-parallel stereo call recording ## if ($stereo_recording_agent =~ /ALLCALLS|ALLFORCE/) { + $rl_exten='SACRBC'; + if ($stereo_recording =~ /CUSTOMER_ONLY/i) + {$rl_exten='SACRCO';} + if ($stereo_recording =~ /CUSTOMER_MUTE/i) + {$rl_exten='SACRCM';} + # insert a record into the recording_log table - $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VDADserver_ip','SACR','$now_date','$now_date_epoch','$stereo_rec_filename','$insert_lead_id','$VDADuser','$insert_close_id')"; + $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VARserver_ip','$rl_exten','$now_date','$now_date_epoch','$stereo_rec_filename','$insert_lead_id','$VDADuser','$insert_close_id')"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -5343,11 +5382,13 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override $retval = $AGI->exec("MixMonitor",",r($PATHmonitorT/$stereo_rec_filename-out.wav)t($PATHmonitorT/$stereo_rec_filename-in.wav)"); ### insert record into recording_log_stereo table ### - $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,recording_status) values('$recording_id','$VDADserver_ip','$now_date','0','$stereo_rec_filename','$insert_lead_id','$channel_group STEREO AGENT-CONTROLLED REMOTE RIR $stereo_recording $stereo_recording_agent','start: $now_date|vicidial_id: $insert_close_id|user: $VDADuser|channel: $channel|','STEREO START');"; + $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,recording_status) values('$recording_id','$VARserver_ip','$now_date','0','$stereo_rec_filename','$insert_lead_id','$channel_group STEREO AGENT-CONTROLLED REMOTE RIR $stereo_recording $stereo_recording_agent','start: $now_date|vicidial_id: $insert_close_id|user: $VDADuser|channel: $channel|','STEREO START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO AGENT-CONTROLLED REMOTE','$VARserver_ip','$now_date','$channel','$stereo_rec_filename','$insert_lead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO AGENT-CONTROLLED REMOTE $rl_exten','$VARserver_ip','$now_date','$channel','$stereo_rec_filename','$insert_lead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -5355,14 +5396,14 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override if ($stereo_recording =~ /CUSTOMER_ONLY/i) { $vmgr_callerid = substr($stereo_rec_filename, 0, 16) . 'M...'; - $stmtE="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VDADserver_ip','','MixMonitorMute','$vmgr_callerid','ActionID: $vmgr_callerid','Channel: $channel','Direction: write','State: 1','','','','','','');"; + $stmtE="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VARserver_ip','','MixMonitorMute','$vmgr_callerid','ActionID: $vmgr_callerid','Channel: $channel','Direction: write','State: 1','','','','','','');"; $mLIVEaffected_rows = $dbhA->do($stmtE); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$mLIVEaffected_rows; &mysql_error_logging; } if ($stereo_recording =~ /CUSTOMER_MUTE/i) { $vmgr_callerid = substr($stereo_rec_filename, 0, 16) . 'M...'; - $stmtE="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VDADserver_ip','','MixMonitorMute','$vmgr_callerid','ActionID: $vmgr_callerid','Channel: $channel','Direction: read','State: 1','','','','','','');"; + $stmtE="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VARserver_ip','','MixMonitorMute','$vmgr_callerid','ActionID: $vmgr_callerid','Channel: $channel','Direction: read','State: 1','','','','','','');"; $mLIVEaffected_rows = $dbhA->do($stmtE); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$mLIVEaffected_rows; &mysql_error_logging; } diff --git a/agc_2-X/trunk/agi/agi-VDAD_ALL_outbound.agi b/agc_2-X/trunk/agi/agi-VDAD_ALL_outbound.agi index ec87a376..fa66bb11 100644 --- a/agc_2-X/trunk/agi/agi-VDAD_ALL_outbound.agi +++ b/agc_2-X/trunk/agi/agi-VDAD_ALL_outbound.agi @@ -135,6 +135,7 @@ # 250827-1556 - Added stereo_recording code # 250924-2150 - Added code for deprecation of "Monitor" application after Asterisk 20 # 251001-1837 - Fix for rare Stereo recording filename issue +# 251020-0835 - Added code for recording_dtmf_muting, fix for stereo call recording # $script = 'agi-VDAD_ALL_outbound.agi'; @@ -292,7 +293,7 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA ############################################# ##### Gather system_settings ##### -$stmtA = "SELECT sip_event_logging,call_quota_lead_ranking,agent_search_method,abandon_check_queue,stereo_recording,stereo_parallel_recording FROM system_settings;"; +$stmtA = "SELECT sip_event_logging,call_quota_lead_ranking,agent_search_method,abandon_check_queue,stereo_recording,stereo_parallel_recording,recording_dtmf_detection,recording_dtmf_muting FROM system_settings;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -305,6 +306,8 @@ if ($sthArows > 0) $SSabandon_check_queue = $aryA[3]; $SSstereo_recording = $aryA[4]; $SSstereo_parallel_recording = $aryA[5]; + $SSrecording_dtmf_detection = $aryA[6]; + $SSrecording_dtmf_muting = $aryA[7]; } $sthA->finish(); ########################################### @@ -838,7 +841,7 @@ if ($VDACaffected_rows > 0) ##### END - Max call stats ### Grab campaign values from the database - $stmtA = "SELECT drop_call_seconds,drop_action,safe_harbor_exten,concurrent_transfers,next_agent_call,voicemail_ext,drop_inbound_group,use_internal_dnc,use_campaign_dnc,cpd_amd_action,am_message_exten,three_way_call_cid,campaign_cid,survey_first_audio_file,survey_opt_in_audio_file,survey_ni_audio_file,survey_third_audio_file,survey_fourth_audio_file,extension_appended_cidname,queue_priority,closer_campaigns,queuemetrics_phone_environment,campaign_recording,campaign_rec_filename,safe_harbor_audio,safe_harbor_menu_id,survey_recording,safe_harbor_audio_field,use_other_campaign_dnc,cpd_unknown_action,routing_initiated_recordings,campaign_rec_exten,call_quota_lead_ranking,sip_event_logging,amd_type,agent_search_method,dial_method,stereo_recording,khomp_settings_container,stereo_recording_agent,stereo_rec_filename,stereo_parallel_recording,parallel_rec_co_filename,parallel_rec_cm_filename,parallel_rec_fr_filename FROM vicidial_campaigns where campaign_id = '$VDADcampaign';"; + $stmtA = "SELECT drop_call_seconds,drop_action,safe_harbor_exten,concurrent_transfers,next_agent_call,voicemail_ext,drop_inbound_group,use_internal_dnc,use_campaign_dnc,cpd_amd_action,am_message_exten,three_way_call_cid,campaign_cid,survey_first_audio_file,survey_opt_in_audio_file,survey_ni_audio_file,survey_third_audio_file,survey_fourth_audio_file,extension_appended_cidname,queue_priority,closer_campaigns,queuemetrics_phone_environment,campaign_recording,campaign_rec_filename,safe_harbor_audio,safe_harbor_menu_id,survey_recording,safe_harbor_audio_field,use_other_campaign_dnc,cpd_unknown_action,routing_initiated_recordings,campaign_rec_exten,call_quota_lead_ranking,sip_event_logging,amd_type,agent_search_method,dial_method,stereo_recording,khomp_settings_container,stereo_recording_agent,stereo_rec_filename,stereo_parallel_recording,parallel_rec_co_filename,parallel_rec_cm_filename,parallel_rec_fr_filename,recording_dtmf_muting FROM vicidial_campaigns where campaign_id = '$VDADcampaign';"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -894,6 +897,9 @@ if ($VDACaffected_rows > 0) $parallel_rec_co_filename = $aryA[42]; $parallel_rec_cm_filename = $aryA[43]; $parallel_rec_fr_filename = $aryA[44]; + $recording_dtmf_muting = $aryA[45]; + if ( ($SSrecording_dtmf_detection < 1) || ($SSrecording_dtmf_muting < 1) ) + {$recording_dtmf_muting=0;} if (length($closer_campaigns) > 2) { @@ -1200,7 +1206,7 @@ if ($VDACaffected_rows > 0) } else { - if ($ast_ver_str{major} > 20) + if ( ($ast_ver_str{major} > 20) || ($SSrecording_dtmf_muting > 0) ) { # Deprecation of "Monitor" application after Asterisk 20 $AGI->exec("MixMonitor",",r($PATHmonitor/MIX/$campaign_rec_filename-in.wav)t($PATHmonitor/MIX/$campaign_rec_filename-out.wav)"); @@ -1236,7 +1242,9 @@ if ($VDACaffected_rows > 0) $dbhP=$dbhA; $mysql_count='02214'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; } - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','MONO_LEGACY_SURVEY','$VARserver_ip','$now_date','$channel','$campaign_rec_filename','$CIDlead_id','VDAD','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','MONO_LEGACY_SURVEY','$VARserver_ip','$now_date','$channel','$campaign_rec_filename','$CIDlead_id','VDAD','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -3210,7 +3218,7 @@ while ($drop_timer <= $DROP_TIME) } else { - if ($ast_ver_str{major} > 20) + if ( ($ast_ver_str{major} > 20) || ($SSrecording_dtmf_muting > 0) ) { # Deprecation of "Monitor" application after Asterisk 20 $retval = $AGI->exec("MixMonitor",",r($PATHmonitor/MIX/$campaign_rec_filename-in.wav)t($PATHmonitor/MIX/$campaign_rec_filename-out.wav)"); @@ -3248,7 +3256,9 @@ while ($drop_timer <= $DROP_TIME) $dbhP=$dbhA; $mysql_count='02214'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; } - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','MONO_LEGACY_REMOTE','$VARserver_ip','$now_date','$channel','$campaign_rec_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','MONO_LEGACY_REMOTE','$VARserver_ip','$now_date','$channel','$campaign_rec_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -3278,7 +3288,7 @@ while ($drop_timer <= $DROP_TIME) $PATHmonitorT = $PATHmonitorP; ### insert record into recording_log_parallel table ### - $stmtA = "INSERT INTO recording_log_parallel (channel,server_ip,extension,start_time,length_in_sec,filename,lead_id,user,vicidial_id,recording_status) values('$channel','$VDADserver_ip','','$now_date','0','PL$stereo_rec_filename','$CIDlead_id','$VDADuser','$uniqueid','START');"; + $stmtA = "INSERT INTO recording_log_parallel (channel,server_ip,extension,start_time,length_in_sec,filename,lead_id,user,vicidial_id,recording_status) values('$channel','$VARserver_ip','','$now_date','0','PL$stereo_rec_filename','$CIDlead_id','$VDADuser','$uniqueid','START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -3318,7 +3328,7 @@ while ($drop_timer <= $DROP_TIME) $temp_parallel_rec_co_filename =~ s/\"|\'//gi; } ### insert a record into the recording_log table - $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VDADserver_ip','SPCOR','$now_date','$now_date_epoch','$temp_parallel_rec_co_filename','$CIDlead_id','$VDADuser','$uniqueid')"; + $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VARserver_ip','SPCOR','$now_date','$now_date_epoch','$temp_parallel_rec_co_filename','$CIDlead_id','$VDADuser','$uniqueid')"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -3343,11 +3353,13 @@ while ($drop_timer <= $DROP_TIME) } ### insert record into recording_log_stereo table ### - $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VDADserver_ip','$now_date','0','$temp_parallel_rec_co_filename','$CIDlead_id','$VDADcampaign STEREO_PARALLEL CUSTOMER-ONLY REMOTE $stereo_recording','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; + $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VARserver_ip','$now_date','0','$temp_parallel_rec_co_filename','$CIDlead_id','$VDADcampaign STEREO_PARALLEL CUSTOMER-ONLY REMOTE $stereo_recording','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO_PARALLEL CUSTOMER-ONLY REMOTE','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_co_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO_PARALLEL CUSTOMER-ONLY REMOTE','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_co_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -3373,7 +3385,7 @@ while ($drop_timer <= $DROP_TIME) $temp_parallel_rec_cm_filename =~ s/\"|\'//gi; } ### insert a record into the recording_log table - $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VDADserver_ip','SPCMR','$now_date','$now_date_epoch','$temp_parallel_rec_cm_filename','$CIDlead_id','$VDADuser','$uniqueid')"; + $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VARserver_ip','SPCMR','$now_date','$now_date_epoch','$temp_parallel_rec_cm_filename','$CIDlead_id','$VDADuser','$uniqueid')"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -3398,11 +3410,13 @@ while ($drop_timer <= $DROP_TIME) } ### insert record into recording_log_stereo table ### - $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VDADserver_ip','$now_date','0','$temp_parallel_rec_cm_filename','$CIDlead_id','$VDADcampaign STEREO_PARALLEL CUSTOMER-MUTED REMOTE $stereo_recording','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; + $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VARserver_ip','$now_date','0','$temp_parallel_rec_cm_filename','$CIDlead_id','$VDADcampaign STEREO_PARALLEL CUSTOMER-MUTED REMOTE $stereo_recording','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO_PARALLEL CUSTOMER-MUTED REMOTE','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_cm_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO_PARALLEL CUSTOMER-MUTED REMOTE','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_cm_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -3428,7 +3442,7 @@ while ($drop_timer <= $DROP_TIME) $temp_parallel_rec_fr_filename =~ s/\"|\'//gi; } ### insert a record into the recording_log table - $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VDADserver_ip','SPFRR','$now_date','$now_date_epoch','$temp_parallel_rec_fr_filename','$CIDlead_id','$VDADuser','$uniqueid')"; + $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VARserver_ip','SPFRR','$now_date','$now_date_epoch','$temp_parallel_rec_fr_filename','$CIDlead_id','$VDADuser','$uniqueid')"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -3453,11 +3467,13 @@ while ($drop_timer <= $DROP_TIME) } ### insert record into recording_log_stereo table ### - $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VDADserver_ip','$now_date','0','$temp_parallel_rec_fr_filename','$CIDlead_id','$VDADcampaign STEREO_PARALLEL FULL-RECORDING REMOTE $stereo_recording','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; + $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VARserver_ip','$now_date','0','$temp_parallel_rec_fr_filename','$CIDlead_id','$VDADcampaign STEREO_PARALLEL FULL-RECORDING REMOTE $stereo_recording','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO_PARALLEL FULL-RECORDING REMOTE','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_fr_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO_PARALLEL FULL-RECORDING REMOTE','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_fr_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -3469,7 +3485,7 @@ while ($drop_timer <= $DROP_TIME) { $temp_parallel_rec_ag_filename = $stereo_rec_filename; ### insert a record into the recording_log table - $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VDADserver_ip','SPACR','$now_date','$now_date_epoch','$temp_parallel_rec_ag_filename','$CIDlead_id','$VDADuser','$uniqueid')"; + $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VARserver_ip','SPACR','$now_date','$now_date_epoch','$temp_parallel_rec_ag_filename','$CIDlead_id','$VDADuser','$uniqueid')"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -3494,11 +3510,13 @@ while ($drop_timer <= $DROP_TIME) } ### insert record into recording_log_stereo table ### - $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VDADserver_ip','$now_date','0','$temp_parallel_rec_ag_filename','$CIDlead_id','$VDADcampaign STEREO_PARALLEL AGENT-CONTROLLED REMOTE $stereo_recording $stereo_recording_agent','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; + $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VARserver_ip','$now_date','0','$temp_parallel_rec_ag_filename','$CIDlead_id','$VDADcampaign STEREO_PARALLEL AGENT-CONTROLLED REMOTE $stereo_recording $stereo_recording_agent','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO_PARALLEL AGENT-CONTROLLED REMOTE','$VARserver_ip','$now_date','$channel','$stereo_recording_agent','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO_PARALLEL AGENT-CONTROLLED REMOTE','$VARserver_ip','$now_date','$channel','$stereo_recording_agent','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -3510,8 +3528,14 @@ while ($drop_timer <= $DROP_TIME) ## Start NON-parallel stereo call recording ## if ($stereo_recording_agent =~ /ALLCALLS|ALLFORCE/) { + $rl_exten='SACRBC'; + if ($stereo_recording =~ /CUSTOMER_ONLY/i) + {$rl_exten='SACRCO';} + if ($stereo_recording =~ /CUSTOMER_MUTE/i) + {$rl_exten='SACRCM';} + # insert a record into the recording_log table - $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VDADserver_ip','SACR','$now_date','$now_date_epoch','$stereo_rec_filename','$CIDlead_id','$VDADuser','$uniqueid')"; + $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VARserver_ip','$rl_exten','$now_date','$now_date_epoch','$stereo_rec_filename','$CIDlead_id','$VDADuser','$uniqueid')"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -3539,11 +3563,13 @@ while ($drop_timer <= $DROP_TIME) $retval = $AGI->exec("MixMonitor",",r($PATHmonitorT/$stereo_rec_filename-out.wav)t($PATHmonitorT/$stereo_rec_filename-in.wav)"); ### insert record into recording_log_stereo table ### - $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,recording_status) values('$recording_id','$VDADserver_ip','$now_date','0','$stereo_rec_filename','$CIDlead_id','$VDADcampaign STEREO AGENT-CONTROLLED REMOTE $stereo_recording $stereo_recording_agent','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','STEREO START');"; + $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,recording_status) values('$recording_id','$VARserver_ip','$now_date','0','$stereo_rec_filename','$CIDlead_id','$VDADcampaign STEREO AGENT-CONTROLLED REMOTE $stereo_recording $stereo_recording_agent','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','STEREO START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO AGENT-CONTROLLED REMOTE','$VARserver_ip','$now_date','$channel','$stereo_rec_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO AGENT-CONTROLLED REMOTE $rl_exten','$VARserver_ip','$now_date','$channel','$stereo_rec_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -3551,14 +3577,14 @@ while ($drop_timer <= $DROP_TIME) if ($stereo_recording =~ /CUSTOMER_ONLY/i) { $vmgr_callerid = substr($stereo_rec_filename, 0, 16) . 'M...'; - $stmtE="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VDADserver_ip','','MixMonitorMute','$vmgr_callerid','ActionID: $vmgr_callerid','Channel: $channel','Direction: write','State: 1','','','','','','');"; + $stmtE="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VARserver_ip','','MixMonitorMute','$vmgr_callerid','ActionID: $vmgr_callerid','Channel: $channel','Direction: write','State: 1','','','','','','');"; $mLIVEaffected_rows = $dbhA->do($stmtE); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$mLIVEaffected_rows; &mysql_error_logging; } if ($stereo_recording =~ /CUSTOMER_MUTE/i) { $vmgr_callerid = substr($stereo_rec_filename, 0, 16) . 'M...'; - $stmtE="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VDADserver_ip','','MixMonitorMute','$vmgr_callerid','ActionID: $vmgr_callerid','Channel: $channel','Direction: read','State: 1','','','','','','');"; + $stmtE="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VARserver_ip','','MixMonitorMute','$vmgr_callerid','ActionID: $vmgr_callerid','Channel: $channel','Direction: read','State: 1','','','','','','');"; $mLIVEaffected_rows = $dbhA->do($stmtE); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$mLIVEaffected_rows; &mysql_error_logging; } @@ -3664,7 +3690,9 @@ while ($drop_timer <= $DROP_TIME) $affected_rowsC = $dbhA->do($stmtC); $dbhP=$dbhA; $mysql_count='02128'; $MEL_aff_rows=$affected_rowsC; &mysql_error_logging; - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','MONO_LEGACY_RIR','$VARserver_ip','$now_date','$channel','$campaign_rec_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','MONO_LEGACY_RIR','$VDADserver_ip','$now_date','$channelrec','$campaign_rec_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -3696,7 +3724,7 @@ while ($drop_timer <= $DROP_TIME) $PATHmonitorT = $PATHmonitorP; ### insert record into recording_log_parallel table ### - $stmtA = "INSERT INTO recording_log_parallel (channel,server_ip,extension,start_time,length_in_sec,filename,lead_id,user,vicidial_id,recording_status) values('$channel','$VDADserver_ip','','$now_date','0','PL$stereo_rec_filename','$CIDlead_id','$VDADuser','$uniqueid','START');"; + $stmtA = "INSERT INTO recording_log_parallel (channel,server_ip,extension,start_time,length_in_sec,filename,lead_id,user,vicidial_id,recording_status) values('$channel','$VARserver_ip','','$now_date','0','PL$stereo_rec_filename','$CIDlead_id','$VDADuser','$uniqueid','START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -3736,7 +3764,7 @@ while ($drop_timer <= $DROP_TIME) $temp_parallel_rec_co_filename =~ s/\"|\'//gi; } ### insert a record into the recording_log table - $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VDADserver_ip','SPCO','$now_date','$now_date_epoch','$temp_parallel_rec_co_filename','$CIDlead_id','$VDADuser','$uniqueid')"; + $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VARserver_ip','SPCO','$now_date','$now_date_epoch','$temp_parallel_rec_co_filename','$CIDlead_id','$VDADuser','$uniqueid')"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -3761,11 +3789,13 @@ while ($drop_timer <= $DROP_TIME) } ### insert record into recording_log_stereo table ### - $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VDADserver_ip','$now_date','0','$temp_parallel_rec_co_filename','$CIDlead_id','$VDADcampaign STEREO_PARALLEL CUSTOMER-ONLY $stereo_recording','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; + $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VARserver_ip','$now_date','0','$temp_parallel_rec_co_filename','$CIDlead_id','$VDADcampaign STEREO_PARALLEL CUSTOMER-ONLY $stereo_recording','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO_PARALLEL CUSTOMER-ONLY','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_co_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO_PARALLEL CUSTOMER-ONLY','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_co_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -3791,7 +3821,7 @@ while ($drop_timer <= $DROP_TIME) $temp_parallel_rec_cm_filename =~ s/\"|\'//gi; } ### insert a record into the recording_log table - $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VDADserver_ip','SPCM','$now_date','$now_date_epoch','$temp_parallel_rec_cm_filename','$CIDlead_id','$VDADuser','$uniqueid')"; + $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VARserver_ip','SPCM','$now_date','$now_date_epoch','$temp_parallel_rec_cm_filename','$CIDlead_id','$VDADuser','$uniqueid')"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -3816,11 +3846,13 @@ while ($drop_timer <= $DROP_TIME) } ### insert record into recording_log_stereo table ### - $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VDADserver_ip','$now_date','0','$temp_parallel_rec_cm_filename','$CIDlead_id','$VDADcampaign STEREO_PARALLEL CUSTOMER-MUTED $stereo_recording','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; + $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VARserver_ip','$now_date','0','$temp_parallel_rec_cm_filename','$CIDlead_id','$VDADcampaign STEREO_PARALLEL CUSTOMER-MUTED $stereo_recording','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO_PARALLEL CUSTOMER-MUTED','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_cm_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO_PARALLEL CUSTOMER-MUTED','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_cm_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -3846,7 +3878,7 @@ while ($drop_timer <= $DROP_TIME) $temp_parallel_rec_fr_filename =~ s/\"|\'//gi; } ### insert a record into the recording_log table - $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VDADserver_ip','SPFR','$now_date','$now_date_epoch','$temp_parallel_rec_fr_filename','$CIDlead_id','$VDADuser','$uniqueid')"; + $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VARserver_ip','SPFR','$now_date','$now_date_epoch','$temp_parallel_rec_fr_filename','$CIDlead_id','$VDADuser','$uniqueid')"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -3871,11 +3903,13 @@ while ($drop_timer <= $DROP_TIME) } ### insert record into recording_log_stereo table ### - $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VDADserver_ip','$now_date','0','$temp_parallel_rec_fr_filename','$CIDlead_id','$VDADcampaign STEREO_PARALLEL FULL-RECORDING $stereo_recording','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; + $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VARserver_ip','$now_date','0','$temp_parallel_rec_fr_filename','$CIDlead_id','$VDADcampaign STEREO_PARALLEL FULL-RECORDING $stereo_recording','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO_PARALLEL FULL-RECORDING','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_fr_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO_PARALLEL FULL-RECORDING','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_fr_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -3887,7 +3921,7 @@ while ($drop_timer <= $DROP_TIME) { $temp_parallel_rec_ag_filename = $stereo_rec_filename; ### insert a record into the recording_log table - $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VDADserver_ip','SPACI','$now_date','$now_date_epoch','$temp_parallel_rec_ag_filename','$CIDlead_id','$VDADuser','$uniqueid')"; + $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VARserver_ip','SPACI','$now_date','$now_date_epoch','$temp_parallel_rec_ag_filename','$CIDlead_id','$VDADuser','$uniqueid')"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -3912,7 +3946,7 @@ while ($drop_timer <= $DROP_TIME) } ### insert record into recording_log_stereo table ### - $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VDADserver_ip','$now_date','0','$temp_parallel_rec_ag_filename','$CIDlead_id','$VDADcampaign STEREO_PARALLEL AGENT-CONTROLLED RIR $stereo_recording $stereo_recording_agent','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; + $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VARserver_ip','$now_date','0','$temp_parallel_rec_ag_filename','$CIDlead_id','$VDADcampaign STEREO_PARALLEL AGENT-CONTROLLED RIR $stereo_recording $stereo_recording_agent','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; @@ -3920,7 +3954,9 @@ while ($drop_timer <= $DROP_TIME) $affected_rowsB = $dbhA->do($stmtB); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rowsB; &mysql_error_logging; - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO_PARALLEL AGENT-CONTROLLED RIR','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_ag_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO_PARALLEL AGENT-CONTROLLED RIR','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_ag_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -3932,8 +3968,14 @@ while ($drop_timer <= $DROP_TIME) ## Start NON-parallel stereo call recording ## if ($stereo_recording_agent =~ /ALLCALLS|ALLFORCE/) { + $rl_exten='SACIBC'; + if ($stereo_recording =~ /CUSTOMER_ONLY/i) + {$rl_exten='SACICO';} + if ($stereo_recording =~ /CUSTOMER_MUTE/i) + {$rl_exten='SACICM';} + # insert a record into the recording_log table - $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VDADserver_ip','SACI','$now_date','$now_date_epoch','$stereo_rec_filename','$CIDlead_id','$VDADuser','$uniqueid')"; + $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VARserver_ip','$rl_exten','$now_date','$now_date_epoch','$stereo_rec_filename','$CIDlead_id','$VDADuser','$uniqueid')"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -3961,7 +4003,7 @@ while ($drop_timer <= $DROP_TIME) $retval = $AGI->exec("MixMonitor",",r($PATHmonitorT/$stereo_rec_filename-out.wav)t($PATHmonitorT/$stereo_rec_filename-in.wav)"); ### insert record into recording_log_stereo table ### - $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,recording_status) values('$recording_id','$VDADserver_ip','$now_date','0','$stereo_rec_filename','$CIDlead_id','$VDADcampaign STEREO AGENT-CONTROLLED RIR $stereo_recording $stereo_recording_agent','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','STEREO START');"; + $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,recording_status) values('$recording_id','$VARserver_ip','$now_date','0','$stereo_rec_filename','$CIDlead_id','$VDADcampaign STEREO AGENT-CONTROLLED RIR $stereo_recording $stereo_recording_agent','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','STEREO START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; @@ -3969,7 +4011,9 @@ while ($drop_timer <= $DROP_TIME) $affected_rowsB = $dbhA->do($stmtB); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rowsB; &mysql_error_logging; - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO AGENT-CONTROLLED RIR','$VARserver_ip','$now_date','$channel','$stereo_rec_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO AGENT-CONTROLLED RIR $rl_exten','$VARserver_ip','$now_date','$channel','$stereo_rec_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -3977,14 +4021,14 @@ while ($drop_timer <= $DROP_TIME) if ($stereo_recording =~ /CUSTOMER_ONLY/i) { $vmgr_callerid = substr($stereo_rec_filename, 0, 16) . 'M...'; - $stmtE="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VDADserver_ip','','MixMonitorMute','$vmgr_callerid','ActionID: $vmgr_callerid','Channel: $channel','Direction: write','State: 1','','','','','','');"; + $stmtE="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VARserver_ip','','MixMonitorMute','$vmgr_callerid','ActionID: $vmgr_callerid','Channel: $channel','Direction: write','State: 1','','','','','','');"; $mLIVEaffected_rows = $dbhA->do($stmtE); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$mLIVEaffected_rows; &mysql_error_logging; } if ($stereo_recording =~ /CUSTOMER_MUTE/i) { $vmgr_callerid = substr($stereo_rec_filename, 0, 16) . 'M...'; - $stmtE="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VDADserver_ip','','MixMonitorMute','$vmgr_callerid','ActionID: $vmgr_callerid','Channel: $channel','Direction: read','State: 1','','','','','','');"; + $stmtE="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VARserver_ip','','MixMonitorMute','$vmgr_callerid','ActionID: $vmgr_callerid','Channel: $channel','Direction: read','State: 1','','','','','','');"; $mLIVEaffected_rows = $dbhA->do($stmtE); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$mLIVEaffected_rows; &mysql_error_logging; } @@ -4606,7 +4650,7 @@ while ($drop_timer <= $DROP_TIME) } else { - if ($ast_ver_str{major} > 20) + if ( ($ast_ver_str{major} > 20) || ($SSrecording_dtmf_muting > 0) ) { # Deprecation of "Monitor" application after Asterisk 20 $retval = $AGI->exec("MixMonitor",",r($PATHmonitor/MIX/$campaign_rec_filename-in.wav)t($PATHmonitor/MIX/$campaign_rec_filename-out.wav)"); @@ -4644,7 +4688,9 @@ while ($drop_timer <= $DROP_TIME) $dbhP=$dbhA; $mysql_count='02214'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; } - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','MONO_LEGACY_REMOTE','$VARserver_ip','$now_date','$channel','$campaign_rec_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','MONO_LEGACY_REMOTE','$VARserver_ip','$now_date','$channel','$campaign_rec_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -4673,7 +4719,7 @@ while ($drop_timer <= $DROP_TIME) $PATHmonitorT = $PATHmonitorP; ### insert record into recording_log_parallel table ### - $stmtA = "INSERT INTO recording_log_parallel (channel,server_ip,extension,start_time,length_in_sec,filename,lead_id,user,vicidial_id,recording_status) values('$channel','$VDADserver_ip','','$now_date','0','PL$stereo_rec_filename','$CIDlead_id','$VDADuser','$uniqueid','START');"; + $stmtA = "INSERT INTO recording_log_parallel (channel,server_ip,extension,start_time,length_in_sec,filename,lead_id,user,vicidial_id,recording_status) values('$channel','$VARserver_ip','','$now_date','0','PL$stereo_rec_filename','$CIDlead_id','$VDADuser','$uniqueid','START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -4713,7 +4759,7 @@ while ($drop_timer <= $DROP_TIME) $temp_parallel_rec_co_filename =~ s/\"|\'//gi; } ### insert a record into the recording_log table - $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VDADserver_ip','SPCOR','$now_date','$now_date_epoch','$temp_parallel_rec_co_filename','$CIDlead_id','$VDADuser','$uniqueid')"; + $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VARserver_ip','SPCOR','$now_date','$now_date_epoch','$temp_parallel_rec_co_filename','$CIDlead_id','$VDADuser','$uniqueid')"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -4738,11 +4784,13 @@ while ($drop_timer <= $DROP_TIME) } ### insert record into recording_log_stereo table ### - $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VDADserver_ip','$now_date','0','$temp_parallel_rec_co_filename','$CIDlead_id','$VDADcampaign STEREO_PARALLEL CUSTOMER-ONLY REMOTE $stereo_recording','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; + $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VARserver_ip','$now_date','0','$temp_parallel_rec_co_filename','$CIDlead_id','$VDADcampaign STEREO_PARALLEL CUSTOMER-ONLY REMOTE $stereo_recording','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO_PARALLEL CUSTOMER-ONLY REMOTE','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_co_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO_PARALLEL CUSTOMER-ONLY REMOTE','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_co_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -4768,7 +4816,7 @@ while ($drop_timer <= $DROP_TIME) $temp_parallel_rec_cm_filename =~ s/\"|\'//gi; } ### insert a record into the recording_log table - $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VDADserver_ip','SPCMR','$now_date','$now_date_epoch','$temp_parallel_rec_cm_filename','$CIDlead_id','$VDADuser','$uniqueid')"; + $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VARserver_ip','SPCMR','$now_date','$now_date_epoch','$temp_parallel_rec_cm_filename','$CIDlead_id','$VDADuser','$uniqueid')"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -4793,11 +4841,13 @@ while ($drop_timer <= $DROP_TIME) } ### insert record into recording_log_stereo table ### - $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VDADserver_ip','$now_date','0','$temp_parallel_rec_cm_filename','$CIDlead_id','$VDADcampaign STEREO_PARALLEL CUSTOMER-MUTED REMOTE $stereo_recording','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; + $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VARserver_ip','$now_date','0','$temp_parallel_rec_cm_filename','$CIDlead_id','$VDADcampaign STEREO_PARALLEL CUSTOMER-MUTED REMOTE $stereo_recording','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO_PARALLEL CUSTOMER-MUTED REMOTE','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_cm_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO_PARALLEL CUSTOMER-MUTED REMOTE','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_cm_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -4823,7 +4873,7 @@ while ($drop_timer <= $DROP_TIME) $temp_parallel_rec_fr_filename =~ s/\"|\'//gi; } ### insert a record into the recording_log table - $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VDADserver_ip','SPRFR','$now_date','$now_date_epoch','$temp_parallel_rec_fr_filename','$CIDlead_id','$VDADuser','$uniqueid')"; + $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VARserver_ip','SPRFR','$now_date','$now_date_epoch','$temp_parallel_rec_fr_filename','$CIDlead_id','$VDADuser','$uniqueid')"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -4848,11 +4898,13 @@ while ($drop_timer <= $DROP_TIME) } ### insert record into recording_log_stereo table ### - $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VDADserver_ip','$now_date','0','$temp_parallel_rec_fr_filename','$CIDlead_id','$VDADcampaign STEREO_PARALLEL FULL-RECORDING REMOTE $stereo_recording','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; + $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VARserver_ip','$now_date','0','$temp_parallel_rec_fr_filename','$CIDlead_id','$VDADcampaign STEREO_PARALLEL FULL-RECORDING REMOTE $stereo_recording','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO_PARALLEL FULL-RECORDING REMOTE','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_fr_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO_PARALLEL FULL-RECORDING REMOTE','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_fr_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -4864,7 +4916,7 @@ while ($drop_timer <= $DROP_TIME) { $temp_parallel_rec_ag_filename = $stereo_rec_filename; ### insert a record into the recording_log table - $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VDADserver_ip','SPACR','$now_date','$now_date_epoch','$temp_parallel_rec_ag_filename','$CIDlead_id','$VDADuser','$uniqueid')"; + $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VARserver_ip','SPACR','$now_date','$now_date_epoch','$temp_parallel_rec_ag_filename','$CIDlead_id','$VDADuser','$uniqueid')"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -4889,11 +4941,13 @@ while ($drop_timer <= $DROP_TIME) } ### insert record into recording_log_stereo table ### - $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VDADserver_ip','$now_date','0','$temp_parallel_rec_ag_filename','$CIDlead_id','$VDADcampaign STEREO_PARALLEL AGENT-CONTROLLED REMOTE $stereo_recording $stereo_recording_agent','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; + $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VARserver_ip','$now_date','0','$temp_parallel_rec_ag_filename','$CIDlead_id','$VDADcampaign STEREO_PARALLEL AGENT-CONTROLLED REMOTE $stereo_recording $stereo_recording_agent','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO_PARALLEL AGENT-CONTROLLED REMOTE','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_ag_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO_PARALLEL AGENT-CONTROLLED REMOTE','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_ag_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -4905,8 +4959,14 @@ while ($drop_timer <= $DROP_TIME) ## Start NON-parallel stereo call recording ## if ($stereo_recording_agent =~ /ALLCALLS|ALLFORCE/) { + $rl_exten='SACRBC'; + if ($stereo_recording =~ /CUSTOMER_ONLY/i) + {$rl_exten='SACRCO';} + if ($stereo_recording =~ /CUSTOMER_MUTE/i) + {$rl_exten='SACRCM';} + # insert a record into the recording_log table - $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VDADserver_ip','SACR','$now_date','$now_date_epoch','$stereo_rec_filename','$CIDlead_id','$VDADuser','$uniqueid')"; + $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VARserver_ip','$rl_exten','$now_date','$now_date_epoch','$stereo_rec_filename','$CIDlead_id','$VDADuser','$uniqueid')"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -4934,11 +4994,13 @@ while ($drop_timer <= $DROP_TIME) $retval = $AGI->exec("MixMonitor",",r($PATHmonitorT/$stereo_rec_filename-out.wav)t($PATHmonitorT/$stereo_rec_filename-in.wav)"); ### insert record into recording_log_stereo table ### - $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,recording_status) values('$recording_id','$VDADserver_ip','$now_date','0','$stereo_rec_filename','$CIDlead_id','$VDADcampaign STEREO AGENT-CONTROLLED REMOTE $stereo_recording $stereo_recording_agent','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','STEREO START');"; + $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,recording_status) values('$recording_id','$VARserver_ip','$now_date','0','$stereo_rec_filename','$CIDlead_id','$VDADcampaign STEREO AGENT-CONTROLLED REMOTE $stereo_recording $stereo_recording_agent','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','STEREO START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO AGENT-CONTROLLED REMOTE','$VARserver_ip','$now_date','$channel','$stereo_rec_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO AGENT-CONTROLLED REMOTE $rl_exten','$VARserver_ip','$now_date','$channel','$stereo_rec_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -4946,14 +5008,14 @@ while ($drop_timer <= $DROP_TIME) if ($stereo_recording =~ /CUSTOMER_ONLY/i) { $vmgr_callerid = substr($stereo_rec_filename, 0, 16) . 'M...'; - $stmtE="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VDADserver_ip','','MixMonitorMute','$vmgr_callerid','ActionID: $vmgr_callerid','Channel: $channel','Direction: write','State: 1','','','','','','');"; + $stmtE="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VARserver_ip','','MixMonitorMute','$vmgr_callerid','ActionID: $vmgr_callerid','Channel: $channel','Direction: write','State: 1','','','','','','');"; $mLIVEaffected_rows = $dbhA->do($stmtE); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$mLIVEaffected_rows; &mysql_error_logging; } if ($stereo_recording =~ /CUSTOMER_MUTE/i) { $vmgr_callerid = substr($stereo_rec_filename, 0, 16) . 'M...'; - $stmtE="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VDADserver_ip','','MixMonitorMute','$vmgr_callerid','ActionID: $vmgr_callerid','Channel: $channel','Direction: read','State: 1','','','','','','');"; + $stmtE="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VARserver_ip','','MixMonitorMute','$vmgr_callerid','ActionID: $vmgr_callerid','Channel: $channel','Direction: read','State: 1','','','','','','');"; $mLIVEaffected_rows = $dbhA->do($stmtE); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$mLIVEaffected_rows; &mysql_error_logging; } @@ -5058,7 +5120,9 @@ while ($drop_timer <= $DROP_TIME) $affected_rowsC = $dbhA->do($stmtC); $dbhP=$dbhA; $mysql_count='02136'; $MEL_aff_rows=$affected_rowsC; &mysql_error_logging; - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','MONO_LEGACY_RIR','$VARserver_ip','$now_date','$channel','$campaign_rec_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','MONO_LEGACY_RIR','$VDADserver_ip','$now_date','$channelrec','$campaign_rec_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -5089,7 +5153,7 @@ while ($drop_timer <= $DROP_TIME) $PATHmonitorT = $PATHmonitorP; ### insert record into recording_log_parallel table ### - $stmtA = "INSERT INTO recording_log_parallel (channel,server_ip,extension,start_time,length_in_sec,filename,lead_id,user,vicidial_id,recording_status) values('$channel','$VDADserver_ip','','$now_date','0','PL$stereo_rec_filename','$CIDlead_id','$VDADuser','$uniqueid','START');"; + $stmtA = "INSERT INTO recording_log_parallel (channel,server_ip,extension,start_time,length_in_sec,filename,lead_id,user,vicidial_id,recording_status) values('$channel','$VARserver_ip','','$now_date','0','PL$stereo_rec_filename','$CIDlead_id','$VDADuser','$uniqueid','START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -5129,7 +5193,7 @@ while ($drop_timer <= $DROP_TIME) $temp_parallel_rec_co_filename =~ s/\"|\'//gi; } ### insert a record into the recording_log table - $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VDADserver_ip','SPCO','$now_date','$now_date_epoch','$temp_parallel_rec_co_filename','$CIDlead_id','$VDADuser','$uniqueid')"; + $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VARserver_ip','SPCO','$now_date','$now_date_epoch','$temp_parallel_rec_co_filename','$CIDlead_id','$VDADuser','$uniqueid')"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -5154,11 +5218,13 @@ while ($drop_timer <= $DROP_TIME) } ### insert record into recording_log_stereo table ### - $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VDADserver_ip','$now_date','0','$temp_parallel_rec_co_filename','$CIDlead_id','$VDADcampaign STEREO_PARALLEL CUSTOMER-ONLY $stereo_recording','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; + $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VARserver_ip','$now_date','0','$temp_parallel_rec_co_filename','$CIDlead_id','$VDADcampaign STEREO_PARALLEL CUSTOMER-ONLY $stereo_recording','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO_PARALLEL CUSTOMER-ONLY','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_co_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO_PARALLEL CUSTOMER-ONLY','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_co_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -5184,7 +5250,7 @@ while ($drop_timer <= $DROP_TIME) $temp_parallel_rec_cm_filename =~ s/\"|\'//gi; } ### insert a record into the recording_log table - $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VDADserver_ip','SPCM','$now_date','$now_date_epoch','$temp_parallel_rec_cm_filename','$CIDlead_id','$VDADuser','$uniqueid')"; + $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VARserver_ip','SPCM','$now_date','$now_date_epoch','$temp_parallel_rec_cm_filename','$CIDlead_id','$VDADuser','$uniqueid')"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -5209,11 +5275,13 @@ while ($drop_timer <= $DROP_TIME) } ### insert record into recording_log_stereo table ### - $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VDADserver_ip','$now_date','0','$temp_parallel_rec_cm_filename','$CIDlead_id','$VDADcampaign STEREO_PARALLEL CUSTOMER-MUTED $stereo_recording','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; + $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VARserver_ip','$now_date','0','$temp_parallel_rec_cm_filename','$CIDlead_id','$VDADcampaign STEREO_PARALLEL CUSTOMER-MUTED $stereo_recording','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO_PARALLEL CUSTOMER-MUTED','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_cm_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO_PARALLEL CUSTOMER-MUTED','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_cm_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -5239,7 +5307,7 @@ while ($drop_timer <= $DROP_TIME) $temp_parallel_rec_fr_filename =~ s/\"|\'//gi; } ### insert a record into the recording_log table - $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VDADserver_ip','SPFR','$now_date','$now_date_epoch','$temp_parallel_rec_fr_filename','$CIDlead_id','$VDADuser','$uniqueid')"; + $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VARserver_ip','SPFR','$now_date','$now_date_epoch','$temp_parallel_rec_fr_filename','$CIDlead_id','$VDADuser','$uniqueid')"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -5264,11 +5332,13 @@ while ($drop_timer <= $DROP_TIME) } ### insert record into recording_log_stereo table ### - $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VDADserver_ip','$now_date','0','$temp_parallel_rec_fr_filename','$CIDlead_id','$VDADcampaign STEREO_PARALLEL FULL-RECORDING $stereo_recording','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; + $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VARserver_ip','$now_date','0','$temp_parallel_rec_fr_filename','$CIDlead_id','$VDADcampaign STEREO_PARALLEL FULL-RECORDING $stereo_recording','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO_PARALLEL FULL-RECORDING','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_fr_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO_PARALLEL FULL-RECORDING','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_fr_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -5280,7 +5350,7 @@ while ($drop_timer <= $DROP_TIME) { $temp_parallel_rec_ag_filename = $stereo_rec_filename; ### insert a record into the recording_log table - $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VDADserver_ip','SPACI','$now_date','$now_date_epoch','$temp_parallel_rec_ag_filename','$CIDlead_id','$VDADuser','$uniqueid')"; + $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VARserver_ip','SPACI','$now_date','$now_date_epoch','$temp_parallel_rec_ag_filename','$CIDlead_id','$VDADuser','$uniqueid')"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -5305,7 +5375,7 @@ while ($drop_timer <= $DROP_TIME) } ### insert record into recording_log_stereo table ### - $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VDADserver_ip','$now_date','0','$temp_parallel_rec_ag_filename','$CIDlead_id','$VDADcampaign STEREO_PARALLEL AGENT-CONTROLLED RIR $stereo_recording $stereo_recording_agent','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; + $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,parallel_recording_id,recording_status) values('$recording_id','$VARserver_ip','$now_date','0','$temp_parallel_rec_ag_filename','$CIDlead_id','$VDADcampaign STEREO_PARALLEL AGENT-CONTROLLED RIR $stereo_recording $stereo_recording_agent','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','$parallel_recording_id','PARALLEL START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; @@ -5313,7 +5383,9 @@ while ($drop_timer <= $DROP_TIME) $affected_rowsB = $dbhA->do($stmtB); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rowsB; &mysql_error_logging; - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO_PARALLEL AGENT-CONTROLLED RIR','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_ag_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO_PARALLEL AGENT-CONTROLLED RIR','$VARserver_ip','$now_date','$channel','$temp_parallel_rec_ag_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -5325,8 +5397,14 @@ while ($drop_timer <= $DROP_TIME) ## Start NON-parallel stereo call recording ## if ($stereo_recording_agent =~ /ALLCALLS|ALLFORCE/) { + $rl_exten='SACIBC'; + if ($stereo_recording =~ /CUSTOMER_ONLY/i) + {$rl_exten='SACICO';} + if ($stereo_recording =~ /CUSTOMER_MUTE/i) + {$rl_exten='SACICM';} + # insert a record into the recording_log table - $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VDADserver_ip','SACI','$now_date','$now_date_epoch','$stereo_rec_filename','$CIDlead_id','$VDADuser','$uniqueid')"; + $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$VARserver_ip','$rl_exten','$now_date','$now_date_epoch','$stereo_rec_filename','$CIDlead_id','$VDADuser','$uniqueid')"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; @@ -5354,7 +5432,7 @@ while ($drop_timer <= $DROP_TIME) $retval = $AGI->exec("MixMonitor",",r($PATHmonitorT/$stereo_rec_filename-out.wav)t($PATHmonitorT/$stereo_rec_filename-in.wav)"); ### insert record into recording_log_stereo table ### - $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,recording_status) values('$recording_id','$VDADserver_ip','$now_date','0','$stereo_rec_filename','$CIDlead_id','$VDADcampaign STEREO AGENT-CONTROLLED RIR $stereo_recording $stereo_recording_agent','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','STEREO START');"; + $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,recording_status) values('$recording_id','$VARserver_ip','$now_date','0','$stereo_rec_filename','$CIDlead_id','$VDADcampaign STEREO AGENT-CONTROLLED RIR $stereo_recording $stereo_recording_agent','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|','STEREO START');"; $SRaffected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging; @@ -5362,7 +5440,9 @@ while ($drop_timer <= $DROP_TIME) $affected_rowsB = $dbhA->do($stmtB); $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rowsB; &mysql_error_logging; - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO AGENT-CONTROLLED RIR','$VARserver_ip','$now_date','$channel','$stereo_rec_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO AGENT-CONTROLLED RIR $rl_exten','$VARserver_ip','$now_date','$channel','$stereo_rec_filename','$CIDlead_id','$VDADuser','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; $rLIVEaffected_rows = $dbhA->do($stmtD); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$rLIVEaffected_rows; &mysql_error_logging; @@ -5370,14 +5450,14 @@ while ($drop_timer <= $DROP_TIME) if ($stereo_recording =~ /CUSTOMER_ONLY/i) { $vmgr_callerid = substr($stereo_rec_filename, 0, 16) . 'M...'; - $stmtE="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VDADserver_ip','','MixMonitorMute','$vmgr_callerid','ActionID: $vmgr_callerid','Channel: $channel','Direction: write','State: 1','','','','','','');"; + $stmtE="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VARserver_ip','','MixMonitorMute','$vmgr_callerid','ActionID: $vmgr_callerid','Channel: $channel','Direction: write','State: 1','','','','','','');"; $mLIVEaffected_rows = $dbhA->do($stmtE); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$mLIVEaffected_rows; &mysql_error_logging; } if ($stereo_recording =~ /CUSTOMER_MUTE/i) { $vmgr_callerid = substr($stereo_rec_filename, 0, 16) . 'M...'; - $stmtE="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VDADserver_ip','','MixMonitorMute','$vmgr_callerid','ActionID: $vmgr_callerid','Channel: $channel','Direction: read','State: 1','','','','','','');"; + $stmtE="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VARserver_ip','','MixMonitorMute','$vmgr_callerid','ActionID: $vmgr_callerid','Channel: $channel','Direction: read','State: 1','','','','','','');"; $mLIVEaffected_rows = $dbhA->do($stmtE); $dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$mLIVEaffected_rows; &mysql_error_logging; } diff --git a/agc_2-X/trunk/agi/agi-VDAD_RINGALL.agi b/agc_2-X/trunk/agi/agi-VDAD_RINGALL.agi index 97301fb6..54622831 100644 --- a/agc_2-X/trunk/agi/agi-VDAD_RINGALL.agi +++ b/agc_2-X/trunk/agi/agi-VDAD_RINGALL.agi @@ -25,6 +25,7 @@ # 240420-2241 - Added ConfBridge code # 240415-1702 - Fix for ConfBridge code # 250924-2157 - Added code for deprecation of "Monitor" application after Asterisk 20 +# 251006-0902 - If recording_dtmf_muting enabled, force use of MixMonitor for recording # $script = 'agi-VDAD_RINGALL.agi'; @@ -42,6 +43,7 @@ $now_date = "$year-$mon-$mday $hour:$min:$sec"; $now_num = "$year$mon$mday$hour$min$sec"; $CIDdate = "$mon$mday$hour$min$sec"; $S='*'; +$recording_dtmf_muting=0; # default path to astguiclient configuration file: $PATHconf = '/etc/astguiclient.conf'; @@ -92,6 +94,21 @@ $AGI = new Asterisk::AGI; $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") or die "Couldn't connect to database: " . DBI->errstr; +############################################# +##### Gather system_settings ##### +$stmtA = "SELECT recording_dtmf_muting,recording_dtmf_detection FROM system_settings;"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $SSrecording_dtmf_muting = $aryA[0]; + $SSrecording_dtmf_detection = $aryA[1]; + } +$sthA->finish(); +########################################### + ### Grab Server values from the database $stmtA = "SELECT agi_output,ext_context,asterisk_version,conf_engine FROM servers where server_ip = '$VARserver_ip';"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; @@ -308,7 +325,7 @@ if ($NAGcount > 0) ### get the recording settings for the campaign that this remote agent is logged into if (length($VLAcampaign_id) > 0) { - $stmtA = "SELECT campaign_recording,campaign_rec_filename FROM vicidial_campaigns where campaign_id='$VLAcampaign_id';"; + $stmtA = "SELECT campaign_recording,campaign_rec_filename,recording_dtmf_muting FROM vicidial_campaigns where campaign_id='$VLAcampaign_id';"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $VCRcount=$sthA->rows; @@ -317,6 +334,9 @@ if ($NAGcount > 0) @aryA = $sthA->fetchrow_array; $campaign_recording = $aryA[0]; $campaign_rec_filename = $aryA[1]; + $recording_dtmf_muting = $aryA[2]; + if ( ($SSrecording_dtmf_detection < 1) || ($SSrecording_dtmf_muting < 1) ) + {$recording_dtmf_muting=0;} } $sthA->finish(); } @@ -388,7 +408,7 @@ if ($NAGcount > 0) } else { - if ($ast_ver_str{major} > 20) + if ( ($ast_ver_str{major} > 20) || ($SSrecording_dtmf_muting > 0) ) { # Deprecation of "Monitor" application after Asterisk 20 $AGI->exec("MixMonitor",",r($PATHmonitor/MIX/$campaign_rec_filename-in.wav)t($PATHmonitor/MIX/$campaign_rec_filename-out.wav)"); @@ -402,7 +422,31 @@ if ($NAGcount > 0) ### insert record into recording_log table ### $stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,length_in_sec,filename,lead_id,user,location,vicidial_id) values('$channel','$VARserver_ip','$VAC_phone_number','$now_date','$now_date_epoch','0','$campaign_rec_filename','$VAC_lead_id','$dial_user','$campaign_rec_filename','$uniqueid');"; $RLRAaffected_rows = $dbhA->do($stmtA); - if ($AGILOG) {$agi_string = "-- REMOTE RECORDING STARTED : |$RLRAaffected_rows|$campaign_rec_filename|$stmtA|"; &agi_output;} + + $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; + $sthA = $dbhA->prepare($stmtB) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $recording_id = $aryA[0]; + } + $sthA->finish(); + + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + { + if ($SSrecording_dtmf_muting > 1) + { + $recording_dtmf_muting = $SSrecording_dtmf_muting; + } + } + + ### insert record into recording_live table ### + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','MONO_LEGACY_REMOTE','$VARserver_ip','$now_date','$channel','$campaign_rec_filename','$VAC_lead_id','$dial_user','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; + $rLIVEaffected_rows = $dbhA->do($stmtD); + + if ($AGILOG) {$agi_string = "-- REMOTE RECORDING STARTED : |$RLRAaffected_rows|$rLIVEaffected_rows|$recording_id|$campaign_rec_filename|$stmtA|"; &agi_output;} } } else diff --git a/agc_2-X/trunk/bin/ADMIN_archive_log_tables.pl b/agc_2-X/trunk/bin/ADMIN_archive_log_tables.pl index 2eb27030..8b60414b 100644 --- a/agc_2-X/trunk/bin/ADMIN_archive_log_tables.pl +++ b/agc_2-X/trunk/bin/ADMIN_archive_log_tables.pl @@ -74,6 +74,7 @@ # 240916-2159 - Added --extended-log-only # 240924-2041 - Added --vicidial-log-only # 250914-1537 - Added archiving of recording_log_stereo and recording_log_parallel tables +# 251011-2048 - Added archiving of recording_live_log table # $CALC_TEST=0; @@ -4136,6 +4137,55 @@ if (!$T) $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; } + + ##### recording_live_log + $stmtA = "SELECT count(*) from recording_live_log;"; + $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; + $recording_live_log_count = $aryA[0]; + } + $sthA->finish(); + + $stmtA = "SELECT count(*) from recording_live_log_archive;"; + $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; + $recording_live_log_archive_count = $aryA[0]; + } + $sthA->finish(); + + if (!$Q) {print "\nProcessing recording_live_log table... ($recording_live_log_count|$recording_live_log_archive_count)\n";} + $stmtA = "INSERT IGNORE INTO recording_live_log_archive SELECT * from recording_live_log;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + + $sthArows = $sthA->rows; + if (!$Q) {print "$sthArows rows inserted into recording_live_log_archive table \n";} + + $rv = $sthA->err(); + if (!$rv) + { + $stmtA = "DELETE FROM recording_live_log WHERE start_time < '$RECdel_time';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows = $sthA->rows; + if (!$Q) {print "$sthArows rows deleted from recording_live_log table \n";} + + $stmtA = "optimize table recording_live_log;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + + $stmtA = "optimize table recording_live_log_archive;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + } } diff --git a/agc_2-X/trunk/bin/ADMIN_central_lead_repository.pl b/agc_2-X/trunk/bin/ADMIN_central_lead_repository.pl new file mode 100644 index 00000000..224d620f --- /dev/null +++ b/agc_2-X/trunk/bin/ADMIN_central_lead_repository.pl @@ -0,0 +1,1795 @@ +#!/usr/bin/perl +# +# ADMIN_central_lead_repository.pl version 2.14 +# +# This script is designed to gather recently changed log entries and look up the lead data for those logs and update a central vicidial_list table on a separate database server. Then after a set cut-off time, check for the previous X hours of leads being modified and update anything that is missing and provide a report. Then early in the morning the changed leads will be sync'd back to the original database server +# +# This script also can sync settings from campaigns, lists, dids, in-groups and users to the CLR database +# +# WARNING!!! This script is experimental and is not recommended for production systems at this time +# +# NOTE: for more information on using this in a multi-cluster situation, read the MySQL_Multi-source-replication.txt document +# NOTE: this script makes use of some non-standard database fields, to use it you may need to run these, which you should not do during production: +# +# ALTER TABLE vicidial_log ADD modify_stamp TIMESTAMP; +# ALTER TABLE vicidial_closer_log ADD modify_stamp TIMESTAMP; +# +# Place in the crontab and run every month after one in the morning, or whenever +# your server is not busy with other tasks +# 30 1 1 * * /usr/share/astguiclient/ADMIN_central_lead_repository.pl +# +# Copyright (C) 2025 Matt Florell LICENSE: AGPLv2 +# +# CHANGES +# 241018-1001 - First version work started, ongoing development +# + +$DB=0; +$DBX=0; +$CALC_TEST=0; +$QUERY_COUNT_TEST=0; +$NIGHTLY_UPDATE=0; +$BACK_TO_CLUSTERS=0; +$SETTINGS_TO_CLR=0; +$ALL_SETTINGS=0; +$T=0; $TEST=0; +$MT[0]=''; +$u_ct=0; +$process_output=''; + +### begin parsing run-time options ### +if (length($ARGV[0])>1) + { + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n"; + print " [--minutes=XX] = number of minutes to gather leads for, default is 1 \n"; + print " [--quiet] = quiet\n"; + print " [--calc-test] = date calculation test only\n"; + print " [--query-count-test] = run archive counts test only\n"; + print " [--nightly-update] = update CLR leads with all modified leads from ORIGINAL db \n"; + print " [--back-to-clusters] = update ORIGINAL leads with all modified leads from CLR db \n"; + print " [--settings-to-clr] = update ORIGINAL settings to the CLR db \n"; + print " [--all-settings] = update all settings instead of by date \n"; + print " [--test] = test\n"; + print " [--debug] = debug output for some options\n"; + print " [--debugX] = extra debug output for some options\n"; + print "\n"; + exit; + } + else + { + if ($args =~ /-quiet/i) + { + $q=1; $Q=1; + } + if ($args =~ /--test/i) + { + $T=1; $TEST=1; + print "\n----- TESTING -----\n\n"; + } + if ($args =~ /--debug/i) + { + $DB=1; + print "\n----- DEBUG -----\n\n"; + } + if ($args =~ /--debugX/i) + { + $DBX=1; + print "\n----- DEBUG EXTRA -----\n\n"; + } + if ($args =~ /--calc-test/i) + { + $CALC_TEST=1; + print "\n----- DATE CALCULATION TESTING ONLY: $CALC_TEST -----\n\n"; + } + if ($args =~ /--query-count-test/i) + { + $QUERY_COUNT_TEST=1; + print "\n----- ARCHIVE TABLES QUERY COUNT TESTING ONLY: $QUERY_COUNT_TEST -----\n\n"; + } + if ($args =~ /--nightly-update/i) + { + $NIGHTLY_UPDATE=1; + print "\n----- NIGHTLY CLR UPDATE: $NIGHTLY_UPDATE -----\n\n"; + } + if ($args =~ /--back-to-clusters/i) + { + $BACK_TO_CLUSTERS=1; + print "\n----- BACK TO CLUSTERS UPDATE: $BACK_TO_CLUSTERS -----\n\n"; + } + if ($args =~ /--settings-to-clr/i) + { + $SETTINGS_TO_CLR=1; + print "\n----- SETTINGS TO CLR UPDATE: $SETTINGS_TO_CLR -----\n\n"; + } + if ($args =~ /--all-settings/i) + { + $ALL_SETTINGS=1; + print "\n----- ALL SETTINGS OVERRIDE: $ALL_SETTINGS -----\n\n"; + } + if ($args =~ /--minutes=/i) + { + @data_in = split(/--minutes=/,$args); + $CLIminutes = $data_in[1]; + $CLIminutes =~ s/ .*$//gi; + $CLIminutes =~ s/\D//gi; + if ($CLIminutes > 999999) + {$CLIminutes=730;} + if ($Q < 1) + {print "\n----- MINUTES OVERRIDE: $CLIminutes -----\n\n";} + } + } + } +else + { + print "no command line options set\n"; + } +### end parsing run-time options ### +if ( (length($CLIminutes)<1) || ($CLIminutes < 1) ) + { + $CLIminutes = 1; + } + +$secX = time(); +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + +$now_epoch = ($secX); # now +($Nsec,$Nmin,$Nhour,$Nmday,$Nmon,$Nyear,$Nwday,$Nyday,$Nisdst) = localtime($now_epoch); +$Nyear = ($Nyear + 1900); +$Nmon++; +if ($Nmon < 10) {$Nmon = "0$Nmon";} +if ($Nmday < 10) {$Nmday = "0$Nmday";} +if ($Nhour < 10) {$Nhour = "0$Nhour";} +if ($Nmin < 10) {$Nmin = "0$Nmin";} +if ($Nsec < 10) {$Nsec = "0$Nsec";} +$now_time = "$Nyear-$Nmon-$Nmday $Nhour:$Nmin:$Nsec"; +$now_date = "$Nyear-$Nmon-$Nmday"; +$now_test_date = "$Nyear$Nmon$Nmday$Nhour$Nmin$Nsec"; + +$del_epoch = ($secX - 60); # 1 minute ago 0 seconds +($RMsec,$RMmin,$RMhour,$RMmday,$RMmon,$RMyear,$RMwday,$RMyday,$RMisdst) = localtime($del_epoch); +$RMyear = ($RMyear + 1900); +$RMmon++; +if ($RMmon < 10) {$RMmon = "0$RMmon";} +if ($RMmday < 10) {$RMmday = "0$RMmday";} +if ($RMhour < 10) {$RMhour = "0$RMhour";} +if ($RMmin < 10) {$RMmin = "0$RMmin";} +if ($RMsec < 10) {$RMsec = "0$RMsec";} +$del_time = "$RMyear-$RMmon-$RMmday $RMhour:$RMmin:00"; + +$Bdel_epoch = (($secX - (60 * $CLIminutes)) - 60); # X+1 minutes ago 0 seconds +($BRMsec,$BRMmin,$BRMhour,$BRMmday,$BRMmon,$BRMyear,$BRMwday,$BRMyday,$BRMisdst) = localtime($Bdel_epoch); +$BRMyear = ($BRMyear + 1900); +$BRMmon++; +if ($BRMmon < 10) {$BRMmon = "0$BRMmon";} +if ($BRMmday < 10) {$BRMmday = "0$BRMmday";} +if ($BRMhour < 10) {$BRMhour = "0$BRMhour";} +if ($BRMmin < 10) {$BRMmin = "0$BRMmin";} +if ($BRMsec < 10) {$BRMsec = "0$BRMsec";} +$Bdel_time = "$BRMyear-$BRMmon-$BRMmday $BRMhour:$BRMmin:00"; + +if (!$Q) {print "\n\n-- ADMIN_central_lead_repository.pl --\n\n";} +if (!$Q) {print "This script is designed take recently modified lead records from the vicidial_list\n";} +if (!$Q) {print "table and sync them to a central lead repository server during the day, then confirm\n";} +if (!$Q) {print "at night, then push back any updated records from the CLR back to the cluster database\n";} +if (!$Q) {print "early in the morning.\n";} +$begin_output = "$CLIminutes minutes ($Bdel_time -> $del_time |$Bdel_epoch$del_epoch| ) NOW: $now_time \n"; +if (!$Q) {print "$begin_output\n";} + +$process_output .= $begin_output; + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + if ( ($line =~ /^VARCS_server/) && ($CLICS_server < 1) ) + {$VARCS_server = $line; $VARCS_server =~ s/.*=//gi;} + if ( ($line =~ /^VARCS_database/) && ($CLICS_database < 1) ) + {$VARCS_database = $line; $VARCS_database =~ s/.*=//gi;} + if ( ($line =~ /^VARCS_user/) && ($CLICS_user < 1) ) + {$VARCS_user = $line; $VARCS_user =~ s/.*=//gi;} + if ( ($line =~ /^VARCS_pass/) && ($CLICS_pass < 1) ) + {$VARCS_pass = $line; $VARCS_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARCS_port/) && ($CLICS_port < 1) ) + {$VARCS_port = $line; $VARCS_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +# default path to Central Lead Repository configuration file: +$PATHclr = '/etc/vicidial_CLR.conf'; + +open(conf, "$PATHclr") || die "can't open $PATHclr: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^VARCLR_server/) && ($CLICLR_server < 1) ) + {$VARCLR_server = $line; $VARCLR_server =~ s/.*=//gi;} + if ( ($line =~ /^VARCLR_database/) && ($CLICLR_database < 1) ) + {$VARCLR_database = $line; $VARCLR_database =~ s/.*=//gi;} + if ( ($line =~ /^VARCLR_user/) && ($CLICLR_user < 1) ) + {$VARCLR_user = $line; $VARCLR_user =~ s/.*=//gi;} + if ( ($line =~ /^VARCLR_pass/) && ($CLICLR_pass < 1) ) + {$VARCLR_pass = $line; $VARCLR_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARCLR_port/) && ($CLICLR_port < 1) ) + {$VARCLR_port = $line; $VARCLR_port =~ s/.*=//gi;} + $i++; + } + +use DBI; +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; +$dbhB = DBI->connect("DBI:mysql:$VARCLR_database:$VARCLR_server:$VARCLR_port", "$VARCLR_user", "$VARCLR_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +############################################# +##### Gather system_settings ##### +$stmtA = "SELECT count(*) FROM vicidial_list;"; +$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; + $MAINvl_ct = $aryA[0]; + if ($DB > 0) {print "MAIN Database test: $MAINvl_ct \n";} + } +$sthA->finish(); +########################################### + +############################################# +##### Test Central-Lead-Repository Database connection with query of vicidial_list table ##### +$stmtB = "SELECT count(*) FROM vicidial_list;"; +$sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr; +$sthB->execute or die "executing: $stmtB ", $dbhB->errstr; +$sthBrows=$sthB->rows; +if ($sthBrows > 0) + { + @aryB = $sthB->fetchrow_array; + $CLRvl_ct = $aryB[0]; + if ($DB > 0) {print "CLR Database test: $CLRvl_ct \n";} + } +$sthB->finish(); +########################################### + +if ($CALC_TEST > 0) + { + exit; + } + + + +################################################################################ +##### BEGIN settings update ORIGINAL to CLR db updates: campaigns, lists, dids, in-groups, users, etc... +################################################################################ +if ($SETTINGS_TO_CLR > 0) + { + if (!$Q) {print "\nStarting settings ORIGINAL to CLR update process...\n";} + + $clr_id=''; + $process_options=''; + + # insert clr_log entry into database + $stmtA = "INSERT INTO clr_log SET start_time=NOW(),begin_range='$Bdel_time',range_minutes='$CLIminutes',phase='BEGIN',server_ip='$server_ip',processing_log='';"; + $affected_rowsA = $dbhA->do($stmtA); + $stmtC = "SELECT LAST_INSERT_ID() LIMIT 1;"; + $sthA = $dbhA->prepare($stmtC) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtC ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $clr_id = $aryA[0]; + } + $sthA->finish(); + if ($DB) {print "clr_id: $clr_id \n";} + + $phase='SETTINGS_UPDATE'; + + ##################################### + ### BEGIN update each setting type + ##################################### + + $v=0; + $temp_type_ARY[$v] = 'users'; + $temp_typeS_ARY[$v] = 'user'; + $temp_table_ARY[$v] = 'vicidial_users'; + $temp_id_field_ARY[$v] = 'user'; + $temp_date_check_SQL_ARY[$v] = "modify_stamp >= \"$Bdel_time\""; + $temp_first_fields_ARY[$v] = "user,modify_stamp,UNIX_TIMESTAMP(modify_stamp)"; + $temp_date_field_ARY[$v] = 'modify_stamp'; + $fields_skip_list_ARY[$v] = "user,active"; + $fields_insert_list_ARY[$v] = ",active='N'"; + $SUBS_tables_list_ARY[$v] = "vicidial_inbound_group_agents,vicidial_campaign_agents"; + $SUBS_delete_first_ARY[$v] = 1; + $SUBS_tables_details_ARY[$v] = "vicidial_inbound_group_agents---group_id,vicidial_campaign_agents---campaign_id"; + + $v++; + $temp_type_ARY[$v] = 'lists'; + $temp_typeS_ARY[$v] = 'list'; + $temp_table_ARY[$v] = 'vicidial_lists'; + $temp_id_field_ARY[$v] = 'list_id'; + $temp_date_check_SQL_ARY[$v] = "list_changedate >= \"$Bdel_time\""; + $temp_first_fields_ARY[$v] = "list_id,list_changedate,UNIX_TIMESTAMP(list_changedate)"; + $temp_date_field_ARY[$v] = 'list_changedate'; + $fields_skip_list_ARY[$v] = "list_id,active"; + $fields_insert_list_ARY[$v] = ",active='N'"; + $SUBS_tables_list_ARY[$v] = ""; + $SUBS_delete_first_ARY[$v] = 0; + $SUBS_tables_details_ARY[$v] = ""; + + $v++; + $temp_type_ARY[$v] = 'dids'; + $temp_typeS_ARY[$v] = 'did'; + $temp_table_ARY[$v] = 'vicidial_inbound_dids'; + $temp_id_field_ARY[$v] = 'did_id'; + $temp_date_check_SQL_ARY[$v] = "modify_stamp >= \"$Bdel_time\""; + $temp_first_fields_ARY[$v] = "did_id,modify_stamp,UNIX_TIMESTAMP(modify_stamp)"; + $temp_date_field_ARY[$v] = 'modify_stamp'; + $fields_skip_list_ARY[$v] = "did_id,did_active"; + $fields_insert_list_ARY[$v] = ",did_active='N'"; + $SUBS_tables_list_ARY[$v] = ""; + $SUBS_delete_first_ARY[$v] = 0; + $SUBS_tables_details_ARY[$v] = ""; + + $v++; + $temp_type_ARY[$v] = 'in-groups'; + $temp_typeS_ARY[$v] = 'in-group'; + $temp_table_ARY[$v] = 'vicidial_inbound_groups'; + $temp_id_field_ARY[$v] = 'group_id'; + $temp_date_check_SQL_ARY[$v] = "modify_stamp >= \"$Bdel_time\""; + $temp_first_fields_ARY[$v] = "group_id,modify_stamp,UNIX_TIMESTAMP(modify_stamp)"; + $temp_date_field_ARY[$v] = 'modify_stamp'; + $fields_skip_list_ARY[$v] = "group_id,active"; + $fields_insert_list_ARY[$v] = ",active='N'"; + $SUBS_tables_list_ARY[$v] = ""; + $SUBS_delete_first_ARY[$v] = 0; + $SUBS_tables_details_ARY[$v] = ""; + + $v++; + $temp_type_ARY[$v] = 'campaigns'; + $temp_typeS_ARY[$v] = 'campaign'; + $temp_table_ARY[$v] = 'vicidial_campaigns'; + $temp_id_field_ARY[$v] = 'campaign_id'; + $temp_date_check_SQL_ARY[$v] = "campaign_changedate >= \"$Bdel_time\""; + $temp_first_fields_ARY[$v] = "campaign_id,campaign_changedate,UNIX_TIMESTAMP(campaign_changedate)"; + $temp_date_field_ARY[$v] = 'campaign_changedate'; + $fields_skip_list_ARY[$v] = "campaign_id,active"; + $fields_insert_list_ARY[$v] = ",active='N'"; + $SUBS_tables_list_ARY[$v] = "vicidial_campaign_statuses,vicidial_campaign_hotkeys"; + $SUBS_delete_first_ARY[$v] = 1; + $SUBS_tables_details_ARY[$v] = "vicidial_campaign_statuses---status,vicidial_campaign_hotkeys---hotkey"; + + # generate list of local affected tables, so we can back them up before starting sync + $e_ct=0; + while ($v >= $e_ct) + { + if ($e_ct > 0) {$dump_table_list .= " ";} + $dump_table_list .= "$temp_table_ARY[$e_ct]"; + if (length($SUBS_tables_list_ARY[$e_ct]) > 0) + { + $dump_table_list .= " $SUBS_tables_list_ARY[$e_ct]"; + } + $e_ct++; + } + $dump_table_list =~ s/,/ /gi; + + print "DEBUG: dump tables: |$dump_table_list|\n"; + + $v=0; + &populate_main_section; + + $secY = time(); + $secZ = ($secY - $secX); + +print "DEV EXIT! $secZ seconds\n"; +exit; + + # insert clr_log entry into database + $stmtA = "UPDATE clr_log SET phase='$phase',records_ct='$u_ct',length_in_sec='$secZ',processing_log='$process_output',options='$process_options' where clr_id='$clr_id';"; + $affected_rowsA = $dbhA->do($stmtA); + + + ##################################### + ### END update each setting type + ##################################### + + + $secY = time(); + $secZ = ($secY - $secX); + + # insert clr_log entry into database + $stmtA = "UPDATE clr_log SET phase='$phase',records_ct='$u_ct',length_in_sec='$secZ',processing_log='$process_output',options='$process_options' where clr_id='$clr_id';"; + $affected_rowsA = $dbhA->do($stmtA); + } +################################################################################ +##### END settings update ORIGINAL to CLR db updates: campaigns, lists, dids, in-groups, users +################################################################################ + +print "DEV EXIT! $secZ seconds\n"; +exit; + + + + + + + + + + + + + + +################################################################################ +##### BEGIN incremental or nightly ORIGINAL to CLR db updates +################################################################################ +if ($BACK_TO_CLUSTERS < 1) + { + if (!$Q) {print "\nStarting Central-Lead-Repository calling-time ORIGINAL to CLR process...\n";} + + $clr_id=''; + # insert clr_log entry into database + $stmtA = "INSERT INTO clr_log SET start_time=NOW(),begin_range='$Bdel_time',range_minutes='$CLIminutes',phase='BEGIN',server_ip='$server_ip',processing_log='';"; + $affected_rowsA = $dbhA->do($stmtA); + $stmtC = "SELECT LAST_INSERT_ID() LIMIT 1;"; + $sthA = $dbhA->prepare($stmtC) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtC ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $clr_id = $aryA[0]; + } + $sthA->finish(); + if ($DB) {print "clr_id: $clr_id \n";} + + $vicidial_list_ct=0; + $vicidial_log_ct=0; + $vicidial_closer_log_ct=0; + + if ($NIGHTLY_UPDATE > 0) + { + $phase='NIGHTLY_UPDATE'; + ### Check if there are any leads modified since X minutes ago + $stmtA = "SELECT count(*) from vicidial_list where modify_date >= \"$Bdel_time\";"; + $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; + $vicidial_list_ct = $aryA[0]; + } + $sthA->finish(); + } + else + { + $phase='DAYTIME_INCREMENTAL'; + ### Check if there are any calls within the previous X minutes + $stmtA = "SELECT count(*) from vicidial_closer_log where modify_stamp >= \"$Bdel_time\" and modify_stamp < \"$del_time\";"; + $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; + $vicidial_closer_log_ct = $aryA[0]; + } + $sthA->finish(); + + $stmtA = "SELECT count(*) from vicidial_log where modify_stamp >= \"$Bdel_time\" and modify_stamp < \"$del_time\";"; + $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; + $vicidial_log_ct = $aryA[0]; + } + $sthA->finish(); + } + + if ( ($vicidial_closer_log_ct < 1) && ($vicidial_log_ct < 1) && ($vicidial_list_ct < 1) ) + { + if (!$Q) {print "No recent calls or changed leads, nothing to do, exiting... \n";} + exit; + } + else + { + if (!$Q) {print "Recent calls - Outbound: $vicidial_log_ct Inbound: $vicidial_closer_log_ct Leads: $vicidial_list_ct \n";} + + if ($NIGHTLY_UPDATE > 0) + { + $o_ct=0; + $stmtA = "SELECT lead_id from vicidial_list where modify_date >= \"$Bdel_time\" limit 10000000;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + while ($sthArows > $o_ct) + { + @aryA = $sthA->fetchrow_array; + $updated_LEADS[$o_ct] = $aryA[0]; + $o_ct++; + } + $sthA->finish(); + $updated_LEADSsize = $o_ct; + } + else + { + $o_ct=0; + $stmtA = "SELECT lead_id from vicidial_log where modify_stamp >= \"$Bdel_time\" and modify_stamp < \"$del_time\" limit 10000000;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + while ($sthArows > $o_ct) + { + @aryA = $sthA->fetchrow_array; + $updated_LEADS[$o_ct] = $aryA[0]; + $o_ct++; + } + $sthA->finish(); + + $i_ct=0; + $stmtA = "SELECT lead_id from vicidial_closer_log where modify_stamp >= \"$Bdel_time\" and modify_stamp < \"$del_time\" limit 10000000;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + while ($sthArows > $o_ct) + { + @aryA = $sthA->fetchrow_array; + $updated_LEADS[$o_ct] = $aryA[0]; + $i_ct++; + $o_ct++; + } + $sthA->finish(); + + # remove duplicate lead_ids + my %h1; + foreach my $x (@updated_LEADS) + { + $h1{$x}=1; + } + @updated_LEADS=keys%h1; + $updated_LEADSsize = @updated_LEADS; + $updated_LEADSdupCT = ($o_ct - $updated_LEADSsize); + + $duplicate_output = "Duplicate check - Dups: $updated_LEADSdupCT Unique: $updated_LEADSsize \n"; + if (!$Q) {print $duplicate_output;} + $process_output .= $duplicate_output; + } + + ### loop through all leads, gather lead data, compare to record on CLR server, update/insert if needed + $u_ct=0; + $CLRupdate_ct=0; $CLRupdate_aff=0; + $CLRinsert_ct=0; $CLRinsert_aff=0; + $CLRnochange_ct=0; + while ($updated_LEADSsize > $u_ct) + { + $update_phase=1; + # gather lead data from ORIGINAL database + $stmtA = "SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id from vicidial_list where lead_id=$updated_LEADS[$u_ct];"; + $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; + $lead_id = $aryA[0]; + if (defined $aryA[1]) {$entry_date = $aryA[1]; $entry_dateSQL = "\"$aryA[1]\"";} + else {$entry_dateSQL = 'NULL'; $entry_date='NULL';} + if (defined $aryA[2]) {$modify_date = $aryA[2]; $modify_dateSQL = "\"$aryA[2]\"";} + else {$modify_dateSQL = 'NULL'; $modify_date='NULL';} + if (defined $aryA[3]) {$status = $aryA[3]; $statusSQL = "\"$aryA[3]\"";} + else {$statusSQL = 'NULL'; $status='NULL';} + if (defined $aryA[4]) {$user = $aryA[4]; $userSQL = "\"$aryA[4]\"";} + else {$userSQL = 'NULL'; $user='NULL';} + if (defined $aryA[5]) {$vendor_lead_code = $aryA[5]; $vendor_lead_codeSQL = "\"$aryA[5]\"";} + else {$vendor_lead_codeSQL = 'NULL'; $vendor_lead_code='NULL';} + if (defined $aryA[6]) {$source_id = $aryA[6]; $source_idSQL = "\"$aryA[6]\"";} + else {$source_idSQL = 'NULL'; $source_id='NULL';} + if (defined $aryA[7]) {$list_id = $aryA[7]; $list_idSQL = "\"$aryA[7]\"";} + else {$list_idSQL = 'NULL'; $list_id='NULL';} + if (defined $aryA[8]) {$gmt_offset_now = $aryA[8]; $gmt_offset_nowSQL = "\"$aryA[8]\"";} + else {$gmt_offset_nowSQL = 'NULL'; $gmt_offset_now='NULL';} + if (defined $aryA[9]) {$called_since_last_reset = $aryA[9]; $called_since_last_resetSQL = "\"$aryA[9]\"";} + else {$called_since_last_resetSQL = 'NULL'; $called_since_last_reset='NULL';} + if (defined $aryA[10]) {$phone_code = $aryA[10]; $phone_codeSQL = "\"$aryA[10]\"";} + else {$phone_codeSQL = 'NULL'; $phone_code='NULL';} + if (defined $aryA[11]) {$phone_number = $aryA[11]; $phone_numberSQL = "\"$aryA[11]\"";} + else {$phone_numberSQL = 'NULL'; $phone_number='NULL';} + if (defined $aryA[12]) {$title = $aryA[12]; $titleSQL = "\"$aryA[12]\"";} + else {$titleSQL = 'NULL'; $title='NULL';} + if (defined $aryA[13]) {$first_name = $aryA[13]; $first_nameSQL = "\"$aryA[13]\"";} + else {$first_nameSQL = 'NULL'; $first_name='NULL';} + if (defined $aryA[14]) {$middle_initial = $aryA[14]; $middle_initialSQL = "\"$aryA[14]\"";} + else {$middle_initialSQL = 'NULL'; $middle_initial='NULL';} + if (defined $aryA[15]) {$last_name = $aryA[15]; $last_nameSQL = "\"$aryA[15]\"";} + else {$last_nameSQL = 'NULL'; $last_name='NULL';} + if (defined $aryA[16]) {$address1 = $aryA[16]; $address1SQL = "\"$aryA[16]\"";} + else {$address1SQL = 'NULL'; $address1='NULL';} + if (defined $aryA[17]) {$address2 = $aryA[17]; $address2SQL = "\"$aryA[17]\"";} + else {$address2SQL = 'NULL'; $address2='NULL';} + if (defined $aryA[18]) {$address3 = $aryA[18]; $address3SQL = "\"$aryA[18]\"";} + else {$address3SQL = 'NULL'; $address3='NULL';} + if (defined $aryA[19]) {$city = $aryA[19]; $citySQL = "\"$aryA[19]\"";} + else {$citySQL = 'NULL'; $city='NULL';} + if (defined $aryA[20]) {$state = $aryA[20]; $stateSQL = "\"$aryA[20]\"";} + else {$stateSQL = 'NULL'; $state='NULL';} + if (defined $aryA[21]) {$province = $aryA[21]; $provinceSQL = "\"$aryA[21]\"";} + else {$provinceSQL = 'NULL'; $province='NULL';} + if (defined $aryA[22]) {$postal_code = $aryA[22]; $postal_codeSQL = "\"$aryA[22]\"";} + else {$postal_codeSQL = 'NULL'; $postal_code='NULL';} + if (defined $aryA[23]) {$country_code = $aryA[23]; $country_codeSQL = "\"$aryA[23]\"";} + else {$country_codeSQL = 'NULL'; $country_code='NULL';} + if (defined $aryA[24]) {$gender = $aryA[24]; $genderSQL = "\"$aryA[24]\"";} + else {$genderSQL = 'NULL'; $gender='NULL';} + if (defined $aryA[25]) {$date_of_birth = $aryA[25]; $date_of_birthSQL = "\"$aryA[25]\"";} + else {$date_of_birthSQL = 'NULL'; $date_of_birth='NULL';} + if (defined $aryA[26]) {$alt_phone = $aryA[26]; $alt_phoneSQL = "\"$aryA[26]\"";} + else {$alt_phoneSQL = 'NULL'; $alt_phone='NULL';} + if (defined $aryA[27]) {$email = $aryA[27]; $emailSQL = "\"$aryA[27]\"";} + else {$emailSQL = 'NULL'; $email='NULL';} + if (defined $aryA[28]) {$security_phrase = $aryA[28]; $security_phraseSQL = "\"$aryA[28]\"";} + else {$security_phraseSQL = 'NULL'; $security_phrase='NULL';} + if (defined $aryA[29]) {$comments = $aryA[29]; $commentsSQL = "\"$aryA[29]\"";} + else {$commentsSQL = 'NULL'; $comments='NULL';} + if (defined $aryA[30]) {$called_count = $aryA[30]; $called_countSQL = "\"$aryA[30]\"";} + else {$called_countSQL = 'NULL'; $called_count='NULL';} + if (defined $aryA[31]) {$last_local_call_time = $aryA[31]; $last_local_call_timeSQL = "\"$aryA[31]\"";} + else {$last_local_call_timeSQL = 'NULL'; $last_local_call_time='NULL';} + if (defined $aryA[32]) {$rank = $aryA[32]; $rankSQL = "\"$aryA[32]\"";} + else {$rankSQL = 'NULL'; $rank='NULL';} + if (defined $aryA[33]) {$owner = $aryA[33]; $ownerSQL = "\"$aryA[33]\"";} + else {$ownerSQL = 'NULL'; $owner='NULL';} + if (defined $aryA[34]) {$entry_list_id = $aryA[34]; $entry_list_idSQL = "\"$aryA[34]\"";} + else {$entry_list_idSQL = 'NULL'; $entry_list_id='NULL';} + $Acompare = "$entry_date|$status|$user|$vendor_lead_code|$source_id|$list_id|$gmt_offset_now|$called_since_last_reset|$phone_code|$phone_number|$title|$first_name|$middle_initial|$last_name|$address1|$address2|$address3|$city|$state|$province|$postal_code|$country_code|$gender|$date_of_birth|$alt_phone|$email|$security_phrase|$comments|$called_count|$last_local_call_time|$rank|$owner|$entry_list_id"; + } + else + { + $update_phase=0; + if ($DBX > 0) + {print "DEBUG: No ORIGINAL lead found for lead $updated_LEADS[$u_ct], skipping \n";} + } + $sthA->finish(); + + # gather lead data from CLR database + $stmtB = "SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id from vicidial_list where lead_id=$updated_LEADS[$u_ct];"; + $sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr; + $sthB->execute or die "executing: $stmtB ", $dbhB->errstr; + $sthBrows=$sthB->rows; + if ($sthBrows > 0) + { + @aryB = $sthB->fetchrow_array; + $Blead_id = $aryB[0]; + if (defined $aryB[1]) {$Bentry_date = $aryB[1]; $Bentry_dateSQL = "\"$aryB[1]\"";} + else {$Bentry_dateSQL = 'NULL'; $Bentry_date='NULL';} + if (defined $aryB[2]) {$Bmodify_date = $aryB[2]; $Bmodify_dateSQL = "\"$aryB[2]\"";} + else {$Bmodify_dateSQL = 'NULL'; $Bmodify_date='NULL';} + if (defined $aryB[3]) {$Bstatus = $aryB[3]; $BstatusSQL = "\"$aryB[3]\"";} + else {$BstatusSQL = 'NULL'; $Bstatus='NULL';} + if (defined $aryB[4]) {$Buser = $aryB[4]; $BuserSQL = "\"$aryB[4]\"";} + else {$BuserSQL = 'NULL'; $Buser='NULL';} + if (defined $aryB[5]) {$Bvendor_lead_code = $aryB[5]; $Bvendor_lead_codeSQL = "\"$aryB[5]\"";} + else {$Bvendor_lead_codeSQL = 'NULL'; $Bvendor_lead_code='NULL';} + if (defined $aryB[6]) {$Bsource_id = $aryB[6]; $Bsource_idSQL = "\"$aryB[6]\"";} + else {$Bsource_idSQL = 'NULL'; $Bsource_id='NULL';} + if (defined $aryB[7]) {$Blist_id = $aryB[7]; $Blist_idSQL = "\"$aryB[7]\"";} + else {$Blist_idSQL = 'NULL'; $Blist_id='NULL';} + if (defined $aryB[8]) {$Bgmt_offset_now = $aryB[8]; $Bgmt_offset_nowSQL = "\"$aryB[8]\"";} + else {$Bgmt_offset_nowSQL = 'NULL'; $Bgmt_offset_now='NULL';} + if (defined $aryB[9]) {$Bcalled_since_last_reset = $aryB[9]; $Bcalled_since_last_resetSQL = "\"$aryB[9]\"";} + else {$Bcalled_since_last_resetSQL = 'NULL'; $Bcalled_since_last_reset='NULL';} + if (defined $aryB[10]) {$Bphone_code = $aryB[10]; $Bphone_codeSQL = "\"$aryB[10]\"";} + else {$Bphone_codeSQL = 'NULL'; $Bphone_code='NULL';} + if (defined $aryB[11]) {$Bphone_number = $aryB[11]; $Bphone_numberSQL = "\"$aryB[11]\"";} + else {$Bphone_numberSQL = 'NULL'; $Bphone_number='NULL';} + if (defined $aryB[12]) {$Btitle = $aryB[12]; $BtitleSQL = "\"$aryB[12]\"";} + else {$BtitleSQL = 'NULL'; $Btitle='NULL';} + if (defined $aryB[13]) {$Bfirst_name = $aryB[13]; $Bfirst_nameSQL = "\"$aryB[13]\"";} + else {$Bfirst_nameSQL = 'NULL'; $Bfirst_name='NULL';} + if (defined $aryB[14]) {$Bmiddle_initial = $aryB[14]; $Bmiddle_initialSQL = "\"$aryB[14]\"";} + else {$Bmiddle_initialSQL = 'NULL'; $Bmiddle_initial='NULL';} + if (defined $aryB[15]) {$Blast_name = $aryB[15]; $Blast_nameSQL = "\"$aryB[15]\"";} + else {$Blast_nameSQL = 'NULL'; $Blast_name='NULL';} + if (defined $aryB[16]) {$Baddress1 = $aryB[16]; $Baddress1SQL = "\"$aryB[16]\"";} + else {$Baddress1SQL = 'NULL'; $Baddress1='NULL';} + if (defined $aryB[17]) {$Baddress2 = $aryB[17]; $Baddress2SQL = "\"$aryB[17]\"";} + else {$Baddress2SQL = 'NULL'; $Baddress2='NULL';} + if (defined $aryB[18]) {$Baddress3 = $aryB[18]; $Baddress3SQL = "\"$aryB[18]\"";} + else {$Baddress3SQL = 'NULL'; $Baddress3='NULL';} + if (defined $aryB[19]) {$Bcity = $aryB[19]; $BcitySQL = "\"$aryB[19]\"";} + else {$BcitySQL = 'NULL'; $Bcity='NULL';} + if (defined $aryB[20]) {$Bstate = $aryB[20]; $BstateSQL = "\"$aryB[20]\"";} + else {$BstateSQL = 'NULL'; $Bstate='NULL';} + if (defined $aryB[21]) {$Bprovince = $aryB[21]; $BprovinceSQL = "\"$aryB[21]\"";} + else {$BprovinceSQL = 'NULL'; $Bprovince='NULL';} + if (defined $aryB[22]) {$Bpostal_code = $aryB[22]; $Bpostal_codeSQL = "\"$aryB[22]\"";} + else {$Bpostal_codeSQL = 'NULL'; $Bpostal_code='NULL';} + if (defined $aryB[23]) {$Bcountry_code = $aryB[23]; $Bcountry_codeSQL = "\"$aryB[23]\"";} + else {$Bcountry_codeSQL = 'NULL'; $Bcountry_code='NULL';} + if (defined $aryB[24]) {$Bgender = $aryB[24]; $BgenderSQL = "\"$aryB[24]\"";} + else {$BgenderSQL = 'NULL'; $Bgender='NULL';} + if (defined $aryB[25]) {$Bdate_of_birth = $aryB[25]; $Bdate_of_birthSQL = "\"$aryB[25]\"";} + else {$Bdate_of_birthSQL = 'NULL'; $Bdate_of_birth='NULL';} + if (defined $aryB[26]) {$Balt_phone = $aryB[26]; $Balt_phoneSQL = "\"$aryB[26]\"";} + else {$Balt_phoneSQL = 'NULL'; $Balt_phone='NULL';} + if (defined $aryB[27]) {$Bemail = $aryB[27]; $BemailSQL = "\"$aryB[27]\"";} + else {$BemailSQL = 'NULL'; $Bemail='NULL';} + if (defined $aryB[28]) {$Bsecurity_phrase = $aryB[28]; $Bsecurity_phraseSQL = "\"$aryB[28]\"";} + else {$Bsecurity_phraseSQL = 'NULL'; $Bsecurity_phrase='NULL';} + if (defined $aryB[29]) {$Bcomments = $aryB[29]; $BcommentsSQL = "\"$aryB[29]\"";} + else {$BcommentsSQL = 'NULL'; $Bcomments='NULL';} + if (defined $aryB[30]) {$Bcalled_count = $aryB[30]; $Bcalled_countSQL = "\"$aryB[30]\"";} + else {$Bcalled_countSQL = 'NULL'; $Bcalled_count='NULL';} + if (defined $aryB[31]) {$Blast_local_call_time = $aryB[31]; $Blast_local_call_timeSQL = "\"$aryB[31]\"";} + else {$Blast_local_call_timeSQL = 'NULL'; $Blast_local_call_time='NULL';} + if (defined $aryB[32]) {$Brank = $aryB[32]; $BrankSQL = "\"$aryB[32]\"";} + else {$BrankSQL = 'NULL'; $Brank='NULL';} + if (defined $aryB[33]) {$Bowner = $aryB[33]; $BownerSQL = "\"$aryB[33]\"";} + else {$BownerSQL = 'NULL'; $Bowner='NULL';} + if (defined $aryB[34]) {$Bentry_list_id = $aryB[34]; $Bentry_list_idSQL = "\"$aryB[34]\"";} + else {$Bentry_list_idSQL = 'NULL'; $Bentry_list_id='NULL';} + + $Bcompare = "$Bentry_date|$Bstatus|$Buser|$Bvendor_lead_code|$Bsource_id|$Blist_id|$Bgmt_offset_now|$Bcalled_since_last_reset|$Bphone_code|$Bphone_number|$Btitle|$Bfirst_name|$Bmiddle_initial|$Blast_name|$Baddress1|$Baddress2|$Baddress3|$Bcity|$Bstate|$Bprovince|$Bpostal_code|$Bcountry_code|$Bgender|$Bdate_of_birth|$Balt_phone|$Bemail|$Bsecurity_phrase|$Bcomments|$Bcalled_count|$Blast_local_call_time|$Brank|$Bowner|$Bentry_list_id"; + } + else + { + if ($update_phase > 0) + { + $update_phase=2; + if ($DBX > 0) {print "DEBUG: No CLR match found for lead $updated_LEADS[$u_ct], inserting instead \n";} + } + } + $sthB->finish(); + + if ($update_phase >= 2) + { + # insert lead into CLR database + + $stmtB = "INSERT INTO vicidial_list SET lead_id='$lead_id',entry_date=$entry_dateSQL,modify_date=$modify_dateSQL,status=$statusSQL,user=$userSQL,vendor_lead_code=$vendor_lead_codeSQL,source_id=$source_idSQL,list_id=$list_idSQL,gmt_offset_now=$gmt_offset_nowSQL,called_since_last_reset=$called_since_last_resetSQL,phone_code=$phone_codeSQL,phone_number=$phone_numberSQL,title=$titleSQL,first_name=$first_nameSQL,middle_initial=$middle_initialSQL,last_name=$last_nameSQL,address1=$address1SQL,address2=$address2SQL,address3=$address3SQL,city=$citySQL,state=$stateSQL,province=$provinceSQL,postal_code=$postal_codeSQL,country_code=$country_codeSQL,gender=$genderSQL,date_of_birth=$date_of_birthSQL,alt_phone=$alt_phoneSQL,email=$emailSQL,security_phrase=$security_phraseSQL,comments=$commentsSQL,called_count=$called_countSQL,last_local_call_time=$last_local_call_timeSQL,rank=$rankSQL,owner=$ownerSQL,entry_list_id=$entry_list_idSQL;"; + $affected_rowsB = $dbhB->do($stmtB); + $CLRinsert_aff = ($CLRinsert_aff + $affected_rowsB); + if ($DBX > 0) {print "DEBUG: CLR lead inserted $updated_LEADS[$u_ct]: $affected_rowsB|$stmtB| \n";} + + $CLRinsert_ct++; + } + else + { + # compare ORIGINAL and CLR lead data to see if update is needed + if ($Acompare eq $Bcompare) + { + $update_phase=0; + if ($DBX > 0) {print "DEBUG: ORIGINAL and CLR lead data is identical: $updated_LEADS[$u_ct] \n";} + } + if ($DBX > 0) {print "$lead_id compare:\n$Acompare \n$Bcompare \n";} + + if ($update_phase >= 1) + { + # update existing lead in CLR database + $stmtB = "UPDATE vicidial_list SET entry_date=$entry_dateSQL,modify_date=$modify_dateSQL,status=$statusSQL,user=$userSQL,vendor_lead_code=$vendor_lead_codeSQL,source_id=$source_idSQL,list_id=$list_idSQL,gmt_offset_now=$gmt_offset_nowSQL,called_since_last_reset=$called_since_last_resetSQL,phone_code=$phone_codeSQL,phone_number=$phone_numberSQL,title=$titleSQL,first_name=$first_nameSQL,middle_initial=$middle_initialSQL,last_name=$last_nameSQL,address1=$address1SQL,address2=$address2SQL,address3=$address3SQL,city=$citySQL,state=$stateSQL,province=$provinceSQL,postal_code=$postal_codeSQL,country_code=$country_codeSQL,gender=$genderSQL,date_of_birth=$date_of_birthSQL,alt_phone=$alt_phoneSQL,email=$emailSQL,security_phrase=$security_phraseSQL,comments=$commentsSQL,called_count=$called_countSQL,last_local_call_time=$last_local_call_timeSQL,rank=$rankSQL,owner=$ownerSQL,entry_list_id=$entry_list_idSQL where lead_id='$lead_id';"; + $affected_rowsB = $dbhB->do($stmtB); + $CLRupdate_aff = ($CLRupdate_aff + $affected_rowsB); + if ($DBX > 0) {print "DEBUG: CLR lead updated $updated_LEADS[$u_ct]: $affected_rowsB|$stmtB| \n";} + + $CLRupdate_ct++; + } + else + { + # no change needed to lead in CLR database + $CLRnochange_ct++; + } + } + + $u_ct++; + if ($Q < 1) + { + if ($u_ct =~ /100$/i) {print STDERR "> $u_ct / $updated_LEADSsize \r";} + if ($u_ct =~ /200$/i) {print STDERR "-> $u_ct / $updated_LEADSsize \r";} + if ($u_ct =~ /300$/i) {print STDERR " -> $u_ct / $updated_LEADSsize \r";} + if ($u_ct =~ /400$/i) {print STDERR " -> $u_ct / $updated_LEADSsize \r";} + if ($u_ct =~ /500$/i) {print STDERR " -> $u_ct / $updated_LEADSsize \r";} + if ($u_ct =~ /600$/i) {print STDERR " -> $u_ct / $updated_LEADSsize \r";} + if ($u_ct =~ /700$/i) {print STDERR " -> $u_ct / $updated_LEADSsize \r";} + if ($u_ct =~ /800$/i) {print STDERR " -> $u_ct / $updated_LEADSsize \r";} + if ($u_ct =~ /900$/i) {print STDERR " -> $u_ct / $updated_LEADSsize \r";} + if ($u_ct =~ /000$/i) {print STDERR " ->$u_ct / $updated_LEADSsize \r";} + if ($u_ct =~ /0000$/i) + { + $secY = time(); + $secZ = ($secY - $secX); + print "$u_ct|$CLRupdate_ct|$CLRinsert_ct|$CLRnochange_ct| $secZ sec \n"; + } + } + } + } + + + $lead_output = "CLR lead updates: $CLRupdate_ct ($CLRupdate_aff) \n"; + $lead_output .= "CLR lead inserts: $CLRinsert_ct ($CLRinsert_aff) \n"; + $lead_output .= "CLR lead no changes: $CLRnochange_ct \n"; + if (!$Q) {print $lead_output;} + + $process_output .= $lead_output; + + $secY = time(); + $secZ = ($secY - $secX); + + # insert clr_log entry into database + $stmtA = "UPDATE clr_log SET phase='$phase',records_ct='$u_ct',length_in_sec='$secZ',processing_log='$process_output' where clr_id='$clr_id';"; + $affected_rowsA = $dbhA->do($stmtA); + } +################################################################################ +##### END incremental or nightly ORIGINAL to CLR db updates +################################################################################ + + + + +################################################################################ +##### BEGIN morning CLR to ORIGINAL db updates +################################################################################ +else + { + if (!$Q) {print "\nStarting Central-Lead-Repository CLR to ORIGINAL process...\n";} + + $clr_id=''; + # insert clr_log entry into database + $stmtA = "INSERT INTO clr_log SET start_time=NOW(),begin_range='$Bdel_time',range_minutes='$CLIminutes',phase='BEGIN',server_ip='$server_ip',processing_log='';"; + $affected_rowsA = $dbhA->do($stmtA); + $stmtC = "SELECT LAST_INSERT_ID() LIMIT 1;"; + $sthA = $dbhA->prepare($stmtC) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtC ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $clr_id = $aryA[0]; + } + $sthA->finish(); + if ($DB) {print "clr_id: $clr_id \n";} + + $vicidial_list_ct=0; + $vicidial_log_ct=0; + $vicidial_closer_log_ct=0; + + $phase='MORNING_UPDATE'; + ### Check if there are any leads modified since X minutes ago + $stmtB = "SELECT count(*) from vicidial_list where modify_date >= \"$Bdel_time\";"; + $sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr; + $sthB->execute or die "executing: $stmtB ", $dbhB->errstr; + $sthBrows=$sthB->rows; + if ($sthBrows > 0) + { + @aryB = $sthB->fetchrow_array; + $vicidial_list_ct = $aryB[0]; + } + $sthB->finish(); + + if ($vicidial_list_ct < 1) + { + if (!$Q) {print "No recent changed leads, nothing to do, exiting... \n";} + exit; + } + else + { + if (!$Q) {print "Recent changed Leads: $vicidial_list_ct \n";} + + $o_ct=0; + $stmtB = "SELECT lead_id from vicidial_list where modify_date >= \"$Bdel_time\" limit 10000000;"; + $sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr; + $sthB->execute or die "executing: $stmtB ", $dbhB->errstr; + $sthBrows=$sthB->rows; + while ($sthBrows > $o_ct) + { + @aryB = $sthB->fetchrow_array; + $updated_LEADS[$o_ct] = $aryB[0]; + $o_ct++; + } + $sthB->finish(); + $updated_LEADSsize = $o_ct; + + ### loop through all leads, gather lead data, compare to record on CLR server, update/insert if needed + $u_ct=0; + $CLRupdate_ct=0; $CLRupdate_aff=0; + $CLRreverse_update_ct=0; $CLRreverse_update_aff=0; + $CLRinsert_ct=0; $CLRinsert_aff=0; + $CLRnochange_ct=0; + while ($updated_LEADSsize > $u_ct) + { + $update_phase=1; + # gather lead data from CLR database + $stmtB = "SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id,UNIX_TIMESTAMP(modify_date) from vicidial_list where lead_id=$updated_LEADS[$u_ct];"; + $sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr; + $sthB->execute or die "executing: $stmtB ", $dbhB->errstr; + $sthBrows=$sthB->rows; + if ($sthBrows > 0) + { + @aryB = $sthB->fetchrow_array; + $lead_id = $aryB[0]; + if (defined $aryB[1]) {$entry_date = $aryB[1]; $entry_dateSQL = "\"$aryB[1]\"";} + else {$entry_dateSQL = 'NULL'; $entry_date='NULL';} + if (defined $aryB[2]) {$modify_date = $aryB[2]; $modify_dateSQL = "\"$aryB[2]\"";} + else {$modify_dateSQL = 'NULL'; $modify_date='NULL';} + if (defined $aryB[3]) {$status = $aryB[3]; $statusSQL = "\"$aryB[3]\"";} + else {$statusSQL = 'NULL'; $status='NULL';} + if (defined $aryB[4]) {$user = $aryB[4]; $userSQL = "\"$aryB[4]\"";} + else {$userSQL = 'NULL'; $user='NULL';} + if (defined $aryB[5]) {$vendor_lead_code = $aryB[5]; $vendor_lead_codeSQL = "\"$aryB[5]\"";} + else {$vendor_lead_codeSQL = 'NULL'; $vendor_lead_code='NULL';} + if (defined $aryB[6]) {$source_id = $aryB[6]; $source_idSQL = "\"$aryB[6]\"";} + else {$source_idSQL = 'NULL'; $source_id='NULL';} + if (defined $aryB[7]) {$list_id = $aryB[7]; $list_idSQL = "\"$aryB[7]\"";} + else {$list_idSQL = 'NULL'; $list_id='NULL';} + if (defined $aryB[8]) {$gmt_offset_now = $aryB[8]; $gmt_offset_nowSQL = "\"$aryB[8]\"";} + else {$gmt_offset_nowSQL = 'NULL'; $gmt_offset_now='NULL';} + if (defined $aryB[9]) {$called_since_last_reset = $aryB[9]; $called_since_last_resetSQL = "\"$aryB[9]\"";} + else {$called_since_last_resetSQL = 'NULL'; $called_since_last_reset='NULL';} + if (defined $aryB[10]) {$phone_code = $aryB[10]; $phone_codeSQL = "\"$aryB[10]\"";} + else {$phone_codeSQL = 'NULL'; $phone_code='NULL';} + if (defined $aryB[11]) {$phone_number = $aryB[11]; $phone_numberSQL = "\"$aryB[11]\"";} + else {$phone_numberSQL = 'NULL'; $phone_number='NULL';} + if (defined $aryB[12]) {$title = $aryB[12]; $titleSQL = "\"$aryB[12]\"";} + else {$titleSQL = 'NULL'; $title='NULL';} + if (defined $aryB[13]) {$first_name = $aryB[13]; $first_nameSQL = "\"$aryB[13]\"";} + else {$first_nameSQL = 'NULL'; $first_name='NULL';} + if (defined $aryB[14]) {$middle_initial = $aryB[14]; $middle_initialSQL = "\"$aryB[14]\"";} + else {$middle_initialSQL = 'NULL'; $middle_initial='NULL';} + if (defined $aryB[15]) {$last_name = $aryB[15]; $last_nameSQL = "\"$aryB[15]\"";} + else {$last_nameSQL = 'NULL'; $last_name='NULL';} + if (defined $aryB[16]) {$address1 = $aryB[16]; $address1SQL = "\"$aryB[16]\"";} + else {$address1SQL = 'NULL'; $address1='NULL';} + if (defined $aryB[17]) {$address2 = $aryB[17]; $address2SQL = "\"$aryB[17]\"";} + else {$address2SQL = 'NULL'; $address2='NULL';} + if (defined $aryB[18]) {$address3 = $aryB[18]; $address3SQL = "\"$aryB[18]\"";} + else {$address3SQL = 'NULL'; $address3='NULL';} + if (defined $aryB[19]) {$city = $aryB[19]; $citySQL = "\"$aryB[19]\"";} + else {$citySQL = 'NULL'; $city='NULL';} + if (defined $aryB[20]) {$state = $aryB[20]; $stateSQL = "\"$aryB[20]\"";} + else {$stateSQL = 'NULL'; $state='NULL';} + if (defined $aryB[21]) {$province = $aryB[21]; $provinceSQL = "\"$aryB[21]\"";} + else {$provinceSQL = 'NULL'; $province='NULL';} + if (defined $aryB[22]) {$postal_code = $aryB[22]; $postal_codeSQL = "\"$aryB[22]\"";} + else {$postal_codeSQL = 'NULL'; $postal_code='NULL';} + if (defined $aryB[23]) {$country_code = $aryB[23]; $country_codeSQL = "\"$aryB[23]\"";} + else {$country_codeSQL = 'NULL'; $country_code='NULL';} + if (defined $aryB[24]) {$gender = $aryB[24]; $genderSQL = "\"$aryB[24]\"";} + else {$genderSQL = 'NULL'; $gender='NULL';} + if (defined $aryB[25]) {$date_of_birth = $aryB[25]; $date_of_birthSQL = "\"$aryB[25]\"";} + else {$date_of_birthSQL = 'NULL'; $date_of_birth='NULL';} + if (defined $aryB[26]) {$alt_phone = $aryB[26]; $alt_phoneSQL = "\"$aryB[26]\"";} + else {$alt_phoneSQL = 'NULL'; $alt_phone='NULL';} + if (defined $aryB[27]) {$email = $aryB[27]; $emailSQL = "\"$aryB[27]\"";} + else {$emailSQL = 'NULL'; $email='NULL';} + if (defined $aryB[28]) {$security_phrase = $aryB[28]; $security_phraseSQL = "\"$aryB[28]\"";} + else {$security_phraseSQL = 'NULL'; $security_phrase='NULL';} + if (defined $aryB[29]) {$comments = $aryB[29]; $commentsSQL = "\"$aryB[29]\"";} + else {$commentsSQL = 'NULL'; $comments='NULL';} + if (defined $aryB[30]) {$called_count = $aryB[30]; $called_countSQL = "\"$aryB[30]\"";} + else {$called_countSQL = 'NULL'; $called_count='NULL';} + if (defined $aryB[31]) {$last_local_call_time = $aryB[31]; $last_local_call_timeSQL = "\"$aryB[31]\"";} + else {$last_local_call_timeSQL = 'NULL'; $last_local_call_time='NULL';} + if (defined $aryB[32]) {$rank = $aryB[32]; $rankSQL = "\"$aryB[32]\"";} + else {$rankSQL = 'NULL'; $rank='NULL';} + if (defined $aryB[33]) {$owner = $aryB[33]; $ownerSQL = "\"$aryB[33]\"";} + else {$ownerSQL = 'NULL'; $owner='NULL';} + if (defined $aryB[34]) {$entry_list_id = $aryB[34]; $entry_list_idSQL = "\"$aryB[34]\"";} + else {$entry_list_idSQL = 'NULL'; $entry_list_id='NULL';} + $Amodify_epoch = $aryB[35]; + $Acompare = "$entry_date|$status|$user|$vendor_lead_code|$source_id|$list_id|$gmt_offset_now|$called_since_last_reset|$phone_code|$phone_number|$title|$first_name|$middle_initial|$last_name|$address1|$address2|$address3|$city|$state|$province|$postal_code|$country_code|$gender|$date_of_birth|$alt_phone|$email|$security_phrase|$comments|$called_count|$last_local_call_time|$rank|$owner|$entry_list_id"; + } + else + { + $update_phase=0; + if ($DBX > 0) + {print "DEBUG: No CLR lead found for lead $updated_LEADS[$u_ct], skipping \n";} + } + $sthB->finish(); + + # gather lead data from ORIGINAL database + $stmtA = "SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id,UNIX_TIMESTAMP(modify_date) from vicidial_list where lead_id=$updated_LEADS[$u_ct];"; + $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; + $Blead_id = $aryA[0]; + if (defined $aryA[1]) {$Bentry_date = $aryA[1]; $Bentry_dateSQL = "\"$aryA[1]\"";} + else {$Bentry_dateSQL = 'NULL'; $Bentry_date='NULL';} + if (defined $aryA[2]) {$Bmodify_date = $aryA[2]; $Bmodify_dateSQL = "\"$aryA[2]\"";} + else {$Bmodify_dateSQL = 'NULL'; $Bmodify_date='NULL';} + if (defined $aryA[3]) {$Bstatus = $aryA[3]; $BstatusSQL = "\"$aryA[3]\"";} + else {$BstatusSQL = 'NULL'; $Bstatus='NULL';} + if (defined $aryA[4]) {$Buser = $aryA[4]; $BuserSQL = "\"$aryA[4]\"";} + else {$BuserSQL = 'NULL'; $Buser='NULL';} + if (defined $aryA[5]) {$Bvendor_lead_code = $aryA[5]; $Bvendor_lead_codeSQL = "\"$aryA[5]\"";} + else {$Bvendor_lead_codeSQL = 'NULL'; $Bvendor_lead_code='NULL';} + if (defined $aryA[6]) {$Bsource_id = $aryA[6]; $Bsource_idSQL = "\"$aryA[6]\"";} + else {$Bsource_idSQL = 'NULL'; $Bsource_id='NULL';} + if (defined $aryA[7]) {$Blist_id = $aryA[7]; $Blist_idSQL = "\"$aryA[7]\"";} + else {$Blist_idSQL = 'NULL'; $Blist_id='NULL';} + if (defined $aryA[8]) {$Bgmt_offset_now = $aryA[8]; $Bgmt_offset_nowSQL = "\"$aryA[8]\"";} + else {$Bgmt_offset_nowSQL = 'NULL'; $Bgmt_offset_now='NULL';} + if (defined $aryA[9]) {$Bcalled_since_last_reset = $aryA[9]; $Bcalled_since_last_resetSQL = "\"$aryA[9]\"";} + else {$Bcalled_since_last_resetSQL = 'NULL'; $Bcalled_since_last_reset='NULL';} + if (defined $aryA[10]) {$Bphone_code = $aryA[10]; $Bphone_codeSQL = "\"$aryA[10]\"";} + else {$Bphone_codeSQL = 'NULL'; $Bphone_code='NULL';} + if (defined $aryA[11]) {$Bphone_number = $aryA[11]; $Bphone_numberSQL = "\"$aryA[11]\"";} + else {$Bphone_numberSQL = 'NULL'; $Bphone_number='NULL';} + if (defined $aryA[12]) {$Btitle = $aryA[12]; $BtitleSQL = "\"$aryA[12]\"";} + else {$BtitleSQL = 'NULL'; $Btitle='NULL';} + if (defined $aryA[13]) {$Bfirst_name = $aryA[13]; $Bfirst_nameSQL = "\"$aryA[13]\"";} + else {$Bfirst_nameSQL = 'NULL'; $Bfirst_name='NULL';} + if (defined $aryA[14]) {$Bmiddle_initial = $aryA[14]; $Bmiddle_initialSQL = "\"$aryA[14]\"";} + else {$Bmiddle_initialSQL = 'NULL'; $Bmiddle_initial='NULL';} + if (defined $aryA[15]) {$Blast_name = $aryA[15]; $Blast_nameSQL = "\"$aryA[15]\"";} + else {$Blast_nameSQL = 'NULL'; $Blast_name='NULL';} + if (defined $aryA[16]) {$Baddress1 = $aryA[16]; $Baddress1SQL = "\"$aryA[16]\"";} + else {$Baddress1SQL = 'NULL'; $Baddress1='NULL';} + if (defined $aryA[17]) {$Baddress2 = $aryA[17]; $Baddress2SQL = "\"$aryA[17]\"";} + else {$Baddress2SQL = 'NULL'; $Baddress2='NULL';} + if (defined $aryA[18]) {$Baddress3 = $aryA[18]; $Baddress3SQL = "\"$aryA[18]\"";} + else {$Baddress3SQL = 'NULL'; $Baddress3='NULL';} + if (defined $aryA[19]) {$Bcity = $aryA[19]; $BcitySQL = "\"$aryA[19]\"";} + else {$BcitySQL = 'NULL'; $Bcity='NULL';} + if (defined $aryA[20]) {$Bstate = $aryA[20]; $BstateSQL = "\"$aryA[20]\"";} + else {$BstateSQL = 'NULL'; $Bstate='NULL';} + if (defined $aryA[21]) {$Bprovince = $aryA[21]; $BprovinceSQL = "\"$aryA[21]\"";} + else {$BprovinceSQL = 'NULL'; $Bprovince='NULL';} + if (defined $aryA[22]) {$Bpostal_code = $aryA[22]; $Bpostal_codeSQL = "\"$aryA[22]\"";} + else {$Bpostal_codeSQL = 'NULL'; $Bpostal_code='NULL';} + if (defined $aryA[23]) {$Bcountry_code = $aryA[23]; $Bcountry_codeSQL = "\"$aryA[23]\"";} + else {$Bcountry_codeSQL = 'NULL'; $Bcountry_code='NULL';} + if (defined $aryA[24]) {$Bgender = $aryA[24]; $BgenderSQL = "\"$aryA[24]\"";} + else {$BgenderSQL = 'NULL'; $Bgender='NULL';} + if (defined $aryA[25]) {$Bdate_of_birth = $aryA[25]; $Bdate_of_birthSQL = "\"$aryA[25]\"";} + else {$Bdate_of_birthSQL = 'NULL'; $Bdate_of_birth='NULL';} + if (defined $aryA[26]) {$Balt_phone = $aryA[26]; $Balt_phoneSQL = "\"$aryA[26]\"";} + else {$Balt_phoneSQL = 'NULL'; $Balt_phone='NULL';} + if (defined $aryA[27]) {$Bemail = $aryA[27]; $BemailSQL = "\"$aryA[27]\"";} + else {$BemailSQL = 'NULL'; $Bemail='NULL';} + if (defined $aryA[28]) {$Bsecurity_phrase = $aryA[28]; $Bsecurity_phraseSQL = "\"$aryA[28]\"";} + else {$Bsecurity_phraseSQL = 'NULL'; $Bsecurity_phrase='NULL';} + if (defined $aryA[29]) {$Bcomments = $aryA[29]; $BcommentsSQL = "\"$aryA[29]\"";} + else {$BcommentsSQL = 'NULL'; $Bcomments='NULL';} + if (defined $aryA[30]) {$Bcalled_count = $aryA[30]; $Bcalled_countSQL = "\"$aryA[30]\"";} + else {$Bcalled_countSQL = 'NULL'; $Bcalled_count='NULL';} + if (defined $aryA[31]) {$Blast_local_call_time = $aryA[31]; $Blast_local_call_timeSQL = "\"$aryA[31]\"";} + else {$Blast_local_call_timeSQL = 'NULL'; $Blast_local_call_time='NULL';} + if (defined $aryA[32]) {$Brank = $aryA[32]; $BrankSQL = "\"$aryA[32]\"";} + else {$BrankSQL = 'NULL'; $Brank='NULL';} + if (defined $aryA[33]) {$Bowner = $aryA[33]; $BownerSQL = "\"$aryA[33]\"";} + else {$BownerSQL = 'NULL'; $Bowner='NULL';} + if (defined $aryA[34]) {$Bentry_list_id = $aryA[34]; $Bentry_list_idSQL = "\"$aryA[34]\"";} + else {$Bentry_list_idSQL = 'NULL'; $Bentry_list_id='NULL';} + $Bmodify_epoch = $aryA[35]; + + $Bcompare = "$Bentry_date|$Bstatus|$Buser|$Bvendor_lead_code|$Bsource_id|$Blist_id|$Bgmt_offset_now|$Bcalled_since_last_reset|$Bphone_code|$Bphone_number|$Btitle|$Bfirst_name|$Bmiddle_initial|$Blast_name|$Baddress1|$Baddress2|$Baddress3|$Bcity|$Bstate|$Bprovince|$Bpostal_code|$Bcountry_code|$Bgender|$Bdate_of_birth|$Balt_phone|$Bemail|$Bsecurity_phrase|$Bcomments|$Bcalled_count|$Blast_local_call_time|$Brank|$Bowner|$Bentry_list_id"; + } + else + { + if ($update_phase > 0) + { + $update_phase=2; + if ($DBX > 0) {print "DEBUG: No ORIGINAL match found for lead $updated_LEADS[$u_ct], inserting instead \n";} + } + } + $sthA->finish(); + + if ($update_phase >= 2) + { + # insert lead into ORIGINAL database + + $stmtA = "INSERT INTO vicidial_list SET lead_id='$lead_id',entry_date=$entry_dateSQL,modify_date=$modify_dateSQL,status=$statusSQL,user=$userSQL,vendor_lead_code=$vendor_lead_codeSQL,source_id=$source_idSQL,list_id=$list_idSQL,gmt_offset_now=$gmt_offset_nowSQL,called_since_last_reset=$called_since_last_resetSQL,phone_code=$phone_codeSQL,phone_number=$phone_numberSQL,title=$titleSQL,first_name=$first_nameSQL,middle_initial=$middle_initialSQL,last_name=$last_nameSQL,address1=$address1SQL,address2=$address2SQL,address3=$address3SQL,city=$citySQL,state=$stateSQL,province=$provinceSQL,postal_code=$postal_codeSQL,country_code=$country_codeSQL,gender=$genderSQL,date_of_birth=$date_of_birthSQL,alt_phone=$alt_phoneSQL,email=$emailSQL,security_phrase=$security_phraseSQL,comments=$commentsSQL,called_count=$called_countSQL,last_local_call_time=$last_local_call_timeSQL,rank=$rankSQL,owner=$ownerSQL,entry_list_id=$entry_list_idSQL;"; + # $affected_rowsA = $dbhA->do($stmtA); + $CLRinsert_aff = ($CLRinsert_aff + $affected_rowsA); + if ($DBX > 0) {print "DEBUG: CLR lead inserted $updated_LEADS[$u_ct]: $affected_rowsA|$stmtA| \n";} + + $CLRinsert_ct++; + } + else + { + # compare ORIGINAL and CLR lead data to see if update is needed + if ($Acompare eq $Bcompare) + { + $update_phase=0; + if ($DBX > 0) {print "DEBUG: ORIGINAL and CLR lead data is identical: $updated_LEADS[$u_ct] \n";} + } + if ($DBX > 0) {print "$lead_id compare:\n$Acompare \n$Bcompare \n";} + + if ($update_phase >= 1) + { + # If ORIGINAL is newer than CLR record, than update the CLR record instead + if ($Amodify_epoch < $Bmodify_epoch) + { + if ($DBX > 0) {print "REVERSE UPDATE: ORIGINAL to CLR ($Amodify_epoch < $Bmodify_epoch): $updated_LEADS[$u_ct] \n";} + + $stmtB = "UPDATE vicidial_list SET entry_date=$Bentry_dateSQL,modify_date=$Bmodify_dateSQL,status=$BstatusSQL,user=$BuserSQL,vendor_lead_code=$Bvendor_lead_codeSQL,source_id=$Bsource_idSQL,list_id=$Blist_idSQL,gmt_offset_now=$Bgmt_offset_nowSQL,called_since_last_reset=$Bcalled_since_last_resetSQL,phone_code=$Bphone_codeSQL,phone_number=$Bphone_numberSQL,title=$BtitleSQL,first_name=$Bfirst_nameSQL,middle_initial=$Bmiddle_initialSQL,last_name=$Blast_nameSQL,address1=$Baddress1SQL,address2=$Baddress2SQL,address3=$Baddress3SQL,city=$BcitySQL,state=$BstateSQL,province=$BprovinceSQL,postal_code=$Bpostal_codeSQL,country_code=$Bcountry_codeSQL,gender=$BgenderSQL,date_of_birth=$Bdate_of_birthSQL,alt_phone=$Balt_phoneSQL,email=$BemailSQL,security_phrase=$Bsecurity_phraseSQL,comments=$BcommentsSQL,called_count=$Bcalled_countSQL,last_local_call_time=$Blast_local_call_timeSQL,rank=$BrankSQL,owner=$BownerSQL,entry_list_id=$Bentry_list_idSQL where lead_id='$lead_id';"; + $affected_rowsB = $dbhB->do($stmtB); + $CLRreverse_update_aff = ($CLRreverse_update_aff + $affected_rowsB); + if ($DBX > 0) {print "DEBUG: CLR lead updated $updated_LEADS[$u_ct]: $affected_rowsB|$stmtB| \n";} + + $CLRreverse_update_ct++; + } + else + { + # update existing lead in ORIGINAL database + $stmtA = "UPDATE vicidial_list SET entry_date=$entry_dateSQL,modify_date=$modify_dateSQL,status=$statusSQL,user=$userSQL,vendor_lead_code=$vendor_lead_codeSQL,source_id=$source_idSQL,list_id=$list_idSQL,gmt_offset_now=$gmt_offset_nowSQL,called_since_last_reset=$called_since_last_resetSQL,phone_code=$phone_codeSQL,phone_number=$phone_numberSQL,title=$titleSQL,first_name=$first_nameSQL,middle_initial=$middle_initialSQL,last_name=$last_nameSQL,address1=$address1SQL,address2=$address2SQL,address3=$address3SQL,city=$citySQL,state=$stateSQL,province=$provinceSQL,postal_code=$postal_codeSQL,country_code=$country_codeSQL,gender=$genderSQL,date_of_birth=$date_of_birthSQL,alt_phone=$alt_phoneSQL,email=$emailSQL,security_phrase=$security_phraseSQL,comments=$commentsSQL,called_count=$called_countSQL,last_local_call_time=$last_local_call_timeSQL,rank=$rankSQL,owner=$ownerSQL,entry_list_id=$entry_list_idSQL where lead_id='$lead_id';"; + # $affected_rowsA = $dbhA->do($stmtA); + $CLRupdate_aff = ($CLRupdate_aff + $affected_rowsA); + if ($DB > 0) {print "DEBUG: CLR lead updated $updated_LEADS[$u_ct]: $affected_rowsA|$stmtA| \n";} + + $CLRupdate_ct++; + } + } + else + { + # no change needed to lead in CLR database + $CLRnochange_ct++; + } + } + + $u_ct++; + if ($Q < 1) + { + if ($u_ct =~ /000$/i) {print STDERR " <$u_ct / $updated_LEADSsize \r";} + if ($u_ct =~ /100$/i) {print STDERR " < $u_ct / $updated_LEADSsize \r";} + if ($u_ct =~ /200$/i) {print STDERR " <- $u_ct / $updated_LEADSsize \r";} + if ($u_ct =~ /300$/i) {print STDERR " <- $u_ct / $updated_LEADSsize \r";} + if ($u_ct =~ /400$/i) {print STDERR " <- $u_ct / $updated_LEADSsize \r";} + if ($u_ct =~ /500$/i) {print STDERR " <- $u_ct / $updated_LEADSsize \r";} + if ($u_ct =~ /600$/i) {print STDERR " <- $u_ct / $updated_LEADSsize \r";} + if ($u_ct =~ /700$/i) {print STDERR " <- $u_ct / $updated_LEADSsize \r";} + if ($u_ct =~ /800$/i) {print STDERR " <- $u_ct / $updated_LEADSsize \r";} + if ($u_ct =~ /900$/i) {print STDERR "<- $u_ct / $updated_LEADSsize \r";} + if ($u_ct =~ /0000$/i) + { + $secY = time(); + $secZ = ($secY - $secX); + print "$u_ct|$CLRupdate_ct/$CLRreverse_update_ct|$CLRinsert_ct|$CLRnochange_ct| $secZ sec \n"; + } + } + } + } + + + $lead_output = "ORIGINAL lead updates: $CLRupdate_ct ($CLRupdate_aff) \n"; + $lead_output .= "REV CLR lead updates: $CLRreverse_update_ct ($CLRreverse_update_aff) \n"; + $lead_output .= "ORIGINAL lead inserts: $CLRinsert_ct ($CLRinsert_aff) \n"; + $lead_output .= "ORIGINAL lead no changes: $CLRnochange_ct \n"; + if (!$Q) {print $lead_output;} + + $process_output .= $lead_output; + + $secY = time(); + $secZ = ($secY - $secX); + + # insert clr_log entry into database + $stmtA = "UPDATE clr_log SET phase='$phase',records_ct='$u_ct',length_in_sec='$secZ',processing_log='$process_output' where clr_id='$clr_id';"; + $affected_rowsA = $dbhA->do($stmtA); + } +################################################################################ +##### END morning CLR to ORIGINAL db updates +################################################################################ + + + + + + + + + + + + + + + + + + + +### calculate time to run script ### +$secY = time(); +$secZ = ($secY - $secX); +$secZm = ($secZ /60); +if (!$Q) {print "\nscript execution time in seconds: $secZ minutes: $secZm\n";} + +exit; + + + + + +################################################################################ +##### SUBROUTINES +################################################################################ + +sub populate_main_section + { + # break out settings into local variables + $temp_type = $temp_type_ARY[$v]; + $temp_typeS = $temp_typeS_ARY[$v]; + $temp_table = $temp_table_ARY[$v]; + $temp_id_field = $temp_id_field_ARY[$v]; + $temp_date_check_SQL = $temp_date_check_SQL_ARY[$v]; + $temp_first_fields = $temp_first_fields_ARY[$v]; + $temp_date_field = $temp_date_field_ARY[$v]; + $fields_skip_list = $fields_skip_list_ARY[$v]; + $fields_insert_list = $fields_insert_list_ARY[$v]; + $SUBS_tables_list = $SUBS_tables_list_ARY[$v]; + $SUBS_delete_first = $SUBS_delete_first_ARY[$v]; + $SUBS_tables_details = $SUBS_tables_details_ARY[$v]; + @SUBS_tables_details_split = split(/,/,$SUBS_tables_details); + $SUBS_tables_details_split_rows = scalar(@SUBS_tables_details_split); + $d_ct=0; + while ($d_ct < $SUBS_tables_details_split_rows) + { + @SUBS_tables_details_detail = split(/---/,$SUBS_tables_details_split[$d_ct]); + $SUB_table[$d_ct] = $SUBS_tables_details_detail[0]; + $SUB_fields[$d_ct] = $SUBS_tables_details_detail[1]; + $d_ct++; + } + if ($d_ct < 1) + { + @SUB_table=@MT; + @SUB_fields=@MT; + } + + ######################################################## + ### BEGIN Check if there are any MAIN changes within the previous X minutes, or ALL + $vicidial_main_ct=0; + $stmtA = "SELECT count(*) from $temp_table where $temp_date_check_SQL;"; + if ($ALL_SETTINGS > 0) + {$stmtA = "SELECT count(*) from $temp_table;"; $process_options.='ALL_SETTINGS';} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $vicidial_main_ct = $aryA[0]; + } + $sthA->finish(); + + if ( ($vicidial_main_ct < 1) ) + { + if (!$Q) {print "No $temp_type updated recently, nothing to do, skipping... \n";} + } + else + { + if (!$Q) {print "Recent changes - $temp_type: $vicidial_main_ct \n";} + + $o_ct=0; + $stmtA = "SELECT $temp_first_fields from $temp_table where $temp_date_check_SQL limit 10000000;"; + if ($ALL_SETTINGS > 0) + {$stmtA = "SELECT $temp_first_fields from $temp_table;";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + while ($sthArows > $o_ct) + { + @aryA = $sthA->fetchrow_array; + $updated_MAINS[$o_ct] = $aryA[0]; + $updated_MAINSepoch[$o_ct] = $aryA[2]; + $o_ct++; + } + $sthA->finish(); + $updated_MAINSsize = $o_ct; + + ### loop through all mains, compare to record on CLR server, update/insert if needed + $u_ct=0; + $CLRupdate_ct=0; $CLRupdate_aff=0; + $CLRinsert_ct=0; $CLRinsert_aff=0; + $CLRskip_ct=0; + $CLRnochange_ct=0; + $MAIN_updated=0; + while ($updated_MAINSsize > $u_ct) + { + $o_ct=0; + $fields_list=''; + $stmtA = "SHOW COLUMNS from $temp_table;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + while ($sthArows > $o_ct) + { + @aryA = $sthA->fetchrow_array; + $fields_list .= "$aryA[0],"; + $o_ct++; + } + $sthA->finish(); + $fields_list =~ s/,$//gi; + + $update_phase=1; + # gather main data from ORIGINAL database + $stmtA = "SELECT $fields_list from $temp_table where $temp_id_field='$updated_MAINS[$u_ct]';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @proc_fields = split(/,/,$fields_list); + $proc_fields_size = @proc_fields; + $proc_skip_fields = ",$fields_skip_list,"; + $AupdateSQL=''; + $Acompare=''; + $p_ct=0; + @aryA = $sthA->fetchrow_array; + while($proc_fields_size > $p_ct) + { + if ($proc_skip_fields =~ /,$proc_fields[$p_ct],/) + {if ($DBX > 0) {print "SKIP $p_ct|$proc_fields[$p_ct]|$aryA[$p_ct]| \n";}} + else + { + if (defined $aryA[$p_ct]) + { + $temp_field = $aryA[$p_ct]; + $temp_fieldSQL = "\"$temp_field\""; + } + else + { + $temp_field='NULL'; + $temp_fieldSQL = 'NULL'; + } + $Acompare .= "$temp_field|"; + $AupdateSQL .= "$proc_fields[$p_ct]=$temp_fieldSQL,"; + } + $p_ct++; + } + $AupdateSQL =~ s/,$//gi; + } + else + { + $update_phase=0; + if ($DBX > 0) + {print "DEBUG: No ORIGINAL $temp_typeS found for $temp_typeS $updated_MAINS[$u_ct], skipping \n";} + } + $sthA->finish(); + + # gather main data from CLR database + $stmtB = "SELECT $fields_list,UNIX_TIMESTAMP($temp_date_field) from $temp_table where $temp_id_field='$updated_MAINS[$u_ct]';"; + $sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr; + $sthB->execute or die "executing: $stmtB ", $dbhB->errstr; + $sthBrows=$sthB->rows; + if ($sthBrows > 0) + { + $BupdateSQL=''; + $Bcompare=''; + $Bupdated_MAINSepoch=0; + $p_ct=0; + @aryB = $sthB->fetchrow_array; + while($proc_fields_size > $p_ct) + { + if ($proc_skip_fields =~ /,$proc_fields[$p_ct],/) + {if ($DBX > 0) {print "SKIP $p_ct|$proc_fields[$p_ct]|$aryA[$p_ct]| \n";}} + else + { + if (defined $aryB[$p_ct]) + { + $temp_field = $aryB[$p_ct]; + $temp_fieldSQL = "\"$temp_field\""; + } + else + { + $temp_field='NULL'; + $temp_fieldSQL = 'NULL'; + } + $Bcompare .= "$temp_field|"; + $BupdateSQL .= "$proc_fields[$p_ct]=$temp_fieldSQL,"; + } + $p_ct++; + $Bupdated_MAINSepoch = $aryB[$p_ct]; + } + $BupdateSQL =~ s/,$//gi; + } + else + { + if ($update_phase > 0) + { + $update_phase=2; + if ($DBX > 0) {print "DEBUG: No CLR match found for $temp_typeS $updated_MAINS[$u_ct], inserting instead \n";} + } + } + $sthB->finish(); + + if ($update_phase >= 2) + { + # insert main into CLR database + + $stmtB = "INSERT IGNORE INTO $temp_table SET $temp_id_field='$updated_MAINS[$u_ct]'$fields_insert_list,$AupdateSQL;"; + $affected_rowsB = $dbhB->do($stmtB); + $CLRinsert_aff = ($CLRinsert_aff + $affected_rowsB); + if ($DBX > 0) {print "DEBUG: CLR $temp_typeS inserted $updated_MAINS[$u_ct]: $affected_rowsB|$stmtB| \n";} + + $CLRinsert_ct++; + $MAIN_updated++; + } + else + { + # compare ORIGINAL and CLR main data to see if update is needed + if ($Acompare eq $Bcompare) + { + $update_phase=0; + if ($DBX > 0) {print "DEBUG: ORIGINAL and CLR $temp_typeS data is identical: $updated_MAINS[$u_ct] \n";} + if ($ALL_SETTINGS > 0) + {$MAIN_updated++;} + } + if ($DBX > 0) {print "$updated_MAINS[$u_ct] compare:\n$Acompare \n$Bcompare \n";} + + if ($update_phase >= 1) + { + if ($updated_MAINSepoch[$u_ct] < $Bupdated_MAINSepoch) + { + if ($DBX > 0) {print "DEBUG: CLR $temp_typeS record is newer than ORIGINAL: $updated_MAINS[$u_ct] ($updated_MAINSepoch[$u_ct] > $Bupdated_MAINSepoch) \n";} + $CLRskip_ct++; + } + else + { + if ($DBX > 0) {print "DEBUG: CLR $temp_typeS record is older or same age as ORIGINAL: $updated_MAINS[$u_ct] ($updated_MAINSepoch[$u_ct] > $Bupdated_MAINSepoch) \n";} + # update existing main in CLR database + $stmtB = "UPDATE $temp_table SET $AupdateSQL where $temp_id_field='$updated_MAINS[$u_ct]';"; + $affected_rowsB = $dbhB->do($stmtB); + $CLRupdate_aff = ($CLRupdate_aff + $affected_rowsB); + if ($DBX > 0) {print "DEBUG: CLR $temp_typeS updated $updated_MAINS[$u_ct]: $affected_rowsB|$stmtB| \n";} + + $CLRupdate_ct++; + $MAIN_updated++; + } + } + else + { + # no change needed to main in CLR database + $CLRnochange_ct++; + } + } + + ### If main has been updated or inserted, then insert/update the statuses/hotkeys/pause-codes/presets/etc... data for this main + if ( ($MAIN_updated > 0) && (length($SUBS_tables_list) > 5) ) + { + # subs-table processing goes here + @subs_to_process = split(/,/,$SUBS_tables_list); + + $sub_ct=0; + foreach(@subs_to_process) + { + if ($DBX > 0) {print "DEBUG: sub-category to process: $subs_to_process[$sub_ct] \n";} + + if ( ($SUBS_delete_first > 0) && ($ALL_SETTINGS > 0) ) + { + # delete and optimize all secondary records from the CLR database for this MAIN before re-populating + $stmtB = "DELETE from $subs_to_process[$sub_ct] WHERE $temp_id_field='$updated_MAINS[$u_ct]';"; + # $affected_rowsB = $dbhB->do($stmtB); + $CLRupdate_aff = ($CLRupdate_aff + $affected_rowsB); + if ($DB > 0) {print "DEBUG: CLR $subs_to_process[$sub_ct] purged: $affected_rowsB|$stmtB| \n";} + + $stmtB = "OPTIMIZE TABLE $subs_to_process[$sub_ct];"; + # $affected_rowsB = $dbhB->do($stmtB); + $CLRupdate_aff = ($CLRupdate_aff + $affected_rowsB); + if ($DB > 0) {print "DEBUG: CLR $subs_to_process[$sub_ct] optimized: $affected_rowsB|$stmtB| \n";} + } + + $temp_subs_table = $subs_to_process[$sub_ct]; + $temp_subs_fields = $SUB_table[$sub_ct]; + + &populate_subs_section; + + $sub_ct++; + } + } + + $u_ct++; + if ($Q < 1) + { + if ($u_ct =~ /100$/i) {print STDERR "> $u_ct / $updated_MAINSsize \r";} + if ($u_ct =~ /200$/i) {print STDERR "-> $u_ct / $updated_MAINSsize \r";} + if ($u_ct =~ /300$/i) {print STDERR " -> $u_ct / $updated_MAINSsize \r";} + if ($u_ct =~ /400$/i) {print STDERR " -> $u_ct / $updated_MAINSsize \r";} + if ($u_ct =~ /500$/i) {print STDERR " -> $u_ct / $updated_MAINSsize \r";} + if ($u_ct =~ /600$/i) {print STDERR " -> $u_ct / $updated_MAINSsize \r";} + if ($u_ct =~ /700$/i) {print STDERR " -> $u_ct / $updated_MAINSsize \r";} + if ($u_ct =~ /800$/i) {print STDERR " -> $u_ct / $updated_MAINSsize \r";} + if ($u_ct =~ /900$/i) {print STDERR " -> $u_ct / $updated_MAINSsize \r";} + if ($u_ct =~ /000$/i) {print STDERR " ->$u_ct / $updated_MAINSsize \r";} + if ($u_ct =~ /0000$/i) + { + $secY = time(); + $secZ = ($secY - $secX); + print "$u_ct|$CLRupdate_ct|$CLRinsert_ct|$CLRnochange_ct| $secZ sec \n"; + } + } + } + } + + $lead_output = "CLR $temp_typeS updates: $CLRupdate_ct ($CLRupdate_aff) \n"; + $lead_output .= "CLR $temp_typeS inserts: $CLRinsert_ct ($CLRinsert_aff) \n"; + $lead_output .= "CLR $temp_typeS skips: $CLRskip_ct \n"; + $lead_output .= "CLR $temp_typeS no changes: $CLRnochange_ct \n"; + if (!$Q) {print $lead_output;} + + $process_output .= $lead_output; + ######################################################## + ### END Check if there are any main changes within the previous X minutes + } + + + +sub populate_subs_section + { + ######################################################## + ### BEGIN Check if there are any SUBS changes within the previous X minutes, or ALL + $temp_subs_table = $subs_to_process[$sub_ct]; + $temp_subs_fields = $SUB_fields[$sub_ct]; + $vicidial_sub_ct=0; + $stmtA = "SELECT count(*) from $temp_subs_table where $temp_id_field='$updated_MAINS[$u_ct]';"; + $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; + $vicidial_sub_ct = $aryA[0]; + } + $sthA->finish(); + + if ( ($vicidial_sub_ct < 1) ) + { + if (!$Q) {print "No $temp_subs_table updated recently, nothing to do, skipping... \n";} + } + else + { + if (!$Q) {print "Recent changes - $temp_subs_table: $vicidial_sub_ct \n";} + + $o_ct=0; + $stmtA = "SELECT $temp_subs_fields from $temp_subs_table where $temp_id_field='$updated_MAINS[$u_ct]' limit 10000000;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + while ($sthArows > $o_ct) + { + @aryA = $sthA->fetchrow_array; + $updated_SUBS[$o_ct] = $aryA[0]; + $o_ct++; + } + $sthA->finish(); + $updated_SUBSsize = $o_ct; + + ### loop through all subs, compare to record on CLR server, update/insert if needed + $s_ct=0; + $sCLRupdate_ct=0; $sCLRupdate_aff=0; + $sCLRinsert_ct=0; $sCLRinsert_aff=0; + $sCLRskip_ct=0; + $sCLRnochange_ct=0; + $SUB_updated=0; + while ($updated_SUBSsize > $s_ct) + { + $o_ct=0; + $subs_fields_list=''; + $stmtA = "SHOW COLUMNS from $temp_subs_table;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + while ($sthArows > $o_ct) + { + @aryA = $sthA->fetchrow_array; + $subs_fields_list .= "$aryA[0],"; + $o_ct++; + } + $sthA->finish(); + $subs_fields_list =~ s/,$//gi; + + $update_phase=1; + # gather subs data from ORIGINAL database + $stmtA = "SELECT $subs_fields_list from $temp_subs_table where $temp_id_field='$updated_MAINS[$u_ct]' and $temp_subs_fields='$updated_SUBS[$s_ct]';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @tsub_fields = split(/,/,$subs_fields_list); + $tsub_fields_size = @tsub_fields; + $tsub_skip_fields = ",$temp_subs_fields,"; + $AupdateSQL=''; + $Acompare=''; + $p_ct=0; + @aryA = $sthA->fetchrow_array; + while($tsub_fields_size > $p_ct) + { + if ($tsub_skip_fields =~ /,$tsub_fields[$p_ct],/) + {if ($DBX > 0) {print "SKIP $p_ct|$tsub_fields[$p_ct]|$aryA[$p_ct]| \n";}} + else + { + if (defined $aryA[$p_ct]) + { + $temp_field = $aryA[$p_ct]; + $temp_fieldSQL = "\"$temp_field\""; + } + else + { + $temp_field='NULL'; + $temp_fieldSQL = 'NULL'; + } + $Acompare .= "$temp_field|"; + $AupdateSQL .= "$tsub_fields[$p_ct]=$temp_fieldSQL,"; + } + $p_ct++; + } + $AupdateSQL =~ s/,$//gi; + } + else + { + $update_phase=0; + if ($DBX > 0) + {print "DEBUG: No ORIGINAL $temp_subs_table found for $updated_SUBS[$s_ct], skipping \n";} + } + $sthA->finish(); + + # gather subs data from CLR database + $stmtB = "SELECT $subs_fields_list from $temp_subs_table where $temp_id_field='$updated_MAINS[$u_ct]' and $temp_subs_fields='$updated_SUBS[$s_ct]';"; + $sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr; + $sthB->execute or die "executing: $stmtB ", $dbhB->errstr; + $sthBrows=$sthB->rows; + if ($sthBrows > 0) + { + $BupdateSQL=''; + $Bcompare=''; + $p_ct=0; + @aryB = $sthB->fetchrow_array; + while($tsub_fields_size > $p_ct) + { + if ($tsub_skip_fields =~ /,$tsub_fields[$p_ct],/) + {if ($DBX > 0) {print "SKIP $p_ct|$tsub_fields[$p_ct]|$aryB[$p_ct]| \n";}} + else + { + if (defined $aryB[$p_ct]) + { + $temp_field = $aryB[$p_ct]; + $temp_fieldSQL = "\"$temp_field\""; + } + else + { + $temp_field='NULL'; + $temp_fieldSQL = 'NULL'; + } + $Bcompare .= "$temp_field|"; + $BupdateSQL .= "$tsub_fields[$p_ct]=$temp_fieldSQL,"; + } + $p_ct++; + } + $BupdateSQL =~ s/,$//gi; + } + else + { + if ($update_phase > 0) + { + $update_phase=2; + if ($DBX > 0) {print "DEBUG: No CLR match found for $temp_subs_table $updated_SUBS[$s_ct], inserting instead \n";} + } + } + $sthB->finish(); + + if ($update_phase >= 2) + { + # insert subs into CLR database + + $stmtB = "INSERT IGNORE INTO $temp_subs_table SET $temp_subs_fields='$updated_SUBS[$s_ct]',$AupdateSQL;"; + $affected_rowsB = $dbhB->do($stmtB); + $sCLRinsert_aff = ($sCLRinsert_aff + $affected_rowsB); + if ($DBX > 0) {print "DEBUG: CLR $temp_typeS inserted $updated_SUBS[$s_ct]: $affected_rowsB|$stmtB| \n";} + + $sCLRinsert_ct++; + $SUB_updated++; + } + else + { + # compare ORIGINAL and CLR sub data to see if update is needed + if ($Acompare eq $Bcompare) + { + $update_phase=0; + if ($DBX > 0) {print "DEBUG: ORIGINAL and CLR $temp_subs_table data is identical: $updated_SUBS[$s_ct] \n";} + if ($ALL_SETTINGS > 0) + {$SUB_updated++;} + } + if ($DBX > 0) {print "$updated_SUBS[$s_ct] compare:\n$Acompare \n$Bcompare \n";} + + if ($update_phase >= 1) + { + if ($DBX > 0) {print "DEBUG: CLR $temp_subs_table record is older or same age as ORIGINAL: $updated_SUBS[$s_ct] ($updated_SUBSepoch[$s_ct] > $Bupdated_SUBSepoch) \n";} + # update existing sub in CLR database + $stmtB = "UPDATE $temp_subs_table SET $AupdateSQL where $temp_id_field='$updated_MAINS[$u_ct]' and $temp_subs_fields='$updated_SUBS[$s_ct]';"; + $affected_rowsB = $dbhB->do($stmtB); + $sCLRupdate_aff = ($sCLRupdate_aff + $affected_rowsB); + if ($DBX > 0) {print "DEBUG: CLR $temp_typeS updated $updated_SUBS[$s_ct]: $affected_rowsB|$stmtB| \n";} + + $sCLRupdate_ct++; + $SUB_updated++; + } + else + { + # no change needed to sub in CLR database + $sCLRnochange_ct++; + } + } + + $s_ct++; + if ($Q < 1) + { + if ($s_ct =~ /100$/i) {print STDERR "> $s_ct / $updated_SUBSsize \r";} + if ($s_ct =~ /200$/i) {print STDERR "-> $s_ct / $updated_SUBSsize \r";} + if ($s_ct =~ /300$/i) {print STDERR " -> $s_ct / $updated_SUBSsize \r";} + if ($s_ct =~ /400$/i) {print STDERR " -> $s_ct / $updated_SUBSsize \r";} + if ($s_ct =~ /500$/i) {print STDERR " -> $s_ct / $updated_SUBSsize \r";} + if ($s_ct =~ /600$/i) {print STDERR " -> $s_ct / $updated_SUBSsize \r";} + if ($s_ct =~ /700$/i) {print STDERR " -> $s_ct / $updated_SUBSsize \r";} + if ($s_ct =~ /800$/i) {print STDERR " -> $s_ct / $updated_SUBSsize \r";} + if ($s_ct =~ /900$/i) {print STDERR " -> $s_ct / $updated_SUBSsize \r";} + if ($s_ct =~ /000$/i) {print STDERR " ->$s_ct / $updated_SUBSsize \r";} + if ($s_ct =~ /0000$/i) + { + $secY = time(); + $secZ = ($secY - $secX); + print "$s_ct|$sCLRupdate_ct|$sCLRinsert_ct|$sCLRnochange_ct| $secZ sec \n"; + } + } + } + } + + $lead_output = " CLR sub $temp_subs_table updates: $sCLRupdate_ct ($sCLRupdate_aff) \n"; + $lead_output .= " CLR sub $temp_subs_table inserts: $sCLRinsert_ct ($sCLRinsert_aff) \n"; + $lead_output .= " CLR sub $temp_subs_table skips: $sCLRskip_ct \n"; + $lead_output .= " CLR sub $temp_subs_table no changes: $sCLRnochange_ct \n"; + if (!$Q) {print $lead_output;} + + $process_output .= $lead_output; + ######################################################## + ### END Check if there are any subs changes within the previous X minutes + } diff --git a/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl b/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl index 02c3e985..b97a8b3e 100644 --- a/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl +++ b/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl @@ -175,9 +175,11 @@ # 250103-0932 - Added ConfBridge code and enhanced_agent_monitoring system setting code # 250914-1601 - Added pruning of recording_live table entries over 7 days old, deletion of parallel recording source files 3+ days # 250924-2212 - Added code for deprecation of "Monitor" application after Asterisk 20 +# 251006-0832 - Added truncating of vicidial_dtmf_log older than 24 hours & If recording_dtmf_muting enabled, force use of MixMonitor for recording +# 251011-1000 - Added archiving of recording_dtmf_muting_log, disabled purging of recording_live_log after 7 days # -$build = '250924-2212'; +$build = '251011-1000'; $DB=0; # Debug flag $teodDB=0; # flag to log Timeclock End of Day processes to log file @@ -500,7 +502,7 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA ##### Get the settings from system_settings ##### -$stmtA = "SELECT sounds_central_control_active,active_voicemail_server,custom_dialplan_entry,default_codecs,generate_cross_server_exten,voicemail_timezones,default_voicemail_timezone,call_menu_qualify_enabled,allow_voicemail_greeting,reload_timestamp,meetme_enter_login_filename,meetme_enter_leave3way_filename,allow_chats,enable_auto_reports,enable_drop_lists,expired_lists_inactive,sip_event_logging,call_quota_lead_ranking,inbound_answer_config,log_latency_gaps,demographic_quotas,weekday_resets,highest_lead_id,hopper_hold_inserts,stereo_recording,stereo_parallel_recording FROM system_settings;"; +$stmtA = "SELECT sounds_central_control_active,active_voicemail_server,custom_dialplan_entry,default_codecs,generate_cross_server_exten,voicemail_timezones,default_voicemail_timezone,call_menu_qualify_enabled,allow_voicemail_greeting,reload_timestamp,meetme_enter_login_filename,meetme_enter_leave3way_filename,allow_chats,enable_auto_reports,enable_drop_lists,expired_lists_inactive,sip_event_logging,call_quota_lead_ranking,inbound_answer_config,log_latency_gaps,demographic_quotas,weekday_resets,highest_lead_id,hopper_hold_inserts,stereo_recording,stereo_parallel_recording,recording_dtmf_muting FROM system_settings;"; # print "$stmtA\n"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; @@ -534,6 +536,7 @@ if ($sthArows > 0) $SShopper_hold_inserts = $aryA[23]; $SSstereo_recording = $aryA[24]; $SSstereo_parallel_recording = $aryA[25]; + $SSrecording_dtmf_muting = $aryA[26]; } $sthA->finish(); if ($DBXXX > 0) {print "SYSTEM SETTINGS: $sounds_central_control_active|$active_voicemail_server|$SScustom_dialplan_entry|$SSdefault_codecs\n";} @@ -2313,6 +2316,24 @@ if ($timeclock_end_of_day_NOW > 0) $sthA->finish(); ##### END vicidial_two_factor_auth end of day process removing records older than 7 days ##### + + ##### BEGIN vicidial_dtmf_log end of day process removing records older than 24 hours ##### + $stmtA = "DELETE from vicidial_dtmf_log where vicidial_dtmf_log < \"$RMSQLdate\";"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows vicidial_dtmf_log records older than 1 day purged|\n";} + if ($teodDB) {$event_string = "vicidial_dtmf_log records older than 1 day purged: |$stmtA|$affected_rows|"; &teod_logger;} + + $stmtA = "optimize table vicidial_dtmf_log;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if ($DB) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + ##### END vicidial_dtmf_log end of day process removing records older than 7 days ##### + ##### BEGIN vicidial_lead_messages end of day process removing records older than 1 day ##### $stmtA = "DELETE FROM vicidial_lead_messages WHERE call_date < \"$RMSQLdate\";"; @@ -2345,18 +2366,59 @@ if ($timeclock_end_of_day_NOW > 0) ##### BEGIN recording_live_log end of day process removing records older than 7 days ##### - $stmtA = "DELETE FROM recording_live_log WHERE start_time < \"$SDSQLdate\";"; + # $stmtA = "DELETE FROM recording_live_log WHERE start_time < \"$SDSQLdate\";"; + # $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + # $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + # $sthArows = $sthA->rows; + # $event_string = "$sthArows rows deleted from recording_live_log table"; + # if (!$Q) {print "$event_string \n";} + # if ($teodDB) {&teod_logger;} + + # $stmtA = "optimize table recording_live_log;"; + # $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + # $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + ##### END recording_live_log end of day process removing records older than 7 days ##### + + + # archive recording_dtmf_muting_log table every night + if (!$Q) {print "\nProcessing recording_dtmf_muting_log table...\n";} + $stmtA = "INSERT IGNORE INTO recording_dtmf_muting_log_archive SELECT * from recording_dtmf_muting_log;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows = $sthA->rows; - $event_string = "$sthArows rows deleted from recording_live_log table"; + $event_string = "$sthArows rows inserted into recording_dtmf_muting_log_archive table"; if (!$Q) {print "$event_string \n";} if ($teodDB) {&teod_logger;} - $stmtA = "optimize table recording_live_log;"; + $rv = $sthA->err(); + if (!$rv) + { + $stmtA = "DELETE FROM recording_dtmf_muting_log WHERE dtmf_muting_end_time < \"$now_date\";"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows = $sthA->rows; + $event_string = "$sthArows rows deleted from in recording_dtmf_muting_log table"; + if (!$Q) {print "$event_string \n";} + if ($teodDB) {&teod_logger;} + + $stmtA = "optimize table recording_dtmf_muting_log;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + } + + # delete recording_dtmf_muting_log_archive records older than 7 days old + $stmtA = "DELETE FROM recording_dtmf_muting_log_archive WHERE dtmf_muting_end_time < \"$SDSQLdate\";"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - ##### END recording_live_log end of day process removing records older than 7 days ##### + $sthArows = $sthA->rows; + $event_string = "$sthArows old rows deleted from in recording_dtmf_muting_log_archive table ($SDSQLdate)"; + if (!$Q) {print "$event_string \n";} + if ($teodDB) {&teod_logger;} + + $stmtA = "optimize table recording_dtmf_muting_log_archive;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + ##### START latency log summary log inserts @@ -3404,7 +3466,7 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r {$Vext .= "exten => 8309,2,Monitor(wav,\${CALLERIDNAME})\n";} else { - if ($asterisk_version =~ /^2[1-9]|^3\d|^4\d/) + if ( ($asterisk_version =~ /^2[1-9]|^3\d|^4\d/) || ($SSrecording_dtmf_muting > 0) ) { # Deprecation of "Monitor" application after Asterisk 20 $Vext .= "exten => 8309,2,MixMonitor(,r($PATHmonitor/\${CALLERID(name)}-in.wav)t($PATHmonitor/\${CALLERID(name)}-out.wav))\n"; @@ -3422,7 +3484,7 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r {$Vext .= "exten => 8310,2,Monitor(gsm,\${CALLERIDNAME})\n";} else { - if ($asterisk_version =~ /^2[1-9]|^3\d|^4\d/) + if ( ($asterisk_version =~ /^2[1-9]|^3\d|^4\d/) || ($SSrecording_dtmf_muting > 0) ) { # Deprecation of "Monitor" application after Asterisk 20 $Vext .= "exten => 8309,2,MixMonitor(,r($PATHmonitor/\${CALLERID(name)}-in.wav)t($PATHmonitor/\${CALLERID(name)}-out.wav))\n"; diff --git a/agc_2-X/trunk/bin/AST_CRON_audio_1_move_mix.pl b/agc_2-X/trunk/bin/AST_CRON_audio_1_move_mix.pl index 9557187f..5d1c91ca 100644 --- a/agc_2-X/trunk/bin/AST_CRON_audio_1_move_mix.pl +++ b/agc_2-X/trunk/bin/AST_CRON_audio_1_move_mix.pl @@ -24,7 +24,7 @@ # This program assumes that recordings are saved by Asterisk as .wav # should be easy to change this code if you use .gsm instead # -# Copyright (C) 2023 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2025 Matt Florell LICENSE: AGPLv2 # # # 80302-1958 - First Build @@ -34,6 +34,7 @@ # 160501-1001 - Added --SPHINX options to check for SPHINX audio files # 160523-0650 - Added --HTTPS option to use https instead of http in local location # 231019-2203 - Changed sleep time between directory scans from 5 to 15 seconds +# 251006-1852 - Added update of recording_live table record # $MIX=0; @@ -294,6 +295,10 @@ foreach(@FILES) if($DBX){print STDERR "\n|$stmtA|\n";} $affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:|$stmtA|\n"; + $stmtA = "UPDATE recording_live set end_time=NOW(),recording_status='FINISHED FILE-MERGE' where recording_id='$recording_id' and recording_status='STARTED';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:|$stmtA|\n"; + if (!$T) { `mv -f "$dir1/$INfile" "$dir2/ORIG/$INfile"`; diff --git a/agc_2-X/trunk/bin/AST_flush_DBqueue.pl b/agc_2-X/trunk/bin/AST_flush_DBqueue.pl index e135e360..9867b58d 100644 --- a/agc_2-X/trunk/bin/AST_flush_DBqueue.pl +++ b/agc_2-X/trunk/bin/AST_flush_DBqueue.pl @@ -37,6 +37,7 @@ # 240219-0811 - Added optimizing of server_live_... tables # 240709-1300 - Added Validate XFER vicidial_auto_calls: "--check-xfers" flag # 250914-1537 - Added archiving of recording_live table +# 251003-0837 - Added --preserve-dtmf flag (DTMF logs would then be kept for 1-2 days) # $session_flush=0; @@ -44,6 +45,7 @@ $SSsip_event_logging=0; $reset_stuck_leads=0; $stuck_lists=''; $stuck_listsSQL=''; +$preserve_dtmf=0; $check_xfers=0; $vicidial_recording_limit=60; @@ -68,6 +70,7 @@ if (length($ARGV[0])>1) print " [--session-flush] = flush the vicidial_sessions_recent table\n"; print " [--reset-stuck-leads] = reset status of ERI/INCALL leads to NEW if previewed but not called\n"; print " [--stuck-lists=X] = restrict stuck leads check to these lists: X-Y-Z multiple lists separated by a single dash\n"; + print " [--preserve-dtmf] = do not purge dtmf log\n"; print " [--check-xfers] = validates that XFER status vicidial_auto_calls records are live, if not, they are deleted\n"; print "\n"; @@ -106,6 +109,12 @@ if (length($ARGV[0])>1) if ($Q < 1) {print "\n----- RESET STUCK LEADS ----- $reset_stuck_leads \n\n";} } + if ($args =~ /--preserve-dtmf/i) + { + $preserve_dtmf=1; + if ($Q < 1) + {print "\n----- PRESERVE DTMF LOGS ----- $preserve_dtmf \n\n";} + } if ($args =~ /--check-xfers/i) { $check_xfers=1; @@ -344,10 +353,13 @@ if($DB){print STDERR "\n|$stmtA|\n";} if (!$T) { $affected_rows = $dbhA->do($stmtA);} if (!$Q) {print " - vicidial_manager flush: $affected_rows rows\n";} -$stmtA = "DELETE from vicidial_dtmf_log where dtmf_time < '$flush_time';"; -if($DB){print STDERR "\n|$stmtA|\n";} -if (!$T) { $affected_rows = $dbhA->do($stmtA);} -if (!$Q) {print " - vicidial_dtmf_log flush: $affected_rows rows\n";} +if ($preserve_dtmf < 1) + { + $stmtA = "DELETE from vicidial_dtmf_log where dtmf_time < '$flush_time';"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) { $affected_rows = $dbhA->do($stmtA);} + if (!$Q) {print " - vicidial_dtmf_log flush: $affected_rows rows\n";} + } $stmtA = "DELETE from routing_initiated_recordings where launch_time < '$flush_time';"; if($DB){print STDERR "\n|$stmtA|\n";} @@ -392,19 +404,21 @@ if (!$T) if (!$Q) {print " - OPTIMIZE vicidial_manager \n";} -$stmtA = "OPTIMIZE table vicidial_dtmf_log;"; -if($DB){print STDERR "\n|$stmtA|\n";} -if (!$T) - { - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - @aryA = $sthA->fetchrow_array; - if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} - $sthA->finish(); - } -if (!$Q) {print " - OPTIMIZE vicidial_dtmf_log \n";} - +if ($preserve_dtmf < 1) + { + $stmtA = "OPTIMIZE table vicidial_dtmf_log;"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) + { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } + if (!$Q) {print " - OPTIMIZE vicidial_dtmf_log \n";} + } $stmtA = "OPTIMIZE table routing_initiated_recordings;"; if($DB){print STDERR "\n|$stmtA|\n";} @@ -1099,7 +1113,7 @@ if ($rl_count > 0) $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows = $sthA->rows; - if (!$Q) {print "$sthArows rows delete from recording_live_log table: |$OR_recording_id[$orc]|$OR_user[$orc]|$OR_lead_id[$orc]|\n";} + if (!$Q) {print "$sthArows rows delete from recording_live table: |$OR_recording_id[$orc]|$OR_user[$orc]|$OR_lead_id[$orc]|\n";} } $orc++; } diff --git a/agc_2-X/trunk/bin/AST_manager_listen_AMI2.pl b/agc_2-X/trunk/bin/AST_manager_listen_AMI2.pl index e6790dd0..bf6bd226 100644 --- a/agc_2-X/trunk/bin/AST_manager_listen_AMI2.pl +++ b/agc_2-X/trunk/bin/AST_manager_listen_AMI2.pl @@ -17,7 +17,7 @@ # the ADMIN_keepalive_ALL.pl script, which makes sure it is always running in a # screen, provided that the astguiclient.conf keepalive setting "2" is set. # -# Copyright (C) 2021 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2025 Matt Florell LICENSE: AGPLv2 # # CHANGES # 170915-2106 - Initial version based off the orginal AST_manager_listen.pl script @@ -25,6 +25,8 @@ # 170930-0923 - Commented out handle_sip_event and handle_cpd_event functions, not needed anymore, to be deleted later # 190121-1505 - Added RA_USER_PHONE On-Hook CID to solve last RINGAGENT issues # 210407-2009 - Added Event handlers for new manager events +# 251007-2110 - Added code for recording_dtmf_detection and recording_dtmf_muting +# # constants $DB=0; # Debug flag, set to 0 for no debug messages, lots of output @@ -162,6 +164,20 @@ if ($sthArows > 0) } $sthA->finish(); +### Grab System Settings values from the database +$stmtA = "SELECT recording_dtmf_detection,recording_dtmf_muting FROM system_settings;"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $SSrecording_dtmf_detection = $aryA[0]; + $SSrecording_dtmf_muting = $aryA[1]; + } +$sthA->finish(); + + if (!$telnet_port) {$telnet_port = '5038';} $event_string='LOGGED INTO MYSQL SERVER ON 1 CONNECTION|'; @@ -866,6 +882,111 @@ sub handle_dtmf_begin_event $dtmf_string = "$HRnow_date|$s_hires|$usec|$event_hash{'Channel'}|$event_hash{'Uniqueid'}|$event_hash{'Digit'}|$event_hash{'Direction'}|Begin|$event_hash{'CallerIDName'}"; &dtmf_logger; + $temp_server_ip = $event_hash{'ServerIP'}; + $temp_channel = $event_hash{'Channel'}; + ##### BEGIN - if recording_dtmf_detection is enabled, check for recordings on this channel ##### + if ( ($SSrecording_dtmf_detection > 0) && ( ($temp_channel !~ /Local\/5\d\d\d\d\d\d\d@default/i) || ( ($temp_channel =~ /Local\/5\d\d\d\d\d\d\d@default/i) && ($temp_channel =~ /;1$/) ) ) ) + { + $channelSQL = "channel='$temp_channel'"; + if (($temp_channel =~ /Local\/5\d\d\d\d\d\d\d@default/i)) + { + $temp_rec_channel = $temp_channel; + $temp_rec_channel =~ s/-.*//gi; + $channelSQL = "channel='$temp_rec_channel'"; + } + $rec_live_match=0; + $stmtA = "SELECT count(*) FROM recording_live where $channelSQL and server_ip='$temp_server_ip' and recording_status='STARTED';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArowsREC=$sthA->rows; + if ($sthArowsREC > 0) + { + @aryA = $sthA->fetchrow_array; + $rec_live_match = $aryA[0]; + } + $sthA->finish(); + if($DBX){print STDERR "$sthArowsREC|$rec_live_match|$stmtA|\n";} + + if ($rec_live_match > 0) + { + $temp_recording_id = ''; + $rec_channel = ''; + $dtmf_detected = 0; + $dtmf_muting = 0; + $dtmf_muting_seconds = 0; + $mute_state = ''; + $recording_type = ''; + $recording_filename = ''; + $rec_lead_id = 0; + $NEXTdtmf_muting = 0; + + $stmtA = "SELECT recording_id,channel,dtmf_detected,dtmf_muting,dtmf_muting_seconds,mute_state,recording_type,filename,lead_id FROM recording_live where $channelSQL and server_ip='$temp_server_ip' and recording_status='STARTED' order by recording_id limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArowsRECdetail=$sthA->rows; + if ($sthArowsRECdetail > 0) + { + @aryA = $sthA->fetchrow_array; + $temp_recording_id = $aryA[0]; + $rec_channel = $aryA[1]; + $dtmf_detected = $aryA[2]; + $dtmf_muting = $aryA[3]; + $dtmf_muting_seconds = $aryA[4]; + $mute_state = $aryA[5]; + $recording_type = $aryA[6]; + $recording_filename = $aryA[7]; + $rec_lead_id = $aryA[8]; + $NEXTdtmf_muting = ($dtmf_muting + 1); + } + $sthA->finish(); + + if ( ($SSrecording_dtmf_muting > 0) && ($dtmf_muting_seconds > 0) && ($sthArowsRECdetail > 0) ) + { + $mute_stateSQL=''; + if ($mute_state < 1) + {$mute_stateSQL="mute_state='1', dtmf_muting='$NEXTdtmf_muting',";} + # update recording_live record, trigger dtmf muting and increment dtmf_detected counter + $stmtA = "UPDATE recording_live SET $mute_stateSQL dtmf_detected='$NEXTdtmf_muting' where recording_id='$temp_recording_id';"; + my $affected_rows = $dbhA->do($stmtA); + if($DBX){print STDERR "$affected_rows|$stmtA|\n";} + + # if dtmf muting is triggered, then send the command to mute the channel and update the recording_live record + if (length($mute_stateSQL) > 10) + { + $mute_direction = 'both'; + if ( ($recording_type eq 'MONO_LEGACY') || ($recording_type eq 'MONO_LEGACY_RIR') ) + {$mute_direction = 'both';} + if ( ($recording_type !~ /PARALLEL/) && ($recording_type =~ /CUSTOMER_ONLY|SACCO|SACICO|SACRCO/) ) + {$mute_direction = 'read';} + if ( ($recording_type !~ /PARALLEL/) && ($recording_type =~ /CUSTOMER_MUTE|SACCM|SACICM|SACRCM/) ) + {$mute_direction = 'write';} + $vmgr_callerid = substr($recording_filename, -15) . 'DTMFM'; + $stmtE="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$temp_server_ip','','MixMonitorMute','$vmgr_callerid','ActionID: $vmgr_callerid','Channel: $temp_channel','Direction: $mute_direction','State: 1','','','','','','');"; + my $affected_rowsVM = $dbhA->do($stmtE); + if($DBX){print STDERR "$affected_rowsVM|$stmtE|\n";} + + $stmtC = "UPDATE recording_live SET mute_state='2', dtmf_muting_end_time=NOW() + INTERVAL $dtmf_muting_seconds SECOND where recording_id='$temp_recording_id';"; + my $affected_rowsRL = $dbhA->do($stmtC); + if($DBX){print STDERR "$affected_rowsRL|$stmtC|\n";} + + $stmtB="INSERT INTO recording_dtmf_muting_log SET recording_id='$temp_recording_id',recording_type='$recording_type',server_ip='$temp_server_ip',channel='$rec_channel',channel_to_mute='$temp_channel',filename='$recording_filename',lead_id='$rec_lead_id',campaign_id='',trigger_dtmf='$event_hash{'Digit'}',dtmf_muting='$NEXTdtmf_muting',dtmf_muting_start_time=NOW(),dtmf_muting_end_time=NOW() + INTERVAL $dtmf_muting_seconds SECOND,dtmf_muting_seconds='$dtmf_muting_seconds',mute_state='2';"; + my $affected_rowsML = $dbhA->do($stmtB); + if($DBX){print STDERR "$affected_rowsML|$stmtB|\n";} + } + } + else + { + if ($sthArowsRECdetail > 0) + { + # update recording_live record, increment dtmf_detected counter + $stmtA = "UPDATE recording_live SET dtmf_detected='$NEXTdtmf_muting' where recording_id='$temp_recording_id';"; + my $affected_rows = $dbhA->do($stmtA); + if($DBX){print STDERR "$affected_rows|$stmtA|\n";} + } + } + } + } + ##### END - if recording_dtmf_detection is enabled, check for recordings on this channel ##### return 1; } else diff --git a/agc_2-X/trunk/bin/AST_update_AMI2.pl b/agc_2-X/trunk/bin/AST_update_AMI2.pl index 6c15b632..c28e60ed 100644 --- a/agc_2-X/trunk/bin/AST_update_AMI2.pl +++ b/agc_2-X/trunk/bin/AST_update_AMI2.pl @@ -5,7 +5,7 @@ # This script uses the Asterisk Manager interface to update the live_channels # tables and verify the parked_channels table in the asterisk MySQL database # -# Copyright (C) 2022 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2025 Matt Florell LICENSE: AGPLv2 # # CHANGES # 170915-2110 - Initial version for Asterisk 13, based upon AST_update.pl @@ -19,6 +19,7 @@ # 210315-1045 - Populate the CIDname in live_sip_channels/live_channels tables, Issue #1255 # 210827-0930 - Added PJSIP compatibility # 220310-1136 - Fix for issue dealing with bad carrier 'P-Asserted-Identity' input +# 251008-2114 - Added code for recording_dtmf_detection and recording_dtmf_muting # # constants @@ -38,6 +39,9 @@ $server_stats_update_interval = 30; # how often performance logging is triggered $performance_logging_interval = 5; +# dtmf-check last second +$dtmf_check_last_time = 999999; + ### begin parsing run-time options ### if (length($ARGV[0])>1) { @@ -192,6 +196,19 @@ if ($sthArows > 0) if (!$telnet_port) {$telnet_port = '5038';} +### Grab System Settings values from the database +$stmtA = "SELECT recording_dtmf_detection,recording_dtmf_muting FROM system_settings;"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $SSrecording_dtmf_detection = $aryA[0]; + $SSrecording_dtmf_muting = $aryA[1]; + } +$sthA->finish(); + ##### Check for a server_updater record, and if not present, insert one $SUrec=0; @@ -642,7 +659,6 @@ else } else { - # Process the channel list $counts = process_channels($dbhA,$chan_array_ref,$phones_ref,$db_trunks_ref,$db_clients_ref,$server_ip,$old_counts); @@ -663,6 +679,18 @@ else $last_perf_log = time(); } + # check for if dtmf-muted recordings to stop, if recording_dtmf_detection and recording_dtmf_muting are active + if ( ($SSrecording_dtmf_detection > 0) && ($SSrecording_dtmf_muting > 0) ) + { + if ($dtmf_check_last_time != $current_time_sec) + { + # dtmf muting stop check hasn't run this second, so check for them + &dtmf_muting_stop_check; + + $dtmf_check_last_time = $current_time_sec; + } + } + # figure out how long that loop took. # get the current time ( $now_sec, $now_micro_sec ) = gettimeofday(); @@ -1462,8 +1490,102 @@ sub get_time_now #get the current date and time and epoch for logging call lengt $now_date_epoch = time(); $now_date = "$year-$mon-$mday $hour:$min:$sec"; $action_log_date = "$year-$mon-$mday"; + $current_time_sec = "$hour$min$sec"; + $current_time_sec = ($current_time_sec + 0); } +sub dtmf_muting_stop_check + { + $mute_to_stop_count=0; + ### Get count of dtmf muted recordings that should be un-muted + $stmtA = "SELECT count(*) FROM recording_live WHERE mute_state='2' and dtmf_muting_end_time <= '$now_date' and recording_status='STARTED' and server_ip='$server_ip';"; + $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; + $mute_to_stop_count = $aryA[0]; + } + $sthA->finish(); + + if ($DB) {print "DEBUG: DTMF Mute Stop Check: $mute_to_stop_count |$sthArows|$stmtA|\n";} + + if ($mute_to_stop_count > 0) + { + # gather details on all recordings that need to be un-muted + $stmtA = "SELECT recording_id,channel,dtmf_detected,dtmf_muting,dtmf_muting_seconds,mute_state,recording_type,filename,lead_id FROM recording_live where mute_state='2' and dtmf_muting_end_time <= '$now_date' and dtmf_muting_end_time != '2020-12-31 23:59:59' and recording_status='STARTED' and server_ip='$server_ip' order by recording_id limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArowsRECdetail=$sthA->rows; + $rl_ct=0; + while ($sthArowsRECdetail > $rl_ct) + { + @aryA = $sthA->fetchrow_array; + $temp_recording_id[$rl_ct] = $aryA[0]; + $rec_channel[$rl_ct] = $aryA[1]; + $dtmf_detected[$rl_ct] = $aryA[2]; + $dtmf_muting[$rl_ct] = $aryA[3]; + $dtmf_muting_seconds[$rl_ct] = $aryA[4]; + $mute_state[$rl_ct] = $aryA[5]; + $recording_type[$rl_ct] = $aryA[6]; + $recording_filename[$rl_ct] = $aryA[7]; + $rec_lead_id[$rl_ct] = $aryA[8]; + + $rl_ct++; + } + $sthA->finish(); + + # go through each recording and un-mute the recording + $rl_ct=0; + while ($sthArowsRECdetail > $rl_ct) + { + # update recording_live record, trigger dtmf muting and increment dtmf_detected counter + $stmtA = "UPDATE recording_live SET mute_state='3' where recording_id='$temp_recording_id[$rl_ct]';"; + my $affected_rows = $dbhA->do($stmtA); + if($DBX){print STDERR "$affected_rows|$stmtA|\n";} + + $channel_to_mute = $rec_channel[$rl_ct]; + $dtmf_mute_id=0; + ### Get channel name of channel that should be un-muted + $stmtA = "SELECT channel_to_mute,dtmf_mute_id FROM recording_dtmf_muting_log WHERE recording_id='$temp_recording_id[$rl_ct]' and mute_state='2' order by dtmf_mute_id desc limit 1;"; + $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; + $channel_to_mute = $aryA[0]; + $dtmf_mute_id = $aryA[1]; + } + $sthA->finish(); + + $mute_direction = 'both'; + if ( ($recording_type[$rl_ct] eq 'MONO_LEGACY') || ($recording_type[$rl_ct] eq 'MONO_LEGACY_RIR') ) + {$mute_direction = 'both';} + if ( ($recording_type[$rl_ct] !~ /PARALLEL/) && ($recording_type[$rl_ct] =~ /CUSTOMER_ONLY|SACCO|SACICO|SACRCO/) ) + {$mute_direction = 'read';} + if ( ($recording_type[$rl_ct] !~ /PARALLEL/) && ($recording_type[$rl_ct] =~ /CUSTOMER_MUTE|SACCM|SACICM|SACRCM/) ) + {$mute_direction = 'write';} + $vmgr_callerid = substr($recording_filename[$rl_ct], -15) . 'DTMFU'; + $stmtE="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$server_ip','','MixMonitorMute','$vmgr_callerid','ActionID: $vmgr_callerid','Channel: $channel_to_mute','Direction: $mute_direction','State: 0','','','','','','');"; + my $affected_rowsVM = $dbhA->do($stmtE); + if($DBX){print STDERR "$affected_rowsVM|$stmtE|\n";} + + $stmtC = "UPDATE recording_live SET mute_state='0', dtmf_muting_end_time='$now_date' where recording_id='$temp_recording_id[$rl_ct]';"; + my $affected_rowsRL = $dbhA->do($stmtC); + if($DBX){print STDERR "$affected_rowsRL|$stmtC|\n";} + + $stmtB = "UPDATE recording_dtmf_muting_log SET mute_state='4',dtmf_muting_end_time='$now_date' WHERE dtmf_mute_id='$dtmf_mute_id';"; + my $affected_rowsML = $dbhA->do($stmtB); + if($DBX){print STDERR "$affected_rowsML|$stmtB|\n";} + + if ($DB) {print "DEBUG: DTMF Mute Stopped: $temp_recording_id[$rl_ct] $rl_ct\n";} + + $rl_ct++; + } + } + } # try to load a module sub try_load diff --git a/agc_2-X/trunk/docs/STEREO_CALL_RECORDINGS.txt b/agc_2-X/trunk/docs/STEREO_CALL_RECORDINGS.txt index c0ef3ce9..f742380a 100644 --- a/agc_2-X/trunk/docs/STEREO_CALL_RECORDINGS.txt +++ b/agc_2-X/trunk/docs/STEREO_CALL_RECORDINGS.txt @@ -1,7 +1,7 @@ -VICIDIAL STEREO CALL RECORDINGS Started: 2025-06-18 Updated: 2025-10-01 +VICIDIAL STEREO CALL RECORDINGS Started: 2025-06-18 Updated: 2025-10-20 -TO USE THESE FEATURES, YOU WILL NEED TO HAVE ALL SERVERS IN YOUR CLUSTER USING SVN/TRUNK REVISION 3947(2025-10-01) CODE OR HIGHER!!! +TO USE THESE FEATURES, YOU WILL NEED TO HAVE ALL SERVERS IN YOUR CLUSTER USING SVN/TRUNK REVISION 3949(2025-10-20) CODE OR HIGHER!!! This project was designed to allow for additional stereo recording of phone calls at the agent and server levels directly on VICIdial Asterisk servers, with the customer always on one channel(the Right channel) and the agent and all other parties on the other channel(the Left channel). If you are looking for the VICI Gateway Recording Server documentation, please see the GATEWAY_RECORDING_SERVER.txt document. @@ -21,10 +21,9 @@ This project has been broken down into 4 phases of development, since it is so l ***COMPLETE*** 4) Live recording muting based on DTMF receipt and un-muting after x seconds of being muted(campaign setting), for both new customer-channel-stereo and legacy-mono agent session recordings. -***STILL-IN-DEVELOPMENT*** +***COMPLETE AS OF SVN/TRUNK REVISION 3949(2025-10-20)*** -While the above development phases will be worked-on in the order they are above, there are portions of the later phases that will be implemented as early as the first phase due to shared processes needed for the later phases. ------------------------------------------------------------------------------------------------- @@ -43,8 +42,13 @@ For In-groups, the "Stereo Recording" options do NOT default to inherit settings For all of Stereo Recording, the agent-controlled Mute Recordings feature will not be available. This is because of all of the complexity already included in the Customer-Only, Customer-Muted and Recording DTMF Muting features that are to be built into Stereo Recording. Also, in the existing default mono call recording, if the Recording DTMF Muting feature is enabled, then the agent-controlled Mute Recordings feature will not be available. -For Recording DTMF Muting (STILL BEING DEVELOPED), this is NOT designed to mute 100% of the DTMF audio in a recording, it is meant to trigger a fixed time period of muting of the channel sending the DTMF audio AFTER a DTMF digit is detected. As a note, on many VICIdial systems, audible DTMF is already muted and converted into out-of-band DTMF signalling in many channel types by default, so this feature may not be necessary for all organizations. This setting is a number of seconds to mute the channel, with '0' being disabled. the default is '0'. +For Recording DTMF Muting, this is NOT designed to mute 100% of the DTMF audio in a recording, it is meant to trigger a fixed time period of muting of the call recording AFTER a DTMF digit is detected. If Recording DTMF Muting is active for a campaign/in-group, it will affect both Mono Legacy and Stereo call recordings for those calls. As a note, on many VICIdial systems, audible DTMF is already muted and converted into out-of-band DTMF signalling in many channel types by default, so this feature may not be necessary for all organizations. This setting is a number of seconds to mute the channel, with '0' being disabled. the default is '0'. To use this feature, you will need to enable both "Allow Recording DTMF Detection" and "Allow Recording DTMF Muting" in System Settings. +IMPORTANT NOTE FOR RECORDING DTMF MUTING: Once enabled in the system settings, make sure you set the "Reload Dialplan On Servers" system settingss option to '1' and submit. This will make sure all of the call recording functions in the dialplan are using MixMonitor, which is what is required for Recording DTMF Muting to work properly. + +Also for Recording DTMF Muting, just like with Stereo Call Recording, each campaign and in-group that you want to have Recording DTMF Muting active for will need to have it enabled, there is no inheritance of that setting from campaign to in-groups. However, if you want to enable Recording DTMF Muting for all call recordings on a system with the same number of muting seconds on all calls, you can use the System Setting "Allow Recording DTMF Muting" setting set to a number 2 or greater to do this. + +When there is more than one recording on the same channel, Recording DTMF Muting logging will only log for one of the recordings on that channel, even though the muting will affect all recordings on that channel. @@ -171,6 +175,11 @@ List of recording_log.extension values with recording_log_stereo.recording_type MONO_LEGACY_RIR MONO_LEGACY_REMOTE MONO_LEGACY_SURVEY + MONO_LEGACY_NVA + MONO_LEGACY_DID + MONO_LEGACY_AMD + MONO_LEGACY_VERIF + MONO_LEGACY_3WAY STEREO_AGENT STEREO_DID SPACBC STEREO_PARALLEL AGENT-CONTROLLED BOTH_CHANNELS @@ -183,18 +192,21 @@ SPCO STEREO_PARALLEL CUSTOMER-ONLY SPCM STEREO_PARALLEL CUSTOMER-MUTED SPFR STEREO_PARALLEL FULL-RECORDING SPACI STEREO_PARALLEL AGENT-CONTROLLED RIR -SACI STEREO AGENT-CONTROLLED RIR +SACIBC STEREO AGENT-CONTROLLED RIR BOTH_CHANNELS +SACICO STEREO AGENT-CONTROLLED RIR CUSTOMER_ONLY +SACICM STEREO AGENT-CONTROLLED RIR CUSTOMER_MUTE SPCOR STEREO_PARALLEL CUSTOMER-ONLY REMOTE SPCMR STEREO_PARALLEL CUSTOMER-MUTED REMOTE SPFRR STEREO_PARALLEL FULL-RECORDING REMOTE SPACR STEREO_PARALLEL AGENT-CONTROLLED REMOTE -SACR STEREO AGENT-CONTROLLED REMOTE - +SACRBC STEREO AGENT-CONTROLLED REMOTE BOTH_CHANNELS +SACRCO STEREO AGENT-CONTROLLED REMOTE CUSTOMER_ONLY +SACRCM STEREO AGENT-CONTROLLED REMOTE CUSTOMER_MUTE ------------------------------------------------------------------------------------------------- -List of scripts modified/created for these new Stereo Call Recording features: +List of scripts modified/created for these new Stereo Call Recording and Recording DTMF Muting features: - agc/vicidial.php - agc/vdc_db_query.php - agc/manager_send.php @@ -204,12 +216,21 @@ List of scripts modified/created for these new Stereo Call Recording features: - install.pl - AST_CRON_audio_1_move_VDonly.pl - AST_CRON_audio_1_stereo.pl +- AST_CRON_audio_1_move_mix.pl - AST_CRON_audio_2_compress.pl - AST_flush_DBqueue.pl - ADMIN_keepalive_ALL.pl - ADMIN_archive_log_tables.pl +- AST_update_AMI2.pl +- AST_manager_listen_AMI2.pl - agi-VDAD_ALL_inbound.agi - agi-VDAD_ALL_outbound.agi +- VD_amd.agi +- agi-VDAD_RINGALL.agi +- agi-NVA_recording.agi +- agi-IVR_recording_verification.agi +- agi-DID_route.agi + @@ -346,23 +367,33 @@ index(recording_id), index(dtmf_muting_end_time) ) ENGINE=MyISAM; -CREATE TABLE recording_dtmf_log ( -recording_id INT(10) UNSIGNED PRIMARY KEY NOT NULL, +CREATE TABLE recording_log_parallel_archive LIKE recording_log_parallel; +CREATE TABLE recording_log_stereo_archive LIKE recording_log_stereo; + +CREATE TABLE recording_dtmf_muting_log ( +dtmf_mute_id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +recording_id INT(10) UNSIGNED NOT NULL, recording_type VARCHAR(40) default 'MONO_LEGACY', server_ip VARCHAR(15), channel VARCHAR(255), +channel_to_mute VARCHAR(255), filename VARCHAR(100), lead_id INT(9) UNSIGNED, -dtmf_muting TINYINT(3) UNSIGNED default '0', +campaign_id VARCHAR(20) default '', +trigger_dtmf VARCHAR(100) default '', +dtmf_muting SMALLINT(3) UNSIGNED default '0', dtmf_muting_start_time DATETIME, dtmf_muting_end_time DATETIME, dtmf_muting_seconds TINYINT(3) UNSIGNED default '0', mute_state TINYINT(3) UNSIGNED default '0', index(filename), -index(lead_id), index(recording_id), index(dtmf_muting_end_time) ) ENGINE=MyISAM; -CREATE TABLE recording_log_parallel_archive LIKE recording_log_parallel; -CREATE TABLE recording_log_stereo_archive LIKE recording_log_stereo; +CREATE TABLE recording_dtmf_muting_log_archive LIKE recording_dtmf_muting_log; +ALTER TABLE recording_dtmf_muting_log_archive MODIFY dtmf_mute_id INT(10) UNSIGNED NOT NULL; +CREATE UNIQUE INDEX rdml_key on recording_dtmf_muting_log_archive(dtmf_mute_id, recording_id); + +CREATE INDEX rllst on recording_live_log(start_time); +CREATE TABLE recording_live_log_archive LIKE recording_live_log; 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 035e9664..e01bf07a 100644 --- a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql +++ b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql @@ -5428,20 +5428,23 @@ index(recording_id), index(dtmf_muting_end_time) ) ENGINE=MyISAM; -CREATE TABLE recording_dtmf_log ( -recording_id INT(10) UNSIGNED PRIMARY KEY NOT NULL, +CREATE TABLE recording_dtmf_muting_log ( +dtmf_mute_id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +recording_id INT(10) UNSIGNED NOT NULL, recording_type VARCHAR(40) default 'MONO_LEGACY', server_ip VARCHAR(15), channel VARCHAR(255), +channel_to_mute VARCHAR(255), filename VARCHAR(100), lead_id INT(9) UNSIGNED, -dtmf_muting TINYINT(3) UNSIGNED default '0', +campaign_id VARCHAR(20) default '', +trigger_dtmf VARCHAR(100) default '', +dtmf_muting SMALLINT(3) UNSIGNED default '0', dtmf_muting_start_time DATETIME, dtmf_muting_end_time DATETIME, dtmf_muting_seconds TINYINT(3) UNSIGNED default '0', mute_state TINYINT(3) UNSIGNED default '0', index(filename), -index(lead_id), index(recording_id), index(dtmf_muting_end_time) ) ENGINE=MyISAM; @@ -5607,6 +5610,8 @@ CREATE INDEX vlecc on vicidial_log_extended (caller_code); CREATE UNIQUE INDEX vvmmcount on vicidial_vmm_counts (lead_id,call_date); CREATE UNIQUE INDEX vicidial_user_logins_daily_user on vicidial_user_logins_daily(login_day, user); +CREATE INDEX vdtmflt on vicidial_dtmf_log (dtmf_time); + CREATE INDEX vlali on vicidial_live_agents (lead_id); CREATE INDEX vlaus on vicidial_live_agents (user); @@ -5754,6 +5759,14 @@ CREATE UNIQUE INDEX vdpla on vicidial_3way_press_log_archive (call_date,caller_c CREATE TABLE vicidial_daily_rt_monitoring_log LIKE vicidial_rt_monitor_log; +CREATE TABLE recording_dtmf_muting_log_archive LIKE recording_dtmf_muting_log; +ALTER TABLE recording_dtmf_muting_log_archive MODIFY dtmf_mute_id INT(10) UNSIGNED NOT NULL; +CREATE UNIQUE INDEX rdml_key on recording_dtmf_muting_log_archive(dtmf_mute_id, recording_id); + +CREATE INDEX rllst on recording_live_log(start_time); +CREATE TABLE recording_live_log_archive LIKE recording_live_log; + + GRANT RELOAD ON *.* TO cron@'%'; GRANT RELOAD ON *.* TO cron@localhost; @@ -5854,4 +5867,4 @@ INSERT INTO `wallboard_reports` VALUES ('AGENTS_AND_QUEUES','Agents and Queues', UPDATE system_settings set vdc_agent_api_active='1'; -UPDATE system_settings SET db_schema_version='1731',db_schema_update_date=NOW(),reload_timestamp=NOW(); +UPDATE system_settings SET db_schema_version='1732',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 f423fc07..2a24e177 100644 --- a/agc_2-X/trunk/extras/upgrade_2.14.sql +++ b/agc_2-X/trunk/extras/upgrade_2.14.sql @@ -2985,24 +2985,6 @@ index(recording_id), index(dtmf_muting_end_time) ) ENGINE=MyISAM; -CREATE TABLE recording_dtmf_log ( -recording_id INT(10) UNSIGNED PRIMARY KEY NOT NULL, -recording_type VARCHAR(40) default 'MONO_LEGACY', -server_ip VARCHAR(15), -channel VARCHAR(255), -filename VARCHAR(100), -lead_id INT(9) UNSIGNED, -dtmf_muting TINYINT(3) UNSIGNED default '0', -dtmf_muting_start_time DATETIME, -dtmf_muting_end_time DATETIME, -dtmf_muting_seconds TINYINT(3) UNSIGNED default '0', -mute_state TINYINT(3) UNSIGNED default '0', -index(filename), -index(lead_id), -index(recording_id), -index(dtmf_muting_end_time) -) ENGINE=MyISAM; - CREATE TABLE recording_log_parallel_archive LIKE recording_log_parallel; CREATE TABLE recording_log_stereo_archive LIKE recording_log_stereo; @@ -3015,3 +2997,36 @@ UPDATE system_settings SET db_schema_version='1730',db_schema_update_date=NOW() ALTER TABLE vicidial_campaigns ADD call_count_limit_restrict VARCHAR(30) default 'DISABLED'; UPDATE system_settings SET db_schema_version='1731',db_schema_update_date=NOW() where db_schema_version < 1731; + +CREATE INDEX vdtmflt on vicidial_dtmf_log (dtmf_time); + +CREATE TABLE recording_dtmf_muting_log ( +dtmf_mute_id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +recording_id INT(10) UNSIGNED NOT NULL, +recording_type VARCHAR(40) default 'MONO_LEGACY', +server_ip VARCHAR(15), +channel VARCHAR(255), +channel_to_mute VARCHAR(255), +filename VARCHAR(100), +lead_id INT(9) UNSIGNED, +campaign_id VARCHAR(20) default '', +trigger_dtmf VARCHAR(100) default '', +dtmf_muting SMALLINT(3) UNSIGNED default '0', +dtmf_muting_start_time DATETIME, +dtmf_muting_end_time DATETIME, +dtmf_muting_seconds TINYINT(3) UNSIGNED default '0', +mute_state TINYINT(3) UNSIGNED default '0', +index(filename), +index(recording_id), +index(dtmf_muting_end_time) +) ENGINE=MyISAM; + +CREATE TABLE recording_dtmf_muting_log_archive LIKE recording_dtmf_muting_log; +ALTER TABLE recording_dtmf_muting_log_archive MODIFY dtmf_mute_id INT(10) UNSIGNED NOT NULL; +CREATE UNIQUE INDEX rdml_key on recording_dtmf_muting_log_archive(dtmf_mute_id, recording_id); + +CREATE INDEX rllst on recording_live_log(start_time); + +CREATE TABLE recording_live_log_archive LIKE recording_live_log; + +UPDATE system_settings SET db_schema_version='1732',db_schema_update_date=NOW() where db_schema_version < 1732; diff --git a/agc_2-X/trunk/www/agc/manager_send.php b/agc_2-X/trunk/www/agc/manager_send.php index 1b748d9b..ef7468c9 100644 --- a/agc_2-X/trunk/www/agc/manager_send.php +++ b/agc_2-X/trunk/www/agc/manager_send.php @@ -159,10 +159,11 @@ # 240709-2010 - Changes to input variable filtering # 241122-1544 - Fix for DTMF issue #1525 # 250831-0839 - Added MonitorStereo/StopMonitorStereo functions +# 251005-0935 - Added code for recording_dtmf_muting # -$version = '2.14-106'; -$build = '250831-0839'; +$version = '2.14-107'; +$build = '251005-0935'; $php_script = 'manager_send.php'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=177; @@ -171,6 +172,7 @@ $SSagent_debug_logging=0; $startMS = microtime(); $dial_override_limit=6; $ip = getenv("REMOTE_ADDR"); +$recording_dtmf_muting=0; require_once("dbconnect_mysqli.php"); require_once("functions.php"); @@ -286,7 +288,7 @@ $pass=preg_replace("/\'|\"|\\\\|;| /","",$pass); ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,allow_sipsak_messages,enable_languages,language_method,meetme_enter_login_filename,meetme_enter_leave3way_filename,agent_debug_logging,allow_web_debug,stereo_recording,stereo_parallel_recording FROM system_settings;"; +$stmt = "SELECT use_non_latin,allow_sipsak_messages,enable_languages,language_method,meetme_enter_login_filename,meetme_enter_leave3way_filename,agent_debug_logging,allow_web_debug,stereo_recording,stereo_parallel_recording,recording_dtmf_detection,recording_dtmf_muting FROM system_settings;"; $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02001',$user,$server_ip,$session_name,$one_mysql_log);} #if ($DB) {echo "$stmt\n";} @@ -304,6 +306,8 @@ if ($qm_conf_ct > 0) $SSallow_web_debug = $row[7]; $SSstereo_recording = $row[8]; $SSstereo_parallel_recording = $row[9]; + $SSrecording_dtmf_detection = $row[10]; + $SSrecording_dtmf_muting = $row[11]; } if ($SSallow_web_debug < 1) {$DB=0;} ##### END SETTINGS LOOKUP ##### @@ -2706,6 +2710,53 @@ if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) $recording_id = mysqli_insert_id($link); } } + + ### check for recording_dtmf_muting + $stmt="SELECT callerid FROM vicidial_live_agents where user='$user' and lead_id='$lead_id' limit 1;"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $rec_count = mysqli_num_rows($rslt); + if ($rec_count>0) + { + $row=mysqli_fetch_row($rslt); + $USERcallerid = $row[0]; + + $stmt="SELECT campaign_id FROM vicidial_auto_calls where callerid='$USERcallerid' and lead_id='$lead_id' order by auto_call_id limit 1;"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vac_count = mysqli_num_rows($rslt); + if ($vac_count>0) + { + $row=mysqli_fetch_row($rslt); + $USERcampaign_id = $row[0]; + + $stmt = "SELECT recording_dtmf_muting FROM vicidial_campaigns where campaign_id='$USERcampaign_id';"; + if (preg_match("/^Y|^DC/",$USERcallerid)) + {$stmt = "SELECT recording_dtmf_muting FROM vicidial_inbound_groups where group_id='$USERcampaign_id';";} + $rslt=mysql_to_mysqli($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vic_count = mysqli_num_rows($rslt); + if ($vic_count>0) + { + $row=mysqli_fetch_row($rslt); + $recording_dtmf_muting = $row[0]; + if ( ($SSrecording_dtmf_detection < 1) or ($SSrecording_dtmf_muting < 1) ) + {$recording_dtmf_muting=0;} + } + } + } + + if ( ($SSrecording_dtmf_detection > 0) and ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + ### insert record into recording_live table ### + $stmt = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','MONO_LEGACY','$server_ip','$NOW_TIME','$channel','$filename','$lead_id','$user','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_to_mysqli($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($FROMvdc=='YES') { ##### update vla record with recording_id @@ -2945,11 +2996,11 @@ if ( ($ACTION=="MonitorStereo") || ($ACTION=="StopMonitorStereo") ) ##### gather stereo recording settings for this specific campaign/in-group if ($VLA_inOUT == 'INBOUND') { - $stmt="SELECT stereo_recording,stereo_parallel_recording,stereo_rec_filename,stereo_recording_agent FROM vicidial_inbound_groups where group_id='$VDcampaign_id';"; + $stmt="SELECT stereo_recording,stereo_parallel_recording,stereo_rec_filename,stereo_recording_agent,recording_dtmf_muting FROM vicidial_inbound_groups where group_id='$VDcampaign_id';"; } else { - $stmt="SELECT stereo_recording,stereo_parallel_recording,stereo_rec_filename,stereo_recording_agent FROM vicidial_campaigns where campaign_id='$VDcampaign_id';"; + $stmt="SELECT stereo_recording,stereo_parallel_recording,stereo_rec_filename,stereo_recording_agent,recording_dtmf_muting FROM vicidial_campaigns where campaign_id='$VDcampaign_id';"; } $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02075',$user,$server_ip,$session_name,$one_mysql_log);} @@ -2962,6 +3013,9 @@ if ( ($ACTION=="MonitorStereo") || ($ACTION=="StopMonitorStereo") ) $stereo_parallel_recording = $row[1]; $stereo_rec_filename = $row[2]; $stereo_recording_agent = $row[3]; + $recording_dtmf_muting = $row[4]; + if ( ($SSrecording_dtmf_detection < 1) or ($SSrecording_dtmf_muting < 1) ) + {$recording_dtmf_muting=0;} } } @@ -3020,7 +3074,7 @@ if ( ($ACTION=="MonitorStereo") || ($ACTION=="StopMonitorStereo") ) if (preg_match("/RECID/",$filename) ) { - $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$server_ip','$stereo_exten','$NOW_TIME','$StarTtime','$stereo_rec_filename','$lead_id','$user','$VDvicidial_id')"; + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$call_server_ip','$stereo_exten','$NOW_TIME','$StarTtime','$stereo_rec_filename','$lead_id','$user','$VDvicidial_id')"; if ($format=='debug') {echo "\n";} $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02133',$user,$server_ip,$session_name,$one_mysql_log);} @@ -3039,7 +3093,7 @@ if ( ($ACTION=="MonitorStereo") || ($ACTION=="StopMonitorStereo") ) } else { - $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$server_ip','$stereo_exten','$NOW_TIME','$StarTtime','$stereo_rec_filename','$lead_id','$user','$VDvicidial_id')"; + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$call_server_ip','$stereo_exten','$NOW_TIME','$StarTtime','$stereo_rec_filename','$lead_id','$user','$VDvicidial_id')"; if ($format=='debug') {echo "\n";} $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02073',$user,$server_ip,$session_name,$one_mysql_log);} @@ -3068,12 +3122,14 @@ if ( ($ACTION=="MonitorStereo") || ($ACTION=="StopMonitorStereo") ) } # stereo_parallel_recording is enabled, only insert DB records, don't initiate recording - $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,recording_status,parallel_recording_id) values('$recording_id','$server_ip','$NOW_TIME','0','$stereo_rec_filename','$lead_id','$VDcampaign_id STEREO_PARALLEL AGENT-CONTROLLED $stereo_recording $stereo_recording_agent','start: $now_date|vicidial_id: $VDvicidial_id|user: $user|channel: $channel|','STEREO START','$parallel_recording_id');"; + $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,recording_status,parallel_recording_id) values('$recording_id','$call_server_ip','$NOW_TIME','0','$stereo_rec_filename','$lead_id','$VDcampaign_id STEREO_PARALLEL AGENT-CONTROLLED $stereo_recording $stereo_recording_agent','start: $now_date|vicidial_id: $VDvicidial_id|user: $user|channel: $channel|','STEREO START','$parallel_recording_id');"; if ($format=='debug') {echo "\n";} $rslt=mysql_to_mysqli($stmtA, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtA,'02166',$user,$server_ip,$session_name,$one_mysql_log);} - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO_PARALLEL AGENT-CONTROLLED','$server_ip','$NOW_TIME','$channel','$stereo_rec_filename','$lead_id','$user','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) and ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO_PARALLEL AGENT-CONTROLLED $stereo_exten','$call_server_ip','$NOW_TIME','$channel','$stereo_rec_filename','$lead_id','$user','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; if ($format=='debug') {echo "\n";} $rslt=mysql_to_mysqli($stmtD, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtD,'02167',$user,$server_ip,$session_name,$one_mysql_log);} @@ -3084,17 +3140,19 @@ if ( ($ACTION=="MonitorStereo") || ($ACTION=="StopMonitorStereo") ) $PATHmonitorT = '/var/spool/asterisk/monitorS'; $stereo_recording_options = "r($PATHmonitorT/$stereo_rec_filename-out.wav)t($PATHmonitorT/$stereo_rec_filename-in.wav)"; $vmgr_callerid = substr($stereo_rec_filename, 0, 17) . '...'; - $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','MixMonitor','$vmgr_callerid','ActionID: $vmgr_callerid','Channel: $channel','Options: $stereo_recording_options','','','','','','','');"; + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','MixMonitor','$vmgr_callerid','ActionID: $vmgr_callerid','Channel: $channel','Options: $stereo_recording_options','','','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02135',$user,$server_ip,$session_name,$one_mysql_log);} - $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,recording_status) values('$recording_id','$server_ip','$NOW_TIME','0','$stereo_rec_filename','$lead_id','$VDcampaign_id STEREO AGENT-CONTROLLED $stereo_recording $stereo_recording_agent','start: $now_date|vicidial_id: $VDvicidial_id|user: $user|channel: $channel|','STEREO START');"; + $stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log,recording_status) values('$recording_id','$call_server_ip','$NOW_TIME','0','$stereo_rec_filename','$lead_id','$VDcampaign_id STEREO AGENT-CONTROLLED $stereo_recording $stereo_recording_agent','start: $now_date|vicidial_id: $VDvicidial_id|user: $user|channel: $channel|','STEREO START');"; if ($format=='debug') {echo "\n";} $rslt=mysql_to_mysqli($stmtA, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtA,'02168',$user,$server_ip,$session_name,$one_mysql_log);} - $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO AGENT-CONTROLLED','$server_ip','$NOW_TIME','$channel','$stereo_rec_filename','$lead_id','$user','2020-12-31 23:59:59','STARTED');"; + if ( ($SSrecording_dtmf_detection > 0) and ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + $stmtD = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO AGENT-CONTROLLED $stereo_exten','$call_server_ip','$NOW_TIME','$channel','$stereo_rec_filename','$lead_id','$user','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; if ($format=='debug') {echo "\n";} $rslt=mysql_to_mysqli($stmtD, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmtD,'02169',$user,$server_ip,$session_name,$one_mysql_log);} @@ -3102,7 +3160,7 @@ if ( ($ACTION=="MonitorStereo") || ($ACTION=="StopMonitorStereo") ) if (preg_match("/CUSTOMER_ONLY/",$stereo_recording) ) { $vmgr_callerid = substr($stereo_rec_filename, 0, 16) . 'M...'; - $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','MixMonitorMute','$vmgr_callerid','ActionID: $vmgr_callerid','Channel: $channel','Direction: write','State: 1','','','','','','');"; + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','MixMonitorMute','$vmgr_callerid','ActionID: $vmgr_callerid','Channel: $channel','Direction: write','State: 1','','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02170',$user,$server_ip,$session_name,$one_mysql_log);} @@ -3110,7 +3168,7 @@ if ( ($ACTION=="MonitorStereo") || ($ACTION=="StopMonitorStereo") ) if (preg_match("/CUSTOMER_MUTE/",$stereo_recording) ) { $vmgr_callerid = substr($stereo_rec_filename, 0, 16) . 'M...'; - $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','MixMonitorMute','$vmgr_callerid','ActionID: $vmgr_callerid','Channel: $channel','Direction: read','State: 1','','','','','','');"; + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','MixMonitorMute','$vmgr_callerid','ActionID: $vmgr_callerid','Channel: $channel','Direction: read','State: 1','','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02171',$user,$server_ip,$session_name,$one_mysql_log);} @@ -3210,14 +3268,14 @@ if ( ($ACTION=="MonitorStereo") || ($ACTION=="StopMonitorStereo") ) if (!preg_match("/PARALLEL/",$recording_type)) { # stop all stereo recordings on the customer channel - $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','StopMixMonitor','$vmgr_callerid','ActionID: $vmgr_callerid','Channel: $channel','','','','','','','','');"; + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','StopMixMonitor','$vmgr_callerid','ActionID: $vmgr_callerid','Channel: $channel','','','','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02177',$user,$server_ip,$session_name,$one_mysql_log);} } } ##### END StopMonitorStereo steps ##### - echo _QXZ("%1s command sent for Channel %2s on %3s",0,'',$ACTION,$channel,$server_ip)."\nFilename: $filename\nRecorDing_ID: $recording_id\n RECORDING WILL LAST UP TO 60 MINUTES\n"; + echo _QXZ("%1s command sent for Channel %2s on %3s",0,'',$ACTION,$channel,$call_server_ip)."\nFilename: $filename\nRecorDing_ID: $recording_id\n RECORDING WILL LAST UP TO 60 MINUTES\n"; } } diff --git a/agc_2-X/trunk/www/agc/vdc_db_query.php b/agc_2-X/trunk/www/agc/vdc_db_query.php index afca9ffa..bd129408 100644 --- a/agc_2-X/trunk/www/agc/vdc_db_query.php +++ b/agc_2-X/trunk/www/agc/vdc_db_query.php @@ -553,7 +553,7 @@ # 240612-0206 - Fix for extension_appended_cidname newer options # 240801-1140 - Code updates for PHP8 compatibility # 240830-1618 - Added manual_minimum_ring_seconds SIP action lookup code -# 240906-1646 - Added testing for stereo_recording campaign option for manual dial calls *NOT PRODUCTION READY* +# 240906-1646 - Added testing for stereo_recording campaign option for manual dial calls # 250129-0900 - Fix for PHP8 TypeError # 250224-1642 - Fix for drop_lockout_time issue with NULL last_local_call_time DROP leads # 250311-1420 - Fix for start_call_url on inbound calls where blank and campaign set to ALT @@ -563,10 +563,11 @@ # 250916-1918 - Added stereo recording features # 250923-1755 - Added talk_sec_url features # 251002-1352 - Added call_count_limit_restrict campaign option +# 251005-0931 - Added code for recording_dtmf_muting # -$version = '2.14-456'; -$build = '251002-1352'; +$version = '2.14-457'; +$build = '251005-0931'; $php_script = 'vdc_db_query.php'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=995; @@ -575,6 +576,7 @@ $DB=0; $VD_login=0; $SSagent_debug_logging=0; $pause_to_code_jump=0; +$recording_dtmf_muting=0; $startMS = microtime(); require_once("dbconnect_mysqli.php"); @@ -1094,7 +1096,7 @@ $sip_hangup_cause_dictionary = array( ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db,qc_features_active,allow_emails,callback_time_24hour,enable_languages,language_method,agent_debug_logging,default_language,active_modules,allow_chats,default_phone_code,user_new_lead_limit,sip_event_logging,call_quota_lead_ranking,daily_call_count_limit,call_limit_24hour,allow_web_debug,abandon_check_queue,inbound_credits,stereo_recording,stereo_parallel_recording FROM system_settings;"; +$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db,qc_features_active,allow_emails,callback_time_24hour,enable_languages,language_method,agent_debug_logging,default_language,active_modules,allow_chats,default_phone_code,user_new_lead_limit,sip_event_logging,call_quota_lead_ranking,daily_call_count_limit,call_limit_24hour,allow_web_debug,abandon_check_queue,inbound_credits,stereo_recording,stereo_parallel_recording,recording_dtmf_detection,recording_dtmf_muting FROM system_settings;"; $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log);} #if ($DB) {echo "$stmt\n";} @@ -1130,6 +1132,8 @@ if ($qm_conf_ct > 0) $SSinbound_credits = $row[25]; $SSstereo_recording = $row[26]; $SSstereo_parallel_recording = $row[27]; + $SSrecording_dtmf_detection = $row[28]; + $SSrecording_dtmf_muting = $row[29]; } if ($SSallow_web_debug < 1) {$DB=0; $format='text';} ##### END SETTINGS LOOKUP ##### @@ -2433,7 +2437,7 @@ if ($ACTION == 'manDiaLnextCaLL') $local_call_time='24hours'; ##### gather local call time, user_group_script settings from campaign - $stmt="SELECT local_call_time,user_group_script,custom_one,custom_two,custom_three,custom_four,custom_five,state_descriptions FROM vicidial_campaigns where campaign_id='$campaign';"; + $stmt="SELECT local_call_time,user_group_script,custom_one,custom_two,custom_three,custom_four,custom_five,state_descriptions,recording_dtmf_muting FROM vicidial_campaigns where campaign_id='$campaign';"; $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00353',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -2449,6 +2453,9 @@ if ($ACTION == 'manDiaLnextCaLL') $camp_custom_four = $row[5]; $camp_custom_five = $row[6]; $state_descriptions = $row[7]; + $recording_dtmf_muting = $row[8]; + if ( ($SSrecording_dtmf_detection < 1) or ($SSrecording_dtmf_muting < 1) ) + {$recording_dtmf_muting=0;} } $stmt="SELECT user_group,territory FROM vicidial_users where user='$user';"; @@ -5394,6 +5401,14 @@ if ($ACTION == 'manDiaLnextCaLL') $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00733',$user,$server_ip,$session_name,$one_mysql_log);} + if ( ($SSrecording_dtmf_detection > 0) and ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + ### insert record into recording_live table ### + $stmt = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','MONO_LEGACY_RIR','$server_ip','$NOW_TIME','$channel','$recording_filename','$lead_id','$user','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_to_mysqli($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + ##### update vla record with recording_id $stmt = "UPDATE vicidial_live_agents SET external_recording='$recording_id' where user='$user';"; if ($format=='debug') {echo "\n";} @@ -6441,7 +6456,7 @@ if ($ACTION == 'manDiaLonly') ### check for manual dial filter and extension append settings in campaign $use_eac=0; $use_custom_cid='N'; - $stmt = "SELECT manual_dial_filter,use_internal_dnc,use_campaign_dnc,use_other_campaign_dnc,extension_appended_cidname,start_call_url,scheduled_callbacks_auto_reschedule,dial_timeout_lead_container,daily_call_count_limit,daily_limit_manual,call_limit_24hour_method,call_limit_24hour_scope,call_limit_24hour,call_limit_24hour_override,custom_one,custom_two,custom_three,custom_four,custom_five,daily_phone_number_call_limit,state_descriptions,call_count_limit_restrict,call_count_limit FROM vicidial_campaigns where campaign_id='$campaign';"; + $stmt = "SELECT manual_dial_filter,use_internal_dnc,use_campaign_dnc,use_other_campaign_dnc,extension_appended_cidname,start_call_url,scheduled_callbacks_auto_reschedule,dial_timeout_lead_container,daily_call_count_limit,daily_limit_manual,call_limit_24hour_method,call_limit_24hour_scope,call_limit_24hour,call_limit_24hour_override,custom_one,custom_two,custom_three,custom_four,custom_five,daily_phone_number_call_limit,state_descriptions,call_count_limit_restrict,call_count_limit,recording_dtmf_muting FROM vicidial_campaigns where campaign_id='$campaign';"; $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00325',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -6472,6 +6487,9 @@ if ($ACTION == 'manDiaLonly') $state_descriptions = $row[20]; $call_count_limit_restrict = $row[21]; $call_count_limit = $row[22]; + $recording_dtmf_muting = $row[23]; + if ( ($SSrecording_dtmf_detection < 1) or ($SSrecording_dtmf_muting < 1) ) + {$recording_dtmf_muting=0;} } # check for user overrides @@ -7441,6 +7459,14 @@ if ($ACTION == 'manDiaLonly') $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00740',$user,$server_ip,$session_name,$one_mysql_log);} + if ( ($SSrecording_dtmf_detection > 0) and ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + ### insert record into recording_live table ### + $stmt = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','MONO_LEGACY_RIR','$server_ip','$NOW_TIME','$channel','$recording_filename','$lead_id','$user','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_to_mysqli($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + ##### update vla record with recording_id $stmt = "UPDATE vicidial_live_agents SET external_recording='$recording_id' where user='$user';"; if ($format=='debug') {echo "\n";} @@ -8184,7 +8210,7 @@ if ($ACTION == 'manDiaLlookCaLL') $row=mysqli_fetch_row($rslt); if ( $row[0] == 'CONFBRIDGE' ) { - $stmt="SELECT stereo_recording,stereo_parallel_recording,stereo_rec_filename,stereo_recording_agent,parallel_rec_co_filename,parallel_rec_cm_filename,parallel_rec_fr_filename FROM vicidial_campaigns where campaign_id='$campaign';"; + $stmt="SELECT stereo_recording,stereo_parallel_recording,stereo_rec_filename,stereo_recording_agent,parallel_rec_co_filename,parallel_rec_cm_filename,parallel_rec_fr_filename,recording_dtmf_muting FROM vicidial_campaigns where campaign_id='$campaign';"; $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00921',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -8199,6 +8225,9 @@ if ($ACTION == 'manDiaLlookCaLL') $parallel_rec_co_filename = $row[4]; $parallel_rec_cm_filename = $row[5]; $parallel_rec_fr_filename = $row[6]; + $recording_dtmf_muting = $row[7]; + if ( ($SSrecording_dtmf_detection < 1) or ($SSrecording_dtmf_muting < 1) ) + {$recording_dtmf_muting=0;} } if ( (preg_match("/CUSTOMER|BOTH/",$stereo_recording) ) and (strlen($stereo_rec_filename) > 5) ) @@ -8302,8 +8331,10 @@ if ($ACTION == 'manDiaLlookCaLL') $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00927',$user,$server_ip,$session_name,$one_mysql_log);} + if ( ($SSrecording_dtmf_detection > 0) and ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } ### insert record into recording_live table ### - $stmt = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO_PARALLEL CUSTOMER-ONLY','$server_ip','$NOW_TIME','$channel','$temp_parallel_rec_co_filename','$lead_id','$user','2020-12-31 23:59:59','STARTED');"; + $stmt = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO_PARALLEL CUSTOMER-ONLY','$server_ip','$NOW_TIME','$channel','$temp_parallel_rec_co_filename','$lead_id','$user','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; if ($format=='debug') {echo "\n";} $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00928',$user,$server_ip,$session_name,$one_mysql_log);} @@ -8353,8 +8384,10 @@ if ($ACTION == 'manDiaLlookCaLL') $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00931',$user,$server_ip,$session_name,$one_mysql_log);} + if ( ($SSrecording_dtmf_detection > 0) and ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } ### insert record into recording_live table ### - $stmt = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO_PARALLEL CUSTOMER-MUTED','$server_ip','$NOW_TIME','$channel','$temp_parallel_rec_cm_filename','$lead_id','$user','2020-12-31 23:59:59','STARTED');"; + $stmt = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO_PARALLEL CUSTOMER-MUTED','$server_ip','$NOW_TIME','$channel','$temp_parallel_rec_cm_filename','$lead_id','$user','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; if ($format=='debug') {echo "\n";} $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00932',$user,$server_ip,$session_name,$one_mysql_log);} @@ -8404,8 +8437,10 @@ if ($ACTION == 'manDiaLlookCaLL') $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00935',$user,$server_ip,$session_name,$one_mysql_log);} + if ( ($SSrecording_dtmf_detection > 0) and ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } ### insert record into recording_live table ### - $stmt = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO_PARALLEL FULL-RECORDING','$server_ip','$NOW_TIME','$channel','$temp_parallel_rec_fr_filename','$lead_id','$user','2020-12-31 23:59:59','STARTED');"; + $stmt = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO_PARALLEL FULL-RECORDING','$server_ip','$NOW_TIME','$channel','$temp_parallel_rec_fr_filename','$lead_id','$user','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; if ($format=='debug') {echo "\n";} $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00936',$user,$server_ip,$session_name,$one_mysql_log);} @@ -8449,8 +8484,10 @@ if ($ACTION == 'manDiaLlookCaLL') $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00939',$user,$server_ip,$session_name,$one_mysql_log);} + if ( ($SSrecording_dtmf_detection > 0) and ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } ### insert record into recording_live table ### - $stmt = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO_PARALLEL AGENT-CONTROLLED','$server_ip','$NOW_TIME','$channel','$temp_parallel_rec_ag_filename','$lead_id','$user','2020-12-31 23:59:59','STARTED');"; + $stmt = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO_PARALLEL AGENT-CONTROLLED','$server_ip','$NOW_TIME','$channel','$temp_parallel_rec_ag_filename','$lead_id','$user','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; if ($format=='debug') {echo "\n";} $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00940',$user,$server_ip,$session_name,$one_mysql_log);} @@ -8465,9 +8502,15 @@ if ($ACTION == 'manDiaLlookCaLL') if ((preg_match("/ALLCALLS|ALLFORCE/",$stereo_recording_agent))) { $stereo_ac='SAC-'.$stereo_recording_agent."\n"; + $rl_exten='SACBC'; + if (preg_match("/CUSTOMER_ONLY/",$stereo_recording) ) + {$rl_exten='SACCO';} + if (preg_match("/CUSTOMER_MUTE/",$stereo_recording) ) + {$rl_exten='SACCM';} + ## Start NON-parallel stereo call recording ## # insert a record into the recording_log table - $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$server_ip','SAC','$NOW_TIME','$StarTtime','$stereo_rec_filename','$lead_id','$user','$uniqueid')"; + $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('$channel','$server_ip','$rl_exten','$NOW_TIME','$StarTtime','$stereo_rec_filename','$lead_id','$user','$uniqueid')"; if ($format=='debug') {echo "\n";} $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00941',$user,$server_ip,$session_name,$one_mysql_log);} @@ -8498,8 +8541,10 @@ if ($ACTION == 'manDiaLlookCaLL') $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00944',$user,$server_ip,$session_name,$one_mysql_log);} + if ( ($SSrecording_dtmf_detection > 0) and ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } ### insert record into recording_live table ### - $stmt = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status) values('$recording_id','STEREO AGENT-CONTROLLED','$server_ip','$NOW_TIME','$channel','$stereo_rec_filename','$lead_id','$user','2020-12-31 23:59:59','STARTED');"; + $stmt = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','STEREO AGENT-CONTROLLED $rl_exten','$server_ip','$NOW_TIME','$channel','$stereo_rec_filename','$lead_id','$user','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; if ($format=='debug') {echo "\n";} $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00945',$user,$server_ip,$session_name,$one_mysql_log);} @@ -9064,7 +9109,7 @@ if ($stage == "end") if ($auto_dial_level > 0) { ### check to see if campaign has alt_dial enabled - $stmt="SELECT auto_alt_dial,use_internal_dnc,use_campaign_dnc,use_other_campaign_dnc,daily_call_count_limit,daily_limit_manual,call_limit_24hour_method,call_limit_24hour_scope,call_limit_24hour,call_limit_24hour_override,auto_alt_threshold,daily_phone_number_call_limit,call_count_limit_restrict,call_count_limit FROM vicidial_campaigns where campaign_id='$campaign';"; + $stmt="SELECT auto_alt_dial,use_internal_dnc,use_campaign_dnc,use_other_campaign_dnc,daily_call_count_limit,daily_limit_manual,call_limit_24hour_method,call_limit_24hour_scope,call_limit_24hour,call_limit_24hour_override,auto_alt_threshold,daily_phone_number_call_limit,call_count_limit_restrict,call_count_limit,recording_dtmf_muting FROM vicidial_campaigns where campaign_id='$campaign';"; $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00064',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -9086,6 +9131,9 @@ if ($stage == "end") $daily_phone_number_call_limit = $row[11]; $call_count_limit_restrict = $row[12]; $call_count_limit = $row[13]; + $recording_dtmf_muting = $row[14]; + if ( ($SSrecording_dtmf_detection < 1) or ($SSrecording_dtmf_muting < 1) ) + {$recording_dtmf_muting=0;} } else {$auto_alt_dial = 'NONE';} $alt_lead_done=0; @@ -10306,6 +10354,14 @@ if ($stage == "end") $recording_id = mysqli_insert_id($link); } } + + if ( ($SSrecording_dtmf_detection > 0) and ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } + ### insert record into recording_live table ### + $stmt = "INSERT INTO recording_live (recording_id,recording_type,server_ip,start_time,channel,filename,lead_id,user,dtmf_muting_end_time,recording_status,dtmf_muting_seconds) values('$recording_id','MONO_LEGACY_3WAY','$server_ip','$NOW_TIME','$channel','$leave_3way_start_recording_filename','$lead_id','$user','2020-12-31 23:59:59','STARTED','$recording_dtmf_muting');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_to_mysqli($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} } ##### END leave_3way_start_recording if triggered ##### @@ -10457,6 +10513,7 @@ if ($ACTION == 'VDADcheckINCOMING') # default to $fronter=$user, closer blank $fronter = $user; $closer=''; + $recording_dtmf_muting=0; if ( (strlen($campaign)<1) || (strlen($server_ip)<1) ) { @@ -11092,7 +11149,7 @@ if ($ACTION == 'VDADcheckINCOMING') $ig_custom_five=''; $ig_state_descriptions=''; - $stmt = "SELECT group_name,group_color,web_form_address,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,default_xfer_group,ingroup_recording_override,ingroup_rec_filename,default_group_alias,web_form_address_two,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,uniqueid_status_display,uniqueid_status_prefix,timer_action_destination,web_form_address_three,status_group_id,inbound_survey,ingroup_script_two,browser_alert_sound,browser_alert_volume,custom_one,custom_two,custom_three,custom_four,custom_five,state_descriptions,stereo_recording,stereo_recording_agent from vicidial_inbound_groups where group_id='$VDADchannel_group';"; + $stmt = "SELECT group_name,group_color,web_form_address,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,default_xfer_group,ingroup_recording_override,ingroup_rec_filename,default_group_alias,web_form_address_two,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,uniqueid_status_display,uniqueid_status_prefix,timer_action_destination,web_form_address_three,status_group_id,inbound_survey,ingroup_script_two,browser_alert_sound,browser_alert_volume,custom_one,custom_two,custom_three,custom_four,custom_five,state_descriptions,stereo_recording,stereo_recording_agent,recording_dtmf_muting from vicidial_inbound_groups where group_id='$VDADchannel_group';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00119',$user,$server_ip,$session_name,$one_mysql_log);} @@ -11139,6 +11196,9 @@ if ($ACTION == 'VDADcheckINCOMING') $ig_state_descriptions = $row[37]; $stereo_recording = $row[38]; $stereo_recording_agent = $row[39]; + $recording_dtmf_muting = $row[40]; + if ( ($SSrecording_dtmf_detection < 1) or ($SSrecording_dtmf_muting < 1) ) + {$recording_dtmf_muting=0;} $status_group_gather_data = status_group_gather($row[27],'INGROUP'); @@ -11524,9 +11584,11 @@ if ($ACTION == 'VDADcheckINCOMING') } } + if ( ($SSrecording_dtmf_detection > 0) and ($SSrecording_dtmf_muting > 0) ) + {if ($SSrecording_dtmf_muting > 1) {$recording_dtmf_muting = $SSrecording_dtmf_muting;} } ### if web form is set then send on to vicidial.php for override of WEB_FORM address - if ( (strlen($VDCL_group_web)>5) or (strlen($VDCL_group_name)>0) ) {echo "$VDCL_group_web|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|$VDCL_ingroup_recording_override|$VDCL_ingroup_rec_filename|$VDCL_default_group_alias|$VDCL_caller_id_number|$VDCL_group_web_vars|$VDCL_group_web_two|$VDCL_timer_action|$VDCL_timer_action_message|$VDCL_timer_action_seconds|$VDCL_xferconf_c_number|$VDCL_xferconf_d_number|$VDCL_xferconf_e_number|$VDCL_uniqueid_status_display|$custom_call_id|$VDCL_uniqueid_status_prefix|$VDCL_timer_action_destination|$DID_id|$DID_extension|$DID_pattern|$DID_description|$INclosecallid|$INxfercallid|$VDCL_group_web_three|$VDCL_ingroup_script_color|$VDCL_inbound_survey|$VDCL_survey_participate|$VDCL_ingroup_script_two|$VDCL_ingroup_script_color_two|$VDCL_browser_alert_sound|$VDCL_browser_alert_volume|$stereo_recording|$stereo_recording_agent|$talk_sec_urls_secs|\n";} - else {echo "X|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|$VDCL_ingroup_recording_override|$VDCL_ingroup_rec_filename|$VDCL_default_group_alias|$VDCL_caller_id_number|$VDCL_group_web_vars|$VDCL_group_web_two|$VDCL_timer_action|$VDCL_timer_action_message|$VDCL_timer_action_seconds|$VDCL_xferconf_c_number|$VDCL_xferconf_d_number|$VDCL_xferconf_e_number|$VDCL_uniqueid_status_display|$custom_call_id|$VDCL_uniqueid_status_prefix|$VDCL_timer_action_destination|$DID_id|$DID_extension|$DID_pattern|$DID_description|$INclosecallid|$INxfercallid|$VDCL_group_web_three|$VDCL_ingroup_script_color|$VDCL_inbound_survey|$VDCL_survey_participate|$VDCL_ingroup_script_two|$VDCL_ingroup_script_color_two|$VDCL_browser_alert_sound|$VDCL_browser_alert_volume|$stereo_recording|$stereo_recording_agent|$talk_sec_urls_secs|\n";} + if ( (strlen($VDCL_group_web)>5) or (strlen($VDCL_group_name)>0) ) {echo "$VDCL_group_web|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|$VDCL_ingroup_recording_override|$VDCL_ingroup_rec_filename|$VDCL_default_group_alias|$VDCL_caller_id_number|$VDCL_group_web_vars|$VDCL_group_web_two|$VDCL_timer_action|$VDCL_timer_action_message|$VDCL_timer_action_seconds|$VDCL_xferconf_c_number|$VDCL_xferconf_d_number|$VDCL_xferconf_e_number|$VDCL_uniqueid_status_display|$custom_call_id|$VDCL_uniqueid_status_prefix|$VDCL_timer_action_destination|$DID_id|$DID_extension|$DID_pattern|$DID_description|$INclosecallid|$INxfercallid|$VDCL_group_web_three|$VDCL_ingroup_script_color|$VDCL_inbound_survey|$VDCL_survey_participate|$VDCL_ingroup_script_two|$VDCL_ingroup_script_color_two|$VDCL_browser_alert_sound|$VDCL_browser_alert_volume|$stereo_recording|$stereo_recording_agent|$talk_sec_urls_secs|$recording_dtmf_muting|\n";} + else {echo "X|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|$VDCL_ingroup_recording_override|$VDCL_ingroup_rec_filename|$VDCL_default_group_alias|$VDCL_caller_id_number|$VDCL_group_web_vars|$VDCL_group_web_two|$VDCL_timer_action|$VDCL_timer_action_message|$VDCL_timer_action_seconds|$VDCL_xferconf_c_number|$VDCL_xferconf_d_number|$VDCL_xferconf_e_number|$VDCL_uniqueid_status_display|$custom_call_id|$VDCL_uniqueid_status_prefix|$VDCL_timer_action_destination|$DID_id|$DID_extension|$DID_pattern|$DID_description|$INclosecallid|$INxfercallid|$VDCL_group_web_three|$VDCL_ingroup_script_color|$VDCL_inbound_survey|$VDCL_survey_participate|$VDCL_ingroup_script_two|$VDCL_ingroup_script_color_two|$VDCL_browser_alert_sound|$VDCL_browser_alert_volume|$stereo_recording|$stereo_recording_agent|$talk_sec_urls_secs|$recording_dtmf_muting|\n";} if (strlen($fronter) < 2) {$fronter = $tsr;} $stmt = "SELECT full_name from vicidial_users where user='$fronter';"; diff --git a/agc_2-X/trunk/www/agc/vicidial.php b/agc_2-X/trunk/www/agc/vicidial.php index 3165b847..d26eeb71 100644 --- a/agc_2-X/trunk/www/agc/vicidial.php +++ b/agc_2-X/trunk/www/agc/vicidial.php @@ -751,10 +751,11 @@ # 250916-2055 - Added stereo recording features # 250924-0953 - Added Talk Seconds URLs features # 251002-1353 - Added call_count_limit_restrict campaign option +# 251020-0849 - Added code for recording_dtmf_muting, fix for Stereo Call Recording # -$version = '2.14-717c'; -$build = '251002-1353'; +$version = '2.14-718c'; +$build = '251020-0849'; $php_script = 'vicidial.php'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=108; @@ -864,7 +865,7 @@ $random = (rand(1000000, 9999999) + 10000000); ############################################# ##### START SYSTEM_SETTINGS AND USER LANGUAGE LOOKUP ##### -$stmt = "SELECT use_non_latin,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,webroot_writable,timeclock_end_of_day,vtiger_url,enable_vtiger_integration,outbound_autodial_active,enable_second_webform,user_territories_active,static_agent_url,custom_fields_enabled,pllb_grouping_limit,qc_features_active,allow_emails,callback_time_24hour,enable_languages,language_method,meetme_enter_login_filename,meetme_enter_leave3way_filename,enable_third_webform,default_language,active_modules,allow_chats,chat_url,default_phone_code,agent_screen_colors,manual_auto_next,agent_xfer_park_3way,admin_web_directory,agent_script,agent_push_events,agent_push_url,agent_logout_link,agentonly_callback_campaign_lock,manual_dial_validation,mute_recordings,enable_second_script,enable_first_webform,recording_buttons,outbound_cid_any,browser_call_alerts,manual_dial_phone_strip,require_password_length,pass_hash_enabled,agent_hidden_sound_seconds,agent_hidden_sound,agent_hidden_sound_volume,agent_screen_timer,agent_hide_hangup,allow_web_debug,max_logged_in_agents,login_kickall,agent_notifications,inbound_credits,two_factor_auth_agent_hours,two_factor_container,sip_event_logging,stereo_recording,agent_hide_dial_fail,agent_man_dial_filter,agent_3way_dial_filter FROM system_settings;"; +$stmt = "SELECT use_non_latin,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,webroot_writable,timeclock_end_of_day,vtiger_url,enable_vtiger_integration,outbound_autodial_active,enable_second_webform,user_territories_active,static_agent_url,custom_fields_enabled,pllb_grouping_limit,qc_features_active,allow_emails,callback_time_24hour,enable_languages,language_method,meetme_enter_login_filename,meetme_enter_leave3way_filename,enable_third_webform,default_language,active_modules,allow_chats,chat_url,default_phone_code,agent_screen_colors,manual_auto_next,agent_xfer_park_3way,admin_web_directory,agent_script,agent_push_events,agent_push_url,agent_logout_link,agentonly_callback_campaign_lock,manual_dial_validation,mute_recordings,enable_second_script,enable_first_webform,recording_buttons,outbound_cid_any,browser_call_alerts,manual_dial_phone_strip,require_password_length,pass_hash_enabled,agent_hidden_sound_seconds,agent_hidden_sound,agent_hidden_sound_volume,agent_screen_timer,agent_hide_hangup,allow_web_debug,max_logged_in_agents,login_kickall,agent_notifications,inbound_credits,two_factor_auth_agent_hours,two_factor_container,sip_event_logging,stereo_recording,agent_hide_dial_fail,agent_man_dial_filter,agent_3way_dial_filter,recording_dtmf_detection,recording_dtmf_muting FROM system_settings;"; $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01001',$VD_login,$server_ip,$session_name,$one_mysql_log);} #if ($DB) {echo "$stmt\n";} @@ -935,6 +936,8 @@ if ($qm_conf_ct > 0) $SSagent_hide_dial_fail = $row[60]; $SSagent_man_dial_filter = $row[61]; $SSagent_3way_dial_filter = $row[62]; + $SSrecording_dtmf_detection = $row[63]; + $SSrecording_dtmf_muting = $row[64]; if ( ($SSagent_hidden_sound == '---NONE---') or ($SSagent_hidden_sound == '') ) {$SSagent_hidden_sound_seconds=0;} } else @@ -3157,7 +3160,7 @@ else $HKstatusnames = substr("$HKstatusnames", 0, -1); ##### grab the campaign settings - $stmt="SELECT park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,agent_pause_codes_active,no_hopper_leads_logins,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,xfer_groups,disable_alter_custphone,display_queue_count,manual_dial_filter,agent_clipboard_copy,use_campaign_dnc,three_way_call_cid,dial_method,three_way_dial_prefix,web_form_target,vtiger_screen_login,agent_allow_group_alias,default_group_alias,quick_transfer_button,prepopulate_transfer_preset,view_calls_in_queue,view_calls_in_queue_launch,call_requeue_button,pause_after_each_call,no_hopper_dialing,agent_dial_owner_only,agent_display_dialable_leads,web_form_address_two,agent_select_territories,crm_popup_login,crm_login_address,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,use_custom_cid,scheduled_callbacks_alert,scheduled_callbacks_count,manual_dial_override,blind_monitor_warning,blind_monitor_message,blind_monitor_filename,timer_action_destination,enable_xfer_presets,hide_xfer_number_to_dial,manual_dial_prefix,customer_3way_hangup_logging,customer_3way_hangup_seconds,customer_3way_hangup_action,ivr_park_call,manual_preview_dial,api_manual_dial,manual_dial_call_time_check,my_callback_option,per_call_notes,agent_lead_search,agent_lead_search_method,queuemetrics_phone_environment,auto_pause_precall,auto_pause_precall_code,auto_resume_precall,manual_dial_cid,custom_3way_button_transfer,callback_days_limit,disable_dispo_screen,disable_dispo_status,screen_labels,status_display_fields,pllb_grouping,pllb_grouping_limit,in_group_dial,in_group_dial_select,pause_after_next_call,owner_populate,manual_dial_lead_id,dead_max,dispo_max,pause_max,dead_max_dispo,dispo_max_dispo,max_inbound_calls,manual_dial_search_checkbox,hide_call_log_info,timer_alt_seconds,wrapup_bypass,wrapup_after_hotkey,callback_active_limit,callback_active_limit_override,comments_all_tabs,comments_dispo_screen,comments_callback_screen,qc_comment_history,show_previous_callback,clear_script,manual_dial_search_filter,web_form_address_three,manual_dial_override_field,status_display_ingroup,customer_gone_seconds,agent_display_fields,manual_dial_timeout,manual_auto_next,manual_auto_show,allow_required_fields,dead_to_dispo,agent_xfer_validation,ready_max_logout,callback_display_days,three_way_record_stop,hangup_xfer_record_start,max_inbound_calls_outcome,manual_auto_next_options,agent_screen_time_display,pause_max_dispo,script_top_dispo,routing_initiated_recordings,dead_trigger_seconds,dead_trigger_action,dead_trigger_repeat,dead_trigger_filename,scheduled_callbacks_force_dial,callback_hours_block,callback_display_days,scheduled_callbacks_timezones_container,three_way_volume_buttons,manual_dial_validation,mute_recordings,leave_vm_no_dispo,leave_vm_message_group_id,campaign_script_two,browser_alert_sound,browser_alert_volume,three_way_record_stop_exception,pause_max_exceptions,transfer_button_launch,leave_3way_start_recording,leave_3way_start_recording_exception,calls_waiting_vl_one,calls_waiting_vl_two,in_man_dial_next_ready_seconds,in_man_dial_next_ready_seconds_override,transfer_no_dispo,local_call_time,pause_max_url,agent_hide_hangup,ig_xfer_list_sort,script_tab_frame_size,user_group_script,agent_hangup_route,agent_hangup_value,agent_hangup_ig_override,show_confetti,custom_one,custom_two,custom_three,custom_four,custom_five,allow_chats,dead_stop_recording,force_per_call_notes,state_descriptions,script_tab_height,leave_3way_stop_recording,manual_minimum_ring_seconds,manual_minimum_attempt_seconds,manual_minimum_answer_seconds,sip_event_logging,stereo_recording,stereo_recording_agent FROM vicidial_campaigns where campaign_id = '$VD_campaign';"; + $stmt="SELECT park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,agent_pause_codes_active,no_hopper_leads_logins,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,xfer_groups,disable_alter_custphone,display_queue_count,manual_dial_filter,agent_clipboard_copy,use_campaign_dnc,three_way_call_cid,dial_method,three_way_dial_prefix,web_form_target,vtiger_screen_login,agent_allow_group_alias,default_group_alias,quick_transfer_button,prepopulate_transfer_preset,view_calls_in_queue,view_calls_in_queue_launch,call_requeue_button,pause_after_each_call,no_hopper_dialing,agent_dial_owner_only,agent_display_dialable_leads,web_form_address_two,agent_select_territories,crm_popup_login,crm_login_address,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,use_custom_cid,scheduled_callbacks_alert,scheduled_callbacks_count,manual_dial_override,blind_monitor_warning,blind_monitor_message,blind_monitor_filename,timer_action_destination,enable_xfer_presets,hide_xfer_number_to_dial,manual_dial_prefix,customer_3way_hangup_logging,customer_3way_hangup_seconds,customer_3way_hangup_action,ivr_park_call,manual_preview_dial,api_manual_dial,manual_dial_call_time_check,my_callback_option,per_call_notes,agent_lead_search,agent_lead_search_method,queuemetrics_phone_environment,auto_pause_precall,auto_pause_precall_code,auto_resume_precall,manual_dial_cid,custom_3way_button_transfer,callback_days_limit,disable_dispo_screen,disable_dispo_status,screen_labels,status_display_fields,pllb_grouping,pllb_grouping_limit,in_group_dial,in_group_dial_select,pause_after_next_call,owner_populate,manual_dial_lead_id,dead_max,dispo_max,pause_max,dead_max_dispo,dispo_max_dispo,max_inbound_calls,manual_dial_search_checkbox,hide_call_log_info,timer_alt_seconds,wrapup_bypass,wrapup_after_hotkey,callback_active_limit,callback_active_limit_override,comments_all_tabs,comments_dispo_screen,comments_callback_screen,qc_comment_history,show_previous_callback,clear_script,manual_dial_search_filter,web_form_address_three,manual_dial_override_field,status_display_ingroup,customer_gone_seconds,agent_display_fields,manual_dial_timeout,manual_auto_next,manual_auto_show,allow_required_fields,dead_to_dispo,agent_xfer_validation,ready_max_logout,callback_display_days,three_way_record_stop,hangup_xfer_record_start,max_inbound_calls_outcome,manual_auto_next_options,agent_screen_time_display,pause_max_dispo,script_top_dispo,routing_initiated_recordings,dead_trigger_seconds,dead_trigger_action,dead_trigger_repeat,dead_trigger_filename,scheduled_callbacks_force_dial,callback_hours_block,callback_display_days,scheduled_callbacks_timezones_container,three_way_volume_buttons,manual_dial_validation,mute_recordings,leave_vm_no_dispo,leave_vm_message_group_id,campaign_script_two,browser_alert_sound,browser_alert_volume,three_way_record_stop_exception,pause_max_exceptions,transfer_button_launch,leave_3way_start_recording,leave_3way_start_recording_exception,calls_waiting_vl_one,calls_waiting_vl_two,in_man_dial_next_ready_seconds,in_man_dial_next_ready_seconds_override,transfer_no_dispo,local_call_time,pause_max_url,agent_hide_hangup,ig_xfer_list_sort,script_tab_frame_size,user_group_script,agent_hangup_route,agent_hangup_value,agent_hangup_ig_override,show_confetti,custom_one,custom_two,custom_three,custom_four,custom_five,allow_chats,dead_stop_recording,force_per_call_notes,state_descriptions,script_tab_height,leave_3way_stop_recording,manual_minimum_ring_seconds,manual_minimum_attempt_seconds,manual_minimum_answer_seconds,sip_event_logging,stereo_recording,stereo_recording_agent,recording_dtmf_muting FROM vicidial_campaigns where campaign_id = '$VD_campaign';"; $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01013',$VD_login,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -3362,6 +3365,7 @@ else $CAMPsip_event_logging = $row[197]; $stereo_recording = $row[198]; $stereo_recording_agent = $row[199]; + $recording_dtmf_muting = $row[200]; if ( (!preg_match("/DISABLED/",$VU_manual_dial_lead_id)) and (strlen($VU_manual_dial_lead_id) > 0) ) { @@ -3504,7 +3508,7 @@ else if (preg_match("/EXTERNAL/",$transfer_no_dispo)) {$transfer_no_dispoEXTERNAL=1;} if (preg_match("/LEAVE3WAY/",$transfer_no_dispo)) {$transfer_no_dispoLEAVE3WAY=1;} - if ($SSmute_recordings < 1) + if ( ($SSmute_recordings < 1) or ( ($SSrecording_dtmf_detection > 0) and ($SSrecording_dtmf_muting > 0) and ($recording_dtmf_muting > 0) ) ) {$mute_recordings='N';} else { @@ -6796,6 +6800,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var MDOalt=''; var manual_entry_dial=0; var mute_recordings=''; + var recording_dtmf_muting=''; var leave_vm_no_dispo=''; var leave_vm_message_group_id=''; var leave_vm_message_group_exists=''; @@ -6866,6 +6871,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var agent_hide_dial_fail=''; var agent_hide_dial_fail_MESSAGE=""; var talk_sec_url_secs=''; + var redirectserverip=''; var DiaLControl_auto_HTML = "\" border=\"0\" alt=\"You are paused\" />"; var DiaLControl_auto_HTML_ready = "\" border=\"0\" alt=\"You are active\" />"; var DiaLControl_auto_HTML_OFF = "\" border=\"0\" alt=\"pause button disabled\" />"; @@ -9139,7 +9145,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { document.getElementById("RecorDControl").innerHTML = conf_rec_start_html; } - if (mute_recordings == 'Y') + if ( (mute_recordings == 'Y') && (recording_dtmf_muting < 1) ) { document.getElementById("RecorDMute").innerHTML = conf_rec_mute_html; } @@ -9219,7 +9225,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { document.getElementById("RecorDControl").innerHTML = conf_rec_start_html; } - if (mute_recordings == 'Y') + if ( (mute_recordings == 'Y') && (recording_dtmf_muting < 1) ) { document.getElementById("RecorDMute").innerHTML = conf_rec_mute_html; } @@ -9305,7 +9311,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) document.getElementById("StRecorDControl").innerHTML = conf_rec_start_html; } } - confmonitor_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&campaign=" + campaign + "&user=" + user + "&pass=" + pass + "&ACTION=" + taskconfrectype + "&format=text&channel=" + lastcustchannel + "&filename=NOfilenameNEEDED&exten=" + query_recording_exten + "&ext_context=" + ext_context + "&lead_id=" + document.vicidial_form.lead_id.value + "&CalLCID=" + LasTCID + "&phone_number=" + lead_dial_number + "&ext_priority=1&FROMvdc=YES&uniqueid=" + tmp_vicidial_id + "&FROMapi=" + taskfromapi; + confmonitor_query = "server_ip=" + server_ip + "&call_server_ip=" + lastcustserverip + "&session_name=" + session_name + "&campaign=" + campaign + "&user=" + user + "&pass=" + pass + "&ACTION=" + taskconfrectype + "&format=text&channel=" + lastcustchannel + "&filename=NOfilenameNEEDED&exten=" + query_recording_exten + "&ext_context=" + ext_context + "&lead_id=" + document.vicidial_form.lead_id.value + "&CalLCID=" + LasTCID + "&phone_number=" + lead_dial_number + "&ext_priority=1&FROMvdc=YES&uniqueid=" + tmp_vicidial_id + "&FROMapi=" + taskfromapi; xmlhttp.open('POST', 'manager_send.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(confmonitor_query); @@ -9401,7 +9407,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) if (xmlhttpXF) { var redirectvalue = MDchannel; - var redirectserverip = lastcustserverip; + redirectserverip = lastcustserverip; if (redirectvalue.length < 2) {redirectvalue = lastcustchannel} if ( (taskvar == 'XfeRBLIND') || (taskvar == 'XfeRVMAIL') ) @@ -9822,7 +9828,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) if (xmlhttpXF) { var redirectvalue = MDchannel; - var redirectserverip = lastcustserverip; + redirectserverip = lastcustserverip; var queryCID=''; var exten=''; var ext_context=''; @@ -14315,6 +14321,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) VDICstereo_recording = VDIC_data_VDIG[42]; VDICstereo_recording_agent = VDIC_data_VDIG[43]; talk_sec_url_secs = VDIC_data_VDIG[44]; + recording_dtmf_muting = VDIC_data_VDIG[45]; // alert("talk_sec_url_secs: |" + talk_sec_url_secs + "|"); var VDIC_data_VDFR=check_VDIC_array[3].split("|"); if ( (VDIC_data_VDFR[1].length > 1) && (VDCL_fronter_display == 'Y') ) diff --git a/agc_2-X/trunk/www/vicidial/admin.php b/agc_2-X/trunk/www/vicidial/admin.php index 91e706a2..398d131c 100644 --- a/agc_2-X/trunk/www/vicidial/admin.php +++ b/agc_2-X/trunk/www/vicidial/admin.php @@ -6290,12 +6290,13 @@ if ($SSscript_remove_js > 0) # 250822-2056 - Added system/campaign/ingroup settings for stereo_recording # 250922-0841 - Added Talk Seconds URL links to multi-url admin page in campaigns and in-groups # 251002-1428 - Added call_count_limit_restrict campaign setting +# 251019-2024 - Added Recording DTMF Muting # # 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-945a'; -$build = '251002-1428'; +$admin_version = '2.14-946a'; +$build = '251019-2024'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -28184,9 +28185,11 @@ if ($ADD==31) { echo "\n"; } - if ( ( ($SSrecording_dtmf_muting =='1') or ($SSrecording_dtmf_muting =='2') or ($SSrecording_dtmf_muting =='3') ) and ($SSrecording_dtmf_detection == '1') ) + if ( ( ($SSrecording_dtmf_muting =='1') or ($SSrecording_dtmf_muting >= 2) ) and ($SSrecording_dtmf_detection == '1') ) { - echo ""._QXZ("Recording DTMF Muting").": $NWB#campaigns-recording_dtmf_muting$NWE\n"; + $SYSTEM_DTMF_MUTING_OVERRIDE=''; + if ($SSrecording_dtmf_muting >= 2) {$SYSTEM_DTMF_MUTING_OVERRIDE = ""._QXZ("SYSTEM OVERRIDE ENABLED").": $SSrecording_dtmf_muting "._QXZ("SECONDS")."";} + echo ""._QXZ("Recording DTMF Muting").": $NWB#campaigns-recording_dtmf_muting$NWE $SYSTEM_DTMF_MUTING_OVERRIDE \n"; } else { @@ -31464,22 +31467,61 @@ if ($ADD==34) echo "\n"; echo "\n"; - $stmt="SELECT vu.user,vca.campaign_rank,vca.calls_today,full_name,vca.campaign_grade from vicidial_campaign_agents vca, vicidial_users vu where campaign_id='$campaign_id' and active='Y' and vu.user=vca.user $LOGadmin_viewable_groupsSQL order by vu.user;"; - $rsltx=mysql_to_mysqli($stmt, $link); - $users_to_print = mysqli_num_rows($rsltx); + $stmt="SELECT user_group from vicidial_user_groups where ( (allowed_campaigns LIKE \"%-ALL-CAMPAIGNS-%\") or (allowed_campaigns LIKE \"% $campaign_id %\") ) $LOGadmin_viewable_groupsSQL;"; + $rslt=mysql_to_mysqli($stmt, $link); + $USERgroups_to_print = mysqli_num_rows($rslt); + if ($DB) {echo "$USERgroups_to_print|$stmt\n";} + $USERgroupsSQL="''"; + $i=0; + while ($i < $USERgroups_to_print) + { + $row=mysqli_fetch_row($rslt); + $USERgroupsSQL .= ",'$row[0]'"; + $i++; + } + + $stmt="SELECT user,full_name from vicidial_users where user_group IN($USERgroupsSQL) and active='Y' order by user;"; + $rslt=mysql_to_mysqli($stmt, $link); + $users_to_print = mysqli_num_rows($rslt); + if ($DB) {echo "$users_to_print|$stmt\n";} + $U_user=array(); + $U_full_name=array(); + $i=0; + while ($i < $users_to_print) + { + $row=mysqli_fetch_row($rslt); + $U_user[$i] = $row[0]; + $U_full_name[$i] = $row[1]; + $i++; + } $o=0; while ($users_to_print > $o) { - $rowx=mysqli_fetch_row($rsltx); - $o++; + $temp_user = $U_user[$o]; + $temp_name = $U_full_name[$o]; + $campaign_rank='n/a'; + $calls_today='n/a'; + $campaign_grade='n/a'; if (preg_match('/1$|3$|5$|7$|9$/i', $o)) {$bgcolor='bgcolor="#'. $SSstd_row2_background .'"';} else {$bgcolor='bgcolor="#'. $SSstd_row1_background .'"';} - echo "\n"; + $stmt="SELECT campaign_rank,calls_today,campaign_grade from vicidial_campaign_agents where user='$U_user[$o]' and campaign_id='$campaign_id';"; + $rslt=mysql_to_mysqli($stmt, $link); + $USERdetails_to_print = mysqli_num_rows($rslt); + if ($USERdetails_to_print > 0) + { + $row=mysqli_fetch_row($rslt); + $campaign_rank = $row[0]; + $calls_today = $row[1]; + $campaign_grade = $row[2]; + } + $o++; + + echo "\n"; } echo "
"._QXZ("USER")."     "._QXZ("RANK")."     "._QXZ("GRADE")."     "._QXZ("CALLS TODAY")."
$rowx[0] - $rowx[3]$rowx[1]$rowx[4]$rowx[2]
$temp_user - $temp_name$campaign_rank$campaign_grade$calls_today

\n"; @@ -35236,9 +35278,11 @@ if ($ADD==3111) { echo "\n"; } - if ( ( ($SSrecording_dtmf_muting =='1') or ($SSrecording_dtmf_muting =='2') or ($SSrecording_dtmf_muting =='3') ) and ($SSrecording_dtmf_detection == '1') ) + if ( ( ($SSrecording_dtmf_muting =='1') or ($SSrecording_dtmf_muting >= 2) ) and ($SSrecording_dtmf_detection == '1') ) { - echo ""._QXZ("Recording DTMF Muting").": $NWB#inbound_groups-recording_dtmf_muting$NWE\n"; + $SYSTEM_DTMF_MUTING_OVERRIDE=''; + if ($SSrecording_dtmf_muting >= 2) {$SYSTEM_DTMF_MUTING_OVERRIDE = ""._QXZ("SYSTEM OVERRIDE ENABLED").": $SSrecording_dtmf_muting "._QXZ("SECONDS")."";} + echo ""._QXZ("Recording DTMF Muting").": $NWB#inbound_groups-recording_dtmf_muting$NWE $SYSTEM_DTMF_MUTING_OVERRIDE \n"; } else { @@ -45271,7 +45315,7 @@ if ($ADD==311111111111111) echo ""._QXZ("Allow Stereo Recordings").": $NWB#settings-stereo_recording$NWE\n"; echo ""._QXZ("Enable Stereo Parallel Recordings").": $NWB#settings-stereo_parallel_recording$NWE\n"; echo ""._QXZ("Allow Recording DTMF Detection").": $NWB#settings-recording_dtmf_detection$NWE\n"; - echo ""._QXZ("Allow Recording DTMF Muting").": $NWB#settings-recording_dtmf_muting$NWE\n"; + echo ""._QXZ("Allow Recording DTMF Muting").": $NWB#settings-recording_dtmf_muting$NWE\n"; } else { diff --git a/agc_2-X/trunk/www/vicidial/admin_modify_lead.php b/agc_2-X/trunk/www/vicidial/admin_modify_lead.php index e04214df..27495eeb 100644 --- a/agc_2-X/trunk/www/vicidial/admin_modify_lead.php +++ b/agc_2-X/trunk/www/vicidial/admin_modify_lead.php @@ -121,6 +121,7 @@ # 241002-0936 - Fix for displaying CID info on outbound calls that were blind transferred # 250129-0921 - Fix for closer call notes display, Issue #1534 # 250913-0837 - Added Stereo Call Recording indicator +# 251010-1140 - Added DTMF count and muting recording log indicator columns # require("dbconnect_mysqli.php"); @@ -282,7 +283,7 @@ if ($nonselectable_statuses > 0) ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,custom_fields_enabled,webroot_writable,allow_emails,enable_languages,language_method,active_modules,log_recording_access,admin_screen_colors,enable_gdpr_download_deletion,source_id_display,mute_recordings,sip_event_logging,allow_web_debug,hopper_hold_inserts,coldstorage_server_ip,coldstorage_dbname,coldstorage_login,coldstorage_pass,coldstorage_port,stereo_recording FROM system_settings;"; +$stmt = "SELECT use_non_latin,custom_fields_enabled,webroot_writable,allow_emails,enable_languages,language_method,active_modules,log_recording_access,admin_screen_colors,enable_gdpr_download_deletion,source_id_display,mute_recordings,sip_event_logging,allow_web_debug,hopper_hold_inserts,coldstorage_server_ip,coldstorage_dbname,coldstorage_login,coldstorage_pass,coldstorage_port,stereo_recording,recording_dtmf_detection,recording_dtmf_muting FROM system_settings;"; $rslt=mysql_to_mysqli($stmt, $link); #if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysqli_num_rows($rslt); @@ -310,6 +311,8 @@ if ($qm_conf_ct > 0) $SScoldstorage_pass = $row[18]; $SScoldstorage_port = $row[19]; $SSstereo_recording = $row[20]; + $SSrecording_dtmf_detection = $row[21]; + $SSrecording_dtmf_muting = $row[22]; } if ($SSallow_web_debug < 1) {$DB=0;} ##### END SETTINGS LOOKUP ##### @@ -4012,10 +4015,21 @@ else { $stereo_column = ""._QXZ("STEREO").""; } + $dtmf_detect_column=''; + if ($SSrecording_dtmf_detection > 0) + { + $dtmf_detect_column = ""._QXZ("DTMF GRP")."   "; + } + $dtmf_mute_column=''; + if ( ($SSrecording_dtmf_detection > 0) and ($SSrecording_dtmf_muting > 0) ) + { + $dtmf_mute_column = ""._QXZ("D-MUTE")."   "; + } + echo ""._QXZ("RECORDINGS FOR THIS LEAD").":\n"; echo "\n"; - echo "$mute_column$stereo_column\n"; + echo "$mute_column$stereo_column$dtmf_detect_column$dtmf_mute_column\n"; $stmt="SELECT recording_id,channel,server_ip,extension,start_time,start_epoch,end_time,end_epoch,length_in_sec,length_in_min,filename,location,lead_id,user,vicidial_id from recording_log where lead_id='" . mysqli_real_escape_string($link, $lead_id) . "' order by recording_id desc limit 500;"; $rslt=mysql_to_mysqli($stmt, $link); @@ -4113,6 +4127,38 @@ else if (!preg_match("/^S/",$stereo_flag)) {$stereo_flag='';} echo "\n"; } + if ($SSrecording_dtmf_detection > 0) + { + $dtmf_detected=''; + $dtmf_muting=''; + $dtmf_muting_seconds=''; + + $stmtDTMF="SELECT dtmf_detected,dtmf_muting,dtmf_muting_seconds from recording_live_log where recording_id='$row[0]' limit 1;"; + $rsltDTMF=mysql_to_mysqli($stmtDTMF, $link); + $DTMF_to_print = mysqli_num_rows($rsltDTMF); + if ($DB) {echo "$DTMF_to_print|$stmtDTMF|\n";} + if ($DTMF_to_print > 0) + { + $DTMFrow=mysqli_fetch_row($rsltDTMF); + $dtmf_detected = $DTMFrow[0]; + $dtmf_muting = $DTMFrow[1]; + $dtmf_muting_seconds = $DTMFrow[2]; + + if ($dtmf_detected < 1) + {$dtmf_detected='';} + if ($SSrecording_dtmf_muting > 0) + { + if ($dtmf_muting > 0) + {$dtmf_muting = "$dtmf_muting - $dtmf_muting_seconds";} + else + {$dtmf_muting='';} + } + } + echo "\n"; + if ($SSrecording_dtmf_muting > 0) + {echo "\n";} + } + echo "$play_audio"; echo "\n"; $rec_ids .= ",'$row[0]'"; diff --git a/agc_2-X/trunk/www/vicidial/help_documentation.txt b/agc_2-X/trunk/www/vicidial/help_documentation.txt index 25413844..5da6db24 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: 20251002142401 +# version: 20251017123601 users-user User ID This field is where you put the users ID number, can be up to 20 digits in length, Must be at least 2 characters in length. We strongly recommend not reusing user accounts for different users, for reporting accuracy. To disable a user account, set the Active option to -N-. users-pass Password This field is where you put the users password. Must be at least 2 characters in length, unless the User Password Minimum Length system setting is enabled, which will require a longer password. 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. @@ -275,7 +275,7 @@ campaigns-stereo_recording_agent Stereo Recording Agent Control If Stereo C campaigns-stereo_rec_filename Stereo Rec Filename If Stereo Call Recordings is enabled, this will be the recording filename of the Stereo call recordings. This cannot be set the same as the Campaign Rec Filename. This field is required to be populated for Stereo Call Recording to work for calls placed from this campaign. The dynamic fields that can be used are the same as can be used in the Campaign Rec Filename. Default is S_FULLDATE_CUSTPHONE. campaigns-stereo_parallel_recording Parallel Stereo Recordings if enabled, then every call will be recorded in its entirety, from when the agent receives it until it leaves the agent session. The options include: CUSTOMER-ONLY, CUSTOMER-MUTED and FULL-RECORDING. If Stereo Recording Agent Control is also enabled, that can itself also result in multiple recordings on a single call. Default is DISABLED. campaigns-parallel_rec_xx_filename Parallel Rec Filenames If Parallel Stereo Recordings are enabled, then these optional fields can be used to customize the call recording filenames for each type of Parallel Stereo Call Recording. If these fields are not populated, then the system will default to use the Stereo Rec Filename with a prefix at the beginning of each filename for the type of Parallel Stereo Call Recording that has been used: CO for Customer-Only, CM for Customer-Muted and FR for Full-Recording. Default is blank for all 3 of these fields. -campaigns-recording_dtmf_muting Recording DTMF Muting NOT FUNCTIONAL, STILL IN DEVELOPMENT. If enabled, and Allow Recording DTMF Detection is also enabled, call recordings will be muted for this number of seconds after the first DTMF signal is detected while recording is active. Default is 0 for disabled. +campaigns-recording_dtmf_muting Recording DTMF Muting If enabled, and the Allow Recording DTMF Detection system setting is also enabled, call recordings will be muted for this number of seconds after the first DTMF signal is detected while recording is active. This setting will only effect on calls placed from this campaign, if you also want DTMF Muting to be active for inbound calls, then each In-Group will also need to have this feature enabled. If this is enabled for a campaign, then Mute Recordings will be disabled automatically. Default is 0 for disabled. campaigns-per_call_notes Call Notes Per Call Setting this option to ENABLED will allow agents to enter in notes for every call they handle in the agent interface. The notes entry field will appear below the Comments field in the agent interface. Also, if the Agent User Group is allowed to view Call Logs then the agent will be able to view past call notes for a lead at any time. Default is DISABLED. campaigns-force_per_call_notes Per Call Notes Required If enabled, the agent will have to enter text into the Call Notes field on their agent screen in order to Hangup the Customer phone call. The CHARACTERS options will also enable this feature, but they will require a minimum number of characters to be entered to allow hangup. Default is DISABLED. campaigns-comments_all_tabs Comments All Tabs Setting this option to ENABLED will display the Comments field on all tabs in the main agent screen. Default is DISABLED. @@ -676,7 +676,7 @@ inbound_groups-stereo_recording_agent Stereo Recording Agent Control If Ste inbound_groups-stereo_rec_filename Stereo Rec Filename If Stereo Call Recordings is enabled, this will be the recording filename of the Stereo call recordings for calls handled through this In-Group. This cannot be set the same as the Campaign Rec Filename. This field is required to be populated for Stereo Call Recording to work for calls handled through this In-Group. The dynamic fields that can be used are the same as can be used in the In-Group Recording Filename. Default is S_FULLDATE_CUSTPHONE. inbound_groups-stereo_parallel_recording Parallel Stereo Recordings if enabled, then every call will be recorded in its entirety for calls handled through this In-Group, from when the agent receives it until it leaves the agent session. The options include: CUSTOMER-ONLY, CUSTOMER-MUTED and FULL-RECORDING. If Stereo Recording Agent Control is also enabled, that can itself also result in multiple recordings on a single call. Default is DISABLED. inbound_groups-parallel_rec_xx_filename Parallel Rec Filenames If Parallel Stereo Recordings are enabled, then these optional fields can be used to customize the call recording filenames for each type of Parallel Stereo Call Recording. If these fields are not populated, then the system will default to use the Stereo Rec Filename with a prefix at the beginning of each filename for the type of Parallel Stereo Call Recording that has been used: CO for Customer-Only, CM for Customer-Muted and FR for Full-Recording. Default is blank for all 3 of these fields. -inbound_groups-recording_dtmf_muting Recording DTMF Muting NOT FUNCTIONAL, STILL IN DEVELOPMENT. If enabled, and Allow Recording DTMF Detection is also enabled, call recordings for calls handled through this In-Group will be muted for this number of seconds after the first DTMF signal is detected while recording is active. Default is 0 for disabled. +inbound_groups-recording_dtmf_muting Recording DTMF Muting If enabled, and the Allow Recording DTMF Detection system setting is also enabled, call recordings from this In-Group will be muted for this number of seconds after the first DTMF signal is detected while recording is active. This setting will only effect on calls handled through this In-Group, if you also want DTMF Muting to be active for outbound calls, then each Campaign will also need to have this feature enabled. Default is 0 for disabled. inbound_groups-qc_enabled QC Enabled Setting this field to Y allows for the agent Quality Control features to work. Default is N. inbound_groups-qc_statuses QC Statuses This area is where you select which statuses of leads should be gone over by the QC system. Place a check next to the status that you want QC to review. inbound_groups-qc_statuses_id QC Statuses ID This area is where you select which "QC_TEMPLATE" settings container will be used to determine the call statuses that are eligible for QC evaluation in this ingroup. This will override both campaign and list "QC Statuses ID" settings. @@ -1252,8 +1252,8 @@ settings-recording_buttons Recording Buttons Type This option allows you to settings-mute_recordings Allow Mute Recordings This option if enabled allows you to enable the MUTE RECORDING button on the agent screen by campaign and-or user. This feature is only tested with systems running Asterisk 13. You should not mute recordings for more than 15 minutes at a time. Default is 0 for disabled. settings-stereo_recording Allow Stereo Recordings If enabled, allows for additional call recordings in stereo, with the customer on one side and the agent on the other. Must also be enabled at the campaign level. Enabling this setting may require additional system resources if standard mono recordings are also still enabled. Default is 0 for disabled. settings-stereo_parallel_recording Enable Stereo Parallel Recordings If enabled, and Allow Stereo Recordings is also enabled, allows for multiple parallel stereo call recordings for every call. Enabling this setting will require additional system resources, since every call will be recorded in its entirety, and post-call processing will be required to facilitate all of this settings features. Must also be enabled at the campaign level. Default is 0 for disabled. -settings-recording_dtmf_detection Allow Recording DTMF Detection NOT FUNCTIONAL, STILL IN DEVELOPMENT. If enabled, recordings will be flagged if any DTMF signals are detected during the recording duration. Default is 0 for disabled. -settings-recording_dtmf_muting Allow Recording DTMF Muting NOT FUNCTIONAL, STILL IN DEVELOPMENT. If enabled, and Allow Recording DTMF Detection is also enabled, call recordings will be muted for X seconds after the first DTMF signal is detected while recording is active. Must also be enabled at the campaign level. Default is 0 for disabled. +settings-recording_dtmf_detection Allow Recording DTMF Detection If enabled, recording logs will be flagged if any DTMF signals are detected during the recording duration. Default is 0 for disabled. +settings-recording_dtmf_muting Allow Recording DTMF Muting If enabled, and Allow Recording DTMF Detection is also enabled, then you will be allowed to enable this feature for specific Campaigns and In-Groups. If set to -1- this setting will only effect on calls handled through the Campaigns and In-Groups that have this feature enabled. If this is enabled for a campaign, then Mute Recordings will be disabled automatically for that campaign. If this setting is set to 2 or higher, then this will force-enable DTMF Muting on all calls on this cluster and will override any Campaign or In-Group settings with this number of seconds of DTMF muting. Default is 0 for disabled. settings-enable_auto_reports Enable Automated Reports This option if enabled allows you access to the Automated Reports section where you can set up reports to run at scheduled times and be delivered by email or FTP. Default is 0 for disabled. settings-first_login_trigger First Login Trigger This setting allows for the initial configuration of the server screen to be shown to the administrator when they first log into the system. settings-require_password_length User Password Minimum Length If set above 0, this setting will require that user passwords, phone and server passwords, and system settings default passwords be at least this minimum length of characters when those records settings are modified on the Modify pages. The most important factor in password security is the length of the password, and user passwords in this system can be up to 100 characters in length. Default is 0 for disabled.
# "._QXZ("LEAD").""._QXZ("DATE/TIME")." "._QXZ("SECONDS")."   "._QXZ("RECID").""._QXZ("FILENAME").""._QXZ("LOCATION").""._QXZ("TSR")."
# "._QXZ("LEAD").""._QXZ("DATE/TIME")." "._QXZ("SECONDS")."   "._QXZ("RECID").""._QXZ("FILENAME").""._QXZ("LOCATION").""._QXZ("TSR")."
$stereo_flag   $dtmf_detected   $dtmf_muting