diff --git a/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi b/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi index bc12a35d..ac9108a1 100644 --- a/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi +++ b/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi @@ -210,6 +210,7 @@ # 170309-1514 - Added populate_state_areacode option # 170325-1104 - Added optional vicidial_drop_log logging # 170412-2223 - Fix for drop call logging +# 170527-2240 - Fix for rare inbound logging issue #1017 # $script = 'agi-VDAD_ALL_inbound.agi'; @@ -3314,12 +3315,12 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override } } - $stmtA = "UPDATE vicidial_xfer_log set closer='$VDADuser' where lead_id = '$insert_lead_id' order by call_date desc limit 1;"; + $stmtA = "UPDATE vicidial_xfer_log set closer='$VDADuser' where lead_id = '$insert_lead_id' order by xfercallid desc limit 1;"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02066'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; if ($AGILOG) {$agi_string = "-- VDXL vicidial_xfer_log update: |$affected_rows|$insert_lead_id|$VDADuser\n|$stmtA|"; &agi_output;} - $stmtA = "UPDATE vicidial_closer_log set user='$VDADuser' where lead_id='$insert_lead_id' order by call_date desc limit 1;"; + $stmtA = "UPDATE vicidial_closer_log set user='$VDADuser' where lead_id='$insert_lead_id' order by closecallid desc limit 1;"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02067'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; if ($AGILOG) {$agi_string = "-- closer log : |$affected_rows|update of vcl table: $insert_lead_id\n|$stmtA|"; &agi_output;} @@ -3742,7 +3743,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override } } - $stmtA = "UPDATE vicidial_closer_log set queue_seconds='$drop_timer' where lead_id = '$insert_lead_id' and call_date='$SQLdate';"; + $stmtA = "UPDATE vicidial_closer_log set queue_seconds='$drop_timer' where lead_id = '$insert_lead_id' and call_date='$SQLdate' order by closecallid desc limit 1;"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02072'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$insert_lead_id|\n|$stmtA|"; &agi_output;} @@ -3849,7 +3850,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override if ($drop_seconds < 1) {$drop_seconds = $drop_timer;} - $stmtA = "UPDATE vicidial_closer_log set status='HXFER',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds',queue_seconds='$drop_seconds',term_reason='HOLDRECALLXFER' where lead_id = '$insert_lead_id' order by start_epoch desc limit 1;"; + $stmtA = "UPDATE vicidial_closer_log set status='HXFER',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds',queue_seconds='$drop_seconds',term_reason='HOLDRECALLXFER' where lead_id = '$insert_lead_id' order by closecallid desc limit 1;"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02076'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$insert_lead_id|\n|$stmtA|"; &agi_output;} @@ -4108,7 +4109,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override $dbhP=$dbhA; $mysql_count='02083'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; if ($AGILOG) {$agi_string = "-- VDAC posttime record: |$affected_rows|$FDtsSQLdate|$callerid|"; &agi_output;} - $stmtA = "SELECT queue_seconds FROM vicidial_closer_log where campaign_id = '$channel_group' and status NOT IN('NANQUE','QUEUE') order by call_date desc limit 5;"; + $stmtA = "SELECT queue_seconds FROM vicidial_closer_log where campaign_id = '$channel_group' and status NOT IN('NANQUE','QUEUE') order by closecallid desc limit 5;"; if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; @@ -4312,7 +4313,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override if ($drop_seconds < 1) {$drop_seconds = $drop_timer;} - $stmtA = "UPDATE vicidial_closer_log set status='$NQstatus',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds',queue_seconds='$drop_seconds',term_reason='$NQterm',comments='$NQcomments' where lead_id = '$insert_lead_id' order by start_epoch desc limit 1;"; + $stmtA = "UPDATE vicidial_closer_log set status='$NQstatus',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds',queue_seconds='$drop_seconds',term_reason='$NQterm',comments='$NQcomments' where lead_id = '$insert_lead_id' order by closecallid desc limit 1;"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02105'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; if ($AGILOG) {$agi_string = "-- ACF VDCL vcl update: |$affected_rows|$insert_lead_id|$insert_close_id|$MCareacode_override|\n|$stmtA|"; &agi_output;} @@ -4883,7 +4884,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override if ($drop_seconds < 1) {$drop_seconds = $drop_timer;} if (length($HT_status)<1) {$HT_status='WAITTO';} - $stmtA = "UPDATE vicidial_closer_log set status='$HT_status',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds',queue_seconds='$drop_seconds',term_reason='HOLDTIME' where lead_id = '$insert_lead_id' order by start_epoch desc limit 1;"; + $stmtA = "UPDATE vicidial_closer_log set status='$HT_status',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds',queue_seconds='$drop_seconds',term_reason='HOLDTIME' where lead_id = '$insert_lead_id' order by closecallid desc limit 1;"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02091'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$insert_lead_id|\n|$stmtA|"; &agi_output;} @@ -5339,7 +5340,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override if ($drop_seconds < 1) {$drop_seconds = $drop_timer;} if (length($HT_status)<1) {$HT_status='HOLDTO';} - $stmtA = "UPDATE vicidial_closer_log set status='$HT_status',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds',queue_seconds='$drop_seconds',term_reason='HOLDTIME' where lead_id = '$insert_lead_id' order by start_epoch desc limit 1;"; + $stmtA = "UPDATE vicidial_closer_log set status='$HT_status',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds',queue_seconds='$drop_seconds',term_reason='HOLDTIME' where lead_id = '$insert_lead_id' order by closecallid desc limit 1;"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02091'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$insert_lead_id|\n|$stmtA|"; &agi_output;} @@ -5705,7 +5706,7 @@ if ( ($drop_timer > $DROP_TIME) || ($MCdrop_override > 0) ) $dbhP=$dbhA; $mysql_count='02099'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; if ($AGILOG) {$agi_string = "-- VDCL vac record deleted: |$affected_rows| $channel_group|"; &agi_output;} - $stmtA = "UPDATE vicidial_closer_log set status='$DRstatus',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds',queue_seconds='$drop_seconds',term_reason='$DRterm' where lead_id='$insert_lead_id' order by start_epoch desc limit 1;"; + $stmtA = "UPDATE vicidial_closer_log set status='$DRstatus',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds',queue_seconds='$drop_seconds',term_reason='$DRterm' where lead_id='$insert_lead_id' order by closecallid desc limit 1;"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02100'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$insert_lead_id|\n|$stmtA|"; &agi_output;} diff --git a/agc_2-X/trunk/agi/cm_status_dial.agi b/agc_2-X/trunk/agi/cm_status_dial.agi index f93e5f41..08e6021f 100644 --- a/agc_2-X/trunk/agi/cm_status_dial.agi +++ b/agc_2-X/trunk/agi/cm_status_dial.agi @@ -1,11 +1,12 @@ #!/usr/bin/perl # -# cm_status_dial.agi version 2.6 +# cm_status_dial.agi version 2.14 # # Used as a Call Menu AGI option route to alter status of a lead before dialing. # The lead is only updated if the call is tagged with a lead_id before this script. # -# You need to put lines similar to those below in your extensions.conf file: +# You need to put lines similar to those below in your extensions.conf file or +# a Custom Dialplan entry: # ; Below are the parameters needed for the script to be run properly # ; 1. the status to change the lead to # ; 2. the phone number or extension to dial @@ -14,12 +15,13 @@ # ;inbound calls check calltime: #cm_status_dial.agi,XFER-----917275551212-----default # -# Copyright (C) 2013 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2017 Matt Florell LICENSE: AGPLv2 # # changes: # 120909-2301 - First Build # 120924-0637 - Added log updating # 130108-1820 - Changes for Asterisk 1.8 compatibility +# 170527-2243 - Fix for rare inbound logging issue #1017 # $script = 'cm_status_dial.agi'; @@ -264,7 +266,7 @@ else $affected_rowsL = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VL update: |$affected_rowsL|$new_status|$dtmf|$lead_id|$context|"; &agi_output;} - $stmtA = "UPDATE vicidial_closer_log SET status='$new_status' where lead_id='$lead_id' order by call_date desc limit 1;"; + $stmtA = "UPDATE vicidial_closer_log SET status='$new_status' where lead_id='$lead_id' order by closecallid desc limit 1;"; if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} $affected_rowsL = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VCLOG update: |$affected_rowsL|$new_status|$dtmf|$lead_id|$context|"; &agi_output;} diff --git a/agc_2-X/trunk/bin/AST_VDauto_dial.pl b/agc_2-X/trunk/bin/AST_VDauto_dial.pl index 44468d74..c4c9a029 100644 --- a/agc_2-X/trunk/bin/AST_VDauto_dial.pl +++ b/agc_2-X/trunk/bin/AST_VDauto_dial.pl @@ -123,6 +123,7 @@ # 161102-1031 - Fixed QM partition problem # 170313-1041 - Added CHAT option to inbound_queue_no_dial # 170325-1106 - Added optional vicidial_drop_log logging +# 170527-2347 - Fix for rare inbound logging issue #1017 # ### begin parsing run-time options ### @@ -2939,7 +2940,7 @@ while($one_day_interval > 0) { if ($NCUcallerid[$vle_count] =~ /^Y/) { - $stmtA = "SELECT campaign_id,status,user,phone_number,'MAIN',list_id FROM vicidial_closer_log where uniqueid='$NCUuniqueid[$vle_count]' and lead_id='$NCUleadid[$vle_count]' and call_date='$NCUcalldate[$vle_count]';"; + $stmtA = "SELECT campaign_id,status,user,phone_number,'MAIN',list_id FROM vicidial_closer_log where uniqueid='$NCUuniqueid[$vle_count]' and lead_id='$NCUleadid[$vle_count]' and call_date='$NCUcalldate[$vle_count]' order by closecallid desc;"; $NCUcalltype[$vle_count] = 'IN'; } else diff --git a/agc_2-X/trunk/bin/AST_VDremote_agents.pl b/agc_2-X/trunk/bin/AST_VDremote_agents.pl index ada32705..0efd5467 100644 --- a/agc_2-X/trunk/bin/AST_VDremote_agents.pl +++ b/agc_2-X/trunk/bin/AST_VDremote_agents.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# AST_VDremote_agents.pl version 2.10 +# AST_VDremote_agents.pl version 2.14 # # SUMMARY: # To use VICIDIAL with remote agents, this must always be running @@ -11,7 +11,7 @@ # agents that should appear to be logged in so that the calls can be transferred # out to them properly. # -# Copyright (C) 2016 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2017 Matt Florell LICENSE: AGPLv2 # # CHANGELOG: # 50215-0954 - First version of script @@ -51,6 +51,7 @@ # 140428-1449 - Added pause_type # 141113-1559 - Added concurrency check # 161102-1032 - Fixed QM partition problem +# 170527-2348 - Fix for rare inbound logging issue #1017 # ### begin parsing run-time options ### @@ -356,7 +357,7 @@ while($one_day_interval > 0) if ($QHcall_type[$w] =~ /IN/) { - $stmtC = "UPDATE vicidial_closer_log set status='XFER',user='$QHuser[$w]',comments='REMOTE' where lead_id='$QHlead_id[$w]' and uniqueid='$QHuniqueid[$w]' and campaign_id='$QHcampaign_id[$w]' limit 1;"; + $stmtC = "UPDATE vicidial_closer_log set status='XFER',user='$QHuser[$w]',comments='REMOTE' where lead_id='$QHlead_id[$w]' and uniqueid='$QHuniqueid[$w]' and campaign_id='$QHcampaign_id[$w]' order by closecallid desc limit 1;"; $Caffected_rows = $dbhA->do($stmtC); $stmtD = "INSERT IGNORE INTO vicidial_live_inbound_agents SET calls_today='1',last_call_time='$SQLdate',user='$QHuser[$w]', group_id='$QHcampaign_id[$w]' ON DUPLICATE KEY UPDATE calls_today=(calls_today + 1),last_call_time='$SQLdate';"; diff --git a/agc_2-X/trunk/bin/FastAGI_log.pl b/agc_2-X/trunk/bin/FastAGI_log.pl index baf358ab..043a21b9 100644 --- a/agc_2-X/trunk/bin/FastAGI_log.pl +++ b/agc_2-X/trunk/bin/FastAGI_log.pl @@ -78,6 +78,7 @@ # 170325-1105 - Added optional vicidial_drop_log logging # 170427-1125 - Fix for drop call logging of answered calls hung up by customer first # 170508-1148 - Added blind monitor call end logging +# 170527-2340 - Fix for rare inbound logging issue #1017 # # defaults for PreFork @@ -1389,7 +1390,7 @@ sub process_request if ($Rsec < 10) {$Rsec = "0$Rsec";} $RSQLdate = "$Ryear-$Rmon-$Rmday $Rhour:$Rmin:$Rsec"; - $stmtA = "SELECT start_epoch,status,closecallid,user,term_reason,length_in_sec,queue_seconds,comments FROM vicidial_closer_log where lead_id = '$VD_lead_id' and call_date > \"$RSQLdate\" order by call_date desc limit 1;"; + $stmtA = "SELECT start_epoch,status,closecallid,user,term_reason,length_in_sec,queue_seconds,comments FROM vicidial_closer_log where lead_id = '$VD_lead_id' and call_date > \"$RSQLdate\" order by closecallid desc limit 1;"; if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; diff --git a/agc_2-X/trunk/www/agc/api.php b/agc_2-X/trunk/www/agc/api.php index 7cd705df..8489a5ff 100644 --- a/agc_2-X/trunk/www/agc/api.php +++ b/agc_2-X/trunk/www/agc/api.php @@ -89,10 +89,11 @@ # 161103-1729 - Added agent_debug to audio playing # 170209-1222 - Added URL and IP logging # 170220-1303 - Added switch_lead function +# 170527-2250 - Fix for rare inbound logging issue #1017, Added variable filtering # -$version = '2.14-55'; -$build = '170220-1303'; +$version = '2.14-56'; +$build = '170527-2250'; $startMS = microtime(); @@ -275,6 +276,8 @@ if ($qm_conf_ct > 0) $ingroup_choices = preg_replace("/\+/"," ",$ingroup_choices); $query_string = preg_replace("/'|\"|\\\\|;/","",$query_string); +$stage = preg_replace("/\'|\"|\\\\|;/","",$stage); +$status = preg_replace("/\'|\"|\\\\|;/","",$status); if ($non_latin < 1) { @@ -351,6 +354,7 @@ if ($non_latin < 1) $alt_user = preg_replace("/[^0-9a-zA-Z]/","",$alt_user); $postal_code = preg_replace("/[^- \.\_0-9a-zA-Z]/","",$postal_code); $agent_debug = preg_replace("/[^- \.\:\|\_0-9a-zA-Z]/","",$agent_debug); + $status = preg_replace("/[^-\_0-9a-zA-Z]/","",$status); } else { @@ -3176,7 +3180,7 @@ if ($function == 'ra_call_control') {$status='RAXFER';} if ($call_type=='IN') { - $stmt = "UPDATE vicidial_closer_log SET status='$status' where uniqueid='$uniqueid' and lead_id='$lead_id' and campaign_id='$campaign_id' order by call_date desc limit 1;"; + $stmt = "UPDATE vicidial_closer_log SET status='$status' where uniqueid='$uniqueid' and lead_id='$lead_id' and campaign_id='$campaign_id' order by closecallid desc limit 1;"; } else { diff --git a/agc_2-X/trunk/www/agc/chat_db_query.php b/agc_2-X/trunk/www/agc/chat_db_query.php index c1414141..f9d56f3f 100644 --- a/agc_2-X/trunk/www/agc/chat_db_query.php +++ b/agc_2-X/trunk/www/agc/chat_db_query.php @@ -22,6 +22,7 @@ # 161217-0824 - Added code for multi-user internal chat sessions # 161221-0800 - Added color-coding for users in internal chat sessions # 170526-2257 - Added additional variable filtering +# 170528-1028 - Added more variable filtering # require("dbconnect_mysqli.php"); @@ -60,7 +61,7 @@ if (isset($_GET["user_level"])) {$user_level=$_GET["user_level"];} if (isset($_GET["pass"])) {$pass=$_GET["pass"];} elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];} if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];} - elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];} + elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];} if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];} elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];} if (isset($_GET["group_id"])) {$group_id=$_GET["group_id"];} @@ -97,7 +98,6 @@ if (isset($_GET["chat_xfer_type"])) {$chat_xfer_type=$_GET["chat_xfer_type"] if (isset($_GET["chat_xfer_value"])) {$chat_xfer_value=$_GET["chat_xfer_value"];} elseif (isset($_POST["chat_xfer_value"])) {$chat_xfer_value=$_POST["chat_xfer_value"];} -$chat_member_name = preg_replace('/[^- \.\,\_0-9a-zA-Z]/',"",$chat_member_name); if (!$user) {echo "No user, no using."; exit;} if (file_exists('options.php')) @@ -113,6 +113,17 @@ $agent_user = preg_replace("/\||`|&|\'|\"|\\\\|;| /","",$agent_user); $manager_chat_id = preg_replace("/\||`|&|\'|\"|\\\\|;| /","",$manager_chat_id); $chat_creator = preg_replace("/\||`|&|\'|\"|\\\\|;| /","",$chat_creator); $group_id = preg_replace("/\||`|&|\'|\"|\\\\|;| /","",$group_id); +$chat_member_name = preg_replace('/[^- \.\,\_0-9a-zA-Z]/',"",$chat_member_name); +$lead_id = preg_replace('/[^0-9]/','',$lead_id); +$agent_to_add = preg_replace("/\||`|&|\'|\"|\\\\|;| /","",$agent_to_add); +$chat_group_id = preg_replace("/\||`|&|\'|\"|\\\\|;| /","",$chat_group_id); +$chat_id = preg_replace("/\||`|&|\'|\"|\\\\|;| /","",$chat_id); +$chat_level = preg_replace("/\||`|&|\'|\"|\\\\|;| /","",$chat_level); +$chat_xfer_type = preg_replace("/\||`|&|\'|\"|\\\\|;| /","",$chat_xfer_type); +$chat_xfer_value = preg_replace("/\||`|&|\'|\"|\\\\|;| /","",$chat_xfer_value); +$email = preg_replace("/\||`|&|\'|\"|\\\\|;| /","",$email); +$field_name = preg_replace("/\||`|&|\'|\"|\\\\|;| /","",$field_name); +$manager_chat_subid = preg_replace("/\||`|&|\'|\"|\\\\|;| /","",$manager_chat_subid); ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### diff --git a/agc_2-X/trunk/www/agc/functions.php b/agc_2-X/trunk/www/agc/functions.php index 692a467e..c4947678 100644 --- a/agc_2-X/trunk/www/agc/functions.php +++ b/agc_2-X/trunk/www/agc/functions.php @@ -39,6 +39,7 @@ # 170330-1152 - Added did_carrier_description display option # 170409-1004 - Added IP List features to user_authorization # 170526-2141 - Added additional auth variable filtering, issue #1016 +# 170528-1029 - Fix for rare inbound logging issue #1017, Added variable filtering # # $mysql_queries = 26 @@ -814,7 +815,7 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user,$DB,$call_i $u++; } - $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,queue_seconds,uniqueid,closecallid,user from vicidial_closer_log where lead_id='$lead_id' order by call_date desc limit 10000;"; + $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,queue_seconds,uniqueid,closecallid,user from vicidial_closer_log where lead_id='$lead_id' order by closecallid desc limit 10000;"; $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05017',$user,$server_ip,$session_name,$one_mysql_log);} $in_logs_to_print = mysqli_num_rows($rslt); @@ -2295,6 +2296,14 @@ function vicidial_ajax_log($NOW_TIME,$startMS,$link,$ACTION,$php_script,$user,$s $stmt = preg_replace('/;/', '', $stmt); $stmt = addslashes($stmt); + $NOW_TIME = preg_replace("/\'|\"|\\\\|;/","",$NOW_TIME); + $startMS = preg_replace("/\'|\"|\\\\|;/","",$startMS); + $php_script = preg_replace('/[^-\._0-9a-zA-Z]/','',$php_script); + $ACTION = preg_replace('/[^-_0-9a-zA-Z]/','',$ACTION); + $lead_id = preg_replace('/[^0-9]/','',$lead_id); + $stage = preg_replace("/\'|\"|\\\\|;/","",$stage); + $session_name = preg_replace('/[^-_0-9a-zA-Z]/','',$session_name); + $stmtA="INSERT INTO vicidial_ajax_log set user='$user',start_time='$NOW_TIME',db_time=NOW(),run_time='$TOTALrun',php_script='$php_script',action='$ACTION',lead_id='$lead_id',stage='$stage',session_name='$session_name',last_sql=\"$stmt\";"; $rslt=mysql_to_mysqli($stmtA, $link); diff --git a/agc_2-X/trunk/www/agc/inbound_popup.php b/agc_2-X/trunk/www/agc/inbound_popup.php index 0f384b71..901d7a84 100644 --- a/agc_2-X/trunk/www/agc/inbound_popup.php +++ b/agc_2-X/trunk/www/agc/inbound_popup.php @@ -80,6 +80,7 @@ $session_name = preg_replace("/\'|\"|\\\\|;/","",$session_name); $server_ip = preg_replace("/\'|\"|\\\\|;/","",$server_ip); $uniqueid = preg_replace('/[^-_\.0-9a-zA-Z]/','',$uniqueid); $exten = preg_replace("/\||`|&|\'|\"|\\\\|;| /","",$exten); +$vmail_box = preg_replace("/\||`|&|\'|\"|\\\\|;| /","",$vmail_box); # default optional vars if not set if (!isset($format)) {$format="text";} diff --git a/agc_2-X/trunk/www/agc/manager_send.php b/agc_2-X/trunk/www/agc/manager_send.php index 7ee5c69e..2dc3fe42 100644 --- a/agc_2-X/trunk/www/agc/manager_send.php +++ b/agc_2-X/trunk/www/agc/manager_send.php @@ -137,10 +137,11 @@ # 170317-2214 - Added more debugging output # 170513-1616 - Added more debugging output # 170526-2241 - Added additional variable filtering +# 170528-0850 - Fix for rare inbound logging issue #1017, Added additional variable filtering # -$version = '2.14-84'; -$build = '170526-2241'; +$version = '2.14-85'; +$build = '170528-0850'; $php_script = 'manager_send.php'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=142; @@ -263,6 +264,38 @@ $uniqueid = preg_replace('/[^-_\.0-9a-zA-Z]/','',$uniqueid); $exten = preg_replace("/\||`|&|\'|\"|\\\\|;| /","",$exten); $extension = preg_replace("/\||`|&|\'|\"|\\\\|;| /","",$extension); $protocol = preg_replace("/\||`|&|\'|\"|\\\\|;| /","",$protocol); +$ACTION = preg_replace("/\'|\"|\\\\|;/","",$ACTION); +$CalLCID = preg_replace("/\'|\"|\\\\|;/","",$CalLCID); +$FROMvdc = preg_replace('/[^-_0-9a-zA-Z]/','',$FROMvdc); +$account = preg_replace('/[^-_0-9a-zA-Z]/','',$account); +$agent_dialed_number = preg_replace('/[^-_0-9a-zA-Z]/','',$agent_dialed_number); +$agent_dialed_type = preg_replace('/[^-_0-9a-zA-Z]/','',$agent_dialed_type); +$agent_log_id = preg_replace('/[^-_0-9a-zA-Z]/','',$agent_log_id); +$agentchannel = preg_replace("/\'|\"|\\\\|;/","",$agentchannel); +$auto_dial_level = preg_replace('/[^-\._0-9a-zA-Z]/','',$auto_dial_level); +$call_server_ip = preg_replace("/\'|\"|\\\\|;/","",$call_server_ip); +$call_variables = preg_replace("/\'|\"|\\\\|;/","",$call_variables); +$channel = preg_replace("/\'|\"|\\\\|;/","",$channel); +$customerparked = preg_replace('/[^0-9]/','',$customerparked); +$enable_sipsak_messages = preg_replace('/[^0-9]/','',$enable_sipsak_messages); +$ext_context = preg_replace('/[^-_0-9a-zA-Z]/','',$ext_context); +$ext_priority = preg_replace('/[^-_0-9a-zA-Z]/','',$ext_priority); +$exten = preg_replace("/\'|\"|\\\\|;/","",$exten); +$extenName = preg_replace("/\'|\"|\\\\|;/","",$extenName); +$extrachannel = preg_replace("/\'|\"|\\\\|;/","",$extrachannel); +$filename = preg_replace("/\'|\"|\\\\|;/","",$filename); +$format = preg_replace('/[^-_0-9a-zA-Z]/','',$format); +$log_campaign = preg_replace("/\'|\"|\\\\|;/","",$log_campaign); +$nodeletevdac = preg_replace('/[^0-9]/','',$nodeletevdac); +$outbound_cid = preg_replace("/\'|\"|\\\\|;/","",$outbound_cid); +$parkedby = preg_replace("/\'|\"|\\\\|;/","",$parkedby); +$phone_code = preg_replace("/\s/","",$phone_code); +$preset_name = preg_replace("/\'|\"|\\\\|;/","",$preset_name); +$qm_extension = preg_replace("/\'|\"|\\\\|;/","",$qm_extension); +$queryCID = preg_replace("/\'|\"|\\\\|;/","",$queryCID); +$secondS = preg_replace('/[^0-9]/','',$secondS); +$stage = preg_replace("/\'|\"|\\\\|;/","",$stage); +$usegroupalias = preg_replace('/[^0-9]/','',$usegroupalias); # default optional vars if not set if (!isset($ACTION)) {$ACTION="Originate";} @@ -930,7 +963,7 @@ if ($ACTION=="RedirectVD") if ($row[0] > 0) { $four_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-4,date("i"),date("s"),date("m"),date("d"),date("Y"))); - $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec=(queue_seconds + $secondS),status='XFER' where lead_id='$lead_id' and call_date > \"$four_hours_ago\" order by start_epoch desc limit 1;"; + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec=(queue_seconds + $secondS),status='XFER' where lead_id='$lead_id' and call_date > \"$four_hours_ago\" order by closecallid desc limit 1;"; if ($format=='debug') {echo "\n";} $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02022',$user,$server_ip,$session_name,$one_mysql_log);} @@ -2421,7 +2454,7 @@ if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) $four_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-4,date("i"),date("s"),date("m"),date("d"),date("Y"))); ### find the value to put in the vicidial_id field if this was an inbound call - $stmt="SELECT closecallid from vicidial_closer_log where lead_id='$lead_id' and call_date > \"$four_hours_ago\" order by call_date desc limit 1;"; + $stmt="SELECT closecallid from vicidial_closer_log where lead_id='$lead_id' and call_date > \"$four_hours_ago\" order by closecallid desc limit 1;"; $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02077',$user,$server_ip,$session_name,$one_mysql_log);} $VAC_qm_ct = mysqli_num_rows($rslt); diff --git a/agc_2-X/trunk/www/agc/vdc_chat_display.php b/agc_2-X/trunk/www/agc/vdc_chat_display.php index 5948cbd6..ae844b52 100644 --- a/agc_2-X/trunk/www/agc/vdc_chat_display.php +++ b/agc_2-X/trunk/www/agc/vdc_chat_display.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2017 Joe Johnson, Matt Florell LICENSE: AGPLv2 # # This is the interface for agents to chat with customers and each other. It's separate from the manager-to-agent # chat interface out of necessity and calls the chat_db_query.php page to send information and display it. It will @@ -16,6 +16,7 @@ # 151218-0913 - Added missing translation code and user auth # 160303-0051 - Added code for chat transfers # 160818-1235 - Added line colors and scrolling +# 170528-1001 - Added variable filtering # require("dbconnect_mysqli.php"); @@ -92,6 +93,7 @@ $campaign = preg_replace('/[^-\_0-9a-zA-Z]/','',$campaign); $dial_method = preg_replace('/[^-\_0-9a-zA-Z]/','',$dial_method); $clickmute = preg_replace("/\'|\"|\\\\|;/","",$clickmute); $stage = preg_replace('/[^-\_0-9a-zA-Z]/','',$stage); +$email_invite_lead_id = preg_replace("/\'|\"|\\\\|;/","",$email_invite_lead_id); if ($non_latin < 1) { diff --git a/agc_2-X/trunk/www/agc/vdc_db_query.php b/agc_2-X/trunk/www/agc/vdc_db_query.php index a8a5e6ac..74fec2bb 100644 --- a/agc_2-X/trunk/www/agc/vdc_db_query.php +++ b/agc_2-X/trunk/www/agc/vdc_db_query.php @@ -430,10 +430,11 @@ # 170429-0835 - Added callback_display_days option # 170504-1056 - Added start_call_url to manual-dial calls # 170526-2327 - Added additional variable filtering +# 170527-2208 - Added more additional variable filtering, fixed rare inbound logging issue #1017 # -$version = '2.14-324'; -$build = '170526-2327'; +$version = '2.14-325'; +$build = '170527-2208'; $php_script = 'vdc_db_query.php'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=684; @@ -885,7 +886,6 @@ $sip_hangup_cause_dictionary = array( ); - ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### $stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db,qc_features_active,allow_emails,callback_time_24hour,enable_languages,language_method,agent_debug_logging,default_language,active_modules,allow_chats,default_phone_code,user_new_lead_limit FROM system_settings;"; @@ -924,8 +924,7 @@ if ($non_latin < 1) $user=preg_replace("/[^-_0-9a-zA-Z]/","",$user); $pass=preg_replace("/\'|\"|\\\\|;| /","",$pass); $orig_pass=preg_replace("/[^-_0-9a-zA-Z]/","",$orig_pass); - $length_in_sec = preg_replace("/[^0-9]/","",$length_in_sec); - $phone_code = preg_replace("/[^0-9]/","",$phone_code); + $phone_code = preg_replace("/[^0-9a-zA-Z]/","",$phone_code); $phone_number = preg_replace("/[^0-9a-zA-Z]/","",$phone_number); $status = preg_replace("/[^-_0-9a-zA-Z]/","",$status); } @@ -940,6 +939,7 @@ else $session_name = preg_replace("/\'|\"|\\\\|;/","",$session_name); $server_ip = preg_replace("/\'|\"|\\\\|;/","",$server_ip); $alt_phone = preg_replace("/\s/","",$alt_phone); +$phone_code = preg_replace("/\s/","",$phone_code); $phone_number = preg_replace("/\s/","",$phone_number); $campaign = preg_replace("/\'|\"|\\\\|;/","",$campaign); $closer_choice = preg_replace("/\'|\"|\\\\|;/","",$closer_choice); @@ -947,6 +947,96 @@ $lead_id = preg_replace('/[^0-9]/','',$lead_id); $list_id = preg_replace('/[^0-9]/','',$list_id); $conf_exten = preg_replace('/[^-_\.0-9a-zA-Z]/','',$conf_exten); $uniqueid = preg_replace('/[^-_\.0-9a-zA-Z]/','',$uniqueid); +$length_in_sec = preg_replace("/[^0-9]/","",$length_in_sec); +$CallBackDatETimE = preg_replace('/[^- \:_0-9a-zA-Z]/','',$CallBackDatETimE); +$CallBackLeadStatus = preg_replace('/[^-_0-9a-zA-Z]/','',$CallBackLeadStatus); +$DB = preg_replace('/[^0-9]/','',$DB); +$DiaL_SecondS = preg_replace('/[^0-9]/','',$DiaL_SecondS); +$LogouTKicKAlL = preg_replace('/[^0-9]/','',$LogouTKicKAlL); +$MDnextCID = preg_replace('/[^- _0-9a-zA-Z]/','',$MDnextCID); +$VDRP_stage = preg_replace('/[^-_0-9a-zA-Z]/','',$VDRP_stage); +$VDstop_rec_after_each_call = preg_replace('/[^-_0-9a-zA-Z]/','',$VDstop_rec_after_each_call); +$account = preg_replace('/[^-_0-9a-zA-Z]/','',$account); +$agent_dialed_number = preg_replace('/[^-_0-9a-zA-Z]/','',$agent_dialed_number); +$agent_dialed_type = preg_replace('/[^-_0-9a-zA-Z]/','',$agent_dialed_type); +$agent_email = preg_replace("/\'|\"|\\\\|;/","",$agent_email); +$agent_log = preg_replace('/[^-_0-9a-zA-Z]/','',$agent_log); +$agent_log_id = preg_replace('/[^-_0-9a-zA-Z]/','',$agent_log_id); +$agent_territories = preg_replace('/[^- _0-9a-zA-Z]/','',$agent_territories); +$agentchannel = preg_replace("/\'|\"|\\\\|;/","",$agentchannel); +$alt_dial = preg_replace('/[^-_0-9a-zA-Z]/','',$alt_dial); +$alt_num_status = preg_replace('/[^-_0-9a-zA-Z]/','',$alt_num_status); +$auto_dial_level = preg_replace('/[^-\._0-9a-zA-Z]/','',$auto_dial_level); +$blind_transfer = preg_replace('/[^-_0-9a-zA-Z]/','',$blind_transfer); +$callback_id = preg_replace('/[^-_0-9a-zA-Z]/','',$callback_id); +$called_count = preg_replace('/[^0-9]/','',$called_count); +$camp_script = preg_replace('/[^-_0-9a-zA-Z]/','',$camp_script); +$campaign_cid = preg_replace('/[^-_0-9a-zA-Z]/','',$campaign_cid); +$channel = preg_replace("/\'|\"|\\\\|;/","",$channel); +$cid_lock = preg_replace('/[^0-9]/','',$cid_lock); +$closer_blended = preg_replace('/[^-_0-9a-zA-Z]/','',$closer_blended); +$conf_dialed = preg_replace('/[^-_0-9a-zA-Z]/','',$conf_dialed); +$conf_silent_prefix = preg_replace('/[^-_0-9a-zA-Z]/','',$conf_silent_prefix); +$custom_field_names = preg_replace("/\'|\"|\\\\|;/","",$custom_field_names); +$customer_server_ip = preg_replace("/\'|\"|\\\\|;/","",$customer_server_ip); +$customer_zap_channel = preg_replace("/\'|\"|\\\\|;/","",$customer_zap_channel); +$date = preg_replace('/[^-_0-9]/','',$date); +$dial_ingroup = preg_replace('/[^-_0-9a-zA-Z]/','',$dial_ingroup); +$dial_method = preg_replace('/[^-_0-9a-zA-Z]/','',$dial_method); +$dial_prefix = preg_replace('/[^-_0-9a-zA-Z]/','',$dial_prefix); +$dial_timeout = preg_replace('/[^0-9]/','',$dial_timeout); +$disable_alter_custphone = preg_replace('/[^-_0-9a-zA-Z]/','',$disable_alter_custphone); +$dispo_choice = preg_replace('/[^-_0-9a-zA-Z]/','',$dispo_choice); +$email_enabled = preg_replace('/[^0-9]/','',$email_enabled); +$email_row_id = preg_replace('/[^-_0-9a-zA-Z]/','',$email_row_id); +$enable_sipsak_messages = preg_replace('/[^0-9]/','',$enable_sipsak_messages); +$ext_context = preg_replace('/[^-_0-9a-zA-Z]/','',$ext_context); +$ext_priority = preg_replace('/[^-_0-9a-zA-Z]/','',$ext_priority); +$exten = preg_replace("/\'|\"|\\\\|;/","",$exten); +$extension = preg_replace("/\'|\"|\\\\|;/","",$extension); +$favorites_list = preg_replace("/\"|\\\\|;/","",$favorites_list); +$format = preg_replace('/[^-_0-9a-zA-Z]/','',$format); +$gender = preg_replace('/[^-_0-9a-zA-Z]/','',$gender); +$group_name = preg_replace("/\'|\"|\\\\|;/","",$group_name); +$hangup_all_non_reserved = preg_replace('/[^0-9]/','',$hangup_all_non_reserved); +$inOUT = preg_replace('/[^-_0-9a-zA-Z]/','',$inOUT); +$in_script = preg_replace('/[^-_0-9a-zA-Z]/','',$in_script); +$inbound_lead_search = preg_replace('/[^0-9]/','',$inbound_lead_search); +$last_VDRP_stage = preg_replace('/[^-_0-9a-zA-Z]/','',$last_VDRP_stage); +$leaving_threeway = preg_replace('/[^0-9]/','',$leaving_threeway); +$manual_dial_call_time_check = preg_replace('/[^-_0-9a-zA-Z]/','',$manual_dial_call_time_check); +$manual_dial_filter = preg_replace('/[^-_0-9a-zA-Z]/','',$manual_dial_filter); +$manual_dial_search_filter = preg_replace('/[^-_0-9a-zA-Z]/','',$manual_dial_search_filter); +$no_delete_sessions = preg_replace('/[^0-9]/','',$no_delete_sessions); +$nocall_dial_flag = preg_replace('/[^-_0-9a-zA-Z]/','',$nocall_dial_flag); +$nodeletevdac = preg_replace('/[^0-9]/','',$nodeletevdac); +$old_CID = preg_replace('/[^- _0-9a-zA-Z]/','',$old_CID); +$omit_phone_code = preg_replace('/[^-_0-9a-zA-Z]/','',$omit_phone_code); +$original_phone_login = preg_replace("/\'|\"|\\\\|;/","",$original_phone_login); +$parked_hangup = preg_replace('/[^-_0-9a-zA-Z]/','',$parked_hangup); +$pause_trigger = preg_replace('/[^-_0-9a-zA-Z]/','',$pause_trigger); +$phone_login = preg_replace("/\'|\"|\\\\|;/","",$phone_login); +$phone_pass = preg_replace("/\'|\"|\\\\|;/","",$phone_pass); +$preview = preg_replace('/[^-_0-9a-zA-Z]/','',$preview); +$previous_agent_log_id = preg_replace('/[^-_0-9a-zA-Z]/','',$previous_agent_log_id); +$protocol = preg_replace('/[^-_0-9a-zA-Z]/','',$protocol); +$qm_dispo_code = preg_replace('/[^-_0-9a-zA-Z]/','',$qm_dispo_code); +$qm_extension = preg_replace("/\'|\"|\\\\|;/","",$qm_extension); +$qm_phone = preg_replace("/\'|\"|\\\\|;/","",$qm_phone); +$recipient = preg_replace('/[^-_0-9a-zA-Z]/','',$recipient); +$recording_filename = preg_replace("/\'|\"|\\\\|;/","",$recording_filename); +$recording_id = preg_replace('/[^0-9]/','',$recording_id); +$search = preg_replace('/[^-_0-9a-zA-Z]/','',$search); +$stage = preg_replace("/\'|\"|\\\\|;/","",$stage); +$start_epoch = preg_replace('/[^0-9]/','',$start_epoch); +$sub_status = preg_replace('/[^-_0-9a-zA-Z]/','',$sub_status); +$url_ids = preg_replace("/\'|\"|\\\\|;/","",$url_ids); +$use_campaign_dnc = preg_replace('/[^-_0-9a-zA-Z]/','',$use_campaign_dnc); +$use_internal_dnc = preg_replace('/[^-_0-9a-zA-Z]/','',$use_internal_dnc); +$usegroupalias = preg_replace('/[^0-9]/','',$usegroupalias); +$user_abb = preg_replace("/\'|\"|\\\\|;/","",$user_abb); +$vtiger_callback_id = preg_replace("/\'|\"|\\\\|;/","",$vtiger_callback_id); +$wrapup = preg_replace("/\'|\"|\\\\|;/","",$wrapup); # default optional vars if not set if (!isset($format)) {$format="text";} @@ -6366,7 +6456,7 @@ if ($stage == "end") { $vcl_statusSQL=''; if ($VDstatus == 'INCALL') {$vcl_statusSQL = ",status='$status_dispo'";} - $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec' $vcl_statusSQL where lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by call_date desc limit 1;"; + $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec' $vcl_statusSQL where lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by closecallid desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00062',$user,$server_ip,$session_name,$one_mysql_log);} @@ -7086,7 +7176,7 @@ if ($stage == "end") if ( (preg_match("/NONE/",$term_reason)) or (preg_match("/NONE/",$VDterm_reason)) or (strlen($VDterm_reason) < 1) ) { ### find out who hung up the call - $stmt="SELECT term_reason,closecallid,queue_position from vicidial_closer_log where lead_id='$lead_id' and call_date > \"$four_hours_ago\" order by call_date desc limit 1;"; + $stmt="SELECT term_reason,closecallid,queue_position from vicidial_closer_log where lead_id='$lead_id' and call_date > \"$four_hours_ago\" order by closecallid desc limit 1;"; $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00091',$user,$server_ip,$session_name,$one_mysql_log);} $VAC_qm_ct = mysqli_num_rows($rslt); @@ -7112,7 +7202,7 @@ if ($stage == "end") if (strlen($SQLterm) > 0) { ##### update the duration and end time in the vicidial_closer_log table - $stmt="UPDATE vicidial_closer_log set $SQLterm where lead_id='$lead_id' and call_date > \"$four_hours_ago\" order by call_date desc limit 1;"; + $stmt="UPDATE vicidial_closer_log set $SQLterm where lead_id='$lead_id' and call_date > \"$four_hours_ago\" order by closecallid desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00092',$user,$server_ip,$session_name,$one_mysql_log);} @@ -7138,7 +7228,7 @@ if ($stage == "end") if (strlen($VDqueue_position) < 1) { ### find out who hung up the call - $stmt="SELECT queue_position from vicidial_closer_log where lead_id='$lead_id' and call_date > \"$four_hours_ago\" order by call_date desc limit 1;"; + $stmt="SELECT queue_position from vicidial_closer_log where lead_id='$lead_id' and call_date > \"$four_hours_ago\" order by closecallid desc limit 1;"; $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00273',$user,$server_ip,$session_name,$one_mysql_log);} $VAC_qm_ct = mysqli_num_rows($rslt); @@ -7838,7 +7928,7 @@ if ($ACTION == 'VDADcheckINCOMING') else { $call_type = 'IN'; - $stmt = "SELECT campaign_id,closecallid,xfercallid from vicidial_closer_log where lead_id = '$lead_id' order by call_date desc limit 1;"; + $stmt = "SELECT campaign_id,closecallid,xfercallid from vicidial_closer_log where lead_id = '$lead_id' order by closecallid desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00183',$user,$server_ip,$session_name,$one_mysql_log);} @@ -7996,7 +8086,7 @@ if ($ACTION == 'VDADcheckINCOMING') if (strlen($closecallid)<1) { - $stmt = "SELECT closecallid,xfercallid from vicidial_closer_log where lead_id='$lead_id' and user='$user' and list_id='$list_id' order by call_date desc limit 1;"; + $stmt = "SELECT closecallid,xfercallid from vicidial_closer_log where lead_id='$lead_id' and user='$user' and list_id='$list_id' order by closecallid desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00336',$user,$server_ip,$session_name,$one_mysql_log);} @@ -8950,15 +9040,18 @@ if ($ACTION == 'VDADcheckINCOMINGother') $email_group_ct=count($inbound_email_groups); # This should always be greater than zero for the script to reach this point, but just in case... for ($i=0; $i<$email_group_ct; $i++) { + $inbound_email_groups[$i] = preg_replace("/\'|\"|\\\\|;/","",$inbound_email_groups[$i]); $email_group_str.="'$inbound_email_groups[$i]',"; } $email_group_str=substr($email_group_str, 0, -1); if (strlen($email_group_str) < 2) {$email_group_str = "''";} $chat_group_ct=count($inbound_chat_groups); # This should always be greater than zero for the script to reach this point, but just in case... - for ($i=0; $i<$chat_group_ct; $i++) { + for ($i=0; $i<$chat_group_ct; $i++) + { + $inbound_chat_groups[$i] = preg_replace("/\'|\"|\\\\|;/","",$inbound_chat_groups[$i]); $chat_group_str.="'$inbound_chat_groups[$i]',"; - } + } $chat_group_str=substr($chat_group_str, 0, -1); if (strlen($chat_group_str) < 2) {$chat_group_str = "''";} @@ -9309,7 +9402,7 @@ if ($ACTION == 'VDADcheckINCOMINGother') if (strlen($closecallid)<1) { - $stmt = "SELECT closecallid,xfercallid from vicidial_closer_log where lead_id='$lead_id' and user='$user' and list_id='$list_id' order by call_date desc limit 1;"; + $stmt = "SELECT closecallid,xfercallid from vicidial_closer_log where lead_id='$lead_id' and user='$user' and list_id='$list_id' order by closecallid desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00498',$user,$server_ip,$session_name,$one_mysql_log);} @@ -10365,7 +10458,7 @@ if ($ACTION == 'LeaDSearcHSelecTUpdatE') $dialed_number = $phone_number; $dialed_label = 'MAIN'; $call_type = 'IN'; - $stmt = "SELECT campaign_id,closecallid,xfercallid from vicidial_closer_log where lead_id = '$stage' order by call_date desc limit 1;"; + $stmt = "SELECT campaign_id,closecallid,xfercallid from vicidial_closer_log where lead_id = '$stage' order by closecallid desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00463',$user,$server_ip,$session_name,$one_mysql_log);} @@ -10398,7 +10491,7 @@ if ($ACTION == 'LeaDSearcHSelecTUpdatE') if (strlen($closecallid)<1) { - $stmt = "SELECT closecallid,xfercallid from vicidial_closer_log where lead_id='$lead_id' and user='$user' order by call_date desc limit 1;"; + $stmt = "SELECT closecallid,xfercallid from vicidial_closer_log where lead_id='$lead_id' and user='$user' order by closecallid desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00466',$user,$server_ip,$session_name,$one_mysql_log);} @@ -11297,7 +11390,7 @@ if ($ACTION == 'updateDISPO') if (strlen($call_notes) > 1) { $VDADchannel_group=$campaign; - $stmt = "SELECT campaign_id,closecallid from vicidial_closer_log where uniqueid='$uniqueid' and user='$user' order by call_date desc limit 1;"; + $stmt = "SELECT campaign_id,closecallid from vicidial_closer_log where uniqueid='$uniqueid' and user='$user' order by closecallid desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00372',$user,$server_ip,$session_name,$one_mysql_log);} @@ -12239,7 +12332,7 @@ if ($ACTION == 'updateDISPO') $INclosecallid=''; $INxfercallid=''; $VDADchannel_group=$campaign; - $stmt = "SELECT campaign_id,closecallid,xfercallid from vicidial_closer_log where uniqueid='$uniqueid' and user='$user' order by call_date desc limit 1;"; + $stmt = "SELECT campaign_id,closecallid,xfercallid from vicidial_closer_log where uniqueid='$uniqueid' and user='$user' order by closecallid desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00348',$user,$server_ip,$session_name,$one_mysql_log);} @@ -14027,7 +14120,7 @@ if ($ACTION == 'CALLLOGview') $u++; } - $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,queue_seconds from vicidial_closer_log where user='$user' and call_date >= '$date 0:00:00' and call_date <= '$date 23:59:59' order by call_date desc limit 10000;"; + $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,queue_seconds from vicidial_closer_log where user='$user' and call_date >= '$date 0:00:00' and call_date <= '$date 23:59:59' order by closecallid desc limit 10000;"; $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00578',$user,$server_ip,$session_name,$one_mysql_log);} $in_logs_to_print = mysqli_num_rows($rslt); @@ -15312,7 +15405,7 @@ if ($ACTION == 'LEADINFOview') $u++; } - $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,queue_seconds,uniqueid,closecallid,user from vicidial_closer_log where lead_id='$lead_id' order by call_date desc limit 10000;"; + $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,queue_seconds,uniqueid,closecallid,user from vicidial_closer_log where lead_id='$lead_id' order by closecallid desc limit 10000;"; $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00583',$user,$server_ip,$session_name,$one_mysql_log);} $in_logs_to_print = mysqli_num_rows($rslt); diff --git a/agc_2-X/trunk/www/agc/vdc_script_display.php b/agc_2-X/trunk/www/agc/vdc_script_display.php index b2812867..f27af6ce 100644 --- a/agc_2-X/trunk/www/agc/vdc_script_display.php +++ b/agc_2-X/trunk/www/agc/vdc_script_display.php @@ -763,7 +763,7 @@ if (preg_match('/--A--TABLEper_call_notes--B--/i',$script_text)) $u++; } - $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,queue_seconds,uniqueid,closecallid,user from vicidial_closer_log where lead_id='$lead_id' order by call_date desc limit 10000;"; + $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,queue_seconds,uniqueid,closecallid,user from vicidial_closer_log where lead_id='$lead_id' order by closecallid desc limit 10000;"; $rslt=mysql_to_mysqli($stmt, $link); $in_logs_to_print = mysqli_num_rows($rslt); if ($format=='debug') {$NOTESout .= "|$in_logs_to_print|$stmt|";} diff --git a/agc_2-X/trunk/www/agc/vdc_script_dispo_example.php b/agc_2-X/trunk/www/agc/vdc_script_dispo_example.php index 25fc85b9..8da43324 100644 --- a/agc_2-X/trunk/www/agc/vdc_script_dispo_example.php +++ b/agc_2-X/trunk/www/agc/vdc_script_dispo_example.php @@ -20,10 +20,11 @@ # 140811-0832 - Changed to use QXZ function for echoing text # 141216-2133 - Added language settings lookups and user/pass variable standardization # 170526-2345 - Added additional variable filtering +# 170528-0902 - Added more variable filtering # -$version = '2.14-8'; -$build = '170526-2345'; +$version = '2.14-9'; +$build = '170528-0902'; require_once("dbconnect_mysqli.php"); require_once("functions.php"); @@ -252,13 +253,18 @@ if (strlen($call_date) < 1) $user=preg_replace("/\'|\"|\\\\|;| /","",$user); $pass=preg_replace("/\'|\"|\\\\|;| /","",$pass); +$lead_id = preg_replace('/[^0-9]/', '', $lead_id); $list_id = preg_replace('/[^0-9]/', '', $list_id); +$notesid = preg_replace('/[^0-9]/', '', $notesid); $server_ip = preg_replace("/\'|\"|\\\\|;/","",$server_ip); $session_id = preg_replace('/[^0-9]/','',$session_id); $uniqueid = preg_replace('/[^-_\.0-9a-zA-Z]/','',$uniqueid); $campaign = preg_replace('/[^-_0-9a-zA-Z]/','',$campaign); $group = preg_replace('/[^-_0-9a-zA-Z]/','',$group); $session_name = preg_replace("/\'|\"|\\\\|;/","",$session_name); +$question = preg_replace("/\'|\"|\\\\|;/","",$question); +$answer = preg_replace("/\'|\"|\\\\|;/","",$answer); +$status = preg_replace("/\'|\"|\\\\|;/","",$status); ############################################# ##### START SYSTEM_SETTINGS AND USER LANGUAGE LOOKUP ##### @@ -298,6 +304,7 @@ if ($non_latin < 1) $length_in_sec = preg_replace("/[^0-9]/","",$length_in_sec); $phone_code = preg_replace("/[^0-9]/","",$phone_code); $phone_number = preg_replace("/[^0-9]/","",$phone_number); + $status=preg_replace("/[^-_0-9a-zA-Z]/","",$status); } if ($DB > 0) @@ -369,24 +376,72 @@ if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0)) echo "\n"; echo "\n"; -echo " + +\n"; echo "\n"; echo ""._QXZ("ViciDial Script"); echo "\n"; -?> - -\n"; echo "\n"; if ($process > 0) { #Update vicidial_list record - $stmt="UPDATE vicidial_list SET vendor_lead_code='$vendor_lead_code',title='$title',first_name='$first_name',middle_initial='$middle_initial',last_name='$last_name',address1='$address1',address2='$address2',address3='$address3',city='$city',state='$state',province='$province',postal_code='$postal_code',phone_code='$phone_code',phone_number='$phone_number',gender='$gender',date_of_birth='$date_of_birth',alt_phone='$alt_phone',email='$email',security_phrase='$security_phrase',comments='$comments',rank='$rank',owner='$owner' where lead_id='$lead_id';"; + $stmt="UPDATE vicidial_list SET vendor_lead_code='" . mysqli_real_escape_string($link, $vendor_lead_code) . "',title='" . mysqli_real_escape_string($link, $title) . "',first_name='" . mysqli_real_escape_string($link, $first_name) . "',middle_initial='" . mysqli_real_escape_string($link, $middle_initial) . "',last_name='" . mysqli_real_escape_string($link, $last_name) . "',address1='" . mysqli_real_escape_string($link, $address1) . "',address2='" . mysqli_real_escape_string($link, $address2) . "',address3='" . mysqli_real_escape_string($link, $address3) . "',city='" . mysqli_real_escape_string($link, $city) . "',state='" . mysqli_real_escape_string($link, $state) . "',province='" . mysqli_real_escape_string($link, $province) . "',postal_code='" . mysqli_real_escape_string($link, $postal_code) . "',phone_code='" . mysqli_real_escape_string($link, $phone_code) . "',phone_number='" . mysqli_real_escape_string($link, $phone_number) . "',gender='" . mysqli_real_escape_string($link, $gender) . "',date_of_birth='" . mysqli_real_escape_string($link, $date_of_birth) . "',alt_phone='" . mysqli_real_escape_string($link, $alt_phone) . "',email='" . mysqli_real_escape_string($link, $email) . "',security_phrase='" . mysqli_real_escape_string($link, $security_phrase) . "',comments='" . mysqli_real_escape_string($link, $comments) . "',rank='" . mysqli_real_escape_string($link, $rank) . "',owner='" . mysqli_real_escape_string($link, $owner) . "' where lead_id='$lead_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); $affected_rows = mysqli_affected_rows($link); @@ -422,7 +477,7 @@ if ($process > 0) } } # Insert into vicidial_call_notes - $stmt="INSERT INTO vicidial_call_notes set lead_id='$lead_id',vicidial_id='$vicidial_id',call_date='$call_date',call_notes='$call_notes';"; + $stmt="INSERT INTO vicidial_call_notes set lead_id='$lead_id',vicidial_id='" . mysqli_real_escape_string($link, $vicidial_id) . "',call_date='" . mysqli_real_escape_string($link, $call_date) . "',order_id='" . mysqli_real_escape_string($link, $order_id) . "',appointment_date='" . mysqli_real_escape_string($link, $appointment_date) . "',appointment_time='" . mysqli_real_escape_string($link, $appointment_time) . "',call_notes='" . mysqli_real_escape_string($link, $call_notes) . "';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); $affected_rows = mysqli_affected_rows($link); @@ -431,7 +486,7 @@ if ($process > 0) else { # update vicidial_call_notes record - $stmt="UPDATE vicidial_call_notes set order_id='$order_id',appointment_date='$appointment_date',appointment_time='$appointment_time',call_notes='$call_notes' where notesid='$notesid';"; + $stmt="UPDATE vicidial_call_notes set order_id='" . mysqli_real_escape_string($link, $order_id) . "',appointment_date='" . mysqli_real_escape_string($link, $appointment_date) . "',appointment_time='" . mysqli_real_escape_string($link, $appointment_time) . "',call_notes='" . mysqli_real_escape_string($link, $call_notes) . "' where notesid='$notesid';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); $affected_rows = mysqli_affected_rows($link); @@ -757,55 +812,6 @@ echo "\n"; - - -         diff --git a/agc_2-X/trunk/www/agc/vdc_script_notes.php b/agc_2-X/trunk/www/agc/vdc_script_notes.php index 18ea173d..33ed07aa 100644 --- a/agc_2-X/trunk/www/agc/vdc_script_notes.php +++ b/agc_2-X/trunk/www/agc/vdc_script_notes.php @@ -18,10 +18,11 @@ # 140810-2113 - Changed to use QXZ function for echoing text # 141216-2132 - Added language settings lookups and user/pass variable standardization # 170526-2345 - Added additional variable filtering +# 170528-0901 - Added more variable filtering # -$version = '2.14-8'; -$build = '170526-2345'; +$version = '2.14-9'; +$build = '170528-0901'; require_once("dbconnect_mysqli.php"); require_once("functions.php"); @@ -220,7 +221,9 @@ if (strlen($call_date) < 1) $user=preg_replace("/\'|\"|\\\\|;| /","",$user); $pass=preg_replace("/\'|\"|\\\\|;| /","",$pass); +$lead_id = preg_replace('/[^0-9]/', '', $lead_id); $list_id = preg_replace('/[^0-9]/', '', $list_id); +$notesid = preg_replace('/[^0-9]/', '', $notesid); $server_ip = preg_replace("/\'|\"|\\\\|;/","",$server_ip); $session_id = preg_replace('/[^0-9]/','',$session_id); $uniqueid = preg_replace('/[^-_\.0-9a-zA-Z]/','',$uniqueid); @@ -351,7 +354,7 @@ echo " if ($process > 0) { #Update vicidial_list record - $stmt="UPDATE vicidial_list SET vendor_lead_code='$vendor_lead_code',title='$title',first_name='$first_name',middle_initial='$middle_initial',last_name='$last_name',address1='$address1',address2='$address2',address3='$address3',city='$city',state='$state',province='$province',postal_code='$postal_code',phone_code='$phone_code',phone_number='$phone_number',gender='$gender',date_of_birth='$date_of_birth',alt_phone='$alt_phone',email='$email',security_phrase='$security_phrase',comments='$comments',rank='$rank',owner='$owner' where lead_id='$lead_id';"; + $stmt="UPDATE vicidial_list SET vendor_lead_code='" . mysqli_real_escape_string($link, $vendor_lead_code) . "',title='" . mysqli_real_escape_string($link, $title) . "',first_name='" . mysqli_real_escape_string($link, $first_name) . "',middle_initial='" . mysqli_real_escape_string($link, $middle_initial) . "',last_name='" . mysqli_real_escape_string($link, $last_name) . "',address1='" . mysqli_real_escape_string($link, $address1) . "',address2='" . mysqli_real_escape_string($link, $address2) . "',address3='" . mysqli_real_escape_string($link, $address3) . "',city='" . mysqli_real_escape_string($link, $city) . "',state='" . mysqli_real_escape_string($link, $state) . "',province='" . mysqli_real_escape_string($link, $province) . "',postal_code='" . mysqli_real_escape_string($link, $postal_code) . "',phone_code='" . mysqli_real_escape_string($link, $phone_code) . "',phone_number='" . mysqli_real_escape_string($link, $phone_number) . "',gender='" . mysqli_real_escape_string($link, $gender) . "',date_of_birth='" . mysqli_real_escape_string($link, $date_of_birth) . "',alt_phone='" . mysqli_real_escape_string($link, $alt_phone) . "',email='" . mysqli_real_escape_string($link, $email) . "',security_phrase='" . mysqli_real_escape_string($link, $security_phrase) . "',comments='" . mysqli_real_escape_string($link, $comments) . "',rank='" . mysqli_real_escape_string($link, $rank) . "',owner='" . mysqli_real_escape_string($link, $owner) . "' where lead_id='$lead_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); $affected_rows = mysqli_affected_rows($link); @@ -365,7 +368,7 @@ if ($process > 0) if ($notesid < 100) { # Insert into vicidial_call_notes - $stmt="INSERT INTO vicidial_call_notes set lead_id='$lead_id',vicidial_id='$vicidial_id',call_date='$call_date',order_id='$order_id',appointment_date='$appointment_date',appointment_time='$appointment_time',call_notes='$call_notes';"; + $stmt="INSERT INTO vicidial_call_notes set lead_id='$lead_id',vicidial_id='" . mysqli_real_escape_string($link, $vicidial_id) . "',call_date='" . mysqli_real_escape_string($link, $call_date) . "',order_id='" . mysqli_real_escape_string($link, $order_id) . "',appointment_date='" . mysqli_real_escape_string($link, $appointment_date) . "',appointment_time='" . mysqli_real_escape_string($link, $appointment_time) . "',call_notes='" . mysqli_real_escape_string($link, $call_notes) . "';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); $affected_rows = mysqli_affected_rows($link); @@ -374,7 +377,7 @@ if ($process > 0) else { # update vicidial_call_notes record - $stmt="UPDATE vicidial_call_notes set order_id='$order_id',appointment_date='$appointment_date',appointment_time='$appointment_time',call_notes='$call_notes' where notesid='$notesid';"; + $stmt="UPDATE vicidial_call_notes set order_id='" . mysqli_real_escape_string($link, $order_id) . "',appointment_date='" . mysqli_real_escape_string($link, $appointment_date) . "',appointment_time='" . mysqli_real_escape_string($link, $appointment_time) . "',call_notes='" . mysqli_real_escape_string($link, $call_notes) . "' where notesid='$notesid';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); $affected_rows = mysqli_affected_rows($link); diff --git a/agc_2-X/trunk/www/vicidial/admin_modify_lead.php b/agc_2-X/trunk/www/vicidial/admin_modify_lead.php index edc46479..8b31396e 100644 --- a/agc_2-X/trunk/www/vicidial/admin_modify_lead.php +++ b/agc_2-X/trunk/www/vicidial/admin_modify_lead.php @@ -80,6 +80,7 @@ # 160926-1052 - Fix for inbound call notes display # 170224-1639 - Added ability to display archived recordings # 170409-1554 - Added IP List validation code +# 170527-2253 - Fix for rare inbound logging issue #1017 # require("dbconnect_mysqli.php"); @@ -784,7 +785,7 @@ if ($end_call > 0) ### update last record in vicidial_closer_log table if (($dispo != $status) and ($modify_closer_logs > 0)) { - $stmtH="UPDATE vicidial_closer_log set status='" . mysqli_real_escape_string($link, $status) . "' where lead_id='" . mysqli_real_escape_string($link, $lead_id) . "' order by call_date desc limit 1"; + $stmtH="UPDATE vicidial_closer_log set status='" . mysqli_real_escape_string($link, $status) . "' where lead_id='" . mysqli_real_escape_string($link, $lead_id) . "' order by closecallid desc limit 1"; if ($DB) {echo "|$stmtH|\n";} $rslt=mysql_to_mysqli($stmtH, $link); } diff --git a/agc_2-X/trunk/www/vicidial/non_agent_api.php b/agc_2-X/trunk/www/vicidial/non_agent_api.php index d39fb7e8..2a577cb5 100644 --- a/agc_2-X/trunk/www/vicidial/non_agent_api.php +++ b/agc_2-X/trunk/www/vicidial/non_agent_api.php @@ -118,10 +118,11 @@ # 170409-1603 - Added IP List validation code # 170423-0800 - Added force_entry_list_id option for update_lead # 170508-1048 - Added blind_monitor logging +# 170527-2254 - Fix for rare inbound logging issue #1017 # -$version = '2.14-94'; -$build = '170508-1048'; +$version = '2.14-95'; +$build = '170527-2254'; $api_url_log = 0; $startMS = microtime(); @@ -4920,7 +4921,7 @@ if ($function == 'did_log_export') { $DLlength_in_sec[$k]=0; $DLcloser_epoch[$k]=$DLepoch[$k]; - $stmt="SELECT length_in_sec,UNIX_TIMESTAMP(call_date) from vicidial_closer_log where uniqueid='$DLuniqueid[$k]' order by call_date desc limit 1;"; + $stmt="SELECT length_in_sec,UNIX_TIMESTAMP(call_date) from vicidial_closer_log where uniqueid='$DLuniqueid[$k]' order by closecallid desc limit 1;"; $rslt=mysql_to_mysqli($stmt, $link); $vcl_recs = mysqli_num_rows($rslt); if ($DB>0) {echo "DEBUG: did_log_export query - $vcl_recs|$stmt\n";} @@ -6687,7 +6688,7 @@ if ($function == 'update_log_entry') if (preg_match("/\./",$call_id)) { if ($inbound_call > 0) - {$stmt="SELECT lead_id,status,closecallid from vicidial_closer_log where campaign_id='$group' and uniqueid='$call_id' order by call_date desc limit 1;";} + {$stmt="SELECT lead_id,status,closecallid from vicidial_closer_log where campaign_id='$group' and uniqueid='$call_id' order by closecallid desc limit 1;";} else {$stmt="SELECT lead_id,status,uniqueid from vicidial_log where campaign_id='$group' and uniqueid='$call_id';";} } @@ -6697,7 +6698,7 @@ if ($function == 'update_log_entry') $lead_id = ($lead_id + 0); if ($inbound_call > 0) - {$stmt="SELECT lead_id,status,closecallid from vicidial_closer_log where campaign_id='$group' and lead_id='$lead_id' order by call_date desc limit 1;";} + {$stmt="SELECT lead_id,status,closecallid from vicidial_closer_log where campaign_id='$group' and lead_id='$lead_id' order by closecallid desc limit 1;";} else {$stmt="SELECT lead_id,status,uniqueid from vicidial_log where campaign_id='$group' and lead_id='$lead_id' order by call_date desc limit 1;";} } @@ -6721,7 +6722,7 @@ if ($function == 'update_log_entry') } if ($inbound_call > 0) - {$stmt="UPDATE vicidial_closer_log SET status='$status' where campaign_id='$group' and closecallid='$uniqueid' order by call_date desc limit 1;";} + {$stmt="UPDATE vicidial_closer_log SET status='$status' where campaign_id='$group' and closecallid='$uniqueid' order by closecallid desc limit 1;";} else {$stmt="UPDATE vicidial_log SET status='$status' where campaign_id='$group' and uniqueid='$uniqueid';";} $rslt=mysql_to_mysqli($stmt, $link); diff --git a/agc_2-X/trunk/www/vicidial/qc_modify_lead.php b/agc_2-X/trunk/www/vicidial/qc_modify_lead.php index fcd70994..b0bc641a 100644 --- a/agc_2-X/trunk/www/vicidial/qc_modify_lead.php +++ b/agc_2-X/trunk/www/vicidial/qc_modify_lead.php @@ -26,6 +26,7 @@ # 160611-1217 - Fixed for external server IP recording link issue # 170409-1542 - Added IP List validation code # 170513-2256 - Added QC Webform, issue #1010 +# 170527-2252 - Fix for rare inbound logging issue #1017 # require("dbconnect_mysqli.php"); @@ -622,7 +623,7 @@ if ($end_call > 0) { echo __LINE__."\n"; } - $stmt="UPDATE vicidial_closer_log set status='" . mysqli_real_escape_string($link, $status) . "' where lead_id='" . mysqli_real_escape_string($link, $lead_id) . "' order by call_date desc limit 1"; + $stmt="UPDATE vicidial_closer_log set status='" . mysqli_real_escape_string($link, $status) . "' where lead_id='" . mysqli_real_escape_string($link, $lead_id) . "' order by closecallid desc limit 1"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_to_mysqli($stmt, $link); } @@ -865,7 +866,7 @@ else } ##### grab vicidial_closer_log records ##### - $stmt="select closecallid,lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed,queue_seconds,user_group,xfercallid,term_reason,uniqueid,agent_only from vicidial_closer_log where lead_id='" . mysqli_real_escape_string($link, $lead_id) . "' order by closecallid desc limit 500;"; + $stmt="SELECT closecallid,lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed,queue_seconds,user_group,xfercallid,term_reason,uniqueid,agent_only from vicidial_closer_log where lead_id='" . mysqli_real_escape_string($link, $lead_id) . "' order by closecallid desc limit 500;"; $rslt=mysql_to_mysqli($stmt, $link); $Clogs_to_print = mysqli_num_rows($rslt);