@webex/plugin-meetings 3.0.0-stream-classes.2 → 3.0.0-stream-classes.4

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 (66) hide show
  1. package/dist/breakouts/breakout.js +1 -1
  2. package/dist/breakouts/index.js +1 -1
  3. package/dist/common/errors/webex-errors.js +25 -5
  4. package/dist/common/errors/webex-errors.js.map +1 -1
  5. package/dist/config.js +2 -2
  6. package/dist/config.js.map +1 -1
  7. package/dist/constants.js +2 -0
  8. package/dist/constants.js.map +1 -1
  9. package/dist/interpretation/index.js +1 -1
  10. package/dist/interpretation/siLanguage.js +1 -1
  11. package/dist/meeting/index.js +4 -8
  12. package/dist/meeting/index.js.map +1 -1
  13. package/dist/meeting/locusMediaRequest.js +1 -1
  14. package/dist/meeting/locusMediaRequest.js.map +1 -1
  15. package/dist/meeting/request.js +23 -13
  16. package/dist/meeting/request.js.map +1 -1
  17. package/dist/meeting/util.js +33 -3
  18. package/dist/meeting/util.js.map +1 -1
  19. package/dist/meeting-info/util.js +1 -1
  20. package/dist/meeting-info/util.js.map +1 -1
  21. package/dist/meeting-info/utilv2.js +16 -31
  22. package/dist/meeting-info/utilv2.js.map +1 -1
  23. package/dist/meetings/index.js +9 -6
  24. package/dist/meetings/index.js.map +1 -1
  25. package/dist/metrics/constants.js +1 -0
  26. package/dist/metrics/constants.js.map +1 -1
  27. package/dist/reachability/index.js +2 -11
  28. package/dist/reachability/index.js.map +1 -1
  29. package/dist/reachability/request.js.map +1 -1
  30. package/dist/reconnection-manager/index.js +26 -22
  31. package/dist/reconnection-manager/index.js.map +1 -1
  32. package/dist/roap/index.js +5 -7
  33. package/dist/roap/index.js.map +1 -1
  34. package/dist/roap/request.js +1 -0
  35. package/dist/roap/request.js.map +1 -1
  36. package/dist/roap/turnDiscovery.js +3 -4
  37. package/dist/roap/turnDiscovery.js.map +1 -1
  38. package/dist/types/common/errors/webex-errors.d.ts +12 -0
  39. package/dist/types/meetings/index.d.ts +1 -1
  40. package/package.json +1 -1
  41. package/src/common/errors/webex-errors.ts +21 -0
  42. package/src/config.ts +2 -2
  43. package/src/constants.ts +2 -2
  44. package/src/meeting/index.ts +4 -4
  45. package/src/meeting/locusMediaRequest.ts +2 -3
  46. package/src/meeting/request.ts +15 -5
  47. package/src/meeting/util.ts +36 -2
  48. package/src/meeting-info/util.ts +1 -1
  49. package/src/meeting-info/utilv2.ts +10 -20
  50. package/src/meetings/index.ts +10 -6
  51. package/src/metrics/constants.ts +1 -0
  52. package/src/reachability/index.ts +4 -10
  53. package/src/reachability/request.ts +1 -1
  54. package/src/reconnection-manager/index.ts +13 -11
  55. package/src/roap/index.ts +2 -4
  56. package/src/roap/request.ts +2 -1
  57. package/src/roap/turnDiscovery.ts +2 -3
  58. package/test/unit/spec/meeting/index.js +8 -6
  59. package/test/unit/spec/meeting/locusMediaRequest.ts +1 -2
  60. package/test/unit/spec/meeting/request.js +23 -0
  61. package/test/unit/spec/meeting/utils.js +73 -4
  62. package/test/unit/spec/meetings/index.js +66 -1
  63. package/test/unit/spec/reachability/index.ts +8 -8
  64. package/test/unit/spec/reconnection-manager/index.js +21 -0
  65. package/test/unit/spec/roap/index.ts +5 -1
  66. package/test/unit/spec/roap/turnDiscovery.ts +11 -4
@@ -8,6 +8,7 @@ import {ROAP} from '../constants';
8
8
 
9
9
  import RoapRequest from './request';
10
10
  import Meeting from '../meeting';
11
+ import MeetingUtil from '../meeting/util';
11
12
 
12
13
  const TURN_DISCOVERY_TIMEOUT = 10; // in seconds
13
14
 
@@ -183,7 +184,7 @@ export default class TurnDiscovery {
183
184
  meetingId: meeting.id,
184
185
  locusMediaRequest: meeting.locusMediaRequest,
185
186
  // @ts-ignore - because of meeting.webex
186
- ipVersion: meeting.webex.meetings.reachability.getIpVersion(),
187
+ ipVersion: MeetingUtil.getIpVersion(meeting.webex),
187
188
  })
188
189
  .then(({mediaConnections}) => {
189
190
  if (mediaConnections) {
@@ -214,8 +215,6 @@ export default class TurnDiscovery {
214
215
  mediaId: meeting.mediaId,
215
216
  meetingId: meeting.id,
216
217
  locusMediaRequest: meeting.locusMediaRequest,
217
- // @ts-ignore - because of meeting.webex
218
- ipVersion: meeting.webex.meetings.reachability.getIpVersion(),
219
218
  });
220
219
  }
221
220
 
@@ -1674,6 +1674,8 @@ describe('plugin-meetings', () => {
1674
1674
  beforeEach(() => {
1675
1675
  clock = sinon.useFakeTimers();
1676
1676
 
1677
+ sinon.stub(MeetingUtil, 'getIpVersion').returns(IP_VERSION.unknown);
1678
+
1677
1679
  meeting.deviceUrl = 'deviceUrl';
1678
1680
  meeting.config.deviceType = 'web';
1679
1681
  meeting.isMultistream = isMultistream;
@@ -1687,12 +1689,11 @@ describe('plugin-meetings', () => {
1687
1689
  meeting.webex.meetings.geoHintInfo = {regionCode: 'EU', countryCode: 'UK'};
1688
1690
  meeting.webex.meetings.reachability = {
1689
1691
  isAnyClusterReachable: sinon.stub().resolves(true),
1690
- getIpVersion: () => IP_VERSION.unknown,
1691
1692
  };
1692
1693
  meeting.roap.doTurnDiscovery = sinon
1693
1694
  .stub()
1694
1695
  .resolves({turnServerInfo: {}, turnDiscoverySkippedReason: 'reachability'});
1695
-
1696
+
1696
1697
  StaticConfig.set({bandwidth: {audio: 1234, video: 5678, startBitrate: 9876}});
1697
1698
 
1698
1699
  // setup things that are expected to be the same across all the tests and are actually irrelevant for these tests
@@ -1768,6 +1769,7 @@ describe('plugin-meetings', () => {
1768
1769
 
1769
1770
  afterEach(() => {
1770
1771
  clock.restore();
1772
+ sinon.restore();
1771
1773
  });
1772
1774
 
1773
1775
  // helper function that waits until all promises are resolved and any queued up /media requests to Locus are sent out
@@ -1855,7 +1857,7 @@ describe('plugin-meetings', () => {
1855
1857
  ],
1856
1858
  clientMediaPreferences: {
1857
1859
  preferTranscoding: !meeting.isMultistream,
1858
- ipver: 0
1860
+ ipver: undefined
1859
1861
  },
1860
1862
  respOnlySdp: true,
1861
1863
  usingResource: null,
@@ -1936,7 +1938,7 @@ describe('plugin-meetings', () => {
1936
1938
  // and that it was the only /media request that was sent
1937
1939
  assert.calledOnce(locusMediaRequestStub);
1938
1940
  });
1939
-
1941
+
1940
1942
  it('addMedia() works correctly when media is enabled with streams to publish', async () => {
1941
1943
  await meeting.addMedia({localStreams: {microphone: fakeMicrophoneStream}});
1942
1944
  await simulateRoapOffer();
@@ -2083,7 +2085,7 @@ describe('plugin-meetings', () => {
2083
2085
  } else {
2084
2086
  assert.notCalled(locusMediaRequestStub);
2085
2087
  }
2086
-
2088
+
2087
2089
  if (isMultistream) {
2088
2090
  assert.calledOnceWithExactly(meeting.sendSlotManager.getSlot(MediaType.AudioMain).publishStream, fakeMicrophoneStream);
2089
2091
  } else {
@@ -4523,7 +4525,7 @@ describe('plugin-meetings', () => {
4523
4525
  payload: {
4524
4526
  canProceed: false,
4525
4527
  },
4526
- options: {showToUser: true, rawError: error, meetingId: meeting.id},
4528
+ options: {rawError: error, meetingId: meeting.id},
4527
4529
  });
4528
4530
  };
4529
4531
 
@@ -68,7 +68,6 @@ describe('LocusMediaRequest.send()', () => {
68
68
  mediaId: 'mediaId',
69
69
  selfUrl: 'fakeMeetingSelfUrl',
70
70
  muteOptions: {},
71
- ipVersion: IP_VERSION.only_ipv6
72
71
  };
73
72
 
74
73
  const createExpectedLocalMuteBody = (expectedMute:{audioMuted: boolean, videoMuted: boolean}, sequence = undefined) => {
@@ -89,7 +88,7 @@ describe('LocusMediaRequest.send()', () => {
89
88
  ],
90
89
  clientMediaPreferences: {
91
90
  preferTranscoding: true,
92
- ipver: 6,
91
+ ipver: undefined,
93
92
  },
94
93
  };
95
94
 
@@ -237,6 +237,29 @@ describe('plugin-meetings', () => {
237
237
  assert.equal(requestParams.body.invitee.address, 'sipUrl');
238
238
  });
239
239
 
240
+ it('sends uses the locusClusterUrl if available', async () => {
241
+ const deviceUrl = 'deviceUrl';
242
+ const correlationId = 'random-uuid';
243
+ const roapMessage = 'roap-message';
244
+ const inviteeAddress = 'sipUrl';
245
+ const locusClusterUrl = 'locusClusterUrl';
246
+
247
+ await meetingsRequest.joinMeeting({
248
+ deviceUrl,
249
+ correlationId,
250
+ roapMessage,
251
+ locusClusterUrl,
252
+ inviteeAddress,
253
+ });
254
+ const requestParams = meetingsRequest.request.getCall(0).args[0];
255
+
256
+ assert.equal(requestParams.method, 'POST');
257
+ assert.equal(
258
+ requestParams.uri,
259
+ 'https://locusClusterUrl/locus/api/v1/loci/call?alternateRedirect=true'
260
+ );
261
+ });
262
+
240
263
  it('adds deviceCapabilities to request when breakouts are supported', async () => {
241
264
  await meetingsRequest.joinMeeting({
242
265
  breakoutsSupported: true,
@@ -4,10 +4,9 @@ import Meetings from '@webex/plugin-meetings';
4
4
  import MeetingUtil from '@webex/plugin-meetings/src/meeting/util';
5
5
  import LoggerProxy from '@webex/plugin-meetings/src/common/logs/logger-proxy';
6
6
  import LoggerConfig from '@webex/plugin-meetings/src/common/logs/logger-config';
7
- import Metrics from '@webex/plugin-meetings/src/metrics/index';
8
- import {SELF_POLICY} from '@webex/plugin-meetings/src/constants';
9
- import {DISPLAY_HINTS} from '@webex/plugin-meetings/src/constants';
7
+ import {SELF_POLICY, IP_VERSION} from '@webex/plugin-meetings/src/constants';
10
8
  import MockWebex from '@webex/test-helper-mock-webex';
9
+ import * as BrowserDetectionModule from '@webex/plugin-meetings/src/common/browser-detection';
11
10
 
12
11
  describe('plugin-meetings', () => {
13
12
  let webex;
@@ -337,7 +336,6 @@ describe('plugin-meetings', () => {
337
336
  selfUrl: 'self url',
338
337
  sequence: {},
339
338
  type: 'LocalMute',
340
- ipVersion: 0,
341
339
  });
342
340
 
343
341
  assert.calledWith(webex.internal.newMetrics.submitClientEvent, {
@@ -517,6 +515,26 @@ describe('plugin-meetings', () => {
517
515
  assert.isUndefined(parameter.inviteeAddress);
518
516
  assert.equal(parameter.meetingNumber, 'meetingNumber');
519
517
  });
518
+
519
+ it('should pass in the locusClusterUrl from meetingInfo', async () => {
520
+ const meeting = {
521
+ meetingInfo: {
522
+ locusClusterUrl: 'locusClusterUrl',
523
+ },
524
+ meetingRequest: {
525
+ joinMeeting: sinon.stub().returns(Promise.resolve({body: {}, headers: {}})),
526
+ },
527
+ getWebexObject: sinon.stub().returns(webex),
528
+ };
529
+
530
+ MeetingUtil.parseLocusJoin = sinon.stub();
531
+ await MeetingUtil.joinMeeting(meeting, {});
532
+
533
+ assert.calledOnce(meeting.meetingRequest.joinMeeting);
534
+ const parameter = meeting.meetingRequest.joinMeeting.getCall(0).args[0];
535
+
536
+ assert.equal(parameter.locusClusterUrl, 'locusClusterUrl');
537
+ });
520
538
  });
521
539
 
522
540
  describe('joinMeetingOptions', () => {
@@ -963,5 +981,56 @@ describe('plugin-meetings', () => {
963
981
  assert.equal(result, input);
964
982
  });
965
983
  });
984
+
985
+ describe('getIpVersion', () => {
986
+ let isBrowserStub;
987
+ beforeEach(() => {
988
+ isBrowserStub = sinon.stub().returns(false);
989
+
990
+ sinon.stub(BrowserDetectionModule, 'default').returns({
991
+ isBrowser: isBrowserStub,
992
+ });
993
+ });
994
+
995
+ afterEach(() => {
996
+ sinon.restore();
997
+ });
998
+
999
+ [
1000
+ {supportsIpV4: undefined, supportsIpV6: undefined, expectedOutput: IP_VERSION.unknown},
1001
+ {supportsIpV4: undefined, supportsIpV6: true, expectedOutput: IP_VERSION.only_ipv6},
1002
+ {supportsIpV4: undefined, supportsIpV6: false, expectedOutput: IP_VERSION.unknown},
1003
+ {supportsIpV4: true, supportsIpV6: undefined, expectedOutput: IP_VERSION.only_ipv4},
1004
+ {supportsIpV4: true, supportsIpV6: true, expectedOutput: IP_VERSION.ipv4_and_ipv6},
1005
+ {supportsIpV4: true, supportsIpV6: false, expectedOutput: IP_VERSION.only_ipv4},
1006
+ {supportsIpV4: false, supportsIpV6: undefined, expectedOutput: IP_VERSION.unknown},
1007
+ {supportsIpV4: false, supportsIpV6: true, expectedOutput: IP_VERSION.only_ipv6},
1008
+ {supportsIpV4: false, supportsIpV6: false, expectedOutput: IP_VERSION.unknown},
1009
+ ].forEach(({supportsIpV4, supportsIpV6, expectedOutput}) => {
1010
+ it(`returns ${expectedOutput} when supportsIpV4=${supportsIpV4} and supportsIpV6=${supportsIpV6}`, () => {
1011
+ sinon
1012
+ .stub(webex.internal.device.ipNetworkDetector, 'supportsIpV4')
1013
+ .get(() => supportsIpV4);
1014
+ sinon
1015
+ .stub(webex.internal.device.ipNetworkDetector, 'supportsIpV6')
1016
+ .get(() => supportsIpV6);
1017
+
1018
+ assert.equal(MeetingUtil.getIpVersion(webex), expectedOutput);
1019
+ });
1020
+
1021
+ it(`returns undefined when supportsIpV4=${supportsIpV4} and supportsIpV6=${supportsIpV6} and browser is firefox`, () => {
1022
+ sinon
1023
+ .stub(webex.internal.device.ipNetworkDetector, 'supportsIpV4')
1024
+ .get(() => supportsIpV4);
1025
+ sinon
1026
+ .stub(webex.internal.device.ipNetworkDetector, 'supportsIpV6')
1027
+ .get(() => supportsIpV6);
1028
+
1029
+ isBrowserStub.callsFake((name) => name === 'firefox');
1030
+
1031
+ assert.equal(MeetingUtil.getIpVersion(webex), undefined);
1032
+ });
1033
+ });
1034
+ });
966
1035
  });
967
1036
  });
@@ -20,6 +20,7 @@ import MeetingCollection from '@webex/plugin-meetings/src/meetings/collection';
20
20
  import MeetingsUtil from '@webex/plugin-meetings/src/meetings/util';
21
21
  import PersonalMeetingRoom from '@webex/plugin-meetings/src/personal-meeting-room';
22
22
  import Reachability from '@webex/plugin-meetings/src/reachability';
23
+ import Metrics from '@webex/plugin-meetings/src/metrics';
23
24
 
24
25
  import testUtils from '../../../utils/testUtils';
25
26
  import {
@@ -46,6 +47,8 @@ describe('plugin-meetings', () => {
46
47
  debug: () => {},
47
48
  };
48
49
 
50
+ let triggerProxyStub;
51
+
49
52
  beforeEach(() => {
50
53
  StaticConfig.set({
51
54
  bandwidth: {
@@ -57,7 +60,7 @@ describe('plugin-meetings', () => {
57
60
  verboseEvents: true,
58
61
  enable: false,
59
62
  });
60
- sinon.stub(TriggerProxy, 'trigger').returns(true);
63
+ triggerProxyStub = sinon.stub(TriggerProxy, 'trigger').returns(true);
61
64
  });
62
65
 
63
66
  let webex;
@@ -2092,5 +2095,67 @@ describe('plugin-meetings', () => {
2092
2095
  assert.calledWith(webex.meetings.handleLocusEvent, {locus: breakoutLocus, locusUrl: breakoutLocus.url});
2093
2096
  });
2094
2097
  });
2098
+
2099
+ describe('uploading of logs', () => {
2100
+ let metricsSpy;
2101
+ let meeting;
2102
+
2103
+ beforeEach(async () => {
2104
+ webex.meetings.config.autoUploadLogs = true;
2105
+ webex.meetings.loggerRequest.uploadLogs = sinon.stub().resolves();
2106
+
2107
+ sinon.stub(webex.meetings.meetingInfo, 'fetchInfoOptions').resolves({});
2108
+ sinon.stub(webex.meetings.meetingInfo, 'fetchMeetingInfo').resolves({});
2109
+
2110
+ triggerProxyStub.restore();
2111
+
2112
+ metricsSpy = sinon.stub(Metrics, 'sendBehavioralMetric');
2113
+
2114
+ meeting = await webex.meetings.create('test');
2115
+
2116
+ meeting.locusId = 'locus id';
2117
+ meeting.correlationId = 'correlation id';
2118
+ meeting.locusInfo = {
2119
+ fullState: { lastActive: 'last active'},
2120
+ info: { webExMeetingId: 'meeting id'}
2121
+ }
2122
+ });
2123
+
2124
+ afterEach(() => {
2125
+ sinon.restore();
2126
+ })
2127
+
2128
+ it('sends metrics on success', async () => {
2129
+
2130
+ await meeting.uploadLogs();
2131
+
2132
+ await testUtils.flushPromises();
2133
+
2134
+ assert.calledOnceWithExactly(metricsSpy, 'js_sdk_upload_logs_success', {
2135
+ callStart: 'last active',
2136
+ correlationId: 'correlation id',
2137
+ feedbackId: 'correlation id',
2138
+ locusId: 'locus id',
2139
+ meetingId: 'meeting id',
2140
+ });
2141
+ });
2142
+
2143
+ it('sends metrics on failure', async () => {
2144
+ webex.meetings.loggerRequest.uploadLogs.rejects(new Error('fake error'));
2145
+
2146
+ await meeting.uploadLogs();
2147
+
2148
+ await testUtils.flushPromises();
2149
+
2150
+ assert.calledOnceWithExactly(metricsSpy, 'js_sdk_upload_logs_failure', sinon.match({
2151
+ callStart: 'last active',
2152
+ correlationId: 'correlation id',
2153
+ feedbackId: 'correlation id',
2154
+ locusId: 'locus id',
2155
+ meetingId: 'meeting id',
2156
+ reason: 'fake error',
2157
+ }));
2158
+ });
2159
+ });
2095
2160
  });
2096
2161
  });
@@ -2,6 +2,8 @@ import {assert} from '@webex/test-helper-chai';
2
2
  import MockWebex from '@webex/test-helper-mock-webex';
3
3
  import sinon from 'sinon';
4
4
  import Reachability, {ICECandidateResult} from '@webex/plugin-meetings/src/reachability/';
5
+ import MeetingUtil from '@webex/plugin-meetings/src/meeting/util';
6
+
5
7
  import { IP_VERSION } from '@webex/plugin-meetings/src/constants';
6
8
 
7
9
  describe('isAnyClusterReachable', () => {
@@ -9,6 +11,12 @@ describe('isAnyClusterReachable', () => {
9
11
 
10
12
  beforeEach(() => {
11
13
  webex = new MockWebex();
14
+
15
+ sinon.stub(MeetingUtil, 'getIpVersion').returns(IP_VERSION.unknown);
16
+ });
17
+
18
+ afterEach(() => {
19
+ sinon.restore();
12
20
  });
13
21
 
14
22
  const checkIsClusterReachable = async (mockStorage: any, expectedValue: boolean) => {
@@ -251,12 +259,4 @@ describe('gatherReachability', () => {
251
259
  });
252
260
  });
253
261
  });
254
-
255
- describe('getIpVersion', () => {
256
- it('returns unknown', () => {
257
- const reachability = new Reachability(webex);
258
-
259
- assert.equal(reachability.getIpVersion(), IP_VERSION.unknown);
260
- })
261
- })
262
262
  });
@@ -58,6 +58,9 @@ describe('plugin-meetings', () => {
58
58
  updateMediaConnection: sinon.stub(),
59
59
  },
60
60
  webex: {
61
+ credentials: {
62
+ isUnverifiedGuest: false,
63
+ },
61
64
  meetings: {
62
65
  getMeetingByType: sinon.stub().returns(true),
63
66
  syncMeetings: sinon.stub().resolves({}),
@@ -71,6 +74,24 @@ describe('plugin-meetings', () => {
71
74
  };
72
75
  });
73
76
 
77
+ it('syncs meetings if it is not an unverified guest', async () => {
78
+ const rm = new ReconnectionManager(fakeMeeting);
79
+
80
+ await rm.reconnect();
81
+
82
+ assert.calledOnce(rm.webex.meetings.syncMeetings);
83
+ });
84
+
85
+ it('does not sync meetings if it is an unverified guest', async () => {
86
+ const rm = new ReconnectionManager(fakeMeeting);
87
+
88
+ rm.webex.credentials.isUnverifiedGuest = true;
89
+
90
+ await rm.reconnect();
91
+
92
+ assert.notCalled(rm.webex.meetings.syncMeetings);
93
+ });
94
+
74
95
  it('uses correct TURN TLS information on the reconnection', async () => {
75
96
  const rm = new ReconnectionManager(fakeMeeting);
76
97
 
@@ -6,6 +6,8 @@ import MockWebex from '@webex/test-helper-mock-webex';
6
6
  import RoapRequest from '@webex/plugin-meetings/src/roap/request';
7
7
  import Roap from '@webex/plugin-meetings/src/roap/';
8
8
  import Meeting from '@webex/plugin-meetings/src/meeting';
9
+ import MeetingUtil from '@webex/plugin-meetings/src/meeting/util';
10
+
9
11
  import { IP_VERSION } from '../../../../src/constants';
10
12
 
11
13
  describe('Roap', () => {
@@ -62,9 +64,11 @@ describe('Roap', () => {
62
64
  setRoapSeq: sinon.stub(),
63
65
  config: {experimental: {enableTurnDiscovery: false}},
64
66
  locusMediaRequest: {fake: true},
65
- webex: { meetings: { reachability: { isAnyClusterReachable: () => true, getIpVersion: () => IP_VERSION.unknown}}},
67
+ webex: { meetings: { reachability: { isAnyClusterReachable: () => true}}},
66
68
  };
67
69
 
70
+ sinon.stub(MeetingUtil, 'getIpVersion').returns(IP_VERSION.unknown);
71
+
68
72
  sendRoapStub = sinon.stub(RoapRequest.prototype, 'sendRoap').resolves({});
69
73
  meeting.setRoapSeq.resetHistory();
70
74
  });
@@ -5,6 +5,7 @@ import TurnDiscovery from '@webex/plugin-meetings/src/roap/turnDiscovery';
5
5
  import Metrics from '@webex/plugin-meetings/src/metrics';
6
6
  import BEHAVIORAL_METRICS from '@webex/plugin-meetings/src/metrics/constants';
7
7
  import RoapRequest from '@webex/plugin-meetings/src/roap/request';
8
+ import MeetingUtil from '@webex/plugin-meetings/src/meeting/util';
8
9
 
9
10
  import testUtils from '../../../utils/testUtils';
10
11
  import { IP_VERSION } from '../../../../src/constants';
@@ -24,6 +25,7 @@ describe('TurnDiscovery', () => {
24
25
  clock = sinon.useFakeTimers();
25
26
 
26
27
  sinon.stub(Metrics, 'sendBehavioralMetric');
28
+ sinon.stub(MeetingUtil, 'getIpVersion').returns(IP_VERSION.unknown);
27
29
 
28
30
  mockRoapRequest = {
29
31
  sendRoap: sinon.fake.resolves({mediaConnections: FAKE_MEDIA_CONNECTIONS_FROM_LOCUS}),
@@ -53,7 +55,6 @@ describe('TurnDiscovery', () => {
53
55
  updateMediaConnections: sinon.stub(),
54
56
  webex: {meetings: {reachability: {
55
57
  isAnyClusterReachable: () => Promise.resolve(false),
56
- getIpVersion: () => IP_VERSION.unknown,
57
58
  }}},
58
59
  isMultistream: false,
59
60
  locusMediaRequest: { fake: true },
@@ -73,7 +74,8 @@ describe('TurnDiscovery', () => {
73
74
  await testUtils.flushPromises();
74
75
 
75
76
  assert.calledOnce(mockRoapRequest.sendRoap);
76
- assert.calledWith(mockRoapRequest.sendRoap, {
77
+
78
+ const expectedSendRoapArgs: any = {
77
79
  roapMessage: {
78
80
  messageType,
79
81
  version: '2',
@@ -83,8 +85,13 @@ describe('TurnDiscovery', () => {
83
85
  mediaId: expectedMediaId,
84
86
  meetingId: testMeeting.id,
85
87
  locusMediaRequest: testMeeting.locusMediaRequest,
86
- ipVersion: 0,
87
- });
88
+ };
89
+
90
+ if (messageType === 'TURN_DISCOVERY_REQUEST') {
91
+ expectedSendRoapArgs.ipVersion = 0;
92
+ }
93
+
94
+ assert.calledWith(mockRoapRequest.sendRoap, expectedSendRoapArgs);
88
95
 
89
96
  if (messageType === 'TURN_DISCOVERY_REQUEST') {
90
97
  // check also that we've applied the media connections from the response