From 6c85d13951b5fea780e5595ebc9bdafba1e84d96 Mon Sep 17 00:00:00 2001 From: mattf Date: Fri, 2 Apr 2021 00:47:47 +0000 Subject: [PATCH] Fixed recording access logging to new QC functions git-svn-id: svn://192.168.202.10@3416 3d104415-ff17-0410-8863-d5cf3c621b8a --- .../vicidial/AST_quality_control_report.php | 124 +++++++++++++++++- agc_2-X/trunk/www/vicidial/qc_modify_lead.php | 46 ++++++- .../www/vicidial/recording_log_redirect.php | 13 +- 3 files changed, 175 insertions(+), 8 deletions(-) diff --git a/agc_2-X/trunk/www/vicidial/AST_quality_control_report.php b/agc_2-X/trunk/www/vicidial/AST_quality_control_report.php index 0bea4e9b..a4ded75e 100644 --- a/agc_2-X/trunk/www/vicidial/AST_quality_control_report.php +++ b/agc_2-X/trunk/www/vicidial/AST_quality_control_report.php @@ -68,7 +68,7 @@ $report_display_type="HTML"; ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,enable_languages,language_method,report_default_format,qc_features_active FROM system_settings;"; +$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,enable_languages,language_method,report_default_format,qc_features_active,log_recording_access FROM system_settings;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$HTML_text.="$stmt\n";} $qm_conf_ct = mysqli_num_rows($rslt); @@ -83,6 +83,7 @@ if ($qm_conf_ct > 0) $SSlanguage_method = $row[5]; $SSreport_default_format = $row[6]; $SSqc_features_active = $row[7]; + $log_recording_access = $row[8]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -590,6 +591,68 @@ $HTML_head.=" .purple {color: white; background-color: purple}\n"; $HTML_head.="-->\n"; $HTML_head.=" \n"; +$HTML_text.="\n"; $HTML_head.="\n"; $HTML_head.="\n"; @@ -843,9 +906,10 @@ if ($SUBMIT && ($QCuser_ct>0 || $user_ct>0 || $group_ct>0 || $QCstatus_ct>0 || ( $max_questions=0; while ($qc_row=mysqli_fetch_array($qc_rslt)) { + $qc_recording_id=$qc_row["recording_id"]; if ($x%2==0) {$bgcolor=$SSstd_row2_background;} else {$bgcolor=$SSstd_row1_background;} $HTML_text.=""; - $HTML_text.="".$qc_row["call_date"].""; + $HTML_text.="".$qc_row["call_date"].""; $HTML_text.="".GetFullName($qc_row["user"]).""; $HTML_text.="".$qc_row["lead_id"].""; $HTML_text.="".$qc_row["campaign_id"].""; @@ -870,15 +934,69 @@ if ($SUBMIT && ($QCuser_ct>0 || $user_ct>0 || $group_ct>0 || $QCstatus_ct>0 || ( if ($question_count>$max_questions) {$max_questions=$question_count;} while($crow=mysqli_fetch_array($checkpoint_rslt)) { + $checkpoint_comment=preg_replace("/((\d{1,2})?\:?\d?\d\:\d{2})/", "$1", $crow["checkpoint_comment_agent"]); $HTML_text.=""; $HTML_text.="    ".$crow["checkpoint_rank"].") ".$crow["checkpoint_text"].""; - $HTML_text.="".$crow["checkpoint_comment_agent"].""; + $HTML_text.="".$checkpoint_comment.""; $HTML_text.="".GetScore($qc_row["qc_log_id"], $crow["qc_checkpoint_log_id"]).""; $HTML_text.="".$crow["instant_fail_value"].""; $HTML_text.=" "; $HTML_text.=""; $CSV_text.=",\"".$crow["checkpoint_rank"].") ".$crow["checkpoint_text"]."\",\"".$crow["checkpoint_comment_agent"]."\",\"".GetScore($qc_row["qc_log_id"], $crow["qc_checkpoint_log_id"])."\",\"".$crow["instant_fail_value"]."\""; } + + # RECORDING + $rec_stmt="select location from recording_log where recording_id='" . mysqli_real_escape_string($link, $qc_recording_id) . "' order by recording_id desc limit 500;"; + $rec_rslt=mysql_to_mysqli($rec_stmt, $link); + $rec_row=mysqli_fetch_row($rec_rslt); + + $location = $rec_row[0]; + + if (strlen($location)>2) + { + $URLserver_ip = $location; + $URLserver_ip = preg_replace('/http:\/\//i', '',$URLserver_ip); + $URLserver_ip = preg_replace('/https:\/\//i', '',$URLserver_ip); + $URLserver_ip = preg_replace('/\/.*/i', '',$URLserver_ip); + $stmt="select count(*) from servers where server_ip='$URLserver_ip';"; + $rsltx=mysql_to_mysqli($stmt, $link); + $rowx=mysqli_fetch_row($rsltx); + + if ($rowx[0] > 0) + { + $stmt="select recording_web_link,alt_server_ip,external_server_ip from servers where server_ip='$URLserver_ip';"; + $rsltx=mysql_to_mysqli($stmt, $link); + $rowx=mysqli_fetch_row($rsltx); + + if (preg_match("/ALT_IP/i",$rowx[0])) + { + $location = preg_replace("/$URLserver_ip/i", "$rowx[1]", $location); + } + if (preg_match("/EXTERNAL_IP/i",$rowx[0])) + { + $location = preg_replace("/$URLserver_ip/i", "$rowx[2]", $location); + } + } + } + + if (strlen($location)>30) + {$locat = substr($location,0,27); $locat = "$locat...";} + else + {$locat = $location;} + $play_audio=''; + if ( (preg_match('/ftp/i',$location)) or (preg_match('/http/i',$location)) ) + { + $play_audio = "     \n"; + $location = "$locat"; + } + else + {$location = $locat;} + $HTML_text.=""; + $HTML_text.=""._QXZ("RECORDING").":"; + $HTML_text.="$play_audio   $location"; + $HTML_text.=""; + ########### + $CSV_text.="\n"; $x++; 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 a61b2883..1ecdd26b 100644 --- a/agc_2-X/trunk/www/vicidial/qc_modify_lead.php +++ b/agc_2-X/trunk/www/vicidial/qc_modify_lead.php @@ -186,7 +186,7 @@ switch($referring_section) # was $scorecard_source ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,custom_fields_enabled,enable_languages,language_method,active_modules FROM system_settings;"; +$stmt = "SELECT use_non_latin,custom_fields_enabled,enable_languages,language_method,active_modules,log_recording_access FROM system_settings;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysqli_num_rows($rslt); @@ -198,6 +198,7 @@ if ($qm_conf_ct > 0) $SSenable_languages = $row[2]; $SSlanguage_method = $row[3]; $active_modules = $row[4]; + $log_recording_access = $row[5]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -1074,6 +1075,43 @@ function ChangeCallbackDateTime(callback_id) } +function LogAudioRecordingAccess(log_active, recording_id, lead_id, recording_object_ID) + { + if (log_active) + { + var xmlhttp=false; + try { + xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); + } catch (e) { + try { + xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); + } catch (E) { + xmlhttp = false; + } + } + if (!xmlhttp && typeof XMLHttpRequest!='undefined') { + xmlhttp = new XMLHttpRequest(); + } + if (xmlhttp) { + var log_query = "&no_redirect=1&recording_id="+recording_id+"&lead_id="+lead_id; + xmlhttp.open('POST', 'recording_log_redirect.php'); + xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); + xmlhttp.send(log_query); + xmlhttp.onreadystatechange = function() { + if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { + var response = xmlhttp.responseText; + if (response!="OK") + { + document.getElementById(recording_object_ID).pause(); + alert(response); + } + } + } + delete xmlhttp; + } + } + } + @@ -2130,9 +2168,9 @@ else $play_audio=''; if ( (preg_match('/ftp/i',$location)) or (preg_match('/http/i',$location)) ) { + $play_audio = "     \n"; if ($log_recording_access<1) { - $play_audio = "     \n"; $location = "$locat"; } else @@ -2212,7 +2250,7 @@ else $i++; } echo ""; - echo "$play_audio  "; + echo "$play_audio  "; echo "$location"; echo "\n"; echo ""; @@ -2348,9 +2386,9 @@ else $play_audio='  '; if ( (preg_match('/ftp/i',$location)) or (preg_match('/http/i',$location)) ) { + $play_audio = " \n"; if ($log_recording_access<1) { - $play_audio = " \n"; $location = "$locat"; } else diff --git a/agc_2-X/trunk/www/vicidial/recording_log_redirect.php b/agc_2-X/trunk/www/vicidial/recording_log_redirect.php index 37787583..abe576ab 100644 --- a/agc_2-X/trunk/www/vicidial/recording_log_redirect.php +++ b/agc_2-X/trunk/www/vicidial/recording_log_redirect.php @@ -6,6 +6,7 @@ # CHANGELOG # 160116-1349 - First Build # 170409-1538 - Added IP List validation code +# 210401-1625 - Added no_redirect for logging when playing a Javascript audio object # require("dbconnect_mysqli.php"); @@ -19,6 +20,8 @@ if (isset($_GET["recording_id"])) {$recording_id=$_GET["recording_id"];} elseif (isset($_POST["recording_id"])) {$recording_id=$_POST["recording_id"];} if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["no_redirect"])) {$no_redirect=$_GET["no_redirect"];} + elseif (isset($_POST["no_redirect"])) {$no_redirect=$_POST["no_redirect"];} if (isset($_GET["search_archived_data"])) {$search_archived_data=$_GET["search_archived_data"];} elseif (isset($_POST["search_archived_data"])) {$search_archived_data=$_POST["search_archived_data"];} @@ -173,5 +176,13 @@ else $log_stmt="insert into vicidial_recording_access_log(recording_id, lead_id, user, access_datetime, access_result, ip) VALUES('$recording_id', '$lead_id', '$PHP_AUTH_USER', now(), 'ACCESSED', '$ip')"; $log_rslt=mysql_to_mysqli($log_stmt, $link); -header("Location: $location"); +if (!$no_redirect) + { + header("Location: $location"); + } +else + { + echo "OK"; // DO NOT TRANSLATE THIS - IT'S A FLAG FOR JAVASCRIPT + exit; + } ?>