@webex/calling 3.5.0 → 3.6.0

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 (102) hide show
  1. package/dist/CallHistory/CallHistory.js +195 -67
  2. package/dist/CallHistory/CallHistory.js.map +1 -1
  3. package/dist/CallHistory/CallHistory.test.js +331 -108
  4. package/dist/CallHistory/CallHistory.test.js.map +1 -1
  5. package/dist/CallHistory/callHistoryFixtures.js +25 -1
  6. package/dist/CallHistory/callHistoryFixtures.js.map +1 -1
  7. package/dist/CallHistory/constants.js +4 -1
  8. package/dist/CallHistory/constants.js.map +1 -1
  9. package/dist/CallHistory/types.js.map +1 -1
  10. package/dist/CallingClient/CallingClient.js +2 -2
  11. package/dist/CallingClient/CallingClient.js.map +1 -1
  12. package/dist/CallingClient/CallingClient.test.js +1 -1
  13. package/dist/CallingClient/CallingClient.test.js.map +1 -1
  14. package/dist/CallingClient/calling/CallerId/index.js +14 -5
  15. package/dist/CallingClient/calling/CallerId/index.js.map +1 -1
  16. package/dist/CallingClient/calling/CallerId/index.test.js +6 -6
  17. package/dist/CallingClient/calling/CallerId/index.test.js.map +1 -1
  18. package/dist/CallingClient/calling/call.js +434 -348
  19. package/dist/CallingClient/calling/call.js.map +1 -1
  20. package/dist/CallingClient/calling/call.test.js +516 -386
  21. package/dist/CallingClient/calling/call.test.js.map +1 -1
  22. package/dist/CallingClient/calling/callManager.js +6 -6
  23. package/dist/CallingClient/calling/callManager.js.map +1 -1
  24. package/dist/CallingClient/calling/callManager.test.js +3 -3
  25. package/dist/CallingClient/calling/callManager.test.js.map +1 -1
  26. package/dist/CallingClient/calling/types.js +6 -1
  27. package/dist/CallingClient/calling/types.js.map +1 -1
  28. package/dist/CallingClient/constants.js +2 -3
  29. package/dist/CallingClient/constants.js.map +1 -1
  30. package/dist/CallingClient/line/index.js +14 -7
  31. package/dist/CallingClient/line/index.js.map +1 -1
  32. package/dist/CallingClient/line/line.test.js +84 -22
  33. package/dist/CallingClient/line/line.test.js.map +1 -1
  34. package/dist/CallingClient/line/types.js.map +1 -1
  35. package/dist/CallingClient/registration/register.js +79 -59
  36. package/dist/CallingClient/registration/register.js.map +1 -1
  37. package/dist/CallingClient/registration/register.test.js +1 -1
  38. package/dist/CallingClient/registration/register.test.js.map +1 -1
  39. package/dist/CallingClient/types.js.map +1 -1
  40. package/dist/Events/types.js +2 -0
  41. package/dist/Events/types.js.map +1 -1
  42. package/dist/common/Utils.js +18 -13
  43. package/dist/common/Utils.js.map +1 -1
  44. package/dist/common/Utils.test.js +97 -0
  45. package/dist/common/Utils.test.js.map +1 -1
  46. package/dist/common/constants.js +4 -3
  47. package/dist/common/constants.js.map +1 -1
  48. package/dist/common/types.js +1 -0
  49. package/dist/common/types.js.map +1 -1
  50. package/dist/module/CallHistory/CallHistory.js +64 -2
  51. package/dist/module/CallHistory/callHistoryFixtures.js +24 -0
  52. package/dist/module/CallHistory/constants.js +3 -0
  53. package/dist/module/CallingClient/CallingClient.js +1 -1
  54. package/dist/module/CallingClient/calling/CallerId/index.js +6 -6
  55. package/dist/module/CallingClient/calling/call.js +66 -22
  56. package/dist/module/CallingClient/calling/callManager.js +5 -5
  57. package/dist/module/CallingClient/calling/types.js +5 -0
  58. package/dist/module/CallingClient/constants.js +1 -2
  59. package/dist/module/CallingClient/line/index.js +14 -8
  60. package/dist/module/CallingClient/registration/register.js +12 -4
  61. package/dist/module/Events/types.js +2 -0
  62. package/dist/module/common/Utils.js +12 -5
  63. package/dist/module/common/constants.js +3 -2
  64. package/dist/module/common/types.js +1 -0
  65. package/dist/types/CallHistory/CallHistory.d.ts +4 -2
  66. package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
  67. package/dist/types/CallHistory/callHistoryFixtures.d.ts +6 -2
  68. package/dist/types/CallHistory/callHistoryFixtures.d.ts.map +1 -1
  69. package/dist/types/CallHistory/constants.d.ts +3 -0
  70. package/dist/types/CallHistory/constants.d.ts.map +1 -1
  71. package/dist/types/CallHistory/types.d.ts +9 -0
  72. package/dist/types/CallHistory/types.d.ts.map +1 -1
  73. package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
  74. package/dist/types/CallingClient/calling/CallerId/index.d.ts.map +1 -1
  75. package/dist/types/CallingClient/calling/call.d.ts +7 -5
  76. package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
  77. package/dist/types/CallingClient/calling/callManager.d.ts +1 -1
  78. package/dist/types/CallingClient/calling/callManager.d.ts.map +1 -1
  79. package/dist/types/CallingClient/calling/types.d.ts +6 -2
  80. package/dist/types/CallingClient/calling/types.d.ts.map +1 -1
  81. package/dist/types/CallingClient/constants.d.ts +1 -2
  82. package/dist/types/CallingClient/constants.d.ts.map +1 -1
  83. package/dist/types/CallingClient/line/index.d.ts +3 -2
  84. package/dist/types/CallingClient/line/index.d.ts.map +1 -1
  85. package/dist/types/CallingClient/line/types.d.ts +1 -1
  86. package/dist/types/CallingClient/line/types.d.ts.map +1 -1
  87. package/dist/types/CallingClient/registration/register.d.ts +4 -2
  88. package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
  89. package/dist/types/CallingClient/types.d.ts +1 -0
  90. package/dist/types/CallingClient/types.d.ts.map +1 -1
  91. package/dist/types/Contacts/ContactsClient.d.ts +1 -1
  92. package/dist/types/Events/types.d.ts +15 -2
  93. package/dist/types/Events/types.d.ts.map +1 -1
  94. package/dist/types/Voicemail/UcmBackendConnector.d.ts +1 -1
  95. package/dist/types/Voicemail/WxCallBackendConnector.d.ts +1 -1
  96. package/dist/types/common/Utils.d.ts +2 -2
  97. package/dist/types/common/Utils.d.ts.map +1 -1
  98. package/dist/types/common/constants.d.ts +1 -0
  99. package/dist/types/common/constants.d.ts.map +1 -1
  100. package/dist/types/common/types.d.ts +2 -1
  101. package/dist/types/common/types.d.ts.map +1 -1
  102. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"names":["LINE_EVENTS","exports"],"sources":["types.ts"],"sourcesContent":["import {LineEventTypes} from '../../Events/types';\nimport {Eventing} from '../../Events/impl';\nimport {IRegistration} from '../registration/types';\nimport {LineError} from '../../Errors/catalog/LineError';\nimport {\n CallDetails,\n CorrelationId,\n IDeviceInfo,\n MobiusDeviceId,\n RegistrationStatus,\n} from '../../common/types';\nimport {ICall} from '../calling/types';\n\nexport enum LINE_EVENTS {\n CONNECTING = 'connecting',\n ERROR = 'error',\n RECONNECTED = 'reconnected',\n RECONNECTING = 'reconnecting',\n REGISTERED = 'registered',\n UNREGISTERED = 'unregistered',\n INCOMING_CALL = 'line:incoming_call',\n}\n\n/**\n * Represents an interface for managing a telephony line.\n */\nexport interface ILine extends Eventing<LineEventTypes> {\n /**\n * The unique identifier of the user associated with the line.\n */\n userId: string;\n\n /**\n * The URI of the client device associated with the line.\n */\n clientDeviceUri: string;\n\n /**\n * The unique identifier of the line.\n */\n lineId: string;\n\n /**\n * The optional Mobius device identifier associated with the line.\n */\n mobiusDeviceId?: string;\n\n /**\n * The phone number associated with the line.\n */\n phoneNumber?: string;\n\n /**\n * The extension number associated with the line.\n */\n extension?: string;\n\n /**\n * An array of SIP addresses associated with the line.\n */\n sipAddresses?: string[];\n\n /**\n * The voicemail number associated with the line.\n */\n voicemail?: string;\n\n /**\n * The timestamp when the line was last seen.\n */\n lastSeen?: string;\n\n /**\n * The interval for sending keep-alive messages for the line.\n */\n keepaliveInterval?: number;\n\n /**\n * The interval for sending call keep-alive messages for the line.\n */\n callKeepaliveInterval?: number;\n\n /**\n * The minimum rehoming interval for the line.\n */\n rehomingIntervalMin?: number;\n\n /**\n * The maximum rehoming interval for the line.\n */\n rehomingIntervalMax?: number;\n\n /**\n * The voice portal number associated with the line.\n */\n voicePortalNumber?: number;\n\n /**\n * The voice portal extension associated with the line.\n */\n voicePortalExtension?: number;\n\n /**\n * The registration information for the line as {@link IRegistration}.\n */\n registration: IRegistration;\n\n /**\n * Registers the line.\n */\n register(): void;\n\n /**\n * Deregisters the line.\n */\n deregister(): void;\n\n /**\n * Retrieves the active Mobius server URL associated with the line.\n *\n */\n getActiveMobiusUrl(): string;\n\n /**\n * Retrieves the registration status of the line as {@link MobiusStatus}.\n *\n */\n getStatus(): RegistrationStatus;\n\n /**\n * Retrieves the device identifier associated with the line as {@link MobiusDeviceId},\n * or `undefined` if no device is associated.\n *\n */\n getDeviceId(): MobiusDeviceId | undefined;\n\n /**\n * Emits line-related events.\n *\n * @param event - The line event to emit.\n * @param deviceInfo - Additional device information (optional).\n * @param lineError - Information about line-related errors (optional).\n *\n * @example\n * ```typescript\n * line.lineEmitter(LINE_EVENTS.UNREGISTERED);\n * ```\n * @ignore\n */\n lineEmitter: (event: LINE_EVENTS, deviceInfo?: IDeviceInfo, lineError?: LineError) => void;\n\n /**\n * Initiates a call to the specified destination.\n *\n * @param dest - The call details including destination information.\n *\n * @example\n * ```typescript\n * const callDetails : CallDetails = {type: 'uri', address: 'example@webex.com'};\n * const callObj: ICall = line.makeCall(callDetails);\n * ```\n */\n makeCall(dest: CallDetails): ICall | undefined;\n\n /**\n * Retrieves a call object based on the provided correlation identifier.\n *\n * @param correlationId - The correlation identifier of the call.\n * @example\n * ```typescript\n * const callObj: ICall = line.getCall(correlationId);\n * ```\n */\n getCall(correlationId: CorrelationId): ICall;\n}\n\nexport type LineEmitterCallback = (\n event: LINE_EVENTS,\n deviceInfo?: IDeviceInfo,\n clientError?: LineError\n) => void;\n\nexport type LineErrorEmitterCallback = (err: LineError, finalError?: boolean) => void;\n"],"mappings":";;;;;;;IAaYA,WAAW,GAAAC,OAAA,CAAAD,WAAA,0BAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA;AAUvB;AACA;AACA"}
1
+ {"version":3,"names":["LINE_EVENTS","exports"],"sources":["types.ts"],"sourcesContent":["import {LineEventTypes} from '../../Events/types';\nimport {Eventing} from '../../Events/impl';\nimport {IRegistration} from '../registration/types';\nimport {LineError} from '../../Errors/catalog/LineError';\nimport {\n CallDetails,\n CorrelationId,\n IDeviceInfo,\n MobiusDeviceId,\n RegistrationStatus,\n} from '../../common/types';\nimport {ICall} from '../calling/types';\n\nexport enum LINE_EVENTS {\n CONNECTING = 'connecting',\n ERROR = 'error',\n RECONNECTED = 'reconnected',\n RECONNECTING = 'reconnecting',\n REGISTERED = 'registered',\n UNREGISTERED = 'unregistered',\n INCOMING_CALL = 'line:incoming_call',\n}\n\n/**\n * Represents an interface for managing a telephony line.\n */\nexport interface ILine extends Eventing<LineEventTypes> {\n /**\n * The unique identifier of the user associated with the line.\n */\n userId: string;\n\n /**\n * The URI of the client device associated with the line.\n */\n clientDeviceUri: string;\n\n /**\n * The unique identifier of the line.\n */\n lineId: string;\n\n /**\n * The optional Mobius device identifier associated with the line.\n */\n mobiusDeviceId?: string;\n\n /**\n * The phone number associated with the line.\n */\n phoneNumber?: string;\n\n /**\n * The extension number associated with the line.\n */\n extension?: string;\n\n /**\n * An array of SIP addresses associated with the line.\n */\n sipAddresses?: string[];\n\n /**\n * The voicemail number associated with the line.\n */\n voicemail?: string;\n\n /**\n * The timestamp when the line was last seen.\n */\n lastSeen?: string;\n\n /**\n * The interval for sending keep-alive messages for the line.\n */\n keepaliveInterval?: number;\n\n /**\n * The interval for sending call keep-alive messages for the line.\n */\n callKeepaliveInterval?: number;\n\n /**\n * The minimum rehoming interval for the line.\n */\n rehomingIntervalMin?: number;\n\n /**\n * The maximum rehoming interval for the line.\n */\n rehomingIntervalMax?: number;\n\n /**\n * The voice portal number associated with the line.\n */\n voicePortalNumber?: number;\n\n /**\n * The voice portal extension associated with the line.\n */\n voicePortalExtension?: number;\n\n /**\n * The registration information for the line as {@link IRegistration}.\n */\n registration: IRegistration;\n\n /**\n * Registers the line.\n */\n register(): void;\n\n /**\n * Deregisters the line.\n */\n deregister(): void;\n\n /**\n * Retrieves the active Mobius server URL associated with the line.\n *\n */\n getActiveMobiusUrl(): string;\n\n /**\n * Retrieves the registration status of the line as {@link MobiusStatus}.\n *\n */\n getStatus(): RegistrationStatus;\n\n /**\n * Retrieves the device identifier associated with the line as {@link MobiusDeviceId},\n * or `undefined` if no device is associated.\n *\n */\n getDeviceId(): MobiusDeviceId | undefined;\n\n /**\n * Emits line-related events.\n *\n * @param event - The line event to emit.\n * @param deviceInfo - Additional device information (optional).\n * @param lineError - Information about line-related errors (optional).\n *\n * @example\n * ```typescript\n * line.lineEmitter(LINE_EVENTS.UNREGISTERED);\n * ```\n * @ignore\n */\n lineEmitter: (event: LINE_EVENTS, deviceInfo?: IDeviceInfo, lineError?: LineError) => void;\n\n /**\n * Initiates a call to the specified destination.\n *\n * @param dest - The call details including destination information.\n *\n * @example\n * ```typescript\n * const callDetails : CallDetails = {type: 'uri', address: 'example@webex.com'};\n * const callObj: ICall = line.makeCall(callDetails);\n * ```\n */\n makeCall(dest?: CallDetails): ICall | undefined;\n\n /**\n * Retrieves a call object based on the provided correlation identifier.\n *\n * @param correlationId - The correlation identifier of the call.\n * @example\n * ```typescript\n * const callObj: ICall = line.getCall(correlationId);\n * ```\n */\n getCall(correlationId: CorrelationId): ICall;\n}\n\nexport type LineEmitterCallback = (\n event: LINE_EVENTS,\n deviceInfo?: IDeviceInfo,\n clientError?: LineError\n) => void;\n\nexport type LineErrorEmitterCallback = (err: LineError, finalError?: boolean) => void;\n"],"mappings":";;;;;;;IAaYA,WAAW,GAAAC,OAAA,CAAAD,WAAA,0BAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA;AAUvB;AACA;AACA"}
@@ -1,10 +1,15 @@
1
1
  "use strict";
2
2
 
3
+ var _Object$keys2 = require("@babel/runtime-corejs2/core-js/object/keys");
4
+ var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs2/core-js/object/get-own-property-symbols");
5
+ var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
6
+ var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
7
+ var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
8
+ var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
3
9
  var _Array$from = require("@babel/runtime-corejs2/core-js/array/from");
4
10
  var _Symbol = require("@babel/runtime-corejs2/core-js/symbol");
5
11
  var _Symbol$iterator = require("@babel/runtime-corejs2/core-js/symbol/iterator");
6
12
  var _Array$isArray = require("@babel/runtime-corejs2/core-js/array/is-array");
7
- var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
8
13
  var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
9
14
  _Object$defineProperty(exports, "__esModule", {
10
15
  value: true
@@ -31,13 +36,15 @@ var _types4 = require("../line/types");
31
36
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && o[_Symbol$iterator] || o["@@iterator"]; if (!it) { if (_Array$isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
32
37
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
33
38
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
39
+ function ownKeys(e, r) { var t = _Object$keys2(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
40
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
34
41
  /**
35
42
  *
36
43
  */
37
44
  var Registration = exports.Registration = /*#__PURE__*/function () {
38
45
  /**
39
46
  */
40
- function Registration(webex, serviceData, mutex, lineEmitter, logLevel) {
47
+ function Registration(webex, serviceData, mutex, lineEmitter, logLevel, jwe) {
41
48
  (0, _classCallCheck2.default)(this, Registration);
42
49
  (0, _defineProperty2.default)(this, "sdkConnector", void 0);
43
50
  (0, _defineProperty2.default)(this, "webex", void 0);
@@ -59,7 +66,10 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
59
66
  (0, _defineProperty2.default)(this, "backupMobiusUris", void 0);
60
67
  (0, _defineProperty2.default)(this, "registerRetry", false);
61
68
  (0, _defineProperty2.default)(this, "reconnectPending", false);
69
+ (0, _defineProperty2.default)(this, "jwe", void 0);
62
70
  (0, _defineProperty2.default)(this, "isCCFlow", false);
71
+ (0, _defineProperty2.default)(this, "failoverImmediately", false);
72
+ this.jwe = jwe;
63
73
  this.sdkConnector = _SDKConnector.default;
64
74
  this.serviceData = serviceData;
65
75
  this.isCCFlow = serviceData.indicator === _types3.ServiceIndicator.CONTACT_CENTER;
@@ -207,7 +217,9 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
207
217
  deviceInfo = {
208
218
  userId: this.userId,
209
219
  clientDeviceUri: this.webex.internal.device.url,
210
- serviceData: this.serviceData
220
+ serviceData: this.jwe ? _objectSpread(_objectSpread({}, this.serviceData), {}, {
221
+ jwe: this.jwe
222
+ }) : this.serviceData
211
223
  };
212
224
  return _context3.abrupt("return", this.webex.request({
213
225
  uri: "".concat(url, "device"),
@@ -362,7 +374,7 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
362
374
  excessVal = timeElapsed + interval - TIMER_THRESHOLD;
363
375
  interval -= excessVal;
364
376
  }
365
- if (!(interval > _constants.BASE_REG_RETRY_TIMER_VAL_IN_SEC)) {
377
+ if (!(interval > _constants.BASE_REG_RETRY_TIMER_VAL_IN_SEC && !this.failoverImmediately)) {
366
378
  _context10.next = 12;
367
379
  break;
368
380
  }
@@ -401,17 +413,18 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
401
413
  }, _callee7);
402
414
  })), interval * _constants.SEC_TO_MSEC_MFACTOR);
403
415
  _Logger.default.log("Scheduled retry with primary in ".concat(interval, " seconds, number of attempts : ").concat(attempt), loggerContext);
404
- _context10.next = 21;
416
+ _context10.next = 22;
405
417
  break;
406
418
  case 12:
407
419
  if (!this.backupMobiusUris.length) {
408
- _context10.next = 20;
420
+ _context10.next = 21;
409
421
  break;
410
422
  }
411
423
  _Logger.default.log('Failing over to backup servers.', loggerContext);
412
- _context10.next = 16;
424
+ this.failoverImmediately = false;
425
+ _context10.next = 17;
413
426
  return this.attemptRegistrationWithServers(this.startFailoverTimer.name, this.backupMobiusUris);
414
- case 16:
427
+ case 17:
415
428
  abort = _context10.sent;
416
429
  if (!abort && !this.isDeviceRegistered()) {
417
430
  interval = this.getRegRetryInterval();
@@ -447,13 +460,13 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
447
460
  })), interval * _constants.SEC_TO_MSEC_MFACTOR);
448
461
  _Logger.default.log("Scheduled retry with backup servers in ".concat(interval, " seconds."), loggerContext);
449
462
  }
450
- _context10.next = 21;
463
+ _context10.next = 22;
451
464
  break;
452
- case 20:
465
+ case 21:
453
466
  (0, _common.emitFinalFailure)(function (clientError) {
454
467
  _this.lineEmitter(_types4.LINE_EVENTS.ERROR, undefined, clientError);
455
468
  }, loggerContext);
456
- case 21:
469
+ case 22:
457
470
  case "end":
458
471
  return _context10.stop();
459
472
  }
@@ -919,8 +932,14 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
919
932
  case 0:
920
933
  servers = _args19.length > 1 && _args19[1] !== undefined ? _args19[1] : this.primaryMobiusUris;
921
934
  abort = false;
935
+ if (!this.failoverImmediately) {
936
+ _context19.next = 4;
937
+ break;
938
+ }
939
+ return _context19.abrupt("return", abort);
940
+ case 4:
922
941
  if (!this.isDeviceRegistered()) {
923
- _context19.next = 5;
942
+ _context19.next = 7;
924
943
  break;
925
944
  }
926
945
  _Logger.default.log("[".concat(caller, "] : Device already registered with : ").concat(this.activeMobiusUrl), {
@@ -928,17 +947,17 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
928
947
  method: this.attemptRegistrationWithServers.name
929
948
  });
930
949
  return _context19.abrupt("return", abort);
931
- case 5:
950
+ case 7:
932
951
  _iterator = _createForOfIteratorHelper(servers);
933
- _context19.prev = 6;
952
+ _context19.prev = 8;
934
953
  _iterator.s();
935
- case 8:
954
+ case 10:
936
955
  if ((_step = _iterator.n()).done) {
937
- _context19.next = 53;
956
+ _context19.next = 55;
938
957
  break;
939
958
  }
940
959
  url = _step.value;
941
- _context19.prev = 10;
960
+ _context19.prev = 12;
942
961
  abort = false;
943
962
  this.registrationStatus = _types3.RegistrationStatus.INACTIVE;
944
963
  this.lineEmitter(_types4.LINE_EVENTS.CONNECTING);
@@ -947,9 +966,9 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
947
966
  method: this.attemptRegistrationWithServers.name
948
967
  });
949
968
  // eslint-disable-next-line no-await-in-loop
950
- _context19.next = 17;
969
+ _context19.next = 19;
951
970
  return this.postRegistration(url);
952
- case 17:
971
+ case 19:
953
972
  resp = _context19.sent;
954
973
  this.deviceInfo = resp.body;
955
974
  this.registrationStatus = _types3.RegistrationStatus.ACTIVE;
@@ -960,12 +979,12 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
960
979
  this.metricManager.submitRegistrationMetric(_types2.METRIC_EVENT.REGISTRATION, _types2.REG_ACTION.REGISTER, _types2.METRIC_TYPE.BEHAVIORAL, undefined);
961
980
  this.startKeepaliveTimer((_this$deviceInfo$devi = this.deviceInfo.device) === null || _this$deviceInfo$devi === void 0 ? void 0 : _this$deviceInfo$devi.uri, this.deviceInfo.keepaliveInterval);
962
981
  this.initiateFailback();
963
- return _context19.abrupt("break", 53);
964
- case 30:
965
- _context19.prev = 30;
966
- _context19.t0 = _context19["catch"](10);
982
+ return _context19.abrupt("break", 55);
983
+ case 32:
984
+ _context19.prev = 32;
985
+ _context19.t0 = _context19["catch"](12);
967
986
  body = _context19.t0; // eslint-disable-next-line no-await-in-loop, @typescript-eslint/no-unused-vars
968
- _context19.next = 35;
987
+ _context19.next = 37;
969
988
  return (0, _common.handleRegistrationErrors)(body, function (clientError, finalError) {
970
989
  if (finalError) {
971
990
  _this6.lineEmitter(_types4.LINE_EVENTS.ERROR, undefined, clientError);
@@ -977,60 +996,60 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
977
996
  method: this.attemptRegistrationWithServers.name,
978
997
  file: _constants.REGISTRATION_FILE
979
998
  }, this.restoreRegistrationCallBack());
980
- case 35:
999
+ case 37:
981
1000
  abort = _context19.sent;
982
1001
  if (!(this.registrationStatus === _types3.RegistrationStatus.ACTIVE)) {
983
- _context19.next = 39;
1002
+ _context19.next = 41;
984
1003
  break;
985
1004
  }
986
1005
  _Logger.default.info("[".concat(caller, "] : Device is already restored, active mobius url: ").concat(this.activeMobiusUrl), {
987
1006
  file: _constants.REGISTRATION_FILE,
988
1007
  method: this.attemptRegistrationWithServers.name
989
1008
  });
990
- return _context19.abrupt("break", 53);
991
- case 39:
1009
+ return _context19.abrupt("break", 55);
1010
+ case 41:
992
1011
  if (!abort) {
993
- _context19.next = 44;
1012
+ _context19.next = 46;
994
1013
  break;
995
1014
  }
996
1015
  this.setStatus(_types3.RegistrationStatus.INACTIVE);
997
- return _context19.abrupt("break", 53);
998
- case 44:
1016
+ return _context19.abrupt("break", 55);
1017
+ case 46:
999
1018
  if (!(caller === this.executeFailback.name)) {
1000
- _context19.next = 51;
1019
+ _context19.next = 53;
1001
1020
  break;
1002
1021
  }
1003
1022
  error = body.statusCode;
1004
1023
  if (!(error === _types.ERROR_CODE.TOO_MANY_REQUESTS)) {
1005
- _context19.next = 51;
1024
+ _context19.next = 53;
1006
1025
  break;
1007
1026
  }
1008
- _context19.next = 49;
1027
+ _context19.next = 51;
1009
1028
  return this.scheduleFailback429Retry();
1010
- case 49:
1011
- abort = true;
1012
- return _context19.abrupt("break", 53);
1013
1029
  case 51:
1014
- _context19.next = 8;
1015
- break;
1030
+ abort = true;
1031
+ return _context19.abrupt("break", 55);
1016
1032
  case 53:
1017
- _context19.next = 58;
1033
+ _context19.next = 10;
1018
1034
  break;
1019
1035
  case 55:
1020
- _context19.prev = 55;
1021
- _context19.t1 = _context19["catch"](6);
1036
+ _context19.next = 60;
1037
+ break;
1038
+ case 57:
1039
+ _context19.prev = 57;
1040
+ _context19.t1 = _context19["catch"](8);
1022
1041
  _iterator.e(_context19.t1);
1023
- case 58:
1024
- _context19.prev = 58;
1042
+ case 60:
1043
+ _context19.prev = 60;
1025
1044
  _iterator.f();
1026
- return _context19.finish(58);
1027
- case 61:
1045
+ return _context19.finish(60);
1046
+ case 63:
1028
1047
  return _context19.abrupt("return", abort);
1029
- case 62:
1048
+ case 64:
1030
1049
  case "end":
1031
1050
  return _context19.stop();
1032
1051
  }
1033
- }, _callee19, this, [[6, 55, 58, 61], [10, 30]]);
1052
+ }, _callee19, this, [[8, 57, 60, 63], [12, 32]]);
1034
1053
  }));
1035
1054
  function attemptRegistrationWithServers(_x11) {
1036
1055
  return _attemptRegistrationWithServers.apply(this, arguments);
@@ -1065,7 +1084,7 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1065
1084
  while (1) switch (_context20.prev = _context20.next) {
1066
1085
  case 0:
1067
1086
  if (!(_this7.isDeviceRegistered() && keepAliveRetryCount < RETRY_COUNT_THRESHOLD)) {
1068
- _context20.next = 29;
1087
+ _context20.next = 30;
1069
1088
  break;
1070
1089
  }
1071
1090
  _context20.prev = 1;
@@ -1078,7 +1097,7 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1078
1097
  _this7.lineEmitter(_types4.LINE_EVENTS.RECONNECTED);
1079
1098
  }
1080
1099
  keepAliveRetryCount = 0;
1081
- _context20.next = 29;
1100
+ _context20.next = 30;
1082
1101
  break;
1083
1102
  case 10:
1084
1103
  _context20.prev = 10;
@@ -1099,25 +1118,26 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1099
1118
  case 17:
1100
1119
  abort = _context20.sent;
1101
1120
  if (!(abort || keepAliveRetryCount >= RETRY_COUNT_THRESHOLD)) {
1102
- _context20.next = 28;
1121
+ _context20.next = 29;
1103
1122
  break;
1104
1123
  }
1124
+ _this7.failoverImmediately = _this7.isCCFlow;
1105
1125
  _this7.setStatus(_types3.RegistrationStatus.INACTIVE);
1106
1126
  _this7.clearKeepaliveTimer();
1107
1127
  _this7.clearFailbackTimer();
1108
1128
  _this7.lineEmitter(_types4.LINE_EVENTS.UNREGISTERED);
1109
1129
  if (abort) {
1110
- _context20.next = 26;
1130
+ _context20.next = 27;
1111
1131
  break;
1112
1132
  }
1113
- _context20.next = 26;
1133
+ _context20.next = 27;
1114
1134
  return _this7.reconnectOnFailure(_this7.startKeepaliveTimer.name);
1115
- case 26:
1116
- _context20.next = 29;
1135
+ case 27:
1136
+ _context20.next = 30;
1117
1137
  break;
1118
- case 28:
1119
- _this7.lineEmitter(_types4.LINE_EVENTS.RECONNECTING);
1120
1138
  case 29:
1139
+ _this7.lineEmitter(_types4.LINE_EVENTS.RECONNECTING);
1140
+ case 30:
1121
1141
  case "end":
1122
1142
  return _context20.stop();
1123
1143
  }
@@ -1285,7 +1305,7 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1285
1305
  }();
1286
1306
  /*
1287
1307
  */
1288
- var createRegistration = exports.createRegistration = function createRegistration(webex, serviceData, mutex, lineEmitter, logLevel) {
1289
- return new Registration(webex, serviceData, mutex, lineEmitter, logLevel);
1308
+ var createRegistration = exports.createRegistration = function createRegistration(webex, serviceData, mutex, lineEmitter, logLevel, jwe) {
1309
+ return new Registration(webex, serviceData, mutex, lineEmitter, logLevel, jwe);
1290
1310
  };
1291
1311
  //# sourceMappingURL=register.js.map