@webex/calling 3.10.0-next.13 → 3.10.0-next.15

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.
Files changed (95) hide show
  1. package/dist/CallHistory/CallHistory.js +118 -124
  2. package/dist/CallHistory/CallHistory.js.map +1 -1
  3. package/dist/CallHistory/CallHistory.test.js +189 -201
  4. package/dist/CallHistory/CallHistory.test.js.map +1 -1
  5. package/dist/CallSettings/CallSettings.js +17 -18
  6. package/dist/CallSettings/CallSettings.js.map +1 -1
  7. package/dist/CallSettings/CallSettings.test.js +14 -14
  8. package/dist/CallSettings/CallSettings.test.js.map +1 -1
  9. package/dist/CallSettings/UcmBackendConnector.js +71 -24
  10. package/dist/CallSettings/UcmBackendConnector.js.map +1 -1
  11. package/dist/CallSettings/UcmBackendConnector.test.js +136 -47
  12. package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -1
  13. package/dist/CallSettings/WxCallBackendConnector.js +135 -137
  14. package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
  15. package/dist/CallSettings/WxCallBackendConnector.test.js +145 -149
  16. package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -1
  17. package/dist/CallingClient/CallingClient.js +198 -201
  18. package/dist/CallingClient/CallingClient.js.map +1 -1
  19. package/dist/CallingClient/CallingClient.test.js +168 -168
  20. package/dist/CallingClient/CallingClient.test.js.map +1 -1
  21. package/dist/CallingClient/calling/CallerId/index.js +7 -8
  22. package/dist/CallingClient/calling/CallerId/index.js.map +1 -1
  23. package/dist/CallingClient/calling/CallerId/index.test.js +24 -24
  24. package/dist/CallingClient/calling/CallerId/index.test.js.map +1 -1
  25. package/dist/CallingClient/calling/call.js +364 -366
  26. package/dist/CallingClient/calling/call.js.map +1 -1
  27. package/dist/CallingClient/calling/call.test.js +340 -340
  28. package/dist/CallingClient/calling/call.test.js.map +1 -1
  29. package/dist/CallingClient/calling/callManager.js +15 -18
  30. package/dist/CallingClient/calling/callManager.js.map +1 -1
  31. package/dist/CallingClient/calling/callManager.test.js +113 -113
  32. package/dist/CallingClient/calling/callManager.test.js.map +1 -1
  33. package/dist/CallingClient/line/index.js +57 -74
  34. package/dist/CallingClient/line/index.js.map +1 -1
  35. package/dist/CallingClient/line/line.test.js +22 -22
  36. package/dist/CallingClient/line/line.test.js.map +1 -1
  37. package/dist/CallingClient/registration/register.js +293 -300
  38. package/dist/CallingClient/registration/register.js.map +1 -1
  39. package/dist/CallingClient/registration/register.test.js +246 -246
  40. package/dist/CallingClient/registration/register.test.js.map +1 -1
  41. package/dist/CallingClient/registration/webWorker.js +24 -24
  42. package/dist/CallingClient/registration/webWorker.js.map +1 -1
  43. package/dist/CallingClient/registration/webWorker.test.js +20 -20
  44. package/dist/CallingClient/registration/webWorker.test.js.map +1 -1
  45. package/dist/CallingClient/windowsChromiumIceWarmupUtils.js +28 -28
  46. package/dist/CallingClient/windowsChromiumIceWarmupUtils.js.map +1 -1
  47. package/dist/Contacts/ContactsClient.js +250 -253
  48. package/dist/Contacts/ContactsClient.js.map +1 -1
  49. package/dist/Contacts/ContactsClient.test.js +60 -60
  50. package/dist/Contacts/ContactsClient.test.js.map +1 -1
  51. package/dist/Errors/catalog/CallError.js +7 -10
  52. package/dist/Errors/catalog/CallError.js.map +1 -1
  53. package/dist/Errors/catalog/CallingDeviceError.js +6 -9
  54. package/dist/Errors/catalog/CallingDeviceError.js.map +1 -1
  55. package/dist/Errors/catalog/ExtendedError.js +6 -8
  56. package/dist/Errors/catalog/ExtendedError.js.map +1 -1
  57. package/dist/Errors/catalog/LineError.js +6 -9
  58. package/dist/Errors/catalog/LineError.js.map +1 -1
  59. package/dist/Events/impl/index.js +11 -13
  60. package/dist/Events/impl/index.js.map +1 -1
  61. package/dist/Metrics/index.js +1 -2
  62. package/dist/Metrics/index.js.map +1 -1
  63. package/dist/SDKConnector/index.js +1 -2
  64. package/dist/SDKConnector/index.js.map +1 -1
  65. package/dist/Voicemail/BroadworksBackendConnector.js +126 -127
  66. package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -1
  67. package/dist/Voicemail/BroadworksBackendConnector.test.js +98 -98
  68. package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -1
  69. package/dist/Voicemail/UcmBackendConnector.js +84 -85
  70. package/dist/Voicemail/UcmBackendConnector.js.map +1 -1
  71. package/dist/Voicemail/UcmBackendConnector.test.js +72 -72
  72. package/dist/Voicemail/UcmBackendConnector.test.js.map +1 -1
  73. package/dist/Voicemail/Voicemail.js +58 -61
  74. package/dist/Voicemail/Voicemail.js.map +1 -1
  75. package/dist/Voicemail/Voicemail.test.js +20 -20
  76. package/dist/Voicemail/Voicemail.test.js.map +1 -1
  77. package/dist/Voicemail/WxCallBackendConnector.js +116 -117
  78. package/dist/Voicemail/WxCallBackendConnector.js.map +1 -1
  79. package/dist/Voicemail/WxCallBackendConnector.test.js +140 -140
  80. package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -1
  81. package/dist/common/Utils.js +168 -167
  82. package/dist/common/Utils.js.map +1 -1
  83. package/dist/common/Utils.test.js +120 -120
  84. package/dist/common/Utils.test.js.map +1 -1
  85. package/dist/common/constants.js +3 -1
  86. package/dist/common/constants.js.map +1 -1
  87. package/dist/common/testUtil.js +3 -3
  88. package/dist/common/testUtil.js.map +1 -1
  89. package/dist/module/CallSettings/UcmBackendConnector.js +20 -6
  90. package/dist/module/common/constants.js +2 -0
  91. package/dist/types/CallSettings/UcmBackendConnector.d.ts +1 -0
  92. package/dist/types/CallSettings/UcmBackendConnector.d.ts.map +1 -1
  93. package/dist/types/common/constants.d.ts +2 -0
  94. package/dist/types/common/constants.d.ts.map +1 -1
  95. package/package.json +2 -2
@@ -94,7 +94,7 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
94
94
  this.primaryMobiusUris = [];
95
95
  this.backupMobiusUris = [];
96
96
  }
97
- (0, _createClass2.default)(Registration, [{
97
+ return (0, _createClass2.default)(Registration, [{
98
98
  key: "getActiveMobiusUrl",
99
99
  value: function getActiveMobiusUrl() {
100
100
  return this.activeMobiusUrl;
@@ -129,56 +129,49 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
129
129
  value: (function () {
130
130
  var _deleteRegistration = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(url, deviceId, deviceUrl) {
131
131
  var _response;
132
- var response;
133
- return _regenerator.default.wrap(function _callee$(_context) {
132
+ var response, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9;
133
+ return _regenerator.default.wrap(function (_context) {
134
134
  while (1) switch (_context.prev = _context.next) {
135
135
  case 0:
136
136
  _context.prev = 0;
137
- _context.t0 = fetch;
138
- _context.t1 = "".concat(url).concat(_constants2.DEVICES_ENDPOINT_RESOURCE, "/").concat(deviceId);
139
- _context.t2 = _types2.HTTP_METHODS.DELETE;
140
- _context.t3 = _defineProperty2.default;
141
- _context.t4 = _defineProperty2.default;
142
- _context.t5 = _defineProperty2.default;
143
- _context.t6 = (0, _defineProperty2.default)({}, _constants2.CISCO_DEVICE_URL, deviceUrl);
144
- _context.next = 10;
137
+ _t = fetch;
138
+ _t2 = "".concat(url).concat(_constants2.DEVICES_ENDPOINT_RESOURCE, "/").concat(deviceId);
139
+ _t3 = _types2.HTTP_METHODS.DELETE;
140
+ _t4 = _defineProperty2.default;
141
+ _t5 = _defineProperty2.default;
142
+ _t6 = _defineProperty2.default;
143
+ _t7 = (0, _defineProperty2.default)({}, _constants2.CISCO_DEVICE_URL, deviceUrl);
144
+ _context.next = 1;
145
145
  return this.webex.credentials.getUserToken();
146
- case 10:
147
- _context.t7 = _context.sent;
148
- _context.t8 = (0, _context.t5)(_context.t6, "Authorization", _context.t7);
149
- _context.t9 = "".concat(_constants2.WEBEX_WEB_CLIENT, "_").concat((0, _uuid.v4)());
150
- _context.t10 = (0, _context.t4)(_context.t8, "trackingId", _context.t9);
151
- _context.t11 = _constants2.SPARK_USER_AGENT;
152
- _context.t12 = _constants2.CALLING_USER_AGENT;
153
- _context.t13 = (0, _context.t3)(_context.t10, _context.t11, _context.t12);
154
- _context.t14 = {
155
- method: _context.t2,
156
- headers: _context.t13
157
- };
158
- _context.next = 20;
159
- return (0, _context.t0)(_context.t1, _context.t14);
160
- case 20:
146
+ case 1:
147
+ _t8 = _t4(_t5(_t6(_t7, "Authorization", _context.sent), "trackingId", "".concat(_constants2.WEBEX_WEB_CLIENT, "_").concat((0, _uuid.v4)())), _constants2.SPARK_USER_AGENT, _constants2.CALLING_USER_AGENT);
148
+ _context.next = 2;
149
+ return _t(_t2, {
150
+ method: _t3,
151
+ headers: _t8
152
+ });
153
+ case 2:
161
154
  response = _context.sent;
162
- _context.next = 28;
155
+ _context.next = 4;
163
156
  break;
164
- case 23:
165
- _context.prev = 23;
166
- _context.t15 = _context["catch"](0);
167
- _Logger.default.warn("Delete failed with Mobius: ".concat((0, _stringify.default)(_context.t15)), {
157
+ case 3:
158
+ _context.prev = 3;
159
+ _t9 = _context["catch"](0);
160
+ _Logger.default.warn("Delete failed with Mobius: ".concat((0, _stringify.default)(_t9)), {
168
161
  file: _constants2.REGISTRATION_FILE,
169
162
  method: _constants2.METHODS.DELETE_REGISTRATION
170
163
  });
171
- _context.next = 28;
164
+ _context.next = 4;
172
165
  return (0, _common.uploadLogs)();
173
- case 28:
166
+ case 4:
174
167
  this.setStatus(_types2.RegistrationStatus.INACTIVE);
175
168
  this.lineEmitter(_types3.LINE_EVENTS.UNREGISTERED);
176
169
  return _context.abrupt("return", (_response = response) === null || _response === void 0 ? void 0 : _response.json());
177
- case 31:
170
+ case 5:
178
171
  case "end":
179
172
  return _context.stop();
180
173
  }
181
- }, _callee, this, [[0, 23]]);
174
+ }, _callee, this, [[0, 3]]);
182
175
  }));
183
176
  function deleteRegistration(_x, _x2, _x3) {
184
177
  return _deleteRegistration.apply(this, arguments);
@@ -195,7 +188,7 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
195
188
  value: (function () {
196
189
  var _postRegistration = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2(url) {
197
190
  var deviceInfo;
198
- return _regenerator.default.wrap(function _callee2$(_context2) {
191
+ return _regenerator.default.wrap(function (_context2) {
199
192
  while (1) switch (_context2.prev = _context2.next) {
200
193
  case 0:
201
194
  deviceInfo = {
@@ -212,7 +205,7 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
212
205
  body: deviceInfo,
213
206
  service: _types2.ALLOWED_SERVICES.MOBIUS
214
207
  }));
215
- case 2:
208
+ case 1:
216
209
  case "end":
217
210
  return _context2.stop();
218
211
  }
@@ -234,61 +227,61 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
234
227
  var _restorePreviousRegistration = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4(caller) {
235
228
  var _this = this;
236
229
  var abort;
237
- return _regenerator.default.wrap(function _callee4$(_context4) {
230
+ return _regenerator.default.wrap(function (_context4) {
238
231
  while (1) switch (_context4.prev = _context4.next) {
239
232
  case 0:
240
233
  abort = false;
241
234
  if (!this.activeMobiusUrl) {
242
- _context4.next = 19;
235
+ _context4.next = 6;
243
236
  break;
244
237
  }
245
- _context4.next = 4;
238
+ _context4.next = 1;
246
239
  return this.attemptRegistrationWithServers(caller, [this.activeMobiusUrl]);
247
- case 4:
240
+ case 1:
248
241
  abort = _context4.sent;
249
242
  if (!this.retryAfter) {
250
- _context4.next = 19;
243
+ _context4.next = 6;
251
244
  break;
252
245
  }
253
246
  if (!(this.retryAfter < _constants2.RETRY_TIMER_UPPER_LIMIT)) {
254
- _context4.next = 10;
247
+ _context4.next = 2;
255
248
  break;
256
249
  }
257
250
  // If retry-after is less than threshold, honor it and schedule retry
258
251
  setTimeout(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3() {
259
- return _regenerator.default.wrap(function _callee3$(_context3) {
252
+ return _regenerator.default.wrap(function (_context3) {
260
253
  while (1) switch (_context3.prev = _context3.next) {
261
254
  case 0:
262
- _context3.next = 2;
255
+ _context3.next = 1;
263
256
  return _this.restartRegistration(caller);
264
- case 2:
257
+ case 1:
265
258
  case "end":
266
259
  return _context3.stop();
267
260
  }
268
261
  }, _callee3);
269
262
  })), this.retryAfter * 1000);
270
- _context4.next = 17;
263
+ _context4.next = 5;
271
264
  break;
272
- case 10:
265
+ case 2:
273
266
  if (!(this.primaryMobiusUris.includes(this.activeMobiusUrl) && this.backupMobiusUris.length > 0)) {
274
- _context4.next = 16;
267
+ _context4.next = 4;
275
268
  break;
276
269
  }
277
- _context4.next = 13;
270
+ _context4.next = 3;
278
271
  return this.attemptRegistrationWithServers(caller, this.backupMobiusUris);
279
- case 13:
272
+ case 3:
280
273
  abort = _context4.sent;
281
- _context4.next = 17;
274
+ _context4.next = 5;
282
275
  break;
283
- case 16:
276
+ case 4:
284
277
  // If we are using backup and got 429, restart registration
285
278
  this.restartRegistration(caller);
286
- case 17:
279
+ case 5:
287
280
  this.retryAfter = undefined;
288
281
  return _context4.abrupt("return", true);
289
- case 19:
282
+ case 6:
290
283
  return _context4.abrupt("return", abort);
291
- case 20:
284
+ case 7:
292
285
  case "end":
293
286
  return _context4.stop();
294
287
  }
@@ -308,24 +301,24 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
308
301
  value: (function () {
309
302
  var _handle404KeepaliveFailure = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5(caller) {
310
303
  var abort;
311
- return _regenerator.default.wrap(function _callee5$(_context5) {
304
+ return _regenerator.default.wrap(function (_context5) {
312
305
  while (1) switch (_context5.prev = _context5.next) {
313
306
  case 0:
314
307
  if (!(caller === _constants2.KEEPALIVE_UTIL)) {
315
- _context5.next = 7;
308
+ _context5.next = 2;
316
309
  break;
317
310
  }
318
- _context5.next = 3;
311
+ _context5.next = 1;
319
312
  return this.attemptRegistrationWithServers(caller);
320
- case 3:
313
+ case 1:
321
314
  abort = _context5.sent;
322
315
  if (!(!abort && !this.isDeviceRegistered())) {
323
- _context5.next = 7;
316
+ _context5.next = 2;
324
317
  break;
325
318
  }
326
- _context5.next = 7;
319
+ _context5.next = 2;
327
320
  return this.startFailoverTimer();
328
- case 7:
321
+ case 2:
329
322
  case "end":
330
323
  return _context5.stop();
331
324
  }
@@ -346,19 +339,19 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
346
339
  var _handle429Retry = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee7(retryAfter, caller) {
347
340
  var _this2 = this;
348
341
  var interval, abort;
349
- return _regenerator.default.wrap(function _callee7$(_context7) {
342
+ return _regenerator.default.wrap(function (_context7) {
350
343
  while (1) switch (_context7.prev = _context7.next) {
351
344
  case 0:
352
345
  if (!(caller === _constants2.FAILBACK_UTIL)) {
353
- _context7.next = 17;
346
+ _context7.next = 4;
354
347
  break;
355
348
  }
356
349
  if (!(this.failback429RetryAttempts >= _constants2.REG_FAILBACK_429_MAX_RETRIES)) {
357
- _context7.next = 3;
350
+ _context7.next = 1;
358
351
  break;
359
352
  }
360
353
  return _context7.abrupt("return");
361
- case 3:
354
+ case 1:
362
355
  this.clearFailbackTimer();
363
356
  this.failback429RetryAttempts += 1;
364
357
  _Logger.default.log("Received 429 while rehoming, 429 retry count : ".concat(this.failback429RetryAttempts), {
@@ -368,25 +361,25 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
368
361
  interval = this.getRegRetryInterval(this.failback429RetryAttempts);
369
362
  this.startFailbackTimer(interval);
370
363
  this.scheduled429Retry = true;
371
- _context7.next = 11;
364
+ _context7.next = 2;
372
365
  return this.restorePreviousRegistration(_constants2.REG_429_RETRY_UTIL);
373
- case 11:
366
+ case 2:
374
367
  abort = _context7.sent;
375
368
  if (!(!abort && !this.isDeviceRegistered())) {
376
- _context7.next = 15;
369
+ _context7.next = 3;
377
370
  break;
378
371
  }
379
- _context7.next = 15;
372
+ _context7.next = 3;
380
373
  return this.restartRegistration(_constants2.REG_429_RETRY_UTIL);
381
- case 15:
382
- _context7.next = 18;
374
+ case 3:
375
+ _context7.next = 5;
383
376
  break;
384
- case 17:
377
+ case 4:
385
378
  if (caller === _constants2.KEEPALIVE_UTIL) {
386
379
  this.clearKeepaliveTimer();
387
380
  setTimeout(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6() {
388
381
  var _this2$deviceInfo$dev;
389
- return _regenerator.default.wrap(function _callee6$(_context6) {
382
+ return _regenerator.default.wrap(function (_context6) {
390
383
  while (1) switch (_context6.prev = _context6.next) {
391
384
  case 0:
392
385
  _Logger.default.log("Resuming keepalive after ".concat(retryAfter, " seconds"), {
@@ -395,9 +388,9 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
395
388
  });
396
389
 
397
390
  // Resume the keepalive after waiting for the retry after period
398
- _context6.next = 3;
391
+ _context6.next = 1;
399
392
  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');
400
- case 3:
393
+ case 1:
401
394
  case "end":
402
395
  return _context6.stop();
403
396
  }
@@ -406,7 +399,7 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
406
399
  } else {
407
400
  this.retryAfter = retryAfter;
408
401
  }
409
- case 18:
402
+ case 5:
410
403
  case "end":
411
404
  return _context7.stop();
412
405
  }
@@ -452,7 +445,7 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
452
445
  abort,
453
446
  scheduledTime,
454
447
  _args10 = arguments;
455
- return _regenerator.default.wrap(function _callee10$(_context10) {
448
+ return _regenerator.default.wrap(function (_context10) {
456
449
  while (1) switch (_context10.prev = _context10.next) {
457
450
  case 0:
458
451
  attempt = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : 1;
@@ -471,7 +464,7 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
471
464
  this.failoverImmediately = this.retryAfter + timeElapsed > TIMER_THRESHOLD;
472
465
  }
473
466
  if (!(interval > _constants2.BASE_REG_RETRY_TIMER_VAL_IN_SEC && !this.failoverImmediately)) {
474
- _context10.next = 14;
467
+ _context10.next = 1;
475
468
  break;
476
469
  }
477
470
  scheduledTime = Math.floor((0, _now.default)() / 1000);
@@ -479,51 +472,51 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
479
472
  interval = Math.max(interval, this.retryAfter);
480
473
  }
481
474
  setTimeout(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9() {
482
- return _regenerator.default.wrap(function _callee9$(_context9) {
475
+ return _regenerator.default.wrap(function (_context9) {
483
476
  while (1) switch (_context9.prev = _context9.next) {
484
477
  case 0:
485
- _context9.next = 2;
478
+ _context9.next = 1;
486
479
  return _this3.mutex.runExclusive(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8() {
487
480
  var currentTime;
488
- return _regenerator.default.wrap(function _callee8$(_context8) {
481
+ return _regenerator.default.wrap(function (_context8) {
489
482
  while (1) switch (_context8.prev = _context8.next) {
490
483
  case 0:
491
- _context8.next = 2;
484
+ _context8.next = 1;
492
485
  return _this3.attemptRegistrationWithServers(_constants2.FAILOVER_UTIL);
493
- case 2:
486
+ case 1:
494
487
  abort = _context8.sent;
495
488
  currentTime = Math.floor((0, _now.default)() / 1000);
496
489
  if (!(!abort && !_this3.isDeviceRegistered())) {
497
- _context8.next = 7;
490
+ _context8.next = 2;
498
491
  break;
499
492
  }
500
- _context8.next = 7;
493
+ _context8.next = 2;
501
494
  return _this3.startFailoverTimer(attempt + 1, timeElapsed + (currentTime - scheduledTime));
502
- case 7:
495
+ case 2:
503
496
  case "end":
504
497
  return _context8.stop();
505
498
  }
506
499
  }, _callee8);
507
500
  })));
508
- case 2:
501
+ case 1:
509
502
  case "end":
510
503
  return _context9.stop();
511
504
  }
512
505
  }, _callee9);
513
506
  })), interval * _constants2.SEC_TO_MSEC_MFACTOR);
514
507
  _Logger.default.log("Scheduled retry with primary in ".concat(interval, " seconds, number of attempts : ").concat(attempt), loggerContext);
515
- _context10.next = 26;
508
+ _context10.next = 5;
516
509
  break;
517
- case 14:
510
+ case 1:
518
511
  if (!this.backupMobiusUris.length) {
519
- _context10.next = 23;
512
+ _context10.next = 3;
520
513
  break;
521
514
  }
522
515
  _Logger.default.info('Failing over to backup servers.', loggerContext);
523
516
  this.failoverImmediately = false;
524
- _context10.next = 19;
517
+ _context10.next = 2;
525
518
  return this.attemptRegistrationWithServers(_constants2.FAILOVER_UTIL, this.backupMobiusUris);
526
- case 19:
519
+ case 2:
527
520
  abort = _context10.sent;
528
521
  if (!abort && !this.isDeviceRegistered()) {
529
522
  interval = this.getRegRetryInterval();
@@ -531,35 +524,35 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
531
524
  interval = interval < this.retryAfter ? this.retryAfter : interval;
532
525
  }
533
526
  setTimeout(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
534
- return _regenerator.default.wrap(function _callee1$(_context1) {
527
+ return _regenerator.default.wrap(function (_context1) {
535
528
  while (1) switch (_context1.prev = _context1.next) {
536
529
  case 0:
537
- _context1.next = 2;
530
+ _context1.next = 1;
538
531
  return _this3.mutex.runExclusive(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0() {
539
- return _regenerator.default.wrap(function _callee0$(_context0) {
532
+ return _regenerator.default.wrap(function (_context0) {
540
533
  while (1) switch (_context0.prev = _context0.next) {
541
534
  case 0:
542
- _context0.next = 2;
535
+ _context0.next = 1;
543
536
  return _this3.attemptRegistrationWithServers(_constants2.FAILOVER_UTIL, _this3.backupMobiusUris);
544
- case 2:
537
+ case 1:
545
538
  abort = _context0.sent;
546
539
  if (!(!abort && !_this3.isDeviceRegistered())) {
547
- _context0.next = 7;
540
+ _context0.next = 3;
548
541
  break;
549
542
  }
550
- _context0.next = 6;
543
+ _context0.next = 2;
551
544
  return (0, _common.uploadLogs)();
552
- case 6:
545
+ case 2:
553
546
  (0, _common.emitFinalFailure)(function (clientError) {
554
547
  _this3.lineEmitter(_types3.LINE_EVENTS.ERROR, undefined, clientError);
555
548
  }, loggerContext);
556
- case 7:
549
+ case 3:
557
550
  case "end":
558
551
  return _context0.stop();
559
552
  }
560
553
  }, _callee0);
561
554
  })));
562
- case 2:
555
+ case 1:
563
556
  case "end":
564
557
  return _context1.stop();
565
558
  }
@@ -567,16 +560,16 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
567
560
  })), interval * _constants2.SEC_TO_MSEC_MFACTOR);
568
561
  _Logger.default.log("Scheduled retry with backup servers in ".concat(interval, " seconds."), loggerContext);
569
562
  }
570
- _context10.next = 26;
563
+ _context10.next = 5;
571
564
  break;
572
- case 23:
573
- _context10.next = 25;
565
+ case 3:
566
+ _context10.next = 4;
574
567
  return (0, _common.uploadLogs)();
575
- case 25:
568
+ case 4:
576
569
  (0, _common.emitFinalFailure)(function (clientError) {
577
570
  _this3.lineEmitter(_types3.LINE_EVENTS.ERROR, undefined, clientError);
578
571
  }, loggerContext);
579
- case 26:
572
+ case 5:
580
573
  case "end":
581
574
  return _context10.stop();
582
575
  }
@@ -603,33 +596,33 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
603
596
  key: "isPrimaryActive",
604
597
  value: function () {
605
598
  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) {
599
+ var status, _iterator, _step, mobiusUrl, baseUri, response, _ref7, statusCode, _t0, _t1;
600
+ return _regenerator.default.wrap(function (_context11) {
608
601
  while (1) switch (_context11.prev = _context11.next) {
609
602
  case 0:
610
603
  _iterator = _createForOfIteratorHelper(this.primaryMobiusUris);
611
604
  _context11.prev = 1;
612
605
  _iterator.s();
613
- case 3:
606
+ case 2:
614
607
  if ((_step = _iterator.n()).done) {
615
- _context11.next = 23;
608
+ _context11.next = 8;
616
609
  break;
617
610
  }
618
611
  mobiusUrl = _step.value;
619
- _context11.prev = 5;
612
+ _context11.prev = 3;
620
613
  baseUri = mobiusUrl.replace(_constants2.URL_ENDPOINT, '/'); // eslint-disable-next-line no-await-in-loop
621
- _context11.next = 9;
614
+ _context11.next = 4;
622
615
  return this.webex.request({
623
616
  uri: "".concat(baseUri, "ping"),
624
617
  method: _types2.HTTP_METHODS.GET,
625
618
  headers: (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _constants2.CISCO_DEVICE_URL, this.webex.internal.device.url), _constants2.SPARK_USER_AGENT, _constants2.CALLING_USER_AGENT),
626
619
  service: _types2.ALLOWED_SERVICES.MOBIUS
627
620
  });
628
- case 9:
621
+ case 4:
629
622
  response = _context11.sent;
630
623
  _ref7 = response, statusCode = _ref7.statusCode;
631
624
  if (!(statusCode === 200)) {
632
- _context11.next = 15;
625
+ _context11.next = 5;
633
626
  break;
634
627
  }
635
628
  _Logger.default.info("Ping successful for primary Mobius: ".concat(mobiusUrl), {
@@ -637,39 +630,39 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
637
630
  method: _constants2.FAILBACK_UTIL
638
631
  });
639
632
  status = 'up';
640
- return _context11.abrupt("break", 23);
641
- case 15:
642
- _context11.next = 21;
633
+ return _context11.abrupt("continue", 8);
634
+ case 5:
635
+ _context11.next = 7;
643
636
  break;
644
- case 17:
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)), {
637
+ case 6:
638
+ _context11.prev = 6;
639
+ _t0 = _context11["catch"](3);
640
+ _Logger.default.warn("Ping failed for primary Mobius: ".concat(mobiusUrl, " with error: ").concat((0, _stringify.default)(_t0)), {
648
641
  file: _constants2.REGISTRATION_FILE,
649
642
  method: _constants2.FAILBACK_UTIL
650
643
  });
651
644
  status = 'down';
652
- case 21:
653
- _context11.next = 3;
645
+ case 7:
646
+ _context11.next = 2;
654
647
  break;
655
- case 23:
656
- _context11.next = 28;
648
+ case 8:
649
+ _context11.next = 10;
657
650
  break;
658
- case 25:
659
- _context11.prev = 25;
660
- _context11.t1 = _context11["catch"](1);
661
- _iterator.e(_context11.t1);
662
- case 28:
663
- _context11.prev = 28;
651
+ case 9:
652
+ _context11.prev = 9;
653
+ _t1 = _context11["catch"](1);
654
+ _iterator.e(_t1);
655
+ case 10:
656
+ _context11.prev = 10;
664
657
  _iterator.f();
665
- return _context11.finish(28);
666
- case 31:
658
+ return _context11.finish(10);
659
+ case 11:
667
660
  return _context11.abrupt("return", status === 'up');
668
- case 32:
661
+ case 12:
669
662
  case "end":
670
663
  return _context11.stop();
671
664
  }
672
- }, _callee11, this, [[1, 25, 28, 31], [5, 17]]);
665
+ }, _callee11, this, [[1, 9, 10, 11], [3, 6]]);
673
666
  }));
674
667
  function isPrimaryActive() {
675
668
  return _isPrimaryActive.apply(this, arguments);
@@ -723,7 +716,7 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
723
716
  value: function startFailbackTimer(intervalInSeconds) {
724
717
  var _this4 = this;
725
718
  this.failbackTimer = setTimeout(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12() {
726
- return _regenerator.default.wrap(function _callee12$(_context12) {
719
+ return _regenerator.default.wrap(function (_context12) {
727
720
  while (1) switch (_context12.prev = _context12.next) {
728
721
  case 0:
729
722
  return _context12.abrupt("return", _this4.executeFailback());
@@ -748,84 +741,84 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
748
741
  value: (function () {
749
742
  var _executeFailback = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14() {
750
743
  var _this5 = this;
751
- return _regenerator.default.wrap(function _callee14$(_context14) {
744
+ return _regenerator.default.wrap(function (_context14) {
752
745
  while (1) switch (_context14.prev = _context14.next) {
753
746
  case 0:
754
- _context14.next = 2;
747
+ _context14.next = 1;
755
748
  return this.mutex.runExclusive(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13() {
756
749
  var primaryServerStatus, abort, abortNew;
757
- return _regenerator.default.wrap(function _callee13$(_context13) {
750
+ return _regenerator.default.wrap(function (_context13) {
758
751
  while (1) switch (_context13.prev = _context13.next) {
759
752
  case 0:
760
753
  if (!_this5.isFailbackRequired()) {
761
- _context13.next = 31;
754
+ _context13.next = 11;
762
755
  break;
763
756
  }
764
- _context13.next = 3;
757
+ _context13.next = 1;
765
758
  return _this5.isPrimaryActive();
766
- case 3:
759
+ case 1:
767
760
  primaryServerStatus = _context13.sent;
768
761
  if (!((0, _keys.default)(_this5.callManager.getActiveCalls()).length === 0 && primaryServerStatus)) {
769
- _context13.next = 28;
762
+ _context13.next = 10;
770
763
  break;
771
764
  }
772
765
  _Logger.default.info("Attempting failback to primary.", {
773
766
  file: _constants2.REGISTRATION_FILE,
774
767
  method: _this5.executeFailback.name
775
768
  });
776
- _context13.next = 8;
769
+ _context13.next = 2;
777
770
  return _this5.deregister();
778
- case 8:
779
- _context13.next = 10;
771
+ case 2:
772
+ _context13.next = 3;
780
773
  return _this5.attemptRegistrationWithServers(_constants2.FAILBACK_UTIL);
781
- case 10:
774
+ case 3:
782
775
  abort = _context13.sent;
783
776
  if (!(_this5.scheduled429Retry || abort || _this5.isDeviceRegistered())) {
784
- _context13.next = 13;
777
+ _context13.next = 4;
785
778
  break;
786
779
  }
787
780
  return _context13.abrupt("return");
788
- case 13:
789
- _context13.next = 15;
781
+ case 4:
782
+ _context13.next = 5;
790
783
  return _this5.restorePreviousRegistration(_constants2.FAILBACK_UTIL);
791
- case 15:
784
+ case 5:
792
785
  abortNew = _context13.sent;
793
786
  if (!abortNew) {
794
- _context13.next = 19;
787
+ _context13.next = 6;
795
788
  break;
796
789
  }
797
790
  _this5.clearFailbackTimer();
798
791
  return _context13.abrupt("return");
799
- case 19:
792
+ case 6:
800
793
  if (_this5.isDeviceRegistered()) {
801
- _context13.next = 24;
794
+ _context13.next = 8;
802
795
  break;
803
796
  }
804
- _context13.next = 22;
797
+ _context13.next = 7;
805
798
  return _this5.restartRegistration(_this5.executeFailback.name);
806
- case 22:
807
- _context13.next = 26;
799
+ case 7:
800
+ _context13.next = 9;
808
801
  break;
809
- case 24:
802
+ case 8:
810
803
  _this5.failbackTimer = undefined;
811
804
  _this5.initiateFailback();
812
- case 26:
813
- _context13.next = 31;
805
+ case 9:
806
+ _context13.next = 11;
814
807
  break;
815
- case 28:
808
+ case 10:
816
809
  _Logger.default.info('Active calls present or primary Mobius is down, deferring failback to next cycle.', {
817
810
  file: _constants2.REGISTRATION_FILE,
818
811
  method: _this5.executeFailback.name
819
812
  });
820
813
  _this5.failbackTimer = undefined;
821
814
  _this5.initiateFailback();
822
- case 31:
815
+ case 11:
823
816
  case "end":
824
817
  return _context13.stop();
825
818
  }
826
819
  }, _callee13);
827
820
  })));
828
- case 2:
821
+ case 1:
829
822
  case "end":
830
823
  return _context14.stop();
831
824
  }
@@ -894,7 +887,7 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
894
887
  value: (function () {
895
888
  var _restartRegistration = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15(caller) {
896
889
  var abort;
897
- return _regenerator.default.wrap(function _callee15$(_context15) {
890
+ return _regenerator.default.wrap(function (_context15) {
898
891
  while (1) switch (_context15.prev = _context15.next) {
899
892
  case 0:
900
893
  /*
@@ -903,17 +896,17 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
903
896
  */
904
897
  this.clearFailbackTimer();
905
898
  this.failback429RetryAttempts = 0;
906
- _context15.next = 4;
899
+ _context15.next = 1;
907
900
  return this.attemptRegistrationWithServers(caller, this.primaryMobiusUris);
908
- case 4:
901
+ case 1:
909
902
  abort = _context15.sent;
910
903
  if (!(!abort && !this.isDeviceRegistered())) {
911
- _context15.next = 8;
904
+ _context15.next = 2;
912
905
  break;
913
906
  }
914
- _context15.next = 8;
907
+ _context15.next = 2;
915
908
  return this.startFailoverTimer();
916
- case 8:
909
+ case 2:
917
910
  case "end":
918
911
  return _context15.stop();
919
912
  }
@@ -935,21 +928,21 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
935
928
  value: (function () {
936
929
  var _handleConnectionRestoration = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17(retry) {
937
930
  var _this6 = this;
938
- return _regenerator.default.wrap(function _callee17$(_context17) {
931
+ return _regenerator.default.wrap(function (_context17) {
939
932
  while (1) switch (_context17.prev = _context17.next) {
940
933
  case 0:
941
934
  _Logger.default.info(_constants.METHOD_START_MESSAGE, {
942
935
  method: _constants2.METHODS.HANDLE_CONNECTION_RESTORATION,
943
936
  file: _constants2.REGISTRATION_FILE
944
937
  });
945
- _context17.next = 3;
938
+ _context17.next = 1;
946
939
  return this.mutex.runExclusive(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16() {
947
940
  var abort;
948
- return _regenerator.default.wrap(function _callee16$(_context16) {
941
+ return _regenerator.default.wrap(function (_context16) {
949
942
  while (1) switch (_context16.prev = _context16.next) {
950
943
  case 0:
951
944
  if (!retry) {
952
- _context16.next = 14;
945
+ _context16.next = 4;
953
946
  break;
954
947
  }
955
948
  _Logger.default.log('Network is up again, re-registering with Webex Calling if needed', {
@@ -958,37 +951,37 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
958
951
  });
959
952
  _this6.clearKeepaliveTimer();
960
953
  if (!_this6.isDeviceRegistered()) {
961
- _context16.next = 6;
954
+ _context16.next = 1;
962
955
  break;
963
956
  }
964
- _context16.next = 6;
957
+ _context16.next = 1;
965
958
  return _this6.deregister();
966
- case 6:
959
+ case 1:
967
960
  if (!_this6.activeMobiusUrl) {
968
- _context16.next = 13;
961
+ _context16.next = 3;
969
962
  break;
970
963
  }
971
- _context16.next = 9;
964
+ _context16.next = 2;
972
965
  return _this6.restorePreviousRegistration(_constants2.METHODS.HANDLE_CONNECTION_RESTORATION);
973
- case 9:
966
+ case 2:
974
967
  abort = _context16.sent;
975
968
  if (!(!abort && !_this6.isDeviceRegistered())) {
976
- _context16.next = 13;
969
+ _context16.next = 3;
977
970
  break;
978
971
  }
979
- _context16.next = 13;
972
+ _context16.next = 3;
980
973
  return _this6.restartRegistration(_constants2.METHODS.HANDLE_CONNECTION_RESTORATION);
981
- case 13:
974
+ case 3:
982
975
  retry = false;
983
- case 14:
976
+ case 4:
984
977
  case "end":
985
978
  return _context16.stop();
986
979
  }
987
980
  }, _callee16);
988
981
  })));
989
- case 3:
982
+ case 1:
990
983
  return _context17.abrupt("return", retry);
991
- case 4:
984
+ case 2:
992
985
  case "end":
993
986
  return _context17.stop();
994
987
  }
@@ -1012,7 +1005,7 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1012
1005
  return /*#__PURE__*/function () {
1013
1006
  var _ref1 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18(restoreData, caller) {
1014
1007
  var logContext, restore, finalError;
1015
- return _regenerator.default.wrap(function _callee18$(_context18) {
1008
+ return _regenerator.default.wrap(function (_context18) {
1016
1009
  while (1) switch (_context18.prev = _context18.next) {
1017
1010
  case 0:
1018
1011
  logContext = {
@@ -1020,37 +1013,37 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1020
1013
  method: caller
1021
1014
  };
1022
1015
  if (_this7.isRegRetry()) {
1023
- _context18.next = 17;
1016
+ _context18.next = 4;
1024
1017
  break;
1025
1018
  }
1026
1019
  _Logger.default.info('Registration restoration in progress.', logContext);
1027
1020
  restore = _this7.getExistingDevice(restoreData);
1028
1021
  if (!restore) {
1029
- _context18.next = 14;
1022
+ _context18.next = 3;
1030
1023
  break;
1031
1024
  }
1032
1025
  _this7.setRegRetry(true);
1033
- _context18.next = 8;
1026
+ _context18.next = 1;
1034
1027
  return _this7.deregister();
1035
- case 8:
1036
- _context18.next = 10;
1028
+ case 1:
1029
+ _context18.next = 2;
1037
1030
  return _this7.restorePreviousRegistration(caller);
1038
- case 10:
1031
+ case 2:
1039
1032
  finalError = _context18.sent;
1040
1033
  _this7.setRegRetry(false);
1041
1034
  if (_this7.isDeviceRegistered()) {
1042
1035
  _Logger.default.info('Registration restored successfully.', logContext);
1043
1036
  }
1044
1037
  return _context18.abrupt("return", finalError);
1045
- case 14:
1038
+ case 3:
1046
1039
  _this7.lineEmitter(_types3.LINE_EVENTS.UNREGISTERED);
1047
- _context18.next = 18;
1040
+ _context18.next = 5;
1048
1041
  break;
1049
- case 17:
1042
+ case 4:
1050
1043
  _this7.lineEmitter(_types3.LINE_EVENTS.UNREGISTERED);
1051
- case 18:
1044
+ case 5:
1052
1045
  return _context18.abrupt("return", false);
1053
- case 19:
1046
+ case 6:
1054
1047
  case "end":
1055
1048
  return _context18.stop();
1056
1049
  }
@@ -1071,24 +1064,24 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1071
1064
  value: (function () {
1072
1065
  var _triggerRegistration = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19() {
1073
1066
  var abort;
1074
- return _regenerator.default.wrap(function _callee19$(_context19) {
1067
+ return _regenerator.default.wrap(function (_context19) {
1075
1068
  while (1) switch (_context19.prev = _context19.next) {
1076
1069
  case 0:
1077
1070
  if (!(this.primaryMobiusUris.length > 0)) {
1078
- _context19.next = 7;
1071
+ _context19.next = 2;
1079
1072
  break;
1080
1073
  }
1081
- _context19.next = 3;
1074
+ _context19.next = 1;
1082
1075
  return this.attemptRegistrationWithServers(_constants2.REGISTRATION_UTIL, this.primaryMobiusUris);
1083
- case 3:
1076
+ case 1:
1084
1077
  abort = _context19.sent;
1085
1078
  if (!(!this.isDeviceRegistered() && !abort)) {
1086
- _context19.next = 7;
1079
+ _context19.next = 2;
1087
1080
  break;
1088
1081
  }
1089
- _context19.next = 7;
1082
+ _context19.next = 2;
1090
1083
  return this.startFailoverTimer();
1091
- case 7:
1084
+ case 2:
1092
1085
  case "end":
1093
1086
  return _context19.stop();
1094
1087
  }
@@ -1119,21 +1112,22 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1119
1112
  _step2,
1120
1113
  _loop,
1121
1114
  _ret,
1122
- _args21 = arguments;
1123
- return _regenerator.default.wrap(function _callee20$(_context21) {
1115
+ _args21 = arguments,
1116
+ _t11;
1117
+ return _regenerator.default.wrap(function (_context21) {
1124
1118
  while (1) switch (_context21.prev = _context21.next) {
1125
1119
  case 0:
1126
1120
  servers = _args21.length > 1 && _args21[1] !== undefined ? _args21[1] : this.primaryMobiusUris;
1127
1121
  abort = false;
1128
1122
  this.retryAfter = undefined;
1129
1123
  if (!this.failoverImmediately) {
1130
- _context21.next = 5;
1124
+ _context21.next = 1;
1131
1125
  break;
1132
1126
  }
1133
1127
  return _context21.abrupt("return", abort);
1134
- case 5:
1128
+ case 1:
1135
1129
  if (!this.isDeviceRegistered()) {
1136
- _context21.next = 8;
1130
+ _context21.next = 2;
1137
1131
  break;
1138
1132
  }
1139
1133
  _Logger.default.info("[".concat(caller, "] : Device already registered with : ").concat(this.activeMobiusUrl), {
@@ -1141,18 +1135,18 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1141
1135
  method: _constants2.REGISTER_UTIL
1142
1136
  });
1143
1137
  return _context21.abrupt("return", abort);
1144
- case 8:
1138
+ case 2:
1145
1139
  _iterator2 = _createForOfIteratorHelper(servers);
1146
- _context21.prev = 9;
1140
+ _context21.prev = 3;
1147
1141
  _loop = /*#__PURE__*/_regenerator.default.mark(function _loop() {
1148
1142
  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) {
1143
+ var url, serverType, _this8$deviceInfo$dev, _resp$headers, _resp$headers$trackin, _resp$headers2, _this8$deviceInfo$dev2, resp, body, _t10;
1144
+ return _regenerator.default.wrap(function (_context20) {
1151
1145
  while (1) switch (_context20.prev = _context20.next) {
1152
1146
  case 0:
1153
1147
  url = _step2.value;
1154
1148
  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;
1149
+ _context20.prev = 1;
1156
1150
  abort = false;
1157
1151
  _this8.registrationStatus = _types2.RegistrationStatus.INACTIVE;
1158
1152
  _this8.lineEmitter(_types3.LINE_EVENTS.CONNECTING);
@@ -1161,9 +1155,9 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1161
1155
  method: _constants2.REGISTER_UTIL
1162
1156
  });
1163
1157
  // eslint-disable-next-line no-await-in-loop
1164
- _context20.next = 9;
1158
+ _context20.next = 2;
1165
1159
  return _this8.postRegistration(url);
1166
- case 9:
1160
+ case 2:
1167
1161
  resp = _context20.sent;
1168
1162
  _this8.deviceInfo = resp.body;
1169
1163
  _this8.registrationStatus = _types2.RegistrationStatus.ACTIVE;
@@ -1179,11 +1173,11 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1179
1173
  _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
1174
  _this8.initiateFailback();
1181
1175
  return _context20.abrupt("return", 0);
1182
- case 23:
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;
1176
+ case 3:
1177
+ _context20.prev = 3;
1178
+ _t10 = _context20["catch"](1);
1179
+ body = _t10; // eslint-disable-next-line no-await-in-loop, @typescript-eslint/no-unused-vars
1180
+ _context20.next = 4;
1187
1181
  return (0, _common.handleRegistrationErrors)(body, function (clientError, finalError) {
1188
1182
  var _body$headers$trackin, _body$headers;
1189
1183
  if (finalError) {
@@ -1198,10 +1192,10 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1198
1192
  }, function (retryAfter, retryCaller) {
1199
1193
  return _this8.handle429Retry(retryAfter, retryCaller);
1200
1194
  }, _this8.restoreRegistrationCallBack());
1201
- case 28:
1195
+ case 4:
1202
1196
  abort = _context20.sent;
1203
1197
  if (!(_this8.registrationStatus === _types2.RegistrationStatus.ACTIVE)) {
1204
- _context20.next = 32;
1198
+ _context20.next = 5;
1205
1199
  break;
1206
1200
  }
1207
1201
  _Logger.default.info("[".concat(caller, "] : Device is already restored, active mobius url: ").concat(_this8.activeMobiusUrl), {
@@ -1209,58 +1203,58 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1209
1203
  method: _this8.attemptRegistrationWithServers.name
1210
1204
  });
1211
1205
  return _context20.abrupt("return", 0);
1212
- case 32:
1206
+ case 5:
1213
1207
  if (!abort) {
1214
- _context20.next = 37;
1208
+ _context20.next = 7;
1215
1209
  break;
1216
1210
  }
1217
1211
  _this8.setStatus(_types2.RegistrationStatus.INACTIVE);
1218
1212
  // eslint-disable-next-line no-await-in-loop
1219
- _context20.next = 36;
1213
+ _context20.next = 6;
1220
1214
  return (0, _common.uploadLogs)();
1221
- case 36:
1215
+ case 6:
1222
1216
  return _context20.abrupt("return", 0);
1223
- case 37:
1217
+ case 7:
1224
1218
  case "end":
1225
1219
  return _context20.stop();
1226
1220
  }
1227
- }, _loop, null, [[2, 23]]);
1221
+ }, _loop, null, [[1, 3]]);
1228
1222
  });
1229
1223
  _iterator2.s();
1230
- case 12:
1224
+ case 4:
1231
1225
  if ((_step2 = _iterator2.n()).done) {
1232
- _context21.next = 19;
1226
+ _context21.next = 7;
1233
1227
  break;
1234
1228
  }
1235
- return _context21.delegateYield(_loop(), "t0", 14);
1236
- case 14:
1229
+ return _context21.delegateYield(_loop(), "t0", 5);
1230
+ case 5:
1237
1231
  _ret = _context21.t0;
1238
1232
  if (!(_ret === 0)) {
1239
- _context21.next = 17;
1233
+ _context21.next = 6;
1240
1234
  break;
1241
1235
  }
1242
- return _context21.abrupt("break", 19);
1243
- case 17:
1244
- _context21.next = 12;
1236
+ return _context21.abrupt("continue", 7);
1237
+ case 6:
1238
+ _context21.next = 4;
1245
1239
  break;
1246
- case 19:
1247
- _context21.next = 24;
1240
+ case 7:
1241
+ _context21.next = 9;
1248
1242
  break;
1249
- case 21:
1250
- _context21.prev = 21;
1251
- _context21.t1 = _context21["catch"](9);
1252
- _iterator2.e(_context21.t1);
1253
- case 24:
1254
- _context21.prev = 24;
1243
+ case 8:
1244
+ _context21.prev = 8;
1245
+ _t11 = _context21["catch"](3);
1246
+ _iterator2.e(_t11);
1247
+ case 9:
1248
+ _context21.prev = 9;
1255
1249
  _iterator2.f();
1256
- return _context21.finish(24);
1257
- case 27:
1250
+ return _context21.finish(9);
1251
+ case 10:
1258
1252
  return _context21.abrupt("return", abort);
1259
- case 28:
1253
+ case 11:
1260
1254
  case "end":
1261
1255
  return _context21.stop();
1262
1256
  }
1263
- }, _callee20, this, [[9, 21, 24, 27]]);
1257
+ }, _callee20, this, [[3, 8, 9, 10]]);
1264
1258
  }));
1265
1259
  function attemptRegistrationWithServers(_x11) {
1266
1260
  return _attemptRegistrationWithServers.apply(this, arguments);
@@ -1278,24 +1272,24 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1278
1272
  var _startKeepaliveTimer = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23(url, interval, serverType) {
1279
1273
  var _this9 = this;
1280
1274
  var RETRY_COUNT_THRESHOLD;
1281
- return _regenerator.default.wrap(function _callee23$(_context24) {
1275
+ return _regenerator.default.wrap(function (_context24) {
1282
1276
  while (1) switch (_context24.prev = _context24.next) {
1283
1277
  case 0:
1284
1278
  this.clearKeepaliveTimer();
1285
1279
  RETRY_COUNT_THRESHOLD = this.isCCFlow ? 4 : 5;
1286
- _context24.next = 4;
1280
+ _context24.next = 1;
1287
1281
  return this.mutex.runExclusive(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22() {
1288
1282
  var accessToken, blob, blobUrl;
1289
- return _regenerator.default.wrap(function _callee22$(_context23) {
1283
+ return _regenerator.default.wrap(function (_context23) {
1290
1284
  while (1) switch (_context23.prev = _context23.next) {
1291
1285
  case 0:
1292
1286
  if (!_this9.isDeviceRegistered()) {
1293
- _context23.next = 5;
1287
+ _context23.next = 2;
1294
1288
  break;
1295
1289
  }
1296
- _context23.next = 3;
1290
+ _context23.next = 1;
1297
1291
  return _this9.webex.credentials.getUserToken();
1298
- case 3:
1292
+ case 1:
1299
1293
  accessToken = _context23.sent;
1300
1294
  if (!_this9.webWorker) {
1301
1295
  blob = new Blob([_webWorkerStr.default], {
@@ -1315,7 +1309,7 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1315
1309
  _this9.webWorker.onmessage = /*#__PURE__*/function () {
1316
1310
  var _ref11 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21(event) {
1317
1311
  var logContext, error, abort;
1318
- return _regenerator.default.wrap(function _callee21$(_context22) {
1312
+ return _regenerator.default.wrap(function (_context22) {
1319
1313
  while (1) switch (_context22.prev = _context22.next) {
1320
1314
  case 0:
1321
1315
  logContext = {
@@ -1327,12 +1321,12 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1327
1321
  _this9.lineEmitter(_types3.LINE_EVENTS.RECONNECTED);
1328
1322
  }
1329
1323
  if (!(event.data.type === _types2.WorkerMessageType.KEEPALIVE_FAILURE)) {
1330
- _context22.next = 25;
1324
+ _context22.next = 7;
1331
1325
  break;
1332
1326
  }
1333
1327
  error = event.data.err;
1334
1328
  _Logger.default.warn("Keep-alive missed ".concat(event.data.keepAliveRetryCount, " times. Status -> ").concat(error.statusCode, " "), logContext);
1335
- _context22.next = 7;
1329
+ _context22.next = 1;
1336
1330
  return (0, _common.handleRegistrationErrors)(error, function (clientError, finalError) {
1337
1331
  var _error$headers$tracki, _error$headers;
1338
1332
  if (finalError) {
@@ -1345,10 +1339,10 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1345
1339
  }, function (retryAfter, retryCaller) {
1346
1340
  return _this9.handle429Retry(retryAfter, retryCaller);
1347
1341
  });
1348
- case 7:
1342
+ case 1:
1349
1343
  abort = _context22.sent;
1350
1344
  if (!(abort || event.data.keepAliveRetryCount >= RETRY_COUNT_THRESHOLD)) {
1351
- _context22.next = 24;
1345
+ _context22.next = 6;
1352
1346
  break;
1353
1347
  }
1354
1348
  _this9.failoverImmediately = _this9.isCCFlow;
@@ -1356,28 +1350,28 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1356
1350
  _this9.clearKeepaliveTimer();
1357
1351
  _this9.clearFailbackTimer();
1358
1352
  _this9.lineEmitter(_types3.LINE_EVENTS.UNREGISTERED);
1359
- _context22.next = 16;
1353
+ _context22.next = 2;
1360
1354
  return (0, _common.uploadLogs)();
1361
- case 16:
1355
+ case 2:
1362
1356
  if (abort) {
1363
- _context22.next = 21;
1357
+ _context22.next = 4;
1364
1358
  break;
1365
1359
  }
1366
- _context22.next = 19;
1360
+ _context22.next = 3;
1367
1361
  return _this9.reconnectOnFailure(_constants2.RECONNECT_ON_FAILURE_UTIL);
1368
- case 19:
1369
- _context22.next = 22;
1362
+ case 3:
1363
+ _context22.next = 5;
1370
1364
  break;
1371
- case 21:
1365
+ case 4:
1372
1366
  if (error.statusCode === 404) {
1373
1367
  _this9.handle404KeepaliveFailure(_constants2.KEEPALIVE_UTIL);
1374
1368
  }
1375
- case 22:
1376
- _context22.next = 25;
1369
+ case 5:
1370
+ _context22.next = 7;
1377
1371
  break;
1378
- case 24:
1372
+ case 6:
1379
1373
  _this9.lineEmitter(_types3.LINE_EVENTS.RECONNECTING);
1380
- case 25:
1374
+ case 7:
1381
1375
  case "end":
1382
1376
  return _context22.stop();
1383
1377
  }
@@ -1388,13 +1382,13 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1388
1382
  };
1389
1383
  }();
1390
1384
  }
1391
- case 5:
1385
+ case 2:
1392
1386
  case "end":
1393
1387
  return _context23.stop();
1394
1388
  }
1395
1389
  }, _callee22);
1396
1390
  })));
1397
- case 4:
1391
+ case 1:
1398
1392
  case "end":
1399
1393
  return _context24.stop();
1400
1394
  }
@@ -1429,35 +1423,35 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1429
1423
  key: "deregister",
1430
1424
  value: function () {
1431
1425
  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) {
1426
+ var _this$deviceInfo$devi, _this$deviceInfo$devi2, _t12;
1427
+ return _regenerator.default.wrap(function (_context25) {
1434
1428
  while (1) switch (_context25.prev = _context25.next) {
1435
1429
  case 0:
1436
1430
  _context25.prev = 0;
1437
- _context25.next = 3;
1431
+ _context25.next = 1;
1438
1432
  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);
1439
- case 3:
1433
+ case 1:
1440
1434
  _Logger.default.log('Registration successfully deregistered', {
1441
1435
  file: _constants2.REGISTRATION_FILE,
1442
1436
  method: _constants2.METHODS.DEREGISTER
1443
1437
  });
1444
- _context25.next = 9;
1438
+ _context25.next = 3;
1445
1439
  break;
1446
- case 6:
1447
- _context25.prev = 6;
1448
- _context25.t0 = _context25["catch"](0);
1449
- _Logger.default.warn("Delete failed with Mobius: ".concat((0, _stringify.default)(_context25.t0)), {
1440
+ case 2:
1441
+ _context25.prev = 2;
1442
+ _t12 = _context25["catch"](0);
1443
+ _Logger.default.warn("Delete failed with Mobius: ".concat((0, _stringify.default)(_t12)), {
1450
1444
  file: _constants2.REGISTRATION_FILE,
1451
1445
  method: _constants2.METHODS.DEREGISTER
1452
1446
  });
1453
- case 9:
1447
+ case 3:
1454
1448
  this.clearKeepaliveTimer();
1455
1449
  this.setStatus(_types2.RegistrationStatus.INACTIVE);
1456
- case 11:
1450
+ case 4:
1457
1451
  case "end":
1458
1452
  return _context25.stop();
1459
1453
  }
1460
- }, _callee24, this, [[0, 6]]);
1454
+ }, _callee24, this, [[0, 2]]);
1461
1455
  }));
1462
1456
  function deregister() {
1463
1457
  return _deregister.apply(this, arguments);
@@ -1523,7 +1517,7 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1523
1517
  value: (function () {
1524
1518
  var _reconnectOnFailure = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee25(caller) {
1525
1519
  var abort;
1526
- return _regenerator.default.wrap(function _callee25$(_context26) {
1520
+ return _regenerator.default.wrap(function (_context26) {
1527
1521
  while (1) switch (_context26.prev = _context26.next) {
1528
1522
  case 0:
1529
1523
  _Logger.default.info(_constants.METHOD_START_MESSAGE, {
@@ -1532,33 +1526,33 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1532
1526
  });
1533
1527
  this.reconnectPending = false;
1534
1528
  if (this.isDeviceRegistered()) {
1535
- _context26.next = 14;
1529
+ _context26.next = 4;
1536
1530
  break;
1537
1531
  }
1538
1532
  if (!((0, _keys.default)(this.callManager.getActiveCalls()).length === 0)) {
1539
- _context26.next = 12;
1533
+ _context26.next = 3;
1540
1534
  break;
1541
1535
  }
1542
- _context26.next = 6;
1536
+ _context26.next = 1;
1543
1537
  return this.restorePreviousRegistration(caller);
1544
- case 6:
1538
+ case 1:
1545
1539
  abort = _context26.sent;
1546
1540
  if (!(!abort && !this.isDeviceRegistered())) {
1547
- _context26.next = 10;
1541
+ _context26.next = 2;
1548
1542
  break;
1549
1543
  }
1550
- _context26.next = 10;
1544
+ _context26.next = 2;
1551
1545
  return this.restartRegistration(caller);
1552
- case 10:
1553
- _context26.next = 14;
1546
+ case 2:
1547
+ _context26.next = 4;
1554
1548
  break;
1555
- case 12:
1549
+ case 3:
1556
1550
  this.reconnectPending = true;
1557
1551
  _Logger.default.info('Active call(s) present, deferred reconnect till call cleanup.', {
1558
1552
  file: _constants2.REGISTRATION_FILE,
1559
1553
  method: _constants2.METHODS.RECONNECT_ON_FAILURE
1560
1554
  });
1561
- case 14:
1555
+ case 4:
1562
1556
  case "end":
1563
1557
  return _context26.stop();
1564
1558
  }
@@ -1570,7 +1564,6 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1570
1564
  return reconnectOnFailure;
1571
1565
  }())
1572
1566
  }]);
1573
- return Registration;
1574
1567
  }();
1575
1568
  /*
1576
1569
  */