@webex/calling 3.10.0 → 3.11.0-next.10

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 (158) hide show
  1. package/dist/CallHistory/CallHistory.js +128 -133
  2. package/dist/CallHistory/CallHistory.js.map +1 -1
  3. package/dist/CallHistory/CallHistory.test.js +289 -186
  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 +72 -25
  10. package/dist/CallSettings/UcmBackendConnector.js.map +1 -1
  11. package/dist/CallSettings/UcmBackendConnector.test.js +138 -48
  12. package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -1
  13. package/dist/CallSettings/WxCallBackendConnector.js +138 -145
  14. package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
  15. package/dist/CallSettings/WxCallBackendConnector.test.js +149 -150
  16. package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -1
  17. package/dist/CallingClient/CallingClient.js +407 -359
  18. package/dist/CallingClient/CallingClient.js.map +1 -1
  19. package/dist/CallingClient/CallingClient.test.js +378 -401
  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 +666 -624
  26. package/dist/CallingClient/calling/call.js.map +1 -1
  27. package/dist/CallingClient/calling/call.test.js +908 -556
  28. package/dist/CallingClient/calling/call.test.js.map +1 -1
  29. package/dist/CallingClient/calling/callManager.js +22 -18
  30. package/dist/CallingClient/calling/callManager.js.map +1 -1
  31. package/dist/CallingClient/calling/callManager.test.js +114 -114
  32. package/dist/CallingClient/calling/callManager.test.js.map +1 -1
  33. package/dist/CallingClient/constants.js +7 -1
  34. package/dist/CallingClient/constants.js.map +1 -1
  35. package/dist/CallingClient/line/index.js +57 -74
  36. package/dist/CallingClient/line/index.js.map +1 -1
  37. package/dist/CallingClient/line/line.test.js +22 -22
  38. package/dist/CallingClient/line/line.test.js.map +1 -1
  39. package/dist/CallingClient/registration/register.js +675 -527
  40. package/dist/CallingClient/registration/register.js.map +1 -1
  41. package/dist/CallingClient/registration/register.test.js +657 -309
  42. package/dist/CallingClient/registration/register.test.js.map +1 -1
  43. package/dist/CallingClient/registration/types.js.map +1 -1
  44. package/dist/CallingClient/registration/webWorker.js +24 -24
  45. package/dist/CallingClient/registration/webWorker.js.map +1 -1
  46. package/dist/CallingClient/registration/webWorker.test.js +20 -20
  47. package/dist/CallingClient/registration/webWorker.test.js.map +1 -1
  48. package/dist/CallingClient/registration/webWorkerStr.js +1 -1
  49. package/dist/CallingClient/registration/webWorkerStr.js.map +1 -1
  50. package/dist/CallingClient/types.js.map +1 -1
  51. package/dist/CallingClient/windowsChromiumIceWarmupUtils.js +28 -28
  52. package/dist/CallingClient/windowsChromiumIceWarmupUtils.js.map +1 -1
  53. package/dist/Contacts/ContactsClient.js +259 -268
  54. package/dist/Contacts/ContactsClient.js.map +1 -1
  55. package/dist/Contacts/ContactsClient.test.js +64 -63
  56. package/dist/Contacts/ContactsClient.test.js.map +1 -1
  57. package/dist/Errors/catalog/CallError.js +7 -10
  58. package/dist/Errors/catalog/CallError.js.map +1 -1
  59. package/dist/Errors/catalog/CallingDeviceError.js +6 -9
  60. package/dist/Errors/catalog/CallingDeviceError.js.map +1 -1
  61. package/dist/Errors/catalog/ExtendedError.js +6 -8
  62. package/dist/Errors/catalog/ExtendedError.js.map +1 -1
  63. package/dist/Errors/catalog/LineError.js +6 -9
  64. package/dist/Errors/catalog/LineError.js.map +1 -1
  65. package/dist/Events/impl/index.js +12 -14
  66. package/dist/Events/impl/index.js.map +1 -1
  67. package/dist/Logger/index.js +3 -3
  68. package/dist/Logger/index.js.map +1 -1
  69. package/dist/Logger/index.test.js +1 -1
  70. package/dist/Logger/index.test.js.map +1 -1
  71. package/dist/Metrics/index.js +1 -2
  72. package/dist/Metrics/index.js.map +1 -1
  73. package/dist/SDKConnector/index.js +1 -2
  74. package/dist/SDKConnector/index.js.map +1 -1
  75. package/dist/SDKConnector/types.js.map +1 -1
  76. package/dist/Voicemail/BroadworksBackendConnector.js +131 -139
  77. package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -1
  78. package/dist/Voicemail/BroadworksBackendConnector.test.js +106 -98
  79. package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -1
  80. package/dist/Voicemail/UcmBackendConnector.js +88 -92
  81. package/dist/Voicemail/UcmBackendConnector.js.map +1 -1
  82. package/dist/Voicemail/UcmBackendConnector.test.js +72 -72
  83. package/dist/Voicemail/UcmBackendConnector.test.js.map +1 -1
  84. package/dist/Voicemail/Voicemail.js +103 -131
  85. package/dist/Voicemail/Voicemail.js.map +1 -1
  86. package/dist/Voicemail/Voicemail.test.js +20 -20
  87. package/dist/Voicemail/Voicemail.test.js.map +1 -1
  88. package/dist/Voicemail/WxCallBackendConnector.js +117 -131
  89. package/dist/Voicemail/WxCallBackendConnector.js.map +1 -1
  90. package/dist/Voicemail/WxCallBackendConnector.test.js +180 -154
  91. package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -1
  92. package/dist/common/Utils.js +198 -166
  93. package/dist/common/Utils.js.map +1 -1
  94. package/dist/common/Utils.test.js +436 -191
  95. package/dist/common/Utils.test.js.map +1 -1
  96. package/dist/common/constants.js +3 -1
  97. package/dist/common/constants.js.map +1 -1
  98. package/dist/common/testUtil.js +5 -4
  99. package/dist/common/testUtil.js.map +1 -1
  100. package/dist/common/types.js.map +1 -1
  101. package/dist/module/CallHistory/CallHistory.js +20 -11
  102. package/dist/module/CallSettings/UcmBackendConnector.js +21 -8
  103. package/dist/module/CallSettings/WxCallBackendConnector.js +10 -15
  104. package/dist/module/CallingClient/CallingClient.js +125 -123
  105. package/dist/module/CallingClient/calling/call.js +76 -60
  106. package/dist/module/CallingClient/calling/callManager.js +7 -0
  107. package/dist/module/CallingClient/constants.js +5 -0
  108. package/dist/module/CallingClient/registration/register.js +93 -5
  109. package/dist/module/CallingClient/registration/webWorker.js +2 -2
  110. package/dist/module/CallingClient/registration/webWorkerStr.js +2 -2
  111. package/dist/module/Contacts/ContactsClient.js +19 -25
  112. package/dist/module/Events/impl/index.js +1 -1
  113. package/dist/module/Logger/index.js +2 -2
  114. package/dist/module/Voicemail/BroadworksBackendConnector.js +10 -18
  115. package/dist/module/Voicemail/UcmBackendConnector.js +7 -11
  116. package/dist/module/Voicemail/Voicemail.js +42 -68
  117. package/dist/module/Voicemail/WxCallBackendConnector.js +14 -28
  118. package/dist/module/common/Utils.js +31 -5
  119. package/dist/module/common/constants.js +2 -0
  120. package/dist/module/common/testUtil.js +1 -0
  121. package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
  122. package/dist/types/CallSettings/UcmBackendConnector.d.ts +1 -0
  123. package/dist/types/CallSettings/UcmBackendConnector.d.ts.map +1 -1
  124. package/dist/types/CallSettings/WxCallBackendConnector.d.ts.map +1 -1
  125. package/dist/types/CallingClient/CallingClient.d.ts +2 -1
  126. package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
  127. package/dist/types/CallingClient/calling/call.d.ts +4 -0
  128. package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
  129. package/dist/types/CallingClient/calling/callManager.d.ts.map +1 -1
  130. package/dist/types/CallingClient/constants.d.ts +5 -0
  131. package/dist/types/CallingClient/constants.d.ts.map +1 -1
  132. package/dist/types/CallingClient/registration/register.d.ts +6 -1
  133. package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
  134. package/dist/types/CallingClient/registration/types.d.ts +8 -1
  135. package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
  136. package/dist/types/CallingClient/registration/webWorkerStr.d.ts +1 -1
  137. package/dist/types/CallingClient/registration/webWorkerStr.d.ts.map +1 -1
  138. package/dist/types/CallingClient/types.d.ts +2 -1
  139. package/dist/types/CallingClient/types.d.ts.map +1 -1
  140. package/dist/types/Contacts/ContactsClient.d.ts +1 -0
  141. package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
  142. package/dist/types/Logger/index.d.ts +1 -2
  143. package/dist/types/Logger/index.d.ts.map +1 -1
  144. package/dist/types/SDKConnector/types.d.ts +16 -0
  145. package/dist/types/SDKConnector/types.d.ts.map +1 -1
  146. package/dist/types/Voicemail/BroadworksBackendConnector.d.ts.map +1 -1
  147. package/dist/types/Voicemail/UcmBackendConnector.d.ts.map +1 -1
  148. package/dist/types/Voicemail/Voicemail.d.ts.map +1 -1
  149. package/dist/types/Voicemail/WxCallBackendConnector.d.ts.map +1 -1
  150. package/dist/types/common/Utils.d.ts +1 -1
  151. package/dist/types/common/Utils.d.ts.map +1 -1
  152. package/dist/types/common/constants.d.ts +2 -0
  153. package/dist/types/common/constants.d.ts.map +1 -1
  154. package/dist/types/common/testUtil.d.ts +1 -0
  155. package/dist/types/common/testUtil.d.ts.map +1 -1
  156. package/dist/types/common/types.d.ts +4 -0
  157. package/dist/types/common/types.d.ts.map +1 -1
  158. package/package.json +4 -4
@@ -17,13 +17,14 @@ exports.createClient = exports.CallingClient = void 0;
17
17
  var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
18
18
  var _values = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/values"));
19
19
  var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
20
+ var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
21
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/toConsumableArray"));
20
22
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
21
23
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
22
24
  var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
23
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/assertThisInitialized"));
24
- var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inherits"));
25
25
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/possibleConstructorReturn"));
26
26
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf"));
27
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inherits"));
27
28
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
28
29
  var Media = _interopRequireWildcard(require("@webex/internal-media-core"));
29
30
  var _asyncMutex = require("async-mutex");
@@ -41,11 +42,11 @@ var _line = _interopRequireDefault(require("./line"));
41
42
  var _types4 = require("../Metrics/types");
42
43
  var _Metrics = require("../Metrics");
43
44
  var _windowsChromiumIceWarmupUtils = _interopRequireDefault(require("./windowsChromiumIceWarmupUtils"));
44
- function _interopRequireWildcard(e, t) { if ("function" == typeof _WeakMap) var r = new _WeakMap(), n = new _WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = _Object$defineProperty) && _Object$getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
45
+ function _interopRequireWildcard(e, t) { if ("function" == typeof _WeakMap) var r = new _WeakMap(), n = new _WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t9 in e) "default" !== _t9 && {}.hasOwnProperty.call(e, _t9) && ((i = (o = _Object$defineProperty) && _Object$getOwnPropertyDescriptor(e, _t9)) && (i.get || i.set) ? o(f, _t9, i) : f[_t9] = e[_t9]); return f; })(e, t); }
45
46
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof _Symbol && r[_Symbol$iterator] || r["@@iterator"]; if (!t) { if (_Array$isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, 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 o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
46
47
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? _Array$from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
47
48
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
48
- function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2.default)(t); if (r) { var s = (0, _getPrototypeOf2.default)(this).constructor; e = _Reflect$construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2.default)(this, e); }; }
49
+ function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
49
50
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /* eslint-disable no-underscore-dangle */ /* eslint-disable valid-jsdoc */ /* eslint-disable @typescript-eslint/no-shadow */
50
51
  /**
51
52
  * The `CallingClient` module provides a set of APIs for line registration and calling functionalities within the SDK.
@@ -58,8 +59,6 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
58
59
  * ```
59
60
  */
60
61
  var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
61
- (0, _inherits2.default)(CallingClient, _Eventing);
62
- var _super = _createSuper(CallingClient);
63
62
  /**
64
63
  * @ignore
65
64
  */
@@ -67,33 +66,33 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
67
66
  var _this$sdkConfig, _this$sdkConfig$servi, _this$sdkConfig2, _this$sdkConfig2$logg;
68
67
  var _this;
69
68
  (0, _classCallCheck2.default)(this, CallingClient);
70
- _this = _super.call(this);
71
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "sdkConnector", void 0);
72
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "webex", void 0);
73
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "mutex", void 0);
74
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "callManager", void 0);
75
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "metricManager", void 0);
76
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "sdkConfig", void 0);
77
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "primaryMobiusUris", void 0);
78
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "backupMobiusUris", void 0);
79
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "mobiusClusters", void 0);
80
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "mobiusHost", void 0);
81
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "mediaEngine", void 0);
82
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "lineDict", {});
83
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isNetworkDown", false);
84
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "networkDownTimestamp", '');
85
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "networkUpTimestamp", '');
86
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "mercuryDownTimestamp", '');
87
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "mercuryUpTimestamp", '');
88
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleNetworkOffline", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee() {
69
+ _this = _callSuper(this, CallingClient);
70
+ (0, _defineProperty2.default)(_this, "sdkConnector", void 0);
71
+ (0, _defineProperty2.default)(_this, "webex", void 0);
72
+ (0, _defineProperty2.default)(_this, "mutex", void 0);
73
+ (0, _defineProperty2.default)(_this, "callManager", void 0);
74
+ (0, _defineProperty2.default)(_this, "metricManager", void 0);
75
+ (0, _defineProperty2.default)(_this, "sdkConfig", void 0);
76
+ (0, _defineProperty2.default)(_this, "primaryMobiusUris", void 0);
77
+ (0, _defineProperty2.default)(_this, "backupMobiusUris", void 0);
78
+ (0, _defineProperty2.default)(_this, "mobiusClusters", void 0);
79
+ (0, _defineProperty2.default)(_this, "mobiusHost", void 0);
80
+ (0, _defineProperty2.default)(_this, "mediaEngine", void 0);
81
+ (0, _defineProperty2.default)(_this, "lineDict", {});
82
+ (0, _defineProperty2.default)(_this, "isNetworkDown", false);
83
+ (0, _defineProperty2.default)(_this, "networkDownTimestamp", '');
84
+ (0, _defineProperty2.default)(_this, "networkUpTimestamp", '');
85
+ (0, _defineProperty2.default)(_this, "mercuryDownTimestamp", '');
86
+ (0, _defineProperty2.default)(_this, "mercuryUpTimestamp", '');
87
+ (0, _defineProperty2.default)(_this, "handleNetworkOffline", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee() {
89
88
  var line;
90
- return _regenerator.default.wrap(function _callee$(_context) {
89
+ return _regenerator.default.wrap(function (_context) {
91
90
  while (1) switch (_context.prev = _context.next) {
92
91
  case 0:
93
92
  _this.networkDownTimestamp = new Date().toISOString();
94
- _context.next = 3;
93
+ _context.next = 1;
95
94
  return _this.checkNetworkReachability();
96
- case 3:
95
+ case 1:
97
96
  _this.isNetworkDown = !_context.sent;
98
97
  _Logger.default.warn("Network has gone down, wait for it to come back up", {
99
98
  file: _constants2.CALLING_CLIENT_FILE,
@@ -103,21 +102,21 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
103
102
  line = (0, _values.default)(_this.lineDict)[0];
104
103
  line.registration.clearKeepaliveTimer();
105
104
  }
106
- case 6:
105
+ case 2:
107
106
  case "end":
108
107
  return _context.stop();
109
108
  }
110
109
  }, _callee);
111
110
  })));
112
111
  // Wondering if we should keep this for timestamp recording purpose
113
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleNetworkOnline", function () {
112
+ (0, _defineProperty2.default)(_this, "handleNetworkOnline", function () {
114
113
  _Logger.default.info(_constants.METHOD_START_MESSAGE, {
115
114
  file: _constants2.CALLING_CLIENT_FILE,
116
115
  method: _constants2.METHODS.NETWORK_ONLINE
117
116
  });
118
117
  _this.networkUpTimestamp = new Date().toISOString();
119
118
  });
120
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleMercuryOffline", function () {
119
+ (0, _defineProperty2.default)(_this, "handleMercuryOffline", function () {
121
120
  _Logger.default.warn("Mercury down, waiting for connection to be up", {
122
121
  file: _constants2.CALLING_CLIENT_FILE,
123
122
  method: _constants2.METHODS.MERCURY_OFFLINE
@@ -125,9 +124,9 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
125
124
  _this.mercuryDownTimestamp = new Date().toISOString();
126
125
  _this.metricManager.submitConnectionMetrics(_types4.METRIC_EVENT.CONNECTION_ERROR, _types4.CONNECTION_ACTION.MERCURY_DOWN, _types4.METRIC_TYPE.BEHAVIORAL, _this.mercuryDownTimestamp, _this.mercuryUpTimestamp);
127
126
  });
128
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleMercuryOnline", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3() {
127
+ (0, _defineProperty2.default)(_this, "handleMercuryOnline", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3() {
129
128
  var callCheckInterval;
130
- return _regenerator.default.wrap(function _callee3$(_context3) {
129
+ return _regenerator.default.wrap(function (_context3) {
131
130
  while (1) switch (_context3.prev = _context3.next) {
132
131
  case 0:
133
132
  _Logger.default.info(_constants.METHOD_START_MESSAGE, {
@@ -136,58 +135,58 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
136
135
  });
137
136
  _this.mercuryUpTimestamp = new Date().toISOString();
138
137
  if (!_this.isNetworkDown) {
139
- _context3.next = 10;
138
+ _context3.next = 2;
140
139
  break;
141
140
  }
142
141
  callCheckInterval = setInterval(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2() {
143
142
  var line;
144
- return _regenerator.default.wrap(function _callee2$(_context2) {
143
+ return _regenerator.default.wrap(function (_context2) {
145
144
  while (1) switch (_context2.prev = _context2.next) {
146
145
  case 0:
147
146
  if ((0, _keys.default)(_this.callManager.getActiveCalls()).length) {
148
- _context2.next = 10;
147
+ _context2.next = 3;
149
148
  break;
150
149
  }
151
150
  clearInterval(callCheckInterval);
152
151
  line = (0, _values.default)(_this.lineDict)[0];
153
152
  if (!(line.getStatus() !== _types3.RegistrationStatus.IDLE)) {
154
- _context2.next = 9;
153
+ _context2.next = 2;
155
154
  break;
156
155
  }
157
- _context2.next = 6;
156
+ _context2.next = 1;
158
157
  return line.registration.handleConnectionRestoration(_this.isNetworkDown);
159
- case 6:
158
+ case 1:
160
159
  _this.isNetworkDown = _context2.sent;
161
- _context2.next = 10;
160
+ _context2.next = 3;
162
161
  break;
163
- case 9:
162
+ case 2:
164
163
  _this.isNetworkDown = false;
165
- case 10:
164
+ case 3:
166
165
  case "end":
167
166
  return _context2.stop();
168
167
  }
169
168
  }, _callee2);
170
169
  })), _constants2.NETWORK_FLAP_TIMEOUT);
171
170
  if (!(0, _keys.default)(_this.callManager.getActiveCalls()).length) {
172
- _context3.next = 7;
171
+ _context3.next = 1;
173
172
  break;
174
173
  }
175
- _context3.next = 7;
174
+ _context3.next = 1;
176
175
  return _this.checkCallStatus();
177
- case 7:
176
+ case 1:
178
177
  _this.metricManager.submitConnectionMetrics(_types4.METRIC_EVENT.CONNECTION_ERROR, _types4.CONNECTION_ACTION.NETWORK_FLAP, _types4.METRIC_TYPE.BEHAVIORAL, _this.networkDownTimestamp, _this.networkUpTimestamp);
179
- _context3.next = 14;
178
+ _context3.next = 4;
180
179
  break;
181
- case 10:
180
+ case 2:
182
181
  if (!(0, _keys.default)(_this.callManager.getActiveCalls()).length) {
183
- _context3.next = 13;
182
+ _context3.next = 3;
184
183
  break;
185
184
  }
186
- _context3.next = 13;
185
+ _context3.next = 3;
187
186
  return _this.checkCallStatus();
188
- case 13:
187
+ case 3:
189
188
  _this.metricManager.submitConnectionMetrics(_types4.METRIC_EVENT.CONNECTION_ERROR, _types4.CONNECTION_ACTION.MERCURY_UP, _types4.METRIC_TYPE.BEHAVIORAL, _this.mercuryDownTimestamp, _this.mercuryUpTimestamp);
190
- case 14:
189
+ case 4:
191
190
  case "end":
192
191
  return _context3.stop();
193
192
  }
@@ -200,9 +199,9 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
200
199
  * will be attempted here on receiving a notification from callManager that all
201
200
  * calls are cleaned up.
202
201
  */
203
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "callsClearedHandler", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5() {
202
+ (0, _defineProperty2.default)(_this, "callsClearedHandler", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5() {
204
203
  var registration;
205
- return _regenerator.default.wrap(function _callee5$(_context5) {
204
+ return _regenerator.default.wrap(function (_context5) {
206
205
  while (1) switch (_context5.prev = _context5.next) {
207
206
  case 0:
208
207
  _Logger.default.info(_constants.METHOD_START_MESSAGE, {
@@ -213,31 +212,31 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
213
212
  // it will change once we have proper lineId and multiple lines as well
214
213
  registration = (0, _values.default)(_this.lineDict)[0].registration;
215
214
  if (registration.isDeviceRegistered()) {
216
- _context5.next = 5;
215
+ _context5.next = 1;
217
216
  break;
218
217
  }
219
- _context5.next = 5;
218
+ _context5.next = 1;
220
219
  return _this.mutex.runExclusive(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4() {
221
- return _regenerator.default.wrap(function _callee4$(_context4) {
220
+ return _regenerator.default.wrap(function (_context4) {
222
221
  while (1) switch (_context4.prev = _context4.next) {
223
222
  case 0:
224
223
  if (!registration.isReconnectPending()) {
225
- _context4.next = 4;
224
+ _context4.next = 1;
226
225
  break;
227
226
  }
228
227
  _Logger.default.info('All calls cleared, reconnecting', {
229
228
  file: _constants2.CALLING_CLIENT_FILE,
230
229
  method: _constants2.CALLS_CLEARED_HANDLER_UTIL
231
230
  });
232
- _context4.next = 4;
231
+ _context4.next = 1;
233
232
  return registration.reconnectOnFailure(_constants2.CALLS_CLEARED_HANDLER_UTIL);
234
- case 4:
233
+ case 1:
235
234
  case "end":
236
235
  return _context4.stop();
237
236
  }
238
237
  }, _callee4);
239
238
  })));
240
- case 5:
239
+ case 1:
241
240
  case "end":
242
241
  return _context5.stop();
243
242
  }
@@ -306,28 +305,7 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
306
305
  _this.mediaEngine.setLogger(adaptedLogger);
307
306
  _this.primaryMobiusUris = [];
308
307
  _this.backupMobiusUris = [];
309
- var mobiusServiceHost = '';
310
- try {
311
- mobiusServiceHost = new URL(_this.webex.internal.services._serviceUrls.mobius).host;
312
- } catch (error) {
313
- _Logger.default.warn("Failed to parse mobius service URL", {
314
- file: _constants2.CALLING_CLIENT_FILE,
315
- method: _this.constructor.name
316
- });
317
- }
318
-
319
- // TODO: This is a temp fix - https://jira-eng-sjc12.cisco.com/jira/browse/CAI-6809
320
- if (_this.webex.internal.services._hostCatalog) {
321
- _this.mobiusClusters = mobiusServiceHost && _this.webex.internal.services._hostCatalog[mobiusServiceHost] || _this.webex.internal.services._hostCatalog[_constants2.MOBIUS_US_PROD] || _this.webex.internal.services._hostCatalog[_constants2.MOBIUS_EU_PROD] || _this.webex.internal.services._hostCatalog[_constants2.MOBIUS_US_INT] || _this.webex.internal.services._hostCatalog[_constants2.MOBIUS_EU_INT];
322
- } else {
323
- // @ts-ignore
324
- var mobiusObject = _this.webex.internal.services._services.find(
325
- // @ts-ignore
326
- function (item) {
327
- return item.serviceName === 'mobius';
328
- });
329
- _this.mobiusClusters = [mobiusObject.serviceUrls[0].baseUrl];
330
- }
308
+ _this.mobiusClusters = _this.webex.internal.services.getMobiusClusters();
331
309
  _this.mobiusHost = '';
332
310
  _this.registerSessionsListener();
333
311
  _this.registerCallsClearedListener();
@@ -346,61 +324,62 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
346
324
  * @returns A promise that resolves when the initialization is complete.
347
325
  * @ignore
348
326
  */
349
- (0, _createClass2.default)(CallingClient, [{
327
+ (0, _inherits2.default)(CallingClient, _Eventing);
328
+ return (0, _createClass2.default)(CallingClient, [{
350
329
  key: "init",
351
330
  value: (function () {
352
331
  var _init = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6() {
353
332
  var _window, _window$navigator;
354
- var ua;
355
- return _regenerator.default.wrap(function _callee6$(_context6) {
333
+ var ua, _t;
334
+ return _regenerator.default.wrap(function (_context6) {
356
335
  while (1) switch (_context6.prev = _context6.next) {
357
336
  case 0:
358
337
  if (!(typeof window !== 'undefined' && (_window = window) !== null && _window !== void 0 && (_window$navigator = _window.navigator) !== null && _window$navigator !== void 0 && _window$navigator.userAgent)) {
359
- _context6.next = 13;
338
+ _context6.next = 4;
360
339
  break;
361
340
  }
362
341
  ua = window.navigator.userAgent;
363
342
  if (!ua.toLowerCase().includes('windows')) {
364
- _context6.next = 13;
343
+ _context6.next = 4;
365
344
  break;
366
345
  }
367
346
  _Logger.default.info('Starting ICE warmup for Windows Chromium based browser', {
368
347
  file: _constants2.CALLING_CLIENT_FILE,
369
348
  method: 'init'
370
349
  });
371
- _context6.prev = 4;
372
- _context6.next = 7;
350
+ _context6.prev = 1;
351
+ _context6.next = 2;
373
352
  return (0, _windowsChromiumIceWarmupUtils.default)({
374
353
  iceServers: [],
375
354
  timeoutMs: 1000
376
355
  });
377
- case 7:
356
+ case 2:
378
357
  _Logger.default.info("ICE warmup completed", {
379
358
  file: _constants2.CALLING_CLIENT_FILE,
380
359
  method: 'init'
381
360
  });
382
- _context6.next = 13;
361
+ _context6.next = 4;
383
362
  break;
384
- case 10:
385
- _context6.prev = 10;
386
- _context6.t0 = _context6["catch"](4);
387
- _Logger.default.warn("ICE warmup failed: ".concat(_context6.t0), {
363
+ case 3:
364
+ _context6.prev = 3;
365
+ _t = _context6["catch"](1);
366
+ _Logger.default.warn("ICE warmup failed: ".concat(_t), {
388
367
  file: _constants2.CALLING_CLIENT_FILE,
389
368
  method: 'init'
390
369
  });
391
- case 13:
392
- _context6.next = 15;
370
+ case 4:
371
+ _context6.next = 5;
393
372
  return this.getMobiusServers();
394
- case 15:
395
- _context6.next = 17;
373
+ case 5:
374
+ _context6.next = 6;
396
375
  return this.createLine();
397
- case 17:
376
+ case 6:
398
377
  this.setupNetworkEventListeners();
399
- case 18:
378
+ case 7:
400
379
  case "end":
401
380
  return _context6.stop();
402
381
  }
403
- }, _callee6, this, [[4, 10]]);
382
+ }, _callee6, this, [[1, 3]]);
404
383
  }));
405
384
  function init() {
406
385
  return _init.apply(this, arguments);
@@ -415,8 +394,8 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
415
394
  key: "checkNetworkReachability",
416
395
  value: (function () {
417
396
  var _checkNetworkReachability = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee7() {
418
- var controller, timeoutId;
419
- return _regenerator.default.wrap(function _callee7$(_context7) {
397
+ var controller, timeoutId, _t2;
398
+ return _regenerator.default.wrap(function (_context7) {
420
399
  while (1) switch (_context7.prev = _context7.next) {
421
400
  case 0:
422
401
  _context7.prev = 0;
@@ -425,29 +404,29 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
425
404
  return controller.abort();
426
405
  }, 3000); // Using a common connectivity check endpoint that returns 204 with minimal payload.
427
406
  // no-cors mode yields an opaque response but a successful fetch implies reachability.
428
- _context7.next = 5;
407
+ _context7.next = 1;
429
408
  return fetch('https://www.google.com/generate_204', {
430
409
  method: 'GET',
431
410
  cache: 'no-cache',
432
411
  mode: 'no-cors',
433
412
  signal: controller.signal
434
413
  });
435
- case 5:
414
+ case 1:
436
415
  clearTimeout(timeoutId);
437
416
  return _context7.abrupt("return", true);
438
- case 9:
439
- _context7.prev = 9;
440
- _context7.t0 = _context7["catch"](0);
441
- _Logger.default.warn("Network connectivity probe failed: ".concat(_context7.t0), {
417
+ case 2:
418
+ _context7.prev = 2;
419
+ _t2 = _context7["catch"](0);
420
+ _Logger.default.warn("Network connectivity probe failed: ".concat(_t2), {
442
421
  file: _constants2.CALLING_CLIENT_FILE,
443
422
  method: 'pingExternal'
444
423
  });
445
424
  return _context7.abrupt("return", false);
446
- case 13:
425
+ case 3:
447
426
  case "end":
448
427
  return _context7.stop();
449
428
  }
450
- }, _callee7, null, [[0, 9]]);
429
+ }, _callee7, null, [[0, 2]]);
451
430
  }));
452
431
  function checkNetworkReachability() {
453
432
  return _checkNetworkReachability.apply(this, arguments);
@@ -458,8 +437,8 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
458
437
  key: "checkCallStatus",
459
438
  value: function () {
460
439
  var _checkCallStatus = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8() {
461
- var loggerContext, calls, _iterator, _step, _loop;
462
- return _regenerator.default.wrap(function _callee8$(_context9) {
440
+ var loggerContext, calls, _iterator, _step, _loop, _t3;
441
+ return _regenerator.default.wrap(function (_context9) {
463
442
  while (1) switch (_context9.prev = _context9.next) {
464
443
  case 0:
465
444
  loggerContext = {
@@ -468,10 +447,10 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
468
447
  };
469
448
  calls = (0, _values.default)(this.callManager.getActiveCalls());
470
449
  _iterator = _createForOfIteratorHelper(calls);
471
- _context9.prev = 3;
450
+ _context9.prev = 1;
472
451
  _loop = /*#__PURE__*/_regenerator.default.mark(function _loop() {
473
452
  var call;
474
- return _regenerator.default.wrap(function _loop$(_context8) {
453
+ return _regenerator.default.wrap(function (_context8) {
475
454
  while (1) switch (_context8.prev = _context8.next) {
476
455
  case 0:
477
456
  call = _step.value;
@@ -487,38 +466,38 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
487
466
  type: 'E_SEND_CALL_DISCONNECT'
488
467
  });
489
468
  });
490
- case 2:
469
+ case 1:
491
470
  case "end":
492
471
  return _context8.stop();
493
472
  }
494
473
  }, _loop);
495
474
  });
496
475
  _iterator.s();
497
- case 6:
476
+ case 2:
498
477
  if ((_step = _iterator.n()).done) {
499
- _context9.next = 10;
478
+ _context9.next = 4;
500
479
  break;
501
480
  }
502
- return _context9.delegateYield(_loop(), "t0", 8);
503
- case 8:
504
- _context9.next = 6;
481
+ return _context9.delegateYield(_loop(), "t0", 3);
482
+ case 3:
483
+ _context9.next = 2;
505
484
  break;
506
- case 10:
507
- _context9.next = 15;
485
+ case 4:
486
+ _context9.next = 6;
508
487
  break;
509
- case 12:
510
- _context9.prev = 12;
511
- _context9.t1 = _context9["catch"](3);
512
- _iterator.e(_context9.t1);
513
- case 15:
514
- _context9.prev = 15;
488
+ case 5:
489
+ _context9.prev = 5;
490
+ _t3 = _context9["catch"](1);
491
+ _iterator.e(_t3);
492
+ case 6:
493
+ _context9.prev = 6;
515
494
  _iterator.f();
516
- return _context9.finish(15);
517
- case 18:
495
+ return _context9.finish(6);
496
+ case 7:
518
497
  case "end":
519
498
  return _context9.stop();
520
499
  }
521
- }, _callee8, this, [[3, 12, 15, 18]]);
500
+ }, _callee8, this, [[1, 5, 6, 7]]);
522
501
  }));
523
502
  function checkCallStatus() {
524
503
  return _checkCallStatus.apply(this, arguments);
@@ -549,147 +528,72 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
549
528
  value: (function () {
550
529
  var _getClientRegionInfo = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9() {
551
530
  var _this3 = this;
552
- var abort, regionInfo, _iterator2, _step2, _loop2, _ret;
553
- return _regenerator.default.wrap(function _callee9$(_context1) {
554
- while (1) switch (_context1.prev = _context1.next) {
531
+ var abort, regionInfo, _response$headers, _response$headers$tra, _response$headers2, response, clientRegionInfo, _t4;
532
+ return _regenerator.default.wrap(function (_context0) {
533
+ while (1) switch (_context0.prev = _context0.next) {
555
534
  case 0:
556
535
  _Logger.default.info(_constants.METHOD_START_MESSAGE, {
557
536
  file: _constants2.CALLING_CLIENT_FILE,
558
537
  method: _constants2.METHODS.GET_CLIENT_REGION_INFO
559
538
  });
560
539
  regionInfo = {};
561
- _iterator2 = _createForOfIteratorHelper(this.mobiusClusters);
562
- _context1.prev = 3;
563
- _loop2 = /*#__PURE__*/_regenerator.default.mark(function _loop2() {
564
- var mobius, _temp$headers, _response$headers, _response$headers2, _response$headers$tra, _response$headers3, temp, myIP, response, clientRegionInfo, extendedError;
565
- return _regenerator.default.wrap(function _loop2$(_context0) {
566
- while (1) switch (_context0.prev = _context0.next) {
567
- case 0:
568
- mobius = _step2.value;
569
- if (mobius.host) {
570
- _this3.mobiusHost = "https://".concat(mobius.host).concat(_constants2.API_V1);
571
- } else {
572
- _this3.mobiusHost = mobius;
573
- }
574
- _context0.prev = 2;
575
- _context0.next = 5;
576
- return _this3.webex.request({
577
- uri: "".concat(_this3.mobiusHost).concat(_constants2.URL_ENDPOINT).concat(_constants2.IP_ENDPOINT),
578
- method: _types3.HTTP_METHODS.GET,
579
- headers: (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _constants2.CISCO_DEVICE_URL, _this3.webex.internal.device.url), _constants2.SPARK_USER_AGENT, _constants2.CALLING_USER_AGENT),
580
- service: _types3.ALLOWED_SERVICES.MOBIUS
581
- });
582
- case 5:
583
- temp = _context0.sent;
584
- _Logger.default.log("Response trackingId: ".concat(temp === null || temp === void 0 ? void 0 : (_temp$headers = temp.headers) === null || _temp$headers === void 0 ? void 0 : _temp$headers.trackingid), {
585
- file: _constants2.CALLING_CLIENT_FILE,
586
- method: _constants2.METHODS.GET_CLIENT_REGION_INFO
587
- });
588
- myIP = temp.body.ipv4; // eslint-disable-next-line no-await-in-loop
589
- _context0.next = 10;
590
- return _this3.webex.request({
591
- uri: "".concat(_constants2.DISCOVERY_URL, "/").concat(myIP),
592
- method: _types3.HTTP_METHODS.GET,
593
- addAuthHeader: false,
594
- headers: (0, _defineProperty2.default)({}, _constants2.SPARK_USER_AGENT, null)
595
- });
596
- case 10:
597
- response = _context0.sent;
598
- _Logger.default.log("Response trackingId: ".concat(response === null || response === void 0 ? void 0 : (_response$headers = response.headers) === null || _response$headers === void 0 ? void 0 : _response$headers.trackingid), {
599
- file: _constants2.CALLING_CLIENT_FILE,
600
- method: _constants2.METHODS.GET_CLIENT_REGION_INFO
601
- });
602
- clientRegionInfo = response.body;
603
- regionInfo.clientRegion = clientRegionInfo !== null && clientRegionInfo !== void 0 && clientRegionInfo.clientRegion ? clientRegionInfo.clientRegion : '';
604
- regionInfo.countryCode = clientRegionInfo !== null && clientRegionInfo !== void 0 && clientRegionInfo.countryCode ? clientRegionInfo.countryCode : '';
605
- _Logger.default.log("Successfully fetched Client region info: ".concat(regionInfo.clientRegion, ", countryCode: ").concat(regionInfo.countryCode, ", and response trackingid: ").concat(response === null || response === void 0 ? void 0 : (_response$headers2 = response.headers) === null || _response$headers2 === void 0 ? void 0 : _response$headers2.trackingid), {
606
- file: _constants2.CALLING_CLIENT_FILE,
607
- method: _constants2.METHODS.GET_CLIENT_REGION_INFO
608
- });
609
-
610
- // Metrics for region info - trying clusters in loop
611
- _this3.metricManager.submitRegionInfoMetric(_types4.METRIC_EVENT.MOBIUS_DISCOVERY, _types4.MOBIUS_SERVER_ACTION.REGION_INFO, _types4.METRIC_TYPE.BEHAVIORAL, _this3.mobiusHost, clientRegionInfo.clientRegion, clientRegionInfo.countryCode, (_response$headers$tra = response === null || response === void 0 ? void 0 : (_response$headers3 = response.headers) === null || _response$headers3 === void 0 ? void 0 : _response$headers3.trackingid) !== null && _response$headers$tra !== void 0 ? _response$headers$tra : '');
612
- return _context0.abrupt("return", 0);
613
- case 20:
614
- _context0.prev = 20;
615
- _context0.t0 = _context0["catch"](2);
616
- extendedError = new Error("Failed to get client region info: ".concat(_context0.t0));
617
- _Logger.default.error(extendedError, {
618
- method: _constants2.METHODS.GET_CLIENT_REGION_INFO,
619
- file: _constants2.CALLING_CLIENT_FILE
620
- });
540
+ _context0.prev = 1;
541
+ _context0.next = 2;
542
+ return this.webex.request({
543
+ uri: "".concat(_constants2.DISCOVERY_URL),
544
+ method: _types3.HTTP_METHODS.GET,
545
+ addAuthHeader: false,
546
+ headers: (0, _defineProperty2.default)({}, _constants2.SPARK_USER_AGENT, null)
547
+ });
548
+ case 2:
549
+ response = _context0.sent;
550
+ clientRegionInfo = response.body;
551
+ regionInfo.clientRegion = (clientRegionInfo === null || clientRegionInfo === void 0 ? void 0 : clientRegionInfo.clientRegion) || '';
552
+ regionInfo.countryCode = (clientRegionInfo === null || clientRegionInfo === void 0 ? void 0 : clientRegionInfo.countryCode) || '';
553
+ _Logger.default.log("Successfully fetched Client region info: ".concat(regionInfo.clientRegion, ", countryCode: ").concat(regionInfo.countryCode, ", and response trackingid: ").concat(response === null || response === void 0 ? void 0 : (_response$headers = response.headers) === null || _response$headers === void 0 ? void 0 : _response$headers.trackingid), {
554
+ file: _constants2.CALLING_CLIENT_FILE,
555
+ method: _constants2.METHODS.GET_CLIENT_REGION_INFO
556
+ });
557
+ this.metricManager.submitRegionInfoMetric(_types4.METRIC_EVENT.MOBIUS_DISCOVERY, _types4.MOBIUS_SERVER_ACTION.REGION_INFO, _types4.METRIC_TYPE.BEHAVIORAL, this.mobiusHost, clientRegionInfo.clientRegion, clientRegionInfo.countryCode, (_response$headers$tra = response === null || response === void 0 ? void 0 : (_response$headers2 = response.headers) === null || _response$headers2 === void 0 ? void 0 : _response$headers2.trackingid) !== null && _response$headers$tra !== void 0 ? _response$headers$tra : '');
558
+ _context0.next = 6;
559
+ break;
560
+ case 3:
561
+ _context0.prev = 3;
562
+ _t4 = _context0["catch"](1);
563
+ _Logger.default.error("Failed to get client region info: ".concat((0, _stringify.default)(_t4)), {
564
+ method: _constants2.METHODS.GET_CLIENT_REGION_INFO,
565
+ file: _constants2.CALLING_CLIENT_FILE
566
+ });
621
567
 
622
- // eslint-disable-next-line no-await-in-loop
623
- _context0.next = 26;
624
- return (0, _Utils.handleCallingClientErrors)(_context0.t0, function (clientError) {
625
- var _headers$trackingId, _headers3;
626
- _this3.metricManager.submitRegistrationMetric(_types4.METRIC_EVENT.REGISTRATION_ERROR, _types4.REG_ACTION.REGISTER, _types4.METRIC_TYPE.BEHAVIORAL, _constants2.GET_MOBIUS_SERVERS_UTIL, 'UNKNOWN', (_headers$trackingId = (_headers3 = _context0.t0.headers) === null || _headers3 === void 0 ? void 0 : _headers3.trackingId) !== null && _headers$trackingId !== void 0 ? _headers$trackingId : '', undefined, clientError);
627
- _this3.emit(_types2.CALLING_CLIENT_EVENT_KEYS.ERROR, clientError);
628
- }, {
629
- method: _constants2.GET_MOBIUS_SERVERS_UTIL,
630
- file: _constants2.CALLING_CLIENT_FILE
631
- });
632
- case 26:
633
- abort = _context0.sent;
634
- regionInfo.clientRegion = '';
635
- regionInfo.countryCode = '';
636
- if (!abort) {
637
- _context0.next = 33;
638
- break;
639
- }
640
- _context0.next = 32;
641
- return (0, _Utils.uploadLogs)();
642
- case 32:
643
- return _context0.abrupt("return", {
644
- v: regionInfo
645
- });
646
- case 33:
647
- case "end":
648
- return _context0.stop();
649
- }
650
- }, _loop2, null, [[2, 20]]);
568
+ // eslint-disable-next-line no-await-in-loop
569
+ _context0.next = 4;
570
+ return (0, _Utils.handleCallingClientErrors)(_t4, function (clientError) {
571
+ var _headers$trackingId, _headers2;
572
+ _this3.metricManager.submitRegistrationMetric(_types4.METRIC_EVENT.REGISTRATION_ERROR, _types4.REG_ACTION.REGISTER, _types4.METRIC_TYPE.BEHAVIORAL, _constants2.GET_MOBIUS_SERVERS_UTIL, 'UNKNOWN', (_headers$trackingId = (_headers2 = _t4.headers) === null || _headers2 === void 0 ? void 0 : _headers2.trackingId) !== null && _headers$trackingId !== void 0 ? _headers$trackingId : '', undefined, clientError);
573
+ _this3.emit(_types2.CALLING_CLIENT_EVENT_KEYS.ERROR, clientError);
574
+ }, {
575
+ method: _constants2.GET_MOBIUS_SERVERS_UTIL,
576
+ file: _constants2.CALLING_CLIENT_FILE
651
577
  });
652
- _iterator2.s();
653
- case 6:
654
- if ((_step2 = _iterator2.n()).done) {
655
- _context1.next = 15;
656
- break;
657
- }
658
- return _context1.delegateYield(_loop2(), "t0", 8);
659
- case 8:
660
- _ret = _context1.t0;
661
- if (!(_ret === 0)) {
662
- _context1.next = 11;
663
- break;
664
- }
665
- return _context1.abrupt("break", 15);
666
- case 11:
667
- if (!_ret) {
668
- _context1.next = 13;
578
+ case 4:
579
+ abort = _context0.sent;
580
+ regionInfo.clientRegion = '';
581
+ regionInfo.countryCode = '';
582
+ if (!abort) {
583
+ _context0.next = 6;
669
584
  break;
670
585
  }
671
- return _context1.abrupt("return", _ret.v);
672
- case 13:
673
- _context1.next = 6;
674
- break;
675
- case 15:
676
- _context1.next = 20;
677
- break;
678
- case 17:
679
- _context1.prev = 17;
680
- _context1.t1 = _context1["catch"](3);
681
- _iterator2.e(_context1.t1);
682
- case 20:
683
- _context1.prev = 20;
684
- _iterator2.f();
685
- return _context1.finish(20);
686
- case 23:
687
- return _context1.abrupt("return", regionInfo);
688
- case 24:
586
+ _context0.next = 5;
587
+ return (0, _Utils.uploadLogs)();
588
+ case 5:
589
+ return _context0.abrupt("return", regionInfo);
590
+ case 6:
591
+ return _context0.abrupt("return", regionInfo);
592
+ case 7:
689
593
  case "end":
690
- return _context1.stop();
594
+ return _context0.stop();
691
595
  }
692
- }, _callee9, this, [[3, 17, 20, 23]]);
596
+ }, _callee9, this, [[1, 3]]);
693
597
  }));
694
598
  function getClientRegionInfo() {
695
599
  return _getClientRegionInfo.apply(this, arguments);
@@ -709,8 +613,8 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
709
613
  _this$sdkConfig4,
710
614
  _this$sdkConfig4$disc,
711
615
  _this4 = this;
712
- var useDefault, clientRegion, countryCode, _this$sdkConfig5, _this$sdkConfig5$disc, _this$sdkConfig6, _this$sdkConfig6$disc, regionInfo, _response$headers4, _response$headers$tra2, _response$headers5, response, mobiusServers, mobiusUris, extendedError, abort;
713
- return _regenerator.default.wrap(function _callee0$(_context10) {
616
+ var useDefault, clientRegion, countryCode, _this$sdkConfig5, _this$sdkConfig5$disc, _this$sdkConfig6, _this$sdkConfig6$disc, _this$webex$internal$, regionInfo, _iterator2, _step2, _loop2, _ret, _t6;
617
+ return _regenerator.default.wrap(function (_context10) {
714
618
  while (1) switch (_context10.prev = _context10.next) {
715
619
  case 0:
716
620
  _Logger.default.info(_constants.METHOD_START_MESSAGE, {
@@ -726,7 +630,7 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
726
630
  */
727
631
  useDefault = false;
728
632
  if (!((_this$sdkConfig3 = this.sdkConfig) !== null && _this$sdkConfig3 !== void 0 && (_this$sdkConfig3$disc = _this$sdkConfig3.discovery) !== null && _this$sdkConfig3$disc !== void 0 && _this$sdkConfig3$disc.country && (_this$sdkConfig4 = this.sdkConfig) !== null && _this$sdkConfig4 !== void 0 && (_this$sdkConfig4$disc = _this$sdkConfig4.discovery) !== null && _this$sdkConfig4$disc !== void 0 && _this$sdkConfig4$disc.region)) {
729
- _context10.next = 9;
633
+ _context10.next = 1;
730
634
  break;
731
635
  }
732
636
  _Logger.default.log('Updating region and country from the SDK config', {
@@ -735,90 +639,139 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
735
639
  });
736
640
  clientRegion = (_this$sdkConfig5 = this.sdkConfig) === null || _this$sdkConfig5 === void 0 ? void 0 : (_this$sdkConfig5$disc = _this$sdkConfig5.discovery) === null || _this$sdkConfig5$disc === void 0 ? void 0 : _this$sdkConfig5$disc.region;
737
641
  countryCode = (_this$sdkConfig6 = this.sdkConfig) === null || _this$sdkConfig6 === void 0 ? void 0 : (_this$sdkConfig6$disc = _this$sdkConfig6.discovery) === null || _this$sdkConfig6$disc === void 0 ? void 0 : _this$sdkConfig6$disc.country;
738
- this.mobiusHost = this.webex.internal.services._serviceUrls.mobius;
739
- _context10.next = 15;
642
+ this.mobiusHost = ((_this$webex$internal$ = this.webex.internal.services._serviceUrls) === null || _this$webex$internal$ === void 0 ? void 0 : _this$webex$internal$.mobius) || this.webex.internal.services.get(this.webex.internal.services._activeServices.mobius);
643
+ _context10.next = 3;
740
644
  break;
741
- case 9:
645
+ case 1:
742
646
  _Logger.default.log('Updating region and country through Region discovery', {
743
647
  file: _constants2.CALLING_CLIENT_FILE,
744
648
  method: _constants2.GET_MOBIUS_SERVERS_UTIL
745
649
  });
746
- _context10.next = 12;
650
+ _context10.next = 2;
747
651
  return this.getClientRegionInfo();
748
- case 12:
652
+ case 2:
749
653
  regionInfo = _context10.sent;
750
654
  clientRegion = regionInfo.clientRegion;
751
655
  countryCode = regionInfo.countryCode;
752
- case 15:
656
+ case 3:
753
657
  if (!(clientRegion && countryCode)) {
754
- _context10.next = 43;
658
+ _context10.next = 12;
755
659
  break;
756
660
  }
757
661
  _Logger.default.log("Found Region: ".concat(clientRegion, " and country: ").concat(countryCode, ", going to fetch Mobius server"), {
758
662
  file: _constants2.CALLING_CLIENT_FILE,
759
663
  method: _constants2.GET_MOBIUS_SERVERS_UTIL
760
664
  });
761
- _context10.prev = 17;
762
- _context10.next = 20;
763
- return this.webex.request({
764
- uri: "".concat(this.mobiusHost).concat(_constants2.URL_ENDPOINT, "?regionCode=").concat(clientRegion, "&countryCode=").concat(countryCode),
765
- method: _types3.HTTP_METHODS.GET,
766
- headers: (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _constants2.CISCO_DEVICE_URL, this.webex.internal.device.url), _constants2.SPARK_USER_AGENT, _constants2.CALLING_USER_AGENT),
767
- service: _types3.ALLOWED_SERVICES.MOBIUS
768
- });
769
- case 20:
770
- response = _context10.sent;
771
- _Logger.default.log("Mobius Server found for the region. Response trackingId: ".concat(response === null || response === void 0 ? void 0 : (_response$headers4 = response.headers) === null || _response$headers4 === void 0 ? void 0 : _response$headers4.trackingid), {
772
- file: _constants2.CALLING_CLIENT_FILE,
773
- method: _constants2.GET_MOBIUS_SERVERS_UTIL
774
- });
775
- mobiusServers = response.body; // Metrics for mobius servers
776
- this.metricManager.submitMobiusServersMetric(_types4.METRIC_EVENT.MOBIUS_DISCOVERY, _types4.MOBIUS_SERVER_ACTION.MOBIUS_SERVERS, _types4.METRIC_TYPE.BEHAVIORAL, mobiusServers, (_response$headers$tra2 = response === null || response === void 0 ? void 0 : (_response$headers5 = response.headers) === null || _response$headers5 === void 0 ? void 0 : _response$headers5.trackingid) !== null && _response$headers$tra2 !== void 0 ? _response$headers$tra2 : '');
665
+ _iterator2 = _createForOfIteratorHelper(this.mobiusClusters);
666
+ _context10.prev = 4;
667
+ _loop2 = /*#__PURE__*/_regenerator.default.mark(function _loop2() {
668
+ var mobius, _response$headers3, _response$headers$tra2, _response$headers4, response, mobiusServers, mobiusUris, abort, _t5;
669
+ return _regenerator.default.wrap(function (_context1) {
670
+ while (1) switch (_context1.prev = _context1.next) {
671
+ case 0:
672
+ mobius = _step2.value;
673
+ if (mobius.host) {
674
+ _this4.mobiusHost = "https://".concat(mobius.host).concat(_constants2.API_V1);
675
+ } else {
676
+ _this4.mobiusHost = mobius;
677
+ }
678
+ _context1.prev = 1;
679
+ _context1.next = 2;
680
+ return _this4.webex.request({
681
+ uri: "".concat(_this4.mobiusHost).concat(_constants2.URL_ENDPOINT, "?regionCode=").concat(clientRegion, "&countryCode=").concat(countryCode),
682
+ method: _types3.HTTP_METHODS.GET,
683
+ headers: (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _constants2.CISCO_DEVICE_URL, _this4.webex.internal.device.url), _constants2.SPARK_USER_AGENT, _constants2.CALLING_USER_AGENT),
684
+ service: _types3.ALLOWED_SERVICES.MOBIUS
685
+ });
686
+ case 2:
687
+ response = _context1.sent;
688
+ _Logger.default.log("Mobius Server found for the region. Response trackingId: ".concat(response === null || response === void 0 ? void 0 : (_response$headers3 = response.headers) === null || _response$headers3 === void 0 ? void 0 : _response$headers3.trackingid), {
689
+ file: _constants2.CALLING_CLIENT_FILE,
690
+ method: _constants2.GET_MOBIUS_SERVERS_UTIL
691
+ });
692
+ mobiusServers = response.body; // Metrics for mobius servers
693
+ _this4.metricManager.submitMobiusServersMetric(_types4.METRIC_EVENT.MOBIUS_DISCOVERY, _types4.MOBIUS_SERVER_ACTION.MOBIUS_SERVERS, _types4.METRIC_TYPE.BEHAVIORAL, mobiusServers, (_response$headers$tra2 = response === null || response === void 0 ? void 0 : (_response$headers4 = response.headers) === null || _response$headers4 === void 0 ? void 0 : _response$headers4.trackingid) !== null && _response$headers$tra2 !== void 0 ? _response$headers$tra2 : '');
777
694
 
778
- /* update arrays of Mobius Uris. */
779
- mobiusUris = (0, _Utils.filterMobiusUris)(mobiusServers, this.mobiusHost);
780
- this.primaryMobiusUris = mobiusUris.primary;
781
- this.backupMobiusUris = mobiusUris.backup;
782
- _Logger.default.log("Final list of Mobius Servers, primary: ".concat(mobiusUris.primary, " and backup: ").concat(mobiusUris.backup), {
783
- file: _constants2.CALLING_CLIENT_FILE,
784
- method: _constants2.GET_MOBIUS_SERVERS_UTIL
785
- });
786
- _context10.next = 41;
787
- break;
788
- case 30:
789
- _context10.prev = 30;
790
- _context10.t0 = _context10["catch"](17);
791
- extendedError = new Error("Failed to get Mobius servers: ".concat(_context10.t0));
792
- _Logger.default.error(extendedError, {
793
- method: _constants2.METHODS.GET_MOBIUS_SERVERS,
794
- file: _constants2.CALLING_CLIENT_FILE
795
- });
796
- _context10.next = 36;
797
- return (0, _Utils.handleCallingClientErrors)(_context10.t0, function (clientError) {
798
- var _headers$trackingId2, _headers5;
799
- _this4.metricManager.submitRegistrationMetric(_types4.METRIC_EVENT.REGISTRATION_ERROR, _types4.REG_ACTION.REGISTER, _types4.METRIC_TYPE.BEHAVIORAL, _constants2.GET_MOBIUS_SERVERS_UTIL, 'UNKNOWN', (_headers$trackingId2 = (_headers5 = _context10.t0.headers) === null || _headers5 === void 0 ? void 0 : _headers5.trackingId) !== null && _headers$trackingId2 !== void 0 ? _headers$trackingId2 : '', undefined, clientError);
800
- _this4.emit(_types2.CALLING_CLIENT_EVENT_KEYS.ERROR, clientError);
801
- }, {
802
- method: _constants2.GET_MOBIUS_SERVERS_UTIL,
803
- file: _constants2.CALLING_CLIENT_FILE
695
+ /* update arrays of Mobius Uris. */
696
+ mobiusUris = (0, _Utils.filterMobiusUris)(mobiusServers, _this4.mobiusHost);
697
+ _this4.primaryMobiusUris = mobiusUris.primary;
698
+ _this4.backupMobiusUris = mobiusUris.backup;
699
+ _Logger.default.log("Final list of Mobius Servers, primary: ".concat(mobiusUris.primary, " and backup: ").concat(mobiusUris.backup), {
700
+ file: _constants2.CALLING_CLIENT_FILE,
701
+ method: _constants2.GET_MOBIUS_SERVERS_UTIL
702
+ });
703
+ return _context1.abrupt("return", 0);
704
+ case 3:
705
+ _context1.prev = 3;
706
+ _t5 = _context1["catch"](1);
707
+ _Logger.default.error("Failed to get Mobius servers: ".concat((0, _stringify.default)(_t5)), {
708
+ method: _constants2.METHODS.GET_MOBIUS_SERVERS,
709
+ file: _constants2.CALLING_CLIENT_FILE
710
+ });
711
+
712
+ // eslint-disable-next-line no-await-in-loop
713
+ _context1.next = 4;
714
+ return (0, _Utils.handleCallingClientErrors)(_t5, function (clientError) {
715
+ var _headers$trackingId2, _headers4;
716
+ _this4.metricManager.submitRegistrationMetric(_types4.METRIC_EVENT.REGISTRATION_ERROR, _types4.REG_ACTION.REGISTER, _types4.METRIC_TYPE.BEHAVIORAL, _constants2.GET_MOBIUS_SERVERS_UTIL, 'UNKNOWN', (_headers$trackingId2 = (_headers4 = _t5.headers) === null || _headers4 === void 0 ? void 0 : _headers4.trackingId) !== null && _headers$trackingId2 !== void 0 ? _headers$trackingId2 : '', undefined, clientError);
717
+ _this4.emit(_types2.CALLING_CLIENT_EVENT_KEYS.ERROR, clientError);
718
+ }, {
719
+ method: _constants2.GET_MOBIUS_SERVERS_UTIL,
720
+ file: _constants2.CALLING_CLIENT_FILE
721
+ });
722
+ case 4:
723
+ abort = _context1.sent;
724
+ if (!abort) {
725
+ _context1.next = 6;
726
+ break;
727
+ }
728
+ useDefault = true;
729
+ // eslint-disable-next-line no-await-in-loop
730
+ _context1.next = 5;
731
+ return (0, _Utils.uploadLogs)();
732
+ case 5:
733
+ return _context1.abrupt("return", 0);
734
+ case 6:
735
+ case "end":
736
+ return _context1.stop();
737
+ }
738
+ }, _loop2, null, [[1, 3]]);
804
739
  });
805
- case 36:
806
- abort = _context10.sent;
807
- if (!abort) {
808
- _context10.next = 40;
740
+ _iterator2.s();
741
+ case 5:
742
+ if ((_step2 = _iterator2.n()).done) {
743
+ _context10.next = 8;
809
744
  break;
810
745
  }
811
- _context10.next = 40;
812
- return (0, _Utils.uploadLogs)();
813
- case 40:
814
- useDefault = true;
815
- case 41:
816
- _context10.next = 44;
746
+ return _context10.delegateYield(_loop2(), "t0", 6);
747
+ case 6:
748
+ _ret = _context10.t0;
749
+ if (!(_ret === 0)) {
750
+ _context10.next = 7;
751
+ break;
752
+ }
753
+ return _context10.abrupt("continue", 8);
754
+ case 7:
755
+ _context10.next = 5;
756
+ break;
757
+ case 8:
758
+ _context10.next = 10;
817
759
  break;
818
- case 43:
760
+ case 9:
761
+ _context10.prev = 9;
762
+ _t6 = _context10["catch"](4);
763
+ _iterator2.e(_t6);
764
+ case 10:
765
+ _context10.prev = 10;
766
+ _iterator2.f();
767
+ return _context10.finish(10);
768
+ case 11:
769
+ _context10.next = 13;
770
+ break;
771
+ case 12:
819
772
  /* Setting this to true because region info is possibly undefined */
820
773
  useDefault = true;
821
- case 44:
774
+ case 13:
822
775
  /* Use a default URL if Mobius discovery fails either because of region info failure
823
776
  * or because the discovered Mobius couldn't be reached
824
777
  */
@@ -831,11 +784,11 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
831
784
  this.mobiusHost = "https://".concat(this.mobiusClusters[0].host).concat(_constants2.API_V1);
832
785
  this.primaryMobiusUris = ["".concat(this.mobiusHost).concat(_constants2.URL_ENDPOINT)];
833
786
  }
834
- case 45:
787
+ case 14:
835
788
  case "end":
836
789
  return _context10.stop();
837
790
  }
838
- }, _callee0, this, [[17, 30]]);
791
+ }, _callee0, this, [[4, 9, 10, 11]]);
839
792
  }));
840
793
  function getMobiusServers() {
841
794
  return _getMobiusServers.apply(this, arguments);
@@ -888,31 +841,31 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
888
841
  this.sdkConnector.registerListener(_types2.MOBIUS_EVENT_KEYS.CALL_SESSION_EVENT_INCLUSIVE, /*#__PURE__*/function () {
889
842
  var _ref6 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1(event) {
890
843
  var sessionArr, i;
891
- return _regenerator.default.wrap(function _callee1$(_context11) {
844
+ return _regenerator.default.wrap(function (_context11) {
892
845
  while (1) switch (_context11.prev = _context11.next) {
893
846
  case 0:
894
847
  if (!(event && event.data.userSessions.userSessions)) {
895
- _context11.next = 7;
848
+ _context11.next = 2;
896
849
  break;
897
850
  }
898
851
  sessionArr = event === null || event === void 0 ? void 0 : event.data.userSessions.userSessions;
899
852
  if (!(sessionArr.length === 1)) {
900
- _context11.next = 5;
853
+ _context11.next = 1;
901
854
  break;
902
855
  }
903
856
  if (!(sessionArr[0].sessionType !== _types2.SessionType.WEBEX_CALLING)) {
904
- _context11.next = 5;
857
+ _context11.next = 1;
905
858
  break;
906
859
  }
907
860
  return _context11.abrupt("return");
908
- case 5:
861
+ case 1:
909
862
  for (i = 0; i < sessionArr.length; i += 1) {
910
863
  if (sessionArr[i].sessionType !== _types2.SessionType.WEBEX_CALLING) {
911
864
  sessionArr.splice(i, 1);
912
865
  }
913
866
  }
914
867
  _this5.emit(_types2.CALLING_CLIENT_EVENT_KEYS.USER_SESSION_INFO, event);
915
- case 7:
868
+ case 2:
916
869
  case "end":
917
870
  return _context11.stop();
918
871
  }
@@ -934,7 +887,7 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
934
887
  var _createLine = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
935
888
  var _this$sdkConfig7, _this$sdkConfig8;
936
889
  var line;
937
- return _regenerator.default.wrap(function _callee10$(_context12) {
890
+ return _regenerator.default.wrap(function (_context12) {
938
891
  while (1) switch (_context12.prev = _context12.next) {
939
892
  case 0:
940
893
  _Logger.default.info(_constants.METHOD_START_MESSAGE, {
@@ -943,7 +896,7 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
943
896
  });
944
897
  line = new _line.default(this.webex.internal.device.userId, this.webex.internal.device.url, this.mutex, this.primaryMobiusUris, this.backupMobiusUris, this.getLoggingLevel(), (_this$sdkConfig7 = this.sdkConfig) === null || _this$sdkConfig7 === void 0 ? void 0 : _this$sdkConfig7.serviceData, (_this$sdkConfig8 = this.sdkConfig) === null || _this$sdkConfig8 === void 0 ? void 0 : _this$sdkConfig8.jwe);
945
898
  this.lineDict[line.lineId] = line;
946
- case 3:
899
+ case 1:
947
900
  case "end":
948
901
  return _context12.stop();
949
902
  }
@@ -965,9 +918,105 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
965
918
  return this.lineDict;
966
919
  }
967
920
 
921
+ /**
922
+ * Fetches the list of devices for a given user from Mobius.
923
+ */
924
+ }, {
925
+ key: "getDevices",
926
+ value: (function () {
927
+ var _getDevices = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11(userId) {
928
+ var userid, mobiusUrls, finalError, _iterator3, _step3, mobiusUrl, normalizedMobiusUrl, uri, _body$devices, response, body, _t7, _t8;
929
+ return _regenerator.default.wrap(function (_context13) {
930
+ while (1) switch (_context13.prev = _context13.next) {
931
+ case 0:
932
+ userid = userId || this.webex.internal.device.userId;
933
+ if (userid) {
934
+ _context13.next = 1;
935
+ break;
936
+ }
937
+ throw new Error('userId is required to fetch devices');
938
+ case 1:
939
+ _Logger.default.info(_constants.METHOD_START_MESSAGE, {
940
+ file: _constants2.CALLING_CLIENT_FILE,
941
+ method: _constants2.METHODS.GET_DEVICES
942
+ });
943
+ mobiusUrls = [].concat((0, _toConsumableArray2.default)(this.primaryMobiusUris), (0, _toConsumableArray2.default)(this.backupMobiusUris));
944
+ if (!(mobiusUrls.length === 0)) {
945
+ _context13.next = 2;
946
+ break;
947
+ }
948
+ throw new Error('Mobius URLs are not available');
949
+ case 2:
950
+ _iterator3 = _createForOfIteratorHelper(mobiusUrls);
951
+ _context13.prev = 3;
952
+ _iterator3.s();
953
+ case 4:
954
+ if ((_step3 = _iterator3.n()).done) {
955
+ _context13.next = 10;
956
+ break;
957
+ }
958
+ mobiusUrl = _step3.value;
959
+ normalizedMobiusUrl = mobiusUrl.replace(/\/+$/, '/');
960
+ uri = "".concat(normalizedMobiusUrl).concat(_constants2.DEVICES_ENDPOINT_RESOURCE, "?userid=").concat(encodeURIComponent(userid));
961
+ _context13.prev = 5;
962
+ _context13.next = 6;
963
+ return this.webex.request({
964
+ uri: uri,
965
+ method: _types3.HTTP_METHODS.GET,
966
+ service: _types3.ALLOWED_SERVICES.MOBIUS,
967
+ headers: (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _constants2.CISCO_DEVICE_URL, this.webex.internal.device.url), _constants2.SPARK_USER_AGENT, _constants2.CALLING_USER_AGENT)
968
+ });
969
+ case 6:
970
+ response = _context13.sent;
971
+ if (!(response.statusCode !== 200)) {
972
+ _context13.next = 7;
973
+ break;
974
+ }
975
+ throw new Error("API call failed with ".concat(response.statusCode));
976
+ case 7:
977
+ body = response.body; // Hydrate registration deviceInfo for deregister/restore flows
978
+ (0, _values.default)(this.lineDict)[0].registration.setDeviceInfo(body);
979
+ (0, _values.default)(this.lineDict)[0].registration.setActiveMobiusUrl(normalizedMobiusUrl);
980
+ return _context13.abrupt("return", (_body$devices = body.devices) !== null && _body$devices !== void 0 ? _body$devices : []);
981
+ case 8:
982
+ _context13.prev = 8;
983
+ _t7 = _context13["catch"](5);
984
+ finalError = _t7;
985
+ case 9:
986
+ _context13.next = 4;
987
+ break;
988
+ case 10:
989
+ _context13.next = 12;
990
+ break;
991
+ case 11:
992
+ _context13.prev = 11;
993
+ _t8 = _context13["catch"](3);
994
+ _iterator3.e(_t8);
995
+ case 12:
996
+ _context13.prev = 12;
997
+ _iterator3.f();
998
+ return _context13.finish(12);
999
+ case 13:
1000
+ _Logger.default.error("Failed to fetch devices for userId ".concat(userId, ": ").concat((0, _stringify.default)(finalError)), {
1001
+ file: _constants2.CALLING_CLIENT_FILE,
1002
+ method: _constants2.METHODS.GET_DEVICES
1003
+ });
1004
+ throw finalError;
1005
+ case 14:
1006
+ case "end":
1007
+ return _context13.stop();
1008
+ }
1009
+ }, _callee11, this, [[3, 11, 12, 13], [5, 8]]);
1010
+ }));
1011
+ function getDevices(_x2) {
1012
+ return _getDevices.apply(this, arguments);
1013
+ }
1014
+ return getDevices;
1015
+ }()
968
1016
  /**
969
1017
  * Retrieves call objects for all the active calls present in the client
970
1018
  */
1019
+ )
971
1020
  }, {
972
1021
  key: "getActiveCalls",
973
1022
  value: function getActiveCalls() {
@@ -1012,27 +1061,27 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
1012
1061
  }, {
1013
1062
  key: "uploadLogs",
1014
1063
  value: (function () {
1015
- var _uploadLogs2 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
1064
+ var _uploadLogs2 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12() {
1016
1065
  var result;
1017
- return _regenerator.default.wrap(function _callee11$(_context13) {
1018
- while (1) switch (_context13.prev = _context13.next) {
1066
+ return _regenerator.default.wrap(function (_context14) {
1067
+ while (1) switch (_context14.prev = _context14.next) {
1019
1068
  case 0:
1020
- _context13.next = 2;
1069
+ _context14.next = 1;
1021
1070
  return (0, _Utils.uploadLogs)({}, true);
1022
- case 2:
1023
- result = _context13.sent;
1071
+ case 1:
1072
+ result = _context14.sent;
1024
1073
  if (result) {
1025
- _context13.next = 5;
1074
+ _context14.next = 2;
1026
1075
  break;
1027
1076
  }
1028
1077
  throw new Error('Failed to upload logs: No response received.');
1029
- case 5:
1030
- return _context13.abrupt("return", result);
1031
- case 6:
1078
+ case 2:
1079
+ return _context14.abrupt("return", result);
1080
+ case 3:
1032
1081
  case "end":
1033
- return _context13.stop();
1082
+ return _context14.stop();
1034
1083
  }
1035
- }, _callee11);
1084
+ }, _callee12);
1036
1085
  }));
1037
1086
  function uploadLogs() {
1038
1087
  return _uploadLogs2.apply(this, arguments);
@@ -1040,7 +1089,6 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
1040
1089
  return uploadLogs;
1041
1090
  }())
1042
1091
  }]);
1043
- return CallingClient;
1044
1092
  }(_impl.Eventing);
1045
1093
  /**
1046
1094
  * Create the `CallingClient` instance using the `webex` object and callingSdk `config`
@@ -1048,23 +1096,23 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
1048
1096
  * @param config - Config to start the CallingClient with.
1049
1097
  */
1050
1098
  var createClient = exports.createClient = /*#__PURE__*/function () {
1051
- var _ref7 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12(webex, config) {
1099
+ var _ref7 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13(webex, config) {
1052
1100
  var callingClientInstance;
1053
- return _regenerator.default.wrap(function _callee12$(_context14) {
1054
- while (1) switch (_context14.prev = _context14.next) {
1101
+ return _regenerator.default.wrap(function (_context15) {
1102
+ while (1) switch (_context15.prev = _context15.next) {
1055
1103
  case 0:
1056
1104
  callingClientInstance = new CallingClient(webex, config);
1057
- _context14.next = 3;
1105
+ _context15.next = 1;
1058
1106
  return callingClientInstance.init();
1059
- case 3:
1060
- return _context14.abrupt("return", callingClientInstance);
1061
- case 4:
1107
+ case 1:
1108
+ return _context15.abrupt("return", callingClientInstance);
1109
+ case 2:
1062
1110
  case "end":
1063
- return _context14.stop();
1111
+ return _context15.stop();
1064
1112
  }
1065
- }, _callee12);
1113
+ }, _callee13);
1066
1114
  }));
1067
- return function createClient(_x2, _x3) {
1115
+ return function createClient(_x3, _x4) {
1068
1116
  return _ref7.apply(this, arguments);
1069
1117
  };
1070
1118
  }();