@webex/calling 3.9.0-multipleLLM.2 → 3.9.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 (174) hide show
  1. package/dist/CallHistory/CallHistory.js +51 -46
  2. package/dist/CallHistory/CallHistory.js.map +1 -1
  3. package/dist/CallHistory/CallHistory.test.js +146 -147
  4. package/dist/CallHistory/CallHistory.test.js.map +1 -1
  5. package/dist/CallHistory/callHistoryFixtures.js.map +1 -1
  6. package/dist/CallHistory/constants.js.map +1 -1
  7. package/dist/CallHistory/types.js.map +1 -1
  8. package/dist/CallSettings/CallSettings.js +8 -8
  9. package/dist/CallSettings/CallSettings.js.map +1 -1
  10. package/dist/CallSettings/CallSettings.test.js +1 -1
  11. package/dist/CallSettings/CallSettings.test.js.map +1 -1
  12. package/dist/CallSettings/UcmBackendConnector.js +12 -11
  13. package/dist/CallSettings/UcmBackendConnector.js.map +1 -1
  14. package/dist/CallSettings/UcmBackendConnector.test.js +9 -10
  15. package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -1
  16. package/dist/CallSettings/WxCallBackendConnector.js +66 -59
  17. package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
  18. package/dist/CallSettings/WxCallBackendConnector.test.js +108 -109
  19. package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -1
  20. package/dist/CallSettings/constants.js.map +1 -1
  21. package/dist/CallSettings/testFixtures.js.map +1 -1
  22. package/dist/CallSettings/types.js.map +1 -1
  23. package/dist/CallingClient/CallingClient.js +452 -216
  24. package/dist/CallingClient/CallingClient.js.map +1 -1
  25. package/dist/CallingClient/CallingClient.test.js +374 -321
  26. package/dist/CallingClient/CallingClient.test.js.map +1 -1
  27. package/dist/CallingClient/callRecordFixtures.js.map +1 -1
  28. package/dist/CallingClient/calling/CallerId/index.js +2 -2
  29. package/dist/CallingClient/calling/CallerId/index.js.map +1 -1
  30. package/dist/CallingClient/calling/CallerId/index.test.js +8 -7
  31. package/dist/CallingClient/calling/CallerId/index.test.js.map +1 -1
  32. package/dist/CallingClient/calling/CallerId/types.js.map +1 -1
  33. package/dist/CallingClient/calling/call.js +343 -320
  34. package/dist/CallingClient/calling/call.js.map +1 -1
  35. package/dist/CallingClient/calling/call.test.js +405 -406
  36. package/dist/CallingClient/calling/call.test.js.map +1 -1
  37. package/dist/CallingClient/calling/callManager.js +3 -4
  38. package/dist/CallingClient/calling/callManager.js.map +1 -1
  39. package/dist/CallingClient/calling/callManager.test.js +67 -68
  40. package/dist/CallingClient/calling/callManager.test.js.map +1 -1
  41. package/dist/CallingClient/calling/index.js.map +1 -1
  42. package/dist/CallingClient/calling/types.js.map +1 -1
  43. package/dist/CallingClient/callingClientFixtures.js.map +1 -1
  44. package/dist/CallingClient/constants.js +8 -6
  45. package/dist/CallingClient/constants.js.map +1 -1
  46. package/dist/CallingClient/line/index.js +7 -7
  47. package/dist/CallingClient/line/index.js.map +1 -1
  48. package/dist/CallingClient/line/line.test.js +6 -6
  49. package/dist/CallingClient/line/line.test.js.map +1 -1
  50. package/dist/CallingClient/line/types.js.map +1 -1
  51. package/dist/CallingClient/registration/index.js.map +1 -1
  52. package/dist/CallingClient/registration/register.js +243 -234
  53. package/dist/CallingClient/registration/register.js.map +1 -1
  54. package/dist/CallingClient/registration/register.test.js +172 -173
  55. package/dist/CallingClient/registration/register.test.js.map +1 -1
  56. package/dist/CallingClient/registration/registerFixtures.js.map +1 -1
  57. package/dist/CallingClient/registration/types.js.map +1 -1
  58. package/dist/CallingClient/registration/webWorker.js +5 -4
  59. package/dist/CallingClient/registration/webWorker.js.map +1 -1
  60. package/dist/CallingClient/registration/webWorker.test.js +14 -14
  61. package/dist/CallingClient/registration/webWorker.test.js.map +1 -1
  62. package/dist/CallingClient/registration/webWorkerStr.js.map +1 -1
  63. package/dist/CallingClient/types.js.map +1 -1
  64. package/dist/CallingClient/windowsChromiumIceWarmupUtils.js +2 -6
  65. package/dist/CallingClient/windowsChromiumIceWarmupUtils.js.map +1 -1
  66. package/dist/Contacts/ContactsClient.js +244 -238
  67. package/dist/Contacts/ContactsClient.js.map +1 -1
  68. package/dist/Contacts/ContactsClient.test.js +89 -90
  69. package/dist/Contacts/ContactsClient.test.js.map +1 -1
  70. package/dist/Contacts/constants.js +2 -2
  71. package/dist/Contacts/constants.js.map +1 -1
  72. package/dist/Contacts/contactFixtures.js.map +1 -1
  73. package/dist/Contacts/types.js.map +1 -1
  74. package/dist/Errors/catalog/CallError.js +2 -2
  75. package/dist/Errors/catalog/CallError.js.map +1 -1
  76. package/dist/Errors/catalog/CallingDeviceError.js +2 -2
  77. package/dist/Errors/catalog/CallingDeviceError.js.map +1 -1
  78. package/dist/Errors/catalog/ExtendedError.js +3 -3
  79. package/dist/Errors/catalog/ExtendedError.js.map +1 -1
  80. package/dist/Errors/catalog/LineError.js +2 -2
  81. package/dist/Errors/catalog/LineError.js.map +1 -1
  82. package/dist/Errors/index.js.map +1 -1
  83. package/dist/Errors/types.js.map +1 -1
  84. package/dist/Events/impl/index.js +2 -2
  85. package/dist/Events/impl/index.js.map +1 -1
  86. package/dist/Events/types.js.map +1 -1
  87. package/dist/Logger/index.js.map +1 -1
  88. package/dist/Logger/index.test.js.map +1 -1
  89. package/dist/Logger/types.js.map +1 -1
  90. package/dist/Metrics/index.js +136 -50
  91. package/dist/Metrics/index.js.map +1 -1
  92. package/dist/Metrics/index.test.js.map +1 -1
  93. package/dist/Metrics/types.js +15 -1
  94. package/dist/Metrics/types.js.map +1 -1
  95. package/dist/SDKConnector/index.js +0 -1
  96. package/dist/SDKConnector/index.js.map +1 -1
  97. package/dist/SDKConnector/index.test.js.map +1 -1
  98. package/dist/SDKConnector/types.js.map +1 -1
  99. package/dist/SDKConnector/utils.js.map +1 -1
  100. package/dist/SDKConnector/utils.test.js.map +1 -1
  101. package/dist/Voicemail/BroadworksBackendConnector.js +42 -39
  102. package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -1
  103. package/dist/Voicemail/BroadworksBackendConnector.test.js +119 -120
  104. package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -1
  105. package/dist/Voicemail/UcmBackendConnector.js +54 -47
  106. package/dist/Voicemail/UcmBackendConnector.js.map +1 -1
  107. package/dist/Voicemail/UcmBackendConnector.test.js +73 -74
  108. package/dist/Voicemail/UcmBackendConnector.test.js.map +1 -1
  109. package/dist/Voicemail/Voicemail.js +12 -11
  110. package/dist/Voicemail/Voicemail.js.map +1 -1
  111. package/dist/Voicemail/Voicemail.test.js +2 -2
  112. package/dist/Voicemail/Voicemail.test.js.map +1 -1
  113. package/dist/Voicemail/WxCallBackendConnector.js +78 -70
  114. package/dist/Voicemail/WxCallBackendConnector.js.map +1 -1
  115. package/dist/Voicemail/WxCallBackendConnector.test.js +184 -185
  116. package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -1
  117. package/dist/Voicemail/constants.js.map +1 -1
  118. package/dist/Voicemail/types.js.map +1 -1
  119. package/dist/Voicemail/voicemailFixture.js.map +1 -1
  120. package/dist/api.js.map +1 -1
  121. package/dist/common/Utils.js +80 -63
  122. package/dist/common/Utils.js.map +1 -1
  123. package/dist/common/Utils.test.js +95 -104
  124. package/dist/common/Utils.test.js.map +1 -1
  125. package/dist/common/constants.js.map +1 -1
  126. package/dist/common/index.js.map +1 -1
  127. package/dist/common/testUtil.js +1 -1
  128. package/dist/common/testUtil.js.map +1 -1
  129. package/dist/common/types.js.map +1 -1
  130. package/dist/index.js +5 -5
  131. package/dist/index.js.map +1 -1
  132. package/dist/module/CallHistory/CallHistory.js +4 -0
  133. package/dist/module/CallSettings/UcmBackendConnector.js +1 -0
  134. package/dist/module/CallSettings/WxCallBackendConnector.js +7 -0
  135. package/dist/module/CallingClient/CallingClient.js +171 -43
  136. package/dist/module/CallingClient/calling/call.js +66 -43
  137. package/dist/module/CallingClient/constants.js +7 -4
  138. package/dist/module/CallingClient/registration/register.js +10 -7
  139. package/dist/module/CallingClient/registration/webWorker.js +2 -1
  140. package/dist/module/CallingClient/windowsChromiumIceWarmupUtils.js +1 -4
  141. package/dist/module/Contacts/ContactsClient.js +23 -17
  142. package/dist/module/Contacts/constants.js +1 -1
  143. package/dist/module/Metrics/index.js +63 -1
  144. package/dist/module/Metrics/types.js +14 -0
  145. package/dist/module/Voicemail/BroadworksBackendConnector.js +3 -0
  146. package/dist/module/Voicemail/UcmBackendConnector.js +6 -0
  147. package/dist/module/Voicemail/WxCallBackendConnector.js +8 -0
  148. package/dist/module/common/Utils.js +22 -8
  149. package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
  150. package/dist/types/CallSettings/UcmBackendConnector.d.ts.map +1 -1
  151. package/dist/types/CallSettings/WxCallBackendConnector.d.ts.map +1 -1
  152. package/dist/types/CallingClient/CallingClient.d.ts +12 -1
  153. package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
  154. package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
  155. package/dist/types/CallingClient/calling/types.d.ts +2 -1
  156. package/dist/types/CallingClient/calling/types.d.ts.map +1 -1
  157. package/dist/types/CallingClient/constants.d.ts +7 -4
  158. package/dist/types/CallingClient/constants.d.ts.map +1 -1
  159. package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
  160. package/dist/types/CallingClient/registration/webWorker.d.ts +2 -1
  161. package/dist/types/CallingClient/registration/webWorker.d.ts.map +1 -1
  162. package/dist/types/CallingClient/windowsChromiumIceWarmupUtils.d.ts +2 -4
  163. package/dist/types/CallingClient/windowsChromiumIceWarmupUtils.d.ts.map +1 -1
  164. package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
  165. package/dist/types/Contacts/constants.d.ts +1 -1
  166. package/dist/types/Contacts/constants.d.ts.map +1 -1
  167. package/dist/types/Metrics/index.d.ts.map +1 -1
  168. package/dist/types/Metrics/types.d.ts +17 -2
  169. package/dist/types/Metrics/types.d.ts.map +1 -1
  170. package/dist/types/Voicemail/BroadworksBackendConnector.d.ts.map +1 -1
  171. package/dist/types/Voicemail/UcmBackendConnector.d.ts.map +1 -1
  172. package/dist/types/Voicemail/WxCallBackendConnector.d.ts.map +1 -1
  173. package/dist/types/common/Utils.d.ts.map +1 -1
  174. package/package.json +9 -7
@@ -41,13 +41,12 @@ var _line = _interopRequireDefault(require("./line"));
41
41
  var _types4 = require("../Metrics/types");
42
42
  var _Metrics = require("../Metrics");
43
43
  var _windowsChromiumIceWarmupUtils = _interopRequireDefault(require("./windowsChromiumIceWarmupUtils"));
44
- function _getRequireWildcardCache(e) { if ("function" != typeof _WeakMap) return null; var r = new _WeakMap(), t = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
45
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? _Object$getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? _Object$defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
46
- 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; } } }; }
47
- 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); }
48
- 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; }
49
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
50
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /* eslint-disable no-underscore-dangle */ /* eslint-disable valid-jsdoc */ /* eslint-disable @typescript-eslint/no-shadow */
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 _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
+ 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
+ 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 _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 */
51
50
  /**
52
51
  * The `CallingClient` module provides a set of APIs for line registration and calling functionalities within the SDK.
53
52
  *
@@ -81,6 +80,119 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
81
80
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "mobiusHost", void 0);
82
81
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "mediaEngine", void 0);
83
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() {
89
+ var line;
90
+ return _regenerator.default.wrap(function _callee$(_context) {
91
+ while (1) switch (_context.prev = _context.next) {
92
+ case 0:
93
+ _this.networkDownTimestamp = new Date().toISOString();
94
+ _context.next = 3;
95
+ return _this.checkNetworkReachability();
96
+ case 3:
97
+ _this.isNetworkDown = !_context.sent;
98
+ _Logger.default.warn("Network has gone down, wait for it to come back up", {
99
+ file: _constants2.CALLING_CLIENT_FILE,
100
+ method: _constants2.METHODS.NETWORK_OFFLINE
101
+ });
102
+ if (_this.isNetworkDown) {
103
+ line = (0, _values.default)(_this.lineDict)[0];
104
+ line.registration.clearKeepaliveTimer();
105
+ }
106
+ case 6:
107
+ case "end":
108
+ return _context.stop();
109
+ }
110
+ }, _callee);
111
+ })));
112
+ // Wondering if we should keep this for timestamp recording purpose
113
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleNetworkOnline", function () {
114
+ _Logger.default.info(_constants.METHOD_START_MESSAGE, {
115
+ file: _constants2.CALLING_CLIENT_FILE,
116
+ method: _constants2.METHODS.NETWORK_ONLINE
117
+ });
118
+ _this.networkUpTimestamp = new Date().toISOString();
119
+ });
120
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleMercuryOffline", function () {
121
+ _Logger.default.warn("Mercury down, waiting for connection to be up", {
122
+ file: _constants2.CALLING_CLIENT_FILE,
123
+ method: _constants2.METHODS.MERCURY_OFFLINE
124
+ });
125
+ _this.mercuryDownTimestamp = new Date().toISOString();
126
+ _this.metricManager.submitConnectionMetrics(_types4.METRIC_EVENT.CONNECTION_ERROR, _types4.CONNECTION_ACTION.MERCURY_DOWN, _types4.METRIC_TYPE.BEHAVIORAL, _this.mercuryDownTimestamp, _this.mercuryUpTimestamp);
127
+ });
128
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleMercuryOnline", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3() {
129
+ var callCheckInterval;
130
+ return _regenerator.default.wrap(function _callee3$(_context3) {
131
+ while (1) switch (_context3.prev = _context3.next) {
132
+ case 0:
133
+ _Logger.default.info(_constants.METHOD_START_MESSAGE, {
134
+ file: _constants2.CALLING_CLIENT_FILE,
135
+ method: _constants2.METHODS.MERCURY_ONLINE
136
+ });
137
+ _this.mercuryUpTimestamp = new Date().toISOString();
138
+ if (!_this.isNetworkDown) {
139
+ _context3.next = 10;
140
+ break;
141
+ }
142
+ callCheckInterval = setInterval(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2() {
143
+ var line;
144
+ return _regenerator.default.wrap(function _callee2$(_context2) {
145
+ while (1) switch (_context2.prev = _context2.next) {
146
+ case 0:
147
+ if ((0, _keys.default)(_this.callManager.getActiveCalls()).length) {
148
+ _context2.next = 10;
149
+ break;
150
+ }
151
+ clearInterval(callCheckInterval);
152
+ line = (0, _values.default)(_this.lineDict)[0];
153
+ if (!(line.getStatus() !== _types3.RegistrationStatus.IDLE)) {
154
+ _context2.next = 9;
155
+ break;
156
+ }
157
+ _context2.next = 6;
158
+ return line.registration.handleConnectionRestoration(_this.isNetworkDown);
159
+ case 6:
160
+ _this.isNetworkDown = _context2.sent;
161
+ _context2.next = 10;
162
+ break;
163
+ case 9:
164
+ _this.isNetworkDown = false;
165
+ case 10:
166
+ case "end":
167
+ return _context2.stop();
168
+ }
169
+ }, _callee2);
170
+ })), _constants2.NETWORK_FLAP_TIMEOUT);
171
+ if (!(0, _keys.default)(_this.callManager.getActiveCalls()).length) {
172
+ _context3.next = 7;
173
+ break;
174
+ }
175
+ _context3.next = 7;
176
+ return _this.checkCallStatus();
177
+ case 7:
178
+ _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;
180
+ break;
181
+ case 10:
182
+ if (!(0, _keys.default)(_this.callManager.getActiveCalls()).length) {
183
+ _context3.next = 13;
184
+ break;
185
+ }
186
+ _context3.next = 13;
187
+ return _this.checkCallStatus();
188
+ case 13:
189
+ _this.metricManager.submitConnectionMetrics(_types4.METRIC_EVENT.CONNECTION_ERROR, _types4.CONNECTION_ACTION.MERCURY_UP, _types4.METRIC_TYPE.BEHAVIORAL, _this.mercuryDownTimestamp, _this.mercuryUpTimestamp);
190
+ case 14:
191
+ case "end":
192
+ return _context3.stop();
193
+ }
194
+ }, _callee3);
195
+ })));
84
196
  /**
85
197
  * Handler registered for ALL_CALLS_CLEARED event emitted by callManager.
86
198
  *
@@ -88,10 +200,10 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
88
200
  * will be attempted here on receiving a notification from callManager that all
89
201
  * calls are cleaned up.
90
202
  */
91
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "callsClearedHandler", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
203
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "callsClearedHandler", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5() {
92
204
  var registration;
93
- return _regenerator.default.wrap(function _callee2$(_context2) {
94
- while (1) switch (_context2.prev = _context2.next) {
205
+ return _regenerator.default.wrap(function _callee5$(_context5) {
206
+ while (1) switch (_context5.prev = _context5.next) {
95
207
  case 0:
96
208
  _Logger.default.info(_constants.METHOD_START_MESSAGE, {
97
209
  file: _constants2.CALLING_CLIENT_FILE,
@@ -101,35 +213,35 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
101
213
  // it will change once we have proper lineId and multiple lines as well
102
214
  registration = (0, _values.default)(_this.lineDict)[0].registration;
103
215
  if (registration.isDeviceRegistered()) {
104
- _context2.next = 5;
216
+ _context5.next = 5;
105
217
  break;
106
218
  }
107
- _context2.next = 5;
108
- return _this.mutex.runExclusive( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
109
- return _regenerator.default.wrap(function _callee$(_context) {
110
- while (1) switch (_context.prev = _context.next) {
219
+ _context5.next = 5;
220
+ return _this.mutex.runExclusive(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4() {
221
+ return _regenerator.default.wrap(function _callee4$(_context4) {
222
+ while (1) switch (_context4.prev = _context4.next) {
111
223
  case 0:
112
224
  if (!registration.isReconnectPending()) {
113
- _context.next = 4;
225
+ _context4.next = 4;
114
226
  break;
115
227
  }
116
228
  _Logger.default.info('All calls cleared, reconnecting', {
117
229
  file: _constants2.CALLING_CLIENT_FILE,
118
230
  method: _constants2.CALLS_CLEARED_HANDLER_UTIL
119
231
  });
120
- _context.next = 4;
232
+ _context4.next = 4;
121
233
  return registration.reconnectOnFailure(_constants2.CALLS_CLEARED_HANDLER_UTIL);
122
234
  case 4:
123
235
  case "end":
124
- return _context.stop();
236
+ return _context4.stop();
125
237
  }
126
- }, _callee);
238
+ }, _callee4);
127
239
  })));
128
240
  case 5:
129
241
  case "end":
130
- return _context2.stop();
242
+ return _context5.stop();
131
243
  }
132
- }, _callee2);
244
+ }, _callee5);
133
245
  })));
134
246
  _this.sdkConnector = _SDKConnector.default;
135
247
  if (!_this.sdkConnector.getWebex()) {
@@ -138,7 +250,6 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
138
250
  if (config !== null && config !== void 0 && (_config$logger = config.logger) !== null && _config$logger !== void 0 && _config$logger.level && webex.logger.config) {
139
251
  webex.logger.config.level = config.logger.level; // override the webex logger level
140
252
  }
141
-
142
253
  _Logger.default.setWebexLogger(webex.logger);
143
254
  }
144
255
  _this.mutex = new _asyncMutex.Mutex();
@@ -223,8 +334,6 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
223
334
  return _this;
224
335
  }
225
336
 
226
- // async calls required to run after constructor
227
-
228
337
  /**
229
338
  * Initializes the `CallingClient` by performing the following steps:
230
339
  *
@@ -239,43 +348,59 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
239
348
  */
240
349
  (0, _createClass2.default)(CallingClient, [{
241
350
  key: "init",
242
- value: function () {
243
- var _init = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
244
- return _regenerator.default.wrap(function _callee3$(_context3) {
245
- while (1) switch (_context3.prev = _context3.next) {
351
+ value: (function () {
352
+ var _init = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6() {
353
+ var _window, _window$navigator;
354
+ var ua;
355
+ return _regenerator.default.wrap(function _callee6$(_context6) {
356
+ while (1) switch (_context6.prev = _context6.next) {
246
357
  case 0:
247
- _context3.prev = 0;
248
- _context3.next = 3;
358
+ 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;
360
+ break;
361
+ }
362
+ ua = window.navigator.userAgent;
363
+ if (!ua.toLowerCase().includes('windows')) {
364
+ _context6.next = 13;
365
+ break;
366
+ }
367
+ _Logger.default.info('Starting ICE warmup for Windows Chromium based browser', {
368
+ file: _constants2.CALLING_CLIENT_FILE,
369
+ method: 'init'
370
+ });
371
+ _context6.prev = 4;
372
+ _context6.next = 7;
249
373
  return (0, _windowsChromiumIceWarmupUtils.default)({
250
- iceServers: [{
251
- urls: 'stun:stun01a-us.bcld.webex.com:5004'
252
- }, {
253
- urls: 'stun:stun02a-us.bcld.webex.com:5004'
254
- }],
374
+ iceServers: [],
255
375
  timeoutMs: 1000
256
376
  });
257
- case 3:
258
- _Logger.default.info("ICE warmup completed", '');
259
- _context3.next = 9;
377
+ case 7:
378
+ _Logger.default.info("ICE warmup completed", {
379
+ file: _constants2.CALLING_CLIENT_FILE,
380
+ method: 'init'
381
+ });
382
+ _context6.next = 13;
260
383
  break;
261
- case 6:
262
- _context3.prev = 6;
263
- _context3.t0 = _context3["catch"](0);
264
- _Logger.default.warn("ICE warmup failed: ".concat(_context3.t0), '');
265
- case 9:
266
- _context3.next = 11;
384
+ case 10:
385
+ _context6.prev = 10;
386
+ _context6.t0 = _context6["catch"](4);
387
+ _Logger.default.warn("ICE warmup failed: ".concat(_context6.t0), {
388
+ file: _constants2.CALLING_CLIENT_FILE,
389
+ method: 'init'
390
+ });
391
+ case 13:
392
+ _context6.next = 15;
267
393
  return this.getMobiusServers();
268
- case 11:
269
- _context3.next = 13;
394
+ case 15:
395
+ _context6.next = 17;
270
396
  return this.createLine();
271
- case 13:
272
- /* Better to run the timer once rather than after every registration */
273
- this.detectNetworkChange();
274
- case 14:
397
+ case 17:
398
+ this.setupNetworkEventListeners();
399
+ case 18:
275
400
  case "end":
276
- return _context3.stop();
401
+ return _context6.stop();
277
402
  }
278
- }, _callee3, this, [[0, 6]]);
403
+ }, _callee6, this, [[4, 10]]);
279
404
  }));
280
405
  function init() {
281
406
  return _init.apply(this, arguments);
@@ -283,102 +408,171 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
283
408
  return init;
284
409
  }()
285
410
  /**
286
- * Register callbacks for network changes.
411
+ * Ping a reliable external endpoint with a short timeout to infer connectivity.
287
412
  */
413
+ )
288
414
  }, {
289
- key: "detectNetworkChange",
415
+ key: "checkNetworkReachability",
290
416
  value: (function () {
291
- var _detectNetworkChange = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
292
- var _this2 = this;
293
- var retry, line;
294
- return _regenerator.default.wrap(function _callee5$(_context5) {
295
- while (1) switch (_context5.prev = _context5.next) {
417
+ var _checkNetworkReachability = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee7() {
418
+ var controller, timeoutId;
419
+ return _regenerator.default.wrap(function _callee7$(_context7) {
420
+ while (1) switch (_context7.prev = _context7.next) {
296
421
  case 0:
297
- _Logger.default.info(_constants.METHOD_START_MESSAGE, {
422
+ _context7.prev = 0;
423
+ controller = new AbortController();
424
+ timeoutId = setTimeout(function () {
425
+ return controller.abort();
426
+ }, 3000); // Using a common connectivity check endpoint that returns 204 with minimal payload.
427
+ // no-cors mode yields an opaque response but a successful fetch implies reachability.
428
+ _context7.next = 5;
429
+ return fetch('https://www.google.com/generate_204', {
430
+ method: 'GET',
431
+ cache: 'no-cache',
432
+ mode: 'no-cors',
433
+ signal: controller.signal
434
+ });
435
+ case 5:
436
+ clearTimeout(timeoutId);
437
+ 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), {
298
442
  file: _constants2.CALLING_CLIENT_FILE,
299
- method: _constants2.METHODS.DETECT_NETWORK_CHANGE
443
+ method: 'pingExternal'
300
444
  });
301
- retry = false; // this is a temporary logic to get registration obj
302
- // it will change once we have proper lineId and multiple lines as well
303
- line = (0, _values.default)(this.lineDict)[0];
304
- setInterval( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
305
- return _regenerator.default.wrap(function _callee4$(_context4) {
306
- while (1) switch (_context4.prev = _context4.next) {
445
+ return _context7.abrupt("return", false);
446
+ case 13:
447
+ case "end":
448
+ return _context7.stop();
449
+ }
450
+ }, _callee7, null, [[0, 9]]);
451
+ }));
452
+ function checkNetworkReachability() {
453
+ return _checkNetworkReachability.apply(this, arguments);
454
+ }
455
+ return checkNetworkReachability;
456
+ }())
457
+ }, {
458
+ key: "checkCallStatus",
459
+ value: function () {
460
+ 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) {
463
+ while (1) switch (_context9.prev = _context9.next) {
464
+ case 0:
465
+ loggerContext = {
466
+ file: _constants2.CALLING_CLIENT_FILE,
467
+ method: 'checkCallStatus'
468
+ };
469
+ calls = (0, _values.default)(this.callManager.getActiveCalls());
470
+ _iterator = _createForOfIteratorHelper(calls);
471
+ _context9.prev = 3;
472
+ _loop = /*#__PURE__*/_regenerator.default.mark(function _loop() {
473
+ var call;
474
+ return _regenerator.default.wrap(function _loop$(_context8) {
475
+ while (1) switch (_context8.prev = _context8.next) {
307
476
  case 0:
308
- if (!_this2.webex.internal.mercury.connected && !retry && !(0, _keys.default)(_this2.callManager.getActiveCalls()).length) {
309
- _Logger.default.warn("Network has flapped, waiting for mercury connection to be up", {
310
- file: _constants2.CALLING_CLIENT_FILE,
311
- method: _constants2.METHODS.DETECT_NETWORK_CHANGE
477
+ call = _step.value;
478
+ call.postStatus().then(function () {
479
+ _Logger.default.info("Call is active", loggerContext);
480
+ /*
481
+ * Media Renegotiation Possibility if call keepalive succeeds,
482
+ * for cases like WebRTC disconnect and media inactivity.
483
+ */
484
+ }).catch(function (err) {
485
+ _Logger.default.warn("Call Keepalive failed: ".concat(err), loggerContext);
486
+ call.sendCallStateMachineEvt({
487
+ type: 'E_SEND_CALL_DISCONNECT'
312
488
  });
313
- line.registration.clearKeepaliveTimer();
314
- retry = true;
315
- }
316
- if (!(retry && _this2.webex.internal.mercury.connected)) {
317
- _context4.next = 9;
318
- break;
319
- }
320
- if (!(line.getStatus() !== _types3.RegistrationStatus.IDLE)) {
321
- _context4.next = 8;
322
- break;
323
- }
324
- _context4.next = 5;
325
- return line.registration.handleConnectionRestoration(retry);
326
- case 5:
327
- retry = _context4.sent;
328
- _context4.next = 9;
329
- break;
330
- case 8:
331
- retry = false;
332
- case 9:
489
+ });
490
+ case 2:
333
491
  case "end":
334
- return _context4.stop();
492
+ return _context8.stop();
335
493
  }
336
- }, _callee4);
337
- })), _constants2.NETWORK_FLAP_TIMEOUT);
338
- case 4:
494
+ }, _loop);
495
+ });
496
+ _iterator.s();
497
+ case 6:
498
+ if ((_step = _iterator.n()).done) {
499
+ _context9.next = 10;
500
+ break;
501
+ }
502
+ return _context9.delegateYield(_loop(), "t0", 8);
503
+ case 8:
504
+ _context9.next = 6;
505
+ break;
506
+ case 10:
507
+ _context9.next = 15;
508
+ 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;
515
+ _iterator.f();
516
+ return _context9.finish(15);
517
+ case 18:
339
518
  case "end":
340
- return _context5.stop();
519
+ return _context9.stop();
341
520
  }
342
- }, _callee5, this);
521
+ }, _callee8, this, [[3, 12, 15, 18]]);
343
522
  }));
344
- function detectNetworkChange() {
345
- return _detectNetworkChange.apply(this, arguments);
523
+ function checkCallStatus() {
524
+ return _checkCallStatus.apply(this, arguments);
346
525
  }
347
- return detectNetworkChange;
526
+ return checkCallStatus;
348
527
  }()
528
+ }, {
529
+ key: "setupNetworkEventListeners",
530
+ value: function setupNetworkEventListeners() {
531
+ var _this2 = this;
532
+ if (typeof window !== 'undefined' && window.addEventListener) {
533
+ window.addEventListener('online', this.handleNetworkOnline);
534
+ window.addEventListener('offline', this.handleNetworkOffline);
535
+ }
536
+ this.webex.internal.mercury.on('offline', function () {
537
+ _this2.handleMercuryOffline();
538
+ });
539
+ this.webex.internal.mercury.on('online', function () {
540
+ _this2.handleMercuryOnline();
541
+ });
542
+ }
543
+
349
544
  /**
350
545
  * Fetches countryCode and region of the client.
351
546
  */
352
- )
353
547
  }, {
354
548
  key: "getClientRegionInfo",
355
549
  value: (function () {
356
- var _getClientRegionInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
550
+ var _getClientRegionInfo = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9() {
357
551
  var _this3 = this;
358
- var abort, regionInfo, _iterator, _step, _loop, _ret;
359
- return _regenerator.default.wrap(function _callee6$(_context7) {
360
- while (1) switch (_context7.prev = _context7.next) {
552
+ var abort, regionInfo, _iterator2, _step2, _loop2, _ret;
553
+ return _regenerator.default.wrap(function _callee9$(_context1) {
554
+ while (1) switch (_context1.prev = _context1.next) {
361
555
  case 0:
362
556
  _Logger.default.info(_constants.METHOD_START_MESSAGE, {
363
557
  file: _constants2.CALLING_CLIENT_FILE,
364
558
  method: _constants2.METHODS.GET_CLIENT_REGION_INFO
365
559
  });
366
560
  regionInfo = {};
367
- _iterator = _createForOfIteratorHelper(this.mobiusClusters);
368
- _context7.prev = 3;
369
- _loop = /*#__PURE__*/_regenerator.default.mark(function _loop() {
370
- var mobius, temp, myIP, response, clientRegionInfo, extendedError;
371
- return _regenerator.default.wrap(function _loop$(_context6) {
372
- while (1) switch (_context6.prev = _context6.next) {
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) {
373
567
  case 0:
374
- mobius = _step.value;
568
+ mobius = _step2.value;
375
569
  if (mobius.host) {
376
570
  _this3.mobiusHost = "https://".concat(mobius.host).concat(_constants2.API_V1);
377
571
  } else {
378
572
  _this3.mobiusHost = mobius;
379
573
  }
380
- _context6.prev = 2;
381
- _context6.next = 5;
574
+ _context0.prev = 2;
575
+ _context0.next = 5;
382
576
  return _this3.webex.request({
383
577
  uri: "".concat(_this3.mobiusHost).concat(_constants2.URL_ENDPOINT).concat(_constants2.IP_ENDPOINT),
384
578
  method: _types3.HTTP_METHODS.GET,
@@ -386,98 +580,116 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
386
580
  service: _types3.ALLOWED_SERVICES.MOBIUS
387
581
  });
388
582
  case 5:
389
- temp = _context6.sent;
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
+ });
390
588
  myIP = temp.body.ipv4; // eslint-disable-next-line no-await-in-loop
391
- _context6.next = 9;
589
+ _context0.next = 10;
392
590
  return _this3.webex.request({
393
591
  uri: "".concat(_constants2.DISCOVERY_URL, "/").concat(myIP),
394
592
  method: _types3.HTTP_METHODS.GET,
395
593
  addAuthHeader: false,
396
594
  headers: (0, _defineProperty2.default)({}, _constants2.SPARK_USER_AGENT, null)
397
595
  });
398
- case 9:
399
- response = _context6.sent;
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
+ });
400
602
  clientRegionInfo = response.body;
401
603
  regionInfo.clientRegion = clientRegionInfo !== null && clientRegionInfo !== void 0 && clientRegionInfo.clientRegion ? clientRegionInfo.clientRegion : '';
402
604
  regionInfo.countryCode = clientRegionInfo !== null && clientRegionInfo !== void 0 && clientRegionInfo.countryCode ? clientRegionInfo.countryCode : '';
403
- return _context6.abrupt("return", 0);
404
- case 16:
405
- _context6.prev = 16;
406
- _context6.t0 = _context6["catch"](2);
407
- extendedError = new Error("Failed to get client region info: ".concat(_context6.t0));
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));
408
617
  _Logger.default.error(extendedError, {
409
618
  method: _constants2.METHODS.GET_CLIENT_REGION_INFO,
410
619
  file: _constants2.CALLING_CLIENT_FILE
411
620
  });
412
621
 
413
622
  // eslint-disable-next-line no-await-in-loop
414
- _context6.next = 22;
415
- return (0, _Utils.handleCallingClientErrors)(_context6.t0, function (clientError) {
623
+ _context0.next = 26;
624
+ return (0, _Utils.handleCallingClientErrors)(_context0.t0, function (clientError) {
416
625
  var _headers$trackingId, _headers3;
417
- _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 = _context6.t0.headers) === null || _headers3 === void 0 ? void 0 : _headers3.trackingId) !== null && _headers$trackingId !== void 0 ? _headers$trackingId : '', undefined, clientError);
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);
418
627
  _this3.emit(_types2.CALLING_CLIENT_EVENT_KEYS.ERROR, clientError);
419
628
  }, {
420
629
  method: _constants2.GET_MOBIUS_SERVERS_UTIL,
421
630
  file: _constants2.CALLING_CLIENT_FILE
422
631
  });
423
- case 22:
424
- abort = _context6.sent;
632
+ case 26:
633
+ abort = _context0.sent;
425
634
  regionInfo.clientRegion = '';
426
635
  regionInfo.countryCode = '';
427
636
  if (!abort) {
428
- _context6.next = 27;
637
+ _context0.next = 33;
429
638
  break;
430
639
  }
431
- return _context6.abrupt("return", {
640
+ _context0.next = 32;
641
+ return (0, _Utils.uploadLogs)();
642
+ case 32:
643
+ return _context0.abrupt("return", {
432
644
  v: regionInfo
433
645
  });
434
- case 27:
646
+ case 33:
435
647
  case "end":
436
- return _context6.stop();
648
+ return _context0.stop();
437
649
  }
438
- }, _loop, null, [[2, 16]]);
650
+ }, _loop2, null, [[2, 20]]);
439
651
  });
440
- _iterator.s();
652
+ _iterator2.s();
441
653
  case 6:
442
- if ((_step = _iterator.n()).done) {
443
- _context7.next = 15;
654
+ if ((_step2 = _iterator2.n()).done) {
655
+ _context1.next = 15;
444
656
  break;
445
657
  }
446
- return _context7.delegateYield(_loop(), "t0", 8);
658
+ return _context1.delegateYield(_loop2(), "t0", 8);
447
659
  case 8:
448
- _ret = _context7.t0;
660
+ _ret = _context1.t0;
449
661
  if (!(_ret === 0)) {
450
- _context7.next = 11;
662
+ _context1.next = 11;
451
663
  break;
452
664
  }
453
- return _context7.abrupt("break", 15);
665
+ return _context1.abrupt("break", 15);
454
666
  case 11:
455
667
  if (!_ret) {
456
- _context7.next = 13;
668
+ _context1.next = 13;
457
669
  break;
458
670
  }
459
- return _context7.abrupt("return", _ret.v);
671
+ return _context1.abrupt("return", _ret.v);
460
672
  case 13:
461
- _context7.next = 6;
673
+ _context1.next = 6;
462
674
  break;
463
675
  case 15:
464
- _context7.next = 20;
676
+ _context1.next = 20;
465
677
  break;
466
678
  case 17:
467
- _context7.prev = 17;
468
- _context7.t1 = _context7["catch"](3);
469
- _iterator.e(_context7.t1);
679
+ _context1.prev = 17;
680
+ _context1.t1 = _context1["catch"](3);
681
+ _iterator2.e(_context1.t1);
470
682
  case 20:
471
- _context7.prev = 20;
472
- _iterator.f();
473
- return _context7.finish(20);
683
+ _context1.prev = 20;
684
+ _iterator2.f();
685
+ return _context1.finish(20);
474
686
  case 23:
475
- return _context7.abrupt("return", regionInfo);
687
+ return _context1.abrupt("return", regionInfo);
476
688
  case 24:
477
689
  case "end":
478
- return _context7.stop();
690
+ return _context1.stop();
479
691
  }
480
- }, _callee6, this, [[3, 17, 20, 23]]);
692
+ }, _callee9, this, [[3, 17, 20, 23]]);
481
693
  }));
482
694
  function getClientRegionInfo() {
483
695
  return _getClientRegionInfo.apply(this, arguments);
@@ -491,15 +703,15 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
491
703
  }, {
492
704
  key: "getMobiusServers",
493
705
  value: (function () {
494
- var _getMobiusServers = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
706
+ var _getMobiusServers = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0() {
495
707
  var _this$sdkConfig3,
496
708
  _this$sdkConfig3$disc,
497
709
  _this$sdkConfig4,
498
710
  _this$sdkConfig4$disc,
499
711
  _this4 = this;
500
- var useDefault, clientRegion, countryCode, _this$sdkConfig5, _this$sdkConfig5$disc, _this$sdkConfig6, _this$sdkConfig6$disc, regionInfo, temp, mobiusServers, mobiusUris, extendedError;
501
- return _regenerator.default.wrap(function _callee7$(_context8) {
502
- while (1) switch (_context8.prev = _context8.next) {
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) {
714
+ while (1) switch (_context10.prev = _context10.next) {
503
715
  case 0:
504
716
  _Logger.default.info(_constants.METHOD_START_MESSAGE, {
505
717
  file: _constants2.CALLING_CLIENT_FILE,
@@ -514,7 +726,7 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
514
726
  */
515
727
  useDefault = false;
516
728
  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)) {
517
- _context8.next = 9;
729
+ _context10.next = 9;
518
730
  break;
519
731
  }
520
732
  _Logger.default.log('Updating region and country from the SDK config', {
@@ -524,27 +736,30 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
524
736
  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;
525
737
  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;
526
738
  this.mobiusHost = this.webex.internal.services._serviceUrls.mobius;
527
- _context8.next = 15;
739
+ _context10.next = 15;
528
740
  break;
529
741
  case 9:
530
742
  _Logger.default.log('Updating region and country through Region discovery', {
531
743
  file: _constants2.CALLING_CLIENT_FILE,
532
744
  method: _constants2.GET_MOBIUS_SERVERS_UTIL
533
745
  });
534
- _context8.next = 12;
746
+ _context10.next = 12;
535
747
  return this.getClientRegionInfo();
536
748
  case 12:
537
- regionInfo = _context8.sent;
749
+ regionInfo = _context10.sent;
538
750
  clientRegion = regionInfo.clientRegion;
539
751
  countryCode = regionInfo.countryCode;
540
752
  case 15:
541
753
  if (!(clientRegion && countryCode)) {
542
- _context8.next = 37;
754
+ _context10.next = 43;
543
755
  break;
544
756
  }
545
- _Logger.default.log("Found Region: ".concat(clientRegion, " and country: ").concat(countryCode, ", going to fetch Mobius server"), '');
546
- _context8.prev = 17;
547
- _context8.next = 20;
757
+ _Logger.default.log("Found Region: ".concat(clientRegion, " and country: ").concat(countryCode, ", going to fetch Mobius server"), {
758
+ file: _constants2.CALLING_CLIENT_FILE,
759
+ method: _constants2.GET_MOBIUS_SERVERS_UTIL
760
+ });
761
+ _context10.prev = 17;
762
+ _context10.next = 20;
548
763
  return this.webex.request({
549
764
  uri: "".concat(this.mobiusHost).concat(_constants2.URL_ENDPOINT, "?regionCode=").concat(clientRegion, "&countryCode=").concat(countryCode),
550
765
  method: _types3.HTTP_METHODS.GET,
@@ -552,54 +767,75 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
552
767
  service: _types3.ALLOWED_SERVICES.MOBIUS
553
768
  });
554
769
  case 20:
555
- temp = _context8.sent;
556
- _Logger.default.log('Mobius Server found for the region', '');
557
- mobiusServers = temp.body;
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 : '');
777
+
558
778
  /* update arrays of Mobius Uris. */
559
779
  mobiusUris = (0, _Utils.filterMobiusUris)(mobiusServers, this.mobiusHost);
560
780
  this.primaryMobiusUris = mobiusUris.primary;
561
781
  this.backupMobiusUris = mobiusUris.backup;
562
- _Logger.default.info("Final list of Mobius Servers, primary: ".concat(mobiusUris.primary, " and backup: ").concat(mobiusUris.backup), '');
563
- _context8.next = 35;
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;
564
787
  break;
565
- case 29:
566
- _context8.prev = 29;
567
- _context8.t0 = _context8["catch"](17);
568
- extendedError = new Error("Failed to get Mobius servers: ".concat(_context8.t0));
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));
569
792
  _Logger.default.error(extendedError, {
570
793
  method: _constants2.METHODS.GET_MOBIUS_SERVERS,
571
794
  file: _constants2.CALLING_CLIENT_FILE
572
795
  });
573
- (0, _Utils.handleCallingClientErrors)(_context8.t0, function (clientError) {
796
+ _context10.next = 36;
797
+ return (0, _Utils.handleCallingClientErrors)(_context10.t0, function (clientError) {
574
798
  var _headers$trackingId2, _headers5;
575
- _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 = _context8.t0.headers) === null || _headers5 === void 0 ? void 0 : _headers5.trackingId) !== null && _headers$trackingId2 !== void 0 ? _headers$trackingId2 : '', undefined, clientError);
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);
576
800
  _this4.emit(_types2.CALLING_CLIENT_EVENT_KEYS.ERROR, clientError);
577
801
  }, {
578
802
  method: _constants2.GET_MOBIUS_SERVERS_UTIL,
579
803
  file: _constants2.CALLING_CLIENT_FILE
580
804
  });
805
+ case 36:
806
+ abort = _context10.sent;
807
+ if (!abort) {
808
+ _context10.next = 40;
809
+ break;
810
+ }
811
+ _context10.next = 40;
812
+ return (0, _Utils.uploadLogs)();
813
+ case 40:
581
814
  useDefault = true;
582
- case 35:
583
- _context8.next = 38;
815
+ case 41:
816
+ _context10.next = 44;
584
817
  break;
585
- case 37:
818
+ case 43:
586
819
  /* Setting this to true because region info is possibly undefined */
587
820
  useDefault = true;
588
- case 38:
821
+ case 44:
589
822
  /* Use a default URL if Mobius discovery fails either because of region info failure
590
823
  * or because the discovered Mobius couldn't be reached
591
824
  */
592
825
 
593
826
  if (useDefault) {
594
- _Logger.default.warn("Couldn't resolve the region and country code. Defaulting to the catalog entries to discover mobius servers", '');
827
+ _Logger.default.warn("Couldn't resolve the region and country code. Defaulting to the catalog entries to discover mobius servers", {
828
+ file: _constants2.CALLING_CLIENT_FILE,
829
+ method: _constants2.GET_MOBIUS_SERVERS_UTIL
830
+ });
595
831
  this.mobiusHost = "https://".concat(this.mobiusClusters[0].host).concat(_constants2.API_V1);
596
832
  this.primaryMobiusUris = ["".concat(this.mobiusHost).concat(_constants2.URL_ENDPOINT)];
597
833
  }
598
- case 39:
834
+ case 45:
599
835
  case "end":
600
- return _context8.stop();
836
+ return _context10.stop();
601
837
  }
602
- }, _callee7, this, [[17, 29]]);
838
+ }, _callee0, this, [[17, 30]]);
603
839
  }));
604
840
  function getMobiusServers() {
605
841
  return _getMobiusServers.apply(this, arguments);
@@ -650,25 +886,25 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
650
886
  method: _constants2.METHODS.REGISTER_SESSIONS_LISTENER
651
887
  });
652
888
  this.sdkConnector.registerListener(_types2.MOBIUS_EVENT_KEYS.CALL_SESSION_EVENT_INCLUSIVE, /*#__PURE__*/function () {
653
- var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(event) {
889
+ var _ref6 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1(event) {
654
890
  var sessionArr, i;
655
- return _regenerator.default.wrap(function _callee8$(_context9) {
656
- while (1) switch (_context9.prev = _context9.next) {
891
+ return _regenerator.default.wrap(function _callee1$(_context11) {
892
+ while (1) switch (_context11.prev = _context11.next) {
657
893
  case 0:
658
894
  if (!(event && event.data.userSessions.userSessions)) {
659
- _context9.next = 7;
895
+ _context11.next = 7;
660
896
  break;
661
897
  }
662
898
  sessionArr = event === null || event === void 0 ? void 0 : event.data.userSessions.userSessions;
663
899
  if (!(sessionArr.length === 1)) {
664
- _context9.next = 5;
900
+ _context11.next = 5;
665
901
  break;
666
902
  }
667
903
  if (!(sessionArr[0].sessionType !== _types2.SessionType.WEBEX_CALLING)) {
668
- _context9.next = 5;
904
+ _context11.next = 5;
669
905
  break;
670
906
  }
671
- return _context9.abrupt("return");
907
+ return _context11.abrupt("return");
672
908
  case 5:
673
909
  for (i = 0; i < sessionArr.length; i += 1) {
674
910
  if (sessionArr[i].sessionType !== _types2.SessionType.WEBEX_CALLING) {
@@ -678,12 +914,12 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
678
914
  _this5.emit(_types2.CALLING_CLIENT_EVENT_KEYS.USER_SESSION_INFO, event);
679
915
  case 7:
680
916
  case "end":
681
- return _context9.stop();
917
+ return _context11.stop();
682
918
  }
683
- }, _callee8);
919
+ }, _callee1);
684
920
  }));
685
921
  return function (_x) {
686
- return _ref4.apply(this, arguments);
922
+ return _ref6.apply(this, arguments);
687
923
  };
688
924
  }());
689
925
  }
@@ -695,11 +931,11 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
695
931
  }, {
696
932
  key: "createLine",
697
933
  value: (function () {
698
- var _createLine = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
934
+ var _createLine = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
699
935
  var _this$sdkConfig7, _this$sdkConfig8;
700
936
  var line;
701
- return _regenerator.default.wrap(function _callee9$(_context10) {
702
- while (1) switch (_context10.prev = _context10.next) {
937
+ return _regenerator.default.wrap(function _callee10$(_context12) {
938
+ while (1) switch (_context12.prev = _context12.next) {
703
939
  case 0:
704
940
  _Logger.default.info(_constants.METHOD_START_MESSAGE, {
705
941
  file: _constants2.CALLING_CLIENT_FILE,
@@ -709,9 +945,9 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
709
945
  this.lineDict[line.lineId] = line;
710
946
  case 3:
711
947
  case "end":
712
- return _context10.stop();
948
+ return _context12.stop();
713
949
  }
714
- }, _callee9, this);
950
+ }, _callee10, this);
715
951
  }));
716
952
  function createLine() {
717
953
  return _createLine.apply(this, arguments);
@@ -776,27 +1012,27 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
776
1012
  }, {
777
1013
  key: "uploadLogs",
778
1014
  value: (function () {
779
- var _uploadLogs2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
1015
+ var _uploadLogs2 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
780
1016
  var result;
781
- return _regenerator.default.wrap(function _callee10$(_context11) {
782
- while (1) switch (_context11.prev = _context11.next) {
1017
+ return _regenerator.default.wrap(function _callee11$(_context13) {
1018
+ while (1) switch (_context13.prev = _context13.next) {
783
1019
  case 0:
784
- _context11.next = 2;
1020
+ _context13.next = 2;
785
1021
  return (0, _Utils.uploadLogs)({}, true);
786
1022
  case 2:
787
- result = _context11.sent;
1023
+ result = _context13.sent;
788
1024
  if (result) {
789
- _context11.next = 5;
1025
+ _context13.next = 5;
790
1026
  break;
791
1027
  }
792
1028
  throw new Error('Failed to upload logs: No response received.');
793
1029
  case 5:
794
- return _context11.abrupt("return", result);
1030
+ return _context13.abrupt("return", result);
795
1031
  case 6:
796
1032
  case "end":
797
- return _context11.stop();
1033
+ return _context13.stop();
798
1034
  }
799
- }, _callee10);
1035
+ }, _callee11);
800
1036
  }));
801
1037
  function uploadLogs() {
802
1038
  return _uploadLogs2.apply(this, arguments);
@@ -812,24 +1048,24 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
812
1048
  * @param config - Config to start the CallingClient with.
813
1049
  */
814
1050
  var createClient = exports.createClient = /*#__PURE__*/function () {
815
- var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(webex, config) {
1051
+ var _ref7 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12(webex, config) {
816
1052
  var callingClientInstance;
817
- return _regenerator.default.wrap(function _callee11$(_context12) {
818
- while (1) switch (_context12.prev = _context12.next) {
1053
+ return _regenerator.default.wrap(function _callee12$(_context14) {
1054
+ while (1) switch (_context14.prev = _context14.next) {
819
1055
  case 0:
820
1056
  callingClientInstance = new CallingClient(webex, config);
821
- _context12.next = 3;
1057
+ _context14.next = 3;
822
1058
  return callingClientInstance.init();
823
1059
  case 3:
824
- return _context12.abrupt("return", callingClientInstance);
1060
+ return _context14.abrupt("return", callingClientInstance);
825
1061
  case 4:
826
1062
  case "end":
827
- return _context12.stop();
1063
+ return _context14.stop();
828
1064
  }
829
- }, _callee11);
1065
+ }, _callee12);
830
1066
  }));
831
1067
  return function createClient(_x2, _x3) {
832
- return _ref5.apply(this, arguments);
1068
+ return _ref7.apply(this, arguments);
833
1069
  };
834
1070
  }();
835
1071
  //# sourceMappingURL=CallingClient.js.map