@webex/calling 3.10.0-next.11 → 3.10.0-next.13
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/calling/call.js +490 -462
- package/dist/CallingClient/calling/call.js.map +1 -1
- package/dist/CallingClient/calling/call.test.js +410 -432
- package/dist/CallingClient/calling/call.test.js.map +1 -1
- package/dist/CallingClient/constants.js +3 -2
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/registration/register.js +428 -387
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +463 -179
- package/dist/CallingClient/registration/register.test.js.map +1 -1
- package/dist/module/CallingClient/calling/call.js +54 -45
- package/dist/module/CallingClient/constants.js +1 -0
- package/dist/module/CallingClient/registration/register.js +18 -2
- package/dist/types/CallingClient/calling/call.d.ts +3 -1
- package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
- package/dist/types/CallingClient/constants.d.ts +1 -0
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -231,27 +231,68 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
231
231
|
}, {
|
|
232
232
|
key: "restorePreviousRegistration",
|
|
233
233
|
value: (function () {
|
|
234
|
-
var _restorePreviousRegistration = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
234
|
+
var _restorePreviousRegistration = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4(caller) {
|
|
235
|
+
var _this = this;
|
|
235
236
|
var abort;
|
|
236
|
-
return _regenerator.default.wrap(function
|
|
237
|
-
while (1) switch (
|
|
237
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
238
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
238
239
|
case 0:
|
|
239
240
|
abort = false;
|
|
240
241
|
if (!this.activeMobiusUrl) {
|
|
241
|
-
|
|
242
|
+
_context4.next = 19;
|
|
242
243
|
break;
|
|
243
244
|
}
|
|
244
|
-
|
|
245
|
+
_context4.next = 4;
|
|
245
246
|
return this.attemptRegistrationWithServers(caller, [this.activeMobiusUrl]);
|
|
246
247
|
case 4:
|
|
247
|
-
abort =
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
248
|
+
abort = _context4.sent;
|
|
249
|
+
if (!this.retryAfter) {
|
|
250
|
+
_context4.next = 19;
|
|
251
|
+
break;
|
|
252
|
+
}
|
|
253
|
+
if (!(this.retryAfter < _constants2.RETRY_TIMER_UPPER_LIMIT)) {
|
|
254
|
+
_context4.next = 10;
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
// If retry-after is less than threshold, honor it and schedule retry
|
|
258
|
+
setTimeout(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
259
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
260
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
261
|
+
case 0:
|
|
262
|
+
_context3.next = 2;
|
|
263
|
+
return _this.restartRegistration(caller);
|
|
264
|
+
case 2:
|
|
265
|
+
case "end":
|
|
266
|
+
return _context3.stop();
|
|
267
|
+
}
|
|
268
|
+
}, _callee3);
|
|
269
|
+
})), this.retryAfter * 1000);
|
|
270
|
+
_context4.next = 17;
|
|
271
|
+
break;
|
|
272
|
+
case 10:
|
|
273
|
+
if (!(this.primaryMobiusUris.includes(this.activeMobiusUrl) && this.backupMobiusUris.length > 0)) {
|
|
274
|
+
_context4.next = 16;
|
|
275
|
+
break;
|
|
276
|
+
}
|
|
277
|
+
_context4.next = 13;
|
|
278
|
+
return this.attemptRegistrationWithServers(caller, this.backupMobiusUris);
|
|
279
|
+
case 13:
|
|
280
|
+
abort = _context4.sent;
|
|
281
|
+
_context4.next = 17;
|
|
282
|
+
break;
|
|
283
|
+
case 16:
|
|
284
|
+
// If we are using backup and got 429, restart registration
|
|
285
|
+
this.restartRegistration(caller);
|
|
286
|
+
case 17:
|
|
287
|
+
this.retryAfter = undefined;
|
|
288
|
+
return _context4.abrupt("return", true);
|
|
289
|
+
case 19:
|
|
290
|
+
return _context4.abrupt("return", abort);
|
|
291
|
+
case 20:
|
|
251
292
|
case "end":
|
|
252
|
-
return
|
|
293
|
+
return _context4.stop();
|
|
253
294
|
}
|
|
254
|
-
},
|
|
295
|
+
}, _callee4, this);
|
|
255
296
|
}));
|
|
256
297
|
function restorePreviousRegistration(_x5) {
|
|
257
298
|
return _restorePreviousRegistration.apply(this, arguments);
|
|
@@ -265,30 +306,30 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
265
306
|
}, {
|
|
266
307
|
key: "handle404KeepaliveFailure",
|
|
267
308
|
value: (function () {
|
|
268
|
-
var _handle404KeepaliveFailure = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
309
|
+
var _handle404KeepaliveFailure = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5(caller) {
|
|
269
310
|
var abort;
|
|
270
|
-
return _regenerator.default.wrap(function
|
|
271
|
-
while (1) switch (
|
|
311
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
312
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
272
313
|
case 0:
|
|
273
314
|
if (!(caller === _constants2.KEEPALIVE_UTIL)) {
|
|
274
|
-
|
|
315
|
+
_context5.next = 7;
|
|
275
316
|
break;
|
|
276
317
|
}
|
|
277
|
-
|
|
318
|
+
_context5.next = 3;
|
|
278
319
|
return this.attemptRegistrationWithServers(caller);
|
|
279
320
|
case 3:
|
|
280
|
-
abort =
|
|
321
|
+
abort = _context5.sent;
|
|
281
322
|
if (!(!abort && !this.isDeviceRegistered())) {
|
|
282
|
-
|
|
323
|
+
_context5.next = 7;
|
|
283
324
|
break;
|
|
284
325
|
}
|
|
285
|
-
|
|
326
|
+
_context5.next = 7;
|
|
286
327
|
return this.startFailoverTimer();
|
|
287
328
|
case 7:
|
|
288
329
|
case "end":
|
|
289
|
-
return
|
|
330
|
+
return _context5.stop();
|
|
290
331
|
}
|
|
291
|
-
},
|
|
332
|
+
}, _callee5, this);
|
|
292
333
|
}));
|
|
293
334
|
function handle404KeepaliveFailure(_x6) {
|
|
294
335
|
return _handle404KeepaliveFailure.apply(this, arguments);
|
|
@@ -302,21 +343,21 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
302
343
|
}, {
|
|
303
344
|
key: "handle429Retry",
|
|
304
345
|
value: (function () {
|
|
305
|
-
var _handle429Retry = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
306
|
-
var
|
|
346
|
+
var _handle429Retry = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee7(retryAfter, caller) {
|
|
347
|
+
var _this2 = this;
|
|
307
348
|
var interval, abort;
|
|
308
|
-
return _regenerator.default.wrap(function
|
|
309
|
-
while (1) switch (
|
|
349
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
350
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
310
351
|
case 0:
|
|
311
352
|
if (!(caller === _constants2.FAILBACK_UTIL)) {
|
|
312
|
-
|
|
353
|
+
_context7.next = 17;
|
|
313
354
|
break;
|
|
314
355
|
}
|
|
315
356
|
if (!(this.failback429RetryAttempts >= _constants2.REG_FAILBACK_429_MAX_RETRIES)) {
|
|
316
|
-
|
|
357
|
+
_context7.next = 3;
|
|
317
358
|
break;
|
|
318
359
|
}
|
|
319
|
-
return
|
|
360
|
+
return _context7.abrupt("return");
|
|
320
361
|
case 3:
|
|
321
362
|
this.clearFailbackTimer();
|
|
322
363
|
this.failback429RetryAttempts += 1;
|
|
@@ -327,26 +368,26 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
327
368
|
interval = this.getRegRetryInterval(this.failback429RetryAttempts);
|
|
328
369
|
this.startFailbackTimer(interval);
|
|
329
370
|
this.scheduled429Retry = true;
|
|
330
|
-
|
|
371
|
+
_context7.next = 11;
|
|
331
372
|
return this.restorePreviousRegistration(_constants2.REG_429_RETRY_UTIL);
|
|
332
373
|
case 11:
|
|
333
|
-
abort =
|
|
374
|
+
abort = _context7.sent;
|
|
334
375
|
if (!(!abort && !this.isDeviceRegistered())) {
|
|
335
|
-
|
|
376
|
+
_context7.next = 15;
|
|
336
377
|
break;
|
|
337
378
|
}
|
|
338
|
-
|
|
379
|
+
_context7.next = 15;
|
|
339
380
|
return this.restartRegistration(_constants2.REG_429_RETRY_UTIL);
|
|
340
381
|
case 15:
|
|
341
|
-
|
|
382
|
+
_context7.next = 18;
|
|
342
383
|
break;
|
|
343
384
|
case 17:
|
|
344
385
|
if (caller === _constants2.KEEPALIVE_UTIL) {
|
|
345
386
|
this.clearKeepaliveTimer();
|
|
346
|
-
setTimeout(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
347
|
-
var
|
|
348
|
-
return _regenerator.default.wrap(function
|
|
349
|
-
while (1) switch (
|
|
387
|
+
setTimeout(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
388
|
+
var _this2$deviceInfo$dev;
|
|
389
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
390
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
350
391
|
case 0:
|
|
351
392
|
_Logger.default.log("Resuming keepalive after ".concat(retryAfter, " seconds"), {
|
|
352
393
|
file: _constants2.REGISTRATION_FILE,
|
|
@@ -354,22 +395,22 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
354
395
|
});
|
|
355
396
|
|
|
356
397
|
// Resume the keepalive after waiting for the retry after period
|
|
357
|
-
|
|
358
|
-
return
|
|
398
|
+
_context6.next = 3;
|
|
399
|
+
return _this2.startKeepaliveTimer((_this2$deviceInfo$dev = _this2.deviceInfo.device) === null || _this2$deviceInfo$dev === void 0 ? void 0 : _this2$deviceInfo$dev.uri, _this2.deviceInfo.keepaliveInterval, 'UNKNOWN');
|
|
359
400
|
case 3:
|
|
360
401
|
case "end":
|
|
361
|
-
return
|
|
402
|
+
return _context6.stop();
|
|
362
403
|
}
|
|
363
|
-
},
|
|
404
|
+
}, _callee6);
|
|
364
405
|
})), retryAfter * 1000);
|
|
365
406
|
} else {
|
|
366
407
|
this.retryAfter = retryAfter;
|
|
367
408
|
}
|
|
368
409
|
case 18:
|
|
369
410
|
case "end":
|
|
370
|
-
return
|
|
411
|
+
return _context7.stop();
|
|
371
412
|
}
|
|
372
|
-
},
|
|
413
|
+
}, _callee7, this);
|
|
373
414
|
}));
|
|
374
415
|
function handle429Retry(_x7, _x8) {
|
|
375
416
|
return _handle429Retry.apply(this, arguments);
|
|
@@ -400,8 +441,8 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
400
441
|
}, {
|
|
401
442
|
key: "startFailoverTimer",
|
|
402
443
|
value: (function () {
|
|
403
|
-
var _startFailoverTimer = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
404
|
-
var
|
|
444
|
+
var _startFailoverTimer = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
445
|
+
var _this3 = this;
|
|
405
446
|
var attempt,
|
|
406
447
|
timeElapsed,
|
|
407
448
|
loggerContext,
|
|
@@ -410,12 +451,12 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
410
451
|
excessVal,
|
|
411
452
|
abort,
|
|
412
453
|
scheduledTime,
|
|
413
|
-
|
|
414
|
-
return _regenerator.default.wrap(function
|
|
415
|
-
while (1) switch (
|
|
454
|
+
_args10 = arguments;
|
|
455
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
456
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
416
457
|
case 0:
|
|
417
|
-
attempt =
|
|
418
|
-
timeElapsed =
|
|
458
|
+
attempt = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : 1;
|
|
459
|
+
timeElapsed = _args10.length > 1 && _args10[1] !== undefined ? _args10[1] : 0;
|
|
419
460
|
loggerContext = {
|
|
420
461
|
file: _constants2.REGISTRATION_FILE,
|
|
421
462
|
method: _constants2.FAILOVER_UTIL
|
|
@@ -430,116 +471,116 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
430
471
|
this.failoverImmediately = this.retryAfter + timeElapsed > TIMER_THRESHOLD;
|
|
431
472
|
}
|
|
432
473
|
if (!(interval > _constants2.BASE_REG_RETRY_TIMER_VAL_IN_SEC && !this.failoverImmediately)) {
|
|
433
|
-
|
|
474
|
+
_context10.next = 14;
|
|
434
475
|
break;
|
|
435
476
|
}
|
|
436
477
|
scheduledTime = Math.floor((0, _now.default)() / 1000);
|
|
437
478
|
if (this.retryAfter != null) {
|
|
438
479
|
interval = Math.max(interval, this.retryAfter);
|
|
439
480
|
}
|
|
440
|
-
setTimeout(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
441
|
-
return _regenerator.default.wrap(function
|
|
442
|
-
while (1) switch (
|
|
481
|
+
setTimeout(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
482
|
+
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
483
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
443
484
|
case 0:
|
|
444
|
-
|
|
445
|
-
return
|
|
485
|
+
_context9.next = 2;
|
|
486
|
+
return _this3.mutex.runExclusive(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
446
487
|
var currentTime;
|
|
447
|
-
return _regenerator.default.wrap(function
|
|
448
|
-
while (1) switch (
|
|
488
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
489
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
449
490
|
case 0:
|
|
450
|
-
|
|
451
|
-
return
|
|
491
|
+
_context8.next = 2;
|
|
492
|
+
return _this3.attemptRegistrationWithServers(_constants2.FAILOVER_UTIL);
|
|
452
493
|
case 2:
|
|
453
|
-
abort =
|
|
494
|
+
abort = _context8.sent;
|
|
454
495
|
currentTime = Math.floor((0, _now.default)() / 1000);
|
|
455
|
-
if (!(!abort && !
|
|
456
|
-
|
|
496
|
+
if (!(!abort && !_this3.isDeviceRegistered())) {
|
|
497
|
+
_context8.next = 7;
|
|
457
498
|
break;
|
|
458
499
|
}
|
|
459
|
-
|
|
460
|
-
return
|
|
500
|
+
_context8.next = 7;
|
|
501
|
+
return _this3.startFailoverTimer(attempt + 1, timeElapsed + (currentTime - scheduledTime));
|
|
461
502
|
case 7:
|
|
462
503
|
case "end":
|
|
463
|
-
return
|
|
504
|
+
return _context8.stop();
|
|
464
505
|
}
|
|
465
|
-
},
|
|
506
|
+
}, _callee8);
|
|
466
507
|
})));
|
|
467
508
|
case 2:
|
|
468
509
|
case "end":
|
|
469
|
-
return
|
|
510
|
+
return _context9.stop();
|
|
470
511
|
}
|
|
471
|
-
},
|
|
512
|
+
}, _callee9);
|
|
472
513
|
})), interval * _constants2.SEC_TO_MSEC_MFACTOR);
|
|
473
514
|
_Logger.default.log("Scheduled retry with primary in ".concat(interval, " seconds, number of attempts : ").concat(attempt), loggerContext);
|
|
474
|
-
|
|
515
|
+
_context10.next = 26;
|
|
475
516
|
break;
|
|
476
517
|
case 14:
|
|
477
518
|
if (!this.backupMobiusUris.length) {
|
|
478
|
-
|
|
519
|
+
_context10.next = 23;
|
|
479
520
|
break;
|
|
480
521
|
}
|
|
481
522
|
_Logger.default.info('Failing over to backup servers.', loggerContext);
|
|
482
523
|
this.failoverImmediately = false;
|
|
483
|
-
|
|
524
|
+
_context10.next = 19;
|
|
484
525
|
return this.attemptRegistrationWithServers(_constants2.FAILOVER_UTIL, this.backupMobiusUris);
|
|
485
526
|
case 19:
|
|
486
|
-
abort =
|
|
527
|
+
abort = _context10.sent;
|
|
487
528
|
if (!abort && !this.isDeviceRegistered()) {
|
|
488
529
|
interval = this.getRegRetryInterval();
|
|
489
530
|
if (this.retryAfter != null && this.retryAfter < _constants2.RETRY_TIMER_UPPER_LIMIT) {
|
|
490
531
|
interval = interval < this.retryAfter ? this.retryAfter : interval;
|
|
491
532
|
}
|
|
492
|
-
setTimeout(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
493
|
-
return _regenerator.default.wrap(function
|
|
494
|
-
while (1) switch (
|
|
533
|
+
setTimeout(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
|
|
534
|
+
return _regenerator.default.wrap(function _callee1$(_context1) {
|
|
535
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
495
536
|
case 0:
|
|
496
|
-
|
|
497
|
-
return
|
|
498
|
-
return _regenerator.default.wrap(function
|
|
499
|
-
while (1) switch (
|
|
537
|
+
_context1.next = 2;
|
|
538
|
+
return _this3.mutex.runExclusive(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0() {
|
|
539
|
+
return _regenerator.default.wrap(function _callee0$(_context0) {
|
|
540
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
500
541
|
case 0:
|
|
501
|
-
|
|
502
|
-
return
|
|
542
|
+
_context0.next = 2;
|
|
543
|
+
return _this3.attemptRegistrationWithServers(_constants2.FAILOVER_UTIL, _this3.backupMobiusUris);
|
|
503
544
|
case 2:
|
|
504
|
-
abort =
|
|
505
|
-
if (!(!abort && !
|
|
506
|
-
|
|
545
|
+
abort = _context0.sent;
|
|
546
|
+
if (!(!abort && !_this3.isDeviceRegistered())) {
|
|
547
|
+
_context0.next = 7;
|
|
507
548
|
break;
|
|
508
549
|
}
|
|
509
|
-
|
|
550
|
+
_context0.next = 6;
|
|
510
551
|
return (0, _common.uploadLogs)();
|
|
511
552
|
case 6:
|
|
512
553
|
(0, _common.emitFinalFailure)(function (clientError) {
|
|
513
|
-
|
|
554
|
+
_this3.lineEmitter(_types3.LINE_EVENTS.ERROR, undefined, clientError);
|
|
514
555
|
}, loggerContext);
|
|
515
556
|
case 7:
|
|
516
557
|
case "end":
|
|
517
|
-
return
|
|
558
|
+
return _context0.stop();
|
|
518
559
|
}
|
|
519
|
-
},
|
|
560
|
+
}, _callee0);
|
|
520
561
|
})));
|
|
521
562
|
case 2:
|
|
522
563
|
case "end":
|
|
523
|
-
return
|
|
564
|
+
return _context1.stop();
|
|
524
565
|
}
|
|
525
|
-
},
|
|
566
|
+
}, _callee1);
|
|
526
567
|
})), interval * _constants2.SEC_TO_MSEC_MFACTOR);
|
|
527
568
|
_Logger.default.log("Scheduled retry with backup servers in ".concat(interval, " seconds."), loggerContext);
|
|
528
569
|
}
|
|
529
|
-
|
|
570
|
+
_context10.next = 26;
|
|
530
571
|
break;
|
|
531
572
|
case 23:
|
|
532
|
-
|
|
573
|
+
_context10.next = 25;
|
|
533
574
|
return (0, _common.uploadLogs)();
|
|
534
575
|
case 25:
|
|
535
576
|
(0, _common.emitFinalFailure)(function (clientError) {
|
|
536
|
-
|
|
577
|
+
_this3.lineEmitter(_types3.LINE_EVENTS.ERROR, undefined, clientError);
|
|
537
578
|
}, loggerContext);
|
|
538
579
|
case 26:
|
|
539
580
|
case "end":
|
|
540
|
-
return
|
|
581
|
+
return _context10.stop();
|
|
541
582
|
}
|
|
542
|
-
},
|
|
583
|
+
}, _callee10, this);
|
|
543
584
|
}));
|
|
544
585
|
function startFailoverTimer() {
|
|
545
586
|
return _startFailoverTimer.apply(this, arguments);
|
|
@@ -561,23 +602,23 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
561
602
|
}, {
|
|
562
603
|
key: "isPrimaryActive",
|
|
563
604
|
value: function () {
|
|
564
|
-
var _isPrimaryActive = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
565
|
-
var status, _iterator, _step, mobiusUrl, baseUri, response,
|
|
566
|
-
return _regenerator.default.wrap(function
|
|
567
|
-
while (1) switch (
|
|
605
|
+
var _isPrimaryActive = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
606
|
+
var status, _iterator, _step, mobiusUrl, baseUri, response, _ref7, statusCode;
|
|
607
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
608
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
568
609
|
case 0:
|
|
569
610
|
_iterator = _createForOfIteratorHelper(this.primaryMobiusUris);
|
|
570
|
-
|
|
611
|
+
_context11.prev = 1;
|
|
571
612
|
_iterator.s();
|
|
572
613
|
case 3:
|
|
573
614
|
if ((_step = _iterator.n()).done) {
|
|
574
|
-
|
|
615
|
+
_context11.next = 23;
|
|
575
616
|
break;
|
|
576
617
|
}
|
|
577
618
|
mobiusUrl = _step.value;
|
|
578
|
-
|
|
619
|
+
_context11.prev = 5;
|
|
579
620
|
baseUri = mobiusUrl.replace(_constants2.URL_ENDPOINT, '/'); // eslint-disable-next-line no-await-in-loop
|
|
580
|
-
|
|
621
|
+
_context11.next = 9;
|
|
581
622
|
return this.webex.request({
|
|
582
623
|
uri: "".concat(baseUri, "ping"),
|
|
583
624
|
method: _types2.HTTP_METHODS.GET,
|
|
@@ -585,10 +626,10 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
585
626
|
service: _types2.ALLOWED_SERVICES.MOBIUS
|
|
586
627
|
});
|
|
587
628
|
case 9:
|
|
588
|
-
response =
|
|
589
|
-
|
|
629
|
+
response = _context11.sent;
|
|
630
|
+
_ref7 = response, statusCode = _ref7.statusCode;
|
|
590
631
|
if (!(statusCode === 200)) {
|
|
591
|
-
|
|
632
|
+
_context11.next = 15;
|
|
592
633
|
break;
|
|
593
634
|
}
|
|
594
635
|
_Logger.default.info("Ping successful for primary Mobius: ".concat(mobiusUrl), {
|
|
@@ -596,39 +637,39 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
596
637
|
method: _constants2.FAILBACK_UTIL
|
|
597
638
|
});
|
|
598
639
|
status = 'up';
|
|
599
|
-
return
|
|
640
|
+
return _context11.abrupt("break", 23);
|
|
600
641
|
case 15:
|
|
601
|
-
|
|
642
|
+
_context11.next = 21;
|
|
602
643
|
break;
|
|
603
644
|
case 17:
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
_Logger.default.warn("Ping failed for primary Mobius: ".concat(mobiusUrl, " with error: ").concat((0, _stringify.default)(
|
|
645
|
+
_context11.prev = 17;
|
|
646
|
+
_context11.t0 = _context11["catch"](5);
|
|
647
|
+
_Logger.default.warn("Ping failed for primary Mobius: ".concat(mobiusUrl, " with error: ").concat((0, _stringify.default)(_context11.t0)), {
|
|
607
648
|
file: _constants2.REGISTRATION_FILE,
|
|
608
649
|
method: _constants2.FAILBACK_UTIL
|
|
609
650
|
});
|
|
610
651
|
status = 'down';
|
|
611
652
|
case 21:
|
|
612
|
-
|
|
653
|
+
_context11.next = 3;
|
|
613
654
|
break;
|
|
614
655
|
case 23:
|
|
615
|
-
|
|
656
|
+
_context11.next = 28;
|
|
616
657
|
break;
|
|
617
658
|
case 25:
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
_iterator.e(
|
|
659
|
+
_context11.prev = 25;
|
|
660
|
+
_context11.t1 = _context11["catch"](1);
|
|
661
|
+
_iterator.e(_context11.t1);
|
|
621
662
|
case 28:
|
|
622
|
-
|
|
663
|
+
_context11.prev = 28;
|
|
623
664
|
_iterator.f();
|
|
624
|
-
return
|
|
665
|
+
return _context11.finish(28);
|
|
625
666
|
case 31:
|
|
626
|
-
return
|
|
667
|
+
return _context11.abrupt("return", status === 'up');
|
|
627
668
|
case 32:
|
|
628
669
|
case "end":
|
|
629
|
-
return
|
|
670
|
+
return _context11.stop();
|
|
630
671
|
}
|
|
631
|
-
},
|
|
672
|
+
}, _callee11, this, [[1, 25, 28, 31], [5, 17]]);
|
|
632
673
|
}));
|
|
633
674
|
function isPrimaryActive() {
|
|
634
675
|
return _isPrimaryActive.apply(this, arguments);
|
|
@@ -680,17 +721,17 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
680
721
|
}, {
|
|
681
722
|
key: "startFailbackTimer",
|
|
682
723
|
value: function startFailbackTimer(intervalInSeconds) {
|
|
683
|
-
var
|
|
684
|
-
this.failbackTimer = setTimeout(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
685
|
-
return _regenerator.default.wrap(function
|
|
686
|
-
while (1) switch (
|
|
724
|
+
var _this4 = this;
|
|
725
|
+
this.failbackTimer = setTimeout(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
726
|
+
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
727
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
687
728
|
case 0:
|
|
688
|
-
return
|
|
729
|
+
return _context12.abrupt("return", _this4.executeFailback());
|
|
689
730
|
case 1:
|
|
690
731
|
case "end":
|
|
691
|
-
return
|
|
732
|
+
return _context12.stop();
|
|
692
733
|
}
|
|
693
|
-
},
|
|
734
|
+
}, _callee12);
|
|
694
735
|
})), intervalInSeconds * _constants2.SEC_TO_MSEC_MFACTOR);
|
|
695
736
|
_Logger.default.log("Failback scheduled after ".concat(intervalInSeconds, " seconds."), {
|
|
696
737
|
file: _constants2.REGISTRATION_FILE,
|
|
@@ -705,90 +746,90 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
705
746
|
}, {
|
|
706
747
|
key: "executeFailback",
|
|
707
748
|
value: (function () {
|
|
708
|
-
var _executeFailback = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
709
|
-
var
|
|
710
|
-
return _regenerator.default.wrap(function
|
|
711
|
-
while (1) switch (
|
|
749
|
+
var _executeFailback = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14() {
|
|
750
|
+
var _this5 = this;
|
|
751
|
+
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
752
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
712
753
|
case 0:
|
|
713
|
-
|
|
714
|
-
return this.mutex.runExclusive(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
754
|
+
_context14.next = 2;
|
|
755
|
+
return this.mutex.runExclusive(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
715
756
|
var primaryServerStatus, abort, abortNew;
|
|
716
|
-
return _regenerator.default.wrap(function
|
|
717
|
-
while (1) switch (
|
|
757
|
+
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
758
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
718
759
|
case 0:
|
|
719
|
-
if (!
|
|
720
|
-
|
|
760
|
+
if (!_this5.isFailbackRequired()) {
|
|
761
|
+
_context13.next = 31;
|
|
721
762
|
break;
|
|
722
763
|
}
|
|
723
|
-
|
|
724
|
-
return
|
|
764
|
+
_context13.next = 3;
|
|
765
|
+
return _this5.isPrimaryActive();
|
|
725
766
|
case 3:
|
|
726
|
-
primaryServerStatus =
|
|
727
|
-
if (!((0, _keys.default)(
|
|
728
|
-
|
|
767
|
+
primaryServerStatus = _context13.sent;
|
|
768
|
+
if (!((0, _keys.default)(_this5.callManager.getActiveCalls()).length === 0 && primaryServerStatus)) {
|
|
769
|
+
_context13.next = 28;
|
|
729
770
|
break;
|
|
730
771
|
}
|
|
731
772
|
_Logger.default.info("Attempting failback to primary.", {
|
|
732
773
|
file: _constants2.REGISTRATION_FILE,
|
|
733
|
-
method:
|
|
774
|
+
method: _this5.executeFailback.name
|
|
734
775
|
});
|
|
735
|
-
|
|
736
|
-
return
|
|
776
|
+
_context13.next = 8;
|
|
777
|
+
return _this5.deregister();
|
|
737
778
|
case 8:
|
|
738
|
-
|
|
739
|
-
return
|
|
779
|
+
_context13.next = 10;
|
|
780
|
+
return _this5.attemptRegistrationWithServers(_constants2.FAILBACK_UTIL);
|
|
740
781
|
case 10:
|
|
741
|
-
abort =
|
|
742
|
-
if (!(
|
|
743
|
-
|
|
782
|
+
abort = _context13.sent;
|
|
783
|
+
if (!(_this5.scheduled429Retry || abort || _this5.isDeviceRegistered())) {
|
|
784
|
+
_context13.next = 13;
|
|
744
785
|
break;
|
|
745
786
|
}
|
|
746
|
-
return
|
|
787
|
+
return _context13.abrupt("return");
|
|
747
788
|
case 13:
|
|
748
|
-
|
|
749
|
-
return
|
|
789
|
+
_context13.next = 15;
|
|
790
|
+
return _this5.restorePreviousRegistration(_constants2.FAILBACK_UTIL);
|
|
750
791
|
case 15:
|
|
751
|
-
abortNew =
|
|
792
|
+
abortNew = _context13.sent;
|
|
752
793
|
if (!abortNew) {
|
|
753
|
-
|
|
794
|
+
_context13.next = 19;
|
|
754
795
|
break;
|
|
755
796
|
}
|
|
756
|
-
|
|
757
|
-
return
|
|
797
|
+
_this5.clearFailbackTimer();
|
|
798
|
+
return _context13.abrupt("return");
|
|
758
799
|
case 19:
|
|
759
|
-
if (
|
|
760
|
-
|
|
800
|
+
if (_this5.isDeviceRegistered()) {
|
|
801
|
+
_context13.next = 24;
|
|
761
802
|
break;
|
|
762
803
|
}
|
|
763
|
-
|
|
764
|
-
return
|
|
804
|
+
_context13.next = 22;
|
|
805
|
+
return _this5.restartRegistration(_this5.executeFailback.name);
|
|
765
806
|
case 22:
|
|
766
|
-
|
|
807
|
+
_context13.next = 26;
|
|
767
808
|
break;
|
|
768
809
|
case 24:
|
|
769
|
-
|
|
770
|
-
|
|
810
|
+
_this5.failbackTimer = undefined;
|
|
811
|
+
_this5.initiateFailback();
|
|
771
812
|
case 26:
|
|
772
|
-
|
|
813
|
+
_context13.next = 31;
|
|
773
814
|
break;
|
|
774
815
|
case 28:
|
|
775
816
|
_Logger.default.info('Active calls present or primary Mobius is down, deferring failback to next cycle.', {
|
|
776
817
|
file: _constants2.REGISTRATION_FILE,
|
|
777
|
-
method:
|
|
818
|
+
method: _this5.executeFailback.name
|
|
778
819
|
});
|
|
779
|
-
|
|
780
|
-
|
|
820
|
+
_this5.failbackTimer = undefined;
|
|
821
|
+
_this5.initiateFailback();
|
|
781
822
|
case 31:
|
|
782
823
|
case "end":
|
|
783
|
-
return
|
|
824
|
+
return _context13.stop();
|
|
784
825
|
}
|
|
785
|
-
},
|
|
826
|
+
}, _callee13);
|
|
786
827
|
})));
|
|
787
828
|
case 2:
|
|
788
829
|
case "end":
|
|
789
|
-
return
|
|
830
|
+
return _context14.stop();
|
|
790
831
|
}
|
|
791
|
-
},
|
|
832
|
+
}, _callee14, this);
|
|
792
833
|
}));
|
|
793
834
|
function executeFailback() {
|
|
794
835
|
return _executeFailback.apply(this, arguments);
|
|
@@ -851,10 +892,10 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
851
892
|
}, {
|
|
852
893
|
key: "restartRegistration",
|
|
853
894
|
value: (function () {
|
|
854
|
-
var _restartRegistration = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
895
|
+
var _restartRegistration = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15(caller) {
|
|
855
896
|
var abort;
|
|
856
|
-
return _regenerator.default.wrap(function
|
|
857
|
-
while (1) switch (
|
|
897
|
+
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
898
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
858
899
|
case 0:
|
|
859
900
|
/*
|
|
860
901
|
* Cancel any failback timer running
|
|
@@ -862,21 +903,21 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
862
903
|
*/
|
|
863
904
|
this.clearFailbackTimer();
|
|
864
905
|
this.failback429RetryAttempts = 0;
|
|
865
|
-
|
|
906
|
+
_context15.next = 4;
|
|
866
907
|
return this.attemptRegistrationWithServers(caller, this.primaryMobiusUris);
|
|
867
908
|
case 4:
|
|
868
|
-
abort =
|
|
909
|
+
abort = _context15.sent;
|
|
869
910
|
if (!(!abort && !this.isDeviceRegistered())) {
|
|
870
|
-
|
|
911
|
+
_context15.next = 8;
|
|
871
912
|
break;
|
|
872
913
|
}
|
|
873
|
-
|
|
914
|
+
_context15.next = 8;
|
|
874
915
|
return this.startFailoverTimer();
|
|
875
916
|
case 8:
|
|
876
917
|
case "end":
|
|
877
|
-
return
|
|
918
|
+
return _context15.stop();
|
|
878
919
|
}
|
|
879
|
-
},
|
|
920
|
+
}, _callee15, this);
|
|
880
921
|
}));
|
|
881
922
|
function restartRegistration(_x9) {
|
|
882
923
|
return _restartRegistration.apply(this, arguments);
|
|
@@ -892,66 +933,66 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
892
933
|
}, {
|
|
893
934
|
key: "handleConnectionRestoration",
|
|
894
935
|
value: (function () {
|
|
895
|
-
var _handleConnectionRestoration = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
896
|
-
var
|
|
897
|
-
return _regenerator.default.wrap(function
|
|
898
|
-
while (1) switch (
|
|
936
|
+
var _handleConnectionRestoration = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17(retry) {
|
|
937
|
+
var _this6 = this;
|
|
938
|
+
return _regenerator.default.wrap(function _callee17$(_context17) {
|
|
939
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
899
940
|
case 0:
|
|
900
941
|
_Logger.default.info(_constants.METHOD_START_MESSAGE, {
|
|
901
942
|
method: _constants2.METHODS.HANDLE_CONNECTION_RESTORATION,
|
|
902
943
|
file: _constants2.REGISTRATION_FILE
|
|
903
944
|
});
|
|
904
|
-
|
|
905
|
-
return this.mutex.runExclusive(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
945
|
+
_context17.next = 3;
|
|
946
|
+
return this.mutex.runExclusive(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16() {
|
|
906
947
|
var abort;
|
|
907
|
-
return _regenerator.default.wrap(function
|
|
908
|
-
while (1) switch (
|
|
948
|
+
return _regenerator.default.wrap(function _callee16$(_context16) {
|
|
949
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
909
950
|
case 0:
|
|
910
951
|
if (!retry) {
|
|
911
|
-
|
|
952
|
+
_context16.next = 14;
|
|
912
953
|
break;
|
|
913
954
|
}
|
|
914
955
|
_Logger.default.log('Network is up again, re-registering with Webex Calling if needed', {
|
|
915
956
|
file: _constants2.REGISTRATION_FILE,
|
|
916
957
|
method: _constants2.METHODS.HANDLE_CONNECTION_RESTORATION
|
|
917
958
|
});
|
|
918
|
-
|
|
919
|
-
if (!
|
|
920
|
-
|
|
959
|
+
_this6.clearKeepaliveTimer();
|
|
960
|
+
if (!_this6.isDeviceRegistered()) {
|
|
961
|
+
_context16.next = 6;
|
|
921
962
|
break;
|
|
922
963
|
}
|
|
923
|
-
|
|
924
|
-
return
|
|
964
|
+
_context16.next = 6;
|
|
965
|
+
return _this6.deregister();
|
|
925
966
|
case 6:
|
|
926
|
-
if (!
|
|
927
|
-
|
|
967
|
+
if (!_this6.activeMobiusUrl) {
|
|
968
|
+
_context16.next = 13;
|
|
928
969
|
break;
|
|
929
970
|
}
|
|
930
|
-
|
|
931
|
-
return
|
|
971
|
+
_context16.next = 9;
|
|
972
|
+
return _this6.restorePreviousRegistration(_constants2.METHODS.HANDLE_CONNECTION_RESTORATION);
|
|
932
973
|
case 9:
|
|
933
|
-
abort =
|
|
934
|
-
if (!(!abort && !
|
|
935
|
-
|
|
974
|
+
abort = _context16.sent;
|
|
975
|
+
if (!(!abort && !_this6.isDeviceRegistered())) {
|
|
976
|
+
_context16.next = 13;
|
|
936
977
|
break;
|
|
937
978
|
}
|
|
938
|
-
|
|
939
|
-
return
|
|
979
|
+
_context16.next = 13;
|
|
980
|
+
return _this6.restartRegistration(_constants2.METHODS.HANDLE_CONNECTION_RESTORATION);
|
|
940
981
|
case 13:
|
|
941
982
|
retry = false;
|
|
942
983
|
case 14:
|
|
943
984
|
case "end":
|
|
944
|
-
return
|
|
985
|
+
return _context16.stop();
|
|
945
986
|
}
|
|
946
|
-
},
|
|
987
|
+
}, _callee16);
|
|
947
988
|
})));
|
|
948
989
|
case 3:
|
|
949
|
-
return
|
|
990
|
+
return _context17.abrupt("return", retry);
|
|
950
991
|
case 4:
|
|
951
992
|
case "end":
|
|
952
|
-
return
|
|
993
|
+
return _context17.stop();
|
|
953
994
|
}
|
|
954
|
-
},
|
|
995
|
+
}, _callee17, this);
|
|
955
996
|
}));
|
|
956
997
|
function handleConnectionRestoration(_x0) {
|
|
957
998
|
return _handleConnectionRestoration.apply(this, arguments);
|
|
@@ -967,56 +1008,56 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
967
1008
|
}, {
|
|
968
1009
|
key: "restoreRegistrationCallBack",
|
|
969
1010
|
value: function restoreRegistrationCallBack() {
|
|
970
|
-
var
|
|
1011
|
+
var _this7 = this;
|
|
971
1012
|
return /*#__PURE__*/function () {
|
|
972
|
-
var
|
|
1013
|
+
var _ref1 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18(restoreData, caller) {
|
|
973
1014
|
var logContext, restore, finalError;
|
|
974
|
-
return _regenerator.default.wrap(function
|
|
975
|
-
while (1) switch (
|
|
1015
|
+
return _regenerator.default.wrap(function _callee18$(_context18) {
|
|
1016
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
976
1017
|
case 0:
|
|
977
1018
|
logContext = {
|
|
978
1019
|
file: _constants2.REGISTRATION_FILE,
|
|
979
1020
|
method: caller
|
|
980
1021
|
};
|
|
981
|
-
if (
|
|
982
|
-
|
|
1022
|
+
if (_this7.isRegRetry()) {
|
|
1023
|
+
_context18.next = 17;
|
|
983
1024
|
break;
|
|
984
1025
|
}
|
|
985
1026
|
_Logger.default.info('Registration restoration in progress.', logContext);
|
|
986
|
-
restore =
|
|
1027
|
+
restore = _this7.getExistingDevice(restoreData);
|
|
987
1028
|
if (!restore) {
|
|
988
|
-
|
|
1029
|
+
_context18.next = 14;
|
|
989
1030
|
break;
|
|
990
1031
|
}
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
return
|
|
1032
|
+
_this7.setRegRetry(true);
|
|
1033
|
+
_context18.next = 8;
|
|
1034
|
+
return _this7.deregister();
|
|
994
1035
|
case 8:
|
|
995
|
-
|
|
996
|
-
return
|
|
1036
|
+
_context18.next = 10;
|
|
1037
|
+
return _this7.restorePreviousRegistration(caller);
|
|
997
1038
|
case 10:
|
|
998
|
-
finalError =
|
|
999
|
-
|
|
1000
|
-
if (
|
|
1039
|
+
finalError = _context18.sent;
|
|
1040
|
+
_this7.setRegRetry(false);
|
|
1041
|
+
if (_this7.isDeviceRegistered()) {
|
|
1001
1042
|
_Logger.default.info('Registration restored successfully.', logContext);
|
|
1002
1043
|
}
|
|
1003
|
-
return
|
|
1044
|
+
return _context18.abrupt("return", finalError);
|
|
1004
1045
|
case 14:
|
|
1005
|
-
|
|
1006
|
-
|
|
1046
|
+
_this7.lineEmitter(_types3.LINE_EVENTS.UNREGISTERED);
|
|
1047
|
+
_context18.next = 18;
|
|
1007
1048
|
break;
|
|
1008
1049
|
case 17:
|
|
1009
|
-
|
|
1050
|
+
_this7.lineEmitter(_types3.LINE_EVENTS.UNREGISTERED);
|
|
1010
1051
|
case 18:
|
|
1011
|
-
return
|
|
1052
|
+
return _context18.abrupt("return", false);
|
|
1012
1053
|
case 19:
|
|
1013
1054
|
case "end":
|
|
1014
|
-
return
|
|
1055
|
+
return _context18.stop();
|
|
1015
1056
|
}
|
|
1016
|
-
},
|
|
1057
|
+
}, _callee18);
|
|
1017
1058
|
}));
|
|
1018
1059
|
return function (_x1, _x10) {
|
|
1019
|
-
return
|
|
1060
|
+
return _ref1.apply(this, arguments);
|
|
1020
1061
|
};
|
|
1021
1062
|
}();
|
|
1022
1063
|
}
|
|
@@ -1028,30 +1069,30 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
1028
1069
|
}, {
|
|
1029
1070
|
key: "triggerRegistration",
|
|
1030
1071
|
value: (function () {
|
|
1031
|
-
var _triggerRegistration = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1072
|
+
var _triggerRegistration = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19() {
|
|
1032
1073
|
var abort;
|
|
1033
|
-
return _regenerator.default.wrap(function
|
|
1034
|
-
while (1) switch (
|
|
1074
|
+
return _regenerator.default.wrap(function _callee19$(_context19) {
|
|
1075
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1035
1076
|
case 0:
|
|
1036
1077
|
if (!(this.primaryMobiusUris.length > 0)) {
|
|
1037
|
-
|
|
1078
|
+
_context19.next = 7;
|
|
1038
1079
|
break;
|
|
1039
1080
|
}
|
|
1040
|
-
|
|
1081
|
+
_context19.next = 3;
|
|
1041
1082
|
return this.attemptRegistrationWithServers(_constants2.REGISTRATION_UTIL, this.primaryMobiusUris);
|
|
1042
1083
|
case 3:
|
|
1043
|
-
abort =
|
|
1084
|
+
abort = _context19.sent;
|
|
1044
1085
|
if (!(!this.isDeviceRegistered() && !abort)) {
|
|
1045
|
-
|
|
1086
|
+
_context19.next = 7;
|
|
1046
1087
|
break;
|
|
1047
1088
|
}
|
|
1048
|
-
|
|
1089
|
+
_context19.next = 7;
|
|
1049
1090
|
return this.startFailoverTimer();
|
|
1050
1091
|
case 7:
|
|
1051
1092
|
case "end":
|
|
1052
|
-
return
|
|
1093
|
+
return _context19.stop();
|
|
1053
1094
|
}
|
|
1054
|
-
},
|
|
1095
|
+
}, _callee19, this);
|
|
1055
1096
|
}));
|
|
1056
1097
|
function triggerRegistration() {
|
|
1057
1098
|
return _triggerRegistration.apply(this, arguments);
|
|
@@ -1070,156 +1111,156 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
1070
1111
|
}, {
|
|
1071
1112
|
key: "attemptRegistrationWithServers",
|
|
1072
1113
|
value: (function () {
|
|
1073
|
-
var _attemptRegistrationWithServers = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1074
|
-
var
|
|
1114
|
+
var _attemptRegistrationWithServers = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20(caller) {
|
|
1115
|
+
var _this8 = this;
|
|
1075
1116
|
var servers,
|
|
1076
1117
|
abort,
|
|
1077
1118
|
_iterator2,
|
|
1078
1119
|
_step2,
|
|
1079
1120
|
_loop,
|
|
1080
1121
|
_ret,
|
|
1081
|
-
|
|
1082
|
-
return _regenerator.default.wrap(function
|
|
1083
|
-
while (1) switch (
|
|
1122
|
+
_args21 = arguments;
|
|
1123
|
+
return _regenerator.default.wrap(function _callee20$(_context21) {
|
|
1124
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1084
1125
|
case 0:
|
|
1085
|
-
servers =
|
|
1126
|
+
servers = _args21.length > 1 && _args21[1] !== undefined ? _args21[1] : this.primaryMobiusUris;
|
|
1086
1127
|
abort = false;
|
|
1087
1128
|
this.retryAfter = undefined;
|
|
1088
1129
|
if (!this.failoverImmediately) {
|
|
1089
|
-
|
|
1130
|
+
_context21.next = 5;
|
|
1090
1131
|
break;
|
|
1091
1132
|
}
|
|
1092
|
-
return
|
|
1133
|
+
return _context21.abrupt("return", abort);
|
|
1093
1134
|
case 5:
|
|
1094
1135
|
if (!this.isDeviceRegistered()) {
|
|
1095
|
-
|
|
1136
|
+
_context21.next = 8;
|
|
1096
1137
|
break;
|
|
1097
1138
|
}
|
|
1098
1139
|
_Logger.default.info("[".concat(caller, "] : Device already registered with : ").concat(this.activeMobiusUrl), {
|
|
1099
1140
|
file: _constants2.REGISTRATION_FILE,
|
|
1100
1141
|
method: _constants2.REGISTER_UTIL
|
|
1101
1142
|
});
|
|
1102
|
-
return
|
|
1143
|
+
return _context21.abrupt("return", abort);
|
|
1103
1144
|
case 8:
|
|
1104
1145
|
_iterator2 = _createForOfIteratorHelper(servers);
|
|
1105
|
-
|
|
1146
|
+
_context21.prev = 9;
|
|
1106
1147
|
_loop = /*#__PURE__*/_regenerator.default.mark(function _loop() {
|
|
1107
|
-
var
|
|
1108
|
-
var url, serverType,
|
|
1109
|
-
return _regenerator.default.wrap(function _loop$(
|
|
1110
|
-
while (1) switch (
|
|
1148
|
+
var _this8$backupMobiusUr;
|
|
1149
|
+
var url, serverType, _this8$deviceInfo$dev, _resp$headers, _resp$headers$trackin, _resp$headers2, _this8$deviceInfo$dev2, resp, body;
|
|
1150
|
+
return _regenerator.default.wrap(function _loop$(_context20) {
|
|
1151
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1111
1152
|
case 0:
|
|
1112
1153
|
url = _step2.value;
|
|
1113
|
-
serverType =
|
|
1114
|
-
|
|
1154
|
+
serverType = _this8.primaryMobiusUris.includes(url) && 'PRIMARY' || ((_this8$backupMobiusUr = _this8.backupMobiusUris) === null || _this8$backupMobiusUr === void 0 ? void 0 : _this8$backupMobiusUr.includes(url)) && 'BACKUP' || 'UNKNOWN';
|
|
1155
|
+
_context20.prev = 2;
|
|
1115
1156
|
abort = false;
|
|
1116
|
-
|
|
1117
|
-
|
|
1157
|
+
_this8.registrationStatus = _types2.RegistrationStatus.INACTIVE;
|
|
1158
|
+
_this8.lineEmitter(_types3.LINE_EVENTS.CONNECTING);
|
|
1118
1159
|
_Logger.default.info("[".concat(caller, "] : Mobius url to contact: ").concat(url), {
|
|
1119
1160
|
file: _constants2.REGISTRATION_FILE,
|
|
1120
1161
|
method: _constants2.REGISTER_UTIL
|
|
1121
1162
|
});
|
|
1122
1163
|
// eslint-disable-next-line no-await-in-loop
|
|
1123
|
-
|
|
1124
|
-
return
|
|
1164
|
+
_context20.next = 9;
|
|
1165
|
+
return _this8.postRegistration(url);
|
|
1125
1166
|
case 9:
|
|
1126
|
-
resp =
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
_Logger.default.log("Registration successful for deviceId: ".concat((
|
|
1167
|
+
resp = _context20.sent;
|
|
1168
|
+
_this8.deviceInfo = resp.body;
|
|
1169
|
+
_this8.registrationStatus = _types2.RegistrationStatus.ACTIVE;
|
|
1170
|
+
_this8.setActiveMobiusUrl(url);
|
|
1171
|
+
_this8.lineEmitter(_types3.LINE_EVENTS.REGISTERED, resp.body);
|
|
1172
|
+
_Logger.default.log("Registration successful for deviceId: ".concat((_this8$deviceInfo$dev = _this8.deviceInfo.device) === null || _this8$deviceInfo$dev === void 0 ? void 0 : _this8$deviceInfo$dev.deviceId, " userId: ").concat(_this8.userId, " responseTrackingId: ").concat((_resp$headers = resp.headers) === null || _resp$headers === void 0 ? void 0 : _resp$headers.trackingid), {
|
|
1132
1173
|
file: _constants2.REGISTRATION_FILE,
|
|
1133
1174
|
method: _constants2.METHODS.REGISTER
|
|
1134
1175
|
});
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
return
|
|
1176
|
+
_this8.setIntervalValues(_this8.deviceInfo);
|
|
1177
|
+
_this8.metricManager.setDeviceInfo(_this8.deviceInfo);
|
|
1178
|
+
_this8.metricManager.submitRegistrationMetric(_types.METRIC_EVENT.REGISTRATION, _types.REG_ACTION.REGISTER, _types.METRIC_TYPE.BEHAVIORAL, caller, serverType, (_resp$headers$trackin = (_resp$headers2 = resp.headers) === null || _resp$headers2 === void 0 ? void 0 : _resp$headers2.trackingid) !== null && _resp$headers$trackin !== void 0 ? _resp$headers$trackin : '', undefined, undefined);
|
|
1179
|
+
_this8.startKeepaliveTimer((_this8$deviceInfo$dev2 = _this8.deviceInfo.device) === null || _this8$deviceInfo$dev2 === void 0 ? void 0 : _this8$deviceInfo$dev2.uri, _this8.deviceInfo.keepaliveInterval, serverType);
|
|
1180
|
+
_this8.initiateFailback();
|
|
1181
|
+
return _context20.abrupt("return", 0);
|
|
1141
1182
|
case 23:
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
body =
|
|
1145
|
-
|
|
1183
|
+
_context20.prev = 23;
|
|
1184
|
+
_context20.t0 = _context20["catch"](2);
|
|
1185
|
+
body = _context20.t0; // eslint-disable-next-line no-await-in-loop, @typescript-eslint/no-unused-vars
|
|
1186
|
+
_context20.next = 28;
|
|
1146
1187
|
return (0, _common.handleRegistrationErrors)(body, function (clientError, finalError) {
|
|
1147
1188
|
var _body$headers$trackin, _body$headers;
|
|
1148
1189
|
if (finalError) {
|
|
1149
|
-
|
|
1190
|
+
_this8.lineEmitter(_types3.LINE_EVENTS.ERROR, undefined, clientError);
|
|
1150
1191
|
} else {
|
|
1151
|
-
|
|
1192
|
+
_this8.lineEmitter(_types3.LINE_EVENTS.UNREGISTERED);
|
|
1152
1193
|
}
|
|
1153
|
-
|
|
1194
|
+
_this8.metricManager.submitRegistrationMetric(_types.METRIC_EVENT.REGISTRATION_ERROR, _types.REG_ACTION.REGISTER, _types.METRIC_TYPE.BEHAVIORAL, caller, serverType, (_body$headers$trackin = (_body$headers = body.headers) === null || _body$headers === void 0 ? void 0 : _body$headers.trackingid) !== null && _body$headers$trackin !== void 0 ? _body$headers$trackin : '', undefined, clientError);
|
|
1154
1195
|
}, {
|
|
1155
1196
|
method: caller,
|
|
1156
1197
|
file: _constants2.REGISTRATION_FILE
|
|
1157
1198
|
}, function (retryAfter, retryCaller) {
|
|
1158
|
-
return
|
|
1159
|
-
},
|
|
1199
|
+
return _this8.handle429Retry(retryAfter, retryCaller);
|
|
1200
|
+
}, _this8.restoreRegistrationCallBack());
|
|
1160
1201
|
case 28:
|
|
1161
|
-
abort =
|
|
1162
|
-
if (!(
|
|
1163
|
-
|
|
1202
|
+
abort = _context20.sent;
|
|
1203
|
+
if (!(_this8.registrationStatus === _types2.RegistrationStatus.ACTIVE)) {
|
|
1204
|
+
_context20.next = 32;
|
|
1164
1205
|
break;
|
|
1165
1206
|
}
|
|
1166
|
-
_Logger.default.info("[".concat(caller, "] : Device is already restored, active mobius url: ").concat(
|
|
1207
|
+
_Logger.default.info("[".concat(caller, "] : Device is already restored, active mobius url: ").concat(_this8.activeMobiusUrl), {
|
|
1167
1208
|
file: _constants2.REGISTRATION_FILE,
|
|
1168
|
-
method:
|
|
1209
|
+
method: _this8.attemptRegistrationWithServers.name
|
|
1169
1210
|
});
|
|
1170
|
-
return
|
|
1211
|
+
return _context20.abrupt("return", 0);
|
|
1171
1212
|
case 32:
|
|
1172
1213
|
if (!abort) {
|
|
1173
|
-
|
|
1214
|
+
_context20.next = 37;
|
|
1174
1215
|
break;
|
|
1175
1216
|
}
|
|
1176
|
-
|
|
1217
|
+
_this8.setStatus(_types2.RegistrationStatus.INACTIVE);
|
|
1177
1218
|
// eslint-disable-next-line no-await-in-loop
|
|
1178
|
-
|
|
1219
|
+
_context20.next = 36;
|
|
1179
1220
|
return (0, _common.uploadLogs)();
|
|
1180
1221
|
case 36:
|
|
1181
|
-
return
|
|
1222
|
+
return _context20.abrupt("return", 0);
|
|
1182
1223
|
case 37:
|
|
1183
1224
|
case "end":
|
|
1184
|
-
return
|
|
1225
|
+
return _context20.stop();
|
|
1185
1226
|
}
|
|
1186
1227
|
}, _loop, null, [[2, 23]]);
|
|
1187
1228
|
});
|
|
1188
1229
|
_iterator2.s();
|
|
1189
1230
|
case 12:
|
|
1190
1231
|
if ((_step2 = _iterator2.n()).done) {
|
|
1191
|
-
|
|
1232
|
+
_context21.next = 19;
|
|
1192
1233
|
break;
|
|
1193
1234
|
}
|
|
1194
|
-
return
|
|
1235
|
+
return _context21.delegateYield(_loop(), "t0", 14);
|
|
1195
1236
|
case 14:
|
|
1196
|
-
_ret =
|
|
1237
|
+
_ret = _context21.t0;
|
|
1197
1238
|
if (!(_ret === 0)) {
|
|
1198
|
-
|
|
1239
|
+
_context21.next = 17;
|
|
1199
1240
|
break;
|
|
1200
1241
|
}
|
|
1201
|
-
return
|
|
1242
|
+
return _context21.abrupt("break", 19);
|
|
1202
1243
|
case 17:
|
|
1203
|
-
|
|
1244
|
+
_context21.next = 12;
|
|
1204
1245
|
break;
|
|
1205
1246
|
case 19:
|
|
1206
|
-
|
|
1247
|
+
_context21.next = 24;
|
|
1207
1248
|
break;
|
|
1208
1249
|
case 21:
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
_iterator2.e(
|
|
1250
|
+
_context21.prev = 21;
|
|
1251
|
+
_context21.t1 = _context21["catch"](9);
|
|
1252
|
+
_iterator2.e(_context21.t1);
|
|
1212
1253
|
case 24:
|
|
1213
|
-
|
|
1254
|
+
_context21.prev = 24;
|
|
1214
1255
|
_iterator2.f();
|
|
1215
|
-
return
|
|
1256
|
+
return _context21.finish(24);
|
|
1216
1257
|
case 27:
|
|
1217
|
-
return
|
|
1258
|
+
return _context21.abrupt("return", abort);
|
|
1218
1259
|
case 28:
|
|
1219
1260
|
case "end":
|
|
1220
|
-
return
|
|
1261
|
+
return _context21.stop();
|
|
1221
1262
|
}
|
|
1222
|
-
},
|
|
1263
|
+
}, _callee20, this, [[9, 21, 24, 27]]);
|
|
1223
1264
|
}));
|
|
1224
1265
|
function attemptRegistrationWithServers(_x11) {
|
|
1225
1266
|
return _attemptRegistrationWithServers.apply(this, arguments);
|
|
@@ -1234,48 +1275,48 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
1234
1275
|
}, {
|
|
1235
1276
|
key: "startKeepaliveTimer",
|
|
1236
1277
|
value: (function () {
|
|
1237
|
-
var _startKeepaliveTimer = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1238
|
-
var
|
|
1278
|
+
var _startKeepaliveTimer = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23(url, interval, serverType) {
|
|
1279
|
+
var _this9 = this;
|
|
1239
1280
|
var RETRY_COUNT_THRESHOLD;
|
|
1240
|
-
return _regenerator.default.wrap(function
|
|
1241
|
-
while (1) switch (
|
|
1281
|
+
return _regenerator.default.wrap(function _callee23$(_context24) {
|
|
1282
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1242
1283
|
case 0:
|
|
1243
1284
|
this.clearKeepaliveTimer();
|
|
1244
1285
|
RETRY_COUNT_THRESHOLD = this.isCCFlow ? 4 : 5;
|
|
1245
|
-
|
|
1246
|
-
return this.mutex.runExclusive(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1286
|
+
_context24.next = 4;
|
|
1287
|
+
return this.mutex.runExclusive(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22() {
|
|
1247
1288
|
var accessToken, blob, blobUrl;
|
|
1248
|
-
return _regenerator.default.wrap(function
|
|
1249
|
-
while (1) switch (
|
|
1289
|
+
return _regenerator.default.wrap(function _callee22$(_context23) {
|
|
1290
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1250
1291
|
case 0:
|
|
1251
|
-
if (!
|
|
1252
|
-
|
|
1292
|
+
if (!_this9.isDeviceRegistered()) {
|
|
1293
|
+
_context23.next = 5;
|
|
1253
1294
|
break;
|
|
1254
1295
|
}
|
|
1255
|
-
|
|
1256
|
-
return
|
|
1296
|
+
_context23.next = 3;
|
|
1297
|
+
return _this9.webex.credentials.getUserToken();
|
|
1257
1298
|
case 3:
|
|
1258
|
-
accessToken =
|
|
1259
|
-
if (!
|
|
1299
|
+
accessToken = _context23.sent;
|
|
1300
|
+
if (!_this9.webWorker) {
|
|
1260
1301
|
blob = new Blob([_webWorkerStr.default], {
|
|
1261
1302
|
type: 'application/javascript'
|
|
1262
1303
|
});
|
|
1263
1304
|
blobUrl = URL.createObjectURL(blob);
|
|
1264
|
-
|
|
1305
|
+
_this9.webWorker = new Worker(blobUrl);
|
|
1265
1306
|
URL.revokeObjectURL(blobUrl);
|
|
1266
|
-
|
|
1307
|
+
_this9.webWorker.postMessage({
|
|
1267
1308
|
type: _types2.WorkerMessageType.START_KEEPALIVE,
|
|
1268
1309
|
accessToken: String(accessToken),
|
|
1269
|
-
deviceUrl: String(
|
|
1310
|
+
deviceUrl: String(_this9.webex.internal.device.url),
|
|
1270
1311
|
interval: interval,
|
|
1271
1312
|
retryCountThreshold: RETRY_COUNT_THRESHOLD,
|
|
1272
1313
|
url: url
|
|
1273
1314
|
});
|
|
1274
|
-
|
|
1275
|
-
var
|
|
1315
|
+
_this9.webWorker.onmessage = /*#__PURE__*/function () {
|
|
1316
|
+
var _ref11 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21(event) {
|
|
1276
1317
|
var logContext, error, abort;
|
|
1277
|
-
return _regenerator.default.wrap(function
|
|
1278
|
-
while (1) switch (
|
|
1318
|
+
return _regenerator.default.wrap(function _callee21$(_context22) {
|
|
1319
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1279
1320
|
case 0:
|
|
1280
1321
|
logContext = {
|
|
1281
1322
|
file: _constants2.REGISTRATION_FILE,
|
|
@@ -1283,81 +1324,81 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
1283
1324
|
};
|
|
1284
1325
|
if (event.data.type === _types2.WorkerMessageType.KEEPALIVE_SUCCESS) {
|
|
1285
1326
|
_Logger.default.info("Sent Keepalive, status: ".concat(event.data.statusCode), logContext);
|
|
1286
|
-
|
|
1327
|
+
_this9.lineEmitter(_types3.LINE_EVENTS.RECONNECTED);
|
|
1287
1328
|
}
|
|
1288
1329
|
if (!(event.data.type === _types2.WorkerMessageType.KEEPALIVE_FAILURE)) {
|
|
1289
|
-
|
|
1330
|
+
_context22.next = 25;
|
|
1290
1331
|
break;
|
|
1291
1332
|
}
|
|
1292
1333
|
error = event.data.err;
|
|
1293
1334
|
_Logger.default.warn("Keep-alive missed ".concat(event.data.keepAliveRetryCount, " times. Status -> ").concat(error.statusCode, " "), logContext);
|
|
1294
|
-
|
|
1335
|
+
_context22.next = 7;
|
|
1295
1336
|
return (0, _common.handleRegistrationErrors)(error, function (clientError, finalError) {
|
|
1296
1337
|
var _error$headers$tracki, _error$headers;
|
|
1297
1338
|
if (finalError) {
|
|
1298
|
-
|
|
1339
|
+
_this9.lineEmitter(_types3.LINE_EVENTS.ERROR, undefined, clientError);
|
|
1299
1340
|
}
|
|
1300
|
-
|
|
1341
|
+
_this9.metricManager.submitRegistrationMetric(_types.METRIC_EVENT.KEEPALIVE_ERROR, _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);
|
|
1301
1342
|
}, {
|
|
1302
1343
|
method: _constants2.KEEPALIVE_UTIL,
|
|
1303
1344
|
file: _constants2.REGISTRATION_FILE
|
|
1304
1345
|
}, function (retryAfter, retryCaller) {
|
|
1305
|
-
return
|
|
1346
|
+
return _this9.handle429Retry(retryAfter, retryCaller);
|
|
1306
1347
|
});
|
|
1307
1348
|
case 7:
|
|
1308
|
-
abort =
|
|
1349
|
+
abort = _context22.sent;
|
|
1309
1350
|
if (!(abort || event.data.keepAliveRetryCount >= RETRY_COUNT_THRESHOLD)) {
|
|
1310
|
-
|
|
1351
|
+
_context22.next = 24;
|
|
1311
1352
|
break;
|
|
1312
1353
|
}
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1354
|
+
_this9.failoverImmediately = _this9.isCCFlow;
|
|
1355
|
+
_this9.setStatus(_types2.RegistrationStatus.INACTIVE);
|
|
1356
|
+
_this9.clearKeepaliveTimer();
|
|
1357
|
+
_this9.clearFailbackTimer();
|
|
1358
|
+
_this9.lineEmitter(_types3.LINE_EVENTS.UNREGISTERED);
|
|
1359
|
+
_context22.next = 16;
|
|
1319
1360
|
return (0, _common.uploadLogs)();
|
|
1320
1361
|
case 16:
|
|
1321
1362
|
if (abort) {
|
|
1322
|
-
|
|
1363
|
+
_context22.next = 21;
|
|
1323
1364
|
break;
|
|
1324
1365
|
}
|
|
1325
|
-
|
|
1326
|
-
return
|
|
1366
|
+
_context22.next = 19;
|
|
1367
|
+
return _this9.reconnectOnFailure(_constants2.RECONNECT_ON_FAILURE_UTIL);
|
|
1327
1368
|
case 19:
|
|
1328
|
-
|
|
1369
|
+
_context22.next = 22;
|
|
1329
1370
|
break;
|
|
1330
1371
|
case 21:
|
|
1331
1372
|
if (error.statusCode === 404) {
|
|
1332
|
-
|
|
1373
|
+
_this9.handle404KeepaliveFailure(_constants2.KEEPALIVE_UTIL);
|
|
1333
1374
|
}
|
|
1334
1375
|
case 22:
|
|
1335
|
-
|
|
1376
|
+
_context22.next = 25;
|
|
1336
1377
|
break;
|
|
1337
1378
|
case 24:
|
|
1338
|
-
|
|
1379
|
+
_this9.lineEmitter(_types3.LINE_EVENTS.RECONNECTING);
|
|
1339
1380
|
case 25:
|
|
1340
1381
|
case "end":
|
|
1341
|
-
return
|
|
1382
|
+
return _context22.stop();
|
|
1342
1383
|
}
|
|
1343
|
-
},
|
|
1384
|
+
}, _callee21);
|
|
1344
1385
|
}));
|
|
1345
1386
|
return function (_x15) {
|
|
1346
|
-
return
|
|
1387
|
+
return _ref11.apply(this, arguments);
|
|
1347
1388
|
};
|
|
1348
1389
|
}();
|
|
1349
1390
|
}
|
|
1350
1391
|
case 5:
|
|
1351
1392
|
case "end":
|
|
1352
|
-
return
|
|
1393
|
+
return _context23.stop();
|
|
1353
1394
|
}
|
|
1354
|
-
},
|
|
1395
|
+
}, _callee22);
|
|
1355
1396
|
})));
|
|
1356
1397
|
case 4:
|
|
1357
1398
|
case "end":
|
|
1358
|
-
return
|
|
1399
|
+
return _context24.stop();
|
|
1359
1400
|
}
|
|
1360
|
-
},
|
|
1401
|
+
}, _callee23, this);
|
|
1361
1402
|
}));
|
|
1362
1403
|
function startKeepaliveTimer(_x12, _x13, _x14) {
|
|
1363
1404
|
return _startKeepaliveTimer.apply(this, arguments);
|
|
@@ -1387,25 +1428,25 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
1387
1428
|
}, {
|
|
1388
1429
|
key: "deregister",
|
|
1389
1430
|
value: function () {
|
|
1390
|
-
var _deregister = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1391
|
-
var _this$deviceInfo$
|
|
1392
|
-
return _regenerator.default.wrap(function
|
|
1393
|
-
while (1) switch (
|
|
1431
|
+
var _deregister = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee24() {
|
|
1432
|
+
var _this$deviceInfo$devi, _this$deviceInfo$devi2;
|
|
1433
|
+
return _regenerator.default.wrap(function _callee24$(_context25) {
|
|
1434
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1394
1435
|
case 0:
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
return this.deleteRegistration(this.activeMobiusUrl, (_this$deviceInfo$
|
|
1436
|
+
_context25.prev = 0;
|
|
1437
|
+
_context25.next = 3;
|
|
1438
|
+
return this.deleteRegistration(this.activeMobiusUrl, (_this$deviceInfo$devi = this.deviceInfo.device) === null || _this$deviceInfo$devi === void 0 ? void 0 : _this$deviceInfo$devi.deviceId, (_this$deviceInfo$devi2 = this.deviceInfo.device) === null || _this$deviceInfo$devi2 === void 0 ? void 0 : _this$deviceInfo$devi2.clientDeviceUri);
|
|
1398
1439
|
case 3:
|
|
1399
1440
|
_Logger.default.log('Registration successfully deregistered', {
|
|
1400
1441
|
file: _constants2.REGISTRATION_FILE,
|
|
1401
1442
|
method: _constants2.METHODS.DEREGISTER
|
|
1402
1443
|
});
|
|
1403
|
-
|
|
1444
|
+
_context25.next = 9;
|
|
1404
1445
|
break;
|
|
1405
1446
|
case 6:
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
_Logger.default.warn("Delete failed with Mobius: ".concat((0, _stringify.default)(
|
|
1447
|
+
_context25.prev = 6;
|
|
1448
|
+
_context25.t0 = _context25["catch"](0);
|
|
1449
|
+
_Logger.default.warn("Delete failed with Mobius: ".concat((0, _stringify.default)(_context25.t0)), {
|
|
1409
1450
|
file: _constants2.REGISTRATION_FILE,
|
|
1410
1451
|
method: _constants2.METHODS.DEREGISTER
|
|
1411
1452
|
});
|
|
@@ -1414,9 +1455,9 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
1414
1455
|
this.setStatus(_types2.RegistrationStatus.INACTIVE);
|
|
1415
1456
|
case 11:
|
|
1416
1457
|
case "end":
|
|
1417
|
-
return
|
|
1458
|
+
return _context25.stop();
|
|
1418
1459
|
}
|
|
1419
|
-
},
|
|
1460
|
+
}, _callee24, this, [[0, 6]]);
|
|
1420
1461
|
}));
|
|
1421
1462
|
function deregister() {
|
|
1422
1463
|
return _deregister.apply(this, arguments);
|
|
@@ -1480,10 +1521,10 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
1480
1521
|
}, {
|
|
1481
1522
|
key: "reconnectOnFailure",
|
|
1482
1523
|
value: (function () {
|
|
1483
|
-
var _reconnectOnFailure = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1524
|
+
var _reconnectOnFailure = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee25(caller) {
|
|
1484
1525
|
var abort;
|
|
1485
|
-
return _regenerator.default.wrap(function
|
|
1486
|
-
while (1) switch (
|
|
1526
|
+
return _regenerator.default.wrap(function _callee25$(_context26) {
|
|
1527
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1487
1528
|
case 0:
|
|
1488
1529
|
_Logger.default.info(_constants.METHOD_START_MESSAGE, {
|
|
1489
1530
|
method: _constants2.METHODS.RECONNECT_ON_FAILURE,
|
|
@@ -1491,25 +1532,25 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
1491
1532
|
});
|
|
1492
1533
|
this.reconnectPending = false;
|
|
1493
1534
|
if (this.isDeviceRegistered()) {
|
|
1494
|
-
|
|
1535
|
+
_context26.next = 14;
|
|
1495
1536
|
break;
|
|
1496
1537
|
}
|
|
1497
1538
|
if (!((0, _keys.default)(this.callManager.getActiveCalls()).length === 0)) {
|
|
1498
|
-
|
|
1539
|
+
_context26.next = 12;
|
|
1499
1540
|
break;
|
|
1500
1541
|
}
|
|
1501
|
-
|
|
1542
|
+
_context26.next = 6;
|
|
1502
1543
|
return this.restorePreviousRegistration(caller);
|
|
1503
1544
|
case 6:
|
|
1504
|
-
abort =
|
|
1545
|
+
abort = _context26.sent;
|
|
1505
1546
|
if (!(!abort && !this.isDeviceRegistered())) {
|
|
1506
|
-
|
|
1547
|
+
_context26.next = 10;
|
|
1507
1548
|
break;
|
|
1508
1549
|
}
|
|
1509
|
-
|
|
1550
|
+
_context26.next = 10;
|
|
1510
1551
|
return this.restartRegistration(caller);
|
|
1511
1552
|
case 10:
|
|
1512
|
-
|
|
1553
|
+
_context26.next = 14;
|
|
1513
1554
|
break;
|
|
1514
1555
|
case 12:
|
|
1515
1556
|
this.reconnectPending = true;
|
|
@@ -1519,9 +1560,9 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
|
|
|
1519
1560
|
});
|
|
1520
1561
|
case 14:
|
|
1521
1562
|
case "end":
|
|
1522
|
-
return
|
|
1563
|
+
return _context26.stop();
|
|
1523
1564
|
}
|
|
1524
|
-
},
|
|
1565
|
+
}, _callee25, this);
|
|
1525
1566
|
}));
|
|
1526
1567
|
function reconnectOnFailure(_x16) {
|
|
1527
1568
|
return _reconnectOnFailure.apply(this, arguments);
|