@webex/calling 3.8.1-next.7 → 3.8.1-next.9
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/CallingClient/CallingClient.test.js +8 -6
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/line/line.test.js +4 -10
- package/dist/CallingClient/line/line.test.js.map +1 -1
- package/dist/CallingClient/registration/register.js +351 -345
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +292 -263
- package/dist/CallingClient/registration/register.test.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.js +115 -0
- package/dist/CallingClient/registration/webWorker.js.map +1 -0
- package/dist/CallingClient/registration/webWorker.test.js +256 -0
- package/dist/CallingClient/registration/webWorker.test.js.map +1 -0
- package/dist/CallingClient/registration/webWorkerStr.js +15 -0
- package/dist/CallingClient/registration/webWorkerStr.js.map +1 -0
- package/dist/common/types.js +8 -1
- package/dist/common/types.js.map +1 -1
- package/dist/module/CallingClient/registration/register.js +54 -54
- package/dist/module/CallingClient/registration/webWorker.js +59 -0
- package/dist/module/CallingClient/registration/webWorkerStr.js +93 -0
- package/dist/module/common/types.js +7 -0
- package/dist/types/CallingClient/registration/register.d.ts +1 -2
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/webWorker.d.ts +2 -0
- package/dist/types/CallingClient/registration/webWorker.d.ts.map +1 -0
- package/dist/types/CallingClient/registration/webWorkerStr.d.ts +3 -0
- package/dist/types/CallingClient/registration/webWorkerStr.d.ts.map +1 -0
- package/dist/types/common/types.d.ts +12 -0
- package/dist/types/common/types.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -25,6 +25,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/he
|
|
|
25
25
|
var _uuid = require("uuid");
|
|
26
26
|
var _constants = require("../../common/constants");
|
|
27
27
|
var _common = require("../../common");
|
|
28
|
+
var _webWorkerStr = _interopRequireDefault(require("./webWorkerStr"));
|
|
28
29
|
var _types = require("../../Metrics/types");
|
|
29
30
|
var _Metrics = require("../../Metrics");
|
|
30
31
|
var _calling = require("../calling");
|
|
@@ -54,7 +55,6 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
54
55
|
(0, _defineProperty2.default)(this, "registrationStatus", void 0);
|
|
55
56
|
(0, _defineProperty2.default)(this, "failbackTimer", void 0);
|
|
56
57
|
(0, _defineProperty2.default)(this, "activeMobiusUrl", void 0);
|
|
57
|
-
(0, _defineProperty2.default)(this, "keepaliveTimer", void 0);
|
|
58
58
|
(0, _defineProperty2.default)(this, "rehomingIntervalMin", void 0);
|
|
59
59
|
(0, _defineProperty2.default)(this, "rehomingIntervalMax", void 0);
|
|
60
60
|
(0, _defineProperty2.default)(this, "mutex", void 0);
|
|
@@ -71,6 +71,7 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
71
71
|
(0, _defineProperty2.default)(this, "failoverImmediately", false);
|
|
72
72
|
(0, _defineProperty2.default)(this, "retryAfter", void 0);
|
|
73
73
|
(0, _defineProperty2.default)(this, "scheduled429Retry", false);
|
|
74
|
+
(0, _defineProperty2.default)(this, "webWorker", void 0);
|
|
74
75
|
this.jwe = jwe;
|
|
75
76
|
this.sdkConnector = _SDKConnector.default;
|
|
76
77
|
this.serviceData = serviceData;
|
|
@@ -118,94 +119,65 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
118
119
|
this.backupMobiusUris = backupMobiusUris;
|
|
119
120
|
}
|
|
120
121
|
|
|
121
|
-
/**
|
|
122
|
-
* Implementation of sending keepalive.
|
|
123
|
-
*
|
|
124
|
-
*/
|
|
125
|
-
}, {
|
|
126
|
-
key: "postKeepAlive",
|
|
127
|
-
value: (function () {
|
|
128
|
-
var _postKeepAlive = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(url) {
|
|
129
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
130
|
-
while (1) switch (_context.prev = _context.next) {
|
|
131
|
-
case 0:
|
|
132
|
-
return _context.abrupt("return", this.webex.request({
|
|
133
|
-
uri: "".concat(url, "/status"),
|
|
134
|
-
method: _types2.HTTP_METHODS.POST,
|
|
135
|
-
headers: (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _constants2.CISCO_DEVICE_URL, this.webex.internal.device.url), _constants2.SPARK_USER_AGENT, _constants2.CALLING_USER_AGENT),
|
|
136
|
-
service: _types2.ALLOWED_SERVICES.MOBIUS
|
|
137
|
-
}));
|
|
138
|
-
case 1:
|
|
139
|
-
case "end":
|
|
140
|
-
return _context.stop();
|
|
141
|
-
}
|
|
142
|
-
}, _callee, this);
|
|
143
|
-
}));
|
|
144
|
-
function postKeepAlive(_x) {
|
|
145
|
-
return _postKeepAlive.apply(this, arguments);
|
|
146
|
-
}
|
|
147
|
-
return postKeepAlive;
|
|
148
|
-
}()
|
|
149
122
|
/**
|
|
150
123
|
* Implementation of delete device.
|
|
151
124
|
*
|
|
152
125
|
*/
|
|
153
|
-
)
|
|
154
126
|
}, {
|
|
155
127
|
key: "deleteRegistration",
|
|
156
128
|
value: (function () {
|
|
157
|
-
var _deleteRegistration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
129
|
+
var _deleteRegistration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(url, deviceId, deviceUrl) {
|
|
158
130
|
var _response;
|
|
159
131
|
var response;
|
|
160
|
-
return _regenerator.default.wrap(function
|
|
161
|
-
while (1) switch (
|
|
132
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
133
|
+
while (1) switch (_context.prev = _context.next) {
|
|
162
134
|
case 0:
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
135
|
+
_context.prev = 0;
|
|
136
|
+
_context.t0 = fetch;
|
|
137
|
+
_context.t1 = "".concat(url).concat(_constants2.DEVICES_ENDPOINT_RESOURCE, "/").concat(deviceId);
|
|
138
|
+
_context.t2 = _types2.HTTP_METHODS.DELETE;
|
|
139
|
+
_context.t3 = _defineProperty2.default;
|
|
140
|
+
_context.t4 = _defineProperty2.default;
|
|
141
|
+
_context.t5 = _defineProperty2.default;
|
|
142
|
+
_context.t6 = (0, _defineProperty2.default)({}, _constants2.CISCO_DEVICE_URL, deviceUrl);
|
|
143
|
+
_context.next = 10;
|
|
172
144
|
return this.webex.credentials.getUserToken();
|
|
173
145
|
case 10:
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
method:
|
|
183
|
-
headers:
|
|
146
|
+
_context.t7 = _context.sent;
|
|
147
|
+
_context.t8 = (0, _context.t5)(_context.t6, "Authorization", _context.t7);
|
|
148
|
+
_context.t9 = "".concat(_constants2.WEBEX_WEB_CLIENT, "_").concat((0, _uuid.v4)());
|
|
149
|
+
_context.t10 = (0, _context.t4)(_context.t8, "trackingId", _context.t9);
|
|
150
|
+
_context.t11 = _constants2.SPARK_USER_AGENT;
|
|
151
|
+
_context.t12 = _constants2.CALLING_USER_AGENT;
|
|
152
|
+
_context.t13 = (0, _context.t3)(_context.t10, _context.t11, _context.t12);
|
|
153
|
+
_context.t14 = {
|
|
154
|
+
method: _context.t2,
|
|
155
|
+
headers: _context.t13
|
|
184
156
|
};
|
|
185
|
-
|
|
186
|
-
return (0,
|
|
157
|
+
_context.next = 20;
|
|
158
|
+
return (0, _context.t0)(_context.t1, _context.t14);
|
|
187
159
|
case 20:
|
|
188
|
-
response =
|
|
189
|
-
|
|
160
|
+
response = _context.sent;
|
|
161
|
+
_context.next = 26;
|
|
190
162
|
break;
|
|
191
163
|
case 23:
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
_Logger.default.warn("Delete failed with Mobius ".concat(
|
|
164
|
+
_context.prev = 23;
|
|
165
|
+
_context.t15 = _context["catch"](0);
|
|
166
|
+
_Logger.default.warn("Delete failed with Mobius ".concat(_context.t15), {
|
|
195
167
|
file: _constants2.REGISTRATION_FILE,
|
|
196
168
|
method: _constants2.METHODS.DEREGISTER
|
|
197
169
|
});
|
|
198
170
|
case 26:
|
|
199
171
|
this.setStatus(_types2.RegistrationStatus.INACTIVE);
|
|
200
172
|
this.lineEmitter(_types3.LINE_EVENTS.UNREGISTERED);
|
|
201
|
-
return
|
|
173
|
+
return _context.abrupt("return", (_response = response) === null || _response === void 0 ? void 0 : _response.json());
|
|
202
174
|
case 29:
|
|
203
175
|
case "end":
|
|
204
|
-
return
|
|
176
|
+
return _context.stop();
|
|
205
177
|
}
|
|
206
|
-
},
|
|
178
|
+
}, _callee, this, [[0, 23]]);
|
|
207
179
|
}));
|
|
208
|
-
function deleteRegistration(_x2, _x3
|
|
180
|
+
function deleteRegistration(_x, _x2, _x3) {
|
|
209
181
|
return _deleteRegistration.apply(this, arguments);
|
|
210
182
|
}
|
|
211
183
|
return deleteRegistration;
|
|
@@ -218,10 +190,10 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
218
190
|
}, {
|
|
219
191
|
key: "postRegistration",
|
|
220
192
|
value: (function () {
|
|
221
|
-
var _postRegistration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
193
|
+
var _postRegistration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(url) {
|
|
222
194
|
var deviceInfo;
|
|
223
|
-
return _regenerator.default.wrap(function
|
|
224
|
-
while (1) switch (
|
|
195
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
196
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
225
197
|
case 0:
|
|
226
198
|
deviceInfo = {
|
|
227
199
|
userId: this.userId,
|
|
@@ -230,7 +202,7 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
230
202
|
jwe: this.jwe
|
|
231
203
|
}) : this.serviceData
|
|
232
204
|
};
|
|
233
|
-
return
|
|
205
|
+
return _context2.abrupt("return", this.webex.request({
|
|
234
206
|
uri: "".concat(url, "device"),
|
|
235
207
|
method: _types2.HTTP_METHODS.POST,
|
|
236
208
|
headers: (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _constants2.CISCO_DEVICE_URL, deviceInfo.clientDeviceUri), _constants2.SPARK_USER_AGENT, _constants2.CALLING_USER_AGENT),
|
|
@@ -239,11 +211,11 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
239
211
|
}));
|
|
240
212
|
case 2:
|
|
241
213
|
case "end":
|
|
242
|
-
return
|
|
214
|
+
return _context2.stop();
|
|
243
215
|
}
|
|
244
|
-
},
|
|
216
|
+
}, _callee2, this);
|
|
245
217
|
}));
|
|
246
|
-
function postRegistration(
|
|
218
|
+
function postRegistration(_x4) {
|
|
247
219
|
return _postRegistration.apply(this, arguments);
|
|
248
220
|
}
|
|
249
221
|
return postRegistration;
|
|
@@ -256,29 +228,29 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
256
228
|
}, {
|
|
257
229
|
key: "restorePreviousRegistration",
|
|
258
230
|
value: (function () {
|
|
259
|
-
var _restorePreviousRegistration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
231
|
+
var _restorePreviousRegistration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(caller) {
|
|
260
232
|
var abort;
|
|
261
|
-
return _regenerator.default.wrap(function
|
|
262
|
-
while (1) switch (
|
|
233
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
234
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
263
235
|
case 0:
|
|
264
236
|
abort = false;
|
|
265
237
|
if (!this.activeMobiusUrl) {
|
|
266
|
-
|
|
238
|
+
_context3.next = 5;
|
|
267
239
|
break;
|
|
268
240
|
}
|
|
269
|
-
|
|
241
|
+
_context3.next = 4;
|
|
270
242
|
return this.attemptRegistrationWithServers(caller, [this.activeMobiusUrl]);
|
|
271
243
|
case 4:
|
|
272
|
-
abort =
|
|
244
|
+
abort = _context3.sent;
|
|
273
245
|
case 5:
|
|
274
|
-
return
|
|
246
|
+
return _context3.abrupt("return", abort);
|
|
275
247
|
case 6:
|
|
276
248
|
case "end":
|
|
277
|
-
return
|
|
249
|
+
return _context3.stop();
|
|
278
250
|
}
|
|
279
|
-
},
|
|
251
|
+
}, _callee3, this);
|
|
280
252
|
}));
|
|
281
|
-
function restorePreviousRegistration(
|
|
253
|
+
function restorePreviousRegistration(_x5) {
|
|
282
254
|
return _restorePreviousRegistration.apply(this, arguments);
|
|
283
255
|
}
|
|
284
256
|
return restorePreviousRegistration;
|
|
@@ -290,20 +262,20 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
290
262
|
}, {
|
|
291
263
|
key: "handle429Retry",
|
|
292
264
|
value: (function () {
|
|
293
|
-
var _handle429Retry = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
265
|
+
var _handle429Retry = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(retryAfter, caller) {
|
|
294
266
|
var interval, abort;
|
|
295
|
-
return _regenerator.default.wrap(function
|
|
296
|
-
while (1) switch (
|
|
267
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
268
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
297
269
|
case 0:
|
|
298
270
|
if (!(caller === _constants2.FAILBACK_UTIL)) {
|
|
299
|
-
|
|
271
|
+
_context4.next = 17;
|
|
300
272
|
break;
|
|
301
273
|
}
|
|
302
274
|
if (!(this.failback429RetryAttempts >= _constants2.REG_FAILBACK_429_MAX_RETRIES)) {
|
|
303
|
-
|
|
275
|
+
_context4.next = 3;
|
|
304
276
|
break;
|
|
305
277
|
}
|
|
306
|
-
return
|
|
278
|
+
return _context4.abrupt("return");
|
|
307
279
|
case 3:
|
|
308
280
|
this.clearFailbackTimer();
|
|
309
281
|
this.failback429RetryAttempts += 1;
|
|
@@ -314,28 +286,28 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
314
286
|
interval = this.getRegRetryInterval(this.failback429RetryAttempts);
|
|
315
287
|
this.startFailbackTimer(interval);
|
|
316
288
|
this.scheduled429Retry = true;
|
|
317
|
-
|
|
289
|
+
_context4.next = 11;
|
|
318
290
|
return this.restorePreviousRegistration(_constants2.REG_429_RETRY_UTIL);
|
|
319
291
|
case 11:
|
|
320
|
-
abort =
|
|
292
|
+
abort = _context4.sent;
|
|
321
293
|
if (!(!abort && !this.isDeviceRegistered())) {
|
|
322
|
-
|
|
294
|
+
_context4.next = 15;
|
|
323
295
|
break;
|
|
324
296
|
}
|
|
325
|
-
|
|
297
|
+
_context4.next = 15;
|
|
326
298
|
return this.restartRegistration(_constants2.REG_429_RETRY_UTIL);
|
|
327
299
|
case 15:
|
|
328
|
-
|
|
300
|
+
_context4.next = 18;
|
|
329
301
|
break;
|
|
330
302
|
case 17:
|
|
331
303
|
this.retryAfter = retryAfter;
|
|
332
304
|
case 18:
|
|
333
305
|
case "end":
|
|
334
|
-
return
|
|
306
|
+
return _context4.stop();
|
|
335
307
|
}
|
|
336
|
-
},
|
|
308
|
+
}, _callee4, this);
|
|
337
309
|
}));
|
|
338
|
-
function handle429Retry(
|
|
310
|
+
function handle429Retry(_x6, _x7) {
|
|
339
311
|
return _handle429Retry.apply(this, arguments);
|
|
340
312
|
}
|
|
341
313
|
return handle429Retry;
|
|
@@ -364,7 +336,7 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
364
336
|
}, {
|
|
365
337
|
key: "startFailoverTimer",
|
|
366
338
|
value: (function () {
|
|
367
|
-
var _startFailoverTimer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
339
|
+
var _startFailoverTimer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
368
340
|
var _this = this;
|
|
369
341
|
var attempt,
|
|
370
342
|
timeElapsed,
|
|
@@ -374,12 +346,12 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
374
346
|
excessVal,
|
|
375
347
|
abort,
|
|
376
348
|
scheduledTime,
|
|
377
|
-
|
|
378
|
-
return _regenerator.default.wrap(function
|
|
379
|
-
while (1) switch (
|
|
349
|
+
_args9 = arguments;
|
|
350
|
+
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
351
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
380
352
|
case 0:
|
|
381
|
-
attempt =
|
|
382
|
-
timeElapsed =
|
|
353
|
+
attempt = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : 1;
|
|
354
|
+
timeElapsed = _args9.length > 1 && _args9[1] !== undefined ? _args9[1] : 0;
|
|
383
355
|
loggerContext = {
|
|
384
356
|
file: _constants2.REGISTRATION_FILE,
|
|
385
357
|
method: _constants2.FAILOVER_UTIL
|
|
@@ -394,83 +366,83 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
394
366
|
this.failoverImmediately = this.retryAfter + timeElapsed > TIMER_THRESHOLD;
|
|
395
367
|
}
|
|
396
368
|
if (!(interval > _constants2.BASE_REG_RETRY_TIMER_VAL_IN_SEC && !this.failoverImmediately)) {
|
|
397
|
-
|
|
369
|
+
_context9.next = 14;
|
|
398
370
|
break;
|
|
399
371
|
}
|
|
400
372
|
scheduledTime = Math.floor((0, _now.default)() / 1000);
|
|
401
373
|
if (this.retryAfter != null) {
|
|
402
374
|
interval = Math.max(interval, this.retryAfter);
|
|
403
375
|
}
|
|
404
|
-
setTimeout( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
405
|
-
return _regenerator.default.wrap(function
|
|
406
|
-
while (1) switch (
|
|
376
|
+
setTimeout( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
377
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
378
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
407
379
|
case 0:
|
|
408
|
-
|
|
409
|
-
return _this.mutex.runExclusive( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
380
|
+
_context6.next = 2;
|
|
381
|
+
return _this.mutex.runExclusive( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
410
382
|
var currentTime;
|
|
411
|
-
return _regenerator.default.wrap(function
|
|
412
|
-
while (1) switch (
|
|
383
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
384
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
413
385
|
case 0:
|
|
414
|
-
|
|
386
|
+
_context5.next = 2;
|
|
415
387
|
return _this.attemptRegistrationWithServers(_constants2.FAILOVER_UTIL);
|
|
416
388
|
case 2:
|
|
417
|
-
abort =
|
|
389
|
+
abort = _context5.sent;
|
|
418
390
|
currentTime = Math.floor((0, _now.default)() / 1000);
|
|
419
391
|
if (!(!abort && !_this.isDeviceRegistered())) {
|
|
420
|
-
|
|
392
|
+
_context5.next = 7;
|
|
421
393
|
break;
|
|
422
394
|
}
|
|
423
|
-
|
|
395
|
+
_context5.next = 7;
|
|
424
396
|
return _this.startFailoverTimer(attempt + 1, timeElapsed + (currentTime - scheduledTime));
|
|
425
397
|
case 7:
|
|
426
398
|
case "end":
|
|
427
|
-
return
|
|
399
|
+
return _context5.stop();
|
|
428
400
|
}
|
|
429
|
-
},
|
|
401
|
+
}, _callee5);
|
|
430
402
|
})));
|
|
431
403
|
case 2:
|
|
432
404
|
case "end":
|
|
433
|
-
return
|
|
405
|
+
return _context6.stop();
|
|
434
406
|
}
|
|
435
|
-
},
|
|
407
|
+
}, _callee6);
|
|
436
408
|
})), interval * _constants2.SEC_TO_MSEC_MFACTOR);
|
|
437
409
|
_Logger.default.log("Scheduled retry with primary in ".concat(interval, " seconds, number of attempts : ").concat(attempt), loggerContext);
|
|
438
|
-
|
|
410
|
+
_context9.next = 26;
|
|
439
411
|
break;
|
|
440
412
|
case 14:
|
|
441
413
|
if (!this.backupMobiusUris.length) {
|
|
442
|
-
|
|
414
|
+
_context9.next = 23;
|
|
443
415
|
break;
|
|
444
416
|
}
|
|
445
417
|
_Logger.default.info('Failing over to backup servers.', loggerContext);
|
|
446
418
|
this.failoverImmediately = false;
|
|
447
|
-
|
|
419
|
+
_context9.next = 19;
|
|
448
420
|
return this.attemptRegistrationWithServers(_constants2.FAILOVER_UTIL, this.backupMobiusUris);
|
|
449
421
|
case 19:
|
|
450
|
-
abort =
|
|
422
|
+
abort = _context9.sent;
|
|
451
423
|
if (!abort && !this.isDeviceRegistered()) {
|
|
452
424
|
interval = this.getRegRetryInterval();
|
|
453
425
|
if (this.retryAfter != null && this.retryAfter < _constants2.RETRY_TIMER_UPPER_LIMIT) {
|
|
454
426
|
interval = interval < this.retryAfter ? this.retryAfter : interval;
|
|
455
427
|
}
|
|
456
|
-
setTimeout( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
457
|
-
return _regenerator.default.wrap(function
|
|
458
|
-
while (1) switch (
|
|
428
|
+
setTimeout( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
429
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
430
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
459
431
|
case 0:
|
|
460
|
-
|
|
461
|
-
return _this.mutex.runExclusive( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
462
|
-
return _regenerator.default.wrap(function
|
|
463
|
-
while (1) switch (
|
|
432
|
+
_context8.next = 2;
|
|
433
|
+
return _this.mutex.runExclusive( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
434
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
435
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
464
436
|
case 0:
|
|
465
|
-
|
|
437
|
+
_context7.next = 2;
|
|
466
438
|
return _this.attemptRegistrationWithServers(_constants2.FAILOVER_UTIL, _this.backupMobiusUris);
|
|
467
439
|
case 2:
|
|
468
|
-
abort =
|
|
440
|
+
abort = _context7.sent;
|
|
469
441
|
if (!(!abort && !_this.isDeviceRegistered())) {
|
|
470
|
-
|
|
442
|
+
_context7.next = 7;
|
|
471
443
|
break;
|
|
472
444
|
}
|
|
473
|
-
|
|
445
|
+
_context7.next = 6;
|
|
474
446
|
return (0, _common.uploadLogs)();
|
|
475
447
|
case 6:
|
|
476
448
|
(0, _common.emitFinalFailure)(function (clientError) {
|
|
@@ -478,22 +450,22 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
478
450
|
}, loggerContext);
|
|
479
451
|
case 7:
|
|
480
452
|
case "end":
|
|
481
|
-
return
|
|
453
|
+
return _context7.stop();
|
|
482
454
|
}
|
|
483
|
-
},
|
|
455
|
+
}, _callee7);
|
|
484
456
|
})));
|
|
485
457
|
case 2:
|
|
486
458
|
case "end":
|
|
487
|
-
return
|
|
459
|
+
return _context8.stop();
|
|
488
460
|
}
|
|
489
|
-
},
|
|
461
|
+
}, _callee8);
|
|
490
462
|
})), interval * _constants2.SEC_TO_MSEC_MFACTOR);
|
|
491
463
|
_Logger.default.log("Scheduled retry with backup servers in ".concat(interval, " seconds."), loggerContext);
|
|
492
464
|
}
|
|
493
|
-
|
|
465
|
+
_context9.next = 26;
|
|
494
466
|
break;
|
|
495
467
|
case 23:
|
|
496
|
-
|
|
468
|
+
_context9.next = 25;
|
|
497
469
|
return (0, _common.uploadLogs)();
|
|
498
470
|
case 25:
|
|
499
471
|
(0, _common.emitFinalFailure)(function (clientError) {
|
|
@@ -501,9 +473,9 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
501
473
|
}, loggerContext);
|
|
502
474
|
case 26:
|
|
503
475
|
case "end":
|
|
504
|
-
return
|
|
476
|
+
return _context9.stop();
|
|
505
477
|
}
|
|
506
|
-
},
|
|
478
|
+
}, _callee9, this);
|
|
507
479
|
}));
|
|
508
480
|
function startFailoverTimer() {
|
|
509
481
|
return _startFailoverTimer.apply(this, arguments);
|
|
@@ -569,16 +541,16 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
569
541
|
key: "startFailbackTimer",
|
|
570
542
|
value: function startFailbackTimer(intervalInSeconds) {
|
|
571
543
|
var _this2 = this;
|
|
572
|
-
this.failbackTimer = setTimeout( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
573
|
-
return _regenerator.default.wrap(function
|
|
574
|
-
while (1) switch (
|
|
544
|
+
this.failbackTimer = setTimeout( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
545
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
546
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
575
547
|
case 0:
|
|
576
|
-
return
|
|
548
|
+
return _context10.abrupt("return", _this2.executeFailback());
|
|
577
549
|
case 1:
|
|
578
550
|
case "end":
|
|
579
|
-
return
|
|
551
|
+
return _context10.stop();
|
|
580
552
|
}
|
|
581
|
-
},
|
|
553
|
+
}, _callee10);
|
|
582
554
|
})), intervalInSeconds * _constants2.SEC_TO_MSEC_MFACTOR);
|
|
583
555
|
_Logger.default.log("Failback scheduled after ".concat(intervalInSeconds, " seconds."), {
|
|
584
556
|
file: _constants2.REGISTRATION_FILE,
|
|
@@ -593,67 +565,67 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
593
565
|
}, {
|
|
594
566
|
key: "executeFailback",
|
|
595
567
|
value: (function () {
|
|
596
|
-
var _executeFailback = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
568
|
+
var _executeFailback = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
597
569
|
var _this3 = this;
|
|
598
|
-
return _regenerator.default.wrap(function
|
|
599
|
-
while (1) switch (
|
|
570
|
+
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
571
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
600
572
|
case 0:
|
|
601
|
-
|
|
602
|
-
return this.mutex.runExclusive( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
573
|
+
_context12.next = 2;
|
|
574
|
+
return this.mutex.runExclusive( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
603
575
|
var abort, abortNew;
|
|
604
|
-
return _regenerator.default.wrap(function
|
|
605
|
-
while (1) switch (
|
|
576
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
577
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
606
578
|
case 0:
|
|
607
579
|
if (!_this3.isFailbackRequired()) {
|
|
608
|
-
|
|
580
|
+
_context11.next = 28;
|
|
609
581
|
break;
|
|
610
582
|
}
|
|
611
583
|
if (!((0, _keys.default)(_this3.callManager.getActiveCalls()).length === 0)) {
|
|
612
|
-
|
|
584
|
+
_context11.next = 25;
|
|
613
585
|
break;
|
|
614
586
|
}
|
|
615
587
|
_Logger.default.info("Attempting failback to primary.", {
|
|
616
588
|
file: _constants2.REGISTRATION_FILE,
|
|
617
589
|
method: _this3.executeFailback.name
|
|
618
590
|
});
|
|
619
|
-
|
|
591
|
+
_context11.next = 5;
|
|
620
592
|
return _this3.deregister();
|
|
621
593
|
case 5:
|
|
622
|
-
|
|
594
|
+
_context11.next = 7;
|
|
623
595
|
return _this3.attemptRegistrationWithServers(_constants2.FAILBACK_UTIL);
|
|
624
596
|
case 7:
|
|
625
|
-
abort =
|
|
597
|
+
abort = _context11.sent;
|
|
626
598
|
if (!(_this3.scheduled429Retry || abort || _this3.isDeviceRegistered())) {
|
|
627
|
-
|
|
599
|
+
_context11.next = 10;
|
|
628
600
|
break;
|
|
629
601
|
}
|
|
630
|
-
return
|
|
602
|
+
return _context11.abrupt("return");
|
|
631
603
|
case 10:
|
|
632
|
-
|
|
604
|
+
_context11.next = 12;
|
|
633
605
|
return _this3.restorePreviousRegistration(_constants2.FAILBACK_UTIL);
|
|
634
606
|
case 12:
|
|
635
|
-
abortNew =
|
|
607
|
+
abortNew = _context11.sent;
|
|
636
608
|
if (!abortNew) {
|
|
637
|
-
|
|
609
|
+
_context11.next = 16;
|
|
638
610
|
break;
|
|
639
611
|
}
|
|
640
612
|
_this3.clearFailbackTimer();
|
|
641
|
-
return
|
|
613
|
+
return _context11.abrupt("return");
|
|
642
614
|
case 16:
|
|
643
615
|
if (_this3.isDeviceRegistered()) {
|
|
644
|
-
|
|
616
|
+
_context11.next = 21;
|
|
645
617
|
break;
|
|
646
618
|
}
|
|
647
|
-
|
|
619
|
+
_context11.next = 19;
|
|
648
620
|
return _this3.restartRegistration(_this3.executeFailback.name);
|
|
649
621
|
case 19:
|
|
650
|
-
|
|
622
|
+
_context11.next = 23;
|
|
651
623
|
break;
|
|
652
624
|
case 21:
|
|
653
625
|
_this3.failbackTimer = undefined;
|
|
654
626
|
_this3.initiateFailback();
|
|
655
627
|
case 23:
|
|
656
|
-
|
|
628
|
+
_context11.next = 28;
|
|
657
629
|
break;
|
|
658
630
|
case 25:
|
|
659
631
|
_Logger.default.info('Active calls present, deferring failback to next cycle.', {
|
|
@@ -664,15 +636,15 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
664
636
|
_this3.initiateFailback();
|
|
665
637
|
case 28:
|
|
666
638
|
case "end":
|
|
667
|
-
return
|
|
639
|
+
return _context11.stop();
|
|
668
640
|
}
|
|
669
|
-
},
|
|
641
|
+
}, _callee11);
|
|
670
642
|
})));
|
|
671
643
|
case 2:
|
|
672
644
|
case "end":
|
|
673
|
-
return
|
|
645
|
+
return _context12.stop();
|
|
674
646
|
}
|
|
675
|
-
},
|
|
647
|
+
}, _callee12, this);
|
|
676
648
|
}));
|
|
677
649
|
function executeFailback() {
|
|
678
650
|
return _executeFailback.apply(this, arguments);
|
|
@@ -735,10 +707,10 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
735
707
|
}, {
|
|
736
708
|
key: "restartRegistration",
|
|
737
709
|
value: (function () {
|
|
738
|
-
var _restartRegistration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
710
|
+
var _restartRegistration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(caller) {
|
|
739
711
|
var abort;
|
|
740
|
-
return _regenerator.default.wrap(function
|
|
741
|
-
while (1) switch (
|
|
712
|
+
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
713
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
742
714
|
case 0:
|
|
743
715
|
/*
|
|
744
716
|
* Cancel any failback timer running
|
|
@@ -746,23 +718,23 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
746
718
|
*/
|
|
747
719
|
this.clearFailbackTimer();
|
|
748
720
|
this.failback429RetryAttempts = 0;
|
|
749
|
-
|
|
721
|
+
_context13.next = 4;
|
|
750
722
|
return this.attemptRegistrationWithServers(caller, this.primaryMobiusUris);
|
|
751
723
|
case 4:
|
|
752
|
-
abort =
|
|
724
|
+
abort = _context13.sent;
|
|
753
725
|
if (!(!abort && !this.isDeviceRegistered())) {
|
|
754
|
-
|
|
726
|
+
_context13.next = 8;
|
|
755
727
|
break;
|
|
756
728
|
}
|
|
757
|
-
|
|
729
|
+
_context13.next = 8;
|
|
758
730
|
return this.startFailoverTimer();
|
|
759
731
|
case 8:
|
|
760
732
|
case "end":
|
|
761
|
-
return
|
|
733
|
+
return _context13.stop();
|
|
762
734
|
}
|
|
763
|
-
},
|
|
735
|
+
}, _callee13, this);
|
|
764
736
|
}));
|
|
765
|
-
function restartRegistration(
|
|
737
|
+
function restartRegistration(_x8) {
|
|
766
738
|
return _restartRegistration.apply(this, arguments);
|
|
767
739
|
}
|
|
768
740
|
return restartRegistration;
|
|
@@ -776,23 +748,23 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
776
748
|
}, {
|
|
777
749
|
key: "handleConnectionRestoration",
|
|
778
750
|
value: (function () {
|
|
779
|
-
var _handleConnectionRestoration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
751
|
+
var _handleConnectionRestoration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(retry) {
|
|
780
752
|
var _this4 = this;
|
|
781
|
-
return _regenerator.default.wrap(function
|
|
782
|
-
while (1) switch (
|
|
753
|
+
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
754
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
783
755
|
case 0:
|
|
784
756
|
_Logger.default.info(_constants.METHOD_START_MESSAGE, {
|
|
785
757
|
method: _constants2.METHODS.HANDLE_CONNECTION_RESTORATION,
|
|
786
758
|
file: _constants2.REGISTRATION_FILE
|
|
787
759
|
});
|
|
788
|
-
|
|
789
|
-
return this.mutex.runExclusive( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
760
|
+
_context15.next = 3;
|
|
761
|
+
return this.mutex.runExclusive( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
|
|
790
762
|
var abort;
|
|
791
|
-
return _regenerator.default.wrap(function
|
|
792
|
-
while (1) switch (
|
|
763
|
+
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
764
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
793
765
|
case 0:
|
|
794
766
|
if (!retry) {
|
|
795
|
-
|
|
767
|
+
_context14.next = 14;
|
|
796
768
|
break;
|
|
797
769
|
}
|
|
798
770
|
_Logger.default.log('Mercury connection is up again, re-registering with Webex Calling if needed', {
|
|
@@ -801,43 +773,43 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
801
773
|
});
|
|
802
774
|
_this4.clearKeepaliveTimer();
|
|
803
775
|
if (!_this4.isDeviceRegistered()) {
|
|
804
|
-
|
|
776
|
+
_context14.next = 6;
|
|
805
777
|
break;
|
|
806
778
|
}
|
|
807
|
-
|
|
779
|
+
_context14.next = 6;
|
|
808
780
|
return _this4.deregister();
|
|
809
781
|
case 6:
|
|
810
782
|
if (!_this4.activeMobiusUrl) {
|
|
811
|
-
|
|
783
|
+
_context14.next = 13;
|
|
812
784
|
break;
|
|
813
785
|
}
|
|
814
|
-
|
|
786
|
+
_context14.next = 9;
|
|
815
787
|
return _this4.restorePreviousRegistration(_this4.handleConnectionRestoration.name);
|
|
816
788
|
case 9:
|
|
817
|
-
abort =
|
|
789
|
+
abort = _context14.sent;
|
|
818
790
|
if (!(!abort && !_this4.isDeviceRegistered())) {
|
|
819
|
-
|
|
791
|
+
_context14.next = 13;
|
|
820
792
|
break;
|
|
821
793
|
}
|
|
822
|
-
|
|
794
|
+
_context14.next = 13;
|
|
823
795
|
return _this4.restartRegistration(_this4.handleConnectionRestoration.name);
|
|
824
796
|
case 13:
|
|
825
797
|
retry = false;
|
|
826
798
|
case 14:
|
|
827
799
|
case "end":
|
|
828
|
-
return
|
|
800
|
+
return _context14.stop();
|
|
829
801
|
}
|
|
830
|
-
},
|
|
802
|
+
}, _callee14);
|
|
831
803
|
})));
|
|
832
804
|
case 3:
|
|
833
|
-
return
|
|
805
|
+
return _context15.abrupt("return", retry);
|
|
834
806
|
case 4:
|
|
835
807
|
case "end":
|
|
836
|
-
return
|
|
808
|
+
return _context15.stop();
|
|
837
809
|
}
|
|
838
|
-
},
|
|
810
|
+
}, _callee15, this);
|
|
839
811
|
}));
|
|
840
|
-
function handleConnectionRestoration(
|
|
812
|
+
function handleConnectionRestoration(_x9) {
|
|
841
813
|
return _handleConnectionRestoration.apply(this, arguments);
|
|
842
814
|
}
|
|
843
815
|
return handleConnectionRestoration;
|
|
@@ -853,53 +825,53 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
853
825
|
value: function restoreRegistrationCallBack() {
|
|
854
826
|
var _this5 = this;
|
|
855
827
|
return /*#__PURE__*/function () {
|
|
856
|
-
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
828
|
+
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16(restoreData, caller) {
|
|
857
829
|
var logContext, restore, finalError;
|
|
858
|
-
return _regenerator.default.wrap(function
|
|
859
|
-
while (1) switch (
|
|
830
|
+
return _regenerator.default.wrap(function _callee16$(_context16) {
|
|
831
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
860
832
|
case 0:
|
|
861
833
|
logContext = {
|
|
862
834
|
file: _constants2.REGISTRATION_FILE,
|
|
863
835
|
method: caller
|
|
864
836
|
};
|
|
865
837
|
if (_this5.isRegRetry()) {
|
|
866
|
-
|
|
838
|
+
_context16.next = 17;
|
|
867
839
|
break;
|
|
868
840
|
}
|
|
869
841
|
_Logger.default.info('Registration restoration in progress.', logContext);
|
|
870
842
|
restore = _this5.getExistingDevice(restoreData);
|
|
871
843
|
if (!restore) {
|
|
872
|
-
|
|
844
|
+
_context16.next = 14;
|
|
873
845
|
break;
|
|
874
846
|
}
|
|
875
847
|
_this5.setRegRetry(true);
|
|
876
|
-
|
|
848
|
+
_context16.next = 8;
|
|
877
849
|
return _this5.deregister();
|
|
878
850
|
case 8:
|
|
879
|
-
|
|
851
|
+
_context16.next = 10;
|
|
880
852
|
return _this5.restorePreviousRegistration(caller);
|
|
881
853
|
case 10:
|
|
882
|
-
finalError =
|
|
854
|
+
finalError = _context16.sent;
|
|
883
855
|
_this5.setRegRetry(false);
|
|
884
856
|
if (_this5.isDeviceRegistered()) {
|
|
885
857
|
_Logger.default.info('Registration restored successfully.', logContext);
|
|
886
858
|
}
|
|
887
|
-
return
|
|
859
|
+
return _context16.abrupt("return", finalError);
|
|
888
860
|
case 14:
|
|
889
861
|
_this5.lineEmitter(_types3.LINE_EVENTS.UNREGISTERED);
|
|
890
|
-
|
|
862
|
+
_context16.next = 18;
|
|
891
863
|
break;
|
|
892
864
|
case 17:
|
|
893
865
|
_this5.lineEmitter(_types3.LINE_EVENTS.UNREGISTERED);
|
|
894
866
|
case 18:
|
|
895
|
-
return
|
|
867
|
+
return _context16.abrupt("return", false);
|
|
896
868
|
case 19:
|
|
897
869
|
case "end":
|
|
898
|
-
return
|
|
870
|
+
return _context16.stop();
|
|
899
871
|
}
|
|
900
|
-
},
|
|
872
|
+
}, _callee16);
|
|
901
873
|
}));
|
|
902
|
-
return function (
|
|
874
|
+
return function (_x10, _x11) {
|
|
903
875
|
return _ref8.apply(this, arguments);
|
|
904
876
|
};
|
|
905
877
|
}();
|
|
@@ -912,30 +884,30 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
912
884
|
}, {
|
|
913
885
|
key: "triggerRegistration",
|
|
914
886
|
value: (function () {
|
|
915
|
-
var _triggerRegistration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
887
|
+
var _triggerRegistration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17() {
|
|
916
888
|
var abort;
|
|
917
|
-
return _regenerator.default.wrap(function
|
|
918
|
-
while (1) switch (
|
|
889
|
+
return _regenerator.default.wrap(function _callee17$(_context17) {
|
|
890
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
919
891
|
case 0:
|
|
920
892
|
if (!(this.primaryMobiusUris.length > 0)) {
|
|
921
|
-
|
|
893
|
+
_context17.next = 7;
|
|
922
894
|
break;
|
|
923
895
|
}
|
|
924
|
-
|
|
896
|
+
_context17.next = 3;
|
|
925
897
|
return this.attemptRegistrationWithServers(_constants2.REGISTRATION_UTIL, this.primaryMobiusUris);
|
|
926
898
|
case 3:
|
|
927
|
-
abort =
|
|
899
|
+
abort = _context17.sent;
|
|
928
900
|
if (!(!this.isDeviceRegistered() && !abort)) {
|
|
929
|
-
|
|
901
|
+
_context17.next = 7;
|
|
930
902
|
break;
|
|
931
903
|
}
|
|
932
|
-
|
|
904
|
+
_context17.next = 7;
|
|
933
905
|
return this.startFailoverTimer();
|
|
934
906
|
case 7:
|
|
935
907
|
case "end":
|
|
936
|
-
return
|
|
908
|
+
return _context17.stop();
|
|
937
909
|
}
|
|
938
|
-
},
|
|
910
|
+
}, _callee17, this);
|
|
939
911
|
}));
|
|
940
912
|
function triggerRegistration() {
|
|
941
913
|
return _triggerRegistration.apply(this, arguments);
|
|
@@ -954,7 +926,7 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
954
926
|
}, {
|
|
955
927
|
key: "attemptRegistrationWithServers",
|
|
956
928
|
value: (function () {
|
|
957
|
-
var _attemptRegistrationWithServers = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
929
|
+
var _attemptRegistrationWithServers = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(caller) {
|
|
958
930
|
var _this6 = this;
|
|
959
931
|
var servers,
|
|
960
932
|
abort,
|
|
@@ -962,40 +934,40 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
962
934
|
_step,
|
|
963
935
|
_loop,
|
|
964
936
|
_ret,
|
|
965
|
-
|
|
966
|
-
return _regenerator.default.wrap(function
|
|
967
|
-
while (1) switch (
|
|
937
|
+
_args19 = arguments;
|
|
938
|
+
return _regenerator.default.wrap(function _callee18$(_context19) {
|
|
939
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
968
940
|
case 0:
|
|
969
|
-
servers =
|
|
941
|
+
servers = _args19.length > 1 && _args19[1] !== undefined ? _args19[1] : this.primaryMobiusUris;
|
|
970
942
|
abort = false;
|
|
971
943
|
this.retryAfter = undefined;
|
|
972
944
|
if (!this.failoverImmediately) {
|
|
973
|
-
|
|
945
|
+
_context19.next = 5;
|
|
974
946
|
break;
|
|
975
947
|
}
|
|
976
|
-
return
|
|
948
|
+
return _context19.abrupt("return", abort);
|
|
977
949
|
case 5:
|
|
978
950
|
if (!this.isDeviceRegistered()) {
|
|
979
|
-
|
|
951
|
+
_context19.next = 8;
|
|
980
952
|
break;
|
|
981
953
|
}
|
|
982
954
|
_Logger.default.info("[".concat(caller, "] : Device already registered with : ").concat(this.activeMobiusUrl), {
|
|
983
955
|
file: _constants2.REGISTRATION_FILE,
|
|
984
956
|
method: _constants2.REGISTER_UTIL
|
|
985
957
|
});
|
|
986
|
-
return
|
|
958
|
+
return _context19.abrupt("return", abort);
|
|
987
959
|
case 8:
|
|
988
960
|
_iterator = _createForOfIteratorHelper(servers);
|
|
989
|
-
|
|
961
|
+
_context19.prev = 9;
|
|
990
962
|
_loop = /*#__PURE__*/_regenerator.default.mark(function _loop() {
|
|
991
963
|
var _this6$backupMobiusUr;
|
|
992
964
|
var url, serverType, _this6$deviceInfo$dev, _resp$headers$trackin, _resp$headers, _this6$deviceInfo$dev2, resp, body;
|
|
993
|
-
return _regenerator.default.wrap(function _loop$(
|
|
994
|
-
while (1) switch (
|
|
965
|
+
return _regenerator.default.wrap(function _loop$(_context18) {
|
|
966
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
995
967
|
case 0:
|
|
996
968
|
url = _step.value;
|
|
997
969
|
serverType = _this6.primaryMobiusUris.includes(url) && 'PRIMARY' || ((_this6$backupMobiusUr = _this6.backupMobiusUris) === null || _this6$backupMobiusUr === void 0 ? void 0 : _this6$backupMobiusUr.includes(url)) && 'BACKUP' || 'UNKNOWN';
|
|
998
|
-
|
|
970
|
+
_context18.prev = 2;
|
|
999
971
|
abort = false;
|
|
1000
972
|
_this6.registrationStatus = _types2.RegistrationStatus.INACTIVE;
|
|
1001
973
|
_this6.lineEmitter(_types3.LINE_EVENTS.CONNECTING);
|
|
@@ -1004,10 +976,10 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
1004
976
|
method: _constants2.REGISTER_UTIL
|
|
1005
977
|
});
|
|
1006
978
|
// eslint-disable-next-line no-await-in-loop
|
|
1007
|
-
|
|
979
|
+
_context18.next = 9;
|
|
1008
980
|
return _this6.postRegistration(url);
|
|
1009
981
|
case 9:
|
|
1010
|
-
resp =
|
|
982
|
+
resp = _context18.sent;
|
|
1011
983
|
_this6.deviceInfo = resp.body;
|
|
1012
984
|
_this6.registrationStatus = _types2.RegistrationStatus.ACTIVE;
|
|
1013
985
|
_this6.lineEmitter(_types3.LINE_EVENTS.REGISTERED, resp.body);
|
|
@@ -1021,12 +993,12 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
1021
993
|
_this6.metricManager.submitRegistrationMetric(_types.METRIC_EVENT.REGISTRATION, _types.REG_ACTION.REGISTER, _types.METRIC_TYPE.BEHAVIORAL, caller, serverType, (_resp$headers$trackin = (_resp$headers = resp.headers) === null || _resp$headers === void 0 ? void 0 : _resp$headers.trackingid) !== null && _resp$headers$trackin !== void 0 ? _resp$headers$trackin : '', undefined, undefined);
|
|
1022
994
|
_this6.startKeepaliveTimer((_this6$deviceInfo$dev2 = _this6.deviceInfo.device) === null || _this6$deviceInfo$dev2 === void 0 ? void 0 : _this6$deviceInfo$dev2.uri, _this6.deviceInfo.keepaliveInterval, serverType);
|
|
1023
995
|
_this6.initiateFailback();
|
|
1024
|
-
return
|
|
996
|
+
return _context18.abrupt("return", 0);
|
|
1025
997
|
case 23:
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
body =
|
|
1029
|
-
|
|
998
|
+
_context18.prev = 23;
|
|
999
|
+
_context18.t0 = _context18["catch"](2);
|
|
1000
|
+
body = _context18.t0; // eslint-disable-next-line no-await-in-loop, @typescript-eslint/no-unused-vars
|
|
1001
|
+
_context18.next = 28;
|
|
1030
1002
|
return (0, _common.handleRegistrationErrors)(body, function (clientError, finalError) {
|
|
1031
1003
|
var _body$headers$trackin, _body$headers;
|
|
1032
1004
|
if (finalError) {
|
|
@@ -1042,66 +1014,66 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
1042
1014
|
return _this6.handle429Retry(retryAfter, retryCaller);
|
|
1043
1015
|
}, _this6.restoreRegistrationCallBack());
|
|
1044
1016
|
case 28:
|
|
1045
|
-
abort =
|
|
1017
|
+
abort = _context18.sent;
|
|
1046
1018
|
if (!(_this6.registrationStatus === _types2.RegistrationStatus.ACTIVE)) {
|
|
1047
|
-
|
|
1019
|
+
_context18.next = 32;
|
|
1048
1020
|
break;
|
|
1049
1021
|
}
|
|
1050
1022
|
_Logger.default.info("[".concat(caller, "] : Device is already restored, active mobius url: ").concat(_this6.activeMobiusUrl), {
|
|
1051
1023
|
file: _constants2.REGISTRATION_FILE,
|
|
1052
1024
|
method: _this6.attemptRegistrationWithServers.name
|
|
1053
1025
|
});
|
|
1054
|
-
return
|
|
1026
|
+
return _context18.abrupt("return", 0);
|
|
1055
1027
|
case 32:
|
|
1056
1028
|
if (!abort) {
|
|
1057
|
-
|
|
1029
|
+
_context18.next = 35;
|
|
1058
1030
|
break;
|
|
1059
1031
|
}
|
|
1060
1032
|
_this6.setStatus(_types2.RegistrationStatus.INACTIVE);
|
|
1061
|
-
return
|
|
1033
|
+
return _context18.abrupt("return", 0);
|
|
1062
1034
|
case 35:
|
|
1063
1035
|
case "end":
|
|
1064
|
-
return
|
|
1036
|
+
return _context18.stop();
|
|
1065
1037
|
}
|
|
1066
1038
|
}, _loop, null, [[2, 23]]);
|
|
1067
1039
|
});
|
|
1068
1040
|
_iterator.s();
|
|
1069
1041
|
case 12:
|
|
1070
1042
|
if ((_step = _iterator.n()).done) {
|
|
1071
|
-
|
|
1043
|
+
_context19.next = 19;
|
|
1072
1044
|
break;
|
|
1073
1045
|
}
|
|
1074
|
-
return
|
|
1046
|
+
return _context19.delegateYield(_loop(), "t0", 14);
|
|
1075
1047
|
case 14:
|
|
1076
|
-
_ret =
|
|
1048
|
+
_ret = _context19.t0;
|
|
1077
1049
|
if (!(_ret === 0)) {
|
|
1078
|
-
|
|
1050
|
+
_context19.next = 17;
|
|
1079
1051
|
break;
|
|
1080
1052
|
}
|
|
1081
|
-
return
|
|
1053
|
+
return _context19.abrupt("break", 19);
|
|
1082
1054
|
case 17:
|
|
1083
|
-
|
|
1055
|
+
_context19.next = 12;
|
|
1084
1056
|
break;
|
|
1085
1057
|
case 19:
|
|
1086
|
-
|
|
1058
|
+
_context19.next = 24;
|
|
1087
1059
|
break;
|
|
1088
1060
|
case 21:
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
_iterator.e(
|
|
1061
|
+
_context19.prev = 21;
|
|
1062
|
+
_context19.t1 = _context19["catch"](9);
|
|
1063
|
+
_iterator.e(_context19.t1);
|
|
1092
1064
|
case 24:
|
|
1093
|
-
|
|
1065
|
+
_context19.prev = 24;
|
|
1094
1066
|
_iterator.f();
|
|
1095
|
-
return
|
|
1067
|
+
return _context19.finish(24);
|
|
1096
1068
|
case 27:
|
|
1097
|
-
return
|
|
1069
|
+
return _context19.abrupt("return", abort);
|
|
1098
1070
|
case 28:
|
|
1099
1071
|
case "end":
|
|
1100
|
-
return
|
|
1072
|
+
return _context19.stop();
|
|
1101
1073
|
}
|
|
1102
|
-
},
|
|
1074
|
+
}, _callee18, this, [[9, 21, 24, 27]]);
|
|
1103
1075
|
}));
|
|
1104
|
-
function attemptRegistrationWithServers(
|
|
1076
|
+
function attemptRegistrationWithServers(_x12) {
|
|
1105
1077
|
return _attemptRegistrationWithServers.apply(this, arguments);
|
|
1106
1078
|
}
|
|
1107
1079
|
return attemptRegistrationWithServers;
|
|
@@ -1113,104 +1085,138 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
1113
1085
|
)
|
|
1114
1086
|
}, {
|
|
1115
1087
|
key: "startKeepaliveTimer",
|
|
1116
|
-
value: function
|
|
1117
|
-
var
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
var RETRY_COUNT_THRESHOLD = this.isCCFlow ? 4 : 5;
|
|
1121
|
-
this.keepaliveTimer = setInterval( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21() {
|
|
1122
|
-
var logContext;
|
|
1088
|
+
value: (function () {
|
|
1089
|
+
var _startKeepaliveTimer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21(url, interval, serverType) {
|
|
1090
|
+
var _this7 = this;
|
|
1091
|
+
var RETRY_COUNT_THRESHOLD;
|
|
1123
1092
|
return _regenerator.default.wrap(function _callee21$(_context22) {
|
|
1124
1093
|
while (1) switch (_context22.prev = _context22.next) {
|
|
1125
1094
|
case 0:
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
return _this7.mutex.runExclusive( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20() {
|
|
1132
|
-
var res, error, abort;
|
|
1095
|
+
this.clearKeepaliveTimer();
|
|
1096
|
+
RETRY_COUNT_THRESHOLD = this.isCCFlow ? 4 : 5;
|
|
1097
|
+
_context22.next = 4;
|
|
1098
|
+
return this.mutex.runExclusive( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20() {
|
|
1099
|
+
var accessToken, blob, blobUrl;
|
|
1133
1100
|
return _regenerator.default.wrap(function _callee20$(_context21) {
|
|
1134
1101
|
while (1) switch (_context21.prev = _context21.next) {
|
|
1135
1102
|
case 0:
|
|
1136
|
-
if (!
|
|
1137
|
-
_context21.next =
|
|
1103
|
+
if (!_this7.isDeviceRegistered()) {
|
|
1104
|
+
_context21.next = 5;
|
|
1138
1105
|
break;
|
|
1139
1106
|
}
|
|
1140
|
-
_context21.
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1107
|
+
_context21.next = 3;
|
|
1108
|
+
return _this7.webex.credentials.getUserToken();
|
|
1109
|
+
case 3:
|
|
1110
|
+
accessToken = _context21.sent;
|
|
1111
|
+
if (!_this7.webWorker) {
|
|
1112
|
+
blob = new Blob([_webWorkerStr.default], {
|
|
1113
|
+
type: 'application/javascript'
|
|
1114
|
+
});
|
|
1115
|
+
blobUrl = URL.createObjectURL(blob);
|
|
1116
|
+
_this7.webWorker = new Worker(blobUrl);
|
|
1117
|
+
URL.revokeObjectURL(blobUrl);
|
|
1118
|
+
_this7.webWorker.postMessage({
|
|
1119
|
+
type: _types2.WorkerMessageType.START_KEEPALIVE,
|
|
1120
|
+
accessToken: String(accessToken),
|
|
1121
|
+
deviceUrl: String(_this7.webex.internal.device.url),
|
|
1122
|
+
interval: interval,
|
|
1123
|
+
retryCountThreshold: RETRY_COUNT_THRESHOLD,
|
|
1124
|
+
url: url
|
|
1125
|
+
});
|
|
1126
|
+
_this7.webWorker.onmessage = /*#__PURE__*/function () {
|
|
1127
|
+
var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(event) {
|
|
1128
|
+
var logContext, error, abort;
|
|
1129
|
+
return _regenerator.default.wrap(function _callee19$(_context20) {
|
|
1130
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1131
|
+
case 0:
|
|
1132
|
+
logContext = {
|
|
1133
|
+
file: _constants2.REGISTRATION_FILE,
|
|
1134
|
+
method: _this7.startKeepaliveTimer.name
|
|
1135
|
+
};
|
|
1136
|
+
if (event.data.type === _types2.WorkerMessageType.KEEPALIVE_SUCCESS) {
|
|
1137
|
+
_Logger.default.info("Sent Keepalive, status: ".concat(event.data.statusCode), logContext);
|
|
1138
|
+
_this7.lineEmitter(_types3.LINE_EVENTS.RECONNECTED);
|
|
1139
|
+
}
|
|
1140
|
+
if (!(event.data.type === _types2.WorkerMessageType.KEEPALIVE_FAILURE)) {
|
|
1141
|
+
_context20.next = 20;
|
|
1142
|
+
break;
|
|
1143
|
+
}
|
|
1144
|
+
error = event.data.err;
|
|
1145
|
+
_Logger.default.warn("Keep-alive missed ".concat(event.data.keepAliveRetryCount, " times. Status -> ").concat(error.statusCode, " "), logContext);
|
|
1146
|
+
_context20.next = 7;
|
|
1147
|
+
return (0, _common.handleRegistrationErrors)(error, function (clientError, finalError) {
|
|
1148
|
+
var _error$headers$tracki, _error$headers;
|
|
1149
|
+
if (finalError) {
|
|
1150
|
+
_this7.lineEmitter(_types3.LINE_EVENTS.ERROR, undefined, clientError);
|
|
1151
|
+
}
|
|
1152
|
+
_this7.metricManager.submitRegistrationMetric(_types.METRIC_EVENT.REGISTRATION, _types.REG_ACTION.KEEPALIVE_FAILURE, _types.METRIC_TYPE.BEHAVIORAL, _constants2.KEEPALIVE_UTIL, serverType, (_error$headers$tracki = (_error$headers = error.headers) === null || _error$headers === void 0 ? void 0 : _error$headers.trackingid) !== null && _error$headers$tracki !== void 0 ? _error$headers$tracki : '', event.data.keepAliveRetryCount, clientError);
|
|
1153
|
+
}, {
|
|
1154
|
+
method: _constants2.KEEPALIVE_UTIL,
|
|
1155
|
+
file: _constants2.REGISTRATION_FILE
|
|
1156
|
+
});
|
|
1157
|
+
case 7:
|
|
1158
|
+
abort = _context20.sent;
|
|
1159
|
+
if (!(abort || event.data.keepAliveRetryCount >= RETRY_COUNT_THRESHOLD)) {
|
|
1160
|
+
_context20.next = 19;
|
|
1161
|
+
break;
|
|
1162
|
+
}
|
|
1163
|
+
_this7.failoverImmediately = _this7.isCCFlow;
|
|
1164
|
+
_this7.setStatus(_types2.RegistrationStatus.INACTIVE);
|
|
1165
|
+
_this7.clearKeepaliveTimer();
|
|
1166
|
+
_this7.clearFailbackTimer();
|
|
1167
|
+
_this7.lineEmitter(_types3.LINE_EVENTS.UNREGISTERED);
|
|
1168
|
+
if (abort) {
|
|
1169
|
+
_context20.next = 17;
|
|
1170
|
+
break;
|
|
1171
|
+
}
|
|
1172
|
+
_context20.next = 17;
|
|
1173
|
+
return _this7.reconnectOnFailure(_constants2.KEEPALIVE_UTIL);
|
|
1174
|
+
case 17:
|
|
1175
|
+
_context20.next = 20;
|
|
1176
|
+
break;
|
|
1177
|
+
case 19:
|
|
1178
|
+
_this7.lineEmitter(_types3.LINE_EVENTS.RECONNECTING);
|
|
1179
|
+
case 20:
|
|
1180
|
+
case "end":
|
|
1181
|
+
return _context20.stop();
|
|
1182
|
+
}
|
|
1183
|
+
}, _callee19);
|
|
1184
|
+
}));
|
|
1185
|
+
return function (_x16) {
|
|
1186
|
+
return _ref10.apply(this, arguments);
|
|
1187
|
+
};
|
|
1188
|
+
}();
|
|
1183
1189
|
}
|
|
1184
|
-
|
|
1185
|
-
return _this7.reconnectOnFailure(_constants2.KEEPALIVE_UTIL);
|
|
1186
|
-
case 27:
|
|
1187
|
-
_context21.next = 30;
|
|
1188
|
-
break;
|
|
1189
|
-
case 29:
|
|
1190
|
-
_this7.lineEmitter(_types3.LINE_EVENTS.RECONNECTING);
|
|
1191
|
-
case 30:
|
|
1190
|
+
case 5:
|
|
1192
1191
|
case "end":
|
|
1193
1192
|
return _context21.stop();
|
|
1194
1193
|
}
|
|
1195
|
-
}, _callee20
|
|
1194
|
+
}, _callee20);
|
|
1196
1195
|
})));
|
|
1197
|
-
case
|
|
1196
|
+
case 4:
|
|
1198
1197
|
case "end":
|
|
1199
1198
|
return _context22.stop();
|
|
1200
1199
|
}
|
|
1201
|
-
}, _callee21);
|
|
1202
|
-
}))
|
|
1203
|
-
|
|
1204
|
-
|
|
1200
|
+
}, _callee21, this);
|
|
1201
|
+
}));
|
|
1202
|
+
function startKeepaliveTimer(_x13, _x14, _x15) {
|
|
1203
|
+
return _startKeepaliveTimer.apply(this, arguments);
|
|
1204
|
+
}
|
|
1205
|
+
return startKeepaliveTimer;
|
|
1206
|
+
}()
|
|
1205
1207
|
/**
|
|
1206
1208
|
* Clears the keepalive timer if running.
|
|
1207
1209
|
*/
|
|
1210
|
+
)
|
|
1208
1211
|
}, {
|
|
1209
1212
|
key: "clearKeepaliveTimer",
|
|
1210
1213
|
value: function clearKeepaliveTimer() {
|
|
1211
|
-
if (this.
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
+
if (this.webWorker) {
|
|
1215
|
+
this.webWorker.postMessage({
|
|
1216
|
+
type: _types2.WorkerMessageType.CLEAR_KEEPALIVE
|
|
1217
|
+
});
|
|
1218
|
+
this.webWorker.terminate();
|
|
1219
|
+
this.webWorker = undefined;
|
|
1214
1220
|
}
|
|
1215
1221
|
}
|
|
1216
1222
|
}, {
|
|
@@ -1357,7 +1363,7 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
1357
1363
|
}
|
|
1358
1364
|
}, _callee23, this);
|
|
1359
1365
|
}));
|
|
1360
|
-
function reconnectOnFailure(
|
|
1366
|
+
function reconnectOnFailure(_x17) {
|
|
1361
1367
|
return _reconnectOnFailure.apply(this, arguments);
|
|
1362
1368
|
}
|
|
1363
1369
|
return reconnectOnFailure;
|