From 2410cbcc84ad5bfc04fad54f8f8bf799a61ebfe7 Mon Sep 17 00:00:00 2001 From: mattf Date: Wed, 16 Apr 2008 10:18:12 +0000 Subject: [PATCH] added ability to update the computer_ip in the phones table upon vicidial.php agent login added QC status codes section to admin.php git-svn-id: svn://192.168.202.10@834 3d104415-ff17-0410-8863-d5cf3c621b8a --- agc_2-X/trunk/UPGRADE | 15 +- agc_2-X/trunk/docs/QC_PROCESS.txt | 12 +- .../TO_BE_TRANSLATED_2.0.5.txt | 18 ++ agc_2-X/trunk/www/agc/vicidial.php | 85 ++++++- agc_2-X/trunk/www/vicidial/admin.php | 212 +++++++++++++++++- 5 files changed, 328 insertions(+), 14 deletions(-) diff --git a/agc_2-X/trunk/UPGRADE b/agc_2-X/trunk/UPGRADE index 0c0c743c..ea135900 100644 --- a/agc_2-X/trunk/UPGRADE +++ b/agc_2-X/trunk/UPGRADE @@ -87,7 +87,20 @@ NOTE: Upgrading from 1.1.12-3 to 2.0.1 is at the bottom [featuremap] blindxfer => D -16. Added ip_relay to allow for loopback IAX trunks that make true blind monitoring possible for all agents no matter their phone type 0860XXXX. +16. Added ip_relay to allow for loopback IAX trunks that make true blind + monitoring possible for all agents no matter their phone type 0860XXXX. + +17. Added the ability to load balance the logins to vicidial.php for phones + that are registered to multiple servers on a multi-server system. + Simply put multiple phone_login values in the phone login field at + login separated by a comma and the vicidial.php script will pick the + server that has the fewest agents logged into it at the moment of login. + +18. Added ability for vicidial.php to populate the phones.computer_ip field upon + agent login. Options set in the vicidial.php file to allow for overwrite + every login or only if field is empty. + + diff --git a/agc_2-X/trunk/docs/QC_PROCESS.txt b/agc_2-X/trunk/docs/QC_PROCESS.txt index 280850b5..dbf47583 100644 --- a/agc_2-X/trunk/docs/QC_PROCESS.txt +++ b/agc_2-X/trunk/docs/QC_PROCESS.txt @@ -144,12 +144,6 @@ qc_user_level INT(2) default '0', campaign_group_id VARCHAR(20) ); -# qc codes to be used for statistics - CREATE TABLE qc_codes ( -code VARCHAR(8) PRIMARY KEY NOT NULL, -code_name VARCHAR(30) -); - # For the log table, some fields will need to be added to the vicidial_log table: ALTER TABLE vicidial_log ADD qc_stage ENUM('NONE','LOCK_1','PASS','LOCK_2','FINISH',COMMIT') default 'NONE'; @@ -162,6 +156,12 @@ ALTER TABLE vicidial_closer_log ADD qc_stage ENUM('NONE','LOCK_1','PASS','LOCK_2 +# qc codes to be used for statistics + CREATE TABLE vicidial_qc_codes ( +code VARCHAR(8) PRIMARY KEY NOT NULL, +code_name VARCHAR(30) +); + ALTER TABLE vicidial_campaigns ADD qc_web_form_address VARCHAR(255); ALTER TABLE vicidial_campaigns ADD qc_script VARCHAR(10); diff --git a/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt b/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt index b30827fb..7c863e30 100644 --- a/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt +++ b/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt @@ -56,6 +56,24 @@ In-Group Recording Override -<\/B> This field allows for the overriding of the c In-Group Recording Filename -<\/B> This field will override the Campaign Recording Filenaming Scheme unless it is set to NONE. The allowed variables are CAMPAIGN CUSTPHONE FULLDATE TINYDATE EPOCH AGENT. The default is FULLDATE_AGENT and would look like this 20051020-103108_6666. Another example is CAMPAIGN_TINYDATE_CUSTPHONE which would look like this TESTCAMP_51020103108_3125551212. 50 char max. Default is NONE|| In-Group Recording Override: || In-Group Recording Filename: || +ADDING VICIDIAL QC STATUS CODE|| +MODIFY VICIDIAL QC STATUS CODE|| +VICIDIAL QC STATUS CODES|| +The Quality Control-QC system within VICIDIAL has its own set of status codes separate from those within the call handling functions of VICIDIAL. QC statuse codes must be between 2 and 8 characters in length and contain no special characters like a space or colon. The QC status code description must be between 2 and 30 characters in length.|| + QC Status Codes || +VICIDIAL QC STATUS CODES WITHIN THIS SYSTEM: || +ADD NEW QC STATUS CODE|| +QC STATUS CODE NOT DELETED|| +QC STATUS CODE DELETED: || +QC STATUS CODE NOT MODIFIED || +QC STATUS CODE MODIFIED: || +the qc status code needs to be at least 1 characters in length|| +the qc status code name needs to be at least 1 characters in length|| +QC STATUS CODE NOT ADDED || +there is already a qc status code in the system with this name:|| +QC STATUS CODE ADDED: || +code must be between 1 and 8 characters in length +code name must be between 2 and 30 characters in length|| ############################################################ CLIENT diff --git a/agc_2-X/trunk/www/agc/vicidial.php b/agc_2-X/trunk/www/agc/vicidial.php index 2daa6707..d883dc48 100644 --- a/agc_2-X/trunk/www/agc/vicidial.php +++ b/agc_2-X/trunk/www/agc/vicidial.php @@ -178,10 +178,12 @@ # 80317-2106 - added recording override options for inbound group calls # 80331-1433 - Added second transfer try for VICIDIAL transfers/hangups on manual dial calls # 80402-0121 - Fixes for manual dial transfers on some systems +# 80407-2112 - Work on adding phone login load balancing across servers +# 80416-0559 - Added ability to log computer_ip at login, set the $PhoneSComPIP variable # -$version = '2.0.5-149'; -$build = '80402-0121'; +$version = '2.0.5-151'; +$build = '80416-0559'; require("dbconnect.php"); @@ -222,7 +224,7 @@ if (isset($_GET["relogin"])) {$relogin=$_GET["relogin"];} ### security strip all non-alphanumeric characters out of the variables ### $DB=ereg_replace("[^0-9a-z]","",$DB); - $phone_login=ereg_replace("[^0-9a-zA-Z]","",$phone_login); + $phone_login=ereg_replace("[^\,0-9a-zA-Z]","",$phone_login); $phone_pass=ereg_replace("[^0-9a-zA-Z]","",$phone_pass); $VD_login=ereg_replace("[^0-9a-zA-Z]","",$VD_login); $VD_pass=ereg_replace("[^0-9a-zA-Z]","",$VD_pass); @@ -269,6 +271,7 @@ $PreseT_DiaL_LinKs = '1'; # set to 1 to show a DIAL link for Dial Presets $LogiNAJAX = '1'; # set to 1 to do lookups $HidEMonitoRSessionS = '1'; # set to 1 to hide remote monitoring channels from "session calls" $LogouTKicKAlL = '1'; # set to 1 to hangup all calls in session upon agent logout +$PhoneSComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 to force log each login $TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen @@ -943,8 +946,29 @@ $VDloginDISPLAY=0; exit; } +# code for parsing load-balanced agent phone allocation where agent interface +# will send multiple phones-table logins so that the script can determine the +# server that has the fewest agents logged into it. +# login: ca101,cb101,cc101 +$pa=0; +if ( (eregi(',',$phone_login)) and (strlen($phone_login) > 2) ) + { + $phoneSQL = "("; + $phones_auto = explode(',',$phone_login); + $phones_auto_ct = count($phones_auto); + while($pa < $phones_auto_ct) + { + if ($pa > 0) + {$phoneSQL .= " or ";} + $phoneSQL .= "(login='$phones_auto[$pa]' and pass='$phone_pass')"; + $pa++; + } + $phoneSQL .= ")"; + } +else {$phoneSQL = "login='$phone_login' and pass='$phone_pass'";} + $authphone=0; -$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; +$stmt="SELECT count(*) from phones where $phoneSQL and active = 'Y';"; if ($DB) {echo "|$stmt|\n";} if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); @@ -982,6 +1006,42 @@ if (!$authphone) } else { +### go through the entered phones to figure out which server has fewest agents +### logged in and use that phone login account + if ($pa > 0) + { + $pb=0; + while($pb < $phones_auto_ct) + { + $pb_login=''; + $pb_server_ip=''; + $pb_count=0; + $pb_log=''; + + $stmtx="SELECT server_ip from phones where login = '$phones_auto[$pb]';"; + if ($DB) {echo "|$stmtx|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmtx, $link); + $rowx=mysql_fetch_row($rslt); + + $stmt="SELECT count(*) from vicidial_live_agents where server_ip = '$rowx[0]';"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + $pb_log .= "$phones_auto[$pb]|$rowx[0]|$row[0]|"; + + if ($pb_count >= $row[0]) + { + $pb_count=$row[0]; + $pb_server_ip=$rowx[0]; + $phone_login=$phones_auto[$pb]; + } + $pb++; + } + echo "\n"; + } echo "VICIDIAL web client\n"; $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; if ($DB) {echo "|$stmt|\n";} @@ -1050,6 +1110,23 @@ else $DBX_port=$row[59]; $enable_sipsak_messages=$row[66]; + if ($PhoneSComPIP == '1') + { + if (strlen($computer_ip) < 4) + { + $stmt="UPDATE phones SET computer_ip='$ip' where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + } + } + if ($PhoneSComPIP == '2') + { + $stmt="UPDATE phones SET computer_ip='$ip' where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; + if ($DB) {echo "|$stmt|\n";} + if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} + $rslt=mysql_query($stmt, $link); + } if ($clientDST) { $local_gmt = ($local_gmt + $isdst); diff --git a/agc_2-X/trunk/www/vicidial/admin.php b/agc_2-X/trunk/www/vicidial/admin.php index a0d651e1..ddeb32a5 100644 --- a/agc_2-X/trunk/www/vicidial/admin.php +++ b/agc_2-X/trunk/www/vicidial/admin.php @@ -703,6 +703,10 @@ if (isset($_GET["qc_script"])) {$qc_script=$_GET["qc_script"];} elseif (isset($_POST["qc_script"])) {$qc_script=$_POST["qc_script"];} if (isset($_GET["ingroup_recording_override"])) {$ingroup_recording_override=$_GET["ingroup_recording_override"];} elseif (isset($_POST["ingroup_recording_override"])) {$ingroup_recording_override=$_POST["ingroup_recording_override"];} +if (isset($_GET["code"])) {$code=$_GET["code"];} + elseif (isset($_POST["code"])) {$code=$_POST["code"];} +if (isset($_GET["code_name"])) {$code_name=$_GET["code_name"];} + elseif (isset($_POST["code_name"])) {$code_name=$_POST["code_name"];} if (isset($script_id)) {$script_id= strtoupper($script_id);} if (isset($lead_filter_id)) {$lead_filter_id = strtoupper($lead_filter_id);} @@ -898,6 +902,7 @@ $after_hours_action = ereg_replace("[^0-9a-zA-Z]","",$after_hours_action); $after_hours_exten = ereg_replace("[^0-9a-zA-Z]","",$after_hours_exten); $after_hours_voicemail = ereg_replace("[^0-9a-zA-Z]","",$after_hours_voicemail); $qc_script = ereg_replace("[^0-9a-zA-Z]","",$qc_script); +$code = ereg_replace("[^0-9a-zA-Z]","",$code); ### DIGITS and Dots $server_ip = ereg_replace("[^\.0-9]","",$server_ip); @@ -1023,6 +1028,7 @@ $list_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$list_description); $vcl_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$vcl_name); $vsc_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$vsc_name); $vsc_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$vsc_description); +$code_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$code_name); ### ALPHA-NUMERIC and underscore and dash and slash and at and dot $call_out_number_group = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$call_out_number_group); @@ -1196,11 +1202,12 @@ $list_mix_container = ereg_replace(";","",$list_mix_container); # 80302-0232 - added drop_action and transfer to in-group for both in-groups and outbound # 80310-1504 - added QC settings section to campaign screen # 80317-2037 - Added Recording override settings to in-groups +# 80414-1505 - More work on QC, added vicidial_qc_codes # # make sure you have added a user to the vicidial_users MySQL table with at least user_level 8 to access this page the first time -$admin_version = '2.0.5-125'; -$build = '80317-2037'; +$admin_version = '2.0.5-126'; +$build = '80414-1505'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -1363,6 +1370,7 @@ if ($ADD==2111111111111) {$hh='admin'; $sh='conference'; echo "ADDING NEW CONFER if ($ADD==21111111111111) {$hh='admin'; $sh='conference'; echo "ADDING NEW VICIDIAL CONFERENCE";} if ($ADD==221111111111111) {$hh='admin'; $sh='status'; echo "ADDING VICIDIAL SYSTEM STATUSES";} if ($ADD==231111111111111) {$hh='admin'; $sh='status'; echo "ADDING VICIDIAL STATUS CATEGORY";} +if ($ADD==241111111111111) {$hh='admin'; $sh='status'; echo "ADDING VICIDIAL QC STATUS CODE";} if ($ADD==3) {$hh='users'; echo "Modify User";} if ($ADD==30) {$hh='campaigns'; echo "Campaign Not Allowed";} if ($ADD==31) @@ -1410,6 +1418,7 @@ if ($ADD==31111111111111) {$hh='admin'; $sh='conference'; echo "MODIFY VICIDIAL if ($ADD==311111111111111) {$hh='admin'; $sh='settings'; echo "MODIFY VICIDIAL SYSTEM SETTINGS";} if ($ADD==321111111111111) {$hh='admin'; $sh='status'; echo "MODIFY VICIDIAL SYSTEM STATUSES";} if ($ADD==331111111111111) {$hh='admin'; $sh='status'; echo "MODIFY VICIDIAL STATUS CATEGORY";} +if ($ADD==341111111111111) {$hh='admin'; $sh='status'; echo "MODIFY VICIDIAL QC STATUS CODE";} if ($ADD=="4A") {$hh='users'; echo "Modify User - Admin";} if ($ADD=="4B") {$hh='users'; echo "Modify User - Admin";} if ($ADD==4) {$hh='users'; echo "Modify User";} @@ -1437,6 +1446,7 @@ if ($ADD==41111111111111) {$hh='admin'; $sh='conference'; echo "MODIFY VICIDIAL if ($ADD==411111111111111) {$hh='admin'; $sh='settings'; echo "MODIFY VICIDIAL SYSTEM SETTINGS";} if ($ADD==421111111111111) {$hh='admin'; $sh='status'; echo "MODIFY VICIDIAL SYSTEM STATUSES";} if ($ADD==431111111111111) {$hh='admin'; $sh='status'; echo "MODIFY VICIDIAL STATUS CATEGORIES";} +if ($ADD==441111111111111) {$hh='admin'; $sh='status'; echo "MODIFY VICIDIAL QC STATUS CODE";} if ($ADD==5) {$hh='users'; echo "Delete User";} if ($ADD==51) {$hh='campaigns'; $sh='detail'; echo "Delete Campaign";} if ($ADD==52) {$hh='campaigns'; $sh='detail'; echo "Logout Agents";} @@ -3654,6 +3664,14 @@ The VICIDIAL basic web-based lead loader is designed simply to take a lead file Through the use of system status categories, you can group together statuses to allow for statistical analysis on a group of statuses. The Category ID must be 2-20 characters in length with no spaces, the name must be 2-50 characters in length, the description is optional and TimeonVDAD Display defines whether that status will be one of the upto 4 statuses that can be calculated and displayed on the Time On VDAD Real-Time report. +



+ +VICIDIAL QC STATUS CODES

+ +
+The Quality Control-QC system within VICIDIAL has its own set of status codes separate from those within the call handling functions of VICIDIAL. QC statuse codes must be between 2 and 8 characters in length and contain no special characters like a space or colon. The QC status code description must be between 2 and 30 characters in length. + +







@@ -4223,7 +4241,7 @@ if (strlen($admin_hh) > 1) { 1) { ?> - >
> System Statuses   |   > Status Categories + >> System Statuses   |   > Status Categories   |   > QC Status Codes "; + $stmt="SELECT count(*) from vicidial_qc_codes where code='$code';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
QC STATUS CODE NOT ADDED - there is already a qc status code in the system with this name: $row[0]\n";} + else + { + if ( (strlen($code) < 1) or (strlen($code_name) < 2) ) + { + echo "
QC STATUS CODE NOT ADDED - Please go back and look at the data you entered\n"; + echo "
code must be between 1 and 8 characters in length\n"; + echo "
code name must be between 2 and 30 characters in length\n"; + } + else + { + echo "
QC STATUS CODE ADDED: $code_name - $code\n"; + + $stmt="INSERT INTO vicidial_qc_codes (code,code_name) values('$code','$code_name');"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW QC STATUS CODE |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=341111111111111; +} + + + ###################################################################################################### ###################################################################################################### ####### 4 series, record modifications submitted and DB is modified, then on to 3 series forms below @@ -7670,6 +7730,74 @@ $ADD=331111111111111; # go to system settings modification form below } +###################### +# ADD=441111111111111 modify/delete qc status code in the system +###################### + +if ($ADD==441111111111111) +{ + if ($LOGmodify_servers==1) + { + echo ""; + + if (ereg('delete',$stage)) + { + if ( (strlen($code) < 1) or (preg_match("/^B$|^NA$|^DNC$|^NA$|^DROP$|^INCALL$|^QUEUE$|^NEW$/i",$code)) ) + { + echo "
QC STATUS CODE NOT DELETED - Please go back and look at the data you entered\n"; + echo "
the qc status code cannot be a reserved status: B,NA,DNC,NA,DROP,INCALL,QUEUE,NEW\n"; + echo "
the qc status code needs to be at least 1 characters in length\n"; + } + else + { + echo "
QC STATUS CODE DELETED: $code\n"; + + $stmt="DELETE FROM vicidial_qc_codes where code='$code';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DELETE QC STATUS CODE |$PHP_AUTH_USER|$ip|$stmt|$stmtA|\n"); + fclose($fp); + } + } + } + if (ereg('modify',$stage)) + { + if ( (strlen($code) < 1) or (strlen($code_name) < 2) ) + { + echo "
QC STATUS CODE NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
the qc status code needs to be at least 1 characters in length\n"; + echo "
the qc status code name needs to be at least 1 characters in length\n"; + } + else + { + echo "
QC STATUS CODE MODIFIED: $code\n"; + + $stmt="UPDATE vicidial_qc_codes SET code_name='$code_name' where code='$code';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY QC STATUS CODE |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=341111111111111; # go to qc status code modification form below +} + + ###################################################################################################### @@ -12842,6 +12970,84 @@ if ($ADD==331111111111111) +###################### +# ADD=341111111111111 modify vicidial QC status code +###################### + +if ($ADD==341111111111111) +{ + if ($LOGmodify_servers==1) + { + echo "
\n"; + echo ""; + + echo "
\n"; + echo "VICIDIAL QC STATUS CODES WITHIN THIS SYSTEM:   $NWB#vicidial_qc_status_codes$NWE
\n"; + echo "\n"; + echo "\n"; + + ##### go through each QC status code + $stmt="SELECT count(*) from vicidial_qc_codes;"; + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0] > 0) + { + $stmt="SELECT code,code_name from vicidial_qc_codes order by code;"; + $rslt=mysql_query($stmt, $link); + $statuses_to_print = mysql_num_rows($rslt); + $o=0; + while ($statuses_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $o++; + + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + echo "\n"; + echo "\n"; + echo "\n"; + } + } + echo "
STATUS CODEDESCRIPTIONMODIFY/DELETE
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "$rowx[0]
        \n"; + echo "   \n"; + + if (preg_match("/^B$|^NA$|^DNC$|^NA$|^DROP$|^INCALL$|^QUEUE$|^NEW$/i",$rowx[0])) + { + echo "DELETE\n"; + } + else + { + echo "DELETE\n"; + } + echo "
\n"; + + echo "
ADD NEW QC STATUS CODE
\n"; + echo "\n"; + echo "Status:   \n"; + echo "Description:
\n"; + echo "
\n"; + + echo "

\n"; + + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + + + + ###################### # ADD=550 search form