diff --git a/agi/agi-VDAD_ALL_inbound.agi b/agi/agi-VDAD_ALL_inbound.agi index cd366629..4d52424d 100644 --- a/agi/agi-VDAD_ALL_inbound.agi +++ b/agi/agi-VDAD_ALL_inbound.agi @@ -411,7 +411,8 @@ if ($channel =~ /Local/i) if ($AGILOG) {$agi_string = "+++++ VDAD START LOCAL CHANNEL: CXFER OVERRIDE- $priority"; &agi_output;} if ($call_handle_method =~ /^CLOSER/) { - sleep(1); + ### sleep for 99 hundredths of a second + usleep(1*990*1000); $stmtA = "SELECT count(*) FROM vicidial_auto_calls where lead_id='$CIDlead_id' and call_type='IN' and campaign_id='$channel_group' and channel NOT LIKE \"Local%\";"; if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; @@ -781,8 +782,8 @@ if ( ($hm < $ct_default_start) || ($hm > $ct_default_stop) ) { $AGI->stream_file('sip-silence'); # stop music-on-hold process $AGI->stream_file('sip-silence'); - - sleep(1); + ### sleep for 99 hundredths of a second + usleep(1*990*1000); } if ($AGILOG) {$agi_string = "exiting the VDAD app after hours, transferring call to $DROPexten"; &agi_output;} @@ -825,7 +826,8 @@ if ( ($hm < $ct_default_start) || ($hm > $ct_default_stop) ) else {$AGI->stream_file("$after_hours_message_filename");} } - sleep(1); + ### sleep for 99 hundredths of a second + usleep(1*990*1000); ### insert a NEW record to the vicidial_manager table to hangup the channel $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$VARserver_ip','','Hangup','$VHqueryCID','Channel: $channel','','','','','','','','','')"; @@ -962,8 +964,8 @@ if ($no_agent_no_queue =~ /Y|NO_PAUSED/) { $AGI->stream_file('sip-silence'); # stop music-on-hold process $AGI->stream_file('sip-silence'); - - sleep(1); + ### sleep for 99 hundredths of a second + usleep(1*990*1000); } if ($AGILOG) {$agi_string = "exiting the VDAD app no agent no queue, transferring call to $DROPexten"; &agi_output;} @@ -998,7 +1000,8 @@ if ($no_agent_no_queue =~ /Y|NO_PAUSED/) else {$AGI->stream_file("$no_agent_action_value");} } - sleep(1); + ### sleep for 99 hundredths of a second + usleep(1*990*1000); ### insert a NEW record to the vicidial_manager table to hangup the channel $stmtA = "INSERT INTO vicidial_manager values('','','$SQLdate','NEW','N','$VARserver_ip','','Hangup','$VHqueryCID','Channel: $channel','','','','','','','','','')"; @@ -2111,7 +2114,8 @@ if ($hold_recall_xfer_group !~ /NONE/) { $AGI->stream_file('sip-silence'); # stop music-on-hold process $AGI->stream_file('sip-silence'); - sleep(1); + ### sleep for 99 hundredths of a second + usleep(1*990*1000); } $stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' and server_ip='$VARserver_ip' order by call_time desc limit 1;"; @@ -2592,7 +2596,8 @@ if ($wait_in_queue < 1) { $AGI->stream_file('sip-silence'); # stop music-on-hold process $AGI->stream_file('sip-silence'); - sleep(1); + ### sleep for 99 hundredths of a second + usleep(1*990*1000); } $stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' and server_ip='$VARserver_ip' order by call_time desc limit 1;"; @@ -2858,7 +2863,8 @@ if ($AGILOG) {$agi_string = "-- VDCL DROP: |$drop_action|$DROPexten|"; &agi { $AGI->stream_file('sip-silence'); # stop music-on-hold process $AGI->stream_file('sip-silence'); - sleep(1); + ### sleep for 99 hundredths of a second + usleep(1*990*1000); } $AGI->stream_file('sip-silence'); diff --git a/bin/AST_VDadapt.pl b/bin/AST_VDadapt.pl index c6b0386b..754a4cd9 100644 --- a/bin/AST_VDadapt.pl +++ b/bin/AST_VDadapt.pl @@ -32,6 +32,7 @@ # 90512-1549 - Formatting fixes and calculation bugs in blended # 90628-2001 - Added drop rate group functions # 91115-0929 - Added auto-kill of script at timeclock reset time of day to facilitate cleaner clearing of daily stats +# 91206-2203 - Added campaign_calldate within last 5 minute as an override to recalculate stats # # constants @@ -245,6 +246,7 @@ foreach(@conf) if (!$VARDB_port) {$VARDB_port='3306';} +use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second use DBI; $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") @@ -356,11 +358,11 @@ while ($master_loop<$CLIloops) if ($CLIcampaign) { - $stmtA = "SELECT campaign_id,lead_order,hopper_level,auto_dial_level,local_call_time,lead_filter_id,use_internal_dnc,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,UNIX_TIMESTAMP(campaign_changedate),campaign_stats_refresh,campaign_allow_inbound,drop_rate_group from vicidial_campaigns where campaign_id='$CLIcampaign'"; + $stmtA = "SELECT campaign_id,lead_order,hopper_level,auto_dial_level,local_call_time,lead_filter_id,use_internal_dnc,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,UNIX_TIMESTAMP(campaign_changedate),campaign_stats_refresh,campaign_allow_inbound,drop_rate_group,UNIX_TIMESTAMP(campaign_calldate) from vicidial_campaigns where campaign_id='$CLIcampaign'"; } else { - $stmtA = "SELECT campaign_id,lead_order,hopper_level,auto_dial_level,local_call_time,lead_filter_id,use_internal_dnc,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,UNIX_TIMESTAMP(campaign_changedate),campaign_stats_refresh,campaign_allow_inbound,drop_rate_group from vicidial_campaigns where ( (active='Y') or (campaign_stats_refresh='Y') )"; + $stmtA = "SELECT campaign_id,lead_order,hopper_level,auto_dial_level,local_call_time,lead_filter_id,use_internal_dnc,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,UNIX_TIMESTAMP(campaign_changedate),campaign_stats_refresh,campaign_allow_inbound,drop_rate_group,UNIX_TIMESTAMP(campaign_calldate) from vicidial_campaigns where ( (active='Y') or (campaign_stats_refresh='Y') )"; } $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; @@ -390,12 +392,15 @@ while ($master_loop<$CLIloops) $campaign_stats_refresh[$rec_count] = $aryA[15]; $campaign_allow_inbound[$rec_count] = $aryA[16]; $drop_rate_group[$rec_count] = $aryA[17]; + $campaign_calldate_epoch[$rec_count] = $aryA[18]; $rec_count++; } $sthA->finish(); if ($DB) {print "$now_date CAMPAIGNS TO PROCESSES ADAPT FOR: $rec_count|$#campaign_id IT: $master_loop\n";} + $five_min_ago = time(); + $five_min_ago = ($five_min_ago - 300); ##### LOOP THROUGH EACH CAMPAIGN AND PROCESS THE HOPPER ##### $i=0; @@ -419,6 +424,8 @@ while ($master_loop<$CLIloops) if ($DBX) {print "$i $event_string\n";} &event_logger; + if ($DBX) {print " TIME CALL CHECK: $five_min_ago/$campaign_calldate_epoch[$i]\n";} + ##### IF THERE ARE NO LEADS IN THE HOPPER FOR THE CAMPAIGN WE DO NOT WANT TO ADJUST THE DIAL_LEVEL if ($hopper_ready_count>0) { @@ -444,7 +451,7 @@ while ($master_loop<$CLIloops) } else { - if ($campaign_stats_refresh[$i] =~ /Y/) + if ( ($campaign_stats_refresh[$i] =~ /Y/) || ($five_min_ago < $campaign_calldate_epoch[$i]) ) { if ($drop_count_updater>=60) { @@ -476,7 +483,7 @@ while ($master_loop<$CLIloops) } else { - if ($campaign_stats_refresh[$i] =~ /Y/) + if ( ($campaign_stats_refresh[$i] =~ /Y/) || ($five_min_ago < $campaign_calldate_epoch[$i]) ) { if ($drop_count_updater>=60) { @@ -523,8 +530,7 @@ while ($master_loop<$CLIloops) $diff_ratio_updater = ($diff_ratio_updater + $CLIdelay); $drop_count_updater = ($drop_count_updater + $CLIdelay); - - sleep($CLIdelay); + usleep($CLIdelay*1000*1000); $stat_count++; $master_loop++; @@ -655,7 +661,7 @@ sub get_time_now if ($DB) {print "\n$event_string\n\n\n";} &event_logger; - sleep(10); + usleep(10*1000*1000); exit; } diff --git a/bin/AST_flush_DBqueue.pl b/bin/AST_flush_DBqueue.pl index 24377632..61510b53 100644 --- a/bin/AST_flush_DBqueue.pl +++ b/bin/AST_flush_DBqueue.pl @@ -15,6 +15,7 @@ # 60717-1536 - changed to use /etc/astguiclient.conf for configs # 60910-0238 - removed park_log query # 90628-2358 - Added vicidial_drop_rate_groups optimization +# 91206-2149 - Added vicidial_campaigns and vicidial_lists optimization # $secX = time(); @@ -53,40 +54,40 @@ $SQLdate_NEG_halfhour="$year-$mon-$mday $hour:$min:$sec"; ### begin parsing run-time options ### if (length($ARGV[0])>1) -{ + { $i=0; while ($#ARGV >= $i) - { - $args = "$args $ARGV[$i]"; - $i++; - } + { + $args = "$args $ARGV[$i]"; + $i++; + } if ($args =~ /--help/i) - { - print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [--debug] = debugging messages\n\n"; - } + { + print "allowed run time options:\n [-q] = quiet\n [-t] = test\n [--debug] = debugging messages\n\n"; + } else - { + { if ($args =~ /-q/i) - { - $q=1; $Q=1; - } + { + $q=1; $Q=1; + } if ($args =~ /--debug/i) - { - $DB=1; - print "\n-----DEBUGGING -----\n\n"; - } + { + $DB=1; + print "\n-----DEBUGGING -----\n\n"; + } if ($args =~ /-t|--test/i) - { - $T=1; $TEST=1; - print "\n-----TESTING -----\n\n"; + { + $T=1; $TEST=1; + print "\n-----TESTING -----\n\n"; + } } } -} else -{ -print "no command line options set\n"; -} + { + print "no command line options set\n"; + } ### end parsing run-time options ### @@ -143,106 +144,134 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA or die "Couldn't connect to database: " . DBI->errstr; ### Grab Server values from the database - $stmtA = "SELECT vd_server_logs FROM servers where server_ip = '$VARserver_ip';"; - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - $rec_count=0; - while ($sthArows > $rec_count) - { - @aryA = $sthA->fetchrow_array; - $DBvd_server_logs = "$aryA[0]"; - if ($DBvd_server_logs =~ /Y/) {$SYSLOG = '1';} - else {$SYSLOG = '0';} - $rec_count++; - } - $sthA->finish(); +$stmtA = "SELECT vd_server_logs FROM servers where server_ip = '$VARserver_ip';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $DBvd_server_logs = "$aryA[0]"; + if ($DBvd_server_logs =~ /Y/) {$SYSLOG = '1';} + else {$SYSLOG = '0';} + $rec_count++; + } +$sthA->finish(); if ($SYSLOG) {$flush_time = $SQLdate_NEG_1hour;} else {$flush_time = $SQLdate_NEG_halfhour;} - $stmtA = "delete from vicidial_manager where server_ip='$server_ip' and entry_date < '$flush_time';"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) { $affected_rows = $dbhA->do($stmtA);} - if (!$Q) {print " - vicidial_manager flush\n";} - - $stmtA = "optimize table vicidial_manager;"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) - { - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - @aryA = $sthA->fetchrow_array; - if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} - $sthA->finish(); - } - if (!$Q) {print " - optimize vicidial_manager \n";} +$stmtA = "delete from vicidial_manager where server_ip='$server_ip' and entry_date < '$flush_time';"; +if($DB){print STDERR "\n|$stmtA|\n";} +if (!$T) { $affected_rows = $dbhA->do($stmtA);} +if (!$Q) {print " - vicidial_manager flush\n";} - $stmtA = "optimize table vicidial_live_agents;"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) { - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - @aryA = $sthA->fetchrow_array; - if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} - $sthA->finish(); - } - if (!$Q) {print " - optimize vicidial_live_agents \n";} +$stmtA = "optimize table vicidial_manager;"; +if($DB){print STDERR "\n|$stmtA|\n";} +if (!$T) + { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } +if (!$Q) {print " - optimize vicidial_manager \n";} - $stmtA = "optimize table vicidial_auto_calls;"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) { - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - @aryA = $sthA->fetchrow_array; - if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} - $rec_countY++; - $sthA->finish(); - } - if (!$Q) {print " - optimize vicidial_auto_calls \n";} +$stmtA = "optimize table vicidial_live_agents;"; +if($DB){print STDERR "\n|$stmtA|\n";} +if (!$T) + { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } +if (!$Q) {print " - optimize vicidial_live_agents \n";} - $stmtA = "optimize table vicidial_hopper;"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) { - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - @aryA = $sthA->fetchrow_array; - if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} - $sthA->finish(); - } - if (!$Q) {print " - optimize vicidial_hopper \n";} +$stmtA = "optimize table vicidial_auto_calls;"; +if($DB){print STDERR "\n|$stmtA|\n";} +if (!$T) + { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $rec_countY++; + $sthA->finish(); + } +if (!$Q) {print " - optimize vicidial_auto_calls \n";} - $stmtA = "optimize table vicidial_drop_rate_groups;"; - if($DB){print STDERR "\n|$stmtA|\n";} - if (!$T) { - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - @aryA = $sthA->fetchrow_array; - if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} - $sthA->finish(); - } - if (!$Q) {print " - optimize vicidial_drop_rate_groups \n";} +$stmtA = "optimize table vicidial_hopper;"; +if($DB){print STDERR "\n|$stmtA|\n";} +if (!$T) + { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } +if (!$Q) {print " - optimize vicidial_hopper \n";} + + +$stmtA = "optimize table vicidial_drop_rate_groups;"; +if($DB){print STDERR "\n|$stmtA|\n";} +if (!$T) + { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } +if (!$Q) {print " - optimize vicidial_drop_rate_groups \n";} + + +$stmtA = "optimize table vicidial_campaigns;"; +if($DB){print STDERR "\n|$stmtA|\n";} +if (!$T) + { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } +if (!$Q) {print " - optimize vicidial_campaigns \n";} + + +$stmtA = "optimize table vicidial_lists;"; +if($DB){print STDERR "\n|$stmtA|\n";} +if (!$T) + { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } +if (!$Q) {print " - optimize vicidial_lists \n";} - $dbhA->disconnect(); +$dbhA->disconnect(); exit; - - - - - diff --git a/extras/MySQL_AST_CREATE_tables.sql b/extras/MySQL_AST_CREATE_tables.sql index 214c310d..72479bc1 100644 --- a/extras/MySQL_AST_CREATE_tables.sql +++ b/extras/MySQL_AST_CREATE_tables.sql @@ -686,7 +686,8 @@ agent_dial_owner_only ENUM('NONE','USER','TERRITORY','USER_GROUP') default 'NONE agent_display_dialable_leads ENUM('Y','N') default 'N', web_form_address_two TEXT, waitforsilence_options VARCHAR(25) default '', -agent_select_territories ENUM('Y','N') default 'N' +agent_select_territories ENUM('Y','N') default 'N', +campaign_calldate DATETIME ); CREATE TABLE vicidial_lists ( @@ -1980,7 +1981,7 @@ CREATE INDEX phone_number on vicidial_closer_log (phone_number); CREATE INDEX date_user on vicidial_closer_log (call_date,user); CREATE INDEX comment_a on live_inbound_log (comment_a); -UPDATE system_settings SET db_schema_version='1185',db_schema_update_date=NOW(); +UPDATE system_settings SET db_schema_version='1186',db_schema_update_date=NOW(); GRANT RELOAD ON *.* TO cron@'%'; GRANT RELOAD ON *.* TO cron@localhost; diff --git a/extras/upgrade_2.2.0.sql b/extras/upgrade_2.2.0.sql index ee4f1942..7c122c6e 100644 --- a/extras/upgrade_2.2.0.sql +++ b/extras/upgrade_2.2.0.sql @@ -651,3 +651,7 @@ ALTER TABLE phones ADD delete_vm_after_email ENUM('N','Y') default 'N'; ALTER TABLE vicidial_voicemail ADD delete_vm_after_email ENUM('N','Y') default 'N'; UPDATE system_settings SET db_schema_version='1185',db_schema_update_date=NOW(); + +ALTER TABLE vicidial_campaigns ADD campaign_calldate DATETIME; + +UPDATE system_settings SET db_schema_version='1186',db_schema_update_date=NOW(); diff --git a/translations/raw_translation_files/TO_BE_TRANSLATED_2.2.0.txt b/translations/raw_translation_files/TO_BE_TRANSLATED_2.2.0.txt index 5bb54501..a977c36f 100644 --- a/translations/raw_translation_files/TO_BE_TRANSLATED_2.2.0.txt +++ b/translations/raw_translation_files/TO_BE_TRANSLATED_2.2.0.txt @@ -348,6 +348,8 @@ CAMPAIGNS ALLOWING THIS IN-GROUP|| This is the secret, or password, for the server in the iax auto-generated conf file for this server on other servers. Limit is 20 characters alphanumeric dash and underscore accepted. Default is test|| Delete Voicemail After Email|| This optional setting allows you to have the voicemail messages deleted from the system after they have been emailed out. Default is N|| +Last Campaign Call Date|| +This is the last time that a call was handled by an agent logged into this campaign|| add-file: user_territories.php diff --git a/www/agc/vdc_db_query.php b/www/agc/vdc_db_query.php index 2c83b601..a206da63 100644 --- a/www/agc/vdc_db_query.php +++ b/www/agc/vdc_db_query.php @@ -228,7 +228,7 @@ $version = '2.2.0-132'; $build = '91204-1937'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=271; +$mysql_log_count=272; $one_mysql_log=0; require("dbconnect.php"); @@ -425,14 +425,12 @@ $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); -$i=0; -while ($i < $qm_conf_ct) +if ($qm_conf_ct > 0) { $row=mysql_fetch_row($rslt); $non_latin = $row[0]; $timeclock_end_of_day = $row[1]; $agentonly_callback_campaign_lock = $row[2]; - $i++; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -4482,6 +4480,11 @@ if ($ACTION == 'updateDISPO') $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00151',$user,$server_ip,$session_name,$one_mysql_log);} + $stmt="UPDATE vicidial_campaigns set campaign_calldate='$NOW_TIME' where campaign_id='$campaign';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00272',$user,$server_ip,$session_name,$one_mysql_log);} + $user_group=''; $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; $rslt=mysql_query($stmt, $link); @@ -5023,8 +5026,7 @@ if ($ACTION == 'updateDISPO') if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00159',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); - $i=0; - while ($i < $qm_conf_ct) + if ($qm_conf_ct > 0) { $row=mysql_fetch_row($rslt); $enable_queuemetrics_logging = $row[0]; @@ -5033,7 +5035,6 @@ if ($ACTION == 'updateDISPO') $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; - $i++; } ##### END QUEUEMETRICS LOGGING LOOKUP ##### ########################################### diff --git a/www/agc/vicidial.php b/www/agc/vicidial.php index 7403daed..7299632a 100644 --- a/www/agc/vicidial.php +++ b/www/agc/vicidial.php @@ -269,7 +269,7 @@ $version = '2.2.0-242'; $build = '91206-2020'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=63; +$mysql_log_count=64; $one_mysql_log=0; require("dbconnect.php"); @@ -347,11 +347,10 @@ $random = (rand(1000000, 9999999) + 10000000); ##### START SYSTEM_SETTINGS LOOKUP ##### $stmt = "SELECT use_non_latin,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,webroot_writable,timeclock_end_of_day,vtiger_url,enable_vtiger_integration,outbound_autodial_active,enable_second_webform,user_territories_active FROM system_settings;"; $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01001',$VD_login,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01001',$VD_login,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); -$i=0; -while ($i < $qm_conf_ct) +if ($qm_conf_ct > 0) { $row=mysql_fetch_row($rslt); $non_latin = $row[0]; @@ -365,8 +364,6 @@ while ($i < $qm_conf_ct) $outbound_autodial_active = $row[8]; $enable_second_webform = $row[9]; $user_territories_active = $row[10]; - - $i++; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -474,104 +471,104 @@ echo "
\n"; echo "\n"; if ($campaign_login_list > 0) -{ -$camp_form_code = "\n"; -} else -{ -$camp_form_code = "\n"; -} + { + $camp_form_code = "\n"; + } if ($LogiNAJAX > 0) @@ -2066,6 +2063,14 @@ else $agent_log_id = mysql_insert_id($link); echo "\n"; + ##### update vicidial_campaigns to show agent has logged in + $stmt="UPDATE vicidial_campaigns set campaign_logindate='$NOW_TIME' where campaign_id='$VD_campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01064',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VCaffected_rows = mysql_affected_rows($link); + echo "\n"; + if ($enable_queuemetrics_logging > 0) { $StarTtimEpause = ($StarTtimE + 1); diff --git a/www/vicidial/admin.php b/www/vicidial/admin.php index e9efae9f..987d13f0 100644 --- a/www/vicidial/admin.php +++ b/www/vicidial/admin.php @@ -3305,6 +3305,11 @@ if ($ADD==99999)