LICENSE: AGPLv2 # # live real-time stats for the VICIDIAL Auto-Dialer all servers # # STOP=4000, SLOW=40, GO=4 seconds refresh interval # # CHANGELOG: # 50406-0920 - Added Paused agents < 1 min # 51130-1218 - Modified layout and info to show all servers in a vicidial system # 60421-1043 - check GET/POST vars lines with isset to not trigger PHP NOTICES # 60511-1343 - Added leads and drop info at the top of the screen # 60608-1539 - Fixed CLOSER tallies for active calls # 60619-1658 - Added variable filtering to eliminate SQL injection attack threat # - Added required user/pass to gain access to this page # 60626-1453 - Added display of system load to bottom (Angelito Manansala) # 60901-1123 - Changed display elements at the top of the screen # 60905-1342 - Fixed non INCALL|QUEUE timer column # 61002-1642 - Added TRUNK SHORT/FILL stats # 61101-1318 - Added SIP and IAX Listen and Barge links option # 61101-1647 - Added Usergroup column and user name option as well as sorting # 61102-1155 - Made display of columns more modular, added ability to hide server info # 61215-1131 - Added answered calls and drop percent taken from answered calls # 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns # 70123-1151 - Added non_latin options for substr in display variables, thanks Marin Blu # 70206-1140 - Added call-type statuses to display(A-Auto, M-Manual, I-Inbound/Closer) # 70619-1339 - Added Status Category tally display # 71029-1900 - Changed CLOSER-type to not require campaign_id restriction # 80227-0418 - Added priority to waiting calls display # 80311-1550 - Added calls_today on all agents and wait time/in-group for inbound calls # 80422-0033 - Added phonediaplay option, allow for toggle-sorting on sortable fields # 80422-1001 - Fixed sort by phone login # 80424-0515 - Added non_latin lookup from system_settings # 80525-1040 - Added IVR status display and summary for inbound calls # 80619-2047 - Added DISPO status for post-call-work while paused # 80704-0543 - Added DEAD status for agents INCALL with no live call # 80822-1222 - Added option for display of customer phone number # 81011-0335 - Fixed remote agent display bug # 81022-1500 - Added inbound call stats display option # 81029-1023 - Changed drop percent calculation for multi-stat reports # 81029-1706 - Added pause code display if enabled per campaign # 81108-2337 - Added inbound-only section # 90105-1153 - Changed monitor links to use 0 prefix instead of 6 # 90202-0108 - Changed options to pop-out frame, added outbound_autodial_active option # 90310-0906 - Added admin header # 90428-0727 - Changed listen and barge to use the API and manager must enter phone # 90508-0623 - Changed to PHP long tags # 90518-0930 - Fixed $CALLSdisplay static assignment bug for some links(bug #210) # 90524-2231 - Changed to use functions.php for seconds to HH:MM:SS conversion # 90602-0405 - Added list mix display in statuses and order if active # 90603-1845 - Fixed color coding bug # 90627-0608 - Some Formatting changes, added in-group name display # 90701-0657 - Fixed inbound=No calculation issues # 90808-0212 - Fixed inbound only non-ALL bug, changed times to use agent last_state_change # 90907-0915 - Added PARK status # 90914-1154 - Added AgentOnly display column to waiting calls section # 91102-2013 - Changed in-group color styles for incoming calls waiting # 91204-1548 - Added ability to change agent in-groups and blended # 100214-1127 - Added no-dialable-leads alert and in-groups stats option # 100301-1229 - Added 3-WAY status for consultative transfer agents # 100303-0930 - Added carrier stats display option # 100424-0943 - Added realtime_block_user_info option # 100709-1054 - Added system setting slave server option # 100802-2347 - Added User Group Allowed Reports option validation and allowed campaigns restrictions # 100805-0704 - Fixed minor bug in campaigns restrictions # 100815-0002 - Added optional display of preset dials if presets are enabled in the campaign # 100912-0839 - Changed several stats to limit to 2 or 3 decimal spaces # 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links # 101024-0832 - Added Agent time stats option and agents-in-dispo counter # 101109-1448 - Added Auto Hopper Level display (MikeC) # 101216-1358 - Added functions to work with new realtime_report.php script # 110218-1037 - Fixed query that was causing load spikes on systems with millions of log entries # 110303-2125 - Added agent on-hook phone indication and RING status and color # 110314-1735 - Fixed another query that was causing load spikes on systems with millions of log entries # 111103-1220 - Added admin_hide_phone_data and admin_hide_lead_data options # 120223-1934 - Added user group options # 120612-2150 - Added percentages to counts for carrier stats and TOTAL line to carrier display stats as well # 121222-2151 - Added email status # 130214-1323 - Added link to in-group selected users report for in-queue inbound calls # 130424-1357 - Fixed issue with pause codes display # 130610-0905 - Finalized changing of all ereg instances to preg # 130620-2303 - Added filtering of input to prevent SQL injection attacks and new user auth # 130901-2008 - Changed to mysqli PHP functions # 131120-1543 - Fixed small display bug when customer phone view is enabled # 140213-1705 - Fixed division by zero bug # 140328-0006 - Converted division calculations to use MathZDC function # 140624-1424 - Added droppedOFtotal options.php option # 140918-1614 - Added QXZ function formatting of output # 141128-0857 - Code cleanup for QXZ functions # 141230-0030 - Added code for on-the-fly language translations display # 150211-2342 - Added hopper link, issue #825 # 150307-0825 - small cosmetic fix # 150804-0956 - Added WHISPER option agent monitoring # 150919-0238 - Added display for chats in queue # 150925-2223 - Added User option to hide users from real-time report # 160104-1059 - Added detection of dead chat sessions # 160227-1031 - Added INGROUPcolorOVERRIDE option # 160327-1259 - Added report_display_type option and several design changes # 160331-1947 - Fix for non-pausecode display in HTML format # 160406-1858 - Added WALL options for report_display_type # 160413-2004 - Added WALL_4 option # 160418-2141 - Fixed issue with WALL displays # 160515-1300 - Added UK OFCOM feature # 160803-1901 - Fixed issue with ERROR in campaign/ingroup name # 170321-1145 - Added pause code time limits colors # 170409-1556 - Added IP List validation code # 170615-0023 - Added DIAL status for manual dial agent calls that have not been answered # 180204-1538 - Added display of LIVE Inbound Callback Queue Calls # 190206-1616 - Added mobile device display variable # 190313-0607 - Fix for columns display issue #1141 # 190420-1728 - Added RS_ListenBarge options.php setting # 190513-1711 - Added ingroup filter # 190525-2133 - Added new agent time segment display # 190531-1454 - Upgraded ingroup filter # 190927-1759 - Fixed PHP7 array issue # 191113-2027 - Fixed cached carrier stats bug # 200401-1930 - Added option to show more customer info for level 9 users and customize the color chart times # 200428-1337 - Added RS_INcolumnsHIDE, RS_report_default_format & RS_AGENTstatusTALLY options.php settings # 200506-1642 - Added RS_CUSTINFOminUL options.php setting # 200815-0930 - Added agent-paused 10 & 15 minute indicators # 201107-2253 - Added display of parked calls, inbound SLA stats and LIMITED report type # 210314-2040 - Added optional DID Description display for inbound calls # 210615-2241 - Fix for issue #1314 # 210618-1011 - Added CORS support # 210625-1432 - Added options.php RS_BargeSwap variable # 220217-2045 - Added input variable filters # 220221-1535 - Added allow_web_debug system setting # 230308-0215 - Added option to show customer phone code # 230421-0107 - Added AGENTlatency display # 230421-1636 - Added RS_UGlatencyRESTRICT options.php setting # 230811-1530 - Added realtime monitoring display information # 231115-1656 - Added RS_no_DEAD_status and RS_hide_CUST_info options.php settings # 240801-1130 - Code updates for PHP8 compatibility # 250103-0929 - Added enhanced_agent_monitoring code # 250130-1130 - Changed vicidial_daily_rt_monitor_log to vicidial_daily_rt_monitorING_log to match SQL file, also added sort clause to WHISPER # 250320-2307 - Added "3-WAYD" status for dead 3way call agent # 250523-1730 - Added inbound calls counting capability # $version = '2.14-120'; $build = '250320-2307'; $php_script='AST_timeonVDADall.php'; require("dbconnect_mysqli.php"); require("functions.php"); ### CUSTOMIZE TIMES FOR REALTIME DISPLAY ### $rt_report_times["waiting_short_time"]=30; $rt_report_times["waiting_medium_time"]=60; $rt_report_times["waiting_long_time"]=300; $rt_report_times["incall_short_time"]=10; $rt_report_times["incall_medium_time"]=60; $rt_report_times["incall_long_time"]=300; $rt_report_times["paused_short_time"]=10; $rt_report_times["paused_medium_time"]=60; $rt_report_times["paused_long_time"]=300; $rt_report_times["paused_long_time10"]=600; $rt_report_times["paused_long_time15"]=900; $rt_report_times["threeway_short_time"]=10; $rt_report_times["dead_short_time"]=10; $rt_report_times["pause_limit"]=999999; $container_stmt="select container_entry from vicidial_settings_containers where container_id='REALTIME_REPORT_TIMES'"; $container_rslt=mysql_to_mysqli($container_stmt, $link); while ($crow=mysqli_fetch_row($container_rslt)) { $realtime_times=$crow[0]; $rt_times=explode("\n", $realtime_times); for ($q=0; $q", $rt_times[$q]); $var_name=trim($rt_array[0]); $var_value=preg_replace('/[^0-9]/', '', trim($rt_array[1])); $rt_report_times["$var_name"]=$var_value; } } ###### END CUSTOM REALTIMES SECTION ######## $PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; $PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; $PHP_SELF=$_SERVER['PHP_SELF']; $PHP_SELF = preg_replace('/\.php.*/i','.php',$PHP_SELF); if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} if (isset($_GET["RR"])) {$RR=$_GET["RR"];} elseif (isset($_POST["RR"])) {$RR=$_POST["RR"];} if (isset($_GET["inbound"])) {$inbound=$_GET["inbound"];} elseif (isset($_POST["inbound"])) {$inbound=$_POST["inbound"];} if (isset($_GET["group"])) {$group=$_GET["group"];} elseif (isset($_POST["group"])) {$group=$_POST["group"];} if (isset($_GET["groups"])) {$groups=$_GET["groups"];} elseif (isset($_POST["groups"])) {$groups=$_POST["groups"];} if (isset($_GET["usergroup"])) {$usergroup=$_GET["usergroup"];} elseif (isset($_POST["usergroup"])) {$usergroup=$_POST["usergroup"];} if (isset($_GET["DB"])) {$DB=$_GET["DB"];} elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} if (isset($_GET["adastats"])) {$adastats=$_GET["adastats"];} elseif (isset($_POST["adastats"])) {$adastats=$_POST["adastats"];} if (isset($_GET["submit"])) {$submit=$_GET["submit"];} elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} if (isset($_GET["SIPmonitorLINK"])) {$SIPmonitorLINK=$_GET["SIPmonitorLINK"];} elseif (isset($_POST["SIPmonitorLINK"])) {$SIPmonitorLINK=$_POST["SIPmonitorLINK"];} if (isset($_GET["IAXmonitorLINK"])) {$IAXmonitorLINK=$_GET["IAXmonitorLINK"];} elseif (isset($_POST["IAXmonitorLINK"])) {$IAXmonitorLINK=$_POST["IAXmonitorLINK"];} if (isset($_GET["UGdisplay"])) {$UGdisplay=$_GET["UGdisplay"];} elseif (isset($_POST["UGdisplay"])) {$UGdisplay=$_POST["UGdisplay"];} if (isset($_GET["UidORname"])) {$UidORname=$_GET["UidORname"];} elseif (isset($_POST["UidORname"])) {$UidORname=$_POST["UidORname"];} if (isset($_GET["orderby"])) {$orderby=$_GET["orderby"];} elseif (isset($_POST["orderby"])) {$orderby=$_POST["orderby"];} if (isset($_GET["SERVdisplay"])) {$SERVdisplay=$_GET["SERVdisplay"];} elseif (isset($_POST["SERVdisplay"])) {$SERVdisplay=$_POST["SERVdisplay"];} if (isset($_GET["CALLSdisplay"])) {$CALLSdisplay=$_GET["CALLSdisplay"];} elseif (isset($_POST["CALLSdisplay"])) {$CALLSdisplay=$_POST["CALLSdisplay"];} if (isset($_GET["PHONEdisplay"])) {$PHONEdisplay=$_GET["PHONEdisplay"];} elseif (isset($_POST["PHONEdisplay"])) {$PHONEdisplay=$_POST["PHONEdisplay"];} if (isset($_GET["MONITORdisplay"])) {$MONITORdisplay=$_GET["MONITORdisplay"];} elseif (isset($_POST["MONITORdisplay"])) {$MONITORdisplay=$_POST["MONITORdisplay"];} if (isset($_GET["CUSTPHONEdisplay"])) {$CUSTPHONEdisplay=$_GET["CUSTPHONEdisplay"];} elseif (isset($_POST["CUSTPHONEdisplay"])) {$CUSTPHONEdisplay=$_POST["CUSTPHONEdisplay"];} if (isset($_GET["CUSTINFOdisplay"])) {$CUSTINFOdisplay=$_GET["CUSTINFOdisplay"];} elseif (isset($_POST["CUSTINFOdisplay"])) {$CUSTINFOdisplay=$_POST["CUSTINFOdisplay"];} if (isset($_GET["NOLEADSalert"])) {$NOLEADSalert=$_GET["NOLEADSalert"];} elseif (isset($_POST["NOLEADSalert"])) {$NOLEADSalert=$_POST["NOLEADSalert"];} if (isset($_GET["DROPINGROUPstats"])) {$DROPINGROUPstats=$_GET["DROPINGROUPstats"];} elseif (isset($_POST["DROPINGROUPstats"])) {$DROPINGROUPstats=$_POST["DROPINGROUPstats"];} if (isset($_GET["ALLINGROUPstats"])) {$ALLINGROUPstats=$_GET["ALLINGROUPstats"];} elseif (isset($_POST["ALLINGROUPstats"])) {$ALLINGROUPstats=$_POST["ALLINGROUPstats"];} if (isset($_GET["with_inbound"])) {$with_inbound=$_GET["with_inbound"];} elseif (isset($_POST["with_inbound"])) {$with_inbound=$_POST["with_inbound"];} if (isset($_GET["monitor_active"])) {$monitor_active=$_GET["monitor_active"];} elseif (isset($_POST["monitor_active"])) {$monitor_active=$_POST["monitor_active"];} if (isset($_GET["monitor_phone"])) {$monitor_phone=$_GET["monitor_phone"];} elseif (isset($_POST["monitor_phone"])) {$monitor_phone=$_POST["monitor_phone"];} if (isset($_GET["ShowCustPhoneCode"])) {$ShowCustPhoneCode=$_GET["ShowCustPhoneCode"];} elseif (isset($_POST["ShowCustPhoneCode"])) {$ShowCustPhoneCode=$_POST["ShowCustPhoneCode"];} if (isset($_GET["CARRIERstats"])) {$CARRIERstats=$_GET["CARRIERstats"];} elseif (isset($_POST["CARRIERstats"])) {$CARRIERstats=$_POST["CARRIERstats"];} if (isset($_GET["PRESETstats"])) {$PRESETstats=$_GET["PRESETstats"];} elseif (isset($_POST["PRESETstats"])) {$PRESETstats=$_POST["PRESETstats"];} if (isset($_GET["AGENTtimeSTATS"])) {$AGENTtimeSTATS=$_GET["AGENTtimeSTATS"];} elseif (isset($_POST["AGENTtimeSTATS"])) {$AGENTtimeSTATS=$_POST["AGENTtimeSTATS"];} if (isset($_GET["AGENTlatency"])) {$AGENTlatency=$_GET["AGENTlatency"];} elseif (isset($_POST["AGENTlatency"])) {$AGENTlatency=$_POST["AGENTlatency"];} if (isset($_GET["INGROUPcolorOVERRIDE"])) {$INGROUPcolorOVERRIDE=$_GET["INGROUPcolorOVERRIDE"];} elseif (isset($_POST["INGROUPcolorOVERRIDE"])) {$INGROUPcolorOVERRIDE=$_POST["INGROUPcolorOVERRIDE"];} if (isset($_GET["RTajax"])) {$RTajax=$_GET["RTajax"];} elseif (isset($_POST["RTajax"])) {$RTajax=$_POST["RTajax"];} if (isset($_GET["RTuser"])) {$RTuser=$_GET["RTuser"];} elseif (isset($_POST["RTuser"])) {$RTuser=$_POST["RTuser"];} if (isset($_GET["RTpass"])) {$RTpass=$_GET["RTpass"];} elseif (isset($_POST["RTpass"])) {$RTpass=$_POST["RTpass"];} if (isset($_GET["user_group_filter"])) {$user_group_filter=$_GET["user_group_filter"];} elseif (isset($_POST["user_group_filter"])) {$user_group_filter=$_POST["user_group_filter"];} if (isset($_GET["ingroup_filter"])) {$ingroup_filter=$_GET["ingroup_filter"];} elseif (isset($_POST["ingroup_filter"])) {$ingroup_filter=$_POST["ingroup_filter"];} if (isset($_GET["inbound_calls_filter"])) {$inbound_calls_filter=$_GET["inbound_calls_filter"];} elseif (isset($_POST["inbound_calls_filter"])) {$inbound_calls_filter=$_POST["inbound_calls_filter"];} if (isset($_GET["droppedOFtotal"])) {$droppedOFtotal=$_GET["droppedOFtotal"];} elseif (isset($_POST["droppedOFtotal"])) {$droppedOFtotal=$_POST["droppedOFtotal"];} if (isset($_GET["report_display_type"])) {$report_display_type=$_GET["report_display_type"];} elseif (isset($_POST["report_display_type"])) {$report_display_type=$_POST["report_display_type"];} if (isset($_GET["mobile_device"])) {$mobile_device=$_GET["mobile_device"];} elseif (isset($_POST["mobile_device"])) {$mobile_device=$_POST["mobile_device"];} if (isset($_GET["parkSTATS"])) {$parkSTATS=$_GET["parkSTATS"];} elseif (isset($_POST["parkSTATS"])) {$parkSTATS=$_POST["parkSTATS"];} if (isset($_GET["SLAinSTATS"])) {$SLAinSTATS=$_GET["SLAinSTATS"];} elseif (isset($_POST["SLAinSTATS"])) {$SLAinSTATS=$_POST["SLAinSTATS"];} $DB=preg_replace("/[^0-9a-zA-Z]/","",$DB); # defaults $RS_BargeSwap=0; $RS_no_DEAD_status=0; $RS_hide_CUST_info=0; if (file_exists('options.php')) { require('options.php'); } header ("Content-type: text/html; charset=utf-8"); $report_name = 'Real-Time Main Report'; $db_source = 'M'; ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### $stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,enable_languages,language_method,agent_whisper_enabled,allow_chats,cache_carrier_stats_realtime,report_default_format,ofcom_uk_drop_calc,enable_pause_code_limits,timeclock_end_of_day,allow_web_debug,enhanced_agent_monitoring FROM system_settings;"; $rslt=mysql_to_mysqli($stmt, $link); #if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysqli_num_rows($rslt); if ($qm_conf_ct > 0) { $row=mysqli_fetch_row($rslt); $non_latin = $row[0]; $outbound_autodial_active = $row[1]; $slave_db_server = $row[2]; $reports_use_slave_db = $row[3]; $SSenable_languages = $row[4]; $SSlanguage_method = $row[5]; $agent_whisper_enabled = $row[6]; $allow_chats = $row[7]; $cache_carrier_stats_realtime = $row[8]; $SSreport_default_format = $row[9]; $SSofcom_uk_drop_calc = $row[10]; $SSenable_pause_code_limits = $row[11]; $SStimeclock_end_of_day = $row[12]; $SSallow_web_debug = $row[13]; $SSenhanced_agent_monitoring = $row[14]; } if ($SSallow_web_debug < 1) {$DB=0;} ##### END SETTINGS LOOKUP ##### ########################################### if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) ) { mysqli_close($link); $use_slave_server=1; $db_source = 'S'; require("dbconnect_mysqli.php"); echo "\n"; } $RS_ListenBarge = 'MONITOR|BARGE|WHISPER'; $RS_agentWAIT = 3; $RS_INcolumnsHIDE = 0; $RS_DIDdesc = 0; if (strlen($RS_report_default_format) > 3) {$SSreport_default_format = $RS_report_default_format;} if (strlen($report_display_type)<2) {$report_display_type = $SSreport_default_format;} if (!isset($DB)) {$DB=0;} if (!isset($RR)) {$RR=40;} if (!isset($group)) {$group='ALL-ACTIVE';} if (!is_array($groups)) {$groups=array();} if (!is_array($user_group_filter)) {$user_group_filter=array();} if (!is_array($ingroup_filter)) {$ingroup_filter=array();} if (!is_array($inbound_calls_filter)) {$inbound_calls_filter=array();} if (!isset($usergroup)) {$usergroup='';} if (!isset($UGdisplay)) {$UGdisplay=0;} # 0=no, 1=yes if (!isset($UidORname)) {$UidORname=1;} # 0=id, 1=name if (!isset($orderby)) {$orderby='timeup';} if (!isset($SERVdisplay)) {$SERVdisplay=0;} # 0=no, 1=yes if (!isset($CALLSdisplay)) {$CALLSdisplay=1;} # 0=no, 1=yes if (!isset($PHONEdisplay)) {$PHONEdisplay=0;} # 0=no, 1=yes if (!isset($CUSTPHONEdisplay)) {$CUSTPHONEdisplay=0;} # 0=no, 1=yes if (!isset($MONITORdisplay)) {$MONITORdisplay=0;} # 0=no, 1=yes if (!isset($CUSTINFOdisplay)) {$CUSTINFOdisplay=0;} # 0=no, 1=yes if ($CUSTINFOdisplay==1) {$CUSTPHONEdisplay=0;} # only one of these should be on at one time if ($CUSTPHONEdisplay==1) {$CUSTINFOdisplay=0;} # only one of these should be on at one time if (!isset($PAUSEcodes)) {$PAUSEcodes='N';} # 0=no, 1=yes if (!isset($with_inbound)) { if ($outbound_autodial_active > 0) {$with_inbound='Y';} # N=no, Y=yes, O=only else {$with_inbound='O';} # N=no, Y=yes, O=only } $ingroup_detail=''; if ( (strlen($group)>1) and (strlen($groups[0])<1) ) {$groups[0] = $group; $RR=40;} else {$group = $groups[0];} function get_server_load($windows = false) { $os = strtolower(PHP_OS); if(strpos($os, "win") === false) { if(file_exists("/proc/loadavg")) { $load = file_get_contents("/proc/loadavg"); $load = explode(' ', $load); return $load[0] . ' ' . $load[1] . ' ' . $load[2]; } elseif(function_exists("shell_exec")) { $load = explode(' ', `uptime`); return $load[count($load)-3] . ' ' . $load[count($load)-2] . ' ' . $load[count($load)-1]; } else { return false; } } elseif($windows) { if(class_exists("COM")) { $wmi = new COM("WinMgmts:\\\\."); $cpus = $wmi->InstancesOf("Win32_Processor"); $cpuload = 0; $i = 0; while ($cpu = $cpus->Next()) { $cpuload += $cpu->LoadPercentage; $i++; } $cpuload = round(MathZDC($cpuload, $i), 2); return "$cpuload%"; } else { return false; } } } $load_ave = get_server_load(true); $NOW_TIME = date("Y-m-d H:i:s"); $NOW_DAY = date("Y-m-d"); $NOW_HOUR = date("H:i:s"); $STARTtime = date("U"); $epochONEminuteAGO = ($STARTtime - 60); $timeONEminuteAGO = date("Y-m-d H:i:s",$epochONEminuteAGO); $epochFIVEminutesAGO = ($STARTtime - 300); $timeFIVEminutesAGO = date("Y-m-d H:i:s",$epochFIVEminutesAGO); $epochFIFTEENminutesAGO = ($STARTtime - 900); $timeFIFTEENminutesAGO = date("Y-m-d H:i:s",$epochFIFTEENminutesAGO); $epochONEhourAGO = ($STARTtime - 3600); $timeONEhourAGO = date("Y-m-d H:i:s",$epochONEhourAGO); $epochSIXhoursAGO = ($STARTtime - 21600); $timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO); $epochTWENTYFOURhoursAGO = ($STARTtime - 86400); $timeTWENTYFOURhoursAGO = date("Y-m-d H:i:s",$epochTWENTYFOURhoursAGO); $timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO); if ($non_latin < 1) { $PHP_AUTH_USER = preg_replace('/[^-_0-9a-zA-Z]/', '', $PHP_AUTH_USER); $PHP_AUTH_PW = preg_replace('/[^-_0-9a-zA-Z]/', '', $PHP_AUTH_PW); } else { $PHP_AUTH_USER = preg_replace('/[^-_0-9\p{L}]/u', '', $PHP_AUTH_USER); $PHP_AUTH_PW = preg_replace('/[^-_0-9\p{L}]/u', '', $PHP_AUTH_PW); } $RR = preg_replace('/[^0-9]/', '', $RR); $inbound = preg_replace('/[^-_0-9a-zA-Z]/', '', $inbound); $group = preg_replace('/[^-_0-9a-zA-Z]/', '', $group); $groups[0] = preg_replace('/[^-_0-9a-zA-Z]/', '', $groups[0]); $usergroup = preg_replace('/[^-_0-9a-zA-Z]/', '', $usergroup); $DB = preg_replace('/[^0-9]/', '', $DB); $adastats = preg_replace('/[^-_0-9a-zA-Z]/', '', $adastats); $SIPmonitorLINK = preg_replace('/[^-_0-9a-zA-Z]/', '', $SIPmonitorLINK); $IAXmonitorLINK = preg_replace('/[^-_0-9a-zA-Z]/', '', $IAXmonitorLINK); $UGdisplay = preg_replace('/[^-_0-9a-zA-Z]/', '', $UGdisplay); $UidORname = preg_replace('/[^-_0-9a-zA-Z]/', '', $UidORname); $orderby = preg_replace('/[^-_0-9a-zA-Z]/', '', $orderby); $SERVdisplay = preg_replace('/[^-_0-9a-zA-Z]/', '', $SERVdisplay); $CALLSdisplay = preg_replace('/[^-_0-9a-zA-Z]/', '', $CALLSdisplay); $PHONEdisplay = preg_replace('/[^-_0-9a-zA-Z]/', '', $PHONEdisplay); $CUSTPHONEdisplay = preg_replace('/[^-_0-9a-zA-Z]/', '', $CUSTPHONEdisplay); $CUSTINFOdisplay = preg_replace('/[^-_0-9a-zA-Z]/', '', $CUSTINFOdisplay); if ($CUSTINFOdisplay==1) {$CUSTPHONEdisplay=0;} # only one of these should be on at one time if ($CUSTPHONEdisplay==1) {$CUSTINFOdisplay=0;} # only one of these should be on at one time $NOLEADSalert = preg_replace('/[^-_0-9a-zA-Z]/', '', $NOLEADSalert); $DROPINGROUPstats = preg_replace('/[^-_0-9a-zA-Z]/', '', $DROPINGROUPstats); $ALLINGROUPstats = preg_replace('/[^-_0-9a-zA-Z]/', '', $ALLINGROUPstats); $with_inbound = preg_replace('/[^-_0-9a-zA-Z]/', '', $with_inbound); $monitor_active = preg_replace('/[^-_0-9a-zA-Z]/', '', $monitor_active); $monitor_phone = preg_replace('/[^-_0-9a-zA-Z]/', '', $monitor_phone); $ShowCustPhoneCode = preg_replace('/[^-_0-9a-zA-Z]/', '', $ShowCustPhoneCode); $CARRIERstats = preg_replace('/[^-_0-9a-zA-Z]/', '', $CARRIERstats); $PRESETstats = preg_replace('/[^-_0-9a-zA-Z]/', '', $PRESETstats); $AGENTtimeSTATS = preg_replace('/[^-_0-9a-zA-Z]/', '', $AGENTtimeSTATS); $AGENTlatency = preg_replace('/[^-_0-9a-zA-Z]/', '', $AGENTlatency); $parkSTATS = preg_replace('/[^-_0-9a-zA-Z]/', '', $parkSTATS); $SLAinSTATS = preg_replace('/[^-_0-9a-zA-Z]/', '', $SLAinSTATS); $INGROUPcolorOVERRIDE = preg_replace('/[^-_0-9a-zA-Z]/', '', $INGROUPcolorOVERRIDE); $droppedOFtotal = preg_replace('/[^-_0-9a-zA-Z]/', '', $droppedOFtotal); $report_display_type = preg_replace('/[^-_0-9a-zA-Z]/', '', $report_display_type); $mobile_device = preg_replace('/[^-_0-9a-zA-Z]/', '', $mobile_device); $RTajax = preg_replace('/[^-_0-9a-zA-Z]/', '', $RTajax); $RTpass = preg_replace('/[^-_0-9a-zA-Z]/', '', $RTpass); $RTuser = preg_replace('/[^-_0-9a-zA-Z]/', '', $RTuser); $server_ip = preg_replace('/[^-\._0-9a-zA-Z]/', '', $server_ip); $SUBMIT = preg_replace('/[^-_0-9a-zA-Z]/', '', $SUBMIT); $submit = preg_replace('/[^-_0-9a-zA-Z]/', '', $submit); # Variables filtered further down in the code # $user_group_filter # $ingroup_filter $stmt="SELECT selected_language from vicidial_users where user='$PHP_AUTH_USER';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_to_mysqli($stmt, $link); $sl_ct = mysqli_num_rows($rslt); if ($sl_ct > 0) { $row=mysqli_fetch_row($rslt); $VUselected_language = $row[0]; } $auth=0; $reports_auth=0; $admin_auth=0; $auth_message = user_authorization($PHP_AUTH_USER,$PHP_AUTH_PW,'REPORTS',0,0); if ( ($auth_message == 'GOOD') or ($auth_message == '2FA') ) { $auth=1; if ($auth_message == '2FA') { header ("Content-type: text/html; charset=utf-8"); echo _QXZ("Your session is expired").". "._QXZ("Click here to log in").".\n"; exit; } } if ($auth > 0) { $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and user_level > 7 and view_reports='1';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_to_mysqli($stmt, $link); $row=mysqli_fetch_row($rslt); $admin_auth=$row[0]; $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and user_level > 6 and view_reports='1';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_to_mysqli($stmt, $link); $row=mysqli_fetch_row($rslt); $reports_auth=$row[0]; if ($reports_auth < 1) { $VDdisplayMESSAGE = _QXZ("You are not allowed to view reports"); Header ("Content-type: text/html; charset=utf-8"); echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n"; exit; } if ( ($reports_auth > 0) and ($admin_auth < 1) ) { $ADD=999999; $reports_only_user=1; } } else { $VDdisplayMESSAGE = _QXZ("Login incorrect, please try again"); if ($auth_message == 'LOCK') { $VDdisplayMESSAGE = _QXZ("Too many login attempts, try again in 15 minutes"); Header ("Content-type: text/html; charset=utf-8"); echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n"; exit; } if ($auth_message == 'IPBLOCK') { $VDdisplayMESSAGE = _QXZ("Your IP Address is not allowed") . ": $ip"; Header ("Content-type: text/html; charset=utf-8"); echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n"; exit; } Header("WWW-Authenticate: Basic realm=\"CONTACT-CENTER-ADMIN\""); Header("HTTP/1.0 401 Unauthorized"); echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$PHP_AUTH_PW|$auth_message|\n"; exit; } $stmt="SELECT user_id,user,pass,full_name,user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override,qc_enabled,qc_user_level,qc_pass,qc_finish,qc_commit,add_timeclock_log,modify_timeclock_log,delete_timeclock_log,alter_custphone_override,vdc_agent_api_access,modify_inbound_dids,delete_inbound_dids,active,alert_enabled,download_lists,agent_shift_enforcement_override,manager_shift_enforcement_override,shift_override_flag,export_reports,delete_from_dnc,email,user_code,territory,allow_alerts,callcard_admin,force_change_password,modify_shifts,modify_phones,modify_carriers,modify_labels,modify_statuses,modify_voicemail,modify_audiostore,modify_moh,modify_tts,modify_contacts,modify_same_user_level from vicidial_users where user='$PHP_AUTH_USER';"; $rslt=mysql_to_mysqli($stmt, $link); $row=mysqli_fetch_row($rslt); $LOGfull_name =$row[3]; $LOGuser_level =$row[4]; $LOGuser_group =$row[5]; $LOGdelete_users =$row[8]; $LOGdelete_user_groups =$row[9]; $LOGdelete_lists =$row[10]; $LOGdelete_campaigns =$row[11]; $LOGdelete_ingroups =$row[12]; $LOGdelete_remote_agents =$row[13]; $LOGload_leads =$row[14]; $LOGcampaign_detail =$row[15]; $LOGast_admin_access =$row[16]; $LOGast_delete_phones =$row[17]; $LOGdelete_scripts =$row[18]; $LOGdelete_filters =$row[29]; $LOGalter_agent_interface =$row[30]; $LOGdelete_call_times =$row[32]; $LOGmodify_call_times =$row[33]; $LOGmodify_users =$row[34]; $LOGmodify_campaigns =$row[35]; $LOGmodify_lists =$row[36]; $LOGmodify_scripts =$row[37]; $LOGmodify_filters =$row[38]; $LOGmodify_ingroups =$row[39]; $LOGmodify_usergroups =$row[40]; $LOGmodify_remoteagents =$row[41]; $LOGmodify_servers =$row[42]; $LOGview_reports =$row[43]; $LOGmodify_dids =$row[56]; $LOGdelete_dids =$row[57]; $LOGmanager_shift_enforcement_override=$row[61]; $LOGexport_reports =$row[64]; $LOGdelete_from_dnc =$row[65]; $LOGcallcard_admin =$row[70]; $LOGforce_change_password =$row[71]; $LOGmodify_shifts =$row[72]; $LOGmodify_phones =$row[73]; $LOGmodify_carriers =$row[74]; $LOGmodify_labels =$row[75]; $LOGmodify_statuses =$row[76]; $LOGmodify_voicemail =$row[77]; $LOGmodify_audiostore =$row[78]; $LOGmodify_moh =$row[79]; $LOGmodify_tts =$row[80]; $LOGmodify_contacts =$row[81]; $LOGmodify_same_user_level =$row[82]; $stmt="SELECT allowed_campaigns,allowed_reports,admin_viewable_groups,admin_viewable_call_times from vicidial_user_groups where user_group='$LOGuser_group';"; $rslt=mysql_to_mysqli($stmt, $link); $row=mysqli_fetch_row($rslt); $LOGallowed_campaigns = $row[0]; $LOGallowed_reports = $row[1]; $LOGadmin_viewable_groups = $row[2]; $LOGadmin_viewable_call_times = $row[3]; $LOGadmin_viewable_groupsSQL=''; $valLOGadmin_viewable_groupsSQL=''; $vmLOGadmin_viewable_groupsSQL=''; if ( (!preg_match('/\-\-ALL\-\-/i',$LOGadmin_viewable_groups)) and (strlen($LOGadmin_viewable_groups) > 3) ) { $rawLOGadmin_viewable_groupsSQL = preg_replace("/ -/",'',$LOGadmin_viewable_groups); $rawLOGadmin_viewable_groupsSQL = preg_replace("/ /","','",$rawLOGadmin_viewable_groupsSQL); $LOGadmin_viewable_groupsSQL = "and user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')"; $whereLOGadmin_viewable_groupsSQL = "where user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')"; $valLOGadmin_viewable_groupsSQL = "and val.user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')"; $vmLOGadmin_viewable_groupsSQL = "and vm.user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')"; } else {$admin_viewable_groupsALL=1;} $RS_UGlatencyALLOWED=0; if (strlen($RS_UGlatencyRESTRICT) > 0) { $latencyUGary = preg_split('/\|/',$RS_UGlatencyRESTRICT); foreach( $latencyUGary as $lineUGR ) { if ($lineUGR == $LOGuser_group) {$RS_UGlatencyALLOWED++;} } } else {$RS_UGlatencyALLOWED=1;} # and (preg_match("/MONITOR|BARGE|HIJACK|WHISPER/",$monitor_active) ) ) if ( (!isset($monitor_phone)) or (strlen($monitor_phone)<1) ) { $stmt="SELECT phone_login from vicidial_users where user='$PHP_AUTH_USER';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $row=mysqli_fetch_row($rslt); $monitor_phone = $row[0]; } $stmt="SELECT realtime_block_user_info,user_group,admin_hide_lead_data,admin_hide_phone_data from vicidial_users where user='$PHP_AUTH_USER';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_to_mysqli($stmt, $link); $row=mysqli_fetch_row($rslt); $realtime_block_user_info = $row[0]; $LOGuser_group = $row[1]; $LOGadmin_hide_lead_data = $row[2]; $LOGadmin_hide_phone_data = $row[3]; $stmt="SELECT allowed_campaigns,allowed_reports,allowed_custom_reports from vicidial_user_groups where user_group='$LOGuser_group';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_to_mysqli($stmt, $link); $row=mysqli_fetch_row($rslt); $LOGallowed_campaigns = $row[0]; $LOGallowed_reports = "$row[1]|$row[2]"; if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL REPORTS/",$LOGallowed_reports)) ) { Header("WWW-Authenticate: Basic realm=\"CONTACT-CENTER-ADMIN\""); Header("HTTP/1.0 401 Unauthorized"); echo _QXZ("You are not allowed to view this report").": |$PHP_AUTH_USER|$report_name|"._QXZ("$report_name")."|\n"; exit; } $LOGallowed_campaignsSQL=''; $whereLOGallowed_campaignsSQL=''; if ( (!preg_match("/ALL-/",$LOGallowed_campaigns)) ) { $rawLOGallowed_campaignsSQL = preg_replace("/ -/",'',$LOGallowed_campaigns); $rawLOGallowed_campaignsSQL = preg_replace("/ /","','",$rawLOGallowed_campaignsSQL); $LOGallowed_campaignsSQL = "and campaign_id IN('$rawLOGallowed_campaignsSQL')"; $whereLOGallowed_campaignsSQL = "where campaign_id IN('$rawLOGallowed_campaignsSQL')"; } $regexLOGallowed_campaigns = " $LOGallowed_campaigns "; $allactivecampaigns=''; $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns where active='Y' $LOGallowed_campaignsSQL order by campaign_id;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $groups_to_print = mysqli_num_rows($rslt); $i=0; $LISTgroups=array(); $LISTnames=array(); $LISTgroups[$i]='ALL-ACTIVE'; $i++; $groups_to_print++; while ($i < $groups_to_print) { $row=mysqli_fetch_row($rslt); $LISTgroups[$i] =$row[0]; $LISTnames[$i] =$row[1]; $allactivecampaigns .= "'$LISTgroups[$i]',"; $i++; } $allactivecampaigns .= "''"; $i=0; $group_string='|'; $group_ct = count($groups); while($i < $group_ct) { $groups[$i] = preg_replace("/'|\"|\\\\|;/","",$groups[$i]); if ( (preg_match("/ $groups[$i] /",$regexLOGallowed_campaigns)) or (preg_match("/ALL-/",$LOGallowed_campaigns)) ) { $group_string .= "$groups[$i]|"; $group_SQL .= "'$groups[$i]',"; $groupQS .= "&groups[]=$groups[$i]"; } $i++; } $group_SQL = preg_replace('/,$/i', '',$group_SQL); $i=0; $user_group_string='|'; $user_group_ct = count($user_group_filter); while($i < $user_group_ct) { $user_group_filter[$i] = preg_replace("/'|\"|\\\\|;/","",$user_group_filter[$i]); # if ( (preg_match("/ $user_group_filter[$i] /",$regexLOGallowed_campaigns)) or (preg_match("/ALL-/",$LOGallowed_campaigns)) ) # { $user_group_string .= "$user_group_filter[$i]|"; $user_group_SQL .= "'$user_group_filter[$i]',"; $usergroupQS .= "&user_group_filter[]=$user_group_filter[$i]"; # } $i++; } $user_group_SQL = preg_replace('/,$/i', '',$user_group_SQL); $i=0; $ingroup_string='|'; $ingroup_ct = count($ingroup_filter); while($i < $ingroup_ct) { $ingroup_filter[$i] = preg_replace('/[^-_0-9a-zA-Z]/', '', $ingroup_filter[$i]); $ingroup_string .= "$ingroup_filter[$i]|"; $ingroup_SQL .= "'$ingroup_filter[$i]',"; $ingroupQS .= "&ingroup_filter[]=$ingroup_filter[$i]"; $i++; } $ingroup_SQL = preg_replace('/,$/i', '',$ingroup_SQL); #if ($DB > 0) {echo "INBOUND INPUT DEBUG: |$ingroup_ct|$ingroup_string|\n";} $i=0; $inbound_calls_string='|'; $inbound_calls_ct = count($inbound_calls_filter); while($i < $inbound_calls_ct) { $inbound_calls_filter[$i] = preg_replace('/[^-_0-9a-zA-Z]/', '', $inbound_calls_filter[$i]); $inbound_calls_string .= "$inbound_calls_filter[$i]|"; $inbound_calls_SQL .= "'$inbound_calls_filter[$i]',"; $inbound_callsQS .= "&inbound_calls_filter[]=$inbound_calls_filter[$i]"; $i++; } $inbound_calls_SQL = preg_replace('/,$/i', '',$inbound_calls_SQL); ### if no campaigns selected, display all if ( ($group_ct < 1) or (strlen($group_string) < 2) ) { $groups[0] = 'ALL-ACTIVE'; $group_string = '|ALL-ACTIVE|'; $group = 'ALL-ACTIVE'; $groupQS .= "&groups[]=ALL-ACTIVE"; } ### if no user groups selected, display all if ( ($user_group_ct < 1) or (strlen($user_group_string) < 2) ) { $user_group_filter[0] = 'ALL-GROUPS'; $user_group_string = '|ALL-GROUPS|'; $usergroupQS .= "&user_group_filter[]=ALL-GROUPS"; } ### if no ingroups selected, display all $ingroup_none=0; if ( ($ingroup_ct < 1) or (strlen($ingroup_string) < 2) ) { $ingroup_filter[0] = 'ALL-INGROUPS'; $ingroup_string = '|ALL-INGROUPS|'; $ingroupQS .= "&ingroup_filter[]=ALL-INGROUPS"; $ingroup_none=1; } ### if no inbound call counts selected, display all $inbound_calls_none=0; if ( ($inbound_calls_ct < 1) or (strlen($inbound_calls_string) < 2) ) { $inbound_calls_filter[0] = 'ALL-INGROUPS'; $inbound_calls_string = '|ALL-INGROUPS|'; $inbound_callsQS .= "&inbound_calls_filter[]=ALL-INGROUPS"; $inbound_calls_none=1; } if ( (preg_match('/\s\-\-NONE\-\-\s/',$group_string) ) or ($group_ct < 1) ) { $all_active = 0; $group_SQL = "''"; $group_SQLand = "and FALSE"; $group_SQLwhere = "where FALSE"; } elseif ( preg_match('/ALL\-ACTIVE/i',$group_string) ) { $all_active = 1; $group_SQL = $allactivecampaigns; $group_SQLand = "and campaign_id IN($allactivecampaigns)"; $group_SQLwhere = "where campaign_id IN($allactivecampaigns)"; } else { $all_active = 0; $group_SQLand = "and campaign_id IN($group_SQL)"; $group_SQLwhere = "where campaign_id IN($group_SQL)"; } ### USER GROUP STUFF if ( (preg_match('/\s\-\-NONE\-\-\s/',$user_group_string) ) or ($user_group_ct < 1) ) { $all_active_groups = 0; $user_group_SQL = "''"; # $user_group_SQLand = "and FALSE"; # $user_group_SQLwhere = "where FALSE"; } elseif ( preg_match('/ALL\-GROUPS/i',$user_group_string) ) { $all_active_groups = 1; # $user_group_SQL = ''; $user_group_SQL = "'$rawLOGadmin_viewable_groupsSQL'"; # $group_SQLand = "and campaign_id IN($allactivecampaigns)"; # $group_SQLwhere = "where campaign_id IN($allactivecampaigns)"; } else { $all_active_groups = 0; # $user_group_SQLand = "and user_group IN($user_group_SQL)"; # $user_group_SQLwhere = "where user_group IN($user_group_SQL)"; } if ( (preg_match('/\s\-\-NONE\-\-\s/',$ingroup_string) ) or ($ingroup_ct < 1) ) { $all_active_ingroups = 0; $ingroup_SQL = "''"; } elseif ( preg_match('/ALL\-INGROUPS/i',$ingroup_string) ) { $all_active_ingroups = 1; $ingroup_SQL = "'$rawLOGadmin_viewable_groupsSQL'"; $ingroup_SQLand = "and campaign_id IN($rawLOGadmin_viewable_groupsSQL)"; $ingroup_SQLwhere = "where campaign_id IN($rawLOGadmin_viewable_groupsSQL)"; } else { $all_active_ingroups = 0; } if ( (preg_match('/\s\-\-NONE\-\-\s/',$inbound_calls_string) ) or ($inbound_calls_ct < 1) ) { $all_active_inbound_call_groups = 0; $inbound_calls_SQL = "''"; } elseif ( preg_match('/ALL\-INGROUPS/i',$inbound_calls_string) ) { if (preg_match('/\-\-\-ALL\-\-\-/', $LOGadmin_viewable_groups)) { $all_active_inbound_calls = 1; } else { $inbound_calls_SQL = "'$rawLOGadmin_viewable_groupsSQL'"; $inbound_calls_SQLand = "and campaign_id IN($rawLOGadmin_viewable_groupsSQL)"; $inbound_calls_SQLwhere = "where campaign_id IN($rawLOGadmin_viewable_groupsSQL)"; } } $stmt="SELECT user_group from vicidial_user_groups $whereLOGadmin_viewable_groupsSQL order by user_group;"; $rslt=mysql_to_mysqli($stmt, $link); if (!isset($DB)) {$DB=0;} if ($DB) {echo "$stmt\n";} $usergroups_to_print = mysqli_num_rows($rslt); $i=0; $usergroups=array(); $usergroupnames=array(); $usergroups[$i]='ALL-GROUPS'; $usergroupnames[$i] = 'All user groups'; $i++; $usergroups_to_print++; while ($i < $usergroups_to_print) { $row=mysqli_fetch_row($rslt); $usergroups[$i] =$row[0]; $i++; } $stmt="select group_id,group_name from vicidial_inbound_groups $whereLOGadmin_viewable_groupsSQL order by group_id;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $ingroups_to_print = mysqli_num_rows($rslt); $i=0; $LISTingroups=array(); $LISTingroup_names=array(); $LISTingroups[$i]='ALL-INGROUPS'; $i++; $ingroups_to_print++; $ingroups_string='|'; while ($i < $ingroups_to_print) { $row=mysqli_fetch_row($rslt); $LISTingroups[$i] = $row[0]; $LISTingroup_names[$i] = $row[1]; $ingroups_string .= "$LISTingroups[$i]|"; $i++; } if (!isset($RR)) {$RR=4;} if (isset($RS_CUSTINFOminUL)) { $CUSTINFOminUL = $RS_CUSTINFOminUL; } else {$CUSTINFOminUL = 9;} if ($LOGuser_level < $CUSTINFOminUL) {$CUSTINFOdisplay=0;} require("screen_colors.php"); $NFB = ''; $NFE = ''; $F=''; $FG=''; $B=''; $BG=''; $select_list = ""; $select_list .= ""; $select_list .= "
"._QXZ("Select Campaigns").":
"; $select_list .= ""; $select_list .= "
"._QXZ("(To select more than 1 campaign, hold down the Ctrl key and click)").""; $select_list .= "

"._QXZ("Select User Groups").":
"; $select_list .= ""; $select_list .= "

"._QXZ("Select In-Groups").":
"; $select_list .= ""; $select_list .= "
"; $select_list .= ""._QXZ("Close Panel")."

"; $select_list .= ""; $select_list .= ""; $select_list .= ""; $select_list .= ""; if ($UGdisplay > 0) { $select_list .= ""; } $select_list .= ""; $select_list .= ""; $select_list .= ""; $select_list .= ""; $select_list .= ""; ## find if any selected campaigns have presets enabled $presets_enabled=0; $stmt="SELECT count(*) from vicidial_campaigns where enable_xfer_presets='ENABLED' $group_SQLand;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$OUToutput .= "$stmt\n";} $presets_enabled_count = mysqli_num_rows($rslt); if ($presets_enabled_count > 0) { $row=mysqli_fetch_row($rslt); $presets_enabled = $row[0]; } if ($presets_enabled > 0) { $select_list .= ""; } $select_list .= ""; if ($RS_UGlatencyALLOWED > 0) { $select_list .= ""; } $select_list .= ""; $select_list .= ""; $select_list .= "
"; $select_list .= _QXZ("Inbound").":
"; $select_list .= _QXZ("Monitor").": "; $select_list .= ""; $select_list .= "
 
"; $select_list .= _QXZ("Select User Group").": "; $select_list .= "
"; $select_list .= _QXZ("Dialable Leads Alert").":
"; $select_list .= _QXZ("Show Drop In-Group Row").":
"; $select_list .= _QXZ("Inbound SLA Stats").":
"; $select_list .= _QXZ("Show Cust Phone Code").":
"; $select_list .= _QXZ("Show Carrier Stats").":
"; $select_list .= _QXZ("Show Presets Stats").":
"; $select_list .= _QXZ("Agent Time Stats").":
"; $select_list .= _QXZ("Agent Latency").":
"; $select_list .= _QXZ("Parked Call Stats").":
"; $select_list .= _QXZ("Display as").":

"; $select_list .= ""; $select_list .= "         "; $select_list .= "
"; $select_list .= "   "; $select_list .= ""; $select_list .= ""._QXZ("VERSION").": $version   "._QXZ("BUILD").": $build"; $select_list .= "
"; $open_list = '
'._QXZ("Choose Report Display Options").'
'; ?> 0) { echo "\n"; } else { ?> \n"; \n"; echo"\n"; echo "$report_name: $group\n"; $short_header=1; require("admin_header.php"); } $stmt = "SELECT count(*) from vicidial_campaigns where active='Y' and campaign_allow_inbound='Y' $group_SQLand;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $row=mysqli_fetch_row($rslt); $campaign_allow_inbound = $row[0]; if ($RTajax < 1) { echo ""; $DROPINGROUPstatsHTML .= ""; $DROPINGROUPstatsHTML .= ""; $DROPINGROUPstatsHTML .= ""; $DROPINGROUPstatsHTML .= ""; $DROPINGROUPstatsHTML .= ""; } ##### CARRIER STATS TOTALS ### $CARRIERstatsHTML=''; if ($CARRIERstats > 0) { $TFhour_status=array(); $TFhour_count=array(); $TFhour_total=0; $SIXhour_count=array(); $ONEhour_count=array(); $FTminute_count=array(); $FIVEminute_count=array(); $ONEminute_count=array(); if ($cache_carrier_stats_realtime > 0) { $stmtB="SELECT stats_html from vicidial_html_cache_stats where stats_type='carrier_stats' and stats_id='ALL';"; if ($DB > 0) {echo "\n|$stmtB|\n";} $rslt=mysql_to_mysqli($stmtB, $link); $csh_to_print = mysqli_num_rows($rslt); if ($csh_to_print > 0) { $row=mysqli_fetch_row($rslt); $CARRIERstatsHTML = $row[0]; } } else { $stmtB="SELECT dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeTWENTYFOURhoursAGO\" group by dialstatus;"; if ($DB > 0) {echo "\n|$stmtB|\n";} $rslt=mysql_to_mysqli($stmtB, $link); $car_to_print = mysqli_num_rows($rslt); $ctp=0; while ($car_to_print > $ctp) { $row=mysqli_fetch_row($rslt); $TFhour_status[$ctp] = $row[0]; $TFhour_count[$ctp] = $row[1]; $TFhour_total+=$row[1]; $dialstatuses .= "'$row[0]',"; $ctp++; } $dialstatuses = preg_replace("/,$/",'',$dialstatuses); $CARRIERstatsHTML .= ""; } } ##### PRESET STATS TOTALS ### $PRESETstatsHTML=''; if ($PRESETstats > 0) { $PRESETstatsHTML .= ""; } # http://server/vicidial/AST_timeonVDADall.php?&groups[]=ALL-ACTIVE&RR=4000&DB=0&adastats=&SIPmonitorLINK=&IAXmonitorLINK=&usergroup=&UGdisplay=1&UidORname=1&orderby=timeup&SERVdisplay=0&CALLSdisplay=1&PHONEdisplay=0&CUSTPHONEdisplay=0&with_inbound=Y&monitor_active=&monitor_phone=350a&ALLINGROUPstats=1&DROPINGROUPstats=0&NOLEADSalert=&CARRIERstats=1 if ( (preg_match('/O/',$with_inbound)) or ($SLAinSTATS > 0) or ($report_display_type=='LIMITED') ) { $stmt="SELECT count(*) from vicidial_campaigns where agent_pause_codes_active!='N' $group_SQLand;"; $stmtB="SELECT sum(calls_today),sum(drops_today),$answersSQL,max(status_category_1),sum(status_category_count_1),max(status_category_2),sum(status_category_count_2),max(status_category_3),sum(status_category_count_3),max(status_category_4),sum(status_category_count_4),sum(hold_sec_stat_one),sum(hold_sec_stat_two),sum(hold_sec_answer_calls),sum(hold_sec_drop_calls),sum(hold_sec_queue_calls) from vicidial_campaign_stats where campaign_id IN ($closer_campaignsSQL);"; if (preg_match('/ALL\-ACTIVE/i',$group_string)) { $inboundSQL = "where campaign_id IN ($closer_campaignsSQL)"; $stmtB="SELECT sum(calls_today),sum(drops_today),$answersSQL,max(status_category_1),sum(status_category_count_1),max(status_category_2),sum(status_category_count_2),max(status_category_3),sum(status_category_count_3),max(status_category_4),sum(status_category_count_4),sum(hold_sec_stat_one),sum(hold_sec_stat_two),sum(hold_sec_answer_calls),sum(hold_sec_drop_calls),sum(hold_sec_queue_calls) from vicidial_campaign_stats $inboundSQL;"; } $stmtC="SELECT agent_non_pause_sec from vicidial_campaign_stats $group_SQLwhere;"; if ($DB > 0) {echo "\n|$stmt|$stmtB|$stmtC|\n";} $rslt=mysql_to_mysqli($stmt, $link); $row=mysqli_fetch_row($rslt); $agent_pause_codes_active = $row[0]; $rslt=mysql_to_mysqli($stmtC, $link); $row=mysqli_fetch_row($rslt); $agent_non_pause_sec = $row[0]; $rslt=mysql_to_mysqli($stmtB, $link); $row=mysqli_fetch_row($rslt); $callsTODAY = $row[0]; $dropsTODAY = $row[1]; $answersTODAY = $row[2]; $VSCcat1 = $row[3]; $VSCcat1tally = $row[4]; $VSCcat2 = $row[5]; $VSCcat2tally = $row[6]; $VSCcat3 = $row[7]; $VSCcat3tally = $row[8]; $VSCcat4 = $row[9]; $VSCcat4tally = $row[10]; $hold_sec_stat_one = $row[11]; $hold_sec_stat_two = $row[12]; $hold_sec_answer_calls = $row[13]; $hold_sec_drop_calls = $row[14]; $hold_sec_queue_calls = $row[15]; $drpctTODAY = ( MathZDC($dropsTODAY, $answersTODAY) * 100); $drpctTODAY = round($drpctTODAY, 2); $drpctTODAY = sprintf("%01.2f", $drpctTODAY); $AVGhold_sec_queue_calls = MathZDC($hold_sec_queue_calls, $callsTODAY); $AVGhold_sec_queue_calls = round($AVGhold_sec_queue_calls, 0); $AVGhold_sec_drop_calls = MathZDC($hold_sec_drop_calls, $dropsTODAY); $AVGhold_sec_drop_calls = round($AVGhold_sec_drop_calls, 0); $PCThold_sec_stat_one = ( MathZDC($hold_sec_stat_one, $answersTODAY) * 100); $PCThold_sec_stat_one = round($PCThold_sec_stat_one, 2); $PCThold_sec_stat_one = sprintf("%01.2f", $PCThold_sec_stat_one); $PCThold_sec_stat_two = ( MathZDC($hold_sec_stat_two, $answersTODAY) * 100); $PCThold_sec_stat_two = round($PCThold_sec_stat_two, 2); $PCThold_sec_stat_two = sprintf("%01.2f", $PCThold_sec_stat_two); $AVGhold_sec_answer_calls = MathZDC($hold_sec_answer_calls, $answersTODAY); $AVGhold_sec_answer_calls = round($AVGhold_sec_answer_calls, 0); $AVG_ANSWERagent_non_pause_sec = (MathZDC($answersTODAY, $agent_non_pause_sec) * 60); $AVG_ANSWERagent_non_pause_sec = round($AVG_ANSWERagent_non_pause_sec, 2); $AVG_ANSWERagent_non_pause_sec = sprintf("%01.2f", $AVG_ANSWERagent_non_pause_sec); } ##### INBOUND ONLY ### if (preg_match('/O/',$with_inbound)) { $multi_drop++; if ( ($report_display_type!='WALL_1') and ($report_display_type!='WALL_2') and ($report_display_type!='WALL_3') and ($report_display_type!='WALL_4') and !$mobile_device) { echo "
"; echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo _QXZ("$report_name")."                                                                               \n"; echo "\n"; echo "
\n"; echo ""._QXZ("Choose Report Display Options").""; echo "
\n"; echo "
\n"; echo "\n"; echo "   "; echo "\n"; echo ""._QXZ("STOP")." | "; echo ""._QXZ("SLOW")." | "; echo ""._QXZ("GO").""; if (preg_match('/ALL\-ACTIVE/i',$group_string)) { echo "       "._QXZ("MODIFY")." | \n"; } else { echo "       "._QXZ("MODIFY")." | \n"; } echo ""._QXZ("SUMMARY")." \n"; echo "\n\n"; } if (!$group) {echo "

"._QXZ("please select a campaign from the pulldown above")."
\n"; exit;} else { $multi_drop=0; ### Gather list of all Closer group ids for exclusion from stats $stmt = "SELECT group_id from vicidial_inbound_groups;"; $rslt=mysql_to_mysqli($stmt, $link); $ingroups_to_print = mysqli_num_rows($rslt); $c=0; while ($ingroups_to_print > $c) { $row=mysqli_fetch_row($rslt); $ALLcloser_campaignsSQL .= "'$row[0]',"; $c++; } $ALLcloser_campaignsSQL = preg_replace("/,$/","",$ALLcloser_campaignsSQL); if (strlen($ALLcloser_campaignsSQL)<2) {$ALLcloser_campaignsSQL="''";} if ($DB > 0) {echo "\n|$ALLcloser_campaignsSQL|$stmt|\n";} ##### INBOUND ##### if ( ( preg_match('/Y/',$with_inbound) or preg_match('/O/',$with_inbound) ) and ($campaign_allow_inbound > 0) ) { $closer_campaignsSQL = ""; ### Gather list of Closer group ids $stmt = "SELECT closer_campaigns from vicidial_campaigns where active='Y' $group_SQLand;"; $rslt=mysql_to_mysqli($stmt, $link); $ccamps_to_print = mysqli_num_rows($rslt); $c=0; while ($ccamps_to_print > $c) { $row=mysqli_fetch_row($rslt); $closer_campaigns = $row[0]; $closer_campaigns_STRING = preg_replace("/^ | -$/","",$closer_campaigns); $closer_campaigns = preg_replace("/ /","','",$closer_campaigns_STRING); $closer_campaignsSQL .= "'$closer_campaigns',"; $c++; } # Clean up closer campaigns $filter_closer_campaigns_STRING=''; if (!in_array("ALL-INGROUPS", $ingroup_filter)) { $filter_closer_campaigns=''; for ($q=0; $q 0) {echo "\nINBOUND FILTER DEBUG: |$q|$ingroup_filter[$q]|$filter_closer_campaigns_STRING|\n";} } $closer_campaignsSQL=$filter_closer_campaigns; } $closer_campaignsSQL = preg_replace("/,$/","",$closer_campaignsSQL); } if (strlen($closer_campaignsSQL)<2) {$closer_campaignsSQL="''";} if ($DB > 0) {echo "\nINBOUND DEBUG: |$closer_campaigns|$closer_campaignsSQL|$filter_closer_campaigns_STRING|$stmt|\n";} $answersSQL = 'sum(answers_today)'; $answers_singleSQL = 'answers_today'; $answers_text = _QXZ("ANSWERED"); if ($droppedOFtotal > 0) { $answersSQL = 'sum(calls_today)'; $answers_singleSQL = 'calls_today'; $answers_text = _QXZ("TOTAL").' '; } ##### SHOW IN-GROUP STATS OR INBOUND ONLY WITH VIEW-MORE ### if ( ($ALLINGROUPstats > 0) or ( (preg_match('/O/',$with_inbound)) and ($adastats > 1) ) ) { $stmtB="SELECT campaign_id from vicidial_campaign_stats where campaign_id IN ($closer_campaignsSQL) order by campaign_id;"; if ($DB > 0) {echo "\n|$stmtB|\n";} $r=0; $rslt=mysql_to_mysqli($stmtB, $link); $ingroups_to_print = mysqli_num_rows($rslt); if ($ingroups_to_print > 0) {$ingroup_detail .= "";} while ($ingroups_to_print > $r) { $row=mysqli_fetch_row($rslt); $ARYingroupdetail[$r] = $row[0]; $r++; } $r=0; while ($ingroups_to_print > $r) { $stmtB="SELECT calls_today,drops_today,$answers_singleSQL,status_category_1,status_category_count_1,status_category_2,status_category_count_2,status_category_3,status_category_count_3,status_category_4,status_category_count_4,hold_sec_stat_one,hold_sec_stat_two,hold_sec_answer_calls,hold_sec_drop_calls,hold_sec_queue_calls,campaign_id from vicidial_campaign_stats where campaign_id='$ARYingroupdetail[$r]';"; if ($DB > 0) {echo "\n|$stmtB|\n";} $rslt=mysql_to_mysqli($stmtB, $link); $ingroup_to_print = mysqli_num_rows($rslt); if ($ingroup_to_print > 0) { $row=mysqli_fetch_row($rslt); $callsTODAY = $row[0]; $dropsTODAY = $row[1]; $answersTODAY = $row[2]; $VSCcat1 = $row[3]; $VSCcat1tally = $row[4]; $VSCcat2 = $row[5]; $VSCcat2tally = $row[6]; $VSCcat3 = $row[7]; $VSCcat3tally = $row[8]; $VSCcat4 = $row[9]; $VSCcat4tally = $row[10]; $hold_sec_stat_one = $row[11]; $hold_sec_stat_two = $row[12]; $hold_sec_answer_calls = $row[13]; $hold_sec_drop_calls = $row[14]; $hold_sec_queue_calls = $row[15]; $ingroupdetail = $row[16]; } $drpctTODAY = ( MathZDC($dropsTODAY, $answersTODAY) * 100); $drpctTODAY = round($drpctTODAY, 2); $drpctTODAY = sprintf("%01.2f", $drpctTODAY); $AVGhold_sec_queue_calls = MathZDC($hold_sec_queue_calls, $callsTODAY); $AVGhold_sec_queue_calls = round($AVGhold_sec_queue_calls, 0); $AVGhold_sec_drop_calls = MathZDC($hold_sec_drop_calls, $dropsTODAY); $AVGhold_sec_drop_calls = round($AVGhold_sec_drop_calls, 0); $PCThold_sec_stat_one = ( MathZDC($hold_sec_stat_one, $answersTODAY) * 100); $PCThold_sec_stat_one = round($PCThold_sec_stat_one, 2); $PCThold_sec_stat_one = sprintf("%01.2f", $PCThold_sec_stat_one); $PCThold_sec_stat_two = ( MathZDC($hold_sec_stat_two, $answersTODAY) * 100); $PCThold_sec_stat_two = round($PCThold_sec_stat_two, 2); $PCThold_sec_stat_two = sprintf("%01.2f", $PCThold_sec_stat_two); $AVGhold_sec_answer_calls = MathZDC($hold_sec_answer_calls, $answersTODAY); $AVGhold_sec_answer_calls = round($AVGhold_sec_answer_calls, 0); $AVG_ANSWERagent_non_pause_sec = (MathZDC($answersTODAY, $agent_non_pause_sec) * 60); $AVG_ANSWERagent_non_pause_sec = round($AVG_ANSWERagent_non_pause_sec, 2); $AVG_ANSWERagent_non_pause_sec = sprintf("%01.2f", $AVG_ANSWERagent_non_pause_sec); $Dicbq_stmt="SELECT count(*) from vicidial_inbound_callback_queue where icbq_status='LIVE' and group_id='$ARYingroupdetail[$r]';"; $Dicbq_rslt=mysql_to_mysqli($Dicbq_stmt, $link); $Dicbq_ct = mysqli_num_rows($Dicbq_rslt); $Dicbq_live=0; if ($Dicbq_ct > 0) { $Dicbq_ARY=mysqli_fetch_row($Dicbq_rslt); if ($Dicbq_ARY[0] > 0) { $Dicbq_live = "$Dicbq_ARY[0]"; } } if (preg_match('/0$|2$|4$|6$|8$/',$r)) {$bgcolor='#E6E6E6';} else {$bgcolor='white';} $ingroup_detail .= ""; $ingroup_detail .= ""; $ingroup_detail .= ""; $ingroup_detail .= ""; $ingroup_detail .= ""; $ingroup_detail .= ""; $ingroup_detail .= ""; $ingroup_detail .= ""; $ingroup_detail .= ""; $ingroup_detail .= ""; $ingroup_detail .= ""; $ingroup_detail .= ""; $ingroup_detail .= ""; $ingroup_detail .= ""; $ingroup_detail .= ""; $ingroup_detail .= ""; $ingroup_detail .= ""; $ingroup_detail .= ""; $ingroup_detail .= ""; $ingroup_detail .= ""; $ingroup_detail .= ""; $ingroup_detail .= ""; $r++; } if ($ingroups_to_print > 0) {$ingroup_detail .= "
        $ingroupdetail   "._QXZ("CALLS TODAY").":  $callsTODAY    "._QXZ("TMA")." 1  $PCThold_sec_stat_one%     "._QXZ("Average Hold time for Answered Calls").":  $AVGhold_sec_answer_calls     "._QXZ("LIVE Inbound Callback Queue Calls").":  $Dicbq_live  
"._QXZ("DROPS TODAY").":  $dropsTODAY    "._QXZ("TMA")." 2:  $PCThold_sec_stat_two%     "._QXZ("Average Hold time for Dropped Calls").":  $AVGhold_sec_drop_calls  
"._QXZ("ANSWERS TODAY").":  $answersTODAY    "._QXZ("DROP PERCENT").":  $drpctTODAY%    "._QXZ("Average Hold time for All Calls").":  $AVGhold_sec_queue_calls  
";} } ##### DROP IN-GROUP ONLY TOTALS ROW ### $DROPINGROUPstatsHTML=''; if ( ($DROPINGROUPstats > 0) and (!preg_match("/ALL-ACTIVE/",$group_string)) ) { $DIGcampaigns=''; $stmtB="SELECT drop_inbound_group from vicidial_campaigns where campaign_id IN($group_SQL) and drop_inbound_group NOT IN('---NONE---','');"; if ($DB > 0) {echo "\n|$stmtB|\n";} $rslt=mysql_to_mysqli($stmtB, $link); $dig_to_print = mysqli_num_rows($rslt); $dtp=0; while ($dig_to_print > $dtp) { $row=mysqli_fetch_row($rslt); $DIGcampaigns .= "'$row[0]',"; $dtp++; } $DIGcampaigns = preg_replace("/,$/",'',$DIGcampaigns); if (strlen($DIGcampaigns) < 2) {$DIGcampaigns = "''";} $stmtB="SELECT sum(calls_today),sum(drops_today),$answersSQL from vicidial_campaign_stats where campaign_id IN($DIGcampaigns);"; if ($DB > 0) {echo "\n|$stmtB|\n";} $rslt=mysql_to_mysqli($stmtB, $link); $row=mysqli_fetch_row($rslt); $callsTODAY = $row[0]; $dropsTODAY = $row[1]; $answersTODAY = $row[2]; $drpctTODAY = ( MathZDC($dropsTODAY, $callsTODAY) * 100); $drpctTODAY = round($drpctTODAY, 2); $drpctTODAY = sprintf("%01.2f", $drpctTODAY); $DROPINGROUPstatsHTML .= "
"._QXZ("DROP IN-GROUP STATS")." -"._QXZ("DROP PERCENT").":  $drpctTODAY%     "._QXZ("CALLS").":  $callsTODAY     "._QXZ("DROPS/ANSWERS").":  $dropsTODAY / $answersTODAY    
"; $CARRIERstatsHTML .= ""; $CARRIERstatsHTML .= ""; $CARRIERstatsHTML .= ""; $CARRIERstatsHTML .= ""; $CARRIERstatsHTML .= ""; $CARRIERstatsHTML .= ""; $CARRIERstatsHTML .= ""; $CARRIERstatsHTML .= ""; $CARRIERstatsHTML .= ""; $CARRIERstatsHTML .= ""; $CARRIERstatsHTML .= ""; if (strlen($dialstatuses) > 1) { $stmtB="SELECT dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeSIXhoursAGO\" group by dialstatus;"; if ($DB > 0) {echo "\n|$stmtB|\n";} $rslt=mysql_to_mysqli($stmtB, $link); $scar_to_print = mysqli_num_rows($rslt); $print_sctp=0; while ($scar_to_print > $print_sctp) { $row=mysqli_fetch_row($rslt); $SIXhour_total+=$row[1]; $print_ctp=0; while ($print_ctp < $ctp) { if ($TFhour_status[$print_ctp] == $row[0]) {$SIXhour_count[$print_ctp] = $row[1];} $print_ctp++; } $print_sctp++; } $stmtB="SELECT dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeONEhourAGO\" group by dialstatus;"; if ($DB > 0) {echo "\n|$stmtB|\n";} $rslt=mysql_to_mysqli($stmtB, $link); $scar_to_print = mysqli_num_rows($rslt); $print_sctp=0; while ($scar_to_print > $print_sctp) { $row=mysqli_fetch_row($rslt); $ONEhour_total+=$row[1]; $print_ctp=0; while ($print_ctp < $ctp) { if ($TFhour_status[$print_ctp] == $row[0]) {$ONEhour_count[$print_ctp] = $row[1];} $print_ctp++; } $print_sctp++; } $stmtB="SELECT dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeFIFTEENminutesAGO\" group by dialstatus;"; if ($DB > 0) {echo "\n|$stmtB|\n";} $rslt=mysql_to_mysqli($stmtB, $link); $scar_to_print = mysqli_num_rows($rslt); $print_sctp=0; while ($scar_to_print > $print_sctp) { $row=mysqli_fetch_row($rslt); $FTminute_total+=$row[1]; $print_ctp=0; while ($print_ctp < $ctp) { if ($TFhour_status[$print_ctp] == $row[0]) {$FTminute_count[$print_ctp] = $row[1];} $print_ctp++; } $print_sctp++; } $stmtB="SELECT dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeFIVEminutesAGO\" group by dialstatus;"; if ($DB > 0) {echo "\n|$stmtB|\n";} $rslt=mysql_to_mysqli($stmtB, $link); $scar_to_print = mysqli_num_rows($rslt); $print_sctp=0; while ($scar_to_print > $print_sctp) { $row=mysqli_fetch_row($rslt); $FIVEminute_total+=$row[1]; $print_ctp=0; while ($print_ctp < $ctp) { if ($TFhour_status[$print_ctp] == $row[0]) {$FIVEminute_count[$print_ctp] = $row[1];} $print_ctp++; } $print_sctp++; } $stmtB="SELECT dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeONEminuteAGO\" group by dialstatus;"; if ($DB > 0) {echo "\n|$stmtB|\n";} $rslt=mysql_to_mysqli($stmtB, $link); $scar_to_print = mysqli_num_rows($rslt); $print_sctp=0; while ($scar_to_print > $print_sctp) { $row=mysqli_fetch_row($rslt); $ONEminute_total+=$row[1]; $print_ctp=0; while ($print_ctp < $ctp) { if ($TFhour_status[$print_ctp] == $row[0]) {$ONEminute_count[$print_ctp] = $row[1];} $print_ctp++; } $print_sctp++; } $print_ctp=0; while ($print_ctp < $ctp) { if (strlen($TFhour_count[$print_ctp])<1) {$TFhour_count[$print_ctp]=0;} if (strlen($SIXhour_count[$print_ctp])<1) {$SIXhour_count[$print_ctp]=0;} if (strlen($ONEhour_count[$print_ctp])<1) {$ONEhour_count[$print_ctp]=0;} if (strlen($FTminute_count[$print_ctp])<1) {$FTminute_count[$print_ctp]=0;} if (strlen($FIVEminute_count[$print_ctp])<1) {$FIVEminute_count[$print_ctp]=0;} if (strlen($ONEminute_count[$print_ctp])<1) {$ONEminute_count[$print_ctp]=0;} $TFhour_pct = (100*MathZDC($TFhour_count[$print_ctp], $TFhour_total)); $SIXhour_pct = (100*MathZDC($SIXhour_count[$print_ctp], $SIXhour_total)); $ONEhour_pct = (100*MathZDC($ONEhour_count[$print_ctp], $ONEhour_total)); $TFminute_pct = (100*MathZDC($FTminute_count[$print_ctp], $FTminute_total)); $FIVEminute_pct = (100*MathZDC($FIVEminute_count[$print_ctp], $FIVEminute_total)); $ONEminute_pct = (100*MathZDC($ONEminute_count[$print_ctp], $ONEminute_total)); $CARRIERstatsHTML .= ""; $CARRIERstatsHTML .= ""; $CARRIERstatsHTML .= ""; $CARRIERstatsHTML .= ""; $CARRIERstatsHTML .= ""; $CARRIERstatsHTML .= ""; $CARRIERstatsHTML .= ""; $CARRIERstatsHTML .= ""; $CARRIERstatsHTML .= ""; $CARRIERstatsHTML .= ""; $print_ctp++; } $CARRIERstatsHTML .= ""; $CARRIERstatsHTML .= ""; $CARRIERstatsHTML .= ""; $CARRIERstatsHTML .= ""; $CARRIERstatsHTML .= ""; $CARRIERstatsHTML .= ""; $CARRIERstatsHTML .= ""; $CARRIERstatsHTML .= ""; $CARRIERstatsHTML .= ""; $CARRIERstatsHTML .= ""; } else { $CARRIERstatsHTML .= ""; } $CARRIERstatsHTML .= "
"._QXZ("CARRIER STATS").":                 "._QXZ("HANGUP STATUS")."     "._QXZ("24 HOURS")."     "._QXZ("6 HOURS")."     "._QXZ("1 HOUR")."     "._QXZ("15 MIN")."     "._QXZ("5 MIN")."     "._QXZ("1 MIN")."  
     $TFhour_status[$print_ctp] $TFhour_count[$print_ctp]  ".sprintf("%01.1f", $TFhour_pct)."% $SIXhour_count[$print_ctp]  ".sprintf("%01.1f", $SIXhour_pct)."% $ONEhour_count[$print_ctp]  ".sprintf("%01.1f", $ONEhour_pct)."% $FTminute_count[$print_ctp]  ".sprintf("%01.1f", $TFminute_pct)."% $FIVEminute_count[$print_ctp]  ".sprintf("%01.1f", $FIVEminute_pct)."% $ONEminute_count[$print_ctp]  ".sprintf("%01.1f", $ONEminute_pct)."%
     "._QXZ("TOTALS")." ".($TFhour_total+0)." ".($SIXhour_total+0)." ".($ONEhour_total+0)." ".($FTminute_total+0)." ".($FIVEminute_total+0)." ".($ONEminute_total+0)."
"._QXZ("no log entries")."
"; $CARRIERstatsHTML .= "
"; $PRESETstatsHTML .= ""; $PRESETstatsHTML .= ""; $PRESETstatsHTML .= ""; $PRESETstatsHTML .= ""; $PRESETstatsHTML .= ""; $PRESETstatsHTML .= ""; $stmtB="SELECT preset_name,xfer_count from vicidial_xfer_stats where preset_name!='' and preset_name is not NULL $group_SQLand order by preset_name;"; if ($DB > 0) {echo "\n|$stmtB|\n";} $rslt=mysql_to_mysqli($stmtB, $link); $pre_to_print = mysqli_num_rows($rslt); $ctp=0; while ($pre_to_print > $ctp) { $row=mysqli_fetch_row($rslt); $PRESETstatsHTML .= ""; $PRESETstatsHTML .= ""; $PRESETstatsHTML .= ""; $PRESETstatsHTML .= ""; $PRESETstatsHTML .= ""; $ctp++; } if ($ctp < 1) { $PRESETstatsHTML .= ""; } $PRESETstatsHTML .= "
  "._QXZ("AGENT DIAL PRESETS").":     "._QXZ("PRESET NAMES")."                 "._QXZ("CALLS")."  
            $row[0]     $row[1]  
"._QXZ("no log entries")."
"; $PRESETstatsHTML .= "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } else {echo "
\n";} } ##### NOT INBOUND ONLY ### else { if (preg_match('/ALL\-ACTIVE/i',$group_string)) { $non_inboundSQL=''; if (preg_match('/N/',$with_inbound)) {$non_inboundSQL = "and campaign_id NOT IN($ALLcloser_campaignsSQL)";} else {$non_inboundSQL = "and campaign_id IN($group_SQL,$closer_campaignsSQL)";} $multi_drop++; $stmt="SELECT avg(auto_dial_level),min(dial_status_a),min(dial_status_b),min(dial_status_c),min(dial_status_d),min(dial_status_e),min(lead_order),min(lead_filter_id),sum(hopper_level),min(dial_method),avg(adaptive_maximum_level),avg(adaptive_dropped_percentage),avg(adaptive_dl_diff_target),avg(adaptive_intensity),min(available_only_ratio_tally),min(adaptive_latest_server_time),min(local_call_time),avg(dial_timeout),min(dial_statuses),max(agent_pause_codes_active),max(list_order_mix),max(auto_hopper_level),max(ofcom_uk_drop_calc) from vicidial_campaigns where active='Y' $group_SQLand;"; $stmtB="SELECT sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),$answersSQL,max(status_category_1),sum(status_category_count_1),max(status_category_2),sum(status_category_count_2),max(status_category_3),sum(status_category_count_3),max(status_category_4),sum(status_category_count_4),sum(agent_calls_today),sum(agent_wait_today),sum(agent_custtalk_today),sum(agent_acw_today),sum(agent_pause_today),sum(agenthandled_today),sum(park_calls_today),sum(park_sec_today) from vicidial_campaign_stats where calls_today > -1 $non_inboundSQL;"; $stmtC="SELECT count(*) from vicidial_campaigns where agent_pause_codes_active!='N' and active='Y' $group_SQLand;"; } else { if ($DB > 0) {echo "\n|$with_inbound|$campaign_allow_inbound|\n";} if ( (preg_match('/Y/',$with_inbound)) and ($campaign_allow_inbound > 0) ) { $multi_drop++; if ($DB) {echo "with_inbound|$with_inbound|$campaign_allow_inbound\n";} $stmt="SELECT auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses,agent_pause_codes_active,list_order_mix,auto_hopper_level,ofcom_uk_drop_calc from vicidial_campaigns where campaign_id IN ($group_SQL,$closer_campaignsSQL);"; $stmtB="SELECT sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),$answersSQL,max(status_category_1),sum(status_category_count_1),max(status_category_2),sum(status_category_count_2),max(status_category_3),sum(status_category_count_3),max(status_category_4),sum(status_category_count_4),sum(agent_calls_today),sum(agent_wait_today),sum(agent_custtalk_today),sum(agent_acw_today),sum(agent_pause_today),sum(agenthandled_today),sum(park_calls_today),sum(park_sec_today) from vicidial_campaign_stats where campaign_id IN ($group_SQL,$closer_campaignsSQL);"; $stmtC="SELECT count(*) from vicidial_campaigns where agent_pause_codes_active!='N' and active='Y' and campaign_id IN ($group_SQL,$closer_campaignsSQL);"; } else { $stmt="SELECT avg(auto_dial_level),max(dial_status_a),max(dial_status_b),max(dial_status_c),max(dial_status_d),max(dial_status_e),max(lead_order),max(lead_filter_id),max(hopper_level),max(dial_method),max(adaptive_maximum_level),avg(adaptive_dropped_percentage),avg(adaptive_dl_diff_target),avg(adaptive_intensity),max(available_only_ratio_tally),max(adaptive_latest_server_time),max(local_call_time),max(dial_timeout),max(dial_statuses),max(agent_pause_codes_active),max(list_order_mix),max(auto_hopper_level),max(ofcom_uk_drop_calc) from vicidial_campaigns where campaign_id IN($group_SQL);"; $stmtB="SELECT sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),$answersSQL,max(status_category_1),sum(status_category_count_1),max(status_category_2),sum(status_category_count_2),max(status_category_3),sum(status_category_count_3),max(status_category_4),sum(status_category_count_4),sum(agent_calls_today),sum(agent_wait_today),sum(agent_custtalk_today),sum(agent_acw_today),sum(agent_pause_today),sum(agenthandled_today),sum(park_calls_today),sum(park_sec_today) from vicidial_campaign_stats where campaign_id IN($group_SQL);"; $stmtC="SELECT count(*) from vicidial_campaigns where agent_pause_codes_active!='N' and active='Y' and campaign_id IN($group_SQL);"; } } if ($DB > 0) {echo "\n|$stmt|$stmtB|\n";} $rslt=mysql_to_mysqli($stmt, $link); $row=mysqli_fetch_row($rslt); $DIALlev = $row[0]; $DIALstatusA = $row[1]; $DIALstatusB = $row[2]; $DIALstatusC = $row[3]; $DIALstatusD = $row[4]; $DIALstatusE = $row[5]; $DIALorder = $row[6]; $DIALfilter = $row[7]; $HOPlev = $row[8]; $DIALmethod = $row[9]; $maxDIALlev = $row[10]; $DROPmax = $row[11]; $targetDIFF = $row[12]; $ADAintense = $row[13]; $ADAavailonly = $row[14]; $TAPERtime = $row[15]; $CALLtime = $row[16]; $DIALtimeout = $row[17]; $DIALstatuses = $row[18]; $DIALmix = $row[20]; $AHOPlev = $row[21]; $UKocDROP = $row[22]; $rslt=mysql_to_mysqli($stmtC, $link); $row=mysqli_fetch_row($rslt); $agent_pause_codes_active = $row[0]; $stmt="SELECT count(*) from vicidial_hopper $group_SQLwhere;"; $rslt=mysql_to_mysqli($stmt, $link); $row=mysqli_fetch_row($rslt); $VDhop = $row[0]; $rslt=mysql_to_mysqli($stmtB, $link); $row=mysqli_fetch_row($rslt); $DAleads = $row[0]; $callsTODAY = $row[1]; $dropsTODAY = $row[2]; $drpctTODAY = $row[3]; $diffONEMIN = $row[4]; $agentsONEMIN = $row[5]; $balanceFILL = $row[6]; $answersTODAY = $row[7]; $VSCcat1 = $row[8]; $VSCcat1tally = $row[9]; $VSCcat2 = $row[10]; $VSCcat2tally = $row[11]; $VSCcat3 = $row[12]; $VSCcat3tally = $row[13]; $VSCcat4 = $row[14]; $VSCcat4tally = $row[15]; $VSCagentcalls = $row[16]; $VSCagentwait = $row[17]; $VSCagentcust = $row[18]; $VSCagentacw = $row[19]; $VSCagentpause = $row[20]; $AGNTansTODAY = $row[21]; $PARKcallTODAY = $row[22]; $PARKsecTODAY = $row[23]; if ($multi_drop > 0) { if ( ($SSofcom_uk_drop_calc > 0) and ($UKocDROP == 'Y') ) { $temp_AGNTansPLUSdrop = ($AGNTansTODAY + $dropsTODAY); $drpctTODAY = ( MathZDC($dropsTODAY, $temp_AGNTansPLUSdrop) * 100); $drpctTODAY = round($drpctTODAY, 2); $drpctTODAY = sprintf("%01.2f", $drpctTODAY); } else { $drpctTODAY = ( MathZDC($dropsTODAY, $answersTODAY) * 100); $drpctTODAY = round($drpctTODAY, 2); $drpctTODAY = sprintf("%01.2f", $drpctTODAY); } } $diffpctONEMIN = ( MathZDC($diffONEMIN, $agentsONEMIN) * 100); $diffpctONEMIN = sprintf("%01.2f", $diffpctONEMIN); $stmt="SELECT sum(local_trunk_shortage) from vicidial_campaign_server_stats $group_SQLwhere;"; $rslt=mysql_to_mysqli($stmt, $link); $row=mysqli_fetch_row($rslt); $balanceSHORT = $row[0]; if (preg_match('/DISABLED/',$DIALmix)) { $DIALstatuses = (preg_replace("/ -$|^ /","",$DIALstatuses)); $DIALstatuses = (preg_replace('/\s/', ', ', $DIALstatuses)); } else { $stmt="SELECT vcl_id from vicidial_campaigns_list_mix where status='ACTIVE' $group_SQLand limit 1;"; $rslt=mysql_to_mysqli($stmt, $link); $Lmix_to_print = mysqli_num_rows($rslt); if ($Lmix_to_print > 0) { $row=mysqli_fetch_row($rslt); $DIALstatuses = _QXZ("List Mix").": $row[0]"; $DIALorder = _QXZ("List Mix").": $row[0]"; } } $DIALlev = sprintf("%01.3f", $DIALlev); $agentsONEMIN = sprintf("%01.2f", $agentsONEMIN); $diffONEMIN = sprintf("%01.2f", $diffONEMIN); if ( ($report_display_type!='WALL_1') and ($report_display_type!='WALL_2') and ($report_display_type!='WALL_3') and ($report_display_type!='WALL_4') and ($report_display_type!='LIMITED') and (!$mobile_device)) { echo "
"._QXZ("CALLS TODAY").":  $callsTODAY    "._QXZ("TMA")." 1:  $PCThold_sec_stat_one%     "._QXZ("Average Hold time for Answered Calls").":  $AVGhold_sec_answer_calls   "._QXZ("TIME").":   $NOW_TIME
"._QXZ("DROPS TODAY").":  $dropsTODAY    "._QXZ("TMA")." 2:  $PCThold_sec_stat_two%     "._QXZ("Average Hold time for Dropped Calls").":  $AVGhold_sec_drop_calls  
"._QXZ("ANSWERS TODAY").":  $answersTODAY    ("._QXZ("Agent non-pause time / Answers").")"._QXZ("Average Hold time for All Calls").":  $AVGhold_sec_queue_calls  
"._QXZ("DROP PERCENT").":  $drpctTODAY%    "._QXZ("PRODUCTIVITY").":  $AVG_ANSWERagent_non_pause_sec    
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; if ($adastats>1) { $min_link='- min '; if ($RTajax > 0) {$min_link='';} echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; if( 1 == count(explode(',' , $group_SQL))) { echo ""; } else { echo ""; } echo ""; echo ""; echo ""; echo ""; $SLAinHTML=''; if ($SLAinSTATS>0) { if ($SLAinSTATS == '1') { $SLAinHTML .= ""; $SLAinHTML .= ""; } if ($SLAinSTATS == '3') { $SLAinHTML .= ""; } if ($SLAinSTATS == '4') { $SLAinHTML .= ""; } if ($SLAinSTATS == '2') { $SLAinHTML .= ""; $SLAinHTML .= ""; } } $parkHTML=''; if ($parkSTATS>0) { $avgparksecallTODAY = MathZDC($PARKsecTODAY, $VSCagentcalls); $avgparksecallTODAY = round($avgparksecallTODAY, 0); $avgparksecallTODAY = sprintf("%01.0f", $avgparksecallTODAY); $avgparksecparkTODAY = MathZDC($PARKsecTODAY, $PARKcallTODAY); $avgparksecparkTODAY = round($avgparksecparkTODAY, 0); $avgparksecparkTODAY = sprintf("%01.0f", $avgparksecparkTODAY); if ($parkSTATS>1) { $parkHTML .= ""; } else { $parkHTML .= ""; $parkHTML .= ""; } } if ($AGENTtimeSTATS>0) { $avgpauseTODAY = MathZDC($VSCagentpause, $VSCagentcalls); $avgpauseTODAY = round($avgpauseTODAY, 0); $avgpauseTODAY = sprintf("%01.0f", $avgpauseTODAY); $avgwaitTODAY = MathZDC($VSCagentwait, $VSCagentcalls); $avgwaitTODAY = round($avgwaitTODAY, 0); $avgwaitTODAY = sprintf("%01.0f", $avgwaitTODAY); $avgcustTODAY = MathZDC($VSCagentcust, $VSCagentcalls); $avgcustTODAY = round($avgcustTODAY, 0); $avgcustTODAY = sprintf("%01.0f", $avgcustTODAY); $avgacwTODAY = MathZDC($VSCagentacw, $VSCagentcalls); $avgacwTODAY = round($avgacwTODAY, 0); $avgacwTODAY = sprintf("%01.0f", $avgacwTODAY); echo ""; echo ""; echo ""; echo ""; echo ""; if ($parkSTATS>0) {echo "$parkHTML$SLAinHTML";} echo ""; } else { if ($parkSTATS>0) { echo ""; echo "$parkHTML$SLAinHTML"; echo ""; } } echo "$DROPINGROUPstatsHTML\n"; echo "$CARRIERstatsHTML\n"; echo "$PRESETstatsHTML\n"; } else {echo "
\n";} } if ( ($report_display_type!='WALL_1') and ($report_display_type!='WALL_2') and ($report_display_type!='WALL_3') and ($report_display_type!='WALL_4') and ($report_display_type!='LIMITED') ) { if (!$mobile_device) { echo ""; echo ""; echo ""; } echo ""; echo ""; echo "
"._QXZ("DIAL LEVEL").":  $DIALlev    "._QXZ("TRUNK SHORT/FILL").":  $balanceSHORT / $balanceFILL     "._QXZ("FILTER").":  "._QXZ("$DIALfilter")."   "._QXZ("TIME").":   $NOW_TIME
$min_link  "._QXZ("MAX LEVEL").":  $maxDIALlev   "._QXZ("DROPPED MAX").":  $DROPmax%    "._QXZ("TARGET DIFF").":  $targetDIFF     "._QXZ("INTENSITY").":  $ADAintense    
"._QXZ("DIAL TIMEOUT").":  $DIALtimeout  "._QXZ("TAPER TIME").":  $TAPERtime  "._QXZ("LOCAL TIME").":  $CALLtime  "._QXZ("AVAIL ONLY").":  $ADAavailonly  
"._QXZ("DIALABLE LEADS").":  $DAleads     "._QXZ("CALLS TODAY").":  $callsTODAY     "._QXZ("AVG AGENTS").":  $agentsONEMIN     "._QXZ("DIAL METHOD").":  "._QXZ("$DIALmethod")."    
"._QXZ("HOPPER")." ( "._QXZ("min/auto")." ):  $HOPlev / $AHOPlev     "._QXZ("DROPPED")." / $answers_text:  $dropsTODAY / $answersTODAY   "._QXZ("DL DIFF").":  $diffONEMIN     "._QXZ("STATUSES").":  $DIALstatuses    
"._QXZ("LEADS IN HOPPER").":  $VDhop     "._QXZ("LEADS IN HOPPER").":  $VDhop     "._QXZ("DROPPED PERCENT"); if ( ($SSofcom_uk_drop_calc > 0) and ($UKocDROP == 'Y') ) {echo "(uk)";} echo ":  "; if ($drpctTODAY >= $DROPmax) {echo "$drpctTODAY%";} else {echo "$drpctTODAY%";} echo "    "._QXZ("DIFF").":  $diffpctONEMIN%     "._QXZ("ORDER").":  "._QXZ("$DIALorder")."    
"._QXZ("SLA")." 1:  $PCThold_sec_stat_one%     "._QXZ("SLA")." 2:  $PCThold_sec_stat_two%     "._QXZ("SLA").":  $PCThold_sec_stat_one%     "._QXZ("SLA").":  $PCThold_sec_stat_two%     "._QXZ("TMA")." 1:  $PCThold_sec_stat_one%     "._QXZ("TMA")." 2:  $PCThold_sec_stat_two%     "._QXZ("AVG PARKTIME").":  $avgparksecallTODAY  "._QXZ("PARKED CALLS").":  $PARKcallTODAY  "._QXZ("AVG PARKTIME/ALL").":  $avgparksecparkTODAY / $avgparksecallTODAY  
"._QXZ("AGENT AVG WAIT").":  $avgwaitTODAY  "._QXZ("AVG CUSTTIME").":  $avgcustTODAY  "._QXZ("AVG ACW").":  $avgacwTODAY  "._QXZ("AVG PAUSE").":  $avgpauseTODAY  
"; if ( (!preg_match('/NULL/i',$VSCcat1)) and (strlen($VSCcat1)>0) ) {echo "$VSCcat1:   $VSCcat1tally       \n";} if ( (!preg_match('/NULL/i',$VSCcat2)) and (strlen($VSCcat2)>0) ) {echo "$VSCcat2:   $VSCcat2tally       \n";} if ( (!preg_match('/NULL/i',$VSCcat3)) and (strlen($VSCcat3)>0) ) {echo "$VSCcat3:   $VSCcat3tally       \n";} if ( (!preg_match('/NULL/i',$VSCcat4)) and (strlen($VSCcat4)>0) ) {echo "$VSCcat4:   $VSCcat4tally       \n";} echo "
"; echo "$ingroup_detail"; if ( ($RTajax < 1) and ($report_display_type!='LIMITED') ) { if (!$mobile_device) { if ($adastats<2) { echo "+ "._QXZ("VIEW MORE").""; } else { echo "- "._QXZ("VIEW LESS").""; } } if ($UGdisplay>0) { echo "       "._QXZ("HIDE USER GROUP").""; } else { echo "       "._QXZ("VIEW USER GROUP").""; } if ($SERVdisplay>0) { echo "       "._QXZ("HIDE SERVER INFO").""; } else { echo "       "._QXZ("SHOW SERVER INFO").""; } if ($CALLSdisplay>0) { echo "       "._QXZ("HIDE WAITING CALLS").""; } else { echo "       "._QXZ("SHOW WAITING CALLS").""; } if ($ALLINGROUPstats>0) { echo "       "._QXZ("HIDE IN-GROUP STATS").""; } else { echo "       "._QXZ("SHOW IN-GROUP STATS").""; } if ($PHONEdisplay>0) { echo "       "._QXZ("HIDE PHONES").""; } else { echo "       "._QXZ("SHOW PHONES").""; } if ($CUSTPHONEdisplay>0) { echo "       "._QXZ("HIDE CUSTPHONES").""; } else { echo "       "._QXZ("SHOW CUSTPHONES").""; } if ($LOGuser_level>=9) { if ($CUSTINFOdisplay>0) { echo "       "._QXZ("HIDE FULL CUST INFO").""; } else { echo "       "._QXZ("SHOW FULL CUST INFO").""; } } } echo "
"; echo "\n\n"; } ##### check for campaigns with no dialable leads if enabled ##### if ( ($with_inbound != 'O') and ($NOLEADSalert == 'YES') ) { $NDLcampaigns=''; $stmtB="SELECT campaign_id from vicidial_campaign_stats where campaign_id IN($group_SQL) and dialable_leads < 1 order by campaign_id;"; if ($DB > 0) {echo "\n|$stmt|$stmtB|\n";} $rslt=mysql_to_mysqli($stmtB, $link); $campaigns_to_print = mysqli_num_rows($rslt); $ctp=0; while ($campaigns_to_print > $ctp) { $row=mysqli_fetch_row($rslt); $NDLcampaigns .= " $row[0]   "; $ctp++; if (preg_match("/0$|5$/",$ctp)) {$NDLcampaigns .= "
";} } if ($ctp > 0) { echo "\n"; echo "
\n"; echo "



"._QXZ("Close Alert").""; echo "




"._QXZ("Campaigns with no dialable leads").":

$NDLcampaigns
"; echo "










  "; echo "
\n"; echo "
\n"; } } } ################################################################################### ###### INBOUND/OUTBOUND CALLS ################################################################################### if ($campaign_allow_inbound > 0) { if (preg_match('/ALL\-ACTIVE/i',$group_string)) { $stmt="SELECT closer_campaigns from vicidial_campaigns where active='Y' $group_SQLand"; $rslt=mysql_to_mysqli($stmt, $link); $closer_campaigns=""; while ($row=mysqli_fetch_row($rslt)) { $closer_campaigns.="$row[0]"; } $closer_campaigns = preg_replace("/^ | -$/","",$closer_campaigns); $closer_campaigns = preg_replace("/ - /"," ",$closer_campaigns); $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); $closer_campaignsSQL = "'$closer_campaigns'"; } # Clean up closer campaigns to only include specifically selected ones if (!in_array("ALL-INGROUPS", $ingroup_filter)) { $filter_closer_campaigns=''; for ($q=0; $q 0) { $stmtA = "SELECT status,campaign_id,phone_number,server_ip,UNIX_TIMESTAMP(call_time),call_type,queue_priority,agent_only"; ## JCJ Display chats if ($allow_chats) { $chat_stmtA="SELECT vlc.status,group_id as campaign_id,if(length(v.phone_number)=0 or v.phone_number is null, v.phone_number, '**NO PHONE**') as phone_number, '' as server_ip,UNIX_TIMESTAMP(chat_start_time), 'CHAT' as call_type, '' as queue_priority, '' as agent_only"; } } else { $stmtA = "SELECT status"; ## JCJ Display chats if ($allow_chats) { $chat_stmtA="SELECT vlc.status"; } } $k=0; $agentonlycount=0; $out_total=0; $out_ring=0; $out_live=0; $in_ivr=0; $D_active_calls=0; $CDstatus=array(); $CDcampaign_id=array(); $CDphone_number=array(); $CDserver_ip=array(); $CDcall_time=array(); $CDcall_type=array(); $CDqueue_priority=array(); $CDagent_only=array(); $stmt = "$stmtA $stmtB"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $parked_to_print = mysqli_num_rows($rslt); if ($parked_to_print > 0) { $i=0; $out_total=0; $out_ring=0; $out_live=0; $in_ivr=0; while ($i < $parked_to_print) { $row=mysqli_fetch_row($rslt); if ($LOGadmin_hide_phone_data != '0') { $phone_temp = $row[2]; if ($DB > 0) {echo "HIDEPHONEDATA|$row[2]|$LOGadmin_hide_phone_data|\n";} if (strlen($phone_temp) > 0) { if ($LOGadmin_hide_phone_data == '4_DIGITS') {$row[2] = str_repeat("X", (strlen($phone_temp) - 4)) . substr($phone_temp,-4,4);} elseif ($LOGadmin_hide_phone_data == '3_DIGITS') {$row[2] = str_repeat("X", (strlen($phone_temp) - 3)) . substr($phone_temp,-3,3);} elseif ($LOGadmin_hide_phone_data == '2_DIGITS') {$row[2] = str_repeat("X", (strlen($phone_temp) - 2)) . substr($phone_temp,-2,2);} else {$row[2] = preg_replace("/./",'X',$phone_temp);} } } if (preg_match("/LIVE/i",$row[0])) { $out_live++; if ($CALLSdisplay > 0) { $CDstatus[$k] = $row[0]; $CDcampaign_id[$k] = $row[1]; $CDphone_number[$k] = $row[2]; $CDserver_ip[$k] = $row[3]; $CDcall_time[$k] = $row[4]; $CDcall_type[$k] = $row[5]; $CDqueue_priority[$k] = $row[6]; $CDagent_only[$k] = $row[7]; if (strlen($CDagent_only[$k]) > 0) {$agentonlycount++;} $k++; } } else { if (preg_match("/IVR/i",$row[0])) { $in_ivr++; if ($CALLSdisplay > 0) { $CDstatus[$k] = $row[0]; $CDcampaign_id[$k] = $row[1]; $CDphone_number[$k] = $row[2]; $CDserver_ip[$k] = $row[3]; $CDcall_time[$k] = $row[4]; $CDcall_type[$k] = $row[5]; $CDqueue_priority[$k] = $row[6]; $CDagent_only[$k] = $row[7]; if (strlen($CDagent_only[$k]) > 0) {$agentonlycount++;} $k++; } } if (preg_match("/CLOSER/i",$row[0])) {$nothing=1;} else {$out_ring++;} } $out_total++; $i++; } ##### MIDI alert audio file test ##### # $test_midi=1; # if ($test_midi > 0) # { # # echo ""; # # echo ""; # echo ""; # echo " "; # echo " "; # echo " "; # echo " "; # echo " alt : test.mid"; # echo ""; # } if ($out_live > 0) {$F=''; $FG='';} if ($out_live > 4) {$F=''; $FG='';} if ($out_live > 9) {$F=''; $FG='';} if ($out_live > 14) {$F=''; $FG='';} $D_active_calls=1; if ( ($report_display_type!='HTML') and ($report_display_type!='WALL_2') and ($report_display_type!='WALL_3') and ($report_display_type!='WALL_4') and ($report_display_type!='LIMITED') ) { if ($report_display_type=='WALL_1') { if ($campaign_allow_inbound > 0) {echo "$NFB$out_total$NFE "._QXZ("current active calls")."      \n";} else {echo "$NFB$out_total$NFE "._QXZ("calls being placed")."       \n";} echo "$NFB$out_ring$NFE "._QXZ("calls ringing")."         \n"; echo "$NFB$F  $out_live $FG$NFE "._QXZ("calls waiting for agents")."       \n"; echo "$NFB  $in_ivr$NFE "._QXZ("calls in IVR")."       \n"; } else { if ($campaign_allow_inbound > 0) {echo "$NFB$out_total$NFE "._QXZ("current active calls")."      \n";} else {echo "$NFB$out_total$NFE "._QXZ("calls being placed")."       \n";} echo "$NFB$out_ring$NFE "._QXZ("calls ringing")."         \n"; echo "$NFB$F  $out_live $FG$NFE "._QXZ("calls waiting for agents")."       \n"; echo "$NFB  $in_ivr$NFE "._QXZ("calls in IVR")."       \n"; } } } else { $D_active_calls=0; if ( ($report_display_type!='HTML') and ($report_display_type!='WALL_2') and ($report_display_type!='WALL_3') and ($report_display_type!='WALL_4') and ($report_display_type!='LIMITED') ) { echo _QXZ(" NO LIVE CALLS WAITING")." \n"; } } $D_active_chats=0; $chats_waiting=0; if ($allow_chats) { $chat_stmtB=" from vicidial_live_chats vlc, vicidial_list v where vlc.status='WAITING' and group_id IN($closer_campaignsSQL) and vlc.lead_id=v.lead_id "; $chat_stmt="$chat_stmtA $chat_stmtB"; #$stmt="$chat_stmt UNION $stmtA $stmtB"; $chat_rslt=mysql_to_mysqli($chat_stmt, $link); $waiting_to_chat = mysqli_num_rows($chat_rslt); if ($waiting_to_chat > 0) { $i=0; while ($i < $waiting_to_chat) { $chat_row=mysqli_fetch_row($chat_rslt); $chats_waiting++; if ($CALLSdisplay > 0) { $CDstatus[$k] = $chat_row[0]; $CDcampaign_id[$k] = $chat_row[1]; $CDphone_number[$k] = $chat_row[2]; $CDserver_ip[$k] = $chat_row[3]; $CDcall_time[$k] = $chat_row[4]; $CDcall_type[$k] = $chat_row[5]; $CDqueue_priority[$k] = $chat_row[6]; $CDagent_only[$k] = $chat_row[7]; if (strlen($CDagent_only[$k]) > 0) {$agentonlycount++;} $k++; } $i++; } if ($chats_waiting > 0) {$F=''; $FG='';} if ($chats_waiting > 4) {$F=''; $FG='';} if ($chats_waiting > 9) {$F=''; $FG='';} if ($chats_waiting > 14) {$F=''; $FG='';} $D_active_chats=1; if ( ($report_display_type!='HTML') and ($report_display_type!='WALL_2') and ($report_display_type!='WALL_3') and ($report_display_type!='WALL_4') and ($report_display_type!='LIMITED') ) { echo "       $NFB$F  $chats_waiting $FG$NFE "._QXZ("chats waiting for agents")."       \n"; } } else { $D_active_chats=0; if ( ($report_display_type!='HTML') and ($report_display_type!='WALL_2') and ($report_display_type!='WALL_3') and ($report_display_type!='WALL_4') and ($report_display_type!='LIMITED') ) { echo _QXZ(" NO LIVE CHATS WAITING ")." \n"; } } } $icbq_stmt="SELECT count(*) from vicidial_inbound_callback_queue where icbq_status='LIVE' and group_id IN($closer_campaignsSQL);"; $icbq_rslt=mysql_to_mysqli($icbq_stmt, $link); $icbq_ct = mysqli_num_rows($icbq_rslt); if ($icbq_ct > 0) { $icbq_ARY=mysqli_fetch_row($icbq_rslt); $icbq_live = $icbq_ARY[0]; } ##### BEGIN HTML output for calls ##### if ( ($report_display_type=='HTML') or ($report_display_type=='WALL_2') or ($report_display_type=='LIMITED') ) { $section_width=860; echo ""; echo "\n"; echo ""; # echo ""; echo ""; if ($campaign_allow_inbound > 0) { echo ""; } else { echo ""; } echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; if ($allow_chats) { echo ""; echo ""; } else { echo ""; echo ""; } # echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; $calls_waiting_td='bgcolor="#015b91"'; $calls_waiting_font='style="color: white; font-family: HELVETICA; font-size: 18; font-weight: bold;"'; if ($out_live > 0) {$calls_waiting_td='bgcolor="#FFCCCC"'; $calls_waiting_font='style="color: black; font-family: HELVETICA; font-size: 18; font-weight: bold;"';} if ($out_live > 4) {$calls_waiting_td='bgcolor="#FF9999"'; $calls_waiting_font='style="color: black; font-family: HELVETICA; font-size: 18; font-weight: bold;"';} if ($out_live > 9) {$calls_waiting_td='bgcolor="#FF6666"'; $calls_waiting_font='style="color: black; font-family: HELVETICA; font-size: 18; font-weight: bold;"';} if ($out_live > 14) {$calls_waiting_td='bgcolor="#FF0000"'; $calls_waiting_font='class="color: white; font-family: HELVETICA; font-size: 18; font-weight: bold;"';} echo ""; echo ""; if ($allow_chats) { $chats_waiting_td='bgcolor="#015b91"'; $chats_waiting_font='style="color: white; font-family: HELVETICA; font-size: 18; font-weight: bold;"'; if ($chats_waiting > 0) {$chats_waiting_td='bgcolor="#FFCCCC"'; $chats_waiting_font='style="color: black; font-family: HELVETICA; font-size: 18; font-weight: bold;"';} if ($chats_waiting > 4) {$chats_waiting_td='bgcolor="#FF9999"'; $chats_waiting_font='style="color: black; font-family: HELVETICA; font-size: 18; font-weight: bold;"';} if ($chats_waiting > 9) {$chats_waiting_td='bgcolor="#FF6666"'; $chats_waiting_font='style="color: black; font-family: HELVETICA; font-size: 18; font-weight: bold;"';} if ($chats_waiting > 14) {$chats_waiting_td='bgcolor="#FF0000"'; $chats_waiting_font='class="color: white; font-family: HELVETICA; font-size: 18; font-weight: bold;"';} echo ""; } else { echo ""; } echo ""; echo ""; echo ""; # echo "
  "._QXZ("current active calls").""._QXZ("calls being placed")."   "._QXZ("calls ringing")."   "._QXZ("calls waiting for agents")."   "._QXZ("calls in IVR")."   "._QXZ("chats waiting for agents")."      "._QXZ("callback queue calls")."
$out_total$out_ring$out_live$in_ivr$chats_waiting $icbq_live
 
"; } ##### END HTML output for calls ##### ################################################################################### ###### CALLS WAITING ################################################################################### $agentonlyheader = ''; if ($agentonlycount > 0) {$agentonlyheader = _QXZ("AGENTONLY");} if ($report_display_type=='TEXT') { $Cecho = ''; $Cecho .= "VICIDIAL: Calls Waiting $NOW_TIME\n"; $Cecho .= "+---------+----------------------+--------------+-----------------+---------+------------+----------+\n"; $Cecho .= "| "._QXZ("STATUS",7)." | "._QXZ("CAMPAIGN",20)." | "._QXZ("PHONE NUMBER",12)." | "._QXZ("SERVER IP",15)." | "._QXZ("DIALTIME",8)."| "._QXZ("CALL TYPE",10)." | "._QXZ("PRIORITY",8)." | $agentonlyheader\n"; $Cecho .= "+---------+----------------------+--------------+-----------------+---------+------------+----------+\n"; } if ( ($report_display_type=='HTML') or ($report_display_type=='LIMITED') ) { $Cecho = ''; $Cecho .= ""; $Cecho .= ""; $Cecho .= ""; $Cecho .= ""; $Cecho .= "\n"; $Cecho .= ""; $Cecho .= ""; $Cecho .= ""; $Cecho .= ""; $Cecho .= ""; $Cecho .= ""; $Cecho .= ""; $Cecho .= ""; $Cecho .= ""; $Cecho .= "\n"; } $p=0; while($p<$k) { $Cstatus = sprintf("%-7s", _QXZ("$CDstatus[$p]",6)); #TRANSLATE $Ccampaign_id = sprintf("%-20s", $CDcampaign_id[$p]); # Do not translate $Cphone_number = sprintf("%-12s", $CDphone_number[$p]); # Do not translate $Cserver_ip = sprintf("%-15s", $CDserver_ip[$p]); # Do not translate $Ccall_type = sprintf("%-10s", _QXZ("$CDcall_type[$p]",10)); #TRANSLATE $Cqueue_priority = sprintf("%8s", $CDqueue_priority[$p]); # Do not translate $Cagent_only = sprintf("%8s", $CDagent_only[$p]); $Ccall_time_S = ($STARTtime - $CDcall_time[$p]); $Ccall_time_MS = sec_convert($Ccall_time_S,'M'); $Ccall_time_MS = sprintf("%7s", $Ccall_time_MS); $G = ''; $EG = ''; if ($CDcall_type[$p] == 'IN' || $CDcall_type[$p] == 'CHAT') { $G=""; $EG=''; $Ccampaign_id="$Ccampaign_id"; } if (strlen($CDagent_only[$p]) > 0) {$Gcalltypedisplay = "$G$Cagent_only$EG";} else {$Gcalltypedisplay = '';} if ($report_display_type=='TEXT') { $Cecho .= "| $G$Cstatus$EG | $G$Ccampaign_id$EG | $G$Cphone_number$EG | $G$Cserver_ip$EG | $G$Ccall_time_MS$EG | $G$Ccall_type$EG | $G$Cqueue_priority$EG | $Gcalltypedisplay \n"; } else { $Cecho .= ""; $Cecho .= ""; $Cecho .= ""; $Cecho .= ""; $Cecho .= ""; $Cecho .= ""; $Cecho .= ""; $Cecho .= ""; $Cecho .= ""; $Cecho .= "\n"; } $p++; } if ($report_display_type=='TEXT') { $Cecho .= "+---------+----------------------+--------------+-----------------+---------+------------+----------+\n"; } else { $Cecho .= "
 "._QXZ("Calls Waiting").":$NOW_TIME
  "._QXZ("STATUS")."   "._QXZ("CAMPAIGN")."   "._QXZ("PHONE NUMBER")."   "._QXZ("SERVER IP")."   "._QXZ("DIALTIME")."   "._QXZ("CALL TYPE")."   "._QXZ("PRIORITY")." $agentonlyheader
$G$Cstatus$EG$G$Ccampaign_id$EG$G$Cphone_number$EG$G$Cserver_ip$EG$G$Ccall_time_MS$EG$G$Ccall_type$EG$G$Cqueue_priority$EG$Gcalltypedisplay
\n"; } if ($p<1) {$Cecho='';} ################################################################################### ###### AGENT TIME ON SYSTEM ################################################################################### $agent_incall=0; $agent_indial=0; $agent_ready=0; $agent_paused=0; $agent_dispo=0; $agent_dead=0; $agent_total=0; $phoneord=$orderby; $userord=$orderby; $groupord=$orderby; $timeord=$orderby; $campaignord=$orderby; if ($phoneord=='phoneup') {$phoneord='phonedown';} else {$phoneord='phoneup';} if ($userord=='userup') {$userord='userdown';} else {$userord='userup';} if ($groupord=='groupup') {$groupord='groupdown';} else {$groupord='groupup';} if ($timeord=='timeup') {$timeord='timedown';} else {$timeord='timeup';} if ($campaignord=='campaignup') {$campaignord='campaigndown';} else {$campaignord='campaignup';} if ($report_display_type=='TEXT') { $Aecho = ''; $Aecho .= ""._QXZ("Agents Time On Calls Campaign").": $group_string $NOW_TIME\n"; } if ( ($report_display_type=='HTML') or ($report_display_type=='LIMITED') ) { $Aecho = ''; $Aecho .= ""; $Aecho .= ""; $Aecho .= ""; $Aecho .= ""; $Aecho .= ""; $Aecho .= "\n"; # $Aecho .= ""; # $Aecho .= ""; # $Aecho .= ""; # $Aecho .= ""; # $Aecho .= ""; # $Aecho .= ""; # $Aecho .= ""; # $Aecho .= ""; # $Aecho .= ""; # $Aecho .= "\n"; } if ($report_display_type=='TEXT') { ##### BEGIN TEXT Output generation ##### $HDbegin = "+"; $HTbegin = "|"; $HDstation = "----------------+"; $HTstation = " "._QXZ("STATION", 14)." |"; $HDphone = "-------------------+"; $HTphone = " "._QXZ("PHONE",11)." |"; if ($RTajax > 0) {$HTphone = " "._QXZ("PHONE",11)." |";} $HDuser = "------------------------+"; $HTuser = " "._QXZ("USER",5)." "; if ($RTajax > 0) {$HTuser = " "._QXZ("USER",5)." ";} if ($UidORname>0) { if ($RTajax > 0) {$HTuser .= ""._QXZ("SHOW ID",8)." ";} else { $HTuser .= ""._QXZ("SHOW ID",8)." "; } } else { if (isset($RTajax) and $RTajax > 0) {$HTuser .= ""._QXZ("SHOW NAME",9)."";} else { $HTuser .= ""._QXZ("SHOW NAME",9).""; } } $HTuser .= " "._QXZ("INFO",6)." |"; $HDusergroup = "--------------+"; $HTusergroup = " "._QXZ("USER GROUP",12)." |"; if ($RTajax > 0) {$HTusergroup = " "._QXZ("USER GROUP",12)." |";} $HDsessionid = "-----------+"; $HTsessionid = " "._QXZ("SESSIONID",9)." |"; $HDlisten = "--------+"; $HTlisten = " "._QXZ("LISTEN",6)." |"; $HDbarge = "-------+"; $HTbarge = " "._QXZ("BARGE",5)." |"; $HDwhisper = "---------+"; $HTwhisper = " "._QXZ("WHISPER",7)." |"; $HDmonitor = "-----------------+----------+"; $HTmonitor = " "._QXZ("MONITOR",15)." | "._QXZ("MON TYPE",8)." |"; $HDstatus = "----------+"; $HTstatus = " "._QXZ("STATUS",8)." |"; $HDcustphone = "-----------------+"; $HTcustphone = " "._QXZ("CUST PHONE",15)." |"; $HDcustinfo = "-----------------+----------------------+---------------------+-------+"; $HTcustinfo = " "._QXZ("CUST PHONE",15)." | "._QXZ("SOURCE ID",20)." | "._QXZ("ENTRY DATE",19)." | "._QXZ("STATE",5)." |"; $HDserver_ip = "-----------------+"; $HTserver_ip = " "._QXZ("SERVER IP",15)." |"; $HDcall_server_ip = "-----------------+"; $HTcall_server_ip = " "._QXZ("CALL SERVER IP",15)." |"; $HDtime = "---------+"; $HTtime = " MM:SS |"; if ($RTajax > 0) {$HTtime = " MM:SS |";} $HDcampaign = "------------+"; $HTcampaign = " "._QXZ("CAMPAIGN",10)." |"; if ($RTajax > 0) {$HTcampaign = " "._QXZ("CAMPAIGN",10)." |";} $HDcalls = "-------+"; $HTcalls = " "._QXZ("CALLS",5)." |"; $HDinbcalls = "-----------+"; $HTinbcalls = " "._QXZ("INB CALLS",9)." |"; $HDpause = ''; $HTpause = ''; $HDigcall = "------+-------------------"; $HTigcall = " "._QXZ("HOLD",4)." | "._QXZ("IN-GROUP",8)." "; if ($RS_DIDdesc > 0) { $HDigcall = "------+-----------------------------+-----------------"; $HTigcall = " "._QXZ("HOLD",4)." | "._QXZ("IN-GROUP",8)." | "._QXZ("DID DESCRIPTION",15)." "; } if ($RS_INcolumnsHIDE > 0) { $HDigcall = ''; $HTigcall = ''; } $HDastcall = ''; $HTastcall = ''; if (strlen($RS_AGENTstatusTALLY) > 0) { $HDastcall = '--------+'; $HTastcall = " "._QXZ("$RS_AGENTstatusTALLY",6)." |"; } $HDlatency = ''; $HTlatency = ''; if ( ($AGENTlatency != 0) and ($RS_UGlatencyALLOWED > 0) ) { $HDlatency = '---------+'; $HTlatency = " "._QXZ("LATENCY",7)." |"; if (preg_match("/^2/",$AGENTlatency)) { $HDlatency = '--------------+'; $HTlatency = " "._QXZ("LATENCY",12)." |"; } if (preg_match("/^3/",$AGENTlatency)) { $HDlatency = '---------------------------------------------+'; $HTlatency = " "._QXZ("LATENCY avg/peak (minutes)",43)." |"; } } if ($agent_pause_codes_active > 0) { $HDstatus = "----------"; $HTstatus = " "._QXZ("STATUS",8)." "; $HDpause = "-------+"; $HTpause = " "._QXZ("PAUSE",5)." |"; } if ( ($SIPmonitorLINK<1) and ($IAXmonitorLINK<1) and (!preg_match("/MONITOR|BARGE|WHISPER/",$monitor_active) ) ) { $HDsessionid = "-----------+"; $HTsessionid = " "._QXZ("SESSIONID",9)." |"; } ##### END TEXT Output generation ##### } if ( ($report_display_type=='HTML') or ($report_display_type=='LIMITED') ) { ##### BEGIN HTML Output generation ##### $HDbegin = ""; $HTbegin = ""; $HDstation = ""; $HTstation = ""; $HDphone = ""; $HTphone = ""; if ($RTajax > 0) {$HTphone = "";} $HDuser = ""; $HTuser = ""; $HDusergroup = ""; $HTusergroup = ""; if ($RTajax > 0) {$HTusergroup = "";} $HDsessionid = ""; $HTsessionid = ""; $HDlisten = ""; $HTlisten = ""; $HDbarge = ""; $HTbarge = ""; $HDwhisper = ""; $HTwhisper = ""; $HDmonitor = ""; $HTmonitor = ""; $HDstatus = ""; $HTstatus = ""; $HDcustphone = ""; $HTcustphone = ""; $HDcustinfo = ""; $HTcustinfo = ""; $HDserver_ip = ""; $HTserver_ip = ""; $HDcall_server_ip = ""; $HTcall_server_ip = ""; $HDtime = ""; $HTtime = ""; if ($RTajax > 0) {$HTtime = "";} $HDcampaign = ""; $HTcampaign = ""; if ($RTajax > 0) {$HTcampaign = "";} $HDcalls = ""; $HTcalls = ""; $HDinbcalls = ""; $HTinbcalls = ""; $HDpause = ''; $HTpause = ''; $HDigcall = ""; $HTigcall = ""; if ($RS_DIDdesc > 0) { $HDigcall = ""; $HTigcall = ""; } if ($RS_INcolumnsHIDE > 0) { $HDigcall = ''; $HTigcall = ''; } $HDastcall = ''; $HTastcall = ''; if (strlen($RS_AGENTstatusTALLY) > 0) { $HDastcall = ''; $HTastcall = ""; } $HDlatency = ''; $HTlatency = ''; if ( ($AGENTlatency != 0) and ($RS_UGlatencyALLOWED > 0) ) { $HDlatency = ''; $HTlatency = ""; if (preg_match("/^3/",$AGENTlatency)) {$HTlatency = "";} } if ($agent_pause_codes_active > 0) { $HDstatus = ""; $HTstatus = ""; $HDpause = ""; $HTpause = ""; } if ( ($SIPmonitorLINK<1) and ($IAXmonitorLINK<1) and (!preg_match("/MONITOR|BARGE|WHISPER/",$monitor_active) ) ) { $HDsessionid = ""; $HTsessionid = ""; } ##### END HTML Output generation ##### } if ($PHONEdisplay < 1) { $HDphone = ''; $HTphone = ''; } if ($MONITORdisplay < 1) { $HDmonitor = ''; $HTmonitor = ''; } if ($CUSTPHONEdisplay < 1) { $HDcustphone = ''; $HTcustphone = ''; } if ($CUSTINFOdisplay < 1) { $HDcustinfo = ''; $HTcustinfo = ''; } if ($UGdisplay < 1) { $HDusergroup = ''; $HTusergroup = ''; } if ( ($SIPmonitorLINK<2) and ($IAXmonitorLINK<2) and ( (!preg_match("/MONITOR|BARGE|WHISPER/",$monitor_active) ) or (!preg_match("/MONITOR/",$RS_ListenBarge) ) ) ) { $HDlisten = ''; $HTlisten = ''; } if ( ($SIPmonitorLINK<2) and ($IAXmonitorLINK<2) and ( (!preg_match("/BARGE/",$monitor_active) ) or (!preg_match("/BARGE/",$RS_ListenBarge) ) ) ) { $HDbarge = ''; $HTbarge = ''; } if ( ($SIPmonitorLINK<2) and ($IAXmonitorLINK<2) and ( (!preg_match("/WHISPER/",$monitor_active) ) or (!preg_match("/WHISPER/",$RS_ListenBarge) ) ) ) { $HDwhisper = ''; $HTwhisper = ''; } if ($SERVdisplay < 1) { $HDserver_ip = ''; $HTserver_ip = ''; $HDcall_server_ip = ''; $HTcall_server_ip = ''; } if ($realtime_block_user_info > 0) { $Aline = "$HDbegin$HDusergroup$HDsessionid$HDlisten$HDbarge$HDwhisper$HDmonitor$HDstatus$HDpause$HDcustphone$HDcustinfo$HDserver_ip$HDcall_server_ip$HDtime$HDcampaign$HDcalls$HDinbcalls$HDlatency$HDastcall$HDigcall$\n"; $Bline = "$HTbegin$HTusergroup$HTsessionid$HDlisten$HTbarge$HTwhisper$HTmonitor$HTstatus$HTpause$HTcustphone$HTcustinfo$HTserver_ip$HTcall_server_ip$HTtime$HTcampaign$HTcalls$HTinbcalls$HTlatency$HTastcall$HTigcall\n"; } else { $Aline = "$HDbegin$HDstation$HDphone$HDuser$HDusergroup$HDsessionid$HDlisten$HDbarge$HDwhisper$HDmonitor$HDstatus$HDpause$HDcustphone$HDcustinfo$HDserver_ip$HDcall_server_ip$HDtime$HDcampaign$HDcalls$HDinbcalls$HDlatency$HDastcall$HDigcall\n"; $Bline = "$HTbegin$HTstation$HTphone$HTuser$HTusergroup$HTsessionid$HTlisten$HTbarge$HTwhisper$HTmonitor$HTstatus$HTpause$HTcustphone$HTcustinfo$HTserver_ip$HTcall_server_ip$HTtime$HTcampaign$HTcalls$HTinbcalls$HTlatency$HTastcall$HTigcall\n"; } $Aecho .= "$Aline"; $Aecho .= "$Bline"; $Aecho .= "$Aline"; if ($orderby=='timeup') {$orderSQL='vicidial_live_agents.status,last_call_time';} if ($orderby=='timedown') {$orderSQL='vicidial_live_agents.status desc,last_call_time desc';} if ($orderby=='campaignup') {$orderSQL='vicidial_live_agents.campaign_id,vicidial_live_agents.status,last_call_time';} if ($orderby=='campaigndown') {$orderSQL='vicidial_live_agents.campaign_id desc,vicidial_live_agents.status desc,last_call_time desc';} if ($orderby=='groupup') {$orderSQL='user_group,vicidial_live_agents.status,last_call_time';} if ($orderby=='groupdown') {$orderSQL='user_group desc,vicidial_live_agents.status desc,last_call_time desc';} if ($orderby=='phoneup') {$orderSQL='extension,server_ip';} if ($orderby=='phonedown') {$orderSQL='extension desc,server_ip desc';} if ($UidORname > 0) { if ($orderby=='userup') {$orderSQL='full_name,status,last_call_time';} if ($orderby=='userdown') {$orderSQL='full_name desc,status desc,last_call_time desc';} } else { if ($orderby=='userup') {$orderSQL='vicidial_live_agents.user';} if ($orderby=='userdown') {$orderSQL='vicidial_live_agents.user desc';} } if ( !preg_match("/ALL-/",$LOGallowed_campaigns) ) {$UgroupSQL = " and vicidial_live_agents.campaign_id IN($group_SQL)";} else if ( (preg_match('/ALL\-ACTIVE/i',$group_string)) and (strlen($group_SQL) < 3) ) {$UgroupSQL = '';} else {$UgroupSQL = " and vicidial_live_agents.campaign_id IN($group_SQL)";} if (strlen($usergroup)<1) {$usergroupSQL = '';} else {$usergroupSQL = " and user_group='" . mysqli_real_escape_string($link, $usergroup) . "'";} if ( (preg_match('/ALL\-GROUPS/i',$user_group_string)) and (strlen($user_group_SQL) < 3) ) {$user_group_filter_SQL = '';} else {$user_group_filter_SQL = " and vicidial_users.user_group IN($user_group_SQL)";} $ring_agents=0; $Aextension=array(); $Auser=array(); $Asessionid=array(); $Astatus=array(); $Aserver_ip=array(); $Acall_time=array(); $Acall_finish=array(); $Acall_server_ip=array(); $Acampaign_id=array(); $Auser_group=array(); $Afull_name=array(); $Acomments=array(); $Acalls_today=array(); $Acallerid=array(); $Alead_id=array(); $Astate_change=array(); $Aon_hook_agent=array(); $Aring_callerid=array(); $Aagent_log_id=array(); $Aring_note=array(); $VAClead_ids=array(); $VACphones=array(); $Alatency_min_avg=array(); $Alatency_min_peak=array(); $Alatency_hour_avg=array(); $Alatency_hour_peak=array(); $Alatency_today_avg=array(); $Alatency_today_peak=array(); $Alatency_now=array(); ### Monitoring check ### if ($MONITORdisplay) { $monitoring_users=array(); $monitoring_types=array(); $monitoring_agents=array(); $monitoring_sessions=array(); $monitoring_codes=array(); $monitoring_times=array(); $monitoring_phones=array(); $monitoring_manager_ips=array(); $monitoring_ips=array(); $monitor_stmt="select manager_user, agent_user, agent_session, caller_code, monitor_type, monitor_start_time, agent_server_ip, manager_server_ip, manager_phone from vicidial_daily_rt_monitoring_log where monitor_start_time>=curdate() and monitor_end_time is null order by monitor_start_time desc"; if ($DB) {echo $monitor_stmt."\n";} $monitor_rslt=mysql_to_mysqli($monitor_stmt, $link); while($monitor_row=mysqli_fetch_array($monitor_rslt)) { $manager_user=$monitor_row["manager_user"]; if(!in_array($manager_user, $monitoring_users)) { array_push($monitoring_users, $manager_user); array_push($monitoring_types, $monitor_row["monitor_type"]); array_push($monitoring_agents, $monitor_row["agent_user"]); array_push($monitoring_sessions, $monitor_row["agent_session"]); array_push($monitoring_codes, $monitor_row["caller_code"]); array_push($monitoring_times, $monitor_row["monitor_start_time"]); array_push($monitoring_manager_ips, $monitor_row["manager_server_ip"]); array_push($monitoring_phones, $monitor_row["manager_phone"]); array_push($monitoring_ips, $monitor_row["agent_server_ip"]); } } } # select * from live_channels where ######################## $stmt="SELECT extension,vicidial_live_agents.user,conf_exten,vicidial_live_agents.status,vicidial_live_agents.server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,vicidial_live_agents.campaign_id,vicidial_users.user_group,vicidial_users.full_name,vicidial_live_agents.comments,vicidial_live_agents.calls_today,vicidial_live_agents.callerid,lead_id,UNIX_TIMESTAMP(last_state_change),on_hook_agent,ring_callerid,agent_log_id,vicidial_live_agents.closer_campaigns from vicidial_live_agents,vicidial_users where vicidial_live_agents.user=vicidial_users.user and vicidial_users.user_hide_realtime='0' $UgroupSQL $usergroupSQL $user_group_filter_SQL order by $orderSQL;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $talking_to_print = mysqli_num_rows($rslt); if ($talking_to_print > 0) { $i=0; $va=0; $mc=0; # Get inbound call counts $inbound_call_counts=array(); $inb_call_stmt="select user, count(*) from vicidial_closer_log where call_date>=date(now()) ".($all_active_inbound_calls ? "" : "and campaign_id in ($inbound_calls_SQL)")." group by user"; $inb_call_rslt=mysql_to_mysqli($inb_call_stmt, $link); while ($inb_call_row=mysqli_fetch_row($inb_call_rslt)) { $inbound_call_counts["$inb_call_row[0]"]=$inb_call_row[1]; } while ($i < $talking_to_print) { $row=mysqli_fetch_row($rslt); $ingroup_pass=1; if ( (strlen($ingroup_string) > 1) and (!preg_match("/ALL-INGROUPS/",$ingroup_string)) ) { $ingroup_pass=0; $fcc_ct=0; $fcc_array = explode(" ",$filter_closer_campaigns_STRING); $fcc_array_ct = count($fcc_array); if (strlen($row[19]) > 2) { while($fcc_array_ct > $fcc_ct) { $temp_fcc = $fcc_array[$fcc_ct]; if (preg_match("/ $temp_fcc /",$row[19])) {$ingroup_pass++;} $fcc_ct++; } #if ($DB > 0) {echo "INBOUND FILTER AGENT DEBUG: $row[1]|$row[19]|$ingroup_string|$filter_closer_campaigns_STRING
\n";} } } if ($ingroup_pass > 0) { $Aextension[$va] = $row[0]; $Auser[$va] = $row[1]; $Asessionid[$va] = $row[2]; $Astatus[$va] = $row[3]; $Aserver_ip[$va] = $row[4]; $Acall_time[$va] = $row[5]; $Acall_finish[$va] = $row[6]; $Acall_server_ip[$va] = $row[7]; $Acampaign_id[$va] = $row[8]; $Auser_group[$va] = $row[9]; $Afull_name[$va] = $row[10]; $Acomments[$va] = $row[11]; $Acalls_today[$va] = $row[12]; $Acallerid[$va] = $row[13]; $Alead_id[$va] = $row[14]; $Astate_change[$va] = $row[15]; $Aon_hook_agent[$va] = $row[16]; $Aring_callerid[$va] = $row[17]; $Aagent_log_id[$va] = $row[18]; $Acloser_campaigns[$va] = $row[19]; $Aring_note[$va] = ' '; $Amonitors[$va] = ' '; $Amonitor_types[$va] = ' '; if ($Aon_hook_agent[$va] == 'Y') { $Aring_note[$va] = '*'; $ring_agents++; if (strlen($Aring_callerid[$va]) > 18) {$Astatus[$va]="RING";} } ### 3-WAY Check ### if ($Alead_id[$va]!=0) { $threewaystmt="SELECT UNIX_TIMESTAMP(last_call_time) from vicidial_live_agents where lead_id='$Alead_id[$va]' and status='INCALL' order by UNIX_TIMESTAMP(last_call_time) desc"; $threewayrslt=mysql_to_mysqli($threewaystmt, $link); if (mysqli_num_rows($threewayrslt)>1) { $Astatus[$va]="3-WAY"; $srow=mysqli_fetch_row($threewayrslt); $Acall_mostrecent[$va]=$srow[0]; } } ### END 3-WAY Check ### ### Monitor search ### # Check if this agent ties to an unfinished monitoring session if ($MONITORdisplay > 0) { # Get indices of active monitoring sessions for this user, if any $active_monitoring_indices=array_keys($monitoring_agents, $Auser[$va]); for ($m=0; $m0) { $followup_row=mysqli_fetch_array($followup_rslt); $extension=$followup_row["extension"]; $channel_data=$followup_row["channel_data"]; $channel_data=preg_replace('/,.*$/', '', $channel_data); $monitor_stmtB="select * from live_sip_channels where channel='$channel_data' and extension='$monitoring_session' UNION select * from live_sip_channels where channel='$channel_data' and extension='$monitoring_session'"; $monitor_rsltB=mysql_to_mysqli($monitor_stmtB, $link); $monitor_match+=mysqli_num_rows($monitor_rsltB); } } } if ($DB) { $Aecho.=""; $Aecho.=""; $Aecho.=""; } if ($monitor_match>0) { $Amonitors[$va].="$monitoring_user, "; $Amonitor_types[$va].="$monitoring_type, "; $mc++; } } } $Amonitors[$va]=trim(preg_replace('/\,\s+$/', '', $Amonitors[$va])); $Amonitor_types[$va]=trim(preg_replace('/\,\s+$/', '', $Amonitor_types[$va])); } ### END Monitor search ### ### Latency Check ### if ( ($AGENTlatency != 0) and ($RS_UGlatencyALLOWED > 0) ) { $latencystmt="SELECT latency_min_avg,latency_min_peak,latency_hour_avg,latency_hour_peak,latency_today_avg,latency_today_peak,latency from vicidial_live_agents_details where user='$Auser[$va]';"; $latencyrslt=mysql_to_mysqli($latencystmt, $link); if (mysqli_num_rows($latencyrslt)>0) { $srow=mysqli_fetch_row($latencyrslt); $Alatency_min_avg[$va] = $srow[0]; $Alatency_min_peak[$va] = $srow[1]; $Alatency_hour_avg[$va] = $srow[2]; $Alatency_hour_peak[$va] = $srow[3]; $Alatency_today_avg[$va] = $srow[4]; $Alatency_today_peak[$va] = $srow[5]; $Alatency_now[$va] = $srow[6]; } } ### END Latency Check ### $va++; } $i++; } $talking_to_print = $va; $callerids=''; $pausecode=''; $stmt="SELECT callerid,lead_id,phone_number from vicidial_auto_calls;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $calls_to_list = mysqli_num_rows($rslt); if ($calls_to_list > 0) { $i=0; while ($i < $calls_to_list) { $row=mysqli_fetch_row($rslt); if ($LOGadmin_hide_phone_data != '0') { if ($DB > 0) {echo "HIDEPHONEDATA|$row[2]|$LOGadmin_hide_phone_data|\n";} $phone_temp = $row[2]; if (strlen($phone_temp) > 0) { if ($LOGadmin_hide_phone_data == '4_DIGITS') {$row[2] = str_repeat("X", (strlen($phone_temp) - 4)) . substr($phone_temp,-4,4);} elseif ($LOGadmin_hide_phone_data == '3_DIGITS') {$row[2] = str_repeat("X", (strlen($phone_temp) - 3)) . substr($phone_temp,-3,3);} elseif ($LOGadmin_hide_phone_data == '2_DIGITS') {$row[2] = str_repeat("X", (strlen($phone_temp) - 2)) . substr($phone_temp,-2,2);} else {$row[2] = preg_replace("/./",'X',$phone_temp);} } } $callerids .= "$row[0]|"; $VAClead_ids[$i] = $row[1]; $VACphones[$i] = $row[2]; $i++; } } ### Lookup phone logins $i=0; while ($i < $talking_to_print) { if (preg_match("/R\//i",$Aextension[$i])) { $protocol = 'EXTERNAL'; $dialplan = preg_replace('/R\//i', '',$Aextension[$i]); $dialplan = preg_replace('/\@.*/i', '',$dialplan); $exten = "dialplan_number='$dialplan'"; } if (preg_match("/Local\//i",$Aextension[$i])) { $protocol = 'EXTERNAL'; $dialplan = preg_replace('/Local\//i', '',$Aextension[$i]); $dialplan = preg_replace('/\@.*/i', '',$dialplan); $exten = "dialplan_number='$dialplan'"; } if (preg_match('/SIP\//i',$Aextension[$i])) { $protocol = 'SIP'; $dialplan = preg_replace('/SIP\//i', '',$Aextension[$i]); $dialplan = preg_replace('/\-.*/i', '',$dialplan); $exten = "extension='$dialplan'"; } if (preg_match('/IAX2\//i',$Aextension[$i])) { $protocol = 'IAX2'; $dialplan = preg_replace('/IAX2\//i', '',$Aextension[$i]); $dialplan = preg_replace('/\-.*/i', '',$dialplan); $exten = "extension='$dialplan'"; } if (preg_match('/Zap\//i',$Aextension[$i])) { $protocol = 'Zap'; $dialplan = preg_replace('/Zap\//i', '',$Aextension[$i]); $exten = "extension='$dialplan'"; } if (preg_match('/DAHDI\//i',$Aextension[$i])) { $protocol = 'Zap'; $dialplan = preg_replace('/DAHDI\//i', '',$Aextension[$i]); $exten = "extension='$dialplan'"; } $stmt="SELECT login from phones where server_ip='$Aserver_ip[$i]' and $exten and protocol='$protocol';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $phones_to_print = mysqli_num_rows($rslt); if ($phones_to_print > 0) { $row=mysqli_fetch_row($rslt); $Alogin[$i] = "$row[0]-----$i"; } else { $Alogin[$i] = "$Aextension[$i]-----$i"; } $i++; } ### Sort by phone if selected if ($orderby=='phoneup') { sort($Alogin); } if ($orderby=='phonedown') { rsort($Alogin); } ### Run through the loop to display agents $j=0; $agentcount=0; while ($j < $talking_to_print) { $n=0; $custphone=''; $cust_state=''; $cust_entrydate=''; $cust_source=''; while ($n < $calls_to_list) { if ( ( (preg_match("/$VAClead_ids[$n]/", $Alead_id[$j])) and (strlen($VAClead_ids[$n]) == strlen($Alead_id[$j])) and (strlen($VAClead_ids[$n] > 1)) ) and ($RS_hide_CUST_info < 1) ) {$custphone = $VACphones[$n];} $n++; } $phone_split = explode("-----",$Alogin[$j]); $i = $phone_split[1]; if (preg_match("/READY|PAUSED/i",$Astatus[$i])) { $Acall_time[$i]=$Astate_change[$i]; if ($Alead_id[$i] > 0) { $Astatus[$i] = 'DISPO'; $Lstatus = 'DISPO'; $status = ' DISPO'; } } if ($non_latin < 1) { $extension = preg_replace('/Local\//i', '',$Aextension[$i]); if ( ($report_display_type!='HTML') and ($report_display_type!='LIMITED') ) { $extension = sprintf("%-14s", $extension); while(strlen($extension)>14) {$extension = substr("$extension", 0, -1);} } } else { $extension = preg_replace('/Local\//i', '',$Aextension[$i]); if ( ($report_display_type!='HTML') and ($report_display_type!='LIMITED') ) { $extension = sprintf("%-48s", $extension); while(mb_strlen($extension, 'utf-8')>14) {$extension = mb_substr("$extension", 0, -1,'utf-8');} } } if ( (($CUSTINFOdisplay>0 || ($CUSTPHONEdisplay>0 && $ShowCustPhoneCode)) && $Alead_id[$j]>0) and ($RS_hide_CUST_info < 1) ) { $custinfo_stmt="select * from vicidial_list where lead_id='".$Alead_id[$j]."' and phone_number='".$custphone."'"; $custinfo_rslt=mysql_to_mysqli($custinfo_stmt, $link); $CIrow=mysqli_fetch_array($custinfo_rslt); $cust_state=$CIrow["state"]; $cust_entrydate=$CIrow["entry_date"]; $cust_source=substr($CIrow["source_id"], 0, 20); if ($ShowCustPhoneCode) {$custphone=$CIrow["phone_code"].$custphone;} } $phone = sprintf("%-18s", $phone_split[0]); $custphone = sprintf("%-15s", $custphone); $cust_state = sprintf("%-5s", $cust_state); $cust_entrydate = sprintf("%-19s", $cust_entrydate); $cust_source = sprintf("%-20s", $cust_source); $Luser = $Auser[$i]; $user = sprintf("%-20s", $Auser[$i]); $Lsessionid = $Asessionid[$i]; $sessionid = sprintf("%-9s", $Asessionid[$i]); $Lstatus = $Astatus[$i]; $status = sprintf("%-6s", $Astatus[$i]); $Lserver_ip = $Aserver_ip[$i]; $server_ip = sprintf("%-15s", $Aserver_ip[$i]); $call_server_ip = sprintf("%-15s", $Acall_server_ip[$i]); $campaign_id = sprintf("%-10s", $Acampaign_id[$i]); $comments= $Acomments[$i]; $calls_today = sprintf("%-5s", $Acalls_today[$i]); $inb_calls_today = sprintf("%-9s", ($inbound_call_counts["$Auser[$i]"]+0)); $monitor_info = sprintf("%-15s", $Amonitors[$i]); $monitor_type = sprintf("%-8s", $Amonitor_types[$i]); if ($agent_pause_codes_active > 0) { $pausecode=' '; } else {$pausecode='';} if (preg_match("/INCALL/i",$Lstatus)) { $stmtP="SELECT count(*) from parked_channels where channel_group='$Acallerid[$i]';"; if ($DB) {echo "$stmtP\n";} $rsltP=mysql_to_mysqli($stmtP,$link); $rowP=mysqli_fetch_row($rsltP); $parked_channel = $rowP[0]; if ($parked_channel > 0) { $Astatus[$i] = 'PARK'; $Lstatus = 'PARK'; $status = ' PARK '; } else { if (!preg_match("/$Acallerid[$i]\|/",$callerids) && !preg_match("/EMAIL/i",$comments) && !preg_match("/CHAT/i",$comments)) { if ($RS_no_DEAD_status > 0) { $Astatus[$i] = 'INCALL'; $Lstatus = 'INCALL'; $status = 'INCALL'; } else { $Acall_time[$i]=$Astate_change[$i]; $Astatus[$i] = 'DEAD'; $Lstatus = 'DEAD'; $status = ' DEAD '; } } else { if ($Acomments[$i] == 'MANUAL') { $stmt="SELECT uniqueid,channel from vicidial_auto_calls where callerid='$Acallerid[$i]' LIMIT 1;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $mandial_to_check = mysqli_num_rows($rslt); if ($mandial_to_check > 0) { $row=mysqli_fetch_row($rslt); if ( (strlen($row[0])<5) and (strlen($row[1])<5) ) { $Astatus[$i] = 'DIAL'; $Lstatus = 'DIAL'; $status = ' DIAL '; } } } } if (preg_match("/CHAT/i",$comments)) { $stmtCT="SELECT chat_id from vicidial_live_chats where chat_creator='$Auser[$i]' and lead_id='$Alead_id[$i]' order by chat_start_time desc limit 1;"; if ($DB) {echo "$stmtCT\n";} $rsltCT=mysql_to_mysqli($stmtCT,$link); $chatting_to_print = mysqli_num_rows($rslt); if ($chatting_to_print > 0) { $rowCT=mysqli_fetch_row($rsltCT); $Achat_id = $rowCT[0]; $stmtCL="SELECT count(*) from vicidial_chat_log where chat_id='$Achat_id' and message LIKE \"%has left chat\";"; if ($DB) {echo "$stmtCL\n";} $rsltCL=mysql_to_mysqli($stmtCL,$link); $rowCL=mysqli_fetch_row($rsltCL); $left_chat = $rowCL[0]; if ($left_chat > 0) { if ($RS_no_DEAD_status > 0) { $Astatus[$i] = 'CHAT'; $Lstatus = 'CHAT'; $status = 'CHAT'; } else { $Acall_time[$i]=$Astate_change[$i]; $Astatus[$i] = 'DEAD'; $Lstatus = 'DEAD'; $status = 'DEAD C'; } } } } } if ( (preg_match("/AUTO/i",$comments)) or (strlen($comments)<1) ) {$CM='A';} else { if (preg_match("/INBOUND/i",$comments)) {$CM='I';} else if (preg_match("/EMAIL/i",$comments)) {$CM='E';} else {$CM='M';} } } else { if (preg_match("/3-WAY/i",$Lstatus)) { if (!preg_match("/$Acallerid[$i]\|/",$callerids) && !preg_match("/EMAIL/i",$comments) && !preg_match("/CHAT/i",$comments)) { if ($RS_no_DEAD_status < 1) { $Acall_time[$i]=$Astate_change[$i]; $Astatus[$i] = '3-WAYD'; $Lstatus = '3-WAYD'; $status = '3-WAYD'; } } if ( (preg_match("/AUTO/i",$comments)) or (strlen($comments)<1) ) {$CM='A';} else { if (preg_match("/INBOUND/i",$comments)) {$CM='I';} else if (preg_match("/EMAIL/i",$comments)) {$CM='E';} else {$CM='M';} } } else {$CM=' ';} } if ($UGdisplay > 0) { if ($non_latin < 1) { $user_group = sprintf("%-12s", $Auser_group[$i]); if ( ($report_display_type!='HTML') and ($report_display_type!='LIMITED') ) { while(strlen($user_group)>12) {$user_group = substr("$user_group", 0, -1);} } } else { $user_group = sprintf("%-40s", $Auser_group[$i]); if ( ($report_display_type!='HTML') and ($report_display_type!='LIMITED') ) { while(mb_strlen($user_group, 'utf-8')>12) {$user_group = mb_substr("$user_group", 0, -1,'utf-8');} } } } if ($UidORname > 0) { if ($non_latin < 1) { $user = sprintf("%-20s", $Afull_name[$i]); if ( ($report_display_type!='HTML') and ($report_display_type!='LIMITED') ) { while(strlen($user)>20) {$user = substr("$user", 0, -1);} } } else { $user = sprintf("%-60s", $Afull_name[$i]); if ( ($report_display_type!='HTML') and ($report_display_type!='LIMITED') ) { while(mb_strlen($user, 'utf-8')>20) {$user = mb_substr("$user", 0, -1,'utf-8');} } } } if (!preg_match("/INCALL|DIAL|QUEUE|PARK|3-WAY/i",$Astatus[$i])) {$call_time_S = ($STARTtime - $Astate_change[$i]);} else if (preg_match("/3-WAY/i",$Astatus[$i])) {$call_time_S = ($STARTtime - $Acall_mostrecent[$i]);} else {$call_time_S = ($STARTtime - $Acall_time[$i]);} $call_time_MS = sec_convert($call_time_S,'M'); $call_time_MS = sprintf("%7s", $call_time_MS); $call_time_MS = " $call_time_MS"; $G = ''; $EG = ''; $tr_class='TRblank'; if ( ($Lstatus=='INCALL') or ($Lstatus=='PARK') ) { if ($comments == 'CHAT') {$G=''; $EG=''; $status='CHAT'; $tr_class='TRred';} else if ($comments == 'EMAIL') {$G=''; $EG=''; $status='EMAIL'; $tr_class='TRorange';} else { if ($call_time_S >= $rt_report_times["incall_short_time"]) {$G=''; $EG=''; $tr_class='TRthistle';} if ($call_time_S >= $rt_report_times["incall_medium_time"]) {$G=''; $EG=''; $tr_class='TRviolet';} if ($call_time_S >= $rt_report_times["incall_long_time"]) {$G=''; $EG=''; $tr_class='TRpurple';} # if ($call_time_S >= 600) {$G=''; $EG=''; $tr_class='TRpurple';} } } if ($Lstatus=='3-WAY') { if ($call_time_S >= $rt_report_times["threeway_short_time"]) {$G=''; $EG=''; $tr_class='TRlime';} } if ($Lstatus=='3-WAYD') { if ($call_time_S >= $rt_report_times["threeway_short_time"]) {$G=''; $EG=''; $tr_class='TRblack';} } if ($Lstatus=='DEAD') { if ($call_time_S >= 21600) {$j++; continue;} else { $agent_dead++; $agent_total++; $G = ''; $EG = ''; $tr_class='TRblank'; if ($call_time_S >= $rt_report_times["dead_short_time"]) {$G=''; $EG=''; $tr_class='TRblack';} } } if ($Lstatus=='DISPO') { if ($call_time_S >= 21600) {$j++; continue;} else { $agent_dispo++; $agent_total++; $G = ''; $EG = ''; $tr_class='TRblank'; if ($call_time_S >= $rt_report_times["paused_short_time"]) {$G=''; $EG=''; $tr_class='TRkhaki';} if ($call_time_S >= $rt_report_times["paused_medium_time"]) {$G=''; $EG=''; $tr_class='TRyellow';} if ($call_time_S >= $rt_report_times["paused_long_time"]) {$G=''; $EG=''; $tr_class='TRolive';} if ($call_time_S >= $rt_report_times["paused_long_time10"]) {$G=''; $EG=''; $tr_class='TRdarkolivegreen';} if ($call_time_S >= $rt_report_times["paused_long_time15"]) {$G=''; $EG=''; $tr_class='TRsaddlebrown';} if ($call_time_S >= $rt_report_times["pause_limit"]) {$G=''; $EG=''; $tr_class='TRdarkred';} } } if ($Lstatus=='PAUSED') { if ($agent_pause_codes_active > 0) { $twentyfour_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-24,date("i"),date("s"),date("m"),date("d"),date("Y"))); $stmtC="SELECT sub_status from vicidial_agent_log where agent_log_id >= \"$Aagent_log_id[$i]\" and user='$Luser' order by agent_log_id desc limit 1;"; $rsltC=mysql_to_mysqli($stmtC,$link); $rowC=mysqli_fetch_row($rsltC); $pausecode = sprintf("%-6s", $rowC[0]); $pausecode="$pausecode "; if ($SSenable_pause_code_limits > 0) { $pause_limit_stmt="SELECT time_limit from vicidial_pause_codes where campaign_id='$Acampaign_id[$i]' and pause_code='$rowC[0]'"; $pause_limit_rslt=mysql_to_mysqli($pause_limit_stmt, $link); if (mysqli_num_rows($pause_limit_rslt)>0) { $pause_limit_row=mysqli_fetch_row($pause_limit_rslt); $pause_limit=$pause_limit_row[0]; } else { $pause_limit=$rt_report_times["pause_limit"]; } } else {$pause_limit="999999";} } else {$pausecode=''; $pause_limit="999999";} if ($call_time_S >= 21600) {$j++; continue;} else { $agent_paused++; $agent_total++; $G = ''; $EG = ''; $tr_class='TRblank'; if ($call_time_S >= $rt_report_times["paused_short_time"]) {$G=''; $EG=''; $tr_class='TRkhaki';} if ($call_time_S >= $rt_report_times["paused_medium_time"]) {$G=''; $EG=''; $tr_class='TRyellow';} if ($call_time_S >= $rt_report_times["paused_long_time"]) {$G=''; $EG=''; $tr_class='TRolive';} if ($call_time_S >= $rt_report_times["paused_long_time10"]) {$G=''; $EG=''; $tr_class='TRdarkolivegreen';} if ($call_time_S >= $rt_report_times["paused_long_time15"]) {$G=''; $EG=''; $tr_class='TRsaddlebrown';} if ($call_time_S >= $pause_limit) {$G=''; $EG=''; $tr_class='TRdarkred';} } } # if ( (strlen($Acall_server_ip[$i])> 4) and ($Acall_server_ip[$i] != "$Aserver_ip[$i]") ) # {$G=''; $EG='';} if ( (preg_match("/INCALL|DIAL/i",$status)) or (preg_match("/QUEUE/i",$status)) or (preg_match("/3-WAY/i",$status)) or (preg_match('/PARK/i',$status))) {$agent_incall++; $agent_total++;} if (preg_match("/DIAL/i",$status)) {$agent_indial++;} if ( (preg_match("/READY/i",$status)) or (preg_match("/CLOSER/i",$status)) ) {$agent_ready++; $agent_total++;} if ( (preg_match("/READY/i",$status)) or (preg_match("/CLOSER/i",$status)) ) { if ($RS_agentWAIT == 4) { $G=''; $EG=''; $tr_class='TRlightblue'; if ($call_time_S >= $rt_report_times["waiting_short_time"]) {$G=''; $EG=''; $tr_class='TRrust';} if ($call_time_S >= $rt_report_times["waiting_medium_time"]) {$G=''; $EG=''; $tr_class='TRblue';} if ($call_time_S >= $rt_report_times["waiting_long_time"]) {$G=''; $EG=''; $tr_class='TRmidnightblue';} } else { $G=''; $EG=''; $tr_class='TRlightblue'; if ($call_time_S >= $rt_report_times["waiting_medium_time"]) {$G=''; $EG=''; $tr_class='TRblue';} if ($call_time_S >= $rt_report_times["waiting_long_time"]) {$G=''; $EG=''; $tr_class='TRmidnightblue';} } } if ($Astatus[$i] == 'RING') { $agent_total++; $G = ''; $EG = ''; $tr_class='TRblank'; if ($call_time_S >= 0) {$G=''; $EG=''; $tr_class='TRsalmon';} } $L=''; $R=''; $filtered_ingroup=1; # assume ingroup is not filtered out if ($report_display_type=='TEXT') { if ($SIPmonitorLINK>0) {$L=" | "._QXZ("LISTEN",6).""; $R='';} if ($IAXmonitorLINK>0) {$L=" | "._QXZ("LISTEN",6).""; $R='';} if ($SIPmonitorLINK>1) {$R=" | "._QXZ("BARGE",5)."";} if ($IAXmonitorLINK>1) {$R=" | BARGE";} if ( (strlen($monitor_phone)>1) and (preg_match("/MONITOR|BARGE|WHISPER/",$monitor_active) ) and (preg_match("/MONITOR/",$RS_ListenBarge) ) ) {$L=" | "._QXZ("LISTEN",6).""; $R='';} if ( (strlen($monitor_phone)>1) and (preg_match("/BARGE|WHISPER/",$monitor_active) ) and (preg_match("/BARGE/",$RS_ListenBarge) ) ) { $BARGEstage = 'BARGE'; if ($RS_BargeSwap > 0) {$BARGEstage = 'BARGESWAP';} $R=" | "._QXZ("BARGE",5).""; } if ($SIPmonitorLINK>1) {$R=" | WHISPER";} if ($IAXmonitorLINK>1) {$R=" | WHISPER";} if ( (strlen($monitor_phone)>1) and (preg_match("/WHISPER/",$monitor_active) ) and (preg_match("/WHISPER/",$RS_ListenBarge) ) ) {$R=" | WHISPER";} if ($MONITORdisplay > 0) {$MO = " $G$monitor_info$EG | $G$monitor_type$EG |";} else {$MO = "";} if ($CUSTPHONEdisplay > 0) {$CP = " $G$custphone$EG |";} else {$CP = "";} if ($CUSTINFOdisplay > 0) {$CI = " $G$custphone$EG | $G$cust_source$EG | $G$cust_entrydate$EG | $G$cust_state$EG |";} else {$CI = "";} if ($UGdisplay > 0) {$UGD = " $G$user_group$EG |";} else {$UGD = "";} if ($SERVdisplay > 0) {$SVD = " $G$server_ip$EG | $G$call_server_ip$EG |";} else {$SVD = "";} if ($PHONEdisplay > 0) {$phoneD = "$G$phone$EG | ";} else {$phoneD = " ";} $vac_stage=''; $vac_campaign=''; $INGRP=''; $INORcolor=''; $INuniqueid=''; if ($CM == 'I') { $stmt="SELECT vac.campaign_id,vac.stage,vig.group_name,vig.group_id,uniqueid from vicidial_auto_calls vac,vicidial_inbound_groups vig where vac.callerid='$Acallerid[$i]' and vac.campaign_id=vig.group_id LIMIT 1;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $ING=$G; $INEG=$EG; $ingrp_to_print = mysqli_num_rows($rslt); if ($ingrp_to_print > 0) { $row=mysqli_fetch_row($rslt); $vac_campaign_id=$row[0]; if (!in_array("ALL-INGROUPS", $ingroup_filter) && !in_array($vac_campaign_id, $ingroup_filter)) { $filtered_ingroup=0; } $vac_campaign = sprintf("%-27s", "$row[0] - $row[2]"); $row[1] = preg_replace('/.*\-/i', '',$row[1]); $vac_stage = sprintf("%-4s", $row[1]); $INORcolor = $row[3]; $INuniqueid = $row[4]; if ( ($INGROUPcolorOVERRIDE>0) or ($INGROUPcolorOVERRIDE=='YES') ) { $ING=''; $INEG=''; } } $INGRP = " $ING$vac_stage$INEG | $ING$vac_campaign$INEG "; if ( ($RS_DIDdesc > 0) and (strlen($INuniqueid) > 0) ) { $did_id=''; $did_extension=''; $did_description=''; $stmt="SELECT did_id,extension from vicidial_did_log where uniqueid='$INuniqueid' and call_date > \"$timeSIXhoursAGO\" order by call_date asc LIMIT 1;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $didL_to_print = mysqli_num_rows($rslt); if ($didL_to_print > 0) { $row=mysqli_fetch_row($rslt); $did_id = $row[0]; $did_extension = $row[1]; } else { $newINuniqueid=''; $stmt="SELECT uniqueid from vicidial_closer_log where lead_id='$Alead_id[$j]' and uniqueid!='$INuniqueid' and call_date > \"$timeSIXhoursAGO\" order by call_date desc LIMIT 1;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $didL_to_print = mysqli_num_rows($rslt); if ($didL_to_print > 0) { $row=mysqli_fetch_row($rslt); $newINuniqueid = $row[0]; } if (strlen($newINuniqueid) > 4) { $stmt="SELECT did_id,extension from vicidial_did_log where uniqueid='$newINuniqueid' and call_date > \"$timeSIXhoursAGO\" order by call_date asc LIMIT 1;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $didL_to_print = mysqli_num_rows($rslt); if ($didL_to_print > 0) { $row=mysqli_fetch_row($rslt); $did_id = $row[0]; $did_extension = $row[1]; } } } $stmt="SELECT did_description from vicidial_inbound_dids where did_id='$did_id' LIMIT 1;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $did_to_print = mysqli_num_rows($rslt); if ($did_to_print > 0) { $row=mysqli_fetch_row($rslt); $did_description = $row[0]; } $INGRP = " $ING$vac_stage$INEG | $ING$vac_campaign$INEG | $ING$did_description$INEG "; } if ($RS_INcolumnsHIDE > 0) { $INGRP = ''; } } $LATENCY=''; if ( ($AGENTlatency != 0) and ($RS_UGlatencyALLOWED > 0) ) { $LTC=$G; $LTCG=$EG; # if ($INORcolor > 0) # { # $LTC=''; $LTCG=''; # } if (preg_match("/^1/",$AGENTlatency)) { $latency_print = sprintf("%-5s", $Alatency_min_avg[$i]); $LATENCY = " $LTC".$latency_print."ms$LTCG |"; } if (preg_match("/^2/",$AGENTlatency)) { $latency_print = sprintf("%-10s", "$Alatency_min_avg[$i]/$Alatency_min_peak[$i]"); $LATENCY = " $LTC".$latency_print."ms$LTCG |"; } if (preg_match("/^3/",$AGENTlatency)) { $latency_print = sprintf("%-43s", "$Alatency_min_avg[$i]/$Alatency_min_peak[$i]ms(1) $Alatency_hour_avg[$i]/$Alatency_hour_peak[$i]ms(60) $Alatency_today_avg[$i]/$Alatency_today_peak[$i]ms(DAY)"); $LATENCY = " $LTC".$latency_print."$LTCG |"; } if (preg_match("/^4/",$AGENTlatency)) { $latency_print = sprintf("%-5s", $Alatency_now[$i]); $LATENCY = " $LTC".$latency_print."ms$LTCG |"; } } $ASTCT=''; if (strlen($RS_AGENTstatusTALLY) > 0) { $AST_ct=0; $SStimeclock_end_of_day_HH = substr($SStimeclock_end_of_day,0,2); $SStimeclock_end_of_day_MM = substr($SStimeclock_end_of_day,2,2); $TCEODdate = date("Y-m-d H:i:s", mktime($SStimeclock_end_of_day_HH,$SStimeclock_end_of_day_MM,0,date("m"),date("d"),date("Y"))); $stmt="SELECT count(*) from vicidial_agent_log where event_time >= \"$TCEODdate\" and user='$Auser[$i]' and status='$RS_AGENTstatusTALLY';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $AST=$G; $ASTG=$EG; $ast_to_print = mysqli_num_rows($rslt); if ($ast_to_print > 0) { $row=mysqli_fetch_row($rslt); $AST_ct = sprintf("%-6s", $row[0]); if ($INORcolor > 0) { $AST=''; $ASTG=''; } } $ASTCT = " $AST$AST_ct$ASTG |"; } $agentcount++; if ($filtered_ingroup==1) { if ($realtime_block_user_info > 0) { $Aecho .= "|$UGD $G$sessionid$EG$L$R$Aring_note[$i]|$MO $G"._QXZ("$status",6)."$EG $CM $pausecode|$CP$CI$SVD$G$call_time_MS$EG | $G$campaign_id$EG | $G$calls_today$EG | $G$inb_calls_today$EG |$LATENCY$ASTCT$INGRP\n"; } if ($realtime_block_user_info < 1) { $Aecho .= "| $G$extension$EG$Aring_note[$i]|$phoneD$G$user$EG + |$UGD $G$sessionid$EG$L$R |$MO $G"._QXZ("$status",6)."$EG $CM $pausecode|$CP$CI$SVD$G$call_time_MS$EG | $G$campaign_id$EG | $G$calls_today$EG | $G$inb_calls_today$EG |$LATENCY$ASTCT$INGRP\n"; } } } if ( ($report_display_type=='HTML') or ($report_display_type=='LIMITED') ) { $G = preg_replace("/SPAN class=\"/",'SPAN class="H',$G); if ($SIPmonitorLINK>0) {$L=""; $R='';} if ($IAXmonitorLINK>0) {$L=""; $R='';} if ($SIPmonitorLINK>1) {$R=" ";} if ($IAXmonitorLINK>1) {$R=" ";} if ( (strlen($monitor_phone)>1) and (preg_match("/MONITOR|BARGE|WHISPER/",$monitor_active) ) and (preg_match("/MONITOR/",$RS_ListenBarge) ) ) {$L=""; $R='';} if ( (strlen($monitor_phone)>1) and (preg_match("/BARGE|WHISPER/",$monitor_active) ) and (preg_match("/BARGE/",$RS_ListenBarge) ) ) { $BARGEstage = 'BARGE'; if ($RS_BargeSwap > 0) {$BARGEstage = 'BARGESWAP';} $R=" "; } if ($SIPmonitorLINK>1) {$R=" ";} if ($IAXmonitorLINK>1) {$R=" ";} if ( (strlen($monitor_phone)>1) and (preg_match("/WHISPER/",$monitor_active) ) and (preg_match("/WHISPER/",$RS_ListenBarge) ) ) {$R=" ";} if ($MONITORdisplay > 0) {$MO = " $G$monitor_info$EG ";} else {$pausecodeHTML = "";} $vac_stage=''; $vac_campaign=''; $INGRP=''; $INuniqueid=''; if ($CM == 'I') { $stmt="SELECT vac.campaign_id,vac.stage,vig.group_name,vig.group_id,uniqueid from vicidial_auto_calls vac,vicidial_inbound_groups vig where vac.callerid='$Acallerid[$i]' and vac.campaign_id=vig.group_id LIMIT 1;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $ING=$G; $INEG=$EG; $ingrp_to_print = mysqli_num_rows($rslt); if ($ingrp_to_print > 0) { $row=mysqli_fetch_row($rslt); $vac_campaign_id=$row[0]; if (!in_array("ALL-INGROUPS", $ingroup_filter) && !in_array($vac_campaign_id, $ingroup_filter)) { $filtered_ingroup=0; } $vac_campaign = sprintf("%-20s", "$row[0] - $row[2]"); $row[1] = preg_replace('/.*\-/i', '',$row[1]); $vac_stage = sprintf("%-4s", $row[1]); $INORcolor = $row[3]; $INuniqueid = $row[4]; if ( ($INGROUPcolorOVERRIDE>0) or ($INGROUPcolorOVERRIDE=='YES') ) { $ING=''; $INEG=''; } } $INGRP = ""; if ( ($RS_DIDdesc > 0) and (strlen($INuniqueid) > 0) ) { $did_id=''; $did_extension=''; $did_description=''; $stmt="SELECT did_id,extension from vicidial_did_log where uniqueid='$INuniqueid' and call_date > \"$timeSIXhoursAGO\" order by call_date asc LIMIT 1;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $didL_to_print = mysqli_num_rows($rslt); if ($didL_to_print > 0) { $row=mysqli_fetch_row($rslt); $did_id = $row[0]; $did_extension = $row[1]; } else { $newINuniqueid=''; $stmt="SELECT uniqueid from vicidial_closer_log where lead_id='$Alead_id[$j]' and uniqueid!='$INuniqueid' and call_date > \"$timeSIXhoursAGO\" order by call_date desc LIMIT 1;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $didL_to_print = mysqli_num_rows($rslt); if ($didL_to_print > 0) { $row=mysqli_fetch_row($rslt); $newINuniqueid = $row[0]; } if (strlen($newINuniqueid) > 4) { $stmt="SELECT did_id,extension from vicidial_did_log where uniqueid='$newINuniqueid' and call_date > \"$timeSIXhoursAGO\" order by call_date asc LIMIT 1;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $didL_to_print = mysqli_num_rows($rslt); if ($didL_to_print > 0) { $row=mysqli_fetch_row($rslt); $did_id = $row[0]; $did_extension = $row[1]; } } } $stmt="SELECT did_description from vicidial_inbound_dids where did_id='$did_id' LIMIT 1;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $did_to_print = mysqli_num_rows($rslt); if ($did_to_print > 0) { $row=mysqli_fetch_row($rslt); $did_description = $row[0]; } $INGRP = ""; } if ($RS_INcolumnsHIDE > 0) { $INGRP = ''; } } $LATENCY=''; if ( ($AGENTlatency != 0) and ($RS_UGlatencyALLOWED > 0) ) { $LTC=$G; $LTCG=$EG; # if ($INORcolor > 0) # { # $LTC=''; $LTCG=''; # } if (preg_match("/^1/",$AGENTlatency)) { $LATENCY = ""; } if (preg_match("/^2/",$AGENTlatency)) { $LATENCY = ""; } if (preg_match("/^3/",$AGENTlatency)) { $LATENCY = ""; } if (preg_match("/^4/",$AGENTlatency)) { $LATENCY = ""; } } $ASTCT=''; if (strlen($RS_AGENTstatusTALLY) > 0) { $AST_ct=0; $SStimeclock_end_of_day_HH = substr($SStimeclock_end_of_day,0,2); $SStimeclock_end_of_day_MM = substr($SStimeclock_end_of_day,2,2); $TCEODdate = date("Y-m-d H:i:s", mktime($SStimeclock_end_of_day_HH,$SStimeclock_end_of_day_MM,0,date("m"),date("d"),date("Y"))); $stmt="SELECT count(*) from vicidial_agent_log where event_time >= \"$TCEODdate\" and user='$Auser[$i]' and status='$RS_AGENTstatusTALLY';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $AST=$G; $ASTG=$EG; $ast_to_print = mysqli_num_rows($rslt); if ($ast_to_print > 0) { $row=mysqli_fetch_row($rslt); $AST_ct = sprintf("%-6s", $row[0]); if ($INORcolor > 0) { $AST=''; $ASTG=''; } } $ASTCT = ""; } $agentcount++; if ($filtered_ingroup==1) { if ($realtime_block_user_info > 0) { $Aecho .= "$pausecodeHTML$LATENCY$ASTCT$INGRP\n"; } if ($realtime_block_user_info < 1) { $Aecho .= "$pausecodeHTML$LATENCY$ASTCT$INGRP\n"; } } } $j++; } if ( ($report_display_type=='HTML') or ($report_display_type=='LIMITED') ) {$Aecho .= "
 "._QXZ("Agents Time On Calls Campaign").": $NOW_TIME\n
"._QXZ("STATUS").""._QXZ("CAMPAIGN").""._QXZ("PHONE NUMBER").""._QXZ("SERVER IP").""._QXZ("DIALTIME").""._QXZ("CALL TYPE").""._QXZ("PRIORITY")."$agentonlyheader
  "._QXZ("STATION")."  "._QXZ("PHONE")."  "._QXZ("PHONE")."  "._QXZ("USER")." "; if ($RTajax > 0) {$HTuser = "   "._QXZ("USER")." ";} if ($UidORname>0) { if ($RTajax > 0) {$HTuser .= " "._QXZ("SHOW ID")." ";} else { $HTuser .= " "._QXZ("SHOW ID")." "; } } else { if (isset($RTajax) and $RTajax > 0) {$HTuser .= " "._QXZ("SHOW NAME")." ";} else { $HTuser .= "  "._QXZ("SHOW NAME")." "; } } $HTuser .= " "._QXZ("INFO",6)."  "._QXZ("USER GROUP")."  "._QXZ("USER GROUP")."   "._QXZ("SESSIONID")."   "._QXZ("LISTEN")."   "._QXZ("BARGE")."   "._QXZ("WHISPER")."   "._QXZ("MONITOR")."   "._QXZ("MON TYPE")."   "._QXZ("STATUS")."    "._QXZ("CUST PHONE")."   "._QXZ("CUST PHONE")."   "._QXZ("SOURCE ID")."   "._QXZ("ENTRY DATE")."   "._QXZ("STATE")."   "._QXZ("SERVER IP")."   "._QXZ("CALL SERVER IP")."  MM:SS  MM:SS  "._QXZ("CAMPAIGN")."  "._QXZ("CAMPAIGN",10)."   "._QXZ("CALLS")."   "._QXZ("INB CALLS")."   "._QXZ("HOLD")."   "._QXZ("IN-GROUP",8)."   "._QXZ("HOLD")."   "._QXZ("IN-GROUP",8)."   "._QXZ("DID DESCRIPTION",15)."   "._QXZ("$RS_AGENTstatusTALLY",6)."   "._QXZ("LATENCY",7)."   "._QXZ("LATENCY avg/peak (minutes)",43)."   "._QXZ("STATUS")."    "._QXZ("PAUSE")."   "._QXZ("SESSIONID")."
"._QXZ("LISTEN")." "._QXZ("LISTEN")." "._QXZ("BARGE")." BARGE "._QXZ("LISTEN")." "._QXZ("BARGE")." WHISPER WHISPER WHISPER $G$monitor_type$EG ";} else {$MO = "";} if ($CUSTPHONEdisplay > 0) {$CP = " $G$custphone$EG ";} else {$CP = "";} if ($CUSTINFOdisplay > 0) {$CI = " $G$custphone$EG $G$cust_source$EG $G$cust_entrydate$EG $G$cust_state$EG ";} else {$CI = "";} if ($UGdisplay > 0) {$UGD = " $G$user_group$EG ";} else {$UGD = "";} if ($SERVdisplay > 0) {$SVD = " $G$server_ip$EG $G$call_server_ip$EG ";} else {$SVD = "";} if ($PHONEdisplay > 0) {$phoneD = "$G$phone$EG ";} else {$phoneD = " ";} if ($agent_pause_codes_active > 0) {$pausecodeHTML = "$pausecode $ING$vac_stage$INEG $ING$vac_campaign$INEG $ING$vac_stage$INEG $ING$vac_campaign$INEG $ING$did_description$INEG $LTC$Alatency_min_avg[$i]ms$LTCG $LTC$Alatency_min_avg[$i]/$Alatency_min_peak[$i]ms$LTCG $LTC$Alatency_min_avg[$i]/$Alatency_min_peak[$i]ms(1) $Alatency_hour_avg[$i]/$Alatency_hour_peak[$i]ms(60) $Alatency_today_avg[$i]/$Alatency_today_peak[$i]ms(DAY) $LTCG $LTC$Alatency_now[$i]ms$LTCG $AST$AST_ct$ASTG
$UGD $G$sessionid$EG$L$R$Aring_note[$i]$MO $G"._QXZ("$status",6)."$EG$CM$CP$CI$SVD$G$call_time_MS$EG $G$campaign_id$EG $G$calls_today$EG $G$inb_calls_today$EG
$G$extension$EG$Aring_note[$i]$phoneD$G$user$EG $G+$EG $UGD $G$sessionid$EG$L$R $MO $G"._QXZ("$status",6)."$EG$CM$CP$CI$SVD$G$call_time_MS$EG $G$campaign_id$EG $G$calls_today$EG $G$inb_calls_today$EG
\n";} $Aecho .= "$Aline"; $Aecho .= " $agentcount "._QXZ("agents logged in on all servers")."\n"; $Aecho .= " "._QXZ("System Load Average").": $load_ave   $db_source\n\n"; # $Aecho .= " - "._QXZ("Balanced call")."\n"; $Aecho .= " - "._QXZ("Agent chatting")."\n"; $Aecho .= " - "._QXZ("Agent in email")."\n"; if ($RS_agentWAIT == 4) { $Aecho .= " - "._QXZ("Agent waiting for call")."\n"; $Aecho .= " - "._QXZ("Agent waiting for call")."> ".TimeToText($rt_report_times["waiting_short_time"])."\n"; $Aecho .= " - "._QXZ("Agent waiting for call")." > ".TimeToText($rt_report_times["waiting_medium_time"])."\n"; $Aecho .= " - "._QXZ("Agent waiting for call")." > ".TimeToText($rt_report_times["waiting_long_time"])."\n"; } else { $Aecho .= " - "._QXZ("Agent waiting for call")."\n"; $Aecho .= " - "._QXZ("Agent waiting for call")." > ".TimeToText($rt_report_times["waiting_medium_time"])."\n"; $Aecho .= " - "._QXZ("Agent waiting for call")." > ".TimeToText($rt_report_times["waiting_long_time"])."\n"; } $Aecho .= " - "._QXZ("Agent on call")." > ".TimeToText($rt_report_times["incall_short_time"])."\n"; $Aecho .= " - "._QXZ("Agent on call")." > ".TimeToText($rt_report_times["incall_medium_time"])."\n"; $Aecho .= " - "._QXZ("Agent on call")." > ".TimeToText($rt_report_times["incall_long_time"])."\n"; $Aecho .= " - "._QXZ("Agent Paused")." > ".TimeToText($rt_report_times["paused_short_time"])."\n"; $Aecho .= " - "._QXZ("Agent Paused")." > ".TimeToText($rt_report_times["paused_medium_time"])."\n"; $Aecho .= " - "._QXZ("Agent Paused")." > ".TimeToText($rt_report_times["paused_long_time"])."\n"; $Aecho .= " - "._QXZ("Agent Paused")." > ".TimeToText($rt_report_times["paused_long_time10"])."\n"; $Aecho .= " - "._QXZ("Agent Paused")." > ".TimeToText($rt_report_times["paused_long_time15"])."\n"; $Aecho .= " - "._QXZ("Agent in 3-WAY")." > ".TimeToText($rt_report_times["threeway_short_time"])."\n"; $Aecho .= " - "._QXZ("Agent on a dead call")."\n"; if ($SSenable_pause_code_limits > 0) { $Aecho .= " - "._QXZ("Agent over pause limit")."\n"; } if ($ring_agents > 0) { $Aecho .= " - "._QXZ("Agent phone ringing")."\n"; $Aecho .= " * "._QXZ("Denotes on-hook agent")."\n"; } if ($agent_ready > 0) {$B=''; $BG='';} if ($agent_ready > 4) {$B=''; $BG='';} if ($agent_ready > 9) {$B=''; $BG='';} if ($agent_ready > 14) {$B=''; $BG='';} $AIDct=''; $AIDtx=''; if ($agent_indial > 0) {$AIDct = "/$agent_indial"; $AIDtx = ' / '._QXZ("dials");} echo "\n
\n"; if ( ($report_display_type=='TEXT') or ($report_display_type=='WALL_1') ) { echo "$NFB$agent_total$NFE "._QXZ("agents logged in")."         \n"; echo "$NFB$agent_incall$AIDct$NFE "._QXZ("agents in calls")."$AIDtx       \n"; echo "$NFB$B  $agent_ready $BG$NFE "._QXZ("agents waiting")."       \n"; echo "$NFB$agent_paused$NFE "._QXZ("paused agents")."       \n"; echo "$NFB$agent_dead$NFE "._QXZ("agents in dead calls")."      \n"; echo "$NFB$agent_dispo$NFE "._QXZ("agents in dispo")."      \n"; if ($report_display_type=='TEXT') { echo "
";
			echo "";
			echo "$Cecho";
			echo "$Aecho";
			}
		}
	}
else
	{
	if ( ($report_display_type!='HTML') and ($report_display_type!='WALL_2') and ($report_display_type!='WALL_3') and ($report_display_type!='WALL_4') and ($report_display_type!='LIMITED') )
		{
		echo " "._QXZ("NO AGENTS ON CALLS")." \n";
		echo "
$Cecho";
		}
	}

if ( ($report_display_type!='HTML') and ($report_display_type!='WALL_2') and ($report_display_type!='WALL_3') and ($report_display_type!='WALL_4') and ($report_display_type!='LIMITED') )
	{
	echo "
"; } ##### BEGIN HTML output for agents summary ##### if ( ($report_display_type=='HTML') or ($report_display_type=='WALL_2') or ($report_display_type=='LIMITED') ) { $AIDct=''; $AIDtx=''; if ($agent_indial > 0) {$AIDct = " / $agent_indial"; $AIDtx = ' / '._QXZ("dials");} # echo "\n"; echo ""; # echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; $agents_waiting_td='bgcolor="#015b91"'; $agents_waiting_font='style="color: white; font-family: HELVETICA; font-size: 18; font-weight: bold;"'; if ($agent_ready > 0) {$agents_waiting_td='bgcolor="#CCFFCC"'; $agents_waiting_font='style="color: black; font-family: HELVETICA; font-size: 18; font-weight: bold;"';} if ($agent_ready > 4) {$agents_waiting_td='bgcolor="#99FF99"'; $agents_waiting_font='style="color: black; font-family: HELVETICA; font-size: 18; font-weight: bold;"';} if ($agent_ready > 9) {$agents_waiting_td='bgcolor="#00FF00"'; $agents_waiting_font='style="color: black; font-family: HELVETICA; font-size: 18; font-weight: bold;"';} if ($agent_ready > 14) {$agents_waiting_td='bgcolor="#00CC00"'; $agents_waiting_font='class="color: white; font-family: HELVETICA; font-size: 18; font-weight: bold;"';} echo ""; echo ""; echo ""; echo ""; echo ""; if ($report_display_type=='LIMITED') { $avgparksecallTODAY = MathZDC($PARKsecTODAY, $VSCagentcalls); $avgparksecallTODAY = round($avgparksecallTODAY, 0); $avgparksecallTODAY = sprintf("%01.0f", $avgparksecallTODAY); $avgwaitTODAY = MathZDC($VSCagentwait, $VSCagentcalls); $avgwaitTODAY = round($avgwaitTODAY, 0); $avgwaitTODAY = sprintf("%01.0f", $avgwaitTODAY); $avgcustTODAY = MathZDC($VSCagentcust, $VSCagentcalls); $avgcustTODAY = round($avgcustTODAY, 0); $avgcustTODAY = sprintf("%01.0f", $avgcustTODAY); echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } echo "
  "._QXZ("agents logged in")."   "._QXZ("agents in calls")."$AIDtx   "._QXZ("agents waiting")."   "._QXZ("paused agents")."   "._QXZ("agents in dead calls")."   "._QXZ("agents in dispo")."
$agent_total$agent_incall$AIDct$agent_ready$agent_paused$agent_dead$agent_dispo
 
"._QXZ("avg agent wait seconds")."   "._QXZ("avg agent talk seconds")."   "._QXZ("avg call park seconds")."   "._QXZ("inbound SLA")."  
$avgwaitTODAY$avgcustTODAY$avgparksecallTODAY$PCThold_sec_stat_one%
"; echo "\n"; if ( ($report_display_type=='HTML') or ($report_display_type=='LIMITED') ) { echo "
";
		echo "";
		echo "$Cecho";
		echo "$Aecho";
		}
	}
##### END HTML output for agents summary #####



##### BEGIN custom WALL_3 display option #####
if ($report_display_type=='WALL_3')
	{
	$AIDct='';   $AIDtx='';
	if ($agent_indial > 0) {$AIDct = " / $agent_indial";   $AIDtx = ' / '._QXZ("dials");}
	echo ""._QXZ("agents waiting")."\n";
	echo "   $agent_ready
\n"; echo ""._QXZ("paused agents")."\n"; echo "   $agent_paused
\n"; echo ""._QXZ("agents in calls")."$AIDtx\n"; echo "   $agent_incall$AIDct
\n"; echo ""._QXZ("calls waiting")."\n"; echo "   $out_live
\n"; echo ""._QXZ("dropped/total calls")."\n"; echo "   $dropsTODAY / $callsTODAY $drpctTODAY %
\n"; } ##### END custom WALL_3 display option ##### ##### BEGIN custom WALL_4 display option ##### if ($report_display_type=='WALL_4') { $AIDct=''; $AIDtx=''; if ($agent_indial > 0) {$AIDct = " / $agent_indial"; $AIDtx = ' / '._QXZ("dials");} echo "
\n"; echo "\n"; echo ""; echo "\n"; echo "\n"; echo "\n"; echo ""; echo "\n"; echo "\n"; echo "\n"; echo ""; echo "\n"; echo "\n"; echo "\n"; echo ""; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
"._QXZ("agents waiting")."   $agent_ready
"._QXZ("paused agents")."   $agent_paused
"._QXZ("agents in calls")."$AIDtx   $agent_incall$AIDct
"._QXZ("calls waiting")."   $out_live
"._QXZ("dropped/total calls")."\n"; echo "   $dropsTODAY / $callsTODAY   $drpctTODAY %
\n"; } ##### END custom WALL_4 display option ##### if ($RTajax < 1) { echo ""; } ?>