From 3fd75a75c61d682df88ad8be1bbb47e291653945 Mon Sep 17 00:00:00 2001 From: mattf Date: Sun, 6 Mar 2016 05:08:50 +0000 Subject: [PATCH] Added Alternate IVR(Call Menu) Logging options Added more optional logging to ADMIN_keepalive_ALL.pl script for end-of-day processes, also those processes now only run on the voicemail server of a cluster. git-svn-id: svn://192.168.202.10@2486 3d104415-ff17-0410-8863-d5cf3c621b8a --- UPGRADE | 2 + agi/cm.agi | 31 +- bin/ADMIN_keepalive_ALL.pl | 1124 +++++++++++++++------------- extras/MySQL_AST_CREATE_tables.sql | 23 +- extras/upgrade_2.12.sql | 21 + www/vicidial/admin.php | 66 +- www/vicidial/help.php | 16 + 7 files changed, 743 insertions(+), 540 deletions(-) diff --git a/UPGRADE b/UPGRADE index cc639a5b..e34e8fd7 100644 --- a/UPGRADE +++ b/UPGRADE @@ -242,6 +242,8 @@ OTHER CHANGES: 62. Added API Log Report to Admin Utilities page +63. Added Alternate IVR(Call Menu) Logging options + diff --git a/agi/cm.agi b/agi/cm.agi index 658ef2f8..96487890 100644 --- a/agi/cm.agi +++ b/agi/cm.agi @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# cm.agi version 2.8 +# cm.agi version 2.12 # # Used by Call Menus to log digit presses if enabled in the settings. You should # not need to manually use this script, it is used by the dialplan builder. @@ -10,16 +10,18 @@ # ; 1. the in-group to take settings from # ; 2. digit pressed # ; 3. field(in vicidial_list) to update with DTMF pressed (only if lead_id populated) +# ; 4. alt-log(enable alternate logging) +# ; 5. question number used if alt-logging is enabled # ; # ;inbound calls check calltime: -#exten => 1,1,AGI(cm.agi,INBOUND-----1-----province) +#exten => 1,1,AGI(cm.agi,INBOUND-----1-----province----------) #exten => 1,2,... # # ;to allow for multi-digit entries, put similar entry in the Custom Dialplan Entry: #exten => _XXXXX,1,AGI(cm.agi,INBOUND-----${EXTEN}-----postal_code) #exten => _XXXXX,n,Goto(next_callmenu_here,s,1) # -# Copyright (C) 2013 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2016 Matt Florell LICENSE: AGPLv2 # # changes: # 110525-2100 - First Build @@ -27,6 +29,7 @@ # 120730-0729 - Changed to allow inbound logging when lead is defined # 130925-1822 - Added variable filter to prevent DID SQL injection attack # 130926-1547 - Added new queue_log IVR entries for QM +# 160305-2244 - Added Alt IVR Logging options # $script = 'cm.agi'; @@ -152,6 +155,8 @@ if (length($ARGV[0])>1) $channel_group = $ARGV_vars[0]; $dtmf = $ARGV_vars[1]; $field = $ARGV_vars[2]; + $alt_logging = $ARGV_vars[3]; + $alt_question = $ARGV_vars[4]; } $|=1; @@ -207,6 +212,17 @@ elsif ($calleridname =~ /^Y\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/) $phone_number = $callerid; $callerid = $calleridname; + $stmtA = "SELECT campaign_id FROM vicidial_auto_calls where callerid='$callerid';"; + $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; + $campaign_id = $aryA[0]; + } + $sthA->finish(); + if ( (length($field)>2) && ($vicidial_list_fields =~ /\|$field\|/) ) { $fieldUPDATE=1; @@ -305,6 +321,15 @@ else if ($AGILOG) {$agi_string = "-- LIL insert: |$affected_rowsL|$uniqueid|$callerid|$extension|"; &agi_output;} } +if ( ($alt_logging =~ /1/) && ($alt_question =~ /\d/) ) + { + $stmtA = "INSERT INTO vicidial_ivr_response (btn,lead_id,question,response,uniqueid,campaign) values('$phone_number','$lead_id','$alt_question','$dtmf','$uniqueid','$campaign_id');"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $affected_rowsAI = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- VIR insert: |$affected_rowsAI|$uniqueid|$phone_number|$lead_id|"; &agi_output;} + } + + ### QueueMetrics logging if enabled if ($enable_queuemetrics_logging > 0) { diff --git a/bin/ADMIN_keepalive_ALL.pl b/bin/ADMIN_keepalive_ALL.pl index bc310524..f05a4fe9 100644 --- a/bin/ADMIN_keepalive_ALL.pl +++ b/bin/ADMIN_keepalive_ALL.pl @@ -15,7 +15,7 @@ # - Auto reset lists at defined times # - Auto restarts Asterisk process if enabled in servers settings # -# Copyright (C) 2015 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2016 Matt Florell LICENSE: AGPLv2 # # CHANGES # 61011-1348 - First build @@ -106,11 +106,14 @@ # 151211-1509 - Added launching of the AST_chat_timeout_cron.pl process on the voicemail server # 151226-1024 - Fix for double-write of extension in conf files for IAX and SIP, Issue #908 # 151229-1623 - Added asterisk output logger launching, tied to server setting, runs every 5 minutes if active +# 160305-2253 - Added --teod flag to log Timeclock End of Day processes to log file +# Limited max-stats process to only run on voicemail server, also added alt-logging flags to cm.agi calls # -$build = '151229-1623'; +$build = '160305-2253'; $DB=0; # Debug flag +$teodDB=0; # flag to log Timeclock End of Day processes to log file # define blank variables $MT[0]=''; $MT[1]=''; @@ -200,6 +203,7 @@ if (length($ARGV[0])>1) print " [-debug] = verbose debug messages\n"; print " [-debugX] = Extra-verbose debug messages\n"; print " [-debugXXX] = Triple-Extra-verbose debug messages\n"; + print " [--teod] = log Timeclock End of Day processes to log file\n"; print "\n"; exit; } @@ -224,6 +228,11 @@ if (length($ARGV[0])>1) $DBXXX=1; print "\n----- TRIPLE DEBUGGING -----\n\n"; } + if ($args =~ /-teod/i) + { + $teodDB=1; + if ($DB > 0) {print "\n----- Timeclock end of day logfile logging -----\n\n";} + } if ($args =~ /-autodial-delay=/i) # CLI defined delay { @CLIvarADARY = split(/-autodial-delay=/,$args); @@ -311,6 +320,8 @@ foreach(@conf) $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 =~ /^VARactive_keepalives/) && ($CLIactive_keepalives < 1) ) {$VARactive_keepalives = $line; $VARactive_keepalives =~ s/.*=//gi;} $i++; @@ -739,6 +750,11 @@ if ($timeclock_auto_logout > 0) { if ($DB) {print "running Timeclock auto-logout process...\n";} `/usr/bin/screen -d -m -S Timeclock $PATHhome/ADMIN_timeclock_auto_logout.pl 2>/dev/null 1>&2`; + if ($teodDB) + { + $event_string = "running Timeclock auto-logout process|/usr/bin/screen -d -m -S Timeclock $PATHhome/ADMIN_timeclock_auto_logout.pl 2>/dev/null 1>&2"; + &teod_logger; + } } ################################################################################ ##### END keepalive of ViciDial-related scripts @@ -798,8 +814,35 @@ 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; + +##### 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 FROM system_settings;"; +# print "$stmtA\n"; +$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; + $sounds_central_control_active = $aryA[0]; + $active_voicemail_server = $aryA[1]; + $SScustom_dialplan_entry = $aryA[2]; + $SSdefault_codecs = $aryA[3]; + $SSgenerate_cross_server_exten = $aryA[4]; + $SSvoicemail_timezones = $aryA[5]; + $SSdefault_voicemail_timezone = $aryA[6]; + $SScall_menu_qualify_enabled = $aryA[7]; + $SSallow_voicemail_greeting = $aryA[8]; + $SSreload_timestamp = $aryA[9]; + $meetme_enter_login_filename = $aryA[10]; + $meetme_enter_leave3way_filename = $aryA[11]; + $SSallow_chats = $aryA[12]; + } +$sthA->finish(); +if ($DBXXX > 0) {print "SYSTEM SETTINGS: $sounds_central_control_active|$active_voicemail_server|$SScustom_dialplan_entry|$SSdefault_codecs\n";} + $timeclock_end_of_day_NOW=0; -### Grab system_settings values from the database +### determine if it is the timeclock end of day right now $stmtA = "SELECT count(*) from system_settings where timeclock_end_of_day LIKE \"%$reset_test%\";"; if ($DB) {print "|$stmtA|\n";} $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; @@ -812,8 +855,33 @@ if ($sthArows > 0) } $sthA->finish(); +##### Get the settings for this server's server_ip ##### +$stmtA = "SELECT active_asterisk_server,generate_vicidial_conf,rebuild_conf_files,asterisk_version,sounds_update,conf_secret,custom_dialplan_entry,auto_restart_asterisk,asterisk_temp_no_restart,gather_asterisk_output FROM servers where server_ip='$server_ip';"; +# print "$stmtA\n"; +$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; + $active_asterisk_server = $aryA[0]; + $generate_vicidial_conf = $aryA[1]; + $rebuild_conf_files = $aryA[2]; + $asterisk_version = $aryA[3]; + $sounds_update = $aryA[4]; + $self_conf_secret = $aryA[5]; + $SERVERcustom_dialplan_entry = $aryA[6]; + $auto_restart_asterisk = $aryA[7]; + $asterisk_temp_no_restart = $aryA[8]; + $gather_asterisk_output = $aryA[9]; + } +$sthA->finish(); + + if ($timeclock_end_of_day_NOW > 0) { + if ($teodDB) {$event_string = "Starting timeclock end of day processes: $stmtA|$timeclock_end_of_day_NOW"; &teod_logger;} + $stmtA = "SELECT agents_calls_reset,usacan_phone_dialcode_fix from system_settings;"; if ($DB) {print "|$stmtA|\n";} $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; @@ -845,6 +913,7 @@ if ($timeclock_end_of_day_NOW > 0) } $sthA->finish(); $k=0; + $conf_cleared=0; while ($k < $rec_count) { $live_session=0; @@ -864,489 +933,529 @@ if ($timeclock_end_of_day_NOW > 0) $stmtA = "UPDATE vicidial_conferences set extension='' where server_ip='$server_ip' and conf_exten='$PT_conf_extens[$k]';"; if($DBX){print STDERR "\n|$stmtA|\n";} $affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:|$stmtA|\n"; + $conf_cleared = ($conf_cleared + $affected_rows); } $k++; } + if ($teodDB) {$event_string = "Empty vicidial_conferences entries cleared: $conf_cleared"; &teod_logger;} - if ($DB) {print "Starting clear out daily reset tables...\n";} - - $stmtA = "UPDATE vicidial_xfer_stats SET xfer_count='0';"; - if($DBX){print STDERR "\n|$stmtA|\n";} - $affected_rows = $dbhA->do($stmtA); - if($DB){print STDERR "\n|$affected_rows vicidial_xfer_stats records reset|\n";} - - $stmtA = "optimize table vicidial_xfer_stats;"; - 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(); - - $stmtA = "UPDATE vicidial_campaign_stats SET dialable_leads='0', calls_today='0', answers_today='0', drops_today='0', drops_today_pct='0', drops_answers_today_pct='0', calls_hour='0', answers_hour='0', drops_hour='0', drops_hour_pct='0', calls_halfhour='0', answers_halfhour='0', drops_halfhour='0', drops_halfhour_pct='0', calls_fivemin='0', answers_fivemin='0', drops_fivemin='0', drops_fivemin_pct='0', calls_onemin='0', answers_onemin='0', drops_onemin='0', drops_onemin_pct='0', differential_onemin='0', agents_average_onemin='0', balance_trunk_fill='0', status_category_count_1='0', status_category_count_2='0', status_category_count_3='0', status_category_count_4='0',agent_calls_today='0',agent_pause_today='0',agent_wait_today='0',agent_custtalk_today='0',agent_acw_today='0';"; - if($DBX){print STDERR "\n|$stmtA|\n";} - $affected_rows = $dbhA->do($stmtA); - if($DB){print STDERR "\n|$affected_rows vicidial_campaign_stats records reset|\n";} - - $stmtA = "optimize table vicidial_campaign_stats;"; - 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(); - - $stmtA = "UPDATE vicidial_drop_rate_groups SET calls_today='0', answers_today='0', drops_today='0', drops_today_pct='0', drops_answers_today_pct='0';"; - if($DBX){print STDERR "\n|$stmtA|\n";} - $affected_rows = $dbhA->do($stmtA); - if($DB){print STDERR "\n|$affected_rows vicidial_drop_rate_groups records reset|\n";} - - $stmtA = "optimize table vicidial_drop_rate_groups;"; - 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(); - - $stmtA = "delete from vicidial_campaign_server_stats;"; - if($DBX){print STDERR "\n|$stmtA|\n";} - $affected_rows = $dbhA->do($stmtA); - if($DB){print STDERR "\n|$affected_rows vicidial_campaign_server_stats records deleted|\n";} - - $stmtA = "optimize table vicidial_campaign_server_stats;"; - 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(); - - $stmtA = "delete from vicidial_campaign_stats_debug;"; - if($DBX){print STDERR "\n|$stmtA|\n";} - $affected_rows = $dbhA->do($stmtA); - if($DB){print STDERR "\n|$affected_rows vicidial_campaign_stats_debug records deleted|\n";} - - $stmtA = "optimize table vicidial_campaign_stats_debug;"; - 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(); - - $stmtA = "update vicidial_inbound_group_agents SET calls_today=0;"; - if($DBX){print STDERR "\n|$stmtA|\n";} - $affected_rows = $dbhA->do($stmtA); - if($DB){print STDERR "\n|$affected_rows vicidial_inbound_group_agents call counts reset|\n";} - - $stmtA = "optimize table vicidial_inbound_group_agents;"; - 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(); - - $stmtA = "update vicidial_campaign_cid_areacodes SET call_count_today=0;"; - if($DBX){print STDERR "\n|$stmtA|\n";} - $affected_rows = $dbhA->do($stmtA); - if($DB){print STDERR "\n|$affected_rows vicidial_campaign_cid_areacodes call counts reset|\n";} - - $stmtA = "optimize table vicidial_campaign_cid_areacodes;"; - 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(); - - $stmtA = "update vicidial_did_ra_extensions SET call_count_today=0;"; - if($DBX){print STDERR "\n|$stmtA|\n";} - $affected_rows = $dbhA->do($stmtA); - if($DB){print STDERR "\n|$affected_rows vicidial_did_ra_extensions call counts reset|\n";} - - $stmtA = "optimize table vicidial_did_ra_extensions;"; - 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(); - - $stmtA = "update vicidial_extension_groups SET call_count_today=0;"; - if($DBX){print STDERR "\n|$stmtA|\n";} - $affected_rows = $dbhA->do($stmtA); - if($DB){print STDERR "\n|$affected_rows vicidial_extension_groups call counts reset|\n";} - - $stmtA = "optimize table vicidial_extension_groups;"; - 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(); - - $stmtA = "optimize table vicidial_users;"; - 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(); - - $stmtA = "update vicidial_campaign_agents SET calls_today=0;"; - if($DBX){print STDERR "\n|$stmtA|\n";} - $affected_rows = $dbhA->do($stmtA); - if($DB){print STDERR "\n|$affected_rows vicidial_campaign_agents call counts reset|\n";} - - $stmtA = "optimize table vicidial_campaign_agents;"; - 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(); - - $stmtA = "update vicidial_live_inbound_agents SET calls_today=0;"; - if($DBX){print STDERR "\n|$stmtA|\n";} - $affected_rows = $dbhA->do($stmtA); - if($DB){print STDERR "\n|$affected_rows vicidial_live_inbound_agents call counts reset|\n";} - - if ($agents_calls_reset > 0) + ### Only run the following on one server in the cluster, the one set as the active voicemail server ### + if ( ($active_voicemail_server =~ /$server_ip/) && ((length($active_voicemail_server)) eq (length($server_ip))) ) { - $stmtA = "delete from vicidial_live_inbound_agents where last_call_finish < \"$TDSQLdate\";"; + if ($DB) {print "Starting clear out system-wide daily reset tables...\n";} + + $stmtA = "UPDATE vicidial_xfer_stats SET xfer_count='0';"; if($DBX){print STDERR "\n|$stmtA|\n";} $affected_rows = $dbhA->do($stmtA); - if($DB){print STDERR "\n|$affected_rows vicidial_live_inbound_agents old records deleted|\n";} + if($DB){print STDERR "\n|$affected_rows vicidial_xfer_stats records reset|\n";} + if ($teodDB) {$event_string = "vicidial_xfer_stats records reset: $affected_rows"; &teod_logger;} - $stmtA = "delete from vicidial_live_agents where last_state_change < \"$TDSQLdate\" and extension NOT LIKE \"R/%\";"; + $stmtA = "optimize table vicidial_xfer_stats;"; + 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(); + + $stmtA = "UPDATE vicidial_campaign_stats SET dialable_leads='0', calls_today='0', answers_today='0', drops_today='0', drops_today_pct='0', drops_answers_today_pct='0', calls_hour='0', answers_hour='0', drops_hour='0', drops_hour_pct='0', calls_halfhour='0', answers_halfhour='0', drops_halfhour='0', drops_halfhour_pct='0', calls_fivemin='0', answers_fivemin='0', drops_fivemin='0', drops_fivemin_pct='0', calls_onemin='0', answers_onemin='0', drops_onemin='0', drops_onemin_pct='0', differential_onemin='0', agents_average_onemin='0', balance_trunk_fill='0', status_category_count_1='0', status_category_count_2='0', status_category_count_3='0', status_category_count_4='0',agent_calls_today='0',agent_pause_today='0',agent_wait_today='0',agent_custtalk_today='0',agent_acw_today='0';"; if($DBX){print STDERR "\n|$stmtA|\n";} $affected_rows = $dbhA->do($stmtA); - if($DB){print STDERR "\n|$affected_rows vicidial_live_agents old records deleted|\n";} + if($DB){print STDERR "\n|$affected_rows vicidial_campaign_stats records reset|\n";} + if ($teodDB) {$event_string = "vicidial_campaign_stats records reset: $affected_rows"; &teod_logger;} - $stmtA = "delete from vicidial_auto_calls where last_update_time < \"$TDSQLdate\";"; + $stmtA = "optimize table vicidial_campaign_stats;"; + 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(); + + $stmtA = "UPDATE vicidial_drop_rate_groups SET calls_today='0', answers_today='0', drops_today='0', drops_today_pct='0', drops_answers_today_pct='0';"; if($DBX){print STDERR "\n|$stmtA|\n";} $affected_rows = $dbhA->do($stmtA); - if($DB){print STDERR "\n|$affected_rows vicidial_auto_calls old records deleted|\n";} - } + if($DB){print STDERR "\n|$affected_rows vicidial_drop_rate_groups records reset|\n";} + if ($teodDB) {$event_string = "vicidial_drop_rate_groups records reset: $affected_rows"; &teod_logger;} - $stmtA = "optimize table vicidial_live_inbound_agents;"; - 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(); - - $stmtA = "optimize table vicidial_live_agents;"; - 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(); - - $stmtA = "optimize table vicidial_auto_calls;"; - 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(); - - $stmtA = "optimize table vicidial_daily_max_stats;"; - 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(); - - $stmtA = "optimize table vicidial_daily_ra_stats;"; - 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(); - - $stmtA = "delete from vicidial_session_data where login_time < \"$TDSQLdate\";"; - if($DBX){print STDERR "\n|$stmtA|\n";} - $affected_rows = $dbhA->do($stmtA); - if($DB){print STDERR "\n|$affected_rows vicidial_session_data old records deleted|\n";} - - $stmtA = "optimize table vicidial_session_data;"; - 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(); - - $stmtA = "delete from vicidial_monitor_calls where monitor_time < \"$TDSQLdate\";"; - if($DBX){print STDERR "\n|$stmtA|\n";} - $affected_rows = $dbhA->do($stmtA); - if($DB){print STDERR "\n|$affected_rows vicidial_monitor_calls old records deleted|\n";} - - $stmtA = "optimize table vicidial_monitor_calls;"; - 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(); - - # set past holidays to EXPIRED status - $stmtA = "UPDATE vicidial_call_time_holidays SET holiday_status='EXPIRED' where holiday_date < \"$RMdate\" and holiday_status!='EXPIRED';"; - if($DBX){print STDERR "\n|$stmtA|\n";} - $affected_rows = $dbhA->do($stmtA); - if($DB){print STDERR "\n|$affected_rows Holidays set to expired|\n";} - - - ##### BEGIN max stats end of day process ##### - # set OPEN max stats records to CLOSING for processing - $stmtA = "UPDATE vicidial_daily_max_stats SET stats_flag='CLOSING' where stats_flag='OPEN';"; - if($DBX){print STDERR "\n|$stmtA|\n";} - $affected_rows = $dbhA->do($stmtA); - if($DB){print STDERR "\n|$affected_rows Daily Max Stats Closing Process Started|\n";} - - # gather data from CLOSING max stats records - $stmtA = "SELECT stats_date,stats_flag,stats_type,campaign_id,update_time,closed_time,max_channels,max_calls,max_inbound,max_outbound,max_agents,max_remote_agents,total_calls from vicidial_daily_max_stats where stats_flag='CLOSING';"; - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArowsDMS=$sthA->rows; - $i=0; - while ($sthArowsDMS > $i) - { - @aryA = $sthA->fetchrow_array; - $Astats_date[$i] = $aryA[0]; - $Astats_flag[$i] = $aryA[1]; - $Astats_type[$i] = $aryA[2]; - $Acampaign_id[$i] = $aryA[3]; - $Aupdate_time[$i] = $aryA[4]; - $Aclosed_time[$i] = $aryA[5]; - $Amax_channels[$i] = $aryA[6]; - $Amax_calls[$i] = $aryA[7]; - $Amax_inbound[$i] = $aryA[8]; - $Amax_outbound[$i] = $aryA[9]; - $Amax_agents[$i] = $aryA[10]; - $Amax_remote_agents[$i] = $aryA[11]; - $Atotal_calls[$i] = $aryA[12]; - - if($DBXXX){print STDERR "\nMAX STATS: |$i|$Astats_date[$i]|$Astats_flag[$i]|$Astats_type[$i]|$Acampaign_id[$i]|$Aupdate_time[$i]|$Aclosed_time[$i]|$Amax_channels[$i]|$Amax_calls[$i]|$Amax_inbound[$i]|$Amax_outbound[$i]|$Amax_agents[$i]|$Amax_remote_agents[$i]|$Atotal_calls[$i]|\n";} - $i++; - } - $sthA->finish(); - - ### loop through CLOSING max stats records and calculate end of day numbers, updating if necessary - $i=0; - while ($sthArowsDMS > $i) - { - $NEWtotal_calls=0; - $inbound_count=0; - $outbound_count=0; - ### calculate total calls for system, did inbound and vicidial outbound - if ($Astats_type[$i] =~ /TOTAL/) - { - $stmtA = "SELECT count(*) from vicidial_did_log where call_date > \"$RMSQLdate\";"; - $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; - $inbound_count = $aryA[0]; - } - $sthA->finish(); - - $stmtA = "SELECT count(*) from vicidial_log where call_date > \"$RMSQLdate\";"; - $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; - $outbound_count = $aryA[0]; - } - $sthA->finish(); - $NEWtotal_calls = ($inbound_count + $outbound_count); - - $stmtA = "UPDATE vicidial_daily_max_stats SET total_calls='$NEWtotal_calls',stats_flag='CLOSED' where stats_flag='CLOSING' and campaign_id='' and stats_type='TOTAL';"; - if($DBX){print STDERR "\n|$stmtA|\n";} - $affected_rows = $dbhA->do($stmtA); - if($DB){print STDERR "\n|$affected_rows Daily Max Stats Closed for TOTAL: $NEWtotal_calls|$Atotal_calls[$i]\n";} - } - ### calculate total calls for ingroups - if ($Astats_type[$i] =~ /INGROUP/) - { - $stmtA = "SELECT count(*) from vicidial_closer_log where call_date > \"$RMSQLdate\" and campaign_id='$Acampaign_id[$i]';"; - $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; - $inbound_count = $aryA[0]; - } - $sthA->finish(); - $NEWtotal_calls = ($inbound_count + $outbound_count); - - $stmtA = "UPDATE vicidial_daily_max_stats SET total_calls='$NEWtotal_calls',stats_flag='CLOSED' where stats_flag='CLOSING' and campaign_id='$Acampaign_id[$i]' and stats_type='INGROUP';"; - if($DBX){print STDERR "\n|$stmtA|\n";} - $affected_rows = $dbhA->do($stmtA); - if($DB){print STDERR "\n|$affected_rows Daily Max Stats Closed for INGROUP $Acampaign_id[$i]: $NEWtotal_calls|$Atotal_calls[$i]|\n";} - } - ### calculate total calls for campaigns - if ($Astats_type[$i] =~ /CAMPAIGN/) - { - $stmtA = "SELECT count(*) from vicidial_log where call_date > \"$RMSQLdate\" and campaign_id='$Acampaign_id[$i]';"; - $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; - $outbound_count = $aryA[0]; - } - $sthA->finish(); - $NEWtotal_calls = ($inbound_count + $outbound_count); - - $stmtA = "UPDATE vicidial_daily_max_stats SET total_calls='$NEWtotal_calls',stats_flag='CLOSED' where stats_flag='CLOSING' and campaign_id='$Acampaign_id[$i]' and stats_type='CAMPAIGN';"; - if($DBX){print STDERR "\n|$stmtA|\n";} - $affected_rows = $dbhA->do($stmtA); - if($DB){print STDERR "\n|$affected_rows Daily Max Stats Closed for CAMPAIGN $Acampaign_id[$i]: $NEWtotal_calls|$Atotal_calls[$i]|\n";} - } - - if($DBXXX){print STDERR "\nMAX STATS: |$i|$Astats_date[$i]|$Astats_flag[$i]|$Astats_type[$i]|$Acampaign_id[$i]|$Aupdate_time[$i]|$Aclosed_time[$i]|$Amax_channels[$i]|$Amax_calls[$i]|$Amax_inbound[$i]|$Amax_outbound[$i]|$Amax_agents[$i]|$Amax_remote_agents[$i]|$Atotal_calls[$i]| |$NEWtotal_calls = ($inbound_count + $outbound_count)|\n";} - $i++; - } - - $stmtA = "UPDATE vicidial_daily_max_stats SET stats_flag='CLOSED' where stats_flag='CLOSING';"; - if($DBX){print STDERR "\n|$stmtA|\n";} - $affected_rows = $dbhA->do($stmtA); - if($DB){print STDERR "\n|$affected_rows Daily Max Stats Closed Cleanup|\n";} - ##### END max stats end of day process ##### - - - - ##### BEGIN ra stats end of day process ##### - # set OPEN ra stats records to CLOSING for processing - $stmtA = "UPDATE vicidial_daily_ra_stats SET stats_flag='CLOSING' where stats_flag='OPEN';"; - if($DBX){print STDERR "\n|$stmtA|\n";} - $affected_rows = $dbhA->do($stmtA); - if($DB){print STDERR "\n|$affected_rows Daily RA Stats Closing Process Started|\n";} - - # gather data from CLOSING ra stats records - $stmtA = "SELECT stats_date,stats_flag,user,update_time,closed_time,max_calls,total_calls from vicidial_daily_ra_stats where stats_flag='CLOSING';"; - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArowsDMS=$sthA->rows; - $i=0; - while ($sthArowsDMS > $i) - { - @aryA = $sthA->fetchrow_array; - $Astats_date[$i] = $aryA[0]; - $Astats_flag[$i] = $aryA[1]; - $Auser[$i] = $aryA[2]; - $Aupdate_time[$i] = $aryA[3]; - $Aclosed_time[$i] = $aryA[4]; - $Amax_calls[$i] = $aryA[5]; - $Atotal_calls[$i] = $aryA[6]; - - if($DBXXX){print STDERR "\nMAX STATS: |$i|$Astats_date[$i]|$Astats_flag[$i]|$Auser[$i]|$Aupdate_time[$i]|$Aclosed_time[$i]|$Amax_calls[$i]|$Atotal_calls[$i]|\n";} - $i++; - } - $sthA->finish(); - - $stmtA = "UPDATE vicidial_daily_ra_stats SET stats_flag='CLOSED' where stats_flag='CLOSING';"; - if($DBX){print STDERR "\n|$stmtA|\n";} - $affected_rows = $dbhA->do($stmtA); - if($DB){print STDERR "\n|$affected_rows Daily RA Stats Closed Cleanup|\n";} - ##### END ra stats end of day process ##### - - - ##### BEGIN vicidial_ajax_log end of day process removing records older than 7 days ##### - $stmtA = "DELETE from vicidial_ajax_log where db_time < \"$SDSQLdate\";"; - if($DBX){print STDERR "\n|$stmtA|\n";} - $affected_rows = $dbhA->do($stmtA); - if($DB){print STDERR "\n|$affected_rows vicidial_ajax_log records older than 7 days purged|\n";} - - $stmtA = "optimize table vicidial_ajax_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_ajax_log end of day process removing records older than 7 days ##### - - - ##### BEGIN usacan_phone_dialcode_fix funciton ##### - if ($usacan_phone_dialcode_fix > 0) - { - $stmtA = "UPDATE vicidial_list SET phone_code='1' where phone_code!='1';"; + $stmtA = "optimize table vicidial_drop_rate_groups;"; if($DBX){print STDERR "\n|$stmtA|\n";} - $PCaffected_rows = $dbhA->do($stmtA); - if($DB){print STDERR "\n|$PCaffected_rows vicidial_list.phone_code entries set to 1|\n";} - - $stmtA = "UPDATE vicidial_list SET phone_number = TRIM(LEADING '1' from phone_number) where char_length(phone_number) > 10 and phone_number LIKE \"1%\";"; - if($DBX){print STDERR "\n|$stmtA|\n";} - $PNaffected_rows = $dbhA->do($stmtA); - if($DB){print STDERR "\n|$PNaffected_rows vicidial_list phone_number leading 1 entries trimmed|\n";} - - if ( ($PCaffected_rows > 0) or ($PNaffected_rows > 0) ) - { - if ($DB) {print "restarting Asterisk process...\n";} - $stmtA="INSERT INTO vicidial_admin_log set event_date=NOW(), user='VDAD', ip_address='1.1.1.1', event_section='SERVERS', event_type='MODIFY', record_id='leads', event_code='USACAN PHONE DIALCODE FIX', event_sql='', event_notes='$PCaffected_rows vicidial_list.phone_code entries set to 1|$PNaffected_rows vicidial_list phone_number leading 1 entries trimmed|';"; - $Laffected_rows = $dbhA->do($stmtA); - if ($DBX) {print "Admin log of USACAN phone code fix: |$Laffected_rows|$stmtA|\n";} - } - } - ##### END usacan_phone_dialcode_fix funciton ##### - - - $dbhC = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_custom_user", "$VARDB_custom_pass") - or die "Couldn't connect to database: " . DBI->errstr; - - ##### find MEMORY tables for reset of empty space ##### - $stmtA = "SHOW TABLE STATUS WHERE Engine='MEMORY';"; - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - $i=0; - while ($sthArows > $i) - { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; @aryA = $sthA->fetchrow_array; - $table_name = $aryA[0]; + if ($DB) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); - $stmtC = "ALTER TABLE $table_name ENGINE=MEMORY;"; - if($DBX){print STDERR "\n|$stmtC|\n";} - $Caffected_rows = $dbhC->do($stmtC); - if($DB){print STDERR "\n|$table_name memory reset $Caffected_rows rows|\n";} - $i++; + $stmtA = "delete from vicidial_campaign_server_stats;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows vicidial_campaign_server_stats records deleted|\n";} + if ($teodDB) {$event_string = "vicidial_campaign_server_stats records reset: $affected_rows"; &teod_logger;} + + $stmtA = "optimize table vicidial_campaign_server_stats;"; + 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(); + + $stmtA = "delete from vicidial_campaign_stats_debug;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows vicidial_campaign_stats_debug records deleted|\n";} + if ($teodDB) {$event_string = "vicidial_campaign_stats_debug records reset: $affected_rows"; &teod_logger;} + + $stmtA = "optimize table vicidial_campaign_stats_debug;"; + 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(); + + $stmtA = "update vicidial_inbound_group_agents SET calls_today=0;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows vicidial_inbound_group_agents call counts reset|\n";} + if ($teodDB) {$event_string = "vicidial_inbound_group_agents records reset: $affected_rows"; &teod_logger;} + + $stmtA = "optimize table vicidial_inbound_group_agents;"; + 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(); + + $stmtA = "update vicidial_campaign_cid_areacodes SET call_count_today=0;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows vicidial_campaign_cid_areacodes call counts reset|\n";} + if ($teodDB) {$event_string = "vicidial_campaign_cid_areacodes records reset: $affected_rows"; &teod_logger;} + + $stmtA = "optimize table vicidial_campaign_cid_areacodes;"; + 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(); + + $stmtA = "update vicidial_did_ra_extensions SET call_count_today=0;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows vicidial_did_ra_extensions call counts reset|\n";} + if ($teodDB) {$event_string = "vicidial_did_ra_extensions records reset: $affected_rows"; &teod_logger;} + + $stmtA = "optimize table vicidial_did_ra_extensions;"; + 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(); + + $stmtA = "update vicidial_extension_groups SET call_count_today=0;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows vicidial_extension_groups call counts reset|\n";} + if ($teodDB) {$event_string = "vicidial_extension_groups records reset: $affected_rows"; &teod_logger;} + + $stmtA = "optimize table vicidial_extension_groups;"; + 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(); + + $stmtA = "optimize table vicidial_users;"; + 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(); + + $stmtA = "update vicidial_campaign_agents SET calls_today=0;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows vicidial_campaign_agents call counts reset|\n";} + if ($teodDB) {$event_string = "vicidial_campaign_agents records reset: $affected_rows"; &teod_logger;} + + $stmtA = "optimize table vicidial_campaign_agents;"; + 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(); + + $stmtA = "update vicidial_live_inbound_agents SET calls_today=0;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows vicidial_live_inbound_agents call counts reset|\n";} + if ($teodDB) {$event_string = "vicidial_live_inbound_agents records reset: $affected_rows"; &teod_logger;} + + if ($agents_calls_reset > 0) + { + $stmtA = "delete from vicidial_live_inbound_agents where last_call_finish < \"$TDSQLdate\";"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows vicidial_live_inbound_agents old records deleted|\n";} + if ($teodDB) {$event_string = "vicidial_live_inbound_agents old records deleted($TDSQLdate): $affected_rows"; &teod_logger;} + + $stmtA = "delete from vicidial_live_agents where last_state_change < \"$TDSQLdate\" and extension NOT LIKE \"R/%\";"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows vicidial_live_agents old records deleted|\n";} + if ($teodDB) {$event_string = "vicidial_live_agents old records deleted($TDSQLdate): $affected_rows"; &teod_logger;} + + $stmtA = "delete from vicidial_auto_calls where last_update_time < \"$TDSQLdate\";"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows vicidial_auto_calls old records deleted|\n";} + if ($teodDB) {$event_string = "vicidial_auto_calls old records deleted($TDSQLdate): $affected_rows"; &teod_logger;} + } + + $stmtA = "optimize table vicidial_live_inbound_agents;"; + 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(); + + $stmtA = "optimize table vicidial_live_agents;"; + 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(); + + $stmtA = "optimize table vicidial_auto_calls;"; + 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(); + + $stmtA = "optimize table vicidial_daily_max_stats;"; + 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(); + + $stmtA = "optimize table vicidial_daily_ra_stats;"; + 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(); + + $stmtA = "delete from vicidial_session_data where login_time < \"$TDSQLdate\";"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows vicidial_session_data old records deleted|\n";} + if ($teodDB) {$event_string = "vicidial_session_data old records deleted($TDSQLdate): $affected_rows"; &teod_logger;} + + $stmtA = "optimize table vicidial_session_data;"; + 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(); + + $stmtA = "delete from vicidial_monitor_calls where monitor_time < \"$TDSQLdate\";"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows vicidial_monitor_calls old records deleted|\n";} + if ($teodDB) {$event_string = "vicidial_monitor_calls old records deleted($TDSQLdate): $affected_rows"; &teod_logger;} + + $stmtA = "optimize table vicidial_monitor_calls;"; + 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(); + + # set past holidays to EXPIRED status + $stmtA = "UPDATE vicidial_call_time_holidays SET holiday_status='EXPIRED' where holiday_date < \"$RMdate\" and holiday_status!='EXPIRED';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows Holidays set to expired|\n";} + if ($teodDB) {$event_string = "Holidays set to expired($RMdate): $affected_rows"; &teod_logger;} + + + ##### BEGIN max stats end of day process ##### + # set OPEN max stats records to CLOSING for processing + $stmtA = "UPDATE vicidial_daily_max_stats SET stats_flag='CLOSING' where stats_flag='OPEN';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows Daily Max Stats Closing Process Started|\n";} + if ($teodDB) {$event_string = "Daily Max Stats Closing Process Started: $affected_rows"; &teod_logger;} + + # gather data from CLOSING max stats records + $stmtA = "SELECT stats_date,stats_flag,stats_type,campaign_id,update_time,closed_time,max_channels,max_calls,max_inbound,max_outbound,max_agents,max_remote_agents,total_calls from vicidial_daily_max_stats where stats_flag='CLOSING';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArowsDMS=$sthA->rows; + $i=0; + while ($sthArowsDMS > $i) + { + @aryA = $sthA->fetchrow_array; + $Astats_date[$i] = $aryA[0]; + $Astats_flag[$i] = $aryA[1]; + $Astats_type[$i] = $aryA[2]; + $Acampaign_id[$i] = $aryA[3]; + $Aupdate_time[$i] = $aryA[4]; + $Aclosed_time[$i] = $aryA[5]; + $Amax_channels[$i] = $aryA[6]; + $Amax_calls[$i] = $aryA[7]; + $Amax_inbound[$i] = $aryA[8]; + $Amax_outbound[$i] = $aryA[9]; + $Amax_agents[$i] = $aryA[10]; + $Amax_remote_agents[$i] = $aryA[11]; + $Atotal_calls[$i] = $aryA[12]; + + if($DBXXX){print STDERR "\nMAX STATS: |$i|$Astats_date[$i]|$Astats_flag[$i]|$Astats_type[$i]|$Acampaign_id[$i]|$Aupdate_time[$i]|$Aclosed_time[$i]|$Amax_channels[$i]|$Amax_calls[$i]|$Amax_inbound[$i]|$Amax_outbound[$i]|$Amax_agents[$i]|$Amax_remote_agents[$i]|$Atotal_calls[$i]|\n";} + if ($teodDB) {$event_string = "MAX STATS: |$i|$Astats_date[$i]|$Astats_flag[$i]|$Astats_type[$i]|$Acampaign_id[$i]|$Aupdate_time[$i]|$Aclosed_time[$i]|$Amax_channels[$i]|$Amax_calls[$i]|$Amax_inbound[$i]|$Amax_outbound[$i]|$Amax_agents[$i]|$Amax_remote_agents[$i]|$Atotal_calls[$i]|"; &teod_logger;} + + $i++; + } + $sthA->finish(); + + ### loop through CLOSING max stats records and calculate end of day numbers, updating if necessary + $i=0; + while ($sthArowsDMS > $i) + { + $NEWtotal_calls=0; + $inbound_count=0; + $outbound_count=0; + ### calculate total calls for system, did inbound and vicidial outbound + if ($Astats_type[$i] =~ /TOTAL/) + { + $stmtA = "SELECT count(*) from vicidial_did_log where call_date >= \"$RMSQLdate\" and call_date < \"$now_date\";"; + $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; + $inbound_count = $aryA[0]; + } + $sthA->finish(); + if ($teodDB) {$event_string = "MAX STATS TOTAL DID INBOUND: |$stmtA|$inbound_count|"; &teod_logger;} + + $stmtA = "SELECT count(*) from vicidial_log where call_date >= \"$RMSQLdate\" and call_date < \"$now_date\";"; + $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; + $outbound_count = $aryA[0]; + } + $sthA->finish(); + if ($teodDB) {$event_string = "MAX STATS TOTAL OUTBOUND: |$stmtA|$outbound_count|"; &teod_logger;} + $NEWtotal_calls = ($inbound_count + $outbound_count); + + $stmtA = "UPDATE vicidial_daily_max_stats SET total_calls='$NEWtotal_calls',stats_flag='CLOSED' where stats_flag='CLOSING' and campaign_id='' and stats_type='TOTAL';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows Daily Max Stats Closed for TOTAL: $NEWtotal_calls|$Atotal_calls[$i]\n";} + if ($teodDB) {$event_string = "Daily Max Stats Closed for TOTAL: |$stmtA|$affected_rows|$NEWtotal_calls|$Atotal_calls[$i]|"; &teod_logger;} + } + ### calculate total calls for ingroups + if ($Astats_type[$i] =~ /INGROUP/) + { + $stmtA = "SELECT count(*) from vicidial_closer_log where call_date >= \"$RMSQLdate\" and call_date < \"$now_date\" and campaign_id='$Acampaign_id[$i]';"; + $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; + $inbound_count = $aryA[0]; + } + $sthA->finish(); + $NEWtotal_calls = $inbound_count; + + $stmtB = "UPDATE vicidial_daily_max_stats SET total_calls='$NEWtotal_calls',stats_flag='CLOSED' where stats_flag='CLOSING' and campaign_id='$Acampaign_id[$i]' and stats_type='INGROUP';"; + if($DBX){print STDERR "\n|$stmtB|\n";} + $affected_rows = $dbhA->do($stmtB); + if($DB){print STDERR "\n|$affected_rows Daily Max Stats Closed for INGROUP $Acampaign_id[$i]: $NEWtotal_calls|$Atotal_calls[$i]|\n";} + if ($teodDB) {$event_string = "MAX STATS IN-GROUP INBOUND: |$stmtA|$inbound_count|$Acampaign_id[$i]|$stmtB|$affected_rows|"; &teod_logger;} + } + ### calculate total calls for campaigns + if ($Astats_type[$i] =~ /CAMPAIGN/) + { + $stmtA = "SELECT count(*) from vicidial_log where call_date >= \"$RMSQLdate\" and call_date < \"$now_date\" and campaign_id='$Acampaign_id[$i]';"; + $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; + $outbound_count = $aryA[0]; + } + $sthA->finish(); + $NEWtotal_calls = $outbound_count; + + $stmtB = "UPDATE vicidial_daily_max_stats SET total_calls='$NEWtotal_calls',stats_flag='CLOSED' where stats_flag='CLOSING' and campaign_id='$Acampaign_id[$i]' and stats_type='CAMPAIGN';"; + if($DBX){print STDERR "\n|$stmtB|\n";} + $affected_rows = $dbhA->do($stmtB); + if($DB){print STDERR "\n|$affected_rows Daily Max Stats Closed for CAMPAIGN $Acampaign_id[$i]: $NEWtotal_calls|$Atotal_calls[$i]|\n";} + if ($teodDB) {$event_string = "MAX STATS CAMPAIGN OUTBOUND: |$stmtA|$outbound_count|$Acampaign_id[$i]|$stmtB|$affected_rows|"; &teod_logger;} + } + + if($DBXXX){print STDERR "\nMAX STATS: |$i|$Astats_date[$i]|$Astats_flag[$i]|$Astats_type[$i]|$Acampaign_id[$i]|$Aupdate_time[$i]|$Aclosed_time[$i]|$Amax_channels[$i]|$Amax_calls[$i]|$Amax_inbound[$i]|$Amax_outbound[$i]|$Amax_agents[$i]|$Amax_remote_agents[$i]|$Atotal_calls[$i]| |$NEWtotal_calls = ($inbound_count + $outbound_count)|\n";} + if ($teodDB) {$event_string = "MAX STATS: |$i|$Astats_date[$i]|$Astats_flag[$i]|$Astats_type[$i]|$Acampaign_id[$i]|$Aupdate_time[$i]|$Aclosed_time[$i]|$Amax_channels[$i]|$Amax_calls[$i]|$Amax_inbound[$i]|$Amax_outbound[$i]|$Amax_agents[$i]|$Amax_remote_agents[$i]|$Atotal_calls[$i]| |$NEWtotal_calls = ($inbound_count + $outbound_count)|"; &teod_logger;} + + $i++; + } + + $stmtA = "UPDATE vicidial_daily_max_stats SET stats_flag='CLOSED' where stats_flag='CLOSING';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows Daily Max Stats Closed Cleanup|\n";} + if ($teodDB) {$event_string = "Daily Max Stats Closed Cleanup: |$stmtA|$affected_rows|"; &teod_logger;} + ##### END max stats end of day process ##### + + + + ##### BEGIN ra stats end of day process ##### + # set OPEN ra stats records to CLOSING for processing + $stmtA = "UPDATE vicidial_daily_ra_stats SET stats_flag='CLOSING' where stats_flag='OPEN';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows Daily RA Stats Closing Process Started|\n";} + if ($teodDB) {$event_string = "Daily RA Stats Closing Process Started: |$stmtA|$affected_rows|"; &teod_logger;} + + # gather data from CLOSING ra stats records + $stmtA = "SELECT stats_date,stats_flag,user,update_time,closed_time,max_calls,total_calls from vicidial_daily_ra_stats where stats_flag='CLOSING';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArowsDMS=$sthA->rows; + $i=0; + while ($sthArowsDMS > $i) + { + @aryA = $sthA->fetchrow_array; + $Astats_date[$i] = $aryA[0]; + $Astats_flag[$i] = $aryA[1]; + $Auser[$i] = $aryA[2]; + $Aupdate_time[$i] = $aryA[3]; + $Aclosed_time[$i] = $aryA[4]; + $Amax_calls[$i] = $aryA[5]; + $Atotal_calls[$i] = $aryA[6]; + + if($DBXXX){print STDERR "\nRA MAX STATS: |$i|$Astats_date[$i]|$Astats_flag[$i]|$Auser[$i]|$Aupdate_time[$i]|$Aclosed_time[$i]|$Amax_calls[$i]|$Atotal_calls[$i]|\n";} + if ($teodDB) {$event_string = "RA MAX STATS: |$i|$Astats_date[$i]|$Astats_flag[$i]|$Auser[$i]|$Aupdate_time[$i]|$Aclosed_time[$i]|$Amax_calls[$i]|$Atotal_calls[$i]|"; &teod_logger;} + $i++; + } + $sthA->finish(); + + $stmtA = "UPDATE vicidial_daily_ra_stats SET stats_flag='CLOSED' where stats_flag='CLOSING';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows Daily RA Stats Closed Cleanup|\n";} + if ($teodDB) {$event_string = "Daily RA Stats Closed Cleanup: |$stmtA|$affected_rows|"; &teod_logger;} + ##### END ra stats end of day process ##### + + + ##### BEGIN vicidial_ajax_log end of day process removing records older than 7 days ##### + $stmtA = "DELETE from vicidial_ajax_log where db_time < \"$SDSQLdate\";"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows vicidial_ajax_log records older than 7 days purged|\n";} + if ($teodDB) {$event_string = "vicidial_ajax_log records older than 7 days purged: |$stmtA|$affected_rows|"; &teod_logger;} + + $stmtA = "optimize table vicidial_ajax_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_ajax_log end of day process removing records older than 7 days ##### + + + ##### BEGIN usacan_phone_dialcode_fix funciton ##### + if ($usacan_phone_dialcode_fix > 0) + { + $stmtA = "UPDATE vicidial_list SET phone_code='1' where phone_code!='1';"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $PCaffected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$PCaffected_rows vicidial_list.phone_code entries set to 1|\n";} + if ($teodDB) {$event_string = "vicidial_list.phone_code entries set to 1: |$stmtA|$PCaffected_rows|"; &teod_logger;} + + $stmtB = "UPDATE vicidial_list SET phone_number = TRIM(LEADING '1' from phone_number) where char_length(phone_number) > 10 and phone_number LIKE \"1%\";"; + if($DBX){print STDERR "\n|$stmtB|\n";} + $PNaffected_rows = $dbhA->do($stmtB); + if($DB){print STDERR "\n|$PNaffected_rows vicidial_list phone_number leading 1 entries trimmed|\n";} + if ($teodDB) {$event_string = "vicidial_list phone_number leading 1 entries trimmed: |$stmtB|$PNaffected_rows|"; &teod_logger;} + + if ( ($PCaffected_rows > 0) or ($PNaffected_rows > 0) ) + { + if ($DB) {print "restarting Asterisk process...\n";} + $stmtA="INSERT INTO vicidial_admin_log set event_date=NOW(), user='VDAD', ip_address='1.1.1.1', event_section='SERVERS', event_type='MODIFY', record_id='leads', event_code='USACAN PHONE DIALCODE FIX', event_sql='', event_notes='$PCaffected_rows vicidial_list.phone_code entries set to 1|$PNaffected_rows vicidial_list phone_number leading 1 entries trimmed|';"; + $Laffected_rows = $dbhA->do($stmtA); + if ($DBX) {print "Admin log of USACAN phone code fix: |$Laffected_rows|$stmtA|\n";} + } + } + ##### END usacan_phone_dialcode_fix funciton ##### + + + $dbhC = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_custom_user", "$VARDB_custom_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + ##### find MEMORY tables for reset of empty space ##### + $stmtA = "SHOW TABLE STATUS WHERE Engine='MEMORY';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $i=0; + while ($sthArows > $i) + { + @aryA = $sthA->fetchrow_array; + $table_name = $aryA[0]; + + $stmtC = "ALTER TABLE $table_name ENGINE=MEMORY;"; + if($DBX){print STDERR "\n|$stmtC|\n";} + $Caffected_rows = $dbhC->do($stmtC); + if($DB){print STDERR "\n|$table_name memory reset $Caffected_rows rows|\n";} + $i++; + } + $sthA->finish(); } - $sthA->finish(); } ################################################################################ @@ -1362,54 +1471,6 @@ if ($timeclock_end_of_day_NOW > 0) ##### START Creation of auto-generated conf files ################################################################################ -##### 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 FROM system_settings;"; -# print "$stmtA\n"; -$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; - $sounds_central_control_active = $aryA[0]; - $active_voicemail_server = $aryA[1]; - $SScustom_dialplan_entry = $aryA[2]; - $SSdefault_codecs = $aryA[3]; - $SSgenerate_cross_server_exten = $aryA[4]; - $SSvoicemail_timezones = $aryA[5]; - $SSdefault_voicemail_timezone = $aryA[6]; - $SScall_menu_qualify_enabled = $aryA[7]; - $SSallow_voicemail_greeting = $aryA[8]; - $SSreload_timestamp = $aryA[9]; - $meetme_enter_login_filename = $aryA[10]; - $meetme_enter_leave3way_filename = $aryA[11]; - $SSallow_chats = $aryA[12]; - } -$sthA->finish(); -if ($DBXXX > 0) {print "SYSTEM SETTINGS: $sounds_central_control_active|$active_voicemail_server|$SScustom_dialplan_entry|$SSdefault_codecs\n";} - -##### Get the settings for this server's server_ip ##### -$stmtA = "SELECT active_asterisk_server,generate_vicidial_conf,rebuild_conf_files,asterisk_version,sounds_update,conf_secret,custom_dialplan_entry,auto_restart_asterisk,asterisk_temp_no_restart,gather_asterisk_output FROM servers where server_ip='$server_ip';"; -# print "$stmtA\n"; -$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; - $active_asterisk_server = $aryA[0]; - $generate_vicidial_conf = $aryA[1]; - $rebuild_conf_files = $aryA[2]; - $asterisk_version = $aryA[3]; - $sounds_update = $aryA[4]; - $self_conf_secret = $aryA[5]; - $SERVERcustom_dialplan_entry = $aryA[6]; - $auto_restart_asterisk = $aryA[7]; - $asterisk_temp_no_restart = $aryA[8]; - $gather_asterisk_output = $aryA[9]; - } -$sthA->finish(); - if ( ($active_voicemail_server =~ /$server_ip/) && ((length($active_voicemail_server)) eq (length($server_ip))) ) { $THISserver_voicemail=1; @@ -2541,7 +2602,7 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r ##### BEGIN Generate the Call Menu entries ##### - $stmtA = "SELECT menu_id,menu_name,menu_prompt,menu_timeout,menu_timeout_prompt,menu_invalid_prompt,menu_repeat,menu_time_check,call_time_id,track_in_vdac,custom_dialplan_entry,tracking_group,dtmf_log,dtmf_field,qualify_sql FROM vicidial_call_menu order by menu_id;"; + $stmtA = "SELECT menu_id,menu_name,menu_prompt,menu_timeout,menu_timeout_prompt,menu_invalid_prompt,menu_repeat,menu_time_check,call_time_id,track_in_vdac,custom_dialplan_entry,tracking_group,dtmf_log,dtmf_field,qualify_sql,alt_dtmf_log,question FROM vicidial_call_menu order by menu_id;"; # print "$stmtA\n"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; @@ -2565,6 +2626,8 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r $dtmf_log[$i] = $aryA[12]; $dtmf_field[$i] = $aryA[13]; $qualify_sql[$i] = $aryA[14]; + $alt_dtmf_log[$i] = $aryA[15]; + $question[$i] = $aryA[16]; if ($track_in_vdac[$i] > 0) {$track_in_vdac[$i] = 'YES';} @@ -2724,21 +2787,21 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r if ($option_route[$j] =~ /AGI/) { if ($dtmf_log[$i] > 0) - {$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j]-----$dtmf_field[$i])\n"; $PRI++;} + {$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j]-----$dtmf_field[$i]-----$alt_dtmf_log[$i]-----$question[$i])\n"; $PRI++;} $call_menu_line .= "exten => $option_value[$j],$PRI,AGI($option_route_value[$j])\n"; $PRI++; $call_menu_line .= "exten => $option_value[$j],$PRI,Hangup()\n"; } if ($option_route[$j] =~ /CALLMENU/) { if ($dtmf_log[$i] > 0) - {$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j]-----$dtmf_field[$i])\n"; $PRI++;} + {$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j]-----$dtmf_field[$i]-----$alt_dtmf_log[$i]-----$question[$i])\n"; $PRI++;} $call_menu_line .= "exten => $option_value[$j],$PRI,Goto($option_route_value[$j],s,1)\n"; $PRI++; $call_menu_line .= "exten => $option_value[$j],$PRI,Hangup()\n"; } if ($option_route[$j] =~ /DID/) { if ($dtmf_log[$i] > 0) - {$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j]-----$dtmf_field[$i])\n"; $PRI++;} + {$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j]-----$dtmf_field[$i]-----$alt_dtmf_log[$i]-----$question[$i])\n"; $PRI++;} $call_menu_line .= "exten => $option_value[$j],$PRI,Goto(trunkinbound,$option_route_value[$j],1)\n"; $PRI++; $call_menu_line .= "exten => $option_value[$j],$PRI,Hangup()\n"; } @@ -2756,14 +2819,14 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r $IGvid_validate_digits = $IGoption_route_value_context[8]; if ($dtmf_log[$i] > 0) - {$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j]-----$dtmf_field[$i])\n"; $PRI++;} + {$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j]-----$dtmf_field[$i]-----$alt_dtmf_log[$i]-----$question[$i])\n"; $PRI++;} $call_menu_line .= "exten => $option_value[$j],$PRI,AGI(agi-VDAD_ALL_inbound.agi,$IGhandle_method-----$IGsearch_method-----$option_route_value[$j]-----$menu_id[$i]--------------------$IGlist_id-----$IGphone_code-----$IGcampaign_id---------------$IGvid_enter_filename-----$IGvid_id_number_filename-----$IGvid_confirm_filename-----$IGvid_validate_digits)\n"; $PRI++; $call_menu_line .= "exten => $option_value[$j],$PRI,Hangup()\n"; } if ($option_route[$j] =~ /EXTENSION/) { if ($dtmf_log[$i] > 0) - {$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j]-----$dtmf_field[$i])\n"; $PRI++;} + {$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j]-----$dtmf_field[$i]-----$alt_dtmf_log[$i]-----$question[$i])\n"; $PRI++;} if (length($option_route_value_context[$j])>0) {$option_route_value_context[$j] = "$option_route_value_context[$j],";} $call_menu_line .= "exten => $option_value[$j],$PRI,Goto($option_route_value_context[$j]$option_route_value[$j],1)\n"; $PRI++; $call_menu_line .= "exten => $option_value[$j],$PRI,Hangup()\n"; @@ -2771,7 +2834,7 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r if ($option_route[$j] =~ /VOICEMAIL|VMAIL_NO_INST/) { if ($dtmf_log[$i] > 0) - {$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j]-----$dtmf_field[$i])\n"; $PRI++;} + {$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j]-----$dtmf_field[$i]-----$alt_dtmf_log[$i]-----$question[$i])\n"; $PRI++;} if ($option_route[$j] =~ /VMAIL_NO_INST/) { $call_menu_line .= "exten => $option_value[$j],$PRI,Goto(default,85026666666667$option_route_value[$j],1)\n"; $PRI++; @@ -2809,13 +2872,13 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r $call_menu_line .= "$hangup_prompt_ext"; if ($dtmf_log[$i] > 0) - {$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j]-----$dtmf_field[$i])\n"; $PRI++;} + {$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j]-----$dtmf_field[$i]-----$alt_dtmf_log[$i]-----$question[$i])\n"; $PRI++;} $call_menu_line .= "exten => $option_value[$j],n,Hangup()\n"; } else { if ($dtmf_log[$i] > 0) - {$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j]-----$dtmf_field[$i])\n"; $PRI++;} + {$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j]-----$dtmf_field[$i]-----$alt_dtmf_log[$i]-----$question[$i])\n"; $PRI++;} $call_menu_line .= "exten => $option_value[$j],$PRI,Hangup()\n"; } } @@ -2843,7 +2906,7 @@ if ( ($active_asterisk_server =~ /Y/) && ($generate_vicidial_conf =~ /Y/) && ($r $DIALstring = "$a$S$b$S$c$S$d$S"; } if ($dtmf_log[$i] > 0) - {$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j]-----$dtmf_field[$i])\n"; $PRI++;} + {$call_menu_line .= "exten => $option_value[$j],$PRI,AGI(cm.agi,$tracking_group[$i]-----$option_value[$j]-----$dtmf_field[$i]-----$alt_dtmf_log[$i]-----$question[$i])\n"; $PRI++;} $call_menu_line .= "exten => $option_value[$j],$PRI,Goto(default,$DIALstring$Pdialplan,1)\n"; $PRI++; $call_menu_line .= "exten => $option_value[$j],$PRI,Hangup()\n"; } @@ -3818,6 +3881,17 @@ if ($DB) {print "DONE\n";} exit; +sub teod_logger + { + if (!$teodLOGfile) {$teodLOGfile = "$PATHlogs/teod.$year-$mon-$mday";} + + ### open the log file for writing ### + open(Lout, ">>$teodLOGfile") + || die "Can't open $teodLOGfile: $!\n"; + print Lout "$now_date|$event_string|\n"; + close(Lout); + $event_string=''; + } sub leading_zero($) { diff --git a/extras/MySQL_AST_CREATE_tables.sql b/extras/MySQL_AST_CREATE_tables.sql index 923f7639..81a975c5 100644 --- a/extras/MySQL_AST_CREATE_tables.sql +++ b/extras/MySQL_AST_CREATE_tables.sql @@ -1642,7 +1642,8 @@ usacan_phone_dialcode_fix ENUM('0','1') default '0', cache_carrier_stats_realtime ENUM('0','1') default '0', oldest_logs_date DATETIME, log_recording_access ENUM('0', '1') default '0', -report_default_format ENUM('TEXT', 'HTML') default 'TEXT' +report_default_format ENUM('TEXT', 'HTML') default 'TEXT', +alt_ivr_logging ENUM('0', '1') default '0' ) ENGINE=MyISAM; CREATE TABLE vicidial_campaigns_list_mix ( @@ -2104,7 +2105,9 @@ tracking_group VARCHAR(20) default 'CALLMENU', dtmf_log ENUM('0','1') default '0', dtmf_field VARCHAR(50) default 'NONE', user_group VARCHAR(20) default '---ALL---', -qualify_sql TEXT +qualify_sql TEXT, +alt_dtmf_log ENUM('0','1') default '0', +question INT(11) DEFAULT NULL ) ENGINE=MyISAM; CREATE TABLE vicidial_call_menu_options ( @@ -3470,6 +3473,20 @@ index(recording_id), index(lead_id) ) ENGINE=MyISAM AUTO_INCREMENT=1599 DEFAULT CHARSET=utf8; +CREATE TABLE vicidial_ivr_response ( +id INT(11) unsigned NOT NULL AUTO_INCREMENT, +btn VARCHAR(10) DEFAULT NULL, +lead_id INT(10) unsigned DEFAULT NULL, +created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +question INT(11) DEFAULT NULL, +response VARCHAR(10) DEFAULT NULL, +uniqueid VARCHAR(50) DEFAULT NULL, +campaign VARCHAR(20) DEFAULT NULL, +PRIMARY KEY (id), +KEY question_created (question,uniqueid,campaign,created), +index(lead_id) +) ENGINE=MyISAM AUTO_INCREMENT=1599 DEFAULT CHARSET=utf8; + ALTER TABLE vicidial_email_list MODIFY message text character set utf8; @@ -3720,4 +3737,4 @@ UPDATE vicidial_configuration set value='1766' where name='qc_database_version'; UPDATE system_settings set vdc_agent_api_active='1'; -UPDATE system_settings SET db_schema_version='1453',db_schema_update_date=NOW(),reload_timestamp=NOW(); +UPDATE system_settings SET db_schema_version='1454',db_schema_update_date=NOW(),reload_timestamp=NOW(); diff --git a/extras/upgrade_2.12.sql b/extras/upgrade_2.12.sql index ad3bdbc0..ea94f79d 100644 --- a/extras/upgrade_2.12.sql +++ b/extras/upgrade_2.12.sql @@ -524,3 +524,24 @@ ALTER TABLE vicidial_chat_archive ADD user_direct_group_id VARCHAR(20); INSERT INTO vicidial_inbound_groups(group_id,group_name,group_color,active,web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_action,drop_exten,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,default_xfer_group,queue_priority,drop_inbound_group,ingroup_recording_override,ingroup_rec_filename,afterhours_xfer_group,qc_enabled,qc_statuses,qc_shift_id,qc_get_record_launch,qc_show_recording,qc_web_form_address,qc_script,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,answer_sec_pct_rt_stat_one,answer_sec_pct_rt_stat_two,default_group_alias,no_agent_no_queue,no_agent_action,no_agent_action_value,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,ignore_list_script_override,extension_appended_cidname,uniqueid_status_display,uniqueid_status_prefix,hold_time_option_minimum,hold_time_option_press_filename,hold_time_option_callmenu,hold_time_option_no_block,hold_time_option_prompt_seconds,onhold_prompt_no_block,onhold_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,timer_action_destination,calculate_estimated_hold_seconds,add_lead_url,eht_minimum_prompt_filename,eht_minimum_prompt_no_block,eht_minimum_prompt_seconds,on_hook_ring_time,na_call_url,on_hook_cid,group_calldate,action_xfer_cid,drop_callmenu,after_hours_callmenu,user_group,max_calls_method,max_calls_count,max_calls_action,dial_ingroup_cid,group_handling,web_form_address_three,populate_lead_ingroup,drop_lead_reset,after_hours_lead_reset,nanq_lead_reset,wait_time_lead_reset,hold_time_lead_reset,status_group_id,routing_initiated_recordings,on_hook_cid_number) VALUES ('AGENTDIRECT_CHAT','Agent Direct Queue for Chats','#FFFFFF','Y','','','longest_wait_time','Y','','',NULL,NULL,NULL,NULL,360,'MESSAGE','8307','24hours','MESSAGE','vm-goodbye','8300',NULL,'---NONE---','default','generic_hold',60,'ding',1000,'---NONE---',99,'---NONE---','DISABLED','NONE','---NONE---','N',NULL,'24HRMIDNIGHT','NONE','Y',NULL,NULL,'N','N','NONE',360,'8300','','---NONE---','vm-hangup',0,'---NONE---','N','ALWAYS',20,30,'','N','MESSAGE','nbdy-avail-to-take-call|vm-goodbye','','NONE','',-1,'','','','','','N','N','DISABLED','',0,'to-be-called-back|digits/1','','N',10,'N',10,'NONE','NONE','WAIT','NONE','NONE','NONE',120,'8300','','---NONE---','','vm-hangup',999,'to-be-called-back|digits/1','N',10,'',0,'','','N',10,15,'','GENERIC',NULL,'CUSTOMER','','','---ALL---','DISABLED',0,'DROP','','CHAT','','ENABLED','N','N','N','N','N','','N',''); UPDATE system_settings SET db_schema_version='1453',db_schema_update_date=NOW() where db_schema_version < 1453; + +CREATE TABLE vicidial_ivr_response ( +id INT(11) unsigned NOT NULL AUTO_INCREMENT, +btn VARCHAR(10) DEFAULT NULL, +lead_id INT(10) unsigned DEFAULT NULL, +created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +question INT(11) DEFAULT NULL, +response VARCHAR(10) DEFAULT NULL, +uniqueid VARCHAR(50) DEFAULT NULL, +campaign VARCHAR(20) DEFAULT NULL, +PRIMARY KEY (id), +KEY question_created (question,uniqueid,campaign,created), +index(lead_id) +) ENGINE=MyISAM AUTO_INCREMENT=1599 DEFAULT CHARSET=utf8; + +ALTER TABLE system_settings ADD alt_ivr_logging ENUM('0', '1') default '0'; + +ALTER TABLE vicidial_call_menu ADD alt_dtmf_log ENUM('0','1') default '0'; +ALTER TABLE vicidial_call_menu ADD question INT(11) DEFAULT NULL; + +UPDATE system_settings SET db_schema_version='1454',db_schema_update_date=NOW() where db_schema_version < 1454; diff --git a/www/vicidial/admin.php b/www/vicidial/admin.php index fe17df18..a1aec165 100644 --- a/www/vicidial/admin.php +++ b/www/vicidial/admin.php @@ -2034,6 +2034,12 @@ if (isset($_GET["manual_dial_hopper_check"])) {$manual_dial_hopper_check=$_GET elseif (isset($_POST["manual_dial_hopper_check"])) {$manual_dial_hopper_check=$_POST["manual_dial_hopper_check"];} if (isset($_GET["report_default_format"])) {$report_default_format=$_GET["report_default_format"];} elseif (isset($_POST["report_default_format"])) {$report_default_format=$_POST["report_default_format"];} +if (isset($_GET["alt_ivr_logging"])) {$alt_ivr_logging=$_GET["alt_ivr_logging"];} + elseif (isset($_POST["alt_ivr_logging"])) {$alt_ivr_logging=$_POST["alt_ivr_logging"];} +if (isset($_GET["question"])) {$question=$_GET["question"];} + elseif (isset($_POST["question"])) {$question=$_POST["question"];} +if (isset($_GET["alt_dtmf_log"])) {$alt_dtmf_log=$_GET["alt_dtmf_log"];} + elseif (isset($_POST["alt_dtmf_log"])) {$alt_dtmf_log=$_POST["alt_dtmf_log"];} if (isset($script_id)) {$script_id= strtoupper($script_id);} @@ -2048,7 +2054,7 @@ if (strlen($dial_status) > 0) ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,enable_queuemetrics_logging,enable_vtiger_integration,qc_features_active,outbound_autodial_active,sounds_central_control_active,enable_second_webform,user_territories_active,custom_fields_enabled,admin_web_directory,webphone_url,first_login_trigger,hosted_settings,default_phone_registration_password,default_phone_login_password,default_server_password,test_campaign_calls,active_voicemail_server,voicemail_timezones,default_voicemail_timezone,default_local_gmt,campaign_cid_areacodes_enabled,pllb_grouping_limit,did_ra_extensions_enabled,expanded_list_stats,contacts_enabled,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db,call_menu_qualify_enabled,admin_list_counts,allow_voicemail_greeting,svn_revision,allow_emails,level_8_disable_add,pass_key,pass_hash_enabled,disable_auto_dial,country_code_list_stats,frozen_server_call_clear,active_modules,allow_chats,enable_languages,language_method,meetme_enter_login_filename,meetme_enter_leave3way_filename,enable_did_entry_list_id,enable_third_webform,default_language,user_hide_realtime_enabled,log_recording_access FROM system_settings;"; +$stmt = "SELECT use_non_latin,enable_queuemetrics_logging,enable_vtiger_integration,qc_features_active,outbound_autodial_active,sounds_central_control_active,enable_second_webform,user_territories_active,custom_fields_enabled,admin_web_directory,webphone_url,first_login_trigger,hosted_settings,default_phone_registration_password,default_phone_login_password,default_server_password,test_campaign_calls,active_voicemail_server,voicemail_timezones,default_voicemail_timezone,default_local_gmt,campaign_cid_areacodes_enabled,pllb_grouping_limit,did_ra_extensions_enabled,expanded_list_stats,contacts_enabled,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db,call_menu_qualify_enabled,admin_list_counts,allow_voicemail_greeting,svn_revision,allow_emails,level_8_disable_add,pass_key,pass_hash_enabled,disable_auto_dial,country_code_list_stats,frozen_server_call_clear,active_modules,allow_chats,enable_languages,language_method,meetme_enter_login_filename,meetme_enter_leave3way_filename,enable_did_entry_list_id,enable_third_webform,default_language,user_hide_realtime_enabled,log_recording_access,alt_ivr_logging FROM system_settings;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysqli_num_rows($rslt); @@ -2108,6 +2114,7 @@ if ($qm_conf_ct > 0) $SSdefault_language = $row[50]; $SSuser_hide_realtime_enabled = $row[51]; $SSlog_recording_access = $row[52]; + $SSalt_ivr_logging = $row[53]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -2402,6 +2409,9 @@ if ($non_latin < 1) $nva_new_list_id = preg_replace('/[^0-9]/','',$nva_new_list_id); $nva_new_phone_code = preg_replace('/[^0-9]/','',$nva_new_phone_code); $manual_dial_timeout = preg_replace('/[^0-9]/','',$manual_dial_timeout); + $alt_ivr_logging = preg_replace('/[^0-9]/','',$alt_ivr_logging); + $question = preg_replace('/[^0-9]/','',$question); + $alt_dtmf_log = preg_replace('/[^0-9]/','',$alt_dtmf_log); $drop_call_seconds = preg_replace('/[^-0-9]/','',$drop_call_seconds); $timer_alt_seconds = preg_replace('/[^-0-9]/','',$timer_alt_seconds); @@ -3706,12 +3716,13 @@ else # 160116-1439 - Added options/permissions for accessing recordings and logging the access time # 160122-1401 - Added report_default_format system setting, added agent count per server on reports page # 160304-2348 - Added link to API log report +# 160305-2048 - Added alternate ivr(call menu) dtmf logging # # 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.12-539a'; -$build = '160304-2348'; +$admin_version = '2.12-540a'; +$build = '160305-2048'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -10026,7 +10037,7 @@ if ($ADD==2611) } else { - $stmt="INSERT INTO vicidial_call_menu (menu_id,menu_name,menu_prompt,menu_timeout,menu_timeout_prompt,menu_invalid_prompt,menu_repeat,menu_time_check,call_time_id,track_in_vdac,custom_dialplan_entry,tracking_group,dtmf_log,dtmf_field,user_group,qualify_sql) SELECT \"$menu_id\",\"$menu_name\",menu_prompt,menu_timeout,menu_timeout_prompt,menu_invalid_prompt,menu_repeat,menu_time_check,call_time_id,track_in_vdac,custom_dialplan_entry,tracking_group,dtmf_log,dtmf_field,user_group,qualify_sql from vicidial_call_menu where menu_id=\"$source_menu\";"; + $stmt="INSERT INTO vicidial_call_menu (menu_id,menu_name,menu_prompt,menu_timeout,menu_timeout_prompt,menu_invalid_prompt,menu_repeat,menu_time_check,call_time_id,track_in_vdac,custom_dialplan_entry,tracking_group,dtmf_log,dtmf_field,user_group,qualify_sql,alt_dtmf_log,question) SELECT \"$menu_id\",\"$menu_name\",menu_prompt,menu_timeout,menu_timeout_prompt,menu_invalid_prompt,menu_repeat,menu_time_check,call_time_id,track_in_vdac,custom_dialplan_entry,tracking_group,dtmf_log,dtmf_field,user_group,qualify_sql,alt_dtmf_log,question from vicidial_call_menu where menu_id=\"$source_menu\";"; $rslt=mysql_to_mysqli($stmt, $link); $stmtA="INSERT INTO vicidial_call_menu_options (menu_id,option_value,option_description,option_route,option_route_value,option_route_value_context) SELECT \"$menu_id\",option_value,option_description,option_route,option_route_value,option_route_value_context from vicidial_call_menu_options where menu_id='$source_menu';"; @@ -13890,7 +13901,7 @@ if ($ADD==4511) $custom_dialplanSQL=''; if ($LOGmodify_custom_dialplans > 0) {$custom_dialplanSQL = ",custom_dialplan_entry='$custom_dialplan_entry'";} - $stmt="UPDATE vicidial_call_menu set menu_name='$menu_name',menu_prompt='$menu_prompt',menu_timeout='$menu_timeout',menu_timeout_prompt='$menu_timeout_prompt',menu_invalid_prompt='$menu_invalid_prompt',menu_repeat='$menu_repeat',menu_time_check='$menu_time_check',call_time_id='$call_time_id',track_in_vdac='$track_in_vdac',tracking_group='$tracking_group',dtmf_log='$dtmf_log',dtmf_field='$dtmf_field',user_group='$user_group',qualify_sql='$qualify_sql'$custom_dialplanSQL where menu_id='$menu_id';"; + $stmt="UPDATE vicidial_call_menu set menu_name='$menu_name',menu_prompt='$menu_prompt',menu_timeout='$menu_timeout',menu_timeout_prompt='$menu_timeout_prompt',menu_invalid_prompt='$menu_invalid_prompt',menu_repeat='$menu_repeat',menu_time_check='$menu_time_check',call_time_id='$call_time_id',track_in_vdac='$track_in_vdac',tracking_group='$tracking_group',dtmf_log='$dtmf_log',dtmf_field='$dtmf_field',user_group='$user_group',qualify_sql='$qualify_sql',alt_dtmf_log='$alt_dtmf_log',question='$question'$custom_dialplanSQL where menu_id='$menu_id';"; $rslt=mysql_to_mysqli($stmt, $link); $h=0; @@ -15586,7 +15597,7 @@ if ($ADD==411111111111111) $custom_reports_slave_SQL=",custom_reports_use_slave_db='$custom_reports_slave_SQL'"; } - $stmt="UPDATE system_settings set use_non_latin='$use_non_latin',webroot_writable='$webroot_writable',enable_queuemetrics_logging='$enable_queuemetrics_logging',queuemetrics_server_ip='$queuemetrics_server_ip',queuemetrics_dbname='$queuemetrics_dbname',queuemetrics_login='$queuemetrics_login',queuemetrics_pass='$queuemetrics_pass',queuemetrics_url='$queuemetrics_url',queuemetrics_log_id='$queuemetrics_log_id',queuemetrics_eq_prepend='$queuemetrics_eq_prepend',vicidial_agent_disable='$vicidial_agent_disable',allow_sipsak_messages='$allow_sipsak_messages',admin_home_url='$admin_home_url',enable_agc_xfer_log='$enable_agc_xfer_log',timeclock_end_of_day='$timeclock_end_of_day',vdc_header_date_format='$vdc_header_date_format',vdc_customer_date_format='$vdc_customer_date_format',vdc_header_phone_format='$vdc_header_phone_format',vdc_agent_api_active='$vdc_agent_api_active',enable_vtiger_integration='$enable_vtiger_integration',vtiger_server_ip='$vtiger_server_ip',vtiger_dbname='$vtiger_dbname',vtiger_login='$vtiger_login',vtiger_pass='$vtiger_pass',vtiger_url='$vtiger_url',qc_features_active='$qc_features_active',outbound_autodial_active='$outbound_autodial_active',outbound_calls_per_second='$outbound_calls_per_second',enable_tts_integration='$enable_tts_integration',agentonly_callback_campaign_lock='$agentonly_callback_campaign_lock',sounds_central_control_active='$sounds_central_control_active',sounds_web_server='$sounds_web_server',sounds_web_directory='$sounds_web_directory',active_voicemail_server='$active_voicemail_server',auto_dial_limit='$auto_dial_limit',user_territories_active='$user_territories_active',allow_custom_dialplan='$allow_custom_dialplan',enable_second_webform='$enable_second_webform',default_webphone='$default_webphone',default_external_server_ip='$default_external_server_ip',webphone_url='" . mysqli_real_escape_string($link, $webphone_url) . "',enable_agc_dispo_log='$enable_agc_dispo_log',queuemetrics_loginout='$queuemetrics_loginout',callcard_enabled='$callcard_enabled',queuemetrics_callstatus='$queuemetrics_callstatus',default_codecs='$default_codecs',admin_web_directory='$admin_web_directory',label_title='$label_title',label_first_name='$label_first_name',label_middle_initial='$label_middle_initial',label_last_name='$label_last_name',label_address1='$label_address1',label_address2='$label_address2',label_address3='$label_address3',label_city='$label_city',label_state='$label_state',label_province='$label_province',label_postal_code='$label_postal_code',label_vendor_lead_code='$label_vendor_lead_code',label_gender='$label_gender',label_phone_number='$label_phone_number',label_phone_code='$label_phone_code',label_alt_phone='$label_alt_phone',label_security_phrase='$label_security_phrase',label_email='$label_email',label_comments='$label_comments',custom_fields_enabled='$custom_fields_enabled',slave_db_server='$slave_db_server',reports_use_slave_db='$reports_use_slave_db'$custom_reports_slave_SQL,webphone_systemkey='$webphone_systemkey',first_login_trigger='$first_login_trigger',default_phone_registration_password='$default_phone_registration_password',default_phone_login_password='$default_phone_login_password',default_server_password='$default_server_password',admin_modify_refresh='$admin_modify_refresh',nocache_admin='$nocache_admin',generate_cross_server_exten='$generate_cross_server_exten',queuemetrics_addmember_enabled='$queuemetrics_addmember_enabled',queuemetrics_dispo_pause='$queuemetrics_dispo_pause',label_hide_field_logs='$label_hide_field_logs',queuemetrics_pe_phone_append='$queuemetrics_pe_phone_append',test_campaign_calls='$test_campaign_calls',agents_calls_reset='$agents_calls_reset',default_voicemail_timezone='$default_voicemail_timezone',default_local_gmt='$default_local_gmt',noanswer_log='$noanswer_log',alt_log_server_ip='$alt_log_server_ip',alt_log_dbname='$alt_log_dbname',alt_log_login='$alt_log_login',alt_log_pass='$alt_log_pass',tables_use_alt_log_db='$tables_use_alt_log_db',did_agent_log='$did_agent_log',campaign_cid_areacodes_enabled='$campaign_cid_areacodes_enabled',pllb_grouping_limit='$pllb_grouping_limit',did_ra_extensions_enabled='$did_ra_extensions_enabled',expanded_list_stats='$expanded_list_stats',contacts_enabled='$contacts_enabled',call_menu_qualify_enabled='$call_menu_qualify_enabled',admin_list_counts='$admin_list_counts',allow_voicemail_greeting='$allow_voicemail_greeting',queuemetrics_socket='$queuemetrics_socket',queuemetrics_socket_url='$queuemetrics_socket_url',enhanced_disconnect_logging='$enhanced_disconnect_logging',allow_emails='$allow_emails',level_8_disable_add='$level_8_disable_add',queuemetrics_record_hold='$queuemetrics_record_hold',country_code_list_stats='$country_code_list_stats',queuemetrics_pause_type='$queuemetrics_pause_type',frozen_server_call_clear='$frozen_server_call_clear',callback_time_24hour='$callback_time_24hour',enable_languages='$enable_languages',language_method='$language_method',meetme_enter_login_filename='$meetme_enter_login_filename',meetme_enter_leave3way_filename='$meetme_enter_leave3way_filename',enable_did_entry_list_id='$enable_did_entry_list_id',enable_third_webform='$enable_third_webform',allow_chats='$allow_chats',chat_url='$chat_url',chat_timeout='$chat_timeout',agent_debug_logging='$agent_debug_logging',default_language='$default_language',agent_whisper_enabled='$agent_whisper_enabled',user_hide_realtime_enabled='$user_hide_realtime_enabled',usacan_phone_dialcode_fix='$usacan_phone_dialcode_fix',cache_carrier_stats_realtime='$cache_carrier_stats_realtime',log_recording_access='$log_recording_access',report_default_format='$report_default_format'$custom_dialplanSQL;"; + $stmt="UPDATE system_settings set use_non_latin='$use_non_latin',webroot_writable='$webroot_writable',enable_queuemetrics_logging='$enable_queuemetrics_logging',queuemetrics_server_ip='$queuemetrics_server_ip',queuemetrics_dbname='$queuemetrics_dbname',queuemetrics_login='$queuemetrics_login',queuemetrics_pass='$queuemetrics_pass',queuemetrics_url='$queuemetrics_url',queuemetrics_log_id='$queuemetrics_log_id',queuemetrics_eq_prepend='$queuemetrics_eq_prepend',vicidial_agent_disable='$vicidial_agent_disable',allow_sipsak_messages='$allow_sipsak_messages',admin_home_url='$admin_home_url',enable_agc_xfer_log='$enable_agc_xfer_log',timeclock_end_of_day='$timeclock_end_of_day',vdc_header_date_format='$vdc_header_date_format',vdc_customer_date_format='$vdc_customer_date_format',vdc_header_phone_format='$vdc_header_phone_format',vdc_agent_api_active='$vdc_agent_api_active',enable_vtiger_integration='$enable_vtiger_integration',vtiger_server_ip='$vtiger_server_ip',vtiger_dbname='$vtiger_dbname',vtiger_login='$vtiger_login',vtiger_pass='$vtiger_pass',vtiger_url='$vtiger_url',qc_features_active='$qc_features_active',outbound_autodial_active='$outbound_autodial_active',outbound_calls_per_second='$outbound_calls_per_second',enable_tts_integration='$enable_tts_integration',agentonly_callback_campaign_lock='$agentonly_callback_campaign_lock',sounds_central_control_active='$sounds_central_control_active',sounds_web_server='$sounds_web_server',sounds_web_directory='$sounds_web_directory',active_voicemail_server='$active_voicemail_server',auto_dial_limit='$auto_dial_limit',user_territories_active='$user_territories_active',allow_custom_dialplan='$allow_custom_dialplan',enable_second_webform='$enable_second_webform',default_webphone='$default_webphone',default_external_server_ip='$default_external_server_ip',webphone_url='" . mysqli_real_escape_string($link, $webphone_url) . "',enable_agc_dispo_log='$enable_agc_dispo_log',queuemetrics_loginout='$queuemetrics_loginout',callcard_enabled='$callcard_enabled',queuemetrics_callstatus='$queuemetrics_callstatus',default_codecs='$default_codecs',admin_web_directory='$admin_web_directory',label_title='$label_title',label_first_name='$label_first_name',label_middle_initial='$label_middle_initial',label_last_name='$label_last_name',label_address1='$label_address1',label_address2='$label_address2',label_address3='$label_address3',label_city='$label_city',label_state='$label_state',label_province='$label_province',label_postal_code='$label_postal_code',label_vendor_lead_code='$label_vendor_lead_code',label_gender='$label_gender',label_phone_number='$label_phone_number',label_phone_code='$label_phone_code',label_alt_phone='$label_alt_phone',label_security_phrase='$label_security_phrase',label_email='$label_email',label_comments='$label_comments',custom_fields_enabled='$custom_fields_enabled',slave_db_server='$slave_db_server',reports_use_slave_db='$reports_use_slave_db'$custom_reports_slave_SQL,webphone_systemkey='$webphone_systemkey',first_login_trigger='$first_login_trigger',default_phone_registration_password='$default_phone_registration_password',default_phone_login_password='$default_phone_login_password',default_server_password='$default_server_password',admin_modify_refresh='$admin_modify_refresh',nocache_admin='$nocache_admin',generate_cross_server_exten='$generate_cross_server_exten',queuemetrics_addmember_enabled='$queuemetrics_addmember_enabled',queuemetrics_dispo_pause='$queuemetrics_dispo_pause',label_hide_field_logs='$label_hide_field_logs',queuemetrics_pe_phone_append='$queuemetrics_pe_phone_append',test_campaign_calls='$test_campaign_calls',agents_calls_reset='$agents_calls_reset',default_voicemail_timezone='$default_voicemail_timezone',default_local_gmt='$default_local_gmt',noanswer_log='$noanswer_log',alt_log_server_ip='$alt_log_server_ip',alt_log_dbname='$alt_log_dbname',alt_log_login='$alt_log_login',alt_log_pass='$alt_log_pass',tables_use_alt_log_db='$tables_use_alt_log_db',did_agent_log='$did_agent_log',campaign_cid_areacodes_enabled='$campaign_cid_areacodes_enabled',pllb_grouping_limit='$pllb_grouping_limit',did_ra_extensions_enabled='$did_ra_extensions_enabled',expanded_list_stats='$expanded_list_stats',contacts_enabled='$contacts_enabled',call_menu_qualify_enabled='$call_menu_qualify_enabled',admin_list_counts='$admin_list_counts',allow_voicemail_greeting='$allow_voicemail_greeting',queuemetrics_socket='$queuemetrics_socket',queuemetrics_socket_url='$queuemetrics_socket_url',enhanced_disconnect_logging='$enhanced_disconnect_logging',allow_emails='$allow_emails',level_8_disable_add='$level_8_disable_add',queuemetrics_record_hold='$queuemetrics_record_hold',country_code_list_stats='$country_code_list_stats',queuemetrics_pause_type='$queuemetrics_pause_type',frozen_server_call_clear='$frozen_server_call_clear',callback_time_24hour='$callback_time_24hour',enable_languages='$enable_languages',language_method='$language_method',meetme_enter_login_filename='$meetme_enter_login_filename',meetme_enter_leave3way_filename='$meetme_enter_leave3way_filename',enable_did_entry_list_id='$enable_did_entry_list_id',enable_third_webform='$enable_third_webform',allow_chats='$allow_chats',chat_url='$chat_url',chat_timeout='$chat_timeout',agent_debug_logging='$agent_debug_logging',default_language='$default_language',agent_whisper_enabled='$agent_whisper_enabled',user_hide_realtime_enabled='$user_hide_realtime_enabled',usacan_phone_dialcode_fix='$usacan_phone_dialcode_fix',cache_carrier_stats_realtime='$cache_carrier_stats_realtime',log_recording_access='$log_recording_access',report_default_format='$report_default_format',alt_ivr_logging='$alt_ivr_logging'$custom_dialplanSQL;"; $rslt=mysql_to_mysqli($stmt, $link); if ( ($meetme_enter_login_filename != $SSmeetme_enter_login_filename) or ($meetme_enter_leave3way_filename != $SSmeetme_enter_leave3way_filename) ) @@ -27075,6 +27086,22 @@ if ($ADD==3911) echo "
\n"; + echo ""._QXZ("CAMPAIGNS ALLOWING THIS CHAT GROUP").":
\n"; + echo "\n"; + + $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns where closer_campaigns LIKE \"% $group_id %\" $LOGallowed_campaignsSQL;"; + $rslt=mysql_to_mysqli($stmt, $link); + $campin_to_print = mysqli_num_rows($rslt); + $o=0; + while ($campin_to_print > $o) + { + $row=mysqli_fetch_row($rslt); + echo "\n"; + $o++; + } + + echo "
$row[0] $row[1]
\n"; + if ($LOGdelete_ingroups > 0) { # echo "

EMERGENCY VDAC CLEAR FOR THIS IN-GROUP

\n"; @@ -27872,7 +27899,7 @@ if ($ADD==3511) echo "\n"; + if ($SSalt_ivr_logging > 0) + { + echo "\n"; + } + else + {echo ">";} + echo "\n"; echo "\n"; @@ -31886,7 +31931,7 @@ if ($ADD==311111111111111) $ALLagent_count = $rowx[2]; } - $stmt="SELECT version,install_date,use_non_latin,webroot_writable,enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_url,queuemetrics_log_id,queuemetrics_eq_prepend,vicidial_agent_disable,allow_sipsak_messages,admin_home_url,enable_agc_xfer_log,db_schema_version,auto_user_add_value,timeclock_end_of_day,timeclock_last_reset_date,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,vdc_agent_api_active,qc_last_pull_time,enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url,qc_features_active,outbound_autodial_active,outbound_calls_per_second,enable_tts_integration,agentonly_callback_campaign_lock,sounds_central_control_active,sounds_web_server,sounds_web_directory,active_voicemail_server,auto_dial_limit,user_territories_active,allow_custom_dialplan,db_schema_update_date,enable_second_webform,default_webphone,default_external_server_ip,webphone_url,enable_agc_dispo_log,custom_dialplan_entry,queuemetrics_loginout,callcard_enabled,queuemetrics_callstatus,default_codecs,admin_web_directory,label_title,label_first_name,label_middle_initial,label_last_name,label_address1,label_address2,label_address3,label_city,label_state,label_province,label_postal_code,label_vendor_lead_code,label_gender,label_phone_number,label_phone_code,label_alt_phone,label_security_phrase,label_email,label_comments,custom_fields_enabled,slave_db_server,reports_use_slave_db,webphone_systemkey,first_login_trigger,default_phone_registration_password,default_phone_login_password,default_server_password,admin_modify_refresh,nocache_admin,generate_cross_server_exten,queuemetrics_addmember_enabled,queuemetrics_dispo_pause,label_hide_field_logs,queuemetrics_pe_phone_append,test_campaign_calls,agents_calls_reset,default_voicemail_timezone,default_local_gmt,noanswer_log,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db,did_agent_log,campaign_cid_areacodes_enabled,pllb_grouping_limit,did_ra_extensions_enabled,expanded_list_stats,contacts_enabled,call_menu_qualify_enabled,admin_list_counts,allow_voicemail_greeting,svn_revision,queuemetrics_socket,queuemetrics_socket_url,enhanced_disconnect_logging,allow_emails,level_8_disable_add,pass_hash_enabled,pass_key,pass_cost,disable_auto_dial,queuemetrics_record_hold,country_code_list_stats,reload_timestamp,queuemetrics_pause_type,frozen_server_call_clear,callback_time_24hour,allow_chats,chat_url,chat_timeout,enable_languages,language_method,meetme_enter_login_filename,meetme_enter_leave3way_filename,enable_did_entry_list_id,enable_third_webform,agent_debug_logging,default_language,agent_whisper_enabled,user_hide_realtime_enabled,usacan_phone_dialcode_fix,cache_carrier_stats_realtime,oldest_logs_date,log_recording_access,report_default_format from system_settings;"; + $stmt="SELECT version,install_date,use_non_latin,webroot_writable,enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_url,queuemetrics_log_id,queuemetrics_eq_prepend,vicidial_agent_disable,allow_sipsak_messages,admin_home_url,enable_agc_xfer_log,db_schema_version,auto_user_add_value,timeclock_end_of_day,timeclock_last_reset_date,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,vdc_agent_api_active,qc_last_pull_time,enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url,qc_features_active,outbound_autodial_active,outbound_calls_per_second,enable_tts_integration,agentonly_callback_campaign_lock,sounds_central_control_active,sounds_web_server,sounds_web_directory,active_voicemail_server,auto_dial_limit,user_territories_active,allow_custom_dialplan,db_schema_update_date,enable_second_webform,default_webphone,default_external_server_ip,webphone_url,enable_agc_dispo_log,custom_dialplan_entry,queuemetrics_loginout,callcard_enabled,queuemetrics_callstatus,default_codecs,admin_web_directory,label_title,label_first_name,label_middle_initial,label_last_name,label_address1,label_address2,label_address3,label_city,label_state,label_province,label_postal_code,label_vendor_lead_code,label_gender,label_phone_number,label_phone_code,label_alt_phone,label_security_phrase,label_email,label_comments,custom_fields_enabled,slave_db_server,reports_use_slave_db,webphone_systemkey,first_login_trigger,default_phone_registration_password,default_phone_login_password,default_server_password,admin_modify_refresh,nocache_admin,generate_cross_server_exten,queuemetrics_addmember_enabled,queuemetrics_dispo_pause,label_hide_field_logs,queuemetrics_pe_phone_append,test_campaign_calls,agents_calls_reset,default_voicemail_timezone,default_local_gmt,noanswer_log,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db,did_agent_log,campaign_cid_areacodes_enabled,pllb_grouping_limit,did_ra_extensions_enabled,expanded_list_stats,contacts_enabled,call_menu_qualify_enabled,admin_list_counts,allow_voicemail_greeting,svn_revision,queuemetrics_socket,queuemetrics_socket_url,enhanced_disconnect_logging,allow_emails,level_8_disable_add,pass_hash_enabled,pass_key,pass_cost,disable_auto_dial,queuemetrics_record_hold,country_code_list_stats,reload_timestamp,queuemetrics_pause_type,frozen_server_call_clear,callback_time_24hour,allow_chats,chat_url,chat_timeout,enable_languages,language_method,meetme_enter_login_filename,meetme_enter_leave3way_filename,enable_did_entry_list_id,enable_third_webform,agent_debug_logging,default_language,agent_whisper_enabled,user_hide_realtime_enabled,usacan_phone_dialcode_fix,cache_carrier_stats_realtime,oldest_logs_date,log_recording_access,report_default_format,alt_ivr_logging from system_settings;"; $rslt=mysql_to_mysqli($stmt, $link); $row=mysqli_fetch_row($rslt); $version = $row[0]; @@ -32031,6 +32076,7 @@ if ($ADD==311111111111111) $oldest_logs_date = $row[139]; $log_recording_access = $row[140]; $report_default_format = $row[141]; + $alt_ivr_logging = $row[142]; if ($pass_hash_enabled > 0) {$pass_hash_enabled = 'ENABLED';} else {$pass_hash_enabled = 'DISABLED';} @@ -32289,6 +32335,8 @@ if ($ADD==311111111111111) echo "\n"; + echo "\n"; + echo "\n"; echo "\n"; diff --git a/www/vicidial/help.php b/www/vicidial/help.php index 3240a45f..4c0c96e2 100644 --- a/www/vicidial/help.php +++ b/www/vicidial/help.php @@ -81,6 +81,7 @@ # 160116-1512 - Added access_recording and log_recording_access entries # 160121-2155 - Added settings-report_default_format entry and help text for several reports # 160211-2255 - Added help text for remaining reports +# 160305-2115 - Added Alt IVR(call menu) DTMF logging # @@ -3072,6 +3073,16 @@ if ($SSqc_features_active > 0)
- +
+ +
+ - + +
+
+
+ - +

@@ -5018,6 +5029,11 @@ FR_SPAC 00 00 00 00 00 - - +
+
+
+ - +

\n"; echo ""; - $stmt="SELECT menu_name,menu_prompt,menu_timeout,menu_timeout_prompt,menu_invalid_prompt,menu_repeat,menu_time_check,call_time_id,track_in_vdac,custom_dialplan_entry,tracking_group,dtmf_log,dtmf_field,user_group,qualify_sql from vicidial_call_menu where menu_id='$menu_id' $LOGadmin_viewable_groupsSQL;"; + $stmt="SELECT menu_name,menu_prompt,menu_timeout,menu_timeout_prompt,menu_invalid_prompt,menu_repeat,menu_time_check,call_time_id,track_in_vdac,custom_dialplan_entry,tracking_group,dtmf_log,dtmf_field,user_group,qualify_sql,alt_dtmf_log,question from vicidial_call_menu where menu_id='$menu_id' $LOGadmin_viewable_groupsSQL;"; $rslt=mysql_to_mysqli($stmt, $link); $row=mysqli_fetch_row($rslt); $menu_name = $row[0]; @@ -27890,7 +27917,8 @@ if ($ADD==3511) $dtmf_field = $row[12]; $user_group = $row[13]; $qualify_sql = $row[14]; - + $alt_dtmf_log = $row[15]; + $question = $row[16]; echo "
"._QXZ("MODIFY A CALL MENU RECORD").": $menu_id
\n"; echo "\n"; @@ -27974,6 +28002,23 @@ if ($ADD==3511) echo "$NWB#call_menu-dtmf_log$NWE     "._QXZ("Log Field").": \n"; echo "$NWB#call_menu-dtmf_field$NWE
"._QXZ("Alt DTMF Log").": $NWB#call_menu-alt_dtmf_log$NWE     "._QXZ("Question").": \n"; + echo "$NWB#call_menu-question$NWE
"._QXZ("Call Menu Options").":
"._QXZ("Call Menu Qualify Enabled").": $NWB#settings-call_menu_qualify_enabled$NWE
"._QXZ("Call Menu Alt DTMF Logging").": $NWB#settings-alt_ivr_logging$NWE
"._QXZ("Level 8 Disable Add").": $NWB#settings-level_8_disable_add$NWE
"._QXZ("Admin List Counts").": $NWB#settings-admin_list_counts$NWE