1
|
<?
|
2
|
# AST_timeonVDADall.php
|
3
|
#
|
4
|
# Copyright (C) 2007 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
5
|
#
|
6
|
# live real-time stats for the VICIDIAL Auto-Dialer all servers
|
7
|
#
|
8
|
# STOP=4000, SLOW=40, GO=4 seconds refresh interval
|
9
|
#
|
10
|
# CHANGELOG:
|
11
|
# 50406-0920 - Added Paused agents < 1 min (Chris Doyle)
|
12
|
# 51130-1218 - Modified layout and info to show all servers in a vicidial system
|
13
|
# 60421-1043 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
14
|
# 60511-1343 - Added leads and drop info at the top of the screen
|
15
|
# 60608-1539 - Fixed CLOSER tallies for active calls
|
16
|
# 60619-1658 - Added variable filtering to eliminate SQL injection attack threat
|
17
|
# - Added required user/pass to gain access to this page
|
18
|
# 60626-1453 - Added display of system load to bottom (Angelito Manansala)
|
19
|
# 60901-1123 - Changed display elements at the top of the screen
|
20
|
# 60905-1342 - Fixed non INCALL|QUEUE timer column
|
21
|
# 61002-1642 - Added TRUNK SHORT/FILL stats
|
22
|
# 61101-1318 - Added SIP and IAX Listen and Barge links option
|
23
|
# 61101-1647 - Added Usergroup column and user name option as well as sorting
|
24
|
# 61102-1155 - Made display of columns more modular, added ability to hide server info
|
25
|
# 61215-1131 - Added answered calls and drop percent taken from answered calls
|
26
|
# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns
|
27
|
# 70123-1151 - Added non_latin options for substr in display variables, thanks Marin Blu
|
28
|
# 70206-1140 - Added call-type statuses to display(A-Auto, M-Manual, I-Inbound/Closer)
|
29
|
# 70619-1339 - Added Status Category tally display
|
30
|
# 71029-1900 - Changed CLOSER-type to not require campaign_id restriction
|
31
|
#
|
32
|
|
33
|
header ("Content-type: text/html; charset=utf-8");
|
34
|
|
35
|
require("dbconnect.php");
|
36
|
|
37
|
$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
|
38
|
$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
|
39
|
$PHP_SELF=$_SERVER['PHP_SELF'];
|
40
|
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
41
|
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
42
|
if (isset($_GET["RR"])) {$RR=$_GET["RR"];}
|
43
|
elseif (isset($_POST["RR"])) {$RR=$_POST["RR"];}
|
44
|
if (isset($_GET["group"])) {$group=$_GET["group"];}
|
45
|
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
|
46
|
if (isset($_GET["usergroup"])) {$usergroup=$_GET["usergroup"];}
|
47
|
elseif (isset($_POST["usergroup"])) {$usergroup=$_POST["usergroup"];}
|
48
|
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
|
49
|
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
|
50
|
if (isset($_GET["adastats"])) {$adastats=$_GET["adastats"];}
|
51
|
elseif (isset($_POST["adastats"])) {$adastats=$_POST["adastats"];}
|
52
|
if (isset($_GET["submit"])) {$submit=$_GET["submit"];}
|
53
|
elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];}
|
54
|
if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];}
|
55
|
elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];}
|
56
|
if (isset($_GET["SIPmonitorLINK"])) {$SIPmonitorLINK=$_GET["SIPmonitorLINK"];}
|
57
|
elseif (isset($_POST["SIPmonitorLINK"])) {$SIPmonitorLINK=$_POST["SIPmonitorLINK"];}
|
58
|
if (isset($_GET["IAXmonitorLINK"])) {$IAXmonitorLINK=$_GET["IAXmonitorLINK"];}
|
59
|
elseif (isset($_POST["IAXmonitorLINK"])) {$IAXmonitorLINK=$_POST["IAXmonitorLINK"];}
|
60
|
if (isset($_GET["UGdisplay"])) {$UGdisplay=$_GET["UGdisplay"];}
|
61
|
elseif (isset($_POST["UGdisplay"])) {$UGdisplay=$_POST["UGdisplay"];}
|
62
|
if (isset($_GET["UidORname"])) {$UidORname=$_GET["UidORname"];}
|
63
|
elseif (isset($_POST["UidORname"])) {$UidORname=$_POST["UidORname"];}
|
64
|
if (isset($_GET["orderby"])) {$orderby=$_GET["orderby"];}
|
65
|
elseif (isset($_POST["orderby"])) {$orderby=$_POST["orderby"];}
|
66
|
if (isset($_GET["SERVdisplay"])) {$SERVdisplay=$_GET["SERVdisplay"];}
|
67
|
elseif (isset($_POST["SERVdisplay"])) {$SERVdisplay=$_POST["SERVdisplay"];}
|
68
|
|
69
|
|
70
|
|
71
|
if (!isset($RR)) {$gRRroup=4;}
|
72
|
if (!isset($group)) {$group='';}
|
73
|
if (!isset($usergroup)) {$usergroup='';}
|
74
|
if (!isset($UGdisplay)) {$UGdisplay=0;} # 0=no, 1=yes
|
75
|
if (!isset($UidORname)) {$UidORname=0;} # 0=id, 1=name
|
76
|
if (!isset($orderby)) {$orderby='timeup';}
|
77
|
if (!isset($SERVdisplay)) {$SERVdisplay=1;} # 0=no, 1=yes
|
78
|
|
79
|
function get_server_load($windows = false) {
|
80
|
$os = strtolower(PHP_OS);
|
81
|
if(strpos($os, "win") === false) {
|
82
|
if(file_exists("/proc/loadavg")) {
|
83
|
$load = file_get_contents("/proc/loadavg");
|
84
|
$load = explode(' ', $load);
|
85
|
return $load[0];
|
86
|
}
|
87
|
elseif(function_exists("shell_exec")) {
|
88
|
$load = explode(' ', `uptime`);
|
89
|
return $load[count($load)-1];
|
90
|
}
|
91
|
else {
|
92
|
return false;
|
93
|
}
|
94
|
}
|
95
|
elseif($windows) {
|
96
|
if(class_exists("COM")) {
|
97
|
$wmi = new COM("WinMgmts:\\\\.");
|
98
|
$cpus = $wmi->InstancesOf("Win32_Processor");
|
99
|
|
100
|
$cpuload = 0;
|
101
|
$i = 0;
|
102
|
while ($cpu = $cpus->Next()) {
|
103
|
$cpuload += $cpu->LoadPercentage;
|
104
|
$i++;
|
105
|
}
|
106
|
|
107
|
$cpuload = round($cpuload / $i, 2);
|
108
|
return "$cpuload%";
|
109
|
}
|
110
|
else {
|
111
|
return false;
|
112
|
}
|
113
|
}
|
114
|
}
|
115
|
|
116
|
$load_ave = get_server_load(true);
|
117
|
|
118
|
|
119
|
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
|
120
|
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
|
121
|
|
122
|
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
|
123
|
if ($DB) {echo "|$stmt|\n";}
|
124
|
if ($non_latin > 0)
|
125
|
{
|
126
|
$rslt=mysql_query("SET NAMES 'UTF8'");
|
127
|
}
|
128
|
$rslt=mysql_query($stmt, $link);
|
129
|
$row=mysql_fetch_row($rslt);
|
130
|
$auth=$row[0];
|
131
|
|
132
|
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
|
133
|
{
|
134
|
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
|
135
|
Header("HTTP/1.0 401 Unauthorized");
|
136
|
echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
|
137
|
exit;
|
138
|
}
|
139
|
|
140
|
$NOW_TIME = date("Y-m-d H:i:s");
|
141
|
$NOW_DAY = date("Y-m-d");
|
142
|
$NOW_HOUR = date("H:i:s");
|
143
|
$STARTtime = date("U");
|
144
|
$epochSIXhoursAGO = ($STARTtime - 21600);
|
145
|
$timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO);
|
146
|
|
147
|
$stmt="select campaign_id from vicidial_campaigns where active='Y';";
|
148
|
if ($non_latin > 0)
|
149
|
{
|
150
|
$rslt=mysql_query("SET NAMES 'UTF8'");
|
151
|
}
|
152
|
$rslt=mysql_query($stmt, $link);
|
153
|
if (!isset($DB)) {$DB=0;}
|
154
|
if ($DB) {echo "$stmt\n";}
|
155
|
$groups_to_print = mysql_num_rows($rslt);
|
156
|
$i=0;
|
157
|
while ($i < $groups_to_print)
|
158
|
{
|
159
|
$row=mysql_fetch_row($rslt);
|
160
|
$groups[$i] =$row[0];
|
161
|
$i++;
|
162
|
}
|
163
|
|
164
|
$stmt="select * from vicidial_user_groups;";
|
165
|
if ($non_latin > 0)
|
166
|
{
|
167
|
$rslt=mysql_query("SET NAMES 'UTF8'");
|
168
|
}
|
169
|
$rslt=mysql_query($stmt, $link);
|
170
|
if (!isset($DB)) {$DB=0;}
|
171
|
if ($DB) {echo "$stmt\n";}
|
172
|
$usergroups_to_print = mysql_num_rows($rslt);
|
173
|
$i=0;
|
174
|
while ($i < $usergroups_to_print)
|
175
|
{
|
176
|
$row=mysql_fetch_row($rslt);
|
177
|
$usergroups[$i] =$row[0];
|
178
|
$i++;
|
179
|
}
|
180
|
|
181
|
if (!isset($RR)) {$RR=4;}
|
182
|
|
183
|
$NFB = '<b><font size=6 face="courier">';
|
184
|
$NFE = '</font></b>';
|
185
|
$F=''; $FG=''; $B=''; $BG='';
|
186
|
|
187
|
?>
|
188
|
|
189
|
<HTML>
|
190
|
<HEAD>
|
191
|
<STYLE type="text/css">
|
192
|
<!--
|
193
|
.green {color: white; background-color: green}
|
194
|
.red {color: white; background-color: red}
|
195
|
.lightblue {color: black; background-color: #ADD8E6}
|
196
|
.blue {color: white; background-color: blue}
|
197
|
.midnightblue {color: white; background-color: #191970}
|
198
|
.purple {color: white; background-color: purple}
|
199
|
.violet {color: black; background-color: #EE82EE}
|
200
|
.thistle {color: black; background-color: #D8BFD8}
|
201
|
.olive {color: white; background-color: #808000}
|
202
|
.yellow {color: black; background-color: yellow}
|
203
|
.khaki {color: black; background-color: #F0E68C}
|
204
|
.orange {color: black; background-color: orange}
|
205
|
|
206
|
.r1 {color: black; background-color: #FFCCCC}
|
207
|
.r2 {color: black; background-color: #FF9999}
|
208
|
.r3 {color: black; background-color: #FF6666}
|
209
|
.r4 {color: white; background-color: #FF0000}
|
210
|
.b1 {color: black; background-color: #CCCCFF}
|
211
|
.b2 {color: black; background-color: #9999FF}
|
212
|
.b3 {color: black; background-color: #6666FF}
|
213
|
.b4 {color: white; background-color: #0000FF}
|
214
|
-->
|
215
|
</STYLE>
|
216
|
|
217
|
<?
|
218
|
$stmt = "select count(*) from vicidial_campaigns where campaign_id='$group' and campaign_allow_inbound='Y';";
|
219
|
$rslt=mysql_query($stmt, $link);
|
220
|
$row=mysql_fetch_row($rslt);
|
221
|
$campaign_allow_inbound = $row[0];
|
222
|
|
223
|
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
224
|
echo"<META HTTP-EQUIV=Refresh CONTENT=\"$RR; URL=$PHP_SELF?RR=$RR&DB=$DB&group=$group&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay\">\n";
|
225
|
echo "<TITLE>VICIDIAL: Time On VDAD Campaign: $group</TITLE></HEAD><BODY BGCOLOR=WHITE>\n";
|
226
|
echo "<FORM ACTION=\"$PHP_SELF\" METHOD=GET>\n";
|
227
|
echo "VICIDIAL Campaign: \n";
|
228
|
echo "<INPUT TYPE=HIDDEN NAME=RR VALUE=\"$RR\">\n";
|
229
|
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
|
230
|
echo "<INPUT TYPE=HIDDEN NAME=adastats VALUE=\"$adastats\">\n";
|
231
|
echo "<INPUT TYPE=HIDDEN NAME=SIPmonitorLINK VALUE=\"$SIPmonitorLINK\">\n";
|
232
|
echo "<INPUT TYPE=HIDDEN NAME=IAXmonitorLINK VALUE=\"$IAXmonitorLINK\">\n";
|
233
|
echo "<INPUT TYPE=HIDDEN NAME=usergroup VALUE=\"$usergroup\">\n";
|
234
|
echo "<INPUT TYPE=HIDDEN NAME=UGdisplay VALUE=\"$UGdisplay\">\n";
|
235
|
echo "<INPUT TYPE=HIDDEN NAME=UidORname VALUE=\"$UidORname\">\n";
|
236
|
echo "<INPUT TYPE=HIDDEN NAME=orderby VALUE=\"$orderby\">\n";
|
237
|
echo "<INPUT TYPE=HIDDEN NAME=SERVdisplay VALUE=\"$SERVdisplay\">\n";
|
238
|
echo "<SELECT SIZE=1 NAME=group>\n";
|
239
|
echo "<option value=\"XXXX-ALL-ACTIVE-XXXX\">ALL ACTIVE</option>\n";
|
240
|
$o=0;
|
241
|
while ($groups_to_print > $o)
|
242
|
{
|
243
|
if ($groups[$o] == $group) {echo "<option selected value=\"$groups[$o]\">$groups[$o]</option>\n";}
|
244
|
else {echo "<option value=\"$groups[$o]\">$groups[$o]</option>\n";}
|
245
|
$o++;
|
246
|
}
|
247
|
echo "</SELECT>\n";
|
248
|
if ($UGdisplay > 0)
|
249
|
{
|
250
|
echo "<SELECT SIZE=1 NAME=usergroup>\n";
|
251
|
echo "<option value=\"\">ALL USER GROUPS</option>\n";
|
252
|
$o=0;
|
253
|
while ($usergroups_to_print > $o)
|
254
|
{
|
255
|
if ($usergroups[$o] == $usergroup) {echo "<option selected value=\"$usergroups[$o]\">$usergroups[$o]</option>\n";}
|
256
|
else {echo "<option value=\"$usergroups[$o]\">$usergroups[$o]</option>\n";}
|
257
|
$o++;
|
258
|
}
|
259
|
echo "</SELECT>\n";
|
260
|
}
|
261
|
echo "<INPUT type=submit NAME=SUBMIT VALUE=SUBMIT><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2> \n";
|
262
|
echo "<a href=\"$PHP_SELF?group=$group&RR=4000&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay\">STOP</a> | ";
|
263
|
echo "<a href=\"$PHP_SELF?group=$group&RR=40&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay\">SLOW</a> | ";
|
264
|
echo "<a href=\"$PHP_SELF?group=$group&RR=4&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay\">GO</a>";
|
265
|
echo " <a href=\"./admin.php?ADD=34&campaign_id=$group\">MODIFY</a> | \n";
|
266
|
echo "<a href=\"./AST_timeonVDADallSUMMARY.php?group=$group&RR=$RR&DB=$DB&adastats=$adastats\">SUMMARY</a> | \n";
|
267
|
echo "<a href=\"./admin.php?ADD=999999\">REPORTS</a> </FONT>\n";
|
268
|
echo "\n\n";
|
269
|
|
270
|
|
271
|
if (!$group) {echo "<BR><BR>please select a campaign from the pulldown above</FORM>\n"; exit;}
|
272
|
else
|
273
|
{
|
274
|
$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 from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';";
|
275
|
if ($group=='XXXX-ALL-ACTIVE-XXXX')
|
276
|
{
|
277
|
$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) from vicidial_campaigns;";
|
278
|
}
|
279
|
if ($non_latin > 0)
|
280
|
{
|
281
|
$rslt=mysql_query("SET NAMES 'UTF8'");
|
282
|
}
|
283
|
$rslt=mysql_query($stmt, $link);
|
284
|
$row=mysql_fetch_row($rslt);
|
285
|
$DIALlev = $row[0];
|
286
|
$DIALstatusA = $row[1];
|
287
|
$DIALstatusB = $row[2];
|
288
|
$DIALstatusC = $row[3];
|
289
|
$DIALstatusD = $row[4];
|
290
|
$DIALstatusE = $row[5];
|
291
|
$DIALorder = $row[6];
|
292
|
$DIALfilter = $row[7];
|
293
|
$HOPlev = $row[8];
|
294
|
$DIALmethod = $row[9];
|
295
|
$maxDIALlev = $row[10];
|
296
|
$DROPmax = $row[11];
|
297
|
$targetDIFF = $row[12];
|
298
|
$ADAintense = $row[13];
|
299
|
$ADAavailonly = $row[14];
|
300
|
$TAPERtime = $row[15];
|
301
|
$CALLtime = $row[16];
|
302
|
$DIALtimeout = $row[17];
|
303
|
$DIALstatuses = $row[18];
|
304
|
$DIALstatuses = (preg_replace("/ -$|^ /","",$DIALstatuses));
|
305
|
$DIALstatuses = (ereg_replace(' ',', ',$DIALstatuses));
|
306
|
|
307
|
$stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';";
|
308
|
if ($group=='XXXX-ALL-ACTIVE-XXXX')
|
309
|
{
|
310
|
$stmt="select count(*) from vicidial_hopper;";
|
311
|
}
|
312
|
if ($non_latin > 0)
|
313
|
{
|
314
|
$rslt=mysql_query("SET NAMES 'UTF8'");
|
315
|
}
|
316
|
$rslt=mysql_query($stmt, $link);
|
317
|
$row=mysql_fetch_row($rslt);
|
318
|
$VDhop = $row[0];
|
319
|
|
320
|
$stmt="select dialable_leads,calls_today,drops_today,drops_answers_today_pct,differential_onemin,agents_average_onemin,balance_trunk_fill,answers_today,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 from vicidial_campaign_stats where campaign_id='" . mysql_real_escape_string($group) . "';";
|
321
|
if ($group=='XXXX-ALL-ACTIVE-XXXX')
|
322
|
{
|
323
|
$stmt="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),sum(answers_today),min(status_category_1),sum(status_category_count_1),min(status_category_2),sum(status_category_count_2),min(status_category_3),sum(status_category_count_3),min(status_category_4),sum(status_category_count_4) from vicidial_campaign_stats;";
|
324
|
}
|
325
|
if ($non_latin > 0)
|
326
|
{
|
327
|
$rslt=mysql_query("SET NAMES 'UTF8'");
|
328
|
}
|
329
|
$rslt=mysql_query($stmt, $link);
|
330
|
$row=mysql_fetch_row($rslt);
|
331
|
$DAleads = $row[0];
|
332
|
$callsTODAY = $row[1];
|
333
|
$dropsTODAY = $row[2];
|
334
|
$drpctTODAY = $row[3];
|
335
|
$diffONEMIN = $row[4];
|
336
|
$agentsONEMIN = $row[5];
|
337
|
$balanceFILL = $row[6];
|
338
|
$answersTODAY = $row[7];
|
339
|
$VSCcat1 = $row[8];
|
340
|
$VSCcat1tally = $row[9];
|
341
|
$VSCcat2 = $row[10];
|
342
|
$VSCcat2tally = $row[11];
|
343
|
$VSCcat3 = $row[12];
|
344
|
$VSCcat3tally = $row[13];
|
345
|
$VSCcat4 = $row[14];
|
346
|
$VSCcat4tally = $row[15];
|
347
|
|
348
|
if ( ($diffONEMIN != 0) and ($agentsONEMIN > 0) )
|
349
|
{
|
350
|
$diffpctONEMIN = ( ($diffONEMIN / $agentsONEMIN) * 100);
|
351
|
$diffpctONEMIN = sprintf("%01.2f", $diffpctONEMIN);
|
352
|
}
|
353
|
else {$diffpctONEMIN = '0.00';}
|
354
|
|
355
|
$stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats where campaign_id='" . mysql_real_escape_string($group) . "';";
|
356
|
if ($group=='XXXX-ALL-ACTIVE-XXXX')
|
357
|
{
|
358
|
$stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats;";
|
359
|
}
|
360
|
if ($non_latin > 0)
|
361
|
{
|
362
|
$rslt=mysql_query("SET NAMES 'UTF8'");
|
363
|
}
|
364
|
$rslt=mysql_query($stmt, $link);
|
365
|
$row=mysql_fetch_row($rslt);
|
366
|
$balanceSHORT = $row[0];
|
367
|
|
368
|
echo "<BR><table cellpadding=0 cellspacing=0><TR>";
|
369
|
echo "<TD ALIGN=RIGHT><font size=2><B>DIAL LEVEL:</B></TD><TD ALIGN=LEFT><font size=2> $DIALlev </TD>";
|
370
|
echo "<TD ALIGN=RIGHT><font size=2><B>TRUNK SHORT/FILL:</B></TD><TD ALIGN=LEFT><font size=2> $balanceSHORT / $balanceFILL </TD>";
|
371
|
echo "<TD ALIGN=RIGHT><font size=2><B>FILTER:</B></TD><TD ALIGN=LEFT><font size=2> $DIALfilter </TD>";
|
372
|
echo "<TD ALIGN=RIGHT><font size=2><B> TIME:</B> </TD><TD ALIGN=LEFT><font size=2> $NOW_TIME </TD>";
|
373
|
echo "";
|
374
|
echo "</TR>";
|
375
|
|
376
|
if ($adastats>1)
|
377
|
{
|
378
|
echo "<TR BGCOLOR=\"#CCCCCC\">";
|
379
|
echo "<TD ALIGN=RIGHT><a href=\"$PHP_SELF?group=$group&RR=4&DB=$DB&adastats=1\"><font size=1>- min </font></a><font size=2> <B>MAX LEVEL:</B></TD><TD ALIGN=LEFT><font size=2> $maxDIALlev </TD>";
|
380
|
echo "<TD ALIGN=RIGHT><font size=2><B>DROPPED MAX:</B></TD><TD ALIGN=LEFT><font size=2> $DROPmax% </TD>";
|
381
|
echo "<TD ALIGN=RIGHT><font size=2><B>TARGET DIFF:</B></TD><TD ALIGN=LEFT><font size=2> $targetDIFF </TD>";
|
382
|
echo "<TD ALIGN=RIGHT><font size=2><B>INTENSITY:</B></TD><TD ALIGN=LEFT><font size=2> $ADAintense </TD>";
|
383
|
echo "</TR>";
|
384
|
|
385
|
echo "<TR BGCOLOR=\"#CCCCCC\">";
|
386
|
echo "<TD ALIGN=RIGHT><font size=2><B>DIAL TIMEOUT:</B></TD><TD ALIGN=LEFT><font size=2> $DIALtimeout </TD>";
|
387
|
echo "<TD ALIGN=RIGHT><font size=2><B>TAPER TIME:</B></TD><TD ALIGN=LEFT><font size=2> $TAPERtime </TD>";
|
388
|
echo "<TD ALIGN=RIGHT><font size=2><B>LOCAL TIME:</B></TD><TD ALIGN=LEFT><font size=2> $CALLtime </TD>";
|
389
|
echo "<TD ALIGN=RIGHT><font size=2><B>AVAIL ONLY:</B></TD><TD ALIGN=LEFT><font size=2> $ADAavailonly </TD>";
|
390
|
echo "</TR>";
|
391
|
}
|
392
|
|
393
|
echo "<TR>";
|
394
|
echo "<TD ALIGN=RIGHT><font size=2><B>DIALABLE LEADS:</B></TD><TD ALIGN=LEFT><font size=2> $DAleads </TD>";
|
395
|
echo "<TD ALIGN=RIGHT><font size=2><B>CALLS TODAY:</B></TD><TD ALIGN=LEFT><font size=2> $callsTODAY </TD>";
|
396
|
echo "<TD ALIGN=RIGHT><font size=2><B>AVG AGENTS:</B></TD><TD ALIGN=LEFT><font size=2> $agentsONEMIN </TD>";
|
397
|
echo "<TD ALIGN=RIGHT><font size=2><B>DIAL METHOD:</B></TD><TD ALIGN=LEFT><font size=2> $DIALmethod </TD>";
|
398
|
echo "</TR>";
|
399
|
|
400
|
echo "<TR>";
|
401
|
echo "<TD ALIGN=RIGHT><font size=2><B>HOPPER LEVEL:</B></TD><TD ALIGN=LEFT><font size=2> $HOPlev </TD>";
|
402
|
echo "<TD ALIGN=RIGHT><font size=2><B>DROPPED / ANSWERED:</B></TD><TD ALIGN=LEFT><font size=2> $dropsTODAY / $answersTODAY </TD>";
|
403
|
echo "<TD ALIGN=RIGHT><font size=2><B>DL DIFF:</B></TD><TD ALIGN=LEFT><font size=2> $diffONEMIN </TD>";
|
404
|
echo "<TD ALIGN=RIGHT><font size=2><B>STATUSES:</B></TD><TD ALIGN=LEFT><font size=2> $DIALstatuses </TD>";
|
405
|
echo "</TR>";
|
406
|
|
407
|
echo "<TR>";
|
408
|
echo "<TD ALIGN=RIGHT><font size=2><B>LEADS IN HOPPER:</B></TD><TD ALIGN=LEFT><font size=2> $VDhop </TD>";
|
409
|
echo "<TD ALIGN=RIGHT><font size=2><B>DROPPED PERCENT:</B></TD><TD ALIGN=LEFT><font size=2> ";
|
410
|
if ($drpctTODAY >= $DROPmax)
|
411
|
{echo "<font color=red><B>$drpctTODAY%</B></font>";}
|
412
|
else
|
413
|
{echo "$drpctTODAY%";}
|
414
|
echo " </TD>";
|
415
|
|
416
|
|
417
|
|
418
|
|
419
|
echo "<TD ALIGN=RIGHT><font size=2><B>DIFF:</B></TD><TD ALIGN=LEFT><font size=2> $diffpctONEMIN% </TD>";
|
420
|
echo "<TD ALIGN=RIGHT><font size=2><B>ORDER:</B></TD><TD ALIGN=LEFT><font size=2> $DIALorder </TD>";
|
421
|
echo "</TR>";
|
422
|
|
423
|
echo "<TR>";
|
424
|
echo "<TD ALIGN=LEFT COLSPAN=8>";
|
425
|
if ( (!eregi('NULL',$VSCcat1)) and (strlen($VSCcat1)>0) )
|
426
|
{echo "<font size=2><B>$VSCcat1:</B> $VSCcat1tally \n";}
|
427
|
if ( (!eregi('NULL',$VSCcat2)) and (strlen($VSCcat2)>0) )
|
428
|
{echo "<font size=2><B>$VSCcat2:</B> $VSCcat2tally \n";}
|
429
|
if ( (!eregi('NULL',$VSCcat3)) and (strlen($VSCcat3)>0) )
|
430
|
{echo "<font size=2><B>$VSCcat3:</B> $VSCcat3tally \n";}
|
431
|
if ( (!eregi('NULL',$VSCcat4)) and (strlen($VSCcat4)>0) )
|
432
|
{echo "<font size=2><B>$VSCcat4:</B> $VSCcat4tally \n";}
|
433
|
echo "</TD></TR>";
|
434
|
echo "<TR>";
|
435
|
echo "<TD ALIGN=LEFT COLSPAN=8>";
|
436
|
|
437
|
if ($adastats<2)
|
438
|
{
|
439
|
echo "<a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=2&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay\"><font size=1>+ VIEW MORE SETTINGS</font></a>";
|
440
|
}
|
441
|
if ($UGdisplay>0)
|
442
|
{
|
443
|
echo " <a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=0&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay\"><font size=1>HIDE USER GROUP</font></a>";
|
444
|
}
|
445
|
else
|
446
|
{
|
447
|
echo " <a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=1&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay\"><font size=1>VIEW USER GROUP</font></a>";
|
448
|
}
|
449
|
if ($UidORname>0)
|
450
|
{
|
451
|
echo " <a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=0&orderby=$orderby&SERVdisplay=$SERVdisplay\"><font size=1>SHOW AGENT ID</font></a>";
|
452
|
}
|
453
|
else
|
454
|
{
|
455
|
echo " <a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=1&orderby=$orderby&SERVdisplay=$SERVdisplay\"><font size=1>SHOW AGENT NAME</font></a>";
|
456
|
}
|
457
|
if ($SERVdisplay>0)
|
458
|
{
|
459
|
echo " <a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=0\"><font size=1>HIDE SERVER INFO</font></a>";
|
460
|
}
|
461
|
else
|
462
|
{
|
463
|
echo " <a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=1\"><font size=1>SHOW SERVER INFO</font></a>";
|
464
|
}
|
465
|
echo "</TD>";
|
466
|
echo "</TR>";
|
467
|
echo "</TABLE>";
|
468
|
|
469
|
echo "</FORM>\n\n";
|
470
|
}
|
471
|
###################################################################################
|
472
|
###### OUTBOUND CALLS
|
473
|
###################################################################################
|
474
|
if ($campaign_allow_inbound > 0)
|
475
|
{
|
476
|
$stmt="select closer_campaigns from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';";
|
477
|
if ($non_latin > 0)
|
478
|
{
|
479
|
$rslt=mysql_query("SET NAMES 'UTF8'");
|
480
|
}
|
481
|
$rslt=mysql_query($stmt, $link);
|
482
|
$row=mysql_fetch_row($rslt);
|
483
|
$closer_campaigns = preg_replace("/^ | -$/","",$row[0]);
|
484
|
$closer_campaigns = preg_replace("/ /","','",$closer_campaigns);
|
485
|
$closer_campaigns = "'$closer_campaigns'";
|
486
|
|
487
|
$stmt="select status from vicidial_auto_calls where status NOT IN('XFER') and ( (call_type='IN' and campaign_id IN($closer_campaigns)) or (campaign_id='" . mysql_real_escape_string($group) . "' and call_type='OUT') );";
|
488
|
}
|
489
|
else
|
490
|
{
|
491
|
if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';}
|
492
|
else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";}
|
493
|
|
494
|
$stmt="select status from vicidial_auto_calls where status NOT IN('XFER') $groupSQL;";
|
495
|
}
|
496
|
if ($non_latin > 0)
|
497
|
{
|
498
|
$rslt=mysql_query("SET NAMES 'UTF8'");
|
499
|
}
|
500
|
$rslt=mysql_query($stmt, $link);
|
501
|
if ($DB) {echo "$stmt\n";}
|
502
|
$parked_to_print = mysql_num_rows($rslt);
|
503
|
if ($parked_to_print > 0)
|
504
|
{
|
505
|
$i=0;
|
506
|
$out_total=0;
|
507
|
$out_ring=0;
|
508
|
$out_live=0;
|
509
|
while ($i < $parked_to_print)
|
510
|
{
|
511
|
$row=mysql_fetch_row($rslt);
|
512
|
|
513
|
if (eregi("LIVE",$row[0]))
|
514
|
{$out_live++;}
|
515
|
else
|
516
|
{
|
517
|
if (eregi("CLOSER",$row[0]))
|
518
|
{$nothing=1;}
|
519
|
else
|
520
|
{$out_ring++;}
|
521
|
}
|
522
|
$out_total++;
|
523
|
$i++;
|
524
|
}
|
525
|
|
526
|
if ($out_live > 0) {$F='<FONT class="r1">'; $FG='</FONT>';}
|
527
|
if ($out_live > 4) {$F='<FONT class="r2">'; $FG='</FONT>';}
|
528
|
if ($out_live > 9) {$F='<FONT class="r3">'; $FG='</FONT>';}
|
529
|
if ($out_live > 14) {$F='<FONT class="r4">'; $FG='</FONT>';}
|
530
|
|
531
|
if ($campaign_allow_inbound > 0)
|
532
|
{echo "$NFB$out_total$NFE current active calls \n";}
|
533
|
else
|
534
|
{echo "$NFB$out_total$NFE calls being placed \n";}
|
535
|
|
536
|
echo "$NFB$out_ring$NFE calls ringing \n";
|
537
|
echo "$NFB$F $out_live $FG$NFE calls waiting for agents \n";
|
538
|
}
|
539
|
else
|
540
|
{
|
541
|
echo " NO LIVE CALLS WAITING \n";
|
542
|
}
|
543
|
|
544
|
|
545
|
###################################################################################
|
546
|
###### TIME ON SYSTEM
|
547
|
###################################################################################
|
548
|
|
549
|
$agent_incall=0;
|
550
|
$agent_ready=0;
|
551
|
$agent_paused=0;
|
552
|
$agent_total=0;
|
553
|
|
554
|
$Aecho = '';
|
555
|
$Aecho .= "VICIDIAL: Agents Time On Calls Campaign: $group $NOW_TIME\n\n";
|
556
|
|
557
|
|
558
|
$HDbegin = "+";
|
559
|
$HTbegin = "|";
|
560
|
$HDstation = "------------+";
|
561
|
$HTstation = " STATION |";
|
562
|
$HDuser = "--------------------+";
|
563
|
$HTuser = " <a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=userup&SERVdisplay=$SERVdisplay\">USER</a> |";
|
564
|
$HDusergroup = "--------------+";
|
565
|
$HTusergroup = " <a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=groupup&SERVdisplay=$SERVdisplay\">USER GROUP</a> |";
|
566
|
$HDsessionid = "------------------+";
|
567
|
$HTsessionid = " SESSIONID |";
|
568
|
$HDbarge = "-------+";
|
569
|
$HTbarge = " BARGE |";
|
570
|
$HDstatus = "----------+";
|
571
|
$HTstatus = " STATUS |";
|
572
|
$HDserver_ip = "-----------------+";
|
573
|
$HTserver_ip = " SERVER IP |";
|
574
|
$HDcall_server_ip = "-----------------+";
|
575
|
$HTcall_server_ip = " CALL SERVER IP |";
|
576
|
$HDtime = "---------+";
|
577
|
$HTtime = " <a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=timeup&SERVdisplay=$SERVdisplay\">MM:SS</a> |";
|
578
|
$HDcampaign = "------------+";
|
579
|
$HTcampaign = " <a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=campaignup&SERVdisplay=$SERVdisplay\">CAMPAIGN</a> |";
|
580
|
|
581
|
if ($UGdisplay < 1)
|
582
|
{
|
583
|
$HDusergroup = '';
|
584
|
$HTusergroup = '';
|
585
|
}
|
586
|
if ( ($SIPmonitorLINK<1) && ($IAXmonitorLINK<1) )
|
587
|
{
|
588
|
$HDsessionid = "-----------+";
|
589
|
$HTsessionid = " SESSIONID |";
|
590
|
}
|
591
|
if ( ($SIPmonitorLINK<2) && ($IAXmonitorLINK<2) )
|
592
|
{
|
593
|
$HDbarge = '';
|
594
|
$HTbarge = '';
|
595
|
}
|
596
|
if ($SERVdisplay < 1)
|
597
|
{
|
598
|
$HDserver_ip = '';
|
599
|
$HTserver_ip = '';
|
600
|
$HDcall_server_ip = '';
|
601
|
$HTcall_server_ip = '';
|
602
|
}
|
603
|
|
604
|
|
605
|
|
606
|
$Aline = "$HDbegin$HDstation$HDuser$HDusergroup$HDsessionid$HDbarge$HDstatus$HDserver_ip$HDcall_server_ip$HDtime$HDcampaign\n";
|
607
|
$Bline = "$HTbegin$HTstation$HTuser$HTusergroup$HTsessionid$HTbarge$HTstatus$HTserver_ip$HTcall_server_ip$HTtime$HTcampaign\n";
|
608
|
$Aecho .= "$Aline";
|
609
|
$Aecho .= "$Bline";
|
610
|
$Aecho .= "$Aline";
|
611
|
|
612
|
if ($orderby=='timeup') {$orderSQL='status,last_call_time';}
|
613
|
if ($orderby=='timedown') {$orderSQL='status desc,last_call_time desc';}
|
614
|
if ($orderby=='campaignup') {$orderSQL='campaign_id,status,last_call_time';}
|
615
|
if ($orderby=='campaigndown') {$orderSQL='campaign_id desc,status desc,last_call_time desc';}
|
616
|
if ($orderby=='groupup') {$orderSQL='user_group,status,last_call_time';}
|
617
|
if ($orderby=='groupdown') {$orderSQL='user_group desc,status desc,last_call_time desc';}
|
618
|
if ($UidORname > 0)
|
619
|
{
|
620
|
if ($orderby=='userup') {$orderSQL='full_name,status,last_call_time';}
|
621
|
if ($orderby=='userdown') {$orderSQL='full_name desc,status desc,last_call_time desc';}
|
622
|
}
|
623
|
else
|
624
|
{
|
625
|
if ($orderby=='userup') {$orderSQL='vicidial_live_agents.user';}
|
626
|
if ($orderby=='userdown') {$orderSQL='vicidial_live_agents.user desc';}
|
627
|
}
|
628
|
|
629
|
if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';}
|
630
|
else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";}
|
631
|
if (strlen($usergroup)<1) {$usergroupSQL = '';}
|
632
|
else {$usergroupSQL = " and user_group='" . mysql_real_escape_string($usergroup) . "'";}
|
633
|
|
634
|
$stmt="select extension,vicidial_live_agents.user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id,vicidial_users.user_group,vicidial_users.full_name,vicidial_live_agents.comments from vicidial_live_agents,vicidial_users where vicidial_live_agents.user=vicidial_users.user $groupSQL $usergroupSQL order by $orderSQL;";
|
635
|
|
636
|
#$stmt="select extension,vicidial_live_agents.user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id,vicidial_users.user_group,vicidial_users.full_name from vicidial_live_agents,vicidial_users where vicidial_live_agents.user=vicidial_users.user and campaign_id='" . mysql_real_escape_string($group) . "' order by $orderSQL;";
|
637
|
|
638
|
if ($non_latin > 0)
|
639
|
{
|
640
|
$rslt=mysql_query("SET NAMES 'UTF8'");
|
641
|
}
|
642
|
$rslt=mysql_query($stmt, $link);
|
643
|
if ($DB) {echo "$stmt\n";}
|
644
|
$talking_to_print = mysql_num_rows($rslt);
|
645
|
if ($talking_to_print > 0)
|
646
|
{
|
647
|
$i=0;
|
648
|
$agentcount=0;
|
649
|
while ($i < $talking_to_print)
|
650
|
{
|
651
|
$row=mysql_fetch_row($rslt);
|
652
|
if (eregi("READY|PAUSED",$row[3]))
|
653
|
{
|
654
|
$row[5]=$row[6];
|
655
|
}
|
656
|
if ($non_latin < 1)
|
657
|
{
|
658
|
$extension = eregi_replace('Local/',"",$row[0]);
|
659
|
$extension = sprintf("%-10s", $extension);
|
660
|
while(strlen($extension)>10) {$extension = substr("$extension", 0, -1);}
|
661
|
}
|
662
|
else
|
663
|
{
|
664
|
$extension = eregi_replace('Local/',"",$row[0]);
|
665
|
$extension = sprintf("%-40s", $extension);
|
666
|
while(mb_strlen($extension, 'utf-8')>10) {$extension = mb_substr("$extension", 0, -1,'utf8');}
|
667
|
}
|
668
|
$Luser = $row[1];
|
669
|
$user = sprintf("%-18s", $row[1]);
|
670
|
$Lsessionid = $row[2];
|
671
|
$sessionid = sprintf("%-9s", $row[2]);
|
672
|
$Lstatus = $row[3];
|
673
|
$status = sprintf("%-6s", $row[3]);
|
674
|
$server_ip = sprintf("%-15s", $row[4]);
|
675
|
$call_server_ip = sprintf("%-15s", $row[7]);
|
676
|
$campaign_id = sprintf("%-10s", $row[8]);
|
677
|
$comments= $row[11];
|
678
|
|
679
|
if (eregi("INCALL",$Lstatus))
|
680
|
{
|
681
|
if ( (eregi("AUTO",$comments)) or (strlen($comments)<1) )
|
682
|
{$CM='A';}
|
683
|
else
|
684
|
{
|
685
|
if (eregi("INBOUND",$comments))
|
686
|
{$CM='I';}
|
687
|
else
|
688
|
{$CM='M';}
|
689
|
}
|
690
|
}
|
691
|
else {$CM=' ';}
|
692
|
|
693
|
if ($UGdisplay > 0)
|
694
|
{
|
695
|
if ($non_latin < 1)
|
696
|
{
|
697
|
$user_group = sprintf("%-12s", $row[9]);
|
698
|
while(strlen($user_group)>12) {$user_group = substr("$user_group", 0, -1);}
|
699
|
}
|
700
|
else
|
701
|
{
|
702
|
$user_group = sprintf("%-40s", $row[9]);
|
703
|
while(mb_strlen($user_group, 'utf-8')>12) {$user_group = mb_substr("$user_group", 0, -1,'utf8');}
|
704
|
}
|
705
|
}
|
706
|
if ($UidORname > 0)
|
707
|
{
|
708
|
if ($non_latin < 1)
|
709
|
{
|
710
|
$user = sprintf("%-18s", $row[10]);
|
711
|
while(strlen($user)>18) {$user = substr("$user", 0, -1);}
|
712
|
}
|
713
|
else
|
714
|
{
|
715
|
$user = sprintf("%-40s", $row[10]);
|
716
|
while(mb_strlen($user, 'utf-8')>18) {$user = mb_substr("$user", 0, -1,'utf8');}
|
717
|
}
|
718
|
}
|
719
|
if (!eregi("INCALL|QUEUE",$row[3]))
|
720
|
{$call_time_S = ($STARTtime - $row[6]);}
|
721
|
else
|
722
|
{$call_time_S = ($STARTtime - $row[5]);}
|
723
|
|
724
|
$call_time_M = ($call_time_S / 60);
|
725
|
$call_time_M = round($call_time_M, 2);
|
726
|
$call_time_M_int = intval("$call_time_M");
|
727
|
$call_time_SEC = ($call_time_M - $call_time_M_int);
|
728
|
$call_time_SEC = ($call_time_SEC * 60);
|
729
|
$call_time_SEC = round($call_time_SEC, 0);
|
730
|
if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
|
731
|
$call_time_MS = "$call_time_M_int:$call_time_SEC";
|
732
|
$call_time_MS = sprintf("%7s", $call_time_MS);
|
733
|
$G = ''; $EG = '';
|
734
|
if ($Lstatus=='INCALL')
|
735
|
{
|
736
|
if ($call_time_S >= 10) {$G='<SPAN class="thistle"><B>'; $EG='</B></SPAN>';}
|
737
|
if ($call_time_M_int >= 1) {$G='<SPAN class="violet"><B>'; $EG='</B></SPAN>';}
|
738
|
if ($call_time_M_int >= 5) {$G='<SPAN class="purple"><B>'; $EG='</B></SPAN>';}
|
739
|
# if ($call_time_M_int >= 10) {$G='<SPAN class="purple"><B>'; $EG='</B></SPAN>';}
|
740
|
}
|
741
|
if (eregi("PAUSED",$row[3]))
|
742
|
{
|
743
|
if ($call_time_M_int >= 30)
|
744
|
{$i++; continue;}
|
745
|
else
|
746
|
{
|
747
|
$agent_paused++; $agent_total++;
|
748
|
$G=''; $EG='';
|
749
|
if ($call_time_S >= 10) {$G='<SPAN class="khaki"><B>'; $EG='</B></SPAN>';}
|
750
|
if ($call_time_M_int >= 1) {$G='<SPAN class="yellow"><B>'; $EG='</B></SPAN>';}
|
751
|
if ($call_time_M_int >= 5) {$G='<SPAN class="olive"><B>'; $EG='</B></SPAN>';}
|
752
|
}
|
753
|
}
|
754
|
# if ( (strlen($row[7])> 4) and ($row[7] != "$row[4]") )
|
755
|
# {$G='<SPAN class="orange"><B>'; $EG='</B></SPAN>';}
|
756
|
|
757
|
if ( (eregi("INCALL",$status)) or (eregi("QUEUE",$status)) ) {$agent_incall++; $agent_total++;}
|
758
|
if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) {$agent_ready++; $agent_total++;}
|
759
|
if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) )
|
760
|
{
|
761
|
$G='<SPAN class="lightblue"><B>'; $EG='</B></SPAN>';
|
762
|
if ($call_time_M_int >= 1) {$G='<SPAN class="blue"><B>'; $EG='</B></SPAN>';}
|
763
|
if ($call_time_M_int >= 5) {$G='<SPAN class="midnightblue"><B>'; $EG='</B></SPAN>';}
|
764
|
}
|
765
|
|
766
|
$L='';
|
767
|
$R='';
|
768
|
if ($SIPmonitorLINK>0) {$L=" <a href=\"sip:6$Lsessionid@$server_ip\">LISTEN</a>"; $R='';}
|
769
|
if ($IAXmonitorLINK>0) {$L=" <a href=\"iax:6$Lsessionid@$server_ip\">LISTEN</a>"; $R='';}
|
770
|
if ($SIPmonitorLINK>1) {$R=" | <a href=\"sip:$Lsessionid@$server_ip\">BARGE</a>";}
|
771
|
if ($IAXmonitorLINK>1) {$R=" | <a href=\"iax:$Lsessionid@$server_ip\">BARGE</a>";}
|
772
|
|
773
|
if ($UGdisplay > 0) {$UGD = " $G$user_group$EG |";}
|
774
|
else {$UGD = "";}
|
775
|
|
776
|
if ($SERVdisplay > 0) {$SVD = "$G$server_ip$EG | $G$call_server_ip$EG | ";}
|
777
|
else {$SVD = "";}
|
778
|
|
779
|
$agentcount++;
|
780
|
|
781
|
$Aecho .= "| $G$extension$EG | <a href=\"./user_status.php?user=$Luser\" target=\"_blank\">$G$user$EG</a> |$UGD $G$sessionid$EG$L$R | $G$status$EG $CM | $SVD$G$call_time_MS$EG | $G$campaign_id$EG |\n";
|
782
|
|
783
|
$i++;
|
784
|
}
|
785
|
|
786
|
$Aecho .= "$Aline";
|
787
|
$Aecho .= " $agentcount agents logged in on all servers\n";
|
788
|
$Aecho .= " System Load Average: $load_ave\n\n";
|
789
|
|
790
|
# $Aecho .= " <SPAN class=\"orange\"><B> </SPAN> - Balanced call</B>\n";
|
791
|
$Aecho .= " <SPAN class=\"lightblue\"><B> </SPAN> - Agent waiting for call</B>\n";
|
792
|
$Aecho .= " <SPAN class=\"blue\"><B> </SPAN> - Agent waiting for call > 1 minute</B>\n";
|
793
|
$Aecho .= " <SPAN class=\"midnightblue\"><B> </SPAN> - Agent waiting for call > 5 minutes</B>\n";
|
794
|
$Aecho .= " <SPAN class=\"thistle\"><B> </SPAN> - Agent on call > 10 seconds</B>\n";
|
795
|
$Aecho .= " <SPAN class=\"violet\"><B> </SPAN> - Agent on call > 1 minute</B>\n";
|
796
|
$Aecho .= " <SPAN class=\"purple\"><B> </SPAN> - Agent on call > 5 minutes</B>\n";
|
797
|
$Aecho .= " <SPAN class=\"khaki\"><B> </SPAN> - Agent Paused > 10 seconds</B>\n";
|
798
|
$Aecho .= " <SPAN class=\"yellow\"><B> </SPAN> - Agent Paused > 1 minute</B>\n";
|
799
|
$Aecho .= " <SPAN class=\"olive\"><B> </SPAN> - Agent Paused > 5 minutes</B>\n";
|
800
|
|
801
|
if ($agent_ready > 0) {$B='<FONT class="b1">'; $BG='</FONT>';}
|
802
|
if ($agent_ready > 4) {$B='<FONT class="b2">'; $BG='</FONT>';}
|
803
|
if ($agent_ready > 9) {$B='<FONT class="b3">'; $BG='</FONT>';}
|
804
|
if ($agent_ready > 14) {$B='<FONT class="b4">'; $BG='</FONT>';}
|
805
|
|
806
|
|
807
|
echo "\n<BR>\n";
|
808
|
|
809
|
echo "$NFB$agent_total$NFE agents logged in \n";
|
810
|
echo "$NFB$agent_incall$NFE agents in calls \n";
|
811
|
echo "$NFB$B $agent_ready $BG$NFE agents waiting \n";
|
812
|
echo "$NFB$agent_paused$NFE paused agents \n";
|
813
|
|
814
|
echo "<PRE><FONT SIZE=2>";
|
815
|
echo "";
|
816
|
echo "$Aecho";
|
817
|
}
|
818
|
else
|
819
|
{
|
820
|
echo " NO AGENTS ON CALLS \n";
|
821
|
}
|
822
|
|
823
|
?>
|
824
|
</PRE>
|
825
|
|
826
|
</BODY></HTML>
|