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 # $version = '2.12-90'; $build = '160418-2141'; header ("Content-type: text/html; charset=utf-8"); require("dbconnect_mysqli.php"); require("functions.php"); $PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; $PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; $PHP_SELF=$_SERVER['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["CUSTPHONEdisplay"])) {$CUSTPHONEdisplay=$_GET["CUSTPHONEdisplay"];} elseif (isset($_POST["CUSTPHONEdisplay"])) {$CUSTPHONEdisplay=$_POST["CUSTPHONEdisplay"];} 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["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["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["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"];} $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 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]; } ##### END SETTINGS LOOKUP ##### ########################################### if (strlen($report_display_type)<2) {$report_display_type = $SSreport_default_format;} 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"; } if (!isset($DB)) {$DB=0;} if (!isset($RR)) {$RR=40;} if (!isset($group)) {$group='ALL-ACTIVE';} if (!isset($user_group_filter)) {$user_group_filter='';} 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($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); 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_PW = preg_replace("/'|\"|\\\\|;/","",$PHP_AUTH_PW); $PHP_AUTH_USER = preg_replace("/'|\"|\\\\|;/","",$PHP_AUTH_USER); } $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); if ($auth_message == 'GOOD') {$auth=1;} 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; } 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;} # 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 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]; 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[$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); ### 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 ( (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)"; } $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[$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++; } if (!isset($RR)) {$RR=4;} $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 .= "
"; $select_list .= ""._QXZ("Close Panel")."

"; $select_list .= ""; $select_list .= ""; $select_list .= ""; $select_list .= ""; if ($UGdisplay > 0) { $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 .= ""; $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("Show Carrier Stats").":
"; $select_list .= _QXZ("Show Presets Stats").":
"; $select_list .= _QXZ("Agent Time 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) { 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 ##### INBOUND ONLY ### if (preg_match('/O/',$with_inbound)) { $multi_drop++; $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); if ( ($report_display_type!='WALL_1') and ($report_display_type!='WALL_2') and ($report_display_type!='WALL_3') and ($report_display_type!='WALL_4') ) { 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 _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 = preg_replace("/^ | -$/","",$closer_campaigns); $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); $closer_campaignsSQL .= "'$closer_campaigns',"; $c++; } $closer_campaignsSQL = preg_replace("/,$/","",$closer_campaignsSQL); } if (strlen($closer_campaignsSQL)<2) {$closer_campaignsSQL="''";} if ($DB > 0) {echo "\n|$closer_campaigns|$closer_campaignsSQL|$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 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 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); $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); 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 .= ""; $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("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) 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) 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 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) 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) 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) 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]; $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]; if ($multi_drop > 0) { $drpctTODAY = ( MathZDC($dropsTODAY, $answersTODAY) * 100); $drpctTODAY = round($drpctTODAY, 2); $drpctTODAY = sprintf("%01.2f", $drpctTODAY); } $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]; $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') ) { 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 ""; 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 ""; 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') ) { echo ""; echo ""; echo ""; echo ""; echo ""; echo "
"._QXZ("DIAL LEVEL").":  $DIALlev    "._QXZ("TRUNK SHORT/FILL").":  $balanceSHORT / $balanceFILL     "._QXZ("FILTER").":  $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").":  $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 ($drpctTODAY >= $DROPmax) {echo "$drpctTODAY%";} else {echo "$drpctTODAY%";} echo "    "._QXZ("DIFF").":  $diffpctONEMIN%     "._QXZ("ORDER").":  $DIALorder    
"._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) { 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").""; } } 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'"; } $stmtB="from vicidial_auto_calls where status NOT IN('XFER') and ( (call_type='IN' and campaign_id IN($closer_campaignsSQL)) or (call_type IN('OUT','OUTBALANCE') $group_SQLand) ) order by queue_priority desc,campaign_id,call_time;"; } else { $stmtB="from vicidial_auto_calls where status NOT IN('XFER') $group_SQLand order by queue_priority desc,campaign_id,call_time;"; } if ($CALLSdisplay > 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; $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') ) { 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') ) { 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') ) { 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') ) { echo _QXZ(" NO LIVE CHATS WAITING ")." \n"; } } } ##### BEGIN HTML output for calls ##### if ( ($report_display_type=='HTML') or ($report_display_type=='WALL_2') ) { $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 ""; $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")."    
$out_total$out_ring$out_live$in_ivr$chats_waiting  
 
"; } ##### 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') { $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_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') { $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",16)." |"; $HDbarge = "-------+"; $HTbarge = " "._QXZ("BARGE",5)." |"; $HDwhisper = "---------+"; $HTwhisper = " "._QXZ("WHISPER",7)." |"; $HDstatus = "----------+"; $HTstatus = " "._QXZ("STATUS",8)." |"; $HDcustphone = "-------------+"; $HTcustphone = " "._QXZ("CUST PHONE",11)." |"; $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)." |"; $HDpause = ''; $HTpause = ''; $HDigcall = "------+------------------"; $HTigcall = " "._QXZ("HOLD",4)." | "._QXZ("IN-GROUP",8)." "; 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') { ##### BEGIN HTML Output generation ##### $HDbegin = ""; $HTbegin = ""; $HDstation = ""; $HTstation = ""; $HDphone = ""; $HTphone = ""; if ($RTajax > 0) {$HTphone = "";} $HDuser = ""; $HTuser = ""; $HDusergroup = ""; $HTusergroup = ""; if ($RTajax > 0) {$HTusergroup = "";} $HDsessionid = ""; $HTsessionid = ""; $HDbarge = ""; $HTbarge = ""; $HDwhisper = ""; $HTwhisper = ""; $HDstatus = ""; $HTstatus = ""; $HDcustphone = ""; $HTcustphone = ""; $HDserver_ip = ""; $HTserver_ip = ""; $HDcall_server_ip = ""; $HTcall_server_ip = ""; $HDtime = ""; $HTtime = ""; if ($RTajax > 0) {$HTtime = "";} $HDcampaign = ""; $HTcampaign = ""; if ($RTajax > 0) {$HTcampaign = "";} $HDcalls = ""; $HTcalls = ""; $HDpause = ''; $HTpause = ''; $HDigcall = ""; $HTigcall = ""; 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 ($CUSTPHONEdisplay < 1) { $HDcustphone = ''; $HTcustphone = ''; } if ($UGdisplay < 1) { $HDusergroup = ''; $HTusergroup = ''; } if ( ($SIPmonitorLINK<2) and ($IAXmonitorLINK<2) and (!preg_match("/BARGE/",$monitor_active) ) ) { $HDbarge = ''; $HTbarge = ''; } if ( ($SIPmonitorLINK<2) and ($IAXmonitorLINK<2) and (!preg_match("/WHISPER/",$monitor_active) ) ) { $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$HDbarge$HDwhisper$HDstatus$HDpause$HDcustphone$HDserver_ip$HDcall_server_ip$HDtime$HDcampaign$HDcalls$HDigcall\n"; $Bline = "$HTbegin$HTusergroup$HTsessionid$HTbarge$HTwhisper$HTstatus$HTpause$HTcustphone$HTserver_ip$HTcall_server_ip$HTtime$HTcampaign$HTcalls$HTigcall\n"; } else { $Aline = "$HDbegin$HDstation$HDphone$HDuser$HDusergroup$HDsessionid$HDbarge$HDwhisper$HDstatus$HDpause$HDcustphone$HDserver_ip$HDcall_server_ip$HDtime$HDcampaign$HDcalls$HDigcall\n"; $Bline = "$HTbegin$HTstation$HTphone$HTuser$HTusergroup$HTsessionid$HTbarge$HTwhisper$HTstatus$HTpause$HTcustphone$HTserver_ip$HTcall_server_ip$HTtime$HTcampaign$HTcalls$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; $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 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; while ($i < $talking_to_print) { $row=mysqli_fetch_row($rslt); $Aextension[$i] = $row[0]; $Auser[$i] = $row[1]; $Asessionid[$i] = $row[2]; $Astatus[$i] = $row[3]; $Aserver_ip[$i] = $row[4]; $Acall_time[$i] = $row[5]; $Acall_finish[$i] = $row[6]; $Acall_server_ip[$i] = $row[7]; $Acampaign_id[$i] = $row[8]; $Auser_group[$i] = $row[9]; $Afull_name[$i] = $row[10]; $Acomments[$i] = $row[11]; $Acalls_today[$i] = $row[12]; $Acallerid[$i] = $row[13]; $Alead_id[$i] = $row[14]; $Astate_change[$i] = $row[15]; $Aon_hook_agent[$i] = $row[16]; $Aring_callerid[$i] = $row[17]; $Aagent_log_id[$i] = $row[18]; $Aring_note[$i] = ' '; if ($Aon_hook_agent[$i] == 'Y') { $Aring_note[$i] = '*'; $ring_agents++; if (strlen($Aring_callerid[$i]) > 18) {$Astatus[$i]="RING";} } ### 3-WAY Check ### if ($Alead_id[$i]!=0) { $threewaystmt="SELECT UNIX_TIMESTAMP(last_call_time) from vicidial_live_agents where lead_id='$Alead_id[$i]' and status='INCALL' order by UNIX_TIMESTAMP(last_call_time) desc"; $threewayrslt=mysql_to_mysqli($threewaystmt, $link); if (mysqli_num_rows($threewayrslt)>1) { $Astatus[$i]="3-WAY"; $srow=mysqli_fetch_row($threewayrslt); $Acall_mostrecent[$i]=$srow[0]; } } ### END 3-WAY Check ### $i++; } $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=''; 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)) ) {$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') { $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') { $extension = sprintf("%-48s", $extension); while(mb_strlen($extension, 'utf-8')>14) {$extension = mb_substr("$extension", 0, -1,'UTF8');} } } $phone = sprintf("%-12s", $phone_split[0]); $custphone = sprintf("%-11s", $custphone); $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]); 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)) { $Acall_time[$i]=$Astate_change[$i]; $Astatus[$i] = 'DEAD'; $Lstatus = 'DEAD'; $status = ' DEAD '; } 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) { $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 {$CM=' ';} if ($UGdisplay > 0) { if ($non_latin < 1) { $user_group = sprintf("%-12s", $Auser_group[$i]); if ($report_display_type!='HTML') { 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') { while(mb_strlen($user_group, 'utf-8')>12) {$user_group = mb_substr("$user_group", 0, -1,'UTF8');} } } } if ($UidORname > 0) { if ($non_latin < 1) { $user = sprintf("%-20s", $Afull_name[$i]); if ($report_display_type!='HTML') { while(strlen($user)>20) {$user = substr("$user", 0, -1);} } } else { $user = sprintf("%-60s", $Afull_name[$i]); if ($report_display_type!='HTML') { while(mb_strlen($user, 'utf-8')>20) {$user = mb_substr("$user", 0, -1,'UTF8');} } } } if (!preg_match("/INCALL|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 >= 10) {$G=''; $EG=''; $tr_class='TRthistle';} if ($call_time_S >= 60) {$G=''; $EG=''; $tr_class='TRviolet';} if ($call_time_S >= 300) {$G=''; $EG=''; $tr_class='TRpurple';} # if ($call_time_S >= 600) {$G=''; $EG=''; $tr_class='TRpurple';} } } if ($Lstatus=='3-WAY') { if ($call_time_S >= 10) {$G=''; $EG=''; $tr_class='TRlime';} } if ($Lstatus=='DEAD') { if ($call_time_S >= 21600) {$j++; continue;} else { $agent_dead++; $agent_total++; $G = ''; $EG = ''; $tr_class='TRblank'; if ($call_time_S >= 10) {$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 >= 10) {$G=''; $EG=''; $tr_class='TRkhaki';} if ($call_time_S >= 60) {$G=''; $EG=''; $tr_class='TRyellow';} if ($call_time_S >= 300) {$G=''; $EG=''; $tr_class='TRolive';} } } 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 "; } else {$pausecode='';} if ($call_time_S >= 21600) {$j++; continue;} else { $agent_paused++; $agent_total++; $G = ''; $EG = ''; $tr_class='TRblank'; if ($call_time_S >= 10) {$G=''; $EG=''; $tr_class='TRkhaki';} if ($call_time_S >= 60) {$G=''; $EG=''; $tr_class='TRyellow';} if ($call_time_S >= 300) {$G=''; $EG=''; $tr_class='TRolive';} } } # if ( (strlen($Acall_server_ip[$i])> 4) and ($Acall_server_ip[$i] != "$Aserver_ip[$i]") ) # {$G=''; $EG='';} if ( (preg_match("/INCALL/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("/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)) ) { $G=''; $EG=''; $tr_class='TRlightblue'; if ($call_time_S >= 60) {$G=''; $EG=''; $tr_class='TRblue';} if ($call_time_S >= 300) {$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=''; 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) ) ) {$L=" "._QXZ("LISTEN",6).""; $R='';} if ( (strlen($monitor_phone)>1) and (preg_match("/BARGE|WHISPER/",$monitor_active) ) ) {$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) ) ) {$R=" | WHISPER";} if ($CUSTPHONEdisplay > 0) {$CP = " $G$custphone$EG |";} else {$CP = "";} 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=''; if ($CM == 'I') { $stmt="SELECT vac.campaign_id,vac.stage,vig.group_name,vig.group_id 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 = sprintf("%-20s", "$row[0] - $row[2]"); $row[1] = preg_replace('/.*\-/i', '',$row[1]); $vac_stage = sprintf("%-4s", $row[1]); if ( ($INGROUPcolorOVERRIDE>0) or ($INGROUPcolorOVERRIDE=='YES') ) { $ING=''; $INEG=''; } } $INGRP = " $ING$vac_stage$INEG | $ING$vac_campaign$INEG "; } $agentcount++; if ($realtime_block_user_info > 0) { $Aecho .= "|$UGD $G$sessionid$EG$L$R$Aring_note[$i]| $G"._QXZ("$status",6)."$EG $CM $pausecode|$CP$SVD$G$call_time_MS$EG | $G$campaign_id$EG | $G$calls_today$EG |$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 | $G"._QXZ("$status",6)."$EG $CM $pausecode|$CP$SVD$G$call_time_MS$EG | $G$campaign_id$EG | $G$calls_today$EG |$INGRP\n"; } } if ($report_display_type=='HTML') { $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) ) ) {$L=""; $R='';} if ( (strlen($monitor_phone)>1) and (preg_match("/BARGE|WHISPER/",$monitor_active) ) ) {$R=" ";} if ($SIPmonitorLINK>1) {$R=" ";} if ($IAXmonitorLINK>1) {$R=" ";} if ( (strlen($monitor_phone)>1) and (preg_match("/WHISPER/",$monitor_active) ) ) {$R=" ";} if ($CUSTPHONEdisplay > 0) {$CP = " $G$custphone$EG ";} else {$pausecodeHTML = "";} $vac_stage=''; $vac_campaign=''; $INGRP=''; if ($CM == 'I') { $stmt="SELECT vac.campaign_id,vac.stage,vig.group_name,vig.group_id 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 = sprintf("%-20s", "$row[0] - $row[2]"); $row[1] = preg_replace('/.*\-/i', '',$row[1]); $vac_stage = sprintf("%-4s", $row[1]); if ( ($INGROUPcolorOVERRIDE>0) or ($INGROUPcolorOVERRIDE=='YES') ) { $ING=''; $INEG=''; } } $INGRP = ""; } $agentcount++; if ($realtime_block_user_info > 0) { $Aecho .= "$pausecodeHTML$INGRP\n"; } if ($realtime_block_user_info < 1) { $Aecho .= "$pausecodeHTML$INGRP\n"; } } $j++; } if ($report_display_type=='HTML') {$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("BARGE")."   "._QXZ("WHISPER")."   "._QXZ("STATUS")."    "._QXZ("CUST PHONE")."   "._QXZ("SERVER IP")."   "._QXZ("CALL SERVER IP")."  MM:SS  MM:SS  "._QXZ("CAMPAIGN")."  "._QXZ("CAMPAIGN",10)."   "._QXZ("CALLS")."   "._QXZ("HOLD")."   "._QXZ("IN-GROUP",8)."
  "._QXZ("STATUS")."    "._QXZ("PAUSE")."   "._QXZ("SESSIONID")." "._QXZ("LISTEN")." "._QXZ("LISTEN")." "._QXZ("BARGE")." BARGE "._QXZ("LISTEN")." "._QXZ("BARGE")." WHISPER WHISPER WHISPER";} else {$CP = "";} 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
$UGD $G$sessionid$EG$L$R$Aring_note[$i] $G"._QXZ("$status",6)."$EG$CM$CP$SVD$G$call_time_MS$EG $G$campaign_id$EG $G$calls_today$EG
$G$extension$EG$Aring_note[$i]$phoneD$G$user$EG $G+$EG $UGD $G$sessionid$EG$L$R $G"._QXZ("$status",6)."$EG$CM$CP$SVD$G$call_time_MS$EG $G$campaign_id$EG $G$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"; $Aecho .= " - "._QXZ("Agent waiting for call")."\n"; $Aecho .= " - "._QXZ("Agent waiting for call > 1 minute")."\n"; $Aecho .= " - "._QXZ("Agent waiting for call > 5 minutes")."\n"; $Aecho .= " - "._QXZ("Agent on call > 10 seconds")."\n"; $Aecho .= " - "._QXZ("Agent on call > 1 minute")."\n"; $Aecho .= " - "._QXZ("Agent on call > 5 minutes")."\n"; $Aecho .= " - "._QXZ("Agent Paused > 10 seconds")."\n"; $Aecho .= " - "._QXZ("Agent Paused > 1 minute")."\n"; $Aecho .= " - "._QXZ("Agent Paused > 5 minutes")."\n"; $Aecho .= " - "._QXZ("Agent in 3-WAY > 10 seconds")."\n"; $Aecho .= " - "._QXZ("Agent on a dead call")."\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='';} 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$NFE "._QXZ("agents in calls")."       \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') )
		{
		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') )
	{
	echo "
"; } ##### BEGIN HTML output for agents summary ##### if ( ($report_display_type=='HTML') or ($report_display_type=='WALL_2') ) { # 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 ""; echo "
  "._QXZ("agents logged in")."   "._QXZ("agents in calls")."   "._QXZ("agents waiting")."   "._QXZ("paused agents")."   "._QXZ("agents in dead calls")."   "._QXZ("agents in dispo")."
$agent_total$agent_incall$agent_ready$agent_paused$agent_dead$agent_dispo
"; echo "\n"; if ($report_display_type=='HTML') { echo "
";
		echo "";
		echo "$Cecho";
		echo "$Aecho";
		}
	}
##### END HTML output for agents summary #####



##### BEGIN custom WALL_3 display option #####
if ($report_display_type=='WALL_3')
	{
	echo ""._QXZ("agents waiting")."\n";
	echo "   $agent_ready
\n"; echo ""._QXZ("paused agents")."\n"; echo "   $agent_paused
\n"; echo ""._QXZ("agents in calls")."\n"; echo "   $agent_incall
\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') { 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")."   $agent_incall
"._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 ""; } ?>