@webex/calling 3.10.0-next.8 → 3.10.0-wxc-disconnect.1

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 (96) hide show
  1. package/dist/CallHistory/CallHistory.js +41 -42
  2. package/dist/CallHistory/CallHistory.js.map +1 -1
  3. package/dist/CallHistory/CallHistory.test.js +5 -120
  4. package/dist/CallHistory/CallHistory.test.js.map +1 -1
  5. package/dist/CallSettings/UcmBackendConnector.js +6 -6
  6. package/dist/CallSettings/UcmBackendConnector.js.map +1 -1
  7. package/dist/CallSettings/UcmBackendConnector.test.js +1 -2
  8. package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -1
  9. package/dist/CallSettings/WxCallBackendConnector.js +43 -38
  10. package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
  11. package/dist/CallSettings/WxCallBackendConnector.test.js +1 -4
  12. package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -1
  13. package/dist/CallingClient/CallingClient.js +207 -161
  14. package/dist/CallingClient/CallingClient.js.map +1 -1
  15. package/dist/CallingClient/CallingClient.test.js +290 -152
  16. package/dist/CallingClient/CallingClient.test.js.map +1 -1
  17. package/dist/CallingClient/calling/call.js +53 -50
  18. package/dist/CallingClient/calling/call.js.map +1 -1
  19. package/dist/CallingClient/calling/call.test.js +51 -93
  20. package/dist/CallingClient/calling/call.test.js.map +1 -1
  21. package/dist/CallingClient/calling/callManager.test.js +1 -1
  22. package/dist/CallingClient/calling/callManager.test.js.map +1 -1
  23. package/dist/CallingClient/registration/register.js +4 -5
  24. package/dist/CallingClient/registration/register.js.map +1 -1
  25. package/dist/CallingClient/registration/webWorker.js +3 -3
  26. package/dist/CallingClient/registration/webWorker.js.map +1 -1
  27. package/dist/CallingClient/registration/webWorkerStr.js +1 -1
  28. package/dist/CallingClient/registration/webWorkerStr.js.map +1 -1
  29. package/dist/Contacts/ContactsClient.js +45 -39
  30. package/dist/Contacts/ContactsClient.js.map +1 -1
  31. package/dist/Contacts/ContactsClient.test.js +3 -4
  32. package/dist/Contacts/ContactsClient.test.js.map +1 -1
  33. package/dist/Events/impl/index.js +1 -1
  34. package/dist/Events/impl/index.js.map +1 -1
  35. package/dist/Logger/index.js +3 -3
  36. package/dist/Logger/index.js.map +1 -1
  37. package/dist/Logger/index.test.js +1 -1
  38. package/dist/Logger/index.test.js.map +1 -1
  39. package/dist/SDKConnector/types.js.map +1 -1
  40. package/dist/Voicemail/BroadworksBackendConnector.js +54 -47
  41. package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -1
  42. package/dist/Voicemail/BroadworksBackendConnector.test.js +2 -10
  43. package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -1
  44. package/dist/Voicemail/UcmBackendConnector.js +32 -29
  45. package/dist/Voicemail/UcmBackendConnector.js.map +1 -1
  46. package/dist/Voicemail/Voicemail.js +102 -77
  47. package/dist/Voicemail/Voicemail.js.map +1 -1
  48. package/dist/Voicemail/WxCallBackendConnector.js +59 -46
  49. package/dist/Voicemail/WxCallBackendConnector.js.map +1 -1
  50. package/dist/Voicemail/WxCallBackendConnector.test.js +18 -44
  51. package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -1
  52. package/dist/common/Utils.js +2 -2
  53. package/dist/common/Utils.js.map +1 -1
  54. package/dist/common/Utils.test.js +8 -4
  55. package/dist/common/Utils.test.js.map +1 -1
  56. package/dist/common/testUtil.js +1 -2
  57. package/dist/common/testUtil.js.map +1 -1
  58. package/dist/module/CallHistory/CallHistory.js +11 -20
  59. package/dist/module/CallSettings/UcmBackendConnector.js +2 -1
  60. package/dist/module/CallSettings/WxCallBackendConnector.js +15 -10
  61. package/dist/module/CallingClient/CallingClient.js +123 -83
  62. package/dist/module/CallingClient/calling/call.js +23 -17
  63. package/dist/module/CallingClient/registration/register.js +3 -3
  64. package/dist/module/CallingClient/registration/webWorker.js +2 -2
  65. package/dist/module/CallingClient/registration/webWorkerStr.js +2 -2
  66. package/dist/module/Contacts/ContactsClient.js +25 -19
  67. package/dist/module/Events/impl/index.js +1 -1
  68. package/dist/module/Logger/index.js +2 -2
  69. package/dist/module/Voicemail/BroadworksBackendConnector.js +18 -10
  70. package/dist/module/Voicemail/UcmBackendConnector.js +11 -7
  71. package/dist/module/Voicemail/Voicemail.js +68 -42
  72. package/dist/module/Voicemail/WxCallBackendConnector.js +28 -14
  73. package/dist/module/common/Utils.js +2 -2
  74. package/dist/module/common/testUtil.js +0 -1
  75. package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
  76. package/dist/types/CallSettings/UcmBackendConnector.d.ts.map +1 -1
  77. package/dist/types/CallSettings/WxCallBackendConnector.d.ts.map +1 -1
  78. package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
  79. package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
  80. package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
  81. package/dist/types/CallingClient/registration/webWorkerStr.d.ts +1 -1
  82. package/dist/types/CallingClient/registration/webWorkerStr.d.ts.map +1 -1
  83. package/dist/types/Contacts/ContactsClient.d.ts +0 -1
  84. package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
  85. package/dist/types/Logger/index.d.ts +2 -1
  86. package/dist/types/Logger/index.d.ts.map +1 -1
  87. package/dist/types/SDKConnector/types.d.ts +0 -10
  88. package/dist/types/SDKConnector/types.d.ts.map +1 -1
  89. package/dist/types/Voicemail/BroadworksBackendConnector.d.ts.map +1 -1
  90. package/dist/types/Voicemail/UcmBackendConnector.d.ts.map +1 -1
  91. package/dist/types/Voicemail/Voicemail.d.ts.map +1 -1
  92. package/dist/types/Voicemail/WxCallBackendConnector.d.ts.map +1 -1
  93. package/dist/types/common/Utils.d.ts.map +1 -1
  94. package/dist/types/common/testUtil.d.ts +0 -1
  95. package/dist/types/common/testUtil.d.ts.map +1 -1
  96. package/package.json +4 -4
@@ -17,7 +17,6 @@ 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
20
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
22
21
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
23
22
  var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
@@ -307,7 +306,28 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
307
306
  _this.mediaEngine.setLogger(adaptedLogger);
308
307
  _this.primaryMobiusUris = [];
309
308
  _this.backupMobiusUris = [];
310
- _this.mobiusClusters = _this.webex.internal.services.getMobiusClusters();
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
+ }
311
331
  _this.mobiusHost = '';
312
332
  _this.registerSessionsListener();
313
333
  _this.registerCallsClearedListener();
@@ -529,72 +549,147 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
529
549
  value: (function () {
530
550
  var _getClientRegionInfo = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9() {
531
551
  var _this3 = this;
532
- var abort, regionInfo, _response$headers, _response$headers$tra, _response$headers2, response, clientRegionInfo;
533
- return _regenerator.default.wrap(function _callee9$(_context0) {
534
- while (1) switch (_context0.prev = _context0.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) {
535
555
  case 0:
536
556
  _Logger.default.info(_constants.METHOD_START_MESSAGE, {
537
557
  file: _constants2.CALLING_CLIENT_FILE,
538
558
  method: _constants2.METHODS.GET_CLIENT_REGION_INFO
539
559
  });
540
560
  regionInfo = {};
541
- _context0.prev = 2;
542
- _context0.next = 5;
543
- return this.webex.request({
544
- uri: "".concat(_constants2.DISCOVERY_URL),
545
- method: _types3.HTTP_METHODS.GET,
546
- addAuthHeader: false,
547
- headers: (0, _defineProperty2.default)({}, _constants2.SPARK_USER_AGENT, null)
548
- });
549
- case 5:
550
- response = _context0.sent;
551
- clientRegionInfo = response.body;
552
- regionInfo.clientRegion = (clientRegionInfo === null || clientRegionInfo === void 0 ? void 0 : clientRegionInfo.clientRegion) || '';
553
- regionInfo.countryCode = (clientRegionInfo === null || clientRegionInfo === void 0 ? void 0 : clientRegionInfo.countryCode) || '';
554
- _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), {
555
- file: _constants2.CALLING_CLIENT_FILE,
556
- method: _constants2.METHODS.GET_CLIENT_REGION_INFO
557
- });
558
- 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 : '');
559
- _context0.next = 25;
560
- break;
561
- case 13:
562
- _context0.prev = 13;
563
- _context0.t0 = _context0["catch"](2);
564
- _Logger.default.error("Failed to get client region info: ".concat((0, _stringify.default)(_context0.t0)), {
565
- method: _constants2.METHODS.GET_CLIENT_REGION_INFO,
566
- file: _constants2.CALLING_CLIENT_FILE
567
- });
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
+ });
568
609
 
569
- // eslint-disable-next-line no-await-in-loop
570
- _context0.next = 18;
571
- return (0, _Utils.handleCallingClientErrors)(_context0.t0, function (clientError) {
572
- var _headers$trackingId, _headers2;
573
- _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 = _context0.t0.headers) === null || _headers2 === void 0 ? void 0 : _headers2.trackingId) !== null && _headers$trackingId !== void 0 ? _headers$trackingId : '', undefined, clientError);
574
- _this3.emit(_types2.CALLING_CLIENT_EVENT_KEYS.ERROR, clientError);
575
- }, {
576
- method: _constants2.GET_MOBIUS_SERVERS_UTIL,
577
- file: _constants2.CALLING_CLIENT_FILE
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
+ });
621
+
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]]);
578
651
  });
579
- case 18:
580
- abort = _context0.sent;
581
- regionInfo.clientRegion = '';
582
- regionInfo.countryCode = '';
583
- if (!abort) {
584
- _context0.next = 25;
652
+ _iterator2.s();
653
+ case 6:
654
+ if ((_step2 = _iterator2.n()).done) {
655
+ _context1.next = 15;
585
656
  break;
586
657
  }
587
- _context0.next = 24;
588
- return (0, _Utils.uploadLogs)();
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;
669
+ break;
670
+ }
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);
589
688
  case 24:
590
- return _context0.abrupt("return", regionInfo);
591
- case 25:
592
- return _context0.abrupt("return", regionInfo);
593
- case 26:
594
689
  case "end":
595
- return _context0.stop();
690
+ return _context1.stop();
596
691
  }
597
- }, _callee9, this, [[2, 13]]);
692
+ }, _callee9, this, [[3, 17, 20, 23]]);
598
693
  }));
599
694
  function getClientRegionInfo() {
600
695
  return _getClientRegionInfo.apply(this, arguments);
@@ -614,7 +709,7 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
614
709
  _this$sdkConfig4,
615
710
  _this$sdkConfig4$disc,
616
711
  _this4 = this;
617
- var useDefault, clientRegion, countryCode, _this$sdkConfig5, _this$sdkConfig5$disc, _this$sdkConfig6, _this$sdkConfig6$disc, _this$webex$internal$, regionInfo, _iterator2, _step2, _loop2, _ret;
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;
618
713
  return _regenerator.default.wrap(function _callee0$(_context10) {
619
714
  while (1) switch (_context10.prev = _context10.next) {
620
715
  case 0:
@@ -640,7 +735,7 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
640
735
  });
641
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;
642
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;
643
- 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);
738
+ this.mobiusHost = this.webex.internal.services._serviceUrls.mobius;
644
739
  _context10.next = 15;
645
740
  break;
646
741
  case 9:
@@ -656,123 +751,74 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
656
751
  countryCode = regionInfo.countryCode;
657
752
  case 15:
658
753
  if (!(clientRegion && countryCode)) {
659
- _context10.next = 38;
754
+ _context10.next = 43;
660
755
  break;
661
756
  }
662
757
  _Logger.default.log("Found Region: ".concat(clientRegion, " and country: ").concat(countryCode, ", going to fetch Mobius server"), {
663
758
  file: _constants2.CALLING_CLIENT_FILE,
664
759
  method: _constants2.GET_MOBIUS_SERVERS_UTIL
665
760
  });
666
- _iterator2 = _createForOfIteratorHelper(this.mobiusClusters);
667
- _context10.prev = 18;
668
- _loop2 = /*#__PURE__*/_regenerator.default.mark(function _loop2() {
669
- var mobius, _response$headers3, _response$headers$tra2, _response$headers4, response, mobiusServers, mobiusUris, abort;
670
- return _regenerator.default.wrap(function _loop2$(_context1) {
671
- while (1) switch (_context1.prev = _context1.next) {
672
- case 0:
673
- mobius = _step2.value;
674
- if (mobius.host) {
675
- _this4.mobiusHost = "https://".concat(mobius.host).concat(_constants2.API_V1);
676
- } else {
677
- _this4.mobiusHost = mobius;
678
- }
679
- _context1.prev = 2;
680
- _context1.next = 5;
681
- return _this4.webex.request({
682
- uri: "".concat(_this4.mobiusHost).concat(_constants2.URL_ENDPOINT, "?regionCode=").concat(clientRegion, "&countryCode=").concat(countryCode),
683
- method: _types3.HTTP_METHODS.GET,
684
- headers: (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _constants2.CISCO_DEVICE_URL, _this4.webex.internal.device.url), _constants2.SPARK_USER_AGENT, _constants2.CALLING_USER_AGENT),
685
- service: _types3.ALLOWED_SERVICES.MOBIUS
686
- });
687
- case 5:
688
- response = _context1.sent;
689
- _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), {
690
- file: _constants2.CALLING_CLIENT_FILE,
691
- method: _constants2.GET_MOBIUS_SERVERS_UTIL
692
- });
693
- mobiusServers = response.body; // Metrics for mobius servers
694
- _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 : '');
695
-
696
- /* update arrays of Mobius Uris. */
697
- mobiusUris = (0, _Utils.filterMobiusUris)(mobiusServers, _this4.mobiusHost);
698
- _this4.primaryMobiusUris = mobiusUris.primary;
699
- _this4.backupMobiusUris = mobiusUris.backup;
700
- _Logger.default.log("Final list of Mobius Servers, primary: ".concat(mobiusUris.primary, " and backup: ").concat(mobiusUris.backup), {
701
- file: _constants2.CALLING_CLIENT_FILE,
702
- method: _constants2.GET_MOBIUS_SERVERS_UTIL
703
- });
704
- return _context1.abrupt("return", 0);
705
- case 16:
706
- _context1.prev = 16;
707
- _context1.t0 = _context1["catch"](2);
708
- _Logger.default.error("Failed to get Mobius servers: ".concat((0, _stringify.default)(_context1.t0)), {
709
- method: _constants2.METHODS.GET_MOBIUS_SERVERS,
710
- file: _constants2.CALLING_CLIENT_FILE
711
- });
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 : '');
712
777
 
713
- // eslint-disable-next-line no-await-in-loop
714
- _context1.next = 21;
715
- return (0, _Utils.handleCallingClientErrors)(_context1.t0, function (clientError) {
716
- var _headers$trackingId2, _headers4;
717
- _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 = _context1.t0.headers) === null || _headers4 === void 0 ? void 0 : _headers4.trackingId) !== null && _headers$trackingId2 !== void 0 ? _headers$trackingId2 : '', undefined, clientError);
718
- _this4.emit(_types2.CALLING_CLIENT_EVENT_KEYS.ERROR, clientError);
719
- }, {
720
- method: _constants2.GET_MOBIUS_SERVERS_UTIL,
721
- file: _constants2.CALLING_CLIENT_FILE
722
- });
723
- case 21:
724
- abort = _context1.sent;
725
- if (!abort) {
726
- _context1.next = 27;
727
- break;
728
- }
729
- useDefault = true;
730
- // eslint-disable-next-line no-await-in-loop
731
- _context1.next = 26;
732
- return (0, _Utils.uploadLogs)();
733
- case 26:
734
- return _context1.abrupt("return", 0);
735
- case 27:
736
- case "end":
737
- return _context1.stop();
738
- }
739
- }, _loop2, null, [[2, 16]]);
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
740
785
  });
741
- _iterator2.s();
742
- case 21:
743
- if ((_step2 = _iterator2.n()).done) {
744
- _context10.next = 28;
745
- break;
746
- }
747
- return _context10.delegateYield(_loop2(), "t0", 23);
748
- case 23:
749
- _ret = _context10.t0;
750
- if (!(_ret === 0)) {
751
- _context10.next = 26;
752
- break;
753
- }
754
- return _context10.abrupt("break", 28);
755
- case 26:
756
- _context10.next = 21;
757
- break;
758
- case 28:
759
- _context10.next = 33;
786
+ _context10.next = 41;
760
787
  break;
761
788
  case 30:
762
789
  _context10.prev = 30;
763
- _context10.t1 = _context10["catch"](18);
764
- _iterator2.e(_context10.t1);
765
- case 33:
766
- _context10.prev = 33;
767
- _iterator2.f();
768
- return _context10.finish(33);
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
804
+ });
769
805
  case 36:
770
- _context10.next = 39;
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:
814
+ useDefault = true;
815
+ case 41:
816
+ _context10.next = 44;
771
817
  break;
772
- case 38:
818
+ case 43:
773
819
  /* Setting this to true because region info is possibly undefined */
774
820
  useDefault = true;
775
- case 39:
821
+ case 44:
776
822
  /* Use a default URL if Mobius discovery fails either because of region info failure
777
823
  * or because the discovered Mobius couldn't be reached
778
824
  */
@@ -785,11 +831,11 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
785
831
  this.mobiusHost = "https://".concat(this.mobiusClusters[0].host).concat(_constants2.API_V1);
786
832
  this.primaryMobiusUris = ["".concat(this.mobiusHost).concat(_constants2.URL_ENDPOINT)];
787
833
  }
788
- case 40:
834
+ case 45:
789
835
  case "end":
790
836
  return _context10.stop();
791
837
  }
792
- }, _callee0, this, [[18, 30, 33, 36]]);
838
+ }, _callee0, this, [[17, 30]]);
793
839
  }));
794
840
  function getMobiusServers() {
795
841
  return _getMobiusServers.apply(this, arguments);