@webex/plugin-meetings 3.0.0-beta.337 → 3.0.0-beta.339
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/breakouts/breakout.js +1 -1
- package/dist/breakouts/index.js +1 -1
- package/dist/config.js +2 -1
- package/dist/config.js.map +1 -1
- package/dist/interpretation/index.js +1 -1
- package/dist/interpretation/siLanguage.js +1 -1
- package/dist/reachability/clusterReachability.js +356 -0
- package/dist/reachability/clusterReachability.js.map +1 -0
- package/dist/reachability/index.js +167 -451
- package/dist/reachability/index.js.map +1 -1
- package/dist/reachability/util.js +29 -0
- package/dist/reachability/util.js.map +1 -0
- package/dist/statsAnalyzer/mqaUtil.js +4 -0
- package/dist/statsAnalyzer/mqaUtil.js.map +1 -1
- package/dist/types/config.d.ts +1 -0
- package/dist/types/meetings/index.d.ts +1 -11
- package/dist/types/reachability/clusterReachability.d.ts +109 -0
- package/dist/types/reachability/index.d.ts +32 -121
- package/dist/types/reachability/util.d.ts +8 -0
- package/dist/webinar/index.js +1 -1
- package/package.json +20 -20
- package/src/config.ts +1 -0
- package/src/reachability/clusterReachability.ts +320 -0
- package/src/reachability/index.ts +124 -421
- package/src/reachability/util.ts +24 -0
- package/src/statsAnalyzer/mqaUtil.ts +4 -0
- package/test/unit/spec/reachability/clusterReachability.ts +279 -0
- package/test/unit/spec/reachability/index.ts +159 -226
- package/test/unit/spec/reachability/util.ts +40 -0
- package/test/unit/spec/roap/request.ts +26 -3
- package/test/unit/spec/stats-analyzer/index.js +47 -20
|
@@ -9,24 +9,20 @@ exports.default = void 0;
|
|
|
9
9
|
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
|
|
10
10
|
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
|
|
11
11
|
var _values = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/values"));
|
|
12
|
-
var
|
|
12
|
+
var _entries = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/entries"));
|
|
13
13
|
var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
|
|
14
14
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
15
|
-
var
|
|
16
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/toConsumableArray"));
|
|
15
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/slicedToArray"));
|
|
17
16
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
|
|
18
17
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
|
|
19
18
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
|
|
20
19
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
21
|
-
var _pick2 = _interopRequireDefault(require("lodash/pick"));
|
|
22
20
|
var _mapValues2 = _interopRequireDefault(require("lodash/mapValues"));
|
|
23
|
-
var _uniq2 = _interopRequireDefault(require("lodash/uniq"));
|
|
24
21
|
var _loggerProxy = _interopRequireDefault(require("../common/logs/logger-proxy"));
|
|
25
22
|
var _util = _interopRequireDefault(require("../meeting/util"));
|
|
26
23
|
var _constants = require("../constants");
|
|
27
24
|
var _request = _interopRequireDefault(require("./request"));
|
|
28
|
-
var
|
|
29
|
-
var VIDEO_MESH_TIMEOUT = 1000;
|
|
25
|
+
var _clusterReachability = require("./clusterReachability");
|
|
30
26
|
/**
|
|
31
27
|
* @class Reachability
|
|
32
28
|
* @export
|
|
@@ -42,7 +38,7 @@ var Reachability = /*#__PURE__*/function () {
|
|
|
42
38
|
(0, _defineProperty2.default)(this, "namespace", _constants.REACHABILITY.namespace);
|
|
43
39
|
(0, _defineProperty2.default)(this, "webex", void 0);
|
|
44
40
|
(0, _defineProperty2.default)(this, "reachabilityRequest", void 0);
|
|
45
|
-
(0, _defineProperty2.default)(this, "
|
|
41
|
+
(0, _defineProperty2.default)(this, "clusterReachability", void 0);
|
|
46
42
|
this.webex = webex;
|
|
47
43
|
|
|
48
44
|
/**
|
|
@@ -53,22 +49,13 @@ var Reachability = /*#__PURE__*/function () {
|
|
|
53
49
|
* @memberof Reachability
|
|
54
50
|
*/
|
|
55
51
|
this.reachabilityRequest = new _request.default(this.webex);
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* internal object of clusters latency results
|
|
59
|
-
* @instance
|
|
60
|
-
* @type {object}
|
|
61
|
-
* @private
|
|
62
|
-
* @memberof Reachability
|
|
63
|
-
*/
|
|
64
|
-
this.clusterLatencyResults = {};
|
|
52
|
+
this.clusterReachability = {};
|
|
65
53
|
}
|
|
66
54
|
|
|
67
55
|
/**
|
|
68
|
-
*
|
|
69
|
-
* @returns {
|
|
56
|
+
* Gets a list of media clusters from the backend and performs reachability checks on all the clusters
|
|
57
|
+
* @returns {Promise<ReachabilityResults>} reachability results
|
|
70
58
|
* @public
|
|
71
|
-
* @async
|
|
72
59
|
* @memberof Reachability
|
|
73
60
|
*/
|
|
74
61
|
(0, _createClass2.default)(Reachability, [{
|
|
@@ -79,45 +66,41 @@ var Reachability = /*#__PURE__*/function () {
|
|
|
79
66
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
80
67
|
while (1) switch (_context.prev = _context.next) {
|
|
81
68
|
case 0:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
// Remove stored reachability results to ensure no stale data
|
|
85
|
-
// @ts-ignore
|
|
86
|
-
_context.next = 3;
|
|
69
|
+
_context.next = 2;
|
|
87
70
|
return this.webex.boundedStorage.del(this.namespace, _constants.REACHABILITY.localStorageResult);
|
|
88
|
-
case
|
|
89
|
-
_context.next =
|
|
71
|
+
case 2:
|
|
72
|
+
_context.next = 4;
|
|
90
73
|
return this.webex.boundedStorage.del(this.namespace, _constants.REACHABILITY.localStorageJoinCookie);
|
|
91
|
-
case
|
|
92
|
-
_context.prev =
|
|
93
|
-
_context.next =
|
|
74
|
+
case 4:
|
|
75
|
+
_context.prev = 4;
|
|
76
|
+
_context.next = 7;
|
|
94
77
|
return this.reachabilityRequest.getClusters(_util.default.getIpVersion(this.webex));
|
|
95
|
-
case
|
|
78
|
+
case 7:
|
|
96
79
|
_yield$this$reachabil = _context.sent;
|
|
97
80
|
clusters = _yield$this$reachabil.clusters;
|
|
98
81
|
joinCookie = _yield$this$reachabil.joinCookie;
|
|
99
|
-
_context.next =
|
|
100
|
-
return this.
|
|
101
|
-
case
|
|
82
|
+
_context.next = 12;
|
|
83
|
+
return this.performReachabilityChecks(clusters);
|
|
84
|
+
case 12:
|
|
102
85
|
results = _context.sent;
|
|
103
|
-
_context.next =
|
|
86
|
+
_context.next = 15;
|
|
104
87
|
return this.webex.boundedStorage.put(this.namespace, _constants.REACHABILITY.localStorageResult, (0, _stringify.default)(results));
|
|
105
|
-
case
|
|
106
|
-
_context.next =
|
|
88
|
+
case 15:
|
|
89
|
+
_context.next = 17;
|
|
107
90
|
return this.webex.boundedStorage.put(this.namespace, _constants.REACHABILITY.localStorageJoinCookie, (0, _stringify.default)(joinCookie));
|
|
108
|
-
case
|
|
91
|
+
case 17:
|
|
109
92
|
_loggerProxy.default.logger.log('Reachability:index#gatherReachability --> Reachability checks completed');
|
|
110
93
|
return _context.abrupt("return", results);
|
|
111
|
-
case
|
|
112
|
-
_context.prev =
|
|
113
|
-
_context.t0 = _context["catch"](
|
|
114
|
-
_loggerProxy.default.logger.error("Reachability:index#gatherReachability --> Error
|
|
94
|
+
case 21:
|
|
95
|
+
_context.prev = 21;
|
|
96
|
+
_context.t0 = _context["catch"](4);
|
|
97
|
+
_loggerProxy.default.logger.error("Reachability:index#gatherReachability --> Error:", _context.t0);
|
|
115
98
|
return _context.abrupt("return", {});
|
|
116
|
-
case
|
|
99
|
+
case 25:
|
|
117
100
|
case "end":
|
|
118
101
|
return _context.stop();
|
|
119
102
|
}
|
|
120
|
-
}, _callee, this, [[
|
|
103
|
+
}, _callee, this, [[4, 21]]);
|
|
121
104
|
}));
|
|
122
105
|
function gatherReachability() {
|
|
123
106
|
return _gatherReachability.apply(this, arguments);
|
|
@@ -134,7 +117,7 @@ var Reachability = /*#__PURE__*/function () {
|
|
|
134
117
|
key: "getReachabilityMetrics",
|
|
135
118
|
value: function () {
|
|
136
119
|
var _getReachabilityMetrics = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
137
|
-
var stats, updateStats, resultsJson,
|
|
120
|
+
var stats, updateStats, resultsJson, results;
|
|
138
121
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
139
122
|
while (1) switch (_context2.prev = _context2.next) {
|
|
140
123
|
case 0:
|
|
@@ -149,13 +132,12 @@ var Reachability = /*#__PURE__*/function () {
|
|
|
149
132
|
reachability_vmn_tcp_failed: 0
|
|
150
133
|
};
|
|
151
134
|
updateStats = function updateStats(clusterType, result) {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
var outcome = result.udp.reachable === 'true' ? 'success' : 'failed';
|
|
135
|
+
if (result.udp && result.udp.result !== 'untested') {
|
|
136
|
+
var outcome = result.udp.result === 'reachable' ? 'success' : 'failed';
|
|
155
137
|
stats["reachability_".concat(clusterType, "_udp_").concat(outcome)] += 1;
|
|
156
138
|
}
|
|
157
|
-
if (
|
|
158
|
-
var _outcome = result.tcp.
|
|
139
|
+
if (result.tcp && result.tcp.result !== 'untested') {
|
|
140
|
+
var _outcome = result.tcp.result === 'reachable' ? 'success' : 'failed';
|
|
159
141
|
stats["reachability_".concat(clusterType, "_tcp_").concat(_outcome)] += 1;
|
|
160
142
|
}
|
|
161
143
|
};
|
|
@@ -164,8 +146,8 @@ var Reachability = /*#__PURE__*/function () {
|
|
|
164
146
|
return this.webex.boundedStorage.get(_constants.REACHABILITY.namespace, _constants.REACHABILITY.localStorageResult);
|
|
165
147
|
case 5:
|
|
166
148
|
resultsJson = _context2.sent;
|
|
167
|
-
|
|
168
|
-
(0, _values.default)(
|
|
149
|
+
results = JSON.parse(resultsJson);
|
|
150
|
+
(0, _values.default)(results).forEach(function (result) {
|
|
169
151
|
updateStats(result.isVideoMesh ? 'vmn' : 'public', result);
|
|
170
152
|
});
|
|
171
153
|
_context2.next = 13;
|
|
@@ -188,6 +170,43 @@ var Reachability = /*#__PURE__*/function () {
|
|
|
188
170
|
}
|
|
189
171
|
return getReachabilityMetrics;
|
|
190
172
|
}()
|
|
173
|
+
/**
|
|
174
|
+
* Maps our internal transport result to the format that backend expects
|
|
175
|
+
* @param {TransportResult} transportResult
|
|
176
|
+
* @returns {TransportResultForBackend}
|
|
177
|
+
*/
|
|
178
|
+
}, {
|
|
179
|
+
key: "mapTransportResultToBackendDataFormat",
|
|
180
|
+
value: function mapTransportResultToBackendDataFormat(transportResult) {
|
|
181
|
+
var output = {};
|
|
182
|
+
for (var _i = 0, _Object$entries = (0, _entries.default)(transportResult); _i < _Object$entries.length; _i++) {
|
|
183
|
+
var _Object$entries$_i = (0, _slicedToArray2.default)(_Object$entries[_i], 2),
|
|
184
|
+
_key = _Object$entries$_i[0],
|
|
185
|
+
value = _Object$entries$_i[1];
|
|
186
|
+
switch (_key) {
|
|
187
|
+
case 'result':
|
|
188
|
+
switch (value) {
|
|
189
|
+
case 'reachable':
|
|
190
|
+
output.reachable = 'true';
|
|
191
|
+
break;
|
|
192
|
+
case 'unreachable':
|
|
193
|
+
output.reachable = 'false';
|
|
194
|
+
break;
|
|
195
|
+
case 'untested':
|
|
196
|
+
output.untested = 'true';
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
break;
|
|
200
|
+
case 'latencyInMilliseconds':
|
|
201
|
+
output.latencyInMilliseconds = value.toString();
|
|
202
|
+
break;
|
|
203
|
+
default:
|
|
204
|
+
output[_key] = value;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return output;
|
|
208
|
+
}
|
|
209
|
+
|
|
191
210
|
/**
|
|
192
211
|
* Reachability results as an object in the format that backend expects
|
|
193
212
|
*
|
|
@@ -197,35 +216,44 @@ var Reachability = /*#__PURE__*/function () {
|
|
|
197
216
|
key: "getReachabilityResults",
|
|
198
217
|
value: function () {
|
|
199
218
|
var _getReachabilityResults = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
200
|
-
var
|
|
219
|
+
var _this = this;
|
|
220
|
+
var results, resultsJson, allClusterResults;
|
|
201
221
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
202
222
|
while (1) switch (_context3.prev = _context3.next) {
|
|
203
223
|
case 0:
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
_context3.prev = 1;
|
|
207
|
-
_context3.next = 4;
|
|
224
|
+
_context3.prev = 0;
|
|
225
|
+
_context3.next = 3;
|
|
208
226
|
return this.webex.boundedStorage.get(_constants.REACHABILITY.namespace, _constants.REACHABILITY.localStorageResult);
|
|
209
|
-
case
|
|
227
|
+
case 3:
|
|
210
228
|
resultsJson = _context3.sent;
|
|
211
|
-
|
|
212
|
-
results = (0, _mapValues2.default)(
|
|
213
|
-
return
|
|
229
|
+
allClusterResults = JSON.parse(resultsJson);
|
|
230
|
+
results = (0, _mapValues2.default)(allClusterResults, function (clusterResult) {
|
|
231
|
+
return {
|
|
232
|
+
udp: _this.mapTransportResultToBackendDataFormat(clusterResult.udp || {
|
|
233
|
+
result: 'untested'
|
|
234
|
+
}),
|
|
235
|
+
tcp: _this.mapTransportResultToBackendDataFormat(clusterResult.tcp || {
|
|
236
|
+
result: 'untested'
|
|
237
|
+
}),
|
|
238
|
+
xtls: _this.mapTransportResultToBackendDataFormat(clusterResult.xtls || {
|
|
239
|
+
result: 'untested'
|
|
240
|
+
})
|
|
241
|
+
};
|
|
214
242
|
});
|
|
215
|
-
_context3.next =
|
|
243
|
+
_context3.next = 11;
|
|
216
244
|
break;
|
|
217
|
-
case
|
|
218
|
-
_context3.prev =
|
|
219
|
-
_context3.t0 = _context3["catch"](
|
|
245
|
+
case 8:
|
|
246
|
+
_context3.prev = 8;
|
|
247
|
+
_context3.t0 = _context3["catch"](0);
|
|
220
248
|
// empty storage, that's ok
|
|
221
249
|
_loggerProxy.default.logger.warn('Roap:request#attachReachabilityData --> Error parsing reachability data: ', _context3.t0);
|
|
222
|
-
case
|
|
250
|
+
case 11:
|
|
223
251
|
return _context3.abrupt("return", results);
|
|
224
|
-
case
|
|
252
|
+
case 12:
|
|
225
253
|
case "end":
|
|
226
254
|
return _context3.stop();
|
|
227
255
|
}
|
|
228
|
-
}, _callee3, this, [[
|
|
256
|
+
}, _callee3, this, [[0, 8]]);
|
|
229
257
|
}));
|
|
230
258
|
function getReachabilityResults() {
|
|
231
259
|
return _getReachabilityResults.apply(this, arguments);
|
|
@@ -255,8 +283,8 @@ var Reachability = /*#__PURE__*/function () {
|
|
|
255
283
|
try {
|
|
256
284
|
reachabilityResults = JSON.parse(reachabilityData);
|
|
257
285
|
reachable = (0, _values.default)(reachabilityResults).some(function (result) {
|
|
258
|
-
var _result$
|
|
259
|
-
return !result.isVideoMesh && (((_result$
|
|
286
|
+
var _result$udp, _result$tcp;
|
|
287
|
+
return !result.isVideoMesh && (((_result$udp = result.udp) === null || _result$udp === void 0 ? void 0 : _result$udp.result) === 'reachable' || ((_result$tcp = result.tcp) === null || _result$tcp === void 0 ? void 0 : _result$tcp.result) === 'reachable');
|
|
260
288
|
});
|
|
261
289
|
} catch (e) {
|
|
262
290
|
_loggerProxy.default.logger.error("Roap:request#attachReachabilityData --> Error in parsing reachability data: ".concat(e));
|
|
@@ -274,123 +302,6 @@ var Reachability = /*#__PURE__*/function () {
|
|
|
274
302
|
}
|
|
275
303
|
return isAnyPublicClusterReachable;
|
|
276
304
|
}()
|
|
277
|
-
/**
|
|
278
|
-
* Generate peerConnection config settings
|
|
279
|
-
* @param {object} cluster
|
|
280
|
-
* @returns {object} peerConnectionConfig
|
|
281
|
-
* @private
|
|
282
|
-
* @memberof Reachability
|
|
283
|
-
*/
|
|
284
|
-
}, {
|
|
285
|
-
key: "buildPeerConnectionConfig",
|
|
286
|
-
value: function buildPeerConnectionConfig(cluster) {
|
|
287
|
-
var iceServers = (0, _uniq2.default)(cluster.udp).map(function (url) {
|
|
288
|
-
return {
|
|
289
|
-
username: '',
|
|
290
|
-
credential: '',
|
|
291
|
-
urls: [url]
|
|
292
|
-
};
|
|
293
|
-
});
|
|
294
|
-
return {
|
|
295
|
-
iceServers: (0, _toConsumableArray2.default)(iceServers),
|
|
296
|
-
iceCandidatePoolSize: '0',
|
|
297
|
-
iceTransportPolicy: 'all'
|
|
298
|
-
};
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* Creates an RTCPeerConnection
|
|
303
|
-
* @param {object} cluster
|
|
304
|
-
* @returns {RTCPeerConnection} peerConnection
|
|
305
|
-
* @private
|
|
306
|
-
* @memberof Reachability
|
|
307
|
-
*/
|
|
308
|
-
}, {
|
|
309
|
-
key: "createPeerConnection",
|
|
310
|
-
value: function createPeerConnection(cluster) {
|
|
311
|
-
var key = cluster.key,
|
|
312
|
-
config = cluster.config;
|
|
313
|
-
try {
|
|
314
|
-
var peerConnection = new window.RTCPeerConnection(config);
|
|
315
|
-
|
|
316
|
-
// @ts-ignore
|
|
317
|
-
peerConnection.key = key;
|
|
318
|
-
return peerConnection;
|
|
319
|
-
} catch (peerConnectionError) {
|
|
320
|
-
_loggerProxy.default.logger.log("Reachability:index#createPeerConnection --> Error creating peerConnection: ".concat(peerConnectionError));
|
|
321
|
-
return null;
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
/**
|
|
326
|
-
* Gets total elapsed time
|
|
327
|
-
* @param {RTCPeerConnection} peerConnection
|
|
328
|
-
* @returns {Number} Milliseconds
|
|
329
|
-
* @private
|
|
330
|
-
* @memberof Reachability
|
|
331
|
-
*/
|
|
332
|
-
}, {
|
|
333
|
-
key: "getElapsedTime",
|
|
334
|
-
value: function getElapsedTime(peerConnection) {
|
|
335
|
-
var startTime = peerConnection.begin;
|
|
336
|
-
delete peerConnection.begin;
|
|
337
|
-
return (0, _now.default)() - startTime;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* creates offer and generates localSDP
|
|
342
|
-
* @param {object} clusterList cluster List
|
|
343
|
-
* @returns {Promise} Reachability latency results
|
|
344
|
-
* @private
|
|
345
|
-
* @memberof Reachability
|
|
346
|
-
*/
|
|
347
|
-
}, {
|
|
348
|
-
key: "getLocalSDPForClusters",
|
|
349
|
-
value: function getLocalSDPForClusters(clusterList) {
|
|
350
|
-
var _this = this;
|
|
351
|
-
var clusters = (0, _toConsumableArray2.default)((0, _keys.default)(clusterList));
|
|
352
|
-
clusters = clusters.map( /*#__PURE__*/function () {
|
|
353
|
-
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(key) {
|
|
354
|
-
var cluster, config, peerConnection, description;
|
|
355
|
-
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
356
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
357
|
-
case 0:
|
|
358
|
-
cluster = clusterList[key];
|
|
359
|
-
config = _this.buildPeerConnectionConfig(cluster);
|
|
360
|
-
peerConnection = _this.createPeerConnection({
|
|
361
|
-
key: key,
|
|
362
|
-
config: config
|
|
363
|
-
});
|
|
364
|
-
_context5.next = 5;
|
|
365
|
-
return peerConnection.createOffer({
|
|
366
|
-
offerToReceiveAudio: true
|
|
367
|
-
});
|
|
368
|
-
case 5:
|
|
369
|
-
description = _context5.sent;
|
|
370
|
-
// @ts-ignore
|
|
371
|
-
peerConnection.begin = (0, _now.default)();
|
|
372
|
-
peerConnection.setLocalDescription(description);
|
|
373
|
-
return _context5.abrupt("return", _this.iceGatheringState(peerConnection, cluster.isVideoMesh).catch(function (iceGatheringStateError) {
|
|
374
|
-
_loggerProxy.default.logger.log("Reachability:index#getLocalSDPForClusters --> Error in getLocalSDP : ".concat(iceGatheringStateError));
|
|
375
|
-
}));
|
|
376
|
-
case 9:
|
|
377
|
-
case "end":
|
|
378
|
-
return _context5.stop();
|
|
379
|
-
}
|
|
380
|
-
}, _callee5);
|
|
381
|
-
}));
|
|
382
|
-
return function (_x) {
|
|
383
|
-
return _ref.apply(this, arguments);
|
|
384
|
-
};
|
|
385
|
-
}());
|
|
386
|
-
return _promise.default.all(clusters).then(this.parseIceResultsToInternalReachabilityResults).then(function (reachabilityLatencyResults) {
|
|
387
|
-
_this.logUnreachableClusters();
|
|
388
|
-
|
|
389
|
-
// return results
|
|
390
|
-
return reachabilityLatencyResults;
|
|
391
|
-
});
|
|
392
|
-
}
|
|
393
|
-
|
|
394
305
|
/**
|
|
395
306
|
* Get list of all unreachable clusters
|
|
396
307
|
* @returns {array} Unreachable clusters
|
|
@@ -398,130 +309,28 @@ var Reachability = /*#__PURE__*/function () {
|
|
|
398
309
|
* @memberof Reachability
|
|
399
310
|
*/
|
|
400
311
|
}, {
|
|
401
|
-
key: "
|
|
402
|
-
value: function
|
|
312
|
+
key: "getUnreachableClusters",
|
|
313
|
+
value: function getUnreachableClusters() {
|
|
403
314
|
var unreachableList = [];
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
/**
|
|
415
|
-
* Attach an event handler for the icegatheringstatechange
|
|
416
|
-
* event and measure latency.
|
|
417
|
-
* @param {RTCPeerConnection} peerConnection
|
|
418
|
-
* @returns {undefined}
|
|
419
|
-
* @private
|
|
420
|
-
* @memberof Reachability
|
|
421
|
-
*/
|
|
422
|
-
}, {
|
|
423
|
-
key: "handleIceGatheringStateChange",
|
|
424
|
-
value: function handleIceGatheringStateChange(peerConnection) {
|
|
425
|
-
var _this2 = this;
|
|
426
|
-
peerConnection.onicegatheringstatechange = function () {
|
|
427
|
-
var COMPLETE = _constants.ICE_GATHERING_STATE.COMPLETE;
|
|
428
|
-
if (peerConnection.iceConnectionState === COMPLETE) {
|
|
429
|
-
var elapsed = _this2.getElapsedTime(peerConnection);
|
|
430
|
-
|
|
431
|
-
// @ts-ignore
|
|
432
|
-
_loggerProxy.default.logger.log( // @ts-ignore
|
|
433
|
-
"Reachability:index#onIceGatheringStateChange --> Successfully pinged ".concat(peerConnection.key, ":"), elapsed);
|
|
434
|
-
_this2.setLatencyAndClose(peerConnection, elapsed);
|
|
315
|
+
(0, _entries.default)(this.clusterReachability).forEach(function (_ref) {
|
|
316
|
+
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
317
|
+
key = _ref2[0],
|
|
318
|
+
clusterReachability = _ref2[1];
|
|
319
|
+
var result = clusterReachability.getResult();
|
|
320
|
+
if (result.udp.result === 'unreachable') {
|
|
321
|
+
unreachableList.push({
|
|
322
|
+
name: key,
|
|
323
|
+
protocol: 'udp'
|
|
324
|
+
});
|
|
435
325
|
}
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
* event and measure latency.
|
|
442
|
-
* @param {RTCPeerConnection} peerConnection
|
|
443
|
-
* @returns {undefined}
|
|
444
|
-
* @private
|
|
445
|
-
* @memberof Reachability
|
|
446
|
-
*/
|
|
447
|
-
}, {
|
|
448
|
-
key: "handleOnIceCandidate",
|
|
449
|
-
value: function handleOnIceCandidate(peerConnection) {
|
|
450
|
-
var _this3 = this;
|
|
451
|
-
peerConnection.onicecandidate = function (e) {
|
|
452
|
-
var SERVER_REFLEXIVE = 'srflx';
|
|
453
|
-
if (e.candidate && String(e.candidate.type).toLowerCase() === SERVER_REFLEXIVE) {
|
|
454
|
-
var elapsed = _this3.getElapsedTime(peerConnection);
|
|
455
|
-
_loggerProxy.default.logger.log( // @ts-ignore
|
|
456
|
-
"Reachability:index#onIceCandidate --> Successfully pinged ".concat(peerConnection.key, ":"), elapsed);
|
|
457
|
-
// order is important
|
|
458
|
-
_this3.addPublicIP(peerConnection, e.candidate.address);
|
|
459
|
-
_this3.setLatencyAndClose(peerConnection, elapsed);
|
|
326
|
+
if (result.tcp.result === 'unreachable') {
|
|
327
|
+
unreachableList.push({
|
|
328
|
+
name: key,
|
|
329
|
+
protocol: 'tcp'
|
|
330
|
+
});
|
|
460
331
|
}
|
|
461
|
-
};
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
/**
|
|
465
|
-
* An event handler on an RTCPeerConnection when the state of the ICE
|
|
466
|
-
* candidate gathering process changes. Used to measure connection
|
|
467
|
-
* speed.
|
|
468
|
-
* @private
|
|
469
|
-
* @param {RTCPeerConnection} peerConnection
|
|
470
|
-
* @param {boolean} isVideoMesh
|
|
471
|
-
* @returns {Promise}
|
|
472
|
-
*/
|
|
473
|
-
}, {
|
|
474
|
-
key: "iceGatheringState",
|
|
475
|
-
value: function iceGatheringState(peerConnection, isVideoMesh) {
|
|
476
|
-
var _this4 = this;
|
|
477
|
-
var ELAPSED = 'elapsed';
|
|
478
|
-
var timeout = isVideoMesh ? VIDEO_MESH_TIMEOUT : DEFAULT_TIMEOUT;
|
|
479
|
-
return new _promise.default(function (resolve) {
|
|
480
|
-
var peerConnectionProxy = new window.Proxy(peerConnection, {
|
|
481
|
-
// eslint-disable-next-line require-jsdoc
|
|
482
|
-
get: function get(target, property) {
|
|
483
|
-
var targetMember = target[property];
|
|
484
|
-
if (typeof targetMember === 'function') {
|
|
485
|
-
return targetMember.bind(target);
|
|
486
|
-
}
|
|
487
|
-
return targetMember;
|
|
488
|
-
},
|
|
489
|
-
set: function set(target, property, value) {
|
|
490
|
-
// only intercept elapsed property
|
|
491
|
-
if (property === ELAPSED) {
|
|
492
|
-
resolve({
|
|
493
|
-
// @ts-ignore
|
|
494
|
-
clusterId: peerConnection.key,
|
|
495
|
-
isVideoMesh: isVideoMesh,
|
|
496
|
-
// @ts-ignore
|
|
497
|
-
publicIPs: target.publicIPs,
|
|
498
|
-
elapsed: value
|
|
499
|
-
});
|
|
500
|
-
return true;
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
// pass thru
|
|
504
|
-
return window.Reflect.set(target, property, value);
|
|
505
|
-
}
|
|
506
|
-
});
|
|
507
|
-
|
|
508
|
-
// Using peerConnection proxy so handle functions below
|
|
509
|
-
// won't be coupled to our promise implementation
|
|
510
|
-
_this4.handleIceGatheringStateChange(peerConnectionProxy);
|
|
511
|
-
_this4.handleOnIceCandidate(peerConnectionProxy);
|
|
512
|
-
|
|
513
|
-
// Set maximum timeout
|
|
514
|
-
window.setTimeout(function () {
|
|
515
|
-
var CLOSED = _constants.CONNECTION_STATE.CLOSED;
|
|
516
|
-
|
|
517
|
-
// Close any open peerConnections
|
|
518
|
-
if (peerConnectionProxy.connectionState !== CLOSED) {
|
|
519
|
-
// order is important
|
|
520
|
-
_this4.addPublicIP(peerConnectionProxy, null);
|
|
521
|
-
_this4.setLatencyAndClose(peerConnectionProxy, null);
|
|
522
|
-
}
|
|
523
|
-
}, timeout);
|
|
524
332
|
});
|
|
333
|
+
return unreachableList;
|
|
525
334
|
}
|
|
526
335
|
|
|
527
336
|
/**
|
|
@@ -533,158 +342,65 @@ var Reachability = /*#__PURE__*/function () {
|
|
|
533
342
|
}, {
|
|
534
343
|
key: "logUnreachableClusters",
|
|
535
344
|
value: function logUnreachableClusters() {
|
|
536
|
-
var list = this.
|
|
537
|
-
list.forEach(function (
|
|
538
|
-
|
|
345
|
+
var list = this.getUnreachableClusters();
|
|
346
|
+
list.forEach(function (_ref3) {
|
|
347
|
+
var name = _ref3.name,
|
|
348
|
+
protocol = _ref3.protocol;
|
|
349
|
+
_loggerProxy.default.logger.log("Reachability:index#logUnreachableClusters --> failed to reach ".concat(name, " over ").concat(protocol));
|
|
539
350
|
});
|
|
540
351
|
}
|
|
541
352
|
|
|
542
353
|
/**
|
|
543
|
-
*
|
|
544
|
-
* @param {
|
|
545
|
-
* @returns {
|
|
546
|
-
* @protected
|
|
547
|
-
* @memberof Reachability
|
|
354
|
+
* Performs reachability checks for all clusters
|
|
355
|
+
* @param {ClusterList} clusterList
|
|
356
|
+
* @returns {Promise<ReachabilityResults>} reachability check results
|
|
548
357
|
*/
|
|
549
358
|
}, {
|
|
550
|
-
key: "
|
|
551
|
-
value: function
|
|
552
|
-
var
|
|
553
|
-
|
|
554
|
-
var
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
/**
|
|
589
|
-
* fetches reachability data
|
|
590
|
-
* @param {object} clusterList
|
|
591
|
-
* @returns {Promise<InternalReachabilityResults>} reachability check results
|
|
592
|
-
* @private
|
|
593
|
-
* @memberof Reachability
|
|
594
|
-
*/
|
|
595
|
-
}, {
|
|
596
|
-
key: "performReachabilityCheck",
|
|
597
|
-
value: function performReachabilityCheck(clusterList) {
|
|
598
|
-
var _this5 = this;
|
|
599
|
-
if (!clusterList || !(0, _keys.default)(clusterList).length) {
|
|
600
|
-
return _promise.default.resolve({});
|
|
601
|
-
}
|
|
602
|
-
return new _promise.default(function (resolve) {
|
|
603
|
-
_this5.getLocalSDPForClusters(clusterList).then(function (localSDPData) {
|
|
604
|
-
if (!localSDPData || !(0, _keys.default)(localSDPData).length) {
|
|
605
|
-
// TODO: handle the error condition properly and try retry
|
|
606
|
-
_loggerProxy.default.logger.log('Reachability:index#performReachabilityCheck --> Local SDP is empty or has missing elements..returning');
|
|
607
|
-
resolve({});
|
|
608
|
-
} else {
|
|
609
|
-
resolve(localSDPData);
|
|
359
|
+
key: "performReachabilityChecks",
|
|
360
|
+
value: function () {
|
|
361
|
+
var _performReachabilityChecks = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(clusterList) {
|
|
362
|
+
var _this2 = this;
|
|
363
|
+
var results, includeTcpReachability, clusterReachabilityChecks;
|
|
364
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
365
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
366
|
+
case 0:
|
|
367
|
+
results = {};
|
|
368
|
+
if (!(!clusterList || !(0, _keys.default)(clusterList).length)) {
|
|
369
|
+
_context5.next = 3;
|
|
370
|
+
break;
|
|
371
|
+
}
|
|
372
|
+
return _context5.abrupt("return", _promise.default.resolve(results));
|
|
373
|
+
case 3:
|
|
374
|
+
// @ts-ignore
|
|
375
|
+
includeTcpReachability = this.webex.config.meetings.experimental.enableTcpReachability;
|
|
376
|
+
_loggerProxy.default.logger.log("Reachability:index#performReachabilityChecks --> doing UDP".concat(includeTcpReachability ? ' and TCP' : '', " reachability checks"));
|
|
377
|
+
clusterReachabilityChecks = (0, _keys.default)(clusterList).map(function (key) {
|
|
378
|
+
var cluster = clusterList[key];
|
|
379
|
+
if (!includeTcpReachability) {
|
|
380
|
+
cluster.tcp = [];
|
|
381
|
+
}
|
|
382
|
+
_this2.clusterReachability[key] = new _clusterReachability.ClusterReachability(key, cluster);
|
|
383
|
+
return _this2.clusterReachability[key].start().then(function (result) {
|
|
384
|
+
results[key] = result;
|
|
385
|
+
results[key].isVideoMesh = cluster.isVideoMesh;
|
|
386
|
+
});
|
|
387
|
+
});
|
|
388
|
+
_context5.next = 8;
|
|
389
|
+
return _promise.default.all(clusterReachabilityChecks);
|
|
390
|
+
case 8:
|
|
391
|
+
this.logUnreachableClusters();
|
|
392
|
+
return _context5.abrupt("return", results);
|
|
393
|
+
case 10:
|
|
394
|
+
case "end":
|
|
395
|
+
return _context5.stop();
|
|
610
396
|
}
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
});
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
/**
|
|
619
|
-
* Adds public IP (client media IPs)
|
|
620
|
-
* @param {RTCPeerConnection} peerConnection
|
|
621
|
-
* @param {string} publicIP
|
|
622
|
-
* @returns {void}
|
|
623
|
-
*/
|
|
624
|
-
}, {
|
|
625
|
-
key: "addPublicIP",
|
|
626
|
-
value: function addPublicIP(peerConnection, publicIP) {
|
|
627
|
-
var modifiedPeerConnection = peerConnection;
|
|
628
|
-
var CLOSED = _constants.CONNECTION_STATE.CLOSED;
|
|
629
|
-
if (modifiedPeerConnection.connectionState === CLOSED) {
|
|
630
|
-
_loggerProxy.default.logger.log("Reachability:index#addPublicIP --> Attempting to set publicIP of ".concat(publicIP, " on closed peerConnection."));
|
|
631
|
-
}
|
|
632
|
-
if (publicIP) {
|
|
633
|
-
if (modifiedPeerConnection.publicIPs) {
|
|
634
|
-
modifiedPeerConnection.publicIPs.push(publicIP);
|
|
635
|
-
} else {
|
|
636
|
-
modifiedPeerConnection.publicIPs = [publicIP];
|
|
637
|
-
}
|
|
638
|
-
} else {
|
|
639
|
-
modifiedPeerConnection.publicIPs = null;
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
/**
|
|
644
|
-
* Records latency and closes the peerConnection
|
|
645
|
-
* @param {RTCPeerConnection} peerConnection
|
|
646
|
-
* @param {number} elapsed Latency in milliseconds
|
|
647
|
-
* @returns {undefined}
|
|
648
|
-
* @private
|
|
649
|
-
* @memberof Reachability
|
|
650
|
-
*/
|
|
651
|
-
}, {
|
|
652
|
-
key: "setLatencyAndClose",
|
|
653
|
-
value: function setLatencyAndClose(peerConnection, elapsed) {
|
|
654
|
-
var _intialState;
|
|
655
|
-
var REACHABLE = 'reachable';
|
|
656
|
-
var UNREACHABLE = 'unreachable';
|
|
657
|
-
var CLOSED = _constants.CONNECTION_STATE.CLOSED;
|
|
658
|
-
// @ts-ignore
|
|
659
|
-
var key = peerConnection.key;
|
|
660
|
-
var resultKey = elapsed === null ? UNREACHABLE : REACHABLE;
|
|
661
|
-
var intialState = (_intialState = {}, (0, _defineProperty2.default)(_intialState, REACHABLE, 0), (0, _defineProperty2.default)(_intialState, UNREACHABLE, 0), _intialState);
|
|
662
|
-
if (peerConnection.connectionState === CLOSED) {
|
|
663
|
-
_loggerProxy.default.logger.log("Reachability:index#setLatencyAndClose --> Attempting to set latency of ".concat(elapsed, " on closed peerConnection."));
|
|
664
|
-
return;
|
|
397
|
+
}, _callee5, this);
|
|
398
|
+
}));
|
|
399
|
+
function performReachabilityChecks(_x) {
|
|
400
|
+
return _performReachabilityChecks.apply(this, arguments);
|
|
665
401
|
}
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
// Set to null in case this fired from
|
|
670
|
-
// an event other than onIceCandidate
|
|
671
|
-
peerConnection.onicecandidate = null;
|
|
672
|
-
peerConnection.close();
|
|
673
|
-
// @ts-ignore
|
|
674
|
-
peerConnection.elapsed = elapsed;
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
/**
|
|
678
|
-
* utility function
|
|
679
|
-
* @returns {undefined}
|
|
680
|
-
* @private
|
|
681
|
-
* @memberof Reachability
|
|
682
|
-
*/
|
|
683
|
-
}, {
|
|
684
|
-
key: "setup",
|
|
685
|
-
value: function setup() {
|
|
686
|
-
this.clusterLatencyResults = {};
|
|
687
|
-
}
|
|
402
|
+
return performReachabilityChecks;
|
|
403
|
+
}()
|
|
688
404
|
}]);
|
|
689
405
|
return Reachability;
|
|
690
406
|
}();
|