@webex/calling 3.0.0-next.2 → 3.0.0-next.21
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/CHANGELOG.md +1403 -0
- package/dist/CallHistory/CallHistory.js +1 -3
- package/dist/CallHistory/CallHistory.js.map +1 -1
- package/dist/CallHistory/callHistoryFixtures.js +9 -0
- package/dist/CallHistory/callHistoryFixtures.js.map +1 -1
- package/dist/CallHistory/types.js.map +1 -1
- package/dist/CallSettings/CallSettings.js +0 -2
- package/dist/CallSettings/CallSettings.js.map +1 -1
- package/dist/CallSettings/types.js.map +1 -1
- package/dist/CallingClient/CallingClient.js +119 -62
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +161 -102
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.js +3 -23
- package/dist/CallingClient/calling/CallerId/index.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/types.js.map +1 -1
- package/dist/CallingClient/calling/call.js +78 -33
- package/dist/CallingClient/calling/call.js.map +1 -1
- package/dist/CallingClient/calling/call.test.js +483 -351
- package/dist/CallingClient/calling/call.test.js.map +1 -1
- package/dist/CallingClient/calling/callManager.js +0 -9
- package/dist/CallingClient/calling/callManager.js.map +1 -1
- package/dist/CallingClient/calling/callManager.test.js +1 -1
- package/dist/CallingClient/calling/callManager.test.js.map +1 -1
- package/dist/CallingClient/calling/types.js.map +1 -1
- package/dist/CallingClient/callingClientFixtures.js +107 -1
- package/dist/CallingClient/callingClientFixtures.js.map +1 -1
- package/dist/CallingClient/constants.js +14 -6
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/line/index.js +12 -12
- package/dist/CallingClient/line/index.js.map +1 -1
- package/dist/CallingClient/line/line.test.js +9 -9
- package/dist/CallingClient/line/line.test.js.map +1 -1
- package/dist/CallingClient/line/types.js +4 -7
- package/dist/CallingClient/line/types.js.map +1 -1
- package/dist/CallingClient/registration/register.js +62 -80
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +28 -28
- package/dist/CallingClient/registration/register.test.js.map +1 -1
- package/dist/CallingClient/registration/types.js.map +1 -1
- package/dist/CallingClient/types.js.map +1 -1
- package/dist/Contacts/ContactsClient.js +8 -2
- package/dist/Contacts/ContactsClient.js.map +1 -1
- package/dist/Contacts/types.js +3 -0
- package/dist/Contacts/types.js.map +1 -1
- package/dist/Errors/catalog/CallingDeviceError.js +1 -1
- package/dist/Errors/catalog/CallingDeviceError.js.map +1 -1
- package/dist/Errors/catalog/LineError.js +2 -2
- package/dist/Errors/catalog/LineError.js.map +1 -1
- package/dist/Errors/index.js +7 -0
- package/dist/Errors/index.js.map +1 -1
- package/dist/Errors/types.js.map +1 -1
- package/dist/Events/types.js +0 -1
- package/dist/Events/types.js.map +1 -1
- package/dist/Metrics/index.test.js +1 -1
- package/dist/Metrics/index.test.js.map +1 -1
- package/dist/SDKConnector/types.js.map +1 -1
- package/dist/Voicemail/Voicemail.js +18 -21
- package/dist/Voicemail/Voicemail.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.js +1 -1
- package/dist/Voicemail/WxCallBackendConnector.js.map +1 -1
- package/dist/Voicemail/types.js.map +1 -1
- package/dist/api.js +43 -20
- package/dist/api.js.map +1 -1
- package/dist/common/Utils.js +13 -18
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +1 -1
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/common/testUtil.js +2 -1
- package/dist/common/testUtil.js.map +1 -1
- package/dist/common/types.js +8 -7
- package/dist/common/types.js.map +1 -1
- package/dist/index.js +233 -0
- package/dist/index.js.map +1 -1
- package/dist/module/CallHistory/callHistoryFixtures.js +9 -0
- package/dist/module/CallingClient/CallingClient.js +59 -42
- package/dist/module/CallingClient/calling/CallerId/index.js +3 -23
- package/dist/module/CallingClient/calling/call.js +54 -17
- package/dist/module/CallingClient/calling/callManager.js +0 -6
- package/dist/module/CallingClient/callingClientFixtures.js +119 -1
- package/dist/module/CallingClient/constants.js +8 -4
- package/dist/module/CallingClient/line/index.js +7 -10
- package/dist/module/CallingClient/line/types.js +0 -5
- package/dist/module/CallingClient/registration/register.js +28 -20
- package/dist/module/Contacts/ContactsClient.js +3 -0
- package/dist/module/Errors/catalog/CallingDeviceError.js +2 -2
- package/dist/module/Errors/catalog/LineError.js +2 -2
- package/dist/module/Errors/index.js +1 -0
- package/dist/module/api.js +6 -5
- package/dist/module/common/Utils.js +14 -19
- package/dist/module/common/testUtil.js +2 -1
- package/dist/module/common/types.js +6 -5
- package/dist/module/index.js +7 -0
- package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
- package/dist/types/CallHistory/callHistoryFixtures.d.ts.map +1 -1
- package/dist/types/CallSettings/CallSettings.d.ts.map +1 -1
- package/dist/types/CallSettings/types.d.ts.map +1 -1
- package/dist/types/CallingClient/CallingClient.d.ts +2 -0
- package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/CallerId/index.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/CallerId/types.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/call.d.ts +2 -0
- package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/callManager.d.ts +0 -1
- package/dist/types/CallingClient/calling/callManager.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/types.d.ts +30 -30
- package/dist/types/CallingClient/calling/types.d.ts.map +1 -1
- package/dist/types/CallingClient/callingClientFixtures.d.ts +69 -1
- package/dist/types/CallingClient/callingClientFixtures.d.ts.map +1 -1
- package/dist/types/CallingClient/constants.d.ts +7 -3
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/line/index.d.ts +4 -5
- package/dist/types/CallingClient/line/index.d.ts.map +1 -1
- package/dist/types/CallingClient/line/types.d.ts +8 -13
- package/dist/types/CallingClient/line/types.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +3 -3
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/types.d.ts +14 -14
- package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
- package/dist/types/CallingClient/types.d.ts +6 -4
- package/dist/types/CallingClient/types.d.ts.map +1 -1
- package/dist/types/Contacts/ContactsClient.d.ts +3 -2
- package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
- package/dist/types/Contacts/types.d.ts +2 -0
- package/dist/types/Contacts/types.d.ts.map +1 -1
- package/dist/types/Errors/catalog/CallingDeviceError.d.ts +4 -4
- package/dist/types/Errors/catalog/CallingDeviceError.d.ts.map +1 -1
- package/dist/types/Errors/catalog/LineError.d.ts +4 -4
- package/dist/types/Errors/catalog/LineError.d.ts.map +1 -1
- package/dist/types/Errors/index.d.ts +1 -0
- package/dist/types/Errors/index.d.ts.map +1 -1
- package/dist/types/Errors/types.d.ts +2 -3
- package/dist/types/Errors/types.d.ts.map +1 -1
- package/dist/types/Events/types.d.ts +11 -0
- package/dist/types/Events/types.d.ts.map +1 -1
- package/dist/types/SDKConnector/types.d.ts +2 -1
- package/dist/types/SDKConnector/types.d.ts.map +1 -1
- package/dist/types/Voicemail/UcmBackendConnector.d.ts +1 -1
- package/dist/types/Voicemail/Voicemail.d.ts.map +1 -1
- package/dist/types/Voicemail/WxCallBackendConnector.d.ts +1 -1
- package/dist/types/Voicemail/types.d.ts +10 -10
- package/dist/types/Voicemail/types.d.ts.map +1 -1
- package/dist/types/api.d.ts +10 -10
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/testUtil.d.ts +1 -0
- package/dist/types/common/testUtil.d.ts.map +1 -1
- package/dist/types/common/types.d.ts +3 -2
- package/dist/types/common/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +11 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +6 -5
|
@@ -26,7 +26,6 @@ var utils = _interopRequireWildcard(require("../common/Utils"));
|
|
|
26
26
|
var _callManager = require("./calling/callManager");
|
|
27
27
|
var _constants = require("./constants");
|
|
28
28
|
var _callRecordFixtures = require("./callRecordFixtures");
|
|
29
|
-
var _types4 = require("./line/types");
|
|
30
29
|
var _callingClientFixtures = require("./callingClientFixtures");
|
|
31
30
|
var _line = _interopRequireDefault(require("./line"));
|
|
32
31
|
var _registerFixtures = require("./registration/registerFixtures");
|
|
@@ -39,6 +38,7 @@ describe('CallingClient Tests', function () {
|
|
|
39
38
|
|
|
40
39
|
var handleErrorSpy = jest.spyOn(utils, 'handleCallingClientErrors');
|
|
41
40
|
var webex = (0, _testUtil.getTestUtilsWebex)();
|
|
41
|
+
webex.internal.services['_hostCatalog'] = _callingClientFixtures.mockCatalogUS;
|
|
42
42
|
var defaultServiceIndicator = _types2.ServiceIndicator.CALLING;
|
|
43
43
|
var callManager = (0, _callManager.getCallManager)(webex, defaultServiceIndicator);
|
|
44
44
|
var logSpy = jest.spyOn(_Logger.default, 'info');
|
|
@@ -378,7 +378,7 @@ describe('CallingClient Tests', function () {
|
|
|
378
378
|
expect(webex.request).nthCalledWith(1, _objectSpread(_objectSpread({
|
|
379
379
|
method: 'GET'
|
|
380
380
|
}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
381
|
-
uri: "".concat(
|
|
381
|
+
uri: "".concat(callingClient['mobiusHost']).concat(_constants.URL_ENDPOINT).concat(_constants.IP_ENDPOINT)
|
|
382
382
|
}));
|
|
383
383
|
expect(webex.request).nthCalledWith(2, {
|
|
384
384
|
method: 'GET',
|
|
@@ -389,7 +389,7 @@ describe('CallingClient Tests', function () {
|
|
|
389
389
|
expect(webex.request).nthCalledWith(3, _objectSpread(_objectSpread({
|
|
390
390
|
method: 'GET'
|
|
391
391
|
}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
392
|
-
uri: "".concat(
|
|
392
|
+
uri: "".concat(callingClient['mobiusHost']).concat(_constants.URL_ENDPOINT, "?regionCode=").concat(_callingClientFixtures.regionBody.clientRegion, "&countryCode=").concat(_callingClientFixtures.regionBody.countryCode)
|
|
393
393
|
}));
|
|
394
394
|
case 10:
|
|
395
395
|
case "end":
|
|
@@ -414,22 +414,29 @@ describe('CallingClient Tests', function () {
|
|
|
414
414
|
});
|
|
415
415
|
case 4:
|
|
416
416
|
callingClient = _context14.sent;
|
|
417
|
-
expect(
|
|
418
|
-
|
|
419
|
-
method: 'getMobiusServers'
|
|
420
|
-
});
|
|
421
|
-
expect(webex.request).toBeCalledOnceWith(_objectSpread(_objectSpread({}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
422
|
-
uri: "".concat(_callingClientFixtures.uri, "myip"),
|
|
417
|
+
expect(webex.request).nthCalledWith(1, _objectSpread(_objectSpread({}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
418
|
+
uri: 'https://mobius-us-east-1.prod.infra.webex.com/api/v1/calling/web/myip',
|
|
423
419
|
method: 'GET'
|
|
424
420
|
}));
|
|
425
|
-
expect(
|
|
426
|
-
|
|
421
|
+
expect(webex.request).nthCalledWith(2, _objectSpread(_objectSpread({}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
422
|
+
uri: 'https://mobius-ca-central-1.prod.infra.webex.com/api/v1/calling/web/myip',
|
|
427
423
|
method: 'GET'
|
|
428
|
-
}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
429
|
-
uri: "".concat(_callingClientFixtures.uri, "myip")
|
|
430
424
|
}));
|
|
431
|
-
expect(
|
|
432
|
-
|
|
425
|
+
expect(webex.request).nthCalledWith(3, _objectSpread(_objectSpread({}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
426
|
+
uri: 'https://mobius-eu-central-1.prod.infra.webex.com/api/v1/calling/web/myip',
|
|
427
|
+
method: 'GET'
|
|
428
|
+
}));
|
|
429
|
+
expect(webex.request).nthCalledWith(4, _objectSpread(_objectSpread({}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
430
|
+
uri: 'https://mobius-ap-southeast-2.prod.infra.webex.com/api/v1/calling/web/myip',
|
|
431
|
+
method: 'GET'
|
|
432
|
+
}));
|
|
433
|
+
expect(handleErrorSpy).toBeCalledWith(failurePayload, expect.anything(), {
|
|
434
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
435
|
+
method: 'getMobiusServers'
|
|
436
|
+
});
|
|
437
|
+
expect(callingClient.primaryMobiusUris).toEqual(["".concat(callingClient['mobiusHost']).concat(_constants.URL_ENDPOINT)]);
|
|
438
|
+
expect(warnSpy).toBeCalledWith("Couldn't resolve the region and country code. Defaulting to the catalog entries to discover mobius servers", '');
|
|
439
|
+
case 12:
|
|
433
440
|
case "end":
|
|
434
441
|
return _context14.stop();
|
|
435
442
|
}
|
|
@@ -457,11 +464,11 @@ describe('CallingClient Tests', function () {
|
|
|
457
464
|
method: 'getMobiusServers'
|
|
458
465
|
});
|
|
459
466
|
expect(webex.request).toBeCalledTimes(3);
|
|
460
|
-
expect(callingClient.primaryMobiusUris).toEqual([
|
|
467
|
+
expect(callingClient.primaryMobiusUris).toEqual(["".concat(callingClient['mobiusHost']).concat(_constants.URL_ENDPOINT)]);
|
|
461
468
|
expect(webex.request).nthCalledWith(1, _objectSpread(_objectSpread({
|
|
462
469
|
method: 'GET'
|
|
463
470
|
}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
464
|
-
uri: "".concat(
|
|
471
|
+
uri: "".concat(callingClient['mobiusHost']).concat(_constants.URL_ENDPOINT).concat(_constants.IP_ENDPOINT)
|
|
465
472
|
}));
|
|
466
473
|
expect(webex.request).nthCalledWith(2, {
|
|
467
474
|
method: 'GET',
|
|
@@ -469,7 +476,7 @@ describe('CallingClient Tests', function () {
|
|
|
469
476
|
addAuthHeader: false,
|
|
470
477
|
headers: (0, _defineProperty2.default)({}, _constants.SPARK_USER_AGENT, null)
|
|
471
478
|
});
|
|
472
|
-
expect(warnSpy).toBeCalledWith('
|
|
479
|
+
expect(warnSpy).toBeCalledWith("Couldn't resolve the region and country code. Defaulting to the catalog entries to discover mobius servers", '');
|
|
473
480
|
case 11:
|
|
474
481
|
case "end":
|
|
475
482
|
return _context15.stop();
|
|
@@ -501,7 +508,7 @@ describe('CallingClient Tests', function () {
|
|
|
501
508
|
method: 'getMobiusServers'
|
|
502
509
|
});
|
|
503
510
|
expect(webex.request).toBeCalledOnceWith(_objectSpread(_objectSpread({}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
504
|
-
uri: "".concat(
|
|
511
|
+
uri: "".concat(callingClient['mobiusHost']).concat(_constants.URL_ENDPOINT, "?regionCode=").concat(_callingClientFixtures.regionBody.clientRegion, "&countryCode=").concat(_callingClientFixtures.regionBody.countryCode),
|
|
505
512
|
method: 'GET'
|
|
506
513
|
}));
|
|
507
514
|
expect(handleErrorSpy).not.toBeCalled();
|
|
@@ -512,6 +519,64 @@ describe('CallingClient Tests', function () {
|
|
|
512
519
|
}, _callee16);
|
|
513
520
|
})));
|
|
514
521
|
});
|
|
522
|
+
describe('Testing each cluster present withing host catalog', function () {
|
|
523
|
+
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'];
|
|
524
|
+
var checkCluster = /*#__PURE__*/function () {
|
|
525
|
+
var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(mockServiceHosts, mockCatalog) {
|
|
526
|
+
var callingClient;
|
|
527
|
+
return _regenerator.default.wrap(function _callee17$(_context17) {
|
|
528
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
529
|
+
case 0:
|
|
530
|
+
webex.internal.services._hostCatalog = mockCatalog;
|
|
531
|
+
_context17.next = 3;
|
|
532
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
533
|
+
logger: {
|
|
534
|
+
level: _types.LOGGER.INFO
|
|
535
|
+
}
|
|
536
|
+
});
|
|
537
|
+
case 3:
|
|
538
|
+
callingClient = _context17.sent;
|
|
539
|
+
expect(callingClient['mobiusClusters']).toStrictEqual(mockServiceHosts);
|
|
540
|
+
case 5:
|
|
541
|
+
case "end":
|
|
542
|
+
return _context17.stop();
|
|
543
|
+
}
|
|
544
|
+
}, _callee17);
|
|
545
|
+
}));
|
|
546
|
+
return function checkCluster(_x, _x2) {
|
|
547
|
+
return _ref17.apply(this, arguments);
|
|
548
|
+
};
|
|
549
|
+
}();
|
|
550
|
+
it.each(mobiusCluster)('%s', /*#__PURE__*/function () {
|
|
551
|
+
var _ref18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(clusterName) {
|
|
552
|
+
return _regenerator.default.wrap(function _callee18$(_context18) {
|
|
553
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
554
|
+
case 0:
|
|
555
|
+
_context18.t0 = clusterName;
|
|
556
|
+
_context18.next = _context18.t0 === 'mobius-eu-central-1.prod.infra.webex.com' ? 3 : _context18.t0 === 'mobius-us-east-1.int.infra.webex.com' ? 5 : _context18.t0 === 'mobius-eu-central-1.int.infra.webex.com' ? 7 : 9;
|
|
557
|
+
break;
|
|
558
|
+
case 3:
|
|
559
|
+
checkCluster(_callingClientFixtures.mockEUServiceHosts, _callingClientFixtures.mockCatalogEU);
|
|
560
|
+
return _context18.abrupt("break", 10);
|
|
561
|
+
case 5:
|
|
562
|
+
checkCluster(_callingClientFixtures.mockIntServiceHosts, _callingClientFixtures.mockCatalogUSInt);
|
|
563
|
+
return _context18.abrupt("break", 10);
|
|
564
|
+
case 7:
|
|
565
|
+
checkCluster(_callingClientFixtures.mockEUIntServiceHosts, _callingClientFixtures.mockCatalogEUInt);
|
|
566
|
+
return _context18.abrupt("break", 10);
|
|
567
|
+
case 9:
|
|
568
|
+
return _context18.abrupt("break", 10);
|
|
569
|
+
case 10:
|
|
570
|
+
case "end":
|
|
571
|
+
return _context18.stop();
|
|
572
|
+
}
|
|
573
|
+
}, _callee18);
|
|
574
|
+
}));
|
|
575
|
+
return function (_x3) {
|
|
576
|
+
return _ref18.apply(this, arguments);
|
|
577
|
+
};
|
|
578
|
+
}());
|
|
579
|
+
});
|
|
515
580
|
describe('Network activity detection tests', function () {
|
|
516
581
|
var callingClient;
|
|
517
582
|
var line;
|
|
@@ -520,35 +585,34 @@ describe('CallingClient Tests', function () {
|
|
|
520
585
|
var restoreSpy;
|
|
521
586
|
var restartRegisterSpy;
|
|
522
587
|
var registerSpy;
|
|
523
|
-
beforeEach( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
524
|
-
return _regenerator.default.wrap(function
|
|
525
|
-
while (1) switch (
|
|
588
|
+
beforeEach( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19() {
|
|
589
|
+
return _regenerator.default.wrap(function _callee19$(_context19) {
|
|
590
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
526
591
|
case 0:
|
|
527
592
|
jest.useFakeTimers();
|
|
528
593
|
webex.request.mockResolvedValueOnce(_callingClientFixtures.ipPayload).mockResolvedValueOnce(_callingClientFixtures.regionPayload).mockResolvedValueOnce(_callingClientFixtures.discoveryPayload).mockResolvedValueOnce(_callingClientFixtures.registrationPayload);
|
|
529
|
-
|
|
594
|
+
_context19.next = 4;
|
|
530
595
|
return (0, _CallingClient.createClient)(webex, {
|
|
531
596
|
logger: {
|
|
532
597
|
level: _types.LOGGER.INFO
|
|
533
598
|
}
|
|
534
599
|
});
|
|
535
600
|
case 4:
|
|
536
|
-
callingClient =
|
|
601
|
+
callingClient = _context19.sent;
|
|
537
602
|
line = (0, _values.default)(callingClient.lineDict)[0];
|
|
538
603
|
reg = line.registration;
|
|
539
|
-
|
|
540
|
-
_context17.next = 10;
|
|
604
|
+
_context19.next = 9;
|
|
541
605
|
return line.register();
|
|
542
|
-
case
|
|
606
|
+
case 9:
|
|
543
607
|
deRegSpy = jest.spyOn(line.registration, 'deregister');
|
|
544
608
|
restoreSpy = jest.spyOn(reg, 'restorePreviousRegistration');
|
|
545
609
|
restartRegisterSpy = jest.spyOn(reg, 'restartRegistration');
|
|
546
610
|
registerSpy = jest.spyOn(reg, 'attemptRegistrationWithServers');
|
|
547
|
-
case
|
|
611
|
+
case 13:
|
|
548
612
|
case "end":
|
|
549
|
-
return
|
|
613
|
+
return _context19.stop();
|
|
550
614
|
}
|
|
551
|
-
},
|
|
615
|
+
}, _callee19);
|
|
552
616
|
})));
|
|
553
617
|
afterEach(function () {
|
|
554
618
|
jest.clearAllTimers();
|
|
@@ -558,18 +622,18 @@ describe('CallingClient Tests', function () {
|
|
|
558
622
|
callingClient = undefined;
|
|
559
623
|
jest.useRealTimers();
|
|
560
624
|
});
|
|
561
|
-
it('detect a network flap in mercury connection', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
562
|
-
return _regenerator.default.wrap(function
|
|
563
|
-
while (1) switch (
|
|
625
|
+
it('detect a network flap in mercury connection', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20() {
|
|
626
|
+
return _regenerator.default.wrap(function _callee20$(_context20) {
|
|
627
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
564
628
|
case 0:
|
|
565
|
-
expect(line.
|
|
629
|
+
expect(line.getStatus()).toEqual(_types2.RegistrationStatus.ACTIVE);
|
|
566
630
|
|
|
567
631
|
/* Set mercury connection to be down and execute a delay of 2.5 seconds */
|
|
568
632
|
webex.internal.mercury.connected = false;
|
|
569
633
|
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 500);
|
|
570
634
|
|
|
571
635
|
/* We should be detecting the network flap */
|
|
572
|
-
expect(warnSpy).
|
|
636
|
+
expect(warnSpy).toBeCalledOnceWith('Network has flapped, waiting for mercury connection to be up', {
|
|
573
637
|
file: _constants.CALLING_CLIENT_FILE,
|
|
574
638
|
method: _constants.NETWORK_CHANGE_DETECTION_UTIL
|
|
575
639
|
});
|
|
@@ -577,32 +641,31 @@ describe('CallingClient Tests', function () {
|
|
|
577
641
|
/* Set mercury connection to be up and execute a delay of 2.5 seconds */
|
|
578
642
|
webex.internal.mercury.connected = true;
|
|
579
643
|
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 500);
|
|
580
|
-
|
|
644
|
+
_context20.next = 8;
|
|
581
645
|
return flushPromises();
|
|
582
646
|
case 8:
|
|
583
647
|
/* We should be detecting the network recovery */
|
|
584
|
-
expect(logSpy).
|
|
648
|
+
expect(logSpy).toBeCalledWith('Mercury connection is up again, re-registering with Webex Calling if needed', {
|
|
585
649
|
file: _constants.REGISTRATION_FILE,
|
|
586
650
|
method: 'handleConnectionRestoration'
|
|
587
651
|
});
|
|
588
|
-
expect(deRegSpy).toBeCalledWith();
|
|
589
652
|
expect(restoreSpy).toBeCalledWith('handleConnectionRestoration');
|
|
590
653
|
expect(restartRegisterSpy).toBeCalledWith('handleConnectionRestoration');
|
|
591
654
|
expect(webex.request).toBeCalledTimes(6);
|
|
592
655
|
expect(registerSpy).toBeCalledWith('handleConnectionRestoration', [reg.getActiveMobiusUrl()]);
|
|
593
656
|
expect(registerSpy).lastCalledWith('handleConnectionRestoration', [_callingClientFixtures.primaryUrl]);
|
|
594
|
-
case
|
|
657
|
+
case 14:
|
|
595
658
|
case "end":
|
|
596
|
-
return
|
|
659
|
+
return _context20.stop();
|
|
597
660
|
}
|
|
598
|
-
},
|
|
661
|
+
}, _callee20);
|
|
599
662
|
})));
|
|
600
|
-
it('Simulate a network flap with no active calls and re-verify registration: Restore Failure', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
663
|
+
it('Simulate a network flap with no active calls and re-verify registration: Restore Failure', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21() {
|
|
601
664
|
var failurePayload, mockRegistrationBody, successPayload;
|
|
602
|
-
return _regenerator.default.wrap(function
|
|
603
|
-
while (1) switch (
|
|
665
|
+
return _regenerator.default.wrap(function _callee21$(_context21) {
|
|
666
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
604
667
|
case 0:
|
|
605
|
-
expect(line.
|
|
668
|
+
expect(line.getStatus()).toEqual(_types2.RegistrationStatus.ACTIVE);
|
|
606
669
|
failurePayload = {
|
|
607
670
|
statusCode: 500,
|
|
608
671
|
body: ''
|
|
@@ -627,41 +690,39 @@ describe('CallingClient Tests', function () {
|
|
|
627
690
|
/* Set mercury connection to be up and execute a delay of 2.5 seconds */
|
|
628
691
|
webex.internal.mercury.connected = true;
|
|
629
692
|
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 500);
|
|
630
|
-
|
|
693
|
+
_context21.next = 12;
|
|
631
694
|
return flushPromises();
|
|
632
695
|
case 12:
|
|
633
696
|
/* We should be detecting the network recovery */
|
|
634
|
-
expect(logSpy).toBeCalledWith('Mercury connection is up again,
|
|
697
|
+
expect(logSpy).toBeCalledWith('Mercury connection is up again, re-registering with Webex Calling if needed', {
|
|
635
698
|
file: _constants.REGISTRATION_FILE,
|
|
636
699
|
method: 'handleConnectionRestoration'
|
|
637
700
|
});
|
|
638
|
-
expect(
|
|
639
|
-
expect(
|
|
640
|
-
expect(restartRegisterSpy).toBeCalledWith('handleConnectionRestoration');
|
|
701
|
+
expect(restoreSpy).toBeCalledOnceWith('handleConnectionRestoration');
|
|
702
|
+
expect(restartRegisterSpy).toBeCalledOnceWith('handleConnectionRestoration');
|
|
641
703
|
expect(webex.request).toBeCalledTimes(6);
|
|
642
704
|
expect(registerSpy).toBeCalledWith('handleConnectionRestoration', [reg.getActiveMobiusUrl()]);
|
|
643
705
|
expect(registerSpy).lastCalledWith('handleConnectionRestoration', [_callingClientFixtures.primaryUrl]);
|
|
644
|
-
case
|
|
706
|
+
case 18:
|
|
645
707
|
case "end":
|
|
646
|
-
return
|
|
708
|
+
return _context21.stop();
|
|
647
709
|
}
|
|
648
|
-
},
|
|
710
|
+
}, _callee21);
|
|
649
711
|
})));
|
|
650
|
-
it('Simulate a network flap before initial registration is done', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
651
|
-
|
|
652
|
-
|
|
712
|
+
it('Simulate a network flap before initial registration is done', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee22() {
|
|
713
|
+
var handleConnectionRestoreSpy;
|
|
714
|
+
return _regenerator.default.wrap(function _callee22$(_context22) {
|
|
715
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
653
716
|
case 0:
|
|
654
|
-
|
|
655
|
-
reg.
|
|
656
|
-
reg.setActiveMobiusUrl(undefined);
|
|
657
|
-
jest.clearAllMocks();
|
|
717
|
+
handleConnectionRestoreSpy = jest.spyOn(reg, 'handleConnectionRestoration');
|
|
718
|
+
reg.setStatus(_types2.RegistrationStatus.IDLE);
|
|
658
719
|
|
|
659
720
|
/* Set mercury connection to be down and execute a delay of 2.5 seconds */
|
|
660
721
|
webex.internal.mercury.connected = false;
|
|
661
722
|
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 500);
|
|
662
723
|
|
|
663
724
|
/* We should be detecting the network flap */
|
|
664
|
-
expect(warnSpy).
|
|
725
|
+
expect(warnSpy).toBeCalledOnceWith('Network has flapped, waiting for mercury connection to be up', {
|
|
665
726
|
file: _constants.CALLING_CLIENT_FILE,
|
|
666
727
|
method: _constants.NETWORK_CHANGE_DETECTION_UTIL
|
|
667
728
|
});
|
|
@@ -669,11 +730,11 @@ describe('CallingClient Tests', function () {
|
|
|
669
730
|
/* Set mercury connection to be up and execute a delay of 2.5 seconds */
|
|
670
731
|
webex.internal.mercury.connected = true;
|
|
671
732
|
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 500);
|
|
672
|
-
|
|
733
|
+
_context22.next = 9;
|
|
673
734
|
return flushPromises();
|
|
674
|
-
case
|
|
735
|
+
case 9:
|
|
675
736
|
/* We should be detecting the network recovery */
|
|
676
|
-
expect(logSpy).toBeCalledWith('Mercury connection is up again,
|
|
737
|
+
expect(logSpy).not.toBeCalledWith('Mercury connection is up again, re-registering with Webex Calling if needed', {
|
|
677
738
|
file: _constants.REGISTRATION_FILE,
|
|
678
739
|
method: 'handleConnectionRestoration'
|
|
679
740
|
});
|
|
@@ -682,20 +743,18 @@ describe('CallingClient Tests', function () {
|
|
|
682
743
|
* When initial registration is not done, network flap
|
|
683
744
|
* will not trigger de-registration/registration
|
|
684
745
|
*/
|
|
685
|
-
expect(
|
|
686
|
-
|
|
687
|
-
expect(registerSpy).not.toBeCalled();
|
|
688
|
-
case 15:
|
|
746
|
+
expect(handleConnectionRestoreSpy).not.toBeCalledOnceWith();
|
|
747
|
+
case 11:
|
|
689
748
|
case "end":
|
|
690
|
-
return
|
|
749
|
+
return _context22.stop();
|
|
691
750
|
}
|
|
692
|
-
},
|
|
751
|
+
}, _callee22);
|
|
693
752
|
})));
|
|
694
|
-
it('Simulate a network flap with 1 active call', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
695
|
-
return _regenerator.default.wrap(function
|
|
696
|
-
while (1) switch (
|
|
753
|
+
it('Simulate a network flap with 1 active call', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee23() {
|
|
754
|
+
return _regenerator.default.wrap(function _callee23$(_context23) {
|
|
755
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
697
756
|
case 0:
|
|
698
|
-
expect(line.
|
|
757
|
+
expect(line.getStatus()).toEqual(_types2.RegistrationStatus.ACTIVE);
|
|
699
758
|
|
|
700
759
|
/** create a new call */
|
|
701
760
|
reg.callManager.createCall();
|
|
@@ -704,11 +763,11 @@ describe('CallingClient Tests', function () {
|
|
|
704
763
|
/* Set mercury connection to be down and execute a delay of 2.5 seconds */
|
|
705
764
|
webex.internal.mercury.connected = false;
|
|
706
765
|
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 500);
|
|
707
|
-
|
|
766
|
+
_context23.next = 7;
|
|
708
767
|
return flushPromises();
|
|
709
768
|
case 7:
|
|
710
769
|
/* We should be detecting the network flap */
|
|
711
|
-
expect(warnSpy).not.
|
|
770
|
+
expect(warnSpy).not.toBeCalledOnceWith('Network has flapped, waiting for mercury connection to be up', {
|
|
712
771
|
file: _constants.CALLING_CLIENT_FILE,
|
|
713
772
|
method: 'handleConnectionRestoration'
|
|
714
773
|
});
|
|
@@ -716,39 +775,39 @@ describe('CallingClient Tests', function () {
|
|
|
716
775
|
/* Set mercury connection to be up and execute a delay of 2.5 seconds */
|
|
717
776
|
webex.internal.mercury.connected = true;
|
|
718
777
|
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 500);
|
|
719
|
-
|
|
778
|
+
_context23.next = 12;
|
|
720
779
|
return flushPromises();
|
|
721
780
|
case 12:
|
|
722
781
|
/* We should be detecting the network recovery */
|
|
723
|
-
expect(logSpy).not.
|
|
782
|
+
expect(logSpy).not.toBeCalledOnceWith('Mercury connection is up again, re-registering with Webex Calling if needed', {
|
|
724
783
|
file: _constants.REGISTRATION_FILE,
|
|
725
784
|
method: 'handleConnectionRestoration'
|
|
726
785
|
});
|
|
727
786
|
expect(registerSpy).not.toBeCalledWith(true);
|
|
728
787
|
case 14:
|
|
729
788
|
case "end":
|
|
730
|
-
return
|
|
789
|
+
return _context23.stop();
|
|
731
790
|
}
|
|
732
|
-
},
|
|
791
|
+
}, _callee23);
|
|
733
792
|
})));
|
|
734
793
|
});
|
|
735
794
|
describe('Line creation tests', function () {
|
|
736
795
|
var callingClient;
|
|
737
796
|
var line;
|
|
738
|
-
beforeEach( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
739
|
-
return _regenerator.default.wrap(function
|
|
740
|
-
while (1) switch (
|
|
797
|
+
beforeEach( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee24() {
|
|
798
|
+
return _regenerator.default.wrap(function _callee24$(_context24) {
|
|
799
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
741
800
|
case 0:
|
|
742
|
-
|
|
801
|
+
_context24.next = 2;
|
|
743
802
|
return (0, _CallingClient.createClient)(webex);
|
|
744
803
|
case 2:
|
|
745
|
-
callingClient =
|
|
804
|
+
callingClient = _context24.sent;
|
|
746
805
|
line = (0, _values.default)(callingClient.lineDict)[0];
|
|
747
806
|
case 4:
|
|
748
807
|
case "end":
|
|
749
|
-
return
|
|
808
|
+
return _context24.stop();
|
|
750
809
|
}
|
|
751
|
-
},
|
|
810
|
+
}, _callee24);
|
|
752
811
|
})));
|
|
753
812
|
afterEach(function () {
|
|
754
813
|
jest.clearAllTimers();
|
|
@@ -783,25 +842,25 @@ describe('CallingClient Tests', function () {
|
|
|
783
842
|
});
|
|
784
843
|
var callingClient;
|
|
785
844
|
var line;
|
|
786
|
-
beforeAll( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
845
|
+
beforeAll( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee25() {
|
|
787
846
|
var calls;
|
|
788
|
-
return _regenerator.default.wrap(function
|
|
789
|
-
while (1) switch (
|
|
847
|
+
return _regenerator.default.wrap(function _callee25$(_context25) {
|
|
848
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
790
849
|
case 0:
|
|
791
|
-
|
|
850
|
+
_context25.next = 2;
|
|
792
851
|
return (0, _CallingClient.createClient)(webex);
|
|
793
852
|
case 2:
|
|
794
|
-
callingClient =
|
|
795
|
-
line = new _line.default(userId, clientDeviceUri,
|
|
853
|
+
callingClient = _context25.sent;
|
|
854
|
+
line = new _line.default(userId, clientDeviceUri, mutex, primaryMobiusUris(), backupMobiusUris(), _types.LOGGER.INFO);
|
|
796
855
|
calls = (0, _values.default)(callManager.getActiveCalls());
|
|
797
856
|
calls.forEach(function (call) {
|
|
798
857
|
call.end();
|
|
799
858
|
});
|
|
800
859
|
case 6:
|
|
801
860
|
case "end":
|
|
802
|
-
return
|
|
861
|
+
return _context25.stop();
|
|
803
862
|
}
|
|
804
|
-
},
|
|
863
|
+
}, _callee25);
|
|
805
864
|
})));
|
|
806
865
|
afterAll(function () {
|
|
807
866
|
callingClient.removeAllListeners();
|
|
@@ -884,23 +943,23 @@ describe('CallingClient Tests', function () {
|
|
|
884
943
|
describe('Call Session Event test', function () {
|
|
885
944
|
var mockOn = webex.internal.mercury.on;
|
|
886
945
|
var callingClient;
|
|
887
|
-
beforeEach( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
888
|
-
return _regenerator.default.wrap(function
|
|
889
|
-
while (1) switch (
|
|
946
|
+
beforeEach( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee26() {
|
|
947
|
+
return _regenerator.default.wrap(function _callee26$(_context26) {
|
|
948
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
890
949
|
case 0:
|
|
891
|
-
|
|
950
|
+
_context26.next = 2;
|
|
892
951
|
return (0, _CallingClient.createClient)(webex, {
|
|
893
952
|
logger: {
|
|
894
953
|
level: _types.LOGGER.INFO
|
|
895
954
|
}
|
|
896
955
|
});
|
|
897
956
|
case 2:
|
|
898
|
-
callingClient =
|
|
957
|
+
callingClient = _context26.sent;
|
|
899
958
|
case 3:
|
|
900
959
|
case "end":
|
|
901
|
-
return
|
|
960
|
+
return _context26.stop();
|
|
902
961
|
}
|
|
903
|
-
},
|
|
962
|
+
}, _callee26);
|
|
904
963
|
})));
|
|
905
964
|
afterEach(function () {
|
|
906
965
|
callingClient.removeAllListeners();
|