forked from amazon-connect/amazon-connect-snippets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
checkConnectivity.html
318 lines (295 loc) · 13.1 KB
/
checkConnectivity.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<title>Call Control Panel (CCP) Connectivity Tool</title>
<meta content="utf-8" http-equiv="encoding" />
<link href="styles/main.css" rel="stylesheet" type="text/css" />
</head>
<body>
<script type="text/javascript" src="scripts/jquery-1.7.1.min.js"></script>
<div id="toolbar">
<div id="headerLogo">
<img src="images/AWS_logo_RGB_REV.svg" id="logo" />
</div>
<div id="title">Amazon Connect - Check Connectivity Tool</div>
</div>
<div class="test_panel">
<form>
<div class="mediapanel">
<fieldset>
<div>
<input type="button" value="Test MEDIA (UDP) ports" onclick="test_all_regions();" id="mediabutton" />
<div id="display"></div>
<table>
<tbody>
<tr></tr>
</tbody>
</table>
<table id="testMedia">
<tbody>
<tr>
<td class="leftcol">[US-East-1]</td>
<td class="media" id="media-us-east-1"> ..... waiting</td>
</tr>
<tr>
<td class="leftcol">[US-West-2]</td>
<td class="media" id="media-us-west-2"> ..... waiting</td>
</tr>
<tr>
<td class="leftcol">[Frankfurt]</td>
<td class="media" id="media-eu-central-1"> ..... waiting</td>
</tr>
<tr>
<td class="leftcol">[Sydney]</td>
<td class="media" id="media-ap-southeast-2"> ..... waiting</td>
</tr>
<tr>
<td class="leftcol">[Tokyo]</td>
<td class="media" id="media-ap-northeast-1"> ..... waiting</td>
</tr>
<tr>
<td class="leftcol">[Singapore]</td>
<td class="media" id="media-ap-southeast-1"> ..... waiting</td>
</tr>
<tr>
<td class="leftcol">[London]</td>
<td class="media" id="media-eu-west-2"> ..... waiting</td>
</tr>
</tbody>
</table>
</div>
</fieldset>
</div>
<div class="mediapanel">
<fieldset>
<div>
<input type="button" id="pingbutton" value="Test EC2 latency" onclick="pingButtonClicked"/>
</div>
<table>
<tbody>
<tr>
<td id="imageCell" colspan="2"></td>
</tr>
</tbody>
</table>
<table id="pingEC2">
<tbody>
<tr>
<td class="leftcol">[US-East-1]</td>
<td class="latency" id="us-east-1" endpoint="https://rtc.connect-telecom.us-east-1.amazonaws.com/"> ..... waiting</td>
</tr>
<tr>
<td class="leftcol">[US-West-2]</td>
<td class="latency" id="us-west-2" endpoint="https://rtc.connect-telecom.us-west-2.amazonaws.com/"> ..... waiting</td>
</tr>
<tr>
<td class="leftcol">[Frankfurt]</td>
<td class="latency" id="eu-central-1" endpoint="https://rtc.connect-telecom.eu-central-1.amazonaws.com/"> ..... waiting</td>
</tr>
<tr>
<td class="leftcol">[Sydney]</td>
<td class="latency" id="ap-southeast-2" endpoint="https://rtc.connect-telecom.ap-southeast-2.amazonaws.com/"> ..... waiting</td>
</tr>
<tr>
<td class="leftcol">[Tokyo]</td>
<td class="latency" id="ap-northeast-1" endpoint="https://rtc.connect-telecom.ap-northeast-1.amazonaws.com/"> ..... waiting</td>
</tr>
<tr>
<td class="leftcol">[Singapore]</td>
<td class="latency" id="ap-southeast-1" endpoint="https://rtc.cell-1.prod.ap-southeast-1.prod.connect.aws.a2z.com/"> ..... waiting</td>
</tr>
<tr>
<td class="leftcol">[London]</td>
<td class="latency" id="eu-west-2" endpoint="https://rtc.cell-1.prod.eu-west-2.prod.connect.aws.a2z.com/"> ..... waiting</td>
</tr>
</tbody>
</table>
</fieldset>
</div>
<div class="mediapanel_bottom">
<fieldset>
<div>
<input type="button" id="pingbuttonCF" value="Test CloudFront latency" onclick="pingButtonClickedCF"/>
</div>
<table>
<tbody>
<tr>
<td id="imageCellCF" colspan="2"></td>
</tr>
</tbody>
</table>
<table id="pingCloudFront">
<tbody>
<tr>
<td>
<label for="alias">Instance Alias</label>
</td>
<td>
<input id="alias" type="text" placeholder="Put Alias Here" />
</td>
</tr>
<tr>
<td></td>
<td class="latencyCF" id="Cloudfront"> </td>
</tr>
</tbody>
</table>
</fieldset>
</div>
</form>
</div>
<script src="scripts/detectRTC.js"></script>
<div class="rtc_tests">
<section class="experiment" id="detectrtc-output">
<h2 id="welcome">
DetectRTC <span class="h2link">(<a href="https://github.com/muaz-khan/DetectRTC" target="_blank">source code</a>)</span>
</h2>
<div class="tablediv">
<table id="browser-features"></table>
</div>
<script>
var browserFeaturesTable = document.querySelector("#browser-features");
function appendTR(firstValue, secondValue, original) {
var tr = document.createElement("tr");
tr.id = original;
var html = '<td class="rtc_td_left" id="rtc_td_left_' + original + '" >' + firstValue + "</td>";
html += '<td class="rtc_td_right" id="rtc_td_right_' + original + '" >' + secondValue + "</td>";
tr.innerHTML = html;
if (original === "error") {
tr.style.color = "red";
}
browserFeaturesTable.appendChild(tr);
return tr;
}
window.onerror = console.error = function () {
appendTR("Error", JSON.stringify(arguments), "error");
};
function printVal(value) {
return value == true ? '<span class="yes">Yes</span>' : value == false ? '<span class="no">No!!</span>' : value;
}
function getInfoDiv(id) {
return '<div class="info-div" id="' + id + '"></div>';
}
var output = "";
function onDetectRTCLoaded() {
browserFeaturesTable.innerHTML = "";
// prints the browser/version.
appendTR("Environment", printVal('<span class="browser">' + DetectRTC.browser.name + "</span>") + "<br> <b>UserAgent: </b>" + navigator.userAgent);
output = printVal(DetectRTC.hasSpeakers);
console.log(DetectRTC.audioOutputDevices);
if (DetectRTC.browser.name === "Firefox" && DetectRTC.audioOutputDevices.length === 0) {
let FireFoxWarning =
'<span class="unknown">Unsure</span><br><b>Note:</b> ' +
DetectRTC.browser.name +
" does not support speaker detection. If system has a speaker, the browser maybe able to utilize it.";
appendTR("System has Speakers?", FireFoxWarning, "audioOutputDevices");
} else if (DetectRTC.audioOutputDevices.length) {
//Should be only one each, can be same. This works in Windows. Will test Mac/Linux later.
let defaultAudio = "";
let defaultCommOut = "";
if (
DetectRTC.audioOutputDevices.filter((device) => device.deviceId === "default")[0] &&
DetectRTC.audioOutputDevices.filter((device) => device.deviceId === "default")[0].label
) {
defaultAudio =
"<br> <b>Default Audio Output Device:</b> " + DetectRTC.audioOutputDevices.filter((device) => device.deviceId === "default")[0].label;
}
if (
DetectRTC.audioOutputDevices.filter((device) => device.deviceId === "communications")[0] &&
DetectRTC.audioOutputDevices.filter((device) => device.deviceId === "communications")[0].label
) {
defaultCommOut =
"<br> <b>Default Communication Output Device:</b> " +
DetectRTC.audioOutputDevices.filter((device) => device.deviceId === "communications")[0].label;
}
appendTR("System has Speakers?", output + defaultAudio + defaultCommOut, "audioOutputDevices");
} else {
appendTR("System has Speakers?", output, "audioOutputDevices");
}
output = printVal(DetectRTC.hasMicrophone);
if (DetectRTC.audioInputDevices.length) {
console.log(DetectRTC.audioInputDevices);
DetectRTC.audioInputDevices.forEach((device) => (output += "<br> <b>Device:</b> " + device.label));
}
appendTR("System has Microphone?", output, "audioInputDevices");
output = printVal(DetectRTC.hasWebcam);
if (DetectRTC.videoInputDevices.length) {
DetectRTC.videoInputDevices.forEach((device) => (output += "<br> <b>Device:</b> " + device.label));
}
appendTR("System has Webcam?", output, "videoInputDevices");
appendTR("Website has webcam permissions?", printVal(DetectRTC.isWebsiteHasWebcamPermissions), "isWebsiteHasWebcamPermissions");
appendTR("Website has microphone permissions?", printVal(DetectRTC.isWebsiteHasMicrophonePermissions), "isWebsiteHasMicrophonePermissions");
appendTR("Browser Supports WebRTC (Either 1.0 or 1.1)?", printVal(DetectRTC.isWebRTCSupported), "isWebRTCSupported");
}
function reloadDetectRTC(callback) {
DetectRTC.load(function () {
onDetectRTCLoaded();
if (callback && typeof callback == "function") {
callback();
}
});
}
DetectRTC.load(function () {
reloadDetectRTC();
try {
if (DetectRTC.MediaDevices[0] && DetectRTC.MediaDevices[0].isCustomLabel) {
navigator.mediaDevices
.getUserMedia({ audio: true, video: true })
.then(function (stream) {
var video;
try {
video = document.createElement("video");
video.muted = true;
video.volume = 0;
video.src = URL.createObjectURL(stream);
video.style.display = "none";
video.style.opacity = 0;
(document.body || document.documentElement).appendChild(vide);
} catch (e) {}
reloadDetectRTC(function () {
// release camera
stream.getTracks().forEach(function (track) {
track.stop();
});
if (video && video.parentNode) {
video.parentNode.removeChild(video);
}
});
})
.catch(reloadDetectRTC);
return;
}
} catch (e) {}
onDetectRTCLoaded();
});
function dataURLToBlob(dataURL) {
var BASE64_MARKER = ";base64,";
if (dataURL.indexOf(BASE64_MARKER) == -1) {
var parts = dataURL.split(",");
var contentType = parts[0].split(":")[1];
var raw = decodeURIComponent(parts[1]);
return new Blob([raw], {
type: contentType,
});
}
var parts = dataURL.split(BASE64_MARKER);
var contentType = parts[0].split(":")[1];
var raw = window.atob(parts[1]);
var rawLength = raw.length;
var uInt8Array = new Uint8Array(rawLength);
for (var i = 0; i < rawLength; ++i) {
uInt8Array[i] = raw.charCodeAt(i);
}
return new Blob([uInt8Array], {
type: contentType,
});
}
</script>
<script type="text/javascript" src="scripts/test_media.js"></script>
<script type="text/javascript" src="scripts/test_ec2.js"></script>
<script type="text/javascript" src="scripts/test_cf.js"></script>
</section>
</div>
</body>
</html>