@webex/calling 3.8.1 → 3.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CallSettings/WxCallBackendConnector.js +2 -2
- package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.test.js +94 -27
- package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -1
- package/dist/CallSettings/types.js.map +1 -1
- package/dist/CallingClient/CallingClient.js +160 -105
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +168 -102
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/constants.js +3 -3
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/line/line.test.js +4 -10
- package/dist/CallingClient/line/line.test.js.map +1 -1
- package/dist/CallingClient/registration/register.js +486 -380
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +441 -309
- package/dist/CallingClient/registration/register.test.js.map +1 -1
- package/dist/CallingClient/registration/types.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.js +115 -0
- package/dist/CallingClient/registration/webWorker.js.map +1 -0
- package/dist/CallingClient/registration/webWorker.test.js +256 -0
- package/dist/CallingClient/registration/webWorker.test.js.map +1 -0
- package/dist/CallingClient/registration/webWorkerStr.js +15 -0
- package/dist/CallingClient/registration/webWorkerStr.js.map +1 -0
- package/dist/Errors/types.js +2 -0
- package/dist/Errors/types.js.map +1 -1
- package/dist/Metrics/index.js +9 -2
- package/dist/Metrics/index.js.map +1 -1
- package/dist/Metrics/index.test.js +10 -4
- package/dist/Metrics/index.test.js.map +1 -1
- package/dist/Metrics/types.js.map +1 -1
- package/dist/common/Utils.js +41 -34
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +265 -119
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/common/types.js +8 -1
- package/dist/common/types.js.map +1 -1
- package/dist/module/CallSettings/WxCallBackendConnector.js +1 -1
- package/dist/module/CallingClient/CallingClient.js +25 -10
- package/dist/module/CallingClient/constants.js +2 -2
- package/dist/module/CallingClient/registration/register.js +101 -65
- package/dist/module/CallingClient/registration/webWorker.js +59 -0
- package/dist/module/CallingClient/registration/webWorkerStr.js +93 -0
- package/dist/module/Errors/types.js +2 -0
- package/dist/module/Metrics/index.js +8 -1
- package/dist/module/common/Utils.js +10 -2
- package/dist/module/common/types.js +7 -0
- package/dist/types/CallSettings/types.d.ts +1 -1
- package/dist/types/CallSettings/types.d.ts.map +1 -1
- package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
- package/dist/types/CallingClient/constants.d.ts +2 -2
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +2 -2
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/webWorker.d.ts +2 -0
- package/dist/types/CallingClient/registration/webWorker.d.ts.map +1 -0
- package/dist/types/CallingClient/registration/webWorkerStr.d.ts +3 -0
- package/dist/types/CallingClient/registration/webWorkerStr.d.ts.map +1 -0
- package/dist/types/Errors/types.d.ts +2 -0
- package/dist/types/Errors/types.d.ts.map +1 -1
- package/dist/types/Metrics/index.d.ts.map +1 -1
- package/dist/types/Metrics/types.d.ts +2 -1
- package/dist/types/Metrics/types.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/types.d.ts +12 -0
- package/dist/types/common/types.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -10,11 +10,11 @@ var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/defi
|
|
|
10
10
|
var _WeakMap = require("@babel/runtime-corejs2/core-js/weak-map");
|
|
11
11
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
12
12
|
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
|
|
13
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
14
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
|
|
13
15
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
14
16
|
var _values = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/values"));
|
|
15
17
|
var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
|
|
16
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
|
|
17
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
18
18
|
var _asyncMutex = require("async-mutex");
|
|
19
19
|
var Media = _interopRequireWildcard(require("@webex/internal-media-core"));
|
|
20
20
|
var _types = require("../Logger/types");
|
|
@@ -41,15 +41,6 @@ global.crypto = {
|
|
|
41
41
|
return '12345678-1234-5678-1234-567812345678';
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
|
-
jest.mock('../common/Utils', function () {
|
|
45
|
-
var originalModule = jest.requireActual('../common/Utils');
|
|
46
|
-
return _objectSpread(_objectSpread({}, originalModule), {}, {
|
|
47
|
-
uploadLogs: jest.fn().mockImplementation(function () {
|
|
48
|
-
return _promise.default.resolve(undefined);
|
|
49
|
-
}),
|
|
50
|
-
handleCallingClientErrors: jest.fn()
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
44
|
jest.spyOn(utils, 'uploadLogs').mockResolvedValue(undefined);
|
|
54
45
|
describe('CallingClient Tests', function () {
|
|
55
46
|
// Common initializers
|
|
@@ -481,7 +472,7 @@ describe('CallingClient Tests', function () {
|
|
|
481
472
|
failurePayload = {
|
|
482
473
|
statusCode: 500
|
|
483
474
|
};
|
|
484
|
-
webex.request.
|
|
475
|
+
webex.request.mockRejectedValue(failurePayload);
|
|
485
476
|
_context16.next = 4;
|
|
486
477
|
return (0, _CallingClient.createClient)(webex, {
|
|
487
478
|
logger: {
|
|
@@ -518,15 +509,15 @@ describe('CallingClient Tests', function () {
|
|
|
518
509
|
}
|
|
519
510
|
}, _callee16);
|
|
520
511
|
})));
|
|
521
|
-
it('when
|
|
512
|
+
it('case when /myIP failed with 401', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17() {
|
|
522
513
|
var failurePayload;
|
|
523
514
|
return _regenerator.default.wrap(function _callee17$(_context17) {
|
|
524
515
|
while (1) switch (_context17.prev = _context17.next) {
|
|
525
516
|
case 0:
|
|
526
517
|
failurePayload = {
|
|
527
|
-
statusCode:
|
|
518
|
+
statusCode: 401
|
|
528
519
|
};
|
|
529
|
-
webex.request.
|
|
520
|
+
webex.request.mockRejectedValueOnce(failurePayload);
|
|
530
521
|
_context17.next = 4;
|
|
531
522
|
return (0, _CallingClient.createClient)(webex, {
|
|
532
523
|
logger: {
|
|
@@ -535,6 +526,39 @@ describe('CallingClient Tests', function () {
|
|
|
535
526
|
});
|
|
536
527
|
case 4:
|
|
537
528
|
callingClient = _context17.sent;
|
|
529
|
+
expect(webex.request).toBeCalledOnceWith(_objectSpread(_objectSpread({}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
530
|
+
uri: 'https://mobius-us-east-1.prod.infra.webex.com/api/v1/calling/web/myip',
|
|
531
|
+
method: 'GET'
|
|
532
|
+
}));
|
|
533
|
+
expect(handleErrorSpy).toBeCalledOnceWith(failurePayload, expect.anything(), {
|
|
534
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
535
|
+
method: 'getMobiusServers'
|
|
536
|
+
});
|
|
537
|
+
expect(callingClient.primaryMobiusUris).toEqual(["".concat(callingClient['mobiusHost']).concat(_constants.URL_ENDPOINT)]);
|
|
538
|
+
expect(warnSpy).toBeCalledWith("Couldn't resolve the region and country code. Defaulting to the catalog entries to discover mobius servers", '');
|
|
539
|
+
case 9:
|
|
540
|
+
case "end":
|
|
541
|
+
return _context17.stop();
|
|
542
|
+
}
|
|
543
|
+
}, _callee17);
|
|
544
|
+
})));
|
|
545
|
+
it('when region discovery succeeds but region based mobius url discovery fails', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18() {
|
|
546
|
+
var failurePayload;
|
|
547
|
+
return _regenerator.default.wrap(function _callee18$(_context18) {
|
|
548
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
549
|
+
case 0:
|
|
550
|
+
failurePayload = {
|
|
551
|
+
statusCode: 500
|
|
552
|
+
};
|
|
553
|
+
webex.request.mockResolvedValueOnce(_callingClientFixtures.ipPayload).mockResolvedValueOnce(_callingClientFixtures.regionPayload).mockRejectedValueOnce(failurePayload);
|
|
554
|
+
_context18.next = 4;
|
|
555
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
556
|
+
logger: {
|
|
557
|
+
level: _types.LOGGER.INFO
|
|
558
|
+
}
|
|
559
|
+
});
|
|
560
|
+
case 4:
|
|
561
|
+
callingClient = _context18.sent;
|
|
538
562
|
expect(handleErrorSpy).toBeCalledWith(failurePayload, expect.anything(), {
|
|
539
563
|
file: _constants.CALLING_CLIENT_FILE,
|
|
540
564
|
method: 'getMobiusServers'
|
|
@@ -555,19 +579,59 @@ describe('CallingClient Tests', function () {
|
|
|
555
579
|
expect(warnSpy).toBeCalledWith("Couldn't resolve the region and country code. Defaulting to the catalog entries to discover mobius servers", '');
|
|
556
580
|
case 11:
|
|
557
581
|
case "end":
|
|
558
|
-
return
|
|
582
|
+
return _context18.stop();
|
|
559
583
|
}
|
|
560
|
-
},
|
|
584
|
+
}, _callee18);
|
|
585
|
+
})));
|
|
586
|
+
it('case when discovery failed with 401', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19() {
|
|
587
|
+
var failurePayload;
|
|
588
|
+
return _regenerator.default.wrap(function _callee19$(_context19) {
|
|
589
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
590
|
+
case 0:
|
|
591
|
+
failurePayload = {
|
|
592
|
+
statusCode: 401
|
|
593
|
+
};
|
|
594
|
+
webex.request.mockResolvedValueOnce(_callingClientFixtures.ipPayload).mockRejectedValueOnce(failurePayload);
|
|
595
|
+
_context19.next = 4;
|
|
596
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
597
|
+
logger: {
|
|
598
|
+
level: _types.LOGGER.INFO
|
|
599
|
+
}
|
|
600
|
+
});
|
|
601
|
+
case 4:
|
|
602
|
+
callingClient = _context19.sent;
|
|
603
|
+
expect(webex.request).toBeCalledTimes(2);
|
|
604
|
+
expect(webex.request).nthCalledWith(1, _objectSpread(_objectSpread({}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
605
|
+
uri: 'https://mobius-us-east-1.prod.infra.webex.com/api/v1/calling/web/myip',
|
|
606
|
+
method: 'GET'
|
|
607
|
+
}));
|
|
608
|
+
expect(webex.request).nthCalledWith(2, {
|
|
609
|
+
method: 'GET',
|
|
610
|
+
uri: "".concat(_constants.DISCOVERY_URL, "/").concat(_callingClientFixtures.myIP),
|
|
611
|
+
addAuthHeader: false,
|
|
612
|
+
headers: (0, _defineProperty2.default)({}, _constants.SPARK_USER_AGENT, null)
|
|
613
|
+
});
|
|
614
|
+
expect(handleErrorSpy).toBeCalledOnceWith(failurePayload, expect.anything(), {
|
|
615
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
616
|
+
method: 'getMobiusServers'
|
|
617
|
+
});
|
|
618
|
+
expect(callingClient.primaryMobiusUris).toEqual(["".concat(callingClient['mobiusHost']).concat(_constants.URL_ENDPOINT)]);
|
|
619
|
+
expect(warnSpy).toBeCalledWith("Couldn't resolve the region and country code. Defaulting to the catalog entries to discover mobius servers", '');
|
|
620
|
+
case 11:
|
|
621
|
+
case "end":
|
|
622
|
+
return _context19.stop();
|
|
623
|
+
}
|
|
624
|
+
}, _callee19);
|
|
561
625
|
})));
|
|
562
|
-
it('Verify successful mobius server url discovery after initializing callingClient through a config', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
626
|
+
it('Verify successful mobius server url discovery after initializing callingClient through a config', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20() {
|
|
563
627
|
var infoSpy;
|
|
564
|
-
return _regenerator.default.wrap(function
|
|
565
|
-
while (1) switch (
|
|
628
|
+
return _regenerator.default.wrap(function _callee20$(_context20) {
|
|
629
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
566
630
|
case 0:
|
|
567
631
|
infoSpy = jest.spyOn(_Logger.default, 'info');
|
|
568
632
|
infoSpy.mockReset();
|
|
569
633
|
webex.request.mockResolvedValueOnce(_callingClientFixtures.discoveryPayload);
|
|
570
|
-
|
|
634
|
+
_context20.next = 5;
|
|
571
635
|
return (0, _CallingClient.createClient)(webex, {
|
|
572
636
|
discovery: {
|
|
573
637
|
region: 'AP-SOUTHEAST',
|
|
@@ -578,7 +642,7 @@ describe('CallingClient Tests', function () {
|
|
|
578
642
|
}
|
|
579
643
|
});
|
|
580
644
|
case 5:
|
|
581
|
-
callingClient =
|
|
645
|
+
callingClient = _context20.sent;
|
|
582
646
|
expect(callingClient.primaryMobiusUris).toEqual([_callingClientFixtures.primaryUrl]);
|
|
583
647
|
expect(infoSpy).toHaveBeenCalledWith(_constants2.METHOD_START_MESSAGE, {
|
|
584
648
|
file: 'CallingClient',
|
|
@@ -591,66 +655,66 @@ describe('CallingClient Tests', function () {
|
|
|
591
655
|
expect(handleErrorSpy).not.toHaveBeenCalled();
|
|
592
656
|
case 10:
|
|
593
657
|
case "end":
|
|
594
|
-
return
|
|
658
|
+
return _context20.stop();
|
|
595
659
|
}
|
|
596
|
-
},
|
|
660
|
+
}, _callee20);
|
|
597
661
|
})));
|
|
598
662
|
});
|
|
599
663
|
describe('Testing each cluster present withing host catalog', function () {
|
|
600
664
|
var mobiusCluster = ['mobius-eu-central-1.prod.infra.webex.com', 'mobius-us-east-1.int.infra.webex.com', 'mobius-eu-central-1.int.infra.webex.com'];
|
|
601
665
|
var checkCluster = /*#__PURE__*/function () {
|
|
602
|
-
var
|
|
666
|
+
var _ref21 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21(mockServiceHosts, mockCatalog) {
|
|
603
667
|
var callingClient;
|
|
604
|
-
return _regenerator.default.wrap(function
|
|
605
|
-
while (1) switch (
|
|
668
|
+
return _regenerator.default.wrap(function _callee21$(_context21) {
|
|
669
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
606
670
|
case 0:
|
|
607
671
|
webex.internal.services._hostCatalog = mockCatalog;
|
|
608
|
-
|
|
672
|
+
_context21.next = 3;
|
|
609
673
|
return (0, _CallingClient.createClient)(webex, {
|
|
610
674
|
logger: {
|
|
611
675
|
level: _types.LOGGER.INFO
|
|
612
676
|
}
|
|
613
677
|
});
|
|
614
678
|
case 3:
|
|
615
|
-
callingClient =
|
|
679
|
+
callingClient = _context21.sent;
|
|
616
680
|
expect(callingClient['mobiusClusters']).toStrictEqual(mockServiceHosts);
|
|
617
681
|
case 5:
|
|
618
682
|
case "end":
|
|
619
|
-
return
|
|
683
|
+
return _context21.stop();
|
|
620
684
|
}
|
|
621
|
-
},
|
|
685
|
+
}, _callee21);
|
|
622
686
|
}));
|
|
623
687
|
return function checkCluster(_x, _x2) {
|
|
624
|
-
return
|
|
688
|
+
return _ref21.apply(this, arguments);
|
|
625
689
|
};
|
|
626
690
|
}();
|
|
627
691
|
it.each(mobiusCluster)('%s', /*#__PURE__*/function () {
|
|
628
|
-
var
|
|
629
|
-
return _regenerator.default.wrap(function
|
|
630
|
-
while (1) switch (
|
|
692
|
+
var _ref22 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee22(clusterName) {
|
|
693
|
+
return _regenerator.default.wrap(function _callee22$(_context22) {
|
|
694
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
631
695
|
case 0:
|
|
632
|
-
|
|
633
|
-
|
|
696
|
+
_context22.t0 = clusterName;
|
|
697
|
+
_context22.next = _context22.t0 === 'mobius-eu-central-1.prod.infra.webex.com' ? 3 : _context22.t0 === 'mobius-us-east-1.int.infra.webex.com' ? 5 : _context22.t0 === 'mobius-eu-central-1.int.infra.webex.com' ? 7 : 9;
|
|
634
698
|
break;
|
|
635
699
|
case 3:
|
|
636
700
|
checkCluster(_callingClientFixtures.mockEUServiceHosts, _callingClientFixtures.mockCatalogEU);
|
|
637
|
-
return
|
|
701
|
+
return _context22.abrupt("break", 10);
|
|
638
702
|
case 5:
|
|
639
703
|
checkCluster(_callingClientFixtures.mockIntServiceHosts, _callingClientFixtures.mockCatalogUSInt);
|
|
640
|
-
return
|
|
704
|
+
return _context22.abrupt("break", 10);
|
|
641
705
|
case 7:
|
|
642
706
|
checkCluster(_callingClientFixtures.mockEUIntServiceHosts, _callingClientFixtures.mockCatalogEUInt);
|
|
643
|
-
return
|
|
707
|
+
return _context22.abrupt("break", 10);
|
|
644
708
|
case 9:
|
|
645
|
-
return
|
|
709
|
+
return _context22.abrupt("break", 10);
|
|
646
710
|
case 10:
|
|
647
711
|
case "end":
|
|
648
|
-
return
|
|
712
|
+
return _context22.stop();
|
|
649
713
|
}
|
|
650
|
-
},
|
|
714
|
+
}, _callee22);
|
|
651
715
|
}));
|
|
652
716
|
return function (_x3) {
|
|
653
|
-
return
|
|
717
|
+
return _ref22.apply(this, arguments);
|
|
654
718
|
};
|
|
655
719
|
}());
|
|
656
720
|
});
|
|
@@ -663,23 +727,23 @@ describe('CallingClient Tests', function () {
|
|
|
663
727
|
var deRegSpy;
|
|
664
728
|
var restartRegisterSpy;
|
|
665
729
|
var registerSpy;
|
|
666
|
-
beforeEach( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
667
|
-
return _regenerator.default.wrap(function
|
|
668
|
-
while (1) switch (
|
|
730
|
+
beforeEach( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee23() {
|
|
731
|
+
return _regenerator.default.wrap(function _callee23$(_context23) {
|
|
732
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
669
733
|
case 0:
|
|
670
734
|
jest.useFakeTimers();
|
|
671
735
|
webex.request.mockResolvedValueOnce(_callingClientFixtures.ipPayload).mockResolvedValueOnce(_callingClientFixtures.regionPayload).mockResolvedValueOnce(_callingClientFixtures.discoveryPayload).mockResolvedValueOnce(_callingClientFixtures.registrationPayload);
|
|
672
|
-
|
|
736
|
+
_context23.next = 4;
|
|
673
737
|
return (0, _CallingClient.createClient)(webex, {
|
|
674
738
|
logger: {
|
|
675
739
|
level: _types.LOGGER.INFO
|
|
676
740
|
}
|
|
677
741
|
});
|
|
678
742
|
case 4:
|
|
679
|
-
callingClient =
|
|
743
|
+
callingClient = _context23.sent;
|
|
680
744
|
line = (0, _values.default)(callingClient.lineDict)[0];
|
|
681
745
|
reg = line.registration;
|
|
682
|
-
|
|
746
|
+
_context23.next = 9;
|
|
683
747
|
return line.register();
|
|
684
748
|
case 9:
|
|
685
749
|
deRegSpy = jest.spyOn(line.registration, 'deregister');
|
|
@@ -688,9 +752,9 @@ describe('CallingClient Tests', function () {
|
|
|
688
752
|
registerSpy = jest.spyOn(reg, 'attemptRegistrationWithServers');
|
|
689
753
|
case 13:
|
|
690
754
|
case "end":
|
|
691
|
-
return
|
|
755
|
+
return _context23.stop();
|
|
692
756
|
}
|
|
693
|
-
},
|
|
757
|
+
}, _callee23);
|
|
694
758
|
})));
|
|
695
759
|
afterEach(function () {
|
|
696
760
|
jest.clearAllTimers();
|
|
@@ -700,10 +764,11 @@ describe('CallingClient Tests', function () {
|
|
|
700
764
|
callingClient = undefined;
|
|
701
765
|
jest.useRealTimers();
|
|
702
766
|
});
|
|
703
|
-
it('detect a network flap in mercury connection', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
704
|
-
return _regenerator.default.wrap(function
|
|
705
|
-
while (1) switch (
|
|
767
|
+
it('detect a network flap in mercury connection', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee24() {
|
|
768
|
+
return _regenerator.default.wrap(function _callee24$(_context24) {
|
|
769
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
706
770
|
case 0:
|
|
771
|
+
warnSpy.mockClear();
|
|
707
772
|
expect(line.getStatus()).toEqual(_types2.RegistrationStatus.ACTIVE);
|
|
708
773
|
|
|
709
774
|
/* Set mercury connection to be down and execute a delay of 2.5 seconds */
|
|
@@ -720,9 +785,9 @@ describe('CallingClient Tests', function () {
|
|
|
720
785
|
webex.internal.mercury.connected = true;
|
|
721
786
|
logSpy.mockReset();
|
|
722
787
|
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 500);
|
|
723
|
-
|
|
788
|
+
_context24.next = 10;
|
|
724
789
|
return flushPromises();
|
|
725
|
-
case
|
|
790
|
+
case 10:
|
|
726
791
|
_Logger.default.info('Mercury connection is up again, re-registering with Webex Calling if needed', {
|
|
727
792
|
file: _constants.REGISTRATION_FILE,
|
|
728
793
|
method: 'handleConnectionRestoration'
|
|
@@ -738,16 +803,16 @@ describe('CallingClient Tests', function () {
|
|
|
738
803
|
expect(webex.request).toHaveBeenCalledTimes(6);
|
|
739
804
|
expect(registerSpy).toHaveBeenCalledWith('handleConnectionRestoration', [reg.getActiveMobiusUrl()]);
|
|
740
805
|
expect(registerSpy).toHaveBeenCalledWith('handleConnectionRestoration', [_callingClientFixtures.primaryUrl]);
|
|
741
|
-
case
|
|
806
|
+
case 17:
|
|
742
807
|
case "end":
|
|
743
|
-
return
|
|
808
|
+
return _context24.stop();
|
|
744
809
|
}
|
|
745
|
-
},
|
|
810
|
+
}, _callee24);
|
|
746
811
|
})));
|
|
747
|
-
it('Simulate a network flap with no active calls and re-verify registration: Restore Failure', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
812
|
+
it('Simulate a network flap with no active calls and re-verify registration: Restore Failure', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee25() {
|
|
748
813
|
var failurePayload, mockRegistrationBody, successPayload;
|
|
749
|
-
return _regenerator.default.wrap(function
|
|
750
|
-
while (1) switch (
|
|
814
|
+
return _regenerator.default.wrap(function _callee25$(_context25) {
|
|
815
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
751
816
|
case 0:
|
|
752
817
|
expect(line.getStatus()).toEqual(_types2.RegistrationStatus.ACTIVE);
|
|
753
818
|
failurePayload = {
|
|
@@ -775,7 +840,7 @@ describe('CallingClient Tests', function () {
|
|
|
775
840
|
webex.internal.mercury.connected = true;
|
|
776
841
|
logSpy.mockReset();
|
|
777
842
|
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 500);
|
|
778
|
-
|
|
843
|
+
_context25.next = 13;
|
|
779
844
|
return flushPromises();
|
|
780
845
|
case 13:
|
|
781
846
|
_Logger.default.info('Mercury connection is up again, re-registering with Webex Calling if needed', {
|
|
@@ -795,15 +860,16 @@ describe('CallingClient Tests', function () {
|
|
|
795
860
|
expect(registerSpy).toHaveBeenCalledWith('handleConnectionRestoration', [_callingClientFixtures.primaryUrl]);
|
|
796
861
|
case 20:
|
|
797
862
|
case "end":
|
|
798
|
-
return
|
|
863
|
+
return _context25.stop();
|
|
799
864
|
}
|
|
800
|
-
},
|
|
865
|
+
}, _callee25);
|
|
801
866
|
})));
|
|
802
|
-
it('Simulate a network flap before initial registration is done', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
867
|
+
it('Simulate a network flap before initial registration is done', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee26() {
|
|
803
868
|
var handleConnectionRestoreSpy;
|
|
804
|
-
return _regenerator.default.wrap(function
|
|
805
|
-
while (1) switch (
|
|
869
|
+
return _regenerator.default.wrap(function _callee26$(_context26) {
|
|
870
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
806
871
|
case 0:
|
|
872
|
+
warnSpy.mockClear();
|
|
807
873
|
handleConnectionRestoreSpy = jest.spyOn(reg, 'handleConnectionRestoration');
|
|
808
874
|
reg.setStatus(_types2.RegistrationStatus.IDLE);
|
|
809
875
|
|
|
@@ -820,9 +886,9 @@ describe('CallingClient Tests', function () {
|
|
|
820
886
|
/* Set mercury connection to be up and execute a delay of 2.5 seconds */
|
|
821
887
|
webex.internal.mercury.connected = true;
|
|
822
888
|
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 500);
|
|
823
|
-
|
|
889
|
+
_context26.next = 10;
|
|
824
890
|
return flushPromises();
|
|
825
|
-
case
|
|
891
|
+
case 10:
|
|
826
892
|
/* We should be detecting the network recovery */
|
|
827
893
|
expect(logSpy).not.toBeCalledWith('Mercury connection is up again, re-registering with Webex Calling if needed', {
|
|
828
894
|
file: _constants.REGISTRATION_FILE,
|
|
@@ -834,15 +900,15 @@ describe('CallingClient Tests', function () {
|
|
|
834
900
|
* will not trigger de-registration/registration
|
|
835
901
|
*/
|
|
836
902
|
expect(handleConnectionRestoreSpy).not.toBeCalledOnceWith();
|
|
837
|
-
case
|
|
903
|
+
case 12:
|
|
838
904
|
case "end":
|
|
839
|
-
return
|
|
905
|
+
return _context26.stop();
|
|
840
906
|
}
|
|
841
|
-
},
|
|
907
|
+
}, _callee26);
|
|
842
908
|
})));
|
|
843
|
-
it('Simulate a network flap with 1 active call', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
844
|
-
return _regenerator.default.wrap(function
|
|
845
|
-
while (1) switch (
|
|
909
|
+
it('Simulate a network flap with 1 active call', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee27() {
|
|
910
|
+
return _regenerator.default.wrap(function _callee27$(_context27) {
|
|
911
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
846
912
|
case 0:
|
|
847
913
|
expect(line.getStatus()).toEqual(_types2.RegistrationStatus.ACTIVE);
|
|
848
914
|
|
|
@@ -853,7 +919,7 @@ describe('CallingClient Tests', function () {
|
|
|
853
919
|
/* Set mercury connection to be down and execute a delay of 2.5 seconds */
|
|
854
920
|
webex.internal.mercury.connected = false;
|
|
855
921
|
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 500);
|
|
856
|
-
|
|
922
|
+
_context27.next = 7;
|
|
857
923
|
return flushPromises();
|
|
858
924
|
case 7:
|
|
859
925
|
/* We should be detecting the network flap */
|
|
@@ -865,7 +931,7 @@ describe('CallingClient Tests', function () {
|
|
|
865
931
|
/* Set mercury connection to be up and execute a delay of 2.5 seconds */
|
|
866
932
|
webex.internal.mercury.connected = true;
|
|
867
933
|
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 500);
|
|
868
|
-
|
|
934
|
+
_context27.next = 12;
|
|
869
935
|
return flushPromises();
|
|
870
936
|
case 12:
|
|
871
937
|
/* We should be detecting the network recovery */
|
|
@@ -876,28 +942,28 @@ describe('CallingClient Tests', function () {
|
|
|
876
942
|
expect(registerSpy).not.toBeCalledWith(true);
|
|
877
943
|
case 14:
|
|
878
944
|
case "end":
|
|
879
|
-
return
|
|
945
|
+
return _context27.stop();
|
|
880
946
|
}
|
|
881
|
-
},
|
|
947
|
+
}, _callee27);
|
|
882
948
|
})));
|
|
883
949
|
});
|
|
884
950
|
describe('Line creation tests', function () {
|
|
885
951
|
var callingClient;
|
|
886
952
|
var line;
|
|
887
|
-
beforeEach( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
888
|
-
return _regenerator.default.wrap(function
|
|
889
|
-
while (1) switch (
|
|
953
|
+
beforeEach( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee28() {
|
|
954
|
+
return _regenerator.default.wrap(function _callee28$(_context28) {
|
|
955
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
890
956
|
case 0:
|
|
891
|
-
|
|
957
|
+
_context28.next = 2;
|
|
892
958
|
return (0, _CallingClient.createClient)(webex);
|
|
893
959
|
case 2:
|
|
894
|
-
callingClient =
|
|
960
|
+
callingClient = _context28.sent;
|
|
895
961
|
line = (0, _values.default)(callingClient.lineDict)[0];
|
|
896
962
|
case 4:
|
|
897
963
|
case "end":
|
|
898
|
-
return
|
|
964
|
+
return _context28.stop();
|
|
899
965
|
}
|
|
900
|
-
},
|
|
966
|
+
}, _callee28);
|
|
901
967
|
})));
|
|
902
968
|
afterEach(function () {
|
|
903
969
|
jest.clearAllTimers();
|
|
@@ -932,15 +998,15 @@ describe('CallingClient Tests', function () {
|
|
|
932
998
|
});
|
|
933
999
|
var callingClient;
|
|
934
1000
|
var line;
|
|
935
|
-
beforeAll( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1001
|
+
beforeAll( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee29() {
|
|
936
1002
|
var calls;
|
|
937
|
-
return _regenerator.default.wrap(function
|
|
938
|
-
while (1) switch (
|
|
1003
|
+
return _regenerator.default.wrap(function _callee29$(_context29) {
|
|
1004
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
939
1005
|
case 0:
|
|
940
|
-
|
|
1006
|
+
_context29.next = 2;
|
|
941
1007
|
return (0, _CallingClient.createClient)(webex);
|
|
942
1008
|
case 2:
|
|
943
|
-
callingClient =
|
|
1009
|
+
callingClient = _context29.sent;
|
|
944
1010
|
line = new _line.default(userId, clientDeviceUri, mutex, primaryMobiusUris(), backupMobiusUris(), _types.LOGGER.INFO);
|
|
945
1011
|
calls = (0, _values.default)(callManager.getActiveCalls());
|
|
946
1012
|
calls.forEach(function (call) {
|
|
@@ -948,9 +1014,9 @@ describe('CallingClient Tests', function () {
|
|
|
948
1014
|
});
|
|
949
1015
|
case 6:
|
|
950
1016
|
case "end":
|
|
951
|
-
return
|
|
1017
|
+
return _context29.stop();
|
|
952
1018
|
}
|
|
953
|
-
},
|
|
1019
|
+
}, _callee29);
|
|
954
1020
|
})));
|
|
955
1021
|
afterAll(function () {
|
|
956
1022
|
callingClient.removeAllListeners();
|
|
@@ -1033,23 +1099,23 @@ describe('CallingClient Tests', function () {
|
|
|
1033
1099
|
describe('Call Session Event test', function () {
|
|
1034
1100
|
var mockOn = webex.internal.mercury.on;
|
|
1035
1101
|
var callingClient;
|
|
1036
|
-
beforeEach( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1037
|
-
return _regenerator.default.wrap(function
|
|
1038
|
-
while (1) switch (
|
|
1102
|
+
beforeEach( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee30() {
|
|
1103
|
+
return _regenerator.default.wrap(function _callee30$(_context30) {
|
|
1104
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
1039
1105
|
case 0:
|
|
1040
|
-
|
|
1106
|
+
_context30.next = 2;
|
|
1041
1107
|
return (0, _CallingClient.createClient)(webex, {
|
|
1042
1108
|
logger: {
|
|
1043
1109
|
level: _types.LOGGER.INFO
|
|
1044
1110
|
}
|
|
1045
1111
|
});
|
|
1046
1112
|
case 2:
|
|
1047
|
-
callingClient =
|
|
1113
|
+
callingClient = _context30.sent;
|
|
1048
1114
|
case 3:
|
|
1049
1115
|
case "end":
|
|
1050
|
-
return
|
|
1116
|
+
return _context30.stop();
|
|
1051
1117
|
}
|
|
1052
|
-
},
|
|
1118
|
+
}, _callee30);
|
|
1053
1119
|
})));
|
|
1054
1120
|
afterEach(function () {
|
|
1055
1121
|
callingClient.removeAllListeners();
|