@webex/calling 3.7.0 → 3.8.0-next.2
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/CallingClient/CallingClient.js +88 -9
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +4 -1
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/calling/call.js +121 -57
- package/dist/CallingClient/calling/call.js.map +1 -1
- package/dist/CallingClient/calling/call.test.js +21 -8
- package/dist/CallingClient/calling/call.test.js.map +1 -1
- package/dist/Contacts/ContactsClient.js +37 -16
- package/dist/Contacts/ContactsClient.js.map +1 -1
- package/dist/Contacts/ContactsClient.test.js +34 -0
- package/dist/Contacts/ContactsClient.test.js.map +1 -1
- package/dist/Logger/index.js +22 -14
- package/dist/Logger/index.js.map +1 -1
- package/dist/Logger/index.test.js +30 -5
- package/dist/Logger/index.test.js.map +1 -1
- package/dist/SDKConnector/types.js.map +1 -1
- package/dist/common/Utils.js +98 -0
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +92 -0
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/common/testUtil.js +3 -1
- package/dist/common/testUtil.js.map +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/module/CallingClient/CallingClient.js +17 -1
- package/dist/module/CallingClient/calling/call.js +64 -1
- package/dist/module/Contacts/ContactsClient.js +16 -5
- package/dist/module/Logger/index.js +20 -11
- package/dist/module/common/Utils.js +49 -0
- package/dist/module/common/testUtil.js +3 -1
- package/dist/module/index.js +1 -0
- package/dist/types/CallingClient/CallingClient.d.ts +3 -0
- package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
- package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
- package/dist/types/Logger/index.d.ts +2 -0
- package/dist/types/Logger/index.d.ts.map +1 -1
- package/dist/types/SDKConnector/types.d.ts +12 -9
- package/dist/types/SDKConnector/types.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts +2 -0
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/testUtil.d.ts +3 -1
- package/dist/types/common/testUtil.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -23,12 +23,14 @@ var _Utils = require("./Utils");
|
|
|
23
23
|
var _voicemailFixture = require("../Voicemail/voicemailFixture");
|
|
24
24
|
var _constants2 = require("./constants");
|
|
25
25
|
var _types3 = require("../Events/types");
|
|
26
|
+
var _SDKConnector = _interopRequireDefault(require("../SDKConnector"));
|
|
26
27
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
27
28
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; } /* eslint-disable no-underscore-dangle */
|
|
28
29
|
var mockSubmitRegistrationMetric = jest.fn();
|
|
29
30
|
var mockEmitterCb = jest.fn();
|
|
30
31
|
var mockRestoreCb = jest.fn();
|
|
31
32
|
var webex = (0, _testUtil.getTestUtilsWebex)();
|
|
33
|
+
_SDKConnector.default.setWebex(webex);
|
|
32
34
|
webex.internal.metrics.submitClientMetrics = mockSubmitRegistrationMetric;
|
|
33
35
|
describe('Mobius service discovery tests', function () {
|
|
34
36
|
it('test filter mobius uris', function () {
|
|
@@ -1345,4 +1347,94 @@ describe('Get XSI Action Endpoint tests', function () {
|
|
|
1345
1347
|
}, _callee12);
|
|
1346
1348
|
})));
|
|
1347
1349
|
});
|
|
1350
|
+
describe('modifySdpForIPv4', function () {
|
|
1351
|
+
it('should return original SDP if input is empty', function () {
|
|
1352
|
+
expect((0, _Utils.modifySdpForIPv4)('')).toBe('');
|
|
1353
|
+
});
|
|
1354
|
+
it('should return original SDP if there is no IPv6 c= line', function () {
|
|
1355
|
+
var sdp = "v=0\no=- 12345 67890 IN IP4 192.168.1.1\n\ns=Test Session";
|
|
1356
|
+
expect((0, _Utils.modifySdpForIPv4)(sdp)).toEqual(sdp);
|
|
1357
|
+
});
|
|
1358
|
+
it('should replace IPv6 c= line with default IPv4 if no IPv4 candidate exists', function () {
|
|
1359
|
+
var sdp = "v=0\n o=- 12345 67890 IN IP6 2001:db8::1\n s=Test Session\n c=IN IP6 2001:db8::1\n a=candidate:1 1 UDP 2122260223 2001:db8::1 3478 typ host";
|
|
1360
|
+
var expectedSdp = "v=0\no=- 12345 67890 IN IP6 2001:db8::1\ns=Test Session\nc=IN IP4 192.1.1.1\na=candidate:1 1 UDP 2122260223 2001:db8::1 3478 typ host\na=candidate:2 1 UDP 2122260223 192.1.1.1 3478 typ host generation 0 network-id 1 network-cost 10";
|
|
1361
|
+
var result = (0, _Utils.modifySdpForIPv4)(sdp);
|
|
1362
|
+
expect(result).toEqual(expectedSdp);
|
|
1363
|
+
});
|
|
1364
|
+
it('should replace IPv6 c= line with an existing IPv4 candidate address', function () {
|
|
1365
|
+
var sdp = "v=0\n o=- 12345 67890 IN IP6 2001:db8::1\n s=Test Session\n c=IN IP6 2001:db8::1\n a=candidate:1 1 UDP 2122260223 192.168.1.2 3478 typ host";
|
|
1366
|
+
var expectedSdp = "v=0\no=- 12345 67890 IN IP6 2001:db8::1\ns=Test Session\nc=IN IP4 192.168.1.2\na=candidate:1 1 UDP 2122260223 192.168.1.2 3478 typ host";
|
|
1367
|
+
expect((0, _Utils.modifySdpForIPv4)(sdp).trim()).toEqual(expectedSdp.trim());
|
|
1368
|
+
});
|
|
1369
|
+
it('should correctly handle both UDP and TCP candidates by adding only one IPv4 candidate UDP first', function () {
|
|
1370
|
+
var sdp = "v=0\n o=- 12345 67890 IN IP6 2001:db8::1\n s=Test Session\n c=IN IP6 2001:db8::1\n a=candidate:1 1 UDP 2122260223 2001:db8::1 3478 typ host\n a=candidate:2 1 TCP 2122260223 2001:db8::2 3479 typ host";
|
|
1371
|
+
var expectedSdp = "v=0\no=- 12345 67890 IN IP6 2001:db8::1\ns=Test Session\nc=IN IP4 192.1.1.1\na=candidate:1 1 UDP 2122260223 2001:db8::1 3478 typ host\na=candidate:2 1 UDP 2122260223 192.1.1.1 3478 typ host generation 0 network-id 1 network-cost 10\na=candidate:2 1 TCP 2122260223 2001:db8::2 3479 typ host\n";
|
|
1372
|
+
expect((0, _Utils.modifySdpForIPv4)(sdp).trim()).toEqual(expectedSdp.trim());
|
|
1373
|
+
});
|
|
1374
|
+
it('should correctly handle both UDP and TCP candidates by adding only one IPv4 candidate TCP first', function () {
|
|
1375
|
+
var sdp = "v=0\n o=- 12345 67890 IN IP6 2001:db8::1\n s=Test Session\n c=IN IP6 2001:db8::1\n a=candidate:1 1 TCP 2122260223 2001:db8::2 3479 typ host\n a=candidate:1 1 UDP 2122260223 2001:db8::1 3478 typ host";
|
|
1376
|
+
var expectedSdp = "v=0\no=- 12345 67890 IN IP6 2001:db8::1\ns=Test Session\nc=IN IP4 192.1.1.1\na=candidate:1 1 TCP 2122260223 2001:db8::2 3479 typ host\na=candidate:2 1 TCP 2122260223 192.1.1.1 3479 typ host generation 0 network-id 1 network-cost 10\na=candidate:1 1 UDP 2122260223 2001:db8::1 3478 typ host";
|
|
1377
|
+
expect((0, _Utils.modifySdpForIPv4)(sdp).trim()).toEqual(expectedSdp.trim());
|
|
1378
|
+
});
|
|
1379
|
+
it('should replace all IPv6 c= line if multiple exist', function () {
|
|
1380
|
+
var sdp = "v=0\n o=- 12345 67890 IN IP6 2001:db8::1\n s=Test Session\n c=IN IP6 2001:db8::1\n c=IN IP6 2001:db8::2\n a=candidate:1 1 UDP 2122260223 2001:db8::1 3478 typ host";
|
|
1381
|
+
var expectedSdp = "v=0\no=- 12345 67890 IN IP6 2001:db8::1\ns=Test Session\nc=IN IP4 192.1.1.1\nc=IN IP4 192.1.1.1\na=candidate:1 1 UDP 2122260223 2001:db8::1 3478 typ host\na=candidate:2 1 UDP 2122260223 192.1.1.1 3478 typ host generation 0 network-id 1 network-cost 10";
|
|
1382
|
+
expect((0, _Utils.modifySdpForIPv4)(sdp).trim()).toEqual(expectedSdp.trim());
|
|
1383
|
+
});
|
|
1384
|
+
it('should not modify SDP if IPv6 c= line is absent and IPv4 candidate already exists', function () {
|
|
1385
|
+
var sdp = "v=0\no=- 12345 67890 IN IP4 192.168.1.1\ns=Test Session\nc=IN IP4 192.168.1.1\na=candidate:1 1 UDP 2122260223 192.168.1.1 3478 typ host";
|
|
1386
|
+
expect((0, _Utils.modifySdpForIPv4)(sdp).trim()).toEqual(sdp.trim());
|
|
1387
|
+
});
|
|
1388
|
+
it('should handle malformed SDP gracefully and return unmodified input', function () {
|
|
1389
|
+
var malformedSdp = "random text without proper format";
|
|
1390
|
+
expect((0, _Utils.modifySdpForIPv4)(malformedSdp).trim()).toEqual(malformedSdp.trim());
|
|
1391
|
+
});
|
|
1392
|
+
it('should handle an SDP with both IP6 and IP4 c= lines correctly', function () {
|
|
1393
|
+
var sdp = "v=0\n o=- 12345 67890 IN IP6 2001:db8::1\n s=Test Session\n c=IN IP6 2001:db8::1\n c=IN IP4 192.168.1.3\n a=candidate:1 1 UDP 2122260223 192.168.1.3 3478 typ host";
|
|
1394
|
+
var expectedSdp = "v=0\no=- 12345 67890 IN IP6 2001:db8::1\ns=Test Session\nc=IN IP4 192.168.1.3\nc=IN IP4 192.168.1.3\na=candidate:1 1 UDP 2122260223 192.168.1.3 3478 typ host";
|
|
1395
|
+
expect((0, _Utils.modifySdpForIPv4)(sdp).trim()).toEqual(expectedSdp.trim());
|
|
1396
|
+
});
|
|
1397
|
+
});
|
|
1398
|
+
describe('uploadLogs tests', function () {
|
|
1399
|
+
it('should call submitLogs with the provided data', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
1400
|
+
var mockData;
|
|
1401
|
+
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
1402
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
1403
|
+
case 0:
|
|
1404
|
+
mockData = {
|
|
1405
|
+
someKey: 'someValue'
|
|
1406
|
+
};
|
|
1407
|
+
_context13.next = 3;
|
|
1408
|
+
return (0, _Utils.uploadLogs)(mockData);
|
|
1409
|
+
case 3:
|
|
1410
|
+
expect(_SDKConnector.default.getWebex().internal.support.submitLogs).toHaveBeenCalledTimes(1);
|
|
1411
|
+
expect(_SDKConnector.default.getWebex().internal.support.submitLogs).toHaveBeenCalledWith(mockData);
|
|
1412
|
+
case 5:
|
|
1413
|
+
case "end":
|
|
1414
|
+
return _context13.stop();
|
|
1415
|
+
}
|
|
1416
|
+
}, _callee13);
|
|
1417
|
+
})));
|
|
1418
|
+
it('should handle errors when submitLogs fails', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
|
|
1419
|
+
var mockError, logSpy;
|
|
1420
|
+
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
1421
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1422
|
+
case 0:
|
|
1423
|
+
mockError = new Error('Test error');
|
|
1424
|
+
_SDKConnector.default.getWebex().internal.support.submitLogs.mockRejectedValue(mockError);
|
|
1425
|
+
logSpy = jest.spyOn(_Logger.default, 'error');
|
|
1426
|
+
_context14.next = 5;
|
|
1427
|
+
return (0, _Utils.uploadLogs)({});
|
|
1428
|
+
case 5:
|
|
1429
|
+
expect(logSpy).toHaveBeenCalledWith(mockError, {
|
|
1430
|
+
file: _constants.UTILS_FILE,
|
|
1431
|
+
method: 'uploadLogs'
|
|
1432
|
+
});
|
|
1433
|
+
case 6:
|
|
1434
|
+
case "end":
|
|
1435
|
+
return _context14.stop();
|
|
1436
|
+
}
|
|
1437
|
+
}, _callee14);
|
|
1438
|
+
})));
|
|
1439
|
+
});
|
|
1348
1440
|
//# sourceMappingURL=Utils.test.js.map
|