@webex/plugin-meetings 2.24.1 → 2.26.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/common/logs/logger-proxy.js +7 -6
- package/dist/common/logs/logger-proxy.js.map +1 -1
- package/dist/config.js +2 -1
- package/dist/config.js.map +1 -1
- package/dist/constants.js +4 -11
- package/dist/constants.js.map +1 -1
- package/dist/media/properties.js +2 -2
- package/dist/media/properties.js.map +1 -1
- package/dist/media/util.js +18 -4
- package/dist/media/util.js.map +1 -1
- package/dist/meeting/index.js +9 -5
- package/dist/meeting/index.js.map +1 -1
- package/dist/metrics/constants.js +2 -1
- package/dist/metrics/constants.js.map +1 -1
- package/dist/peer-connection-manager/index.js +6 -4
- package/dist/peer-connection-manager/index.js.map +1 -1
- package/dist/reconnection-manager/index.js +40 -14
- package/dist/reconnection-manager/index.js.map +1 -1
- package/dist/roap/handler.js +0 -2
- package/dist/roap/handler.js.map +1 -1
- package/dist/roap/index.js +36 -7
- package/dist/roap/index.js.map +1 -1
- package/dist/roap/request.js +5 -3
- package/dist/roap/request.js.map +1 -1
- package/dist/roap/turnDiscovery.js +273 -0
- package/dist/roap/turnDiscovery.js.map +1 -0
- package/dist/roap/util.js +0 -2
- package/dist/roap/util.js.map +1 -1
- package/package.json +5 -5
- package/src/common/logs/logger-proxy.js +7 -6
- package/src/config.js +2 -1
- package/src/constants.ts +3 -4
- package/src/media/properties.js +2 -2
- package/src/media/util.js +17 -7
- package/src/meeting/index.js +9 -7
- package/src/metrics/constants.js +2 -1
- package/src/peer-connection-manager/index.js +6 -3
- package/src/reconnection-manager/index.js +13 -10
- package/src/roap/handler.js +0 -2
- package/src/roap/index.js +36 -6
- package/src/roap/request.js +5 -3
- package/src/roap/turnDiscovery.ts +238 -0
- package/src/roap/util.js +0 -2
- package/test/unit/spec/meeting/index.js +47 -0
- package/test/unit/spec/peerconnection-manager/index.js +47 -4
- package/test/unit/spec/roap/index.ts +113 -0
- package/test/unit/spec/roap/turnDiscovery.ts +334 -0
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import {Defer} from '@webex/common';
|
|
2
|
+
|
|
3
|
+
import Metrics from '../metrics';
|
|
4
|
+
import BEHAVIORAL_METRICS from '../metrics/constants';
|
|
5
|
+
import LoggerProxy from '../common/logs/logger-proxy';
|
|
6
|
+
import {ROAP} from '../constants';
|
|
7
|
+
|
|
8
|
+
import RoapRequest from './request';
|
|
9
|
+
|
|
10
|
+
const TURN_DISCOVERY_TIMEOUT = 10; // in seconds
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Handles the process of finding out TURN server information from Linus.
|
|
14
|
+
* This is achieved by sending a TURN_DISCOVERY_REQUEST.
|
|
15
|
+
*/
|
|
16
|
+
export default class TurnDiscovery {
|
|
17
|
+
private roapRequest: RoapRequest;
|
|
18
|
+
|
|
19
|
+
private defer?: Defer; // used for waiting for the response
|
|
20
|
+
|
|
21
|
+
private turnInfo: {
|
|
22
|
+
url: string;
|
|
23
|
+
username: string;
|
|
24
|
+
password: string;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
private responseTimer?: ReturnType<typeof setTimeout>;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Constructor
|
|
31
|
+
*
|
|
32
|
+
* @param {RoapRequest} roapRequest
|
|
33
|
+
*/
|
|
34
|
+
constructor(roapRequest: RoapRequest) {
|
|
35
|
+
this.roapRequest = roapRequest;
|
|
36
|
+
this.turnInfo = {
|
|
37
|
+
url: '',
|
|
38
|
+
username: '',
|
|
39
|
+
password: '',
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* waits for TURN_DISCOVERY_RESPONSE message to arrive
|
|
46
|
+
*
|
|
47
|
+
* @returns {Promise}
|
|
48
|
+
* @private
|
|
49
|
+
* @memberof Roap
|
|
50
|
+
*/
|
|
51
|
+
waitForTurnDiscoveryResponse() {
|
|
52
|
+
if (!this.defer) {
|
|
53
|
+
LoggerProxy.logger.warn('Roap:turnDiscovery#waitForTurnDiscoveryResponse --> TURN discovery is not in progress');
|
|
54
|
+
|
|
55
|
+
return Promise.reject(new Error('waitForTurnDiscoveryResponse() called before sendRoapTurnDiscoveryRequest()'));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const {defer} = this;
|
|
59
|
+
|
|
60
|
+
this.responseTimer = setTimeout(() => {
|
|
61
|
+
LoggerProxy.logger.warn(`Roap:turnDiscovery#waitForTurnDiscoveryResponse --> timeout! no response arrived within ${TURN_DISCOVERY_TIMEOUT} seconds`);
|
|
62
|
+
|
|
63
|
+
defer.reject(new Error('Timed out waiting for TURN_DISCOVERY_RESPONSE'));
|
|
64
|
+
}, TURN_DISCOVERY_TIMEOUT * 1000);
|
|
65
|
+
|
|
66
|
+
LoggerProxy.logger.info('Roap:turnDiscovery#waitForTurnDiscoveryResponse --> waiting for TURN_DISCOVERY_RESPONSE...');
|
|
67
|
+
|
|
68
|
+
return defer.promise;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* handles TURN_DISCOVERY_RESPONSE roap message
|
|
73
|
+
*
|
|
74
|
+
* @param {Object} roapMessage
|
|
75
|
+
* @returns {void}
|
|
76
|
+
* @public
|
|
77
|
+
* @memberof Roap
|
|
78
|
+
*/
|
|
79
|
+
handleTurnDiscoveryResponse(roapMessage) {
|
|
80
|
+
const {headers} = roapMessage;
|
|
81
|
+
|
|
82
|
+
if (!this.defer) {
|
|
83
|
+
LoggerProxy.logger.warn('Roap:turnDiscovery#handleTurnDiscoveryResponse --> unexpected TURN discovery response');
|
|
84
|
+
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const expectedHeaders = [
|
|
89
|
+
{headerName: 'x-cisco-turn-url', field: 'url'},
|
|
90
|
+
{headerName: 'x-cisco-turn-username', field: 'username'},
|
|
91
|
+
{headerName: 'x-cisco-turn-password', field: 'password'},
|
|
92
|
+
];
|
|
93
|
+
|
|
94
|
+
let foundHeaders = 0;
|
|
95
|
+
|
|
96
|
+
headers?.forEach((receivedHeader) => {
|
|
97
|
+
// check if it matches any of our expected headers
|
|
98
|
+
expectedHeaders.forEach((expectedHeader) => {
|
|
99
|
+
if (receivedHeader.startsWith(`${expectedHeader.headerName}=`)) {
|
|
100
|
+
this.turnInfo[expectedHeader.field] = receivedHeader.substring(expectedHeader.headerName.length + 1);
|
|
101
|
+
foundHeaders += 1;
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
clearTimeout(this.responseTimer);
|
|
107
|
+
this.responseTimer = undefined;
|
|
108
|
+
|
|
109
|
+
if (foundHeaders !== expectedHeaders.length) {
|
|
110
|
+
LoggerProxy.logger.warn(`Roap:turnDiscovery#handleTurnDiscoveryResponse --> missing some headers, received: ${JSON.stringify(headers)}`);
|
|
111
|
+
this.defer.reject(new Error(`TURN_DISCOVERY_RESPONSE missing some headers: ${JSON.stringify(headers)}`));
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
LoggerProxy.logger.info(`Roap:turnDiscovery#handleTurnDiscoveryResponse --> received a valid response, url=${this.turnInfo.url}`);
|
|
115
|
+
this.defer.resolve();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* sends the TURN_DISCOVERY_REQUEST roap request
|
|
121
|
+
*
|
|
122
|
+
* @param {Meeting} meeting
|
|
123
|
+
* @param {Boolean} isReconnecting
|
|
124
|
+
* @returns {Promise}
|
|
125
|
+
* @private
|
|
126
|
+
* @memberof Roap
|
|
127
|
+
*/
|
|
128
|
+
sendRoapTurnDiscoveryRequest(meeting, isReconnecting) {
|
|
129
|
+
const seq = meeting.roapSeq + 1;
|
|
130
|
+
|
|
131
|
+
if (this.defer) {
|
|
132
|
+
LoggerProxy.logger.warn('Roap:turnDiscovery#sendRoapTurnDiscoveryRequest --> already in progress');
|
|
133
|
+
|
|
134
|
+
return Promise.resolve();
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
this.defer = new Defer();
|
|
138
|
+
|
|
139
|
+
const roapMessage = {
|
|
140
|
+
messageType: ROAP.ROAP_TYPES.TURN_DISCOVERY_REQUEST,
|
|
141
|
+
version: ROAP.ROAP_VERSION,
|
|
142
|
+
seq,
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
LoggerProxy.logger.info('Roap:turnDiscovery#sendRoapTurnDiscoveryRequest --> sending TURN_DISCOVERY_REQUEST');
|
|
146
|
+
|
|
147
|
+
return this.roapRequest
|
|
148
|
+
.sendRoap({
|
|
149
|
+
roapMessage,
|
|
150
|
+
correlationId: meeting.correlationId,
|
|
151
|
+
locusSelfUrl: meeting.selfUrl,
|
|
152
|
+
mediaId: isReconnecting ? '' : meeting.mediaId,
|
|
153
|
+
audioMuted: meeting.isAudioMuted(),
|
|
154
|
+
videoMuted: meeting.isVideoMuted(),
|
|
155
|
+
meetingId: meeting.id
|
|
156
|
+
})
|
|
157
|
+
.then(({mediaConnections}) => {
|
|
158
|
+
meeting.setRoapSeq(seq);
|
|
159
|
+
|
|
160
|
+
if (mediaConnections) {
|
|
161
|
+
meeting.updateMediaConnections(mediaConnections);
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Sends the OK message that server expects to receive
|
|
168
|
+
* after it sends us TURN_DISCOVERY_RESPONSE
|
|
169
|
+
*
|
|
170
|
+
* @param {Meeting} meeting
|
|
171
|
+
* @returns {Promise}
|
|
172
|
+
*/
|
|
173
|
+
sendRoapOK(meeting) {
|
|
174
|
+
LoggerProxy.logger.info('Roap:turnDiscovery#sendRoapOK --> sending OK');
|
|
175
|
+
|
|
176
|
+
return this.roapRequest.sendRoap({
|
|
177
|
+
roapMessage: {
|
|
178
|
+
messageType: ROAP.ROAP_TYPES.OK,
|
|
179
|
+
version: ROAP.ROAP_VERSION,
|
|
180
|
+
seq: meeting.roapSeq
|
|
181
|
+
},
|
|
182
|
+
locusSelfUrl: meeting.selfUrl,
|
|
183
|
+
mediaId: meeting.mediaId,
|
|
184
|
+
correlationId: meeting.correlationId,
|
|
185
|
+
audioMuted: meeting.isAudioMuted(),
|
|
186
|
+
videoMuted: meeting.isVideoMuted(),
|
|
187
|
+
meetingId: meeting.id
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Retrieves TURN server information from the backend by doing
|
|
193
|
+
* a roap message exchange:
|
|
194
|
+
* client server
|
|
195
|
+
* | -----TURN_DISCOVERY_REQUEST-----> |
|
|
196
|
+
* | <----TURN_DISCOVERY_RESPONSE----- |
|
|
197
|
+
* | --------------OK----------------> |
|
|
198
|
+
*
|
|
199
|
+
* @param {Meeting} meeting
|
|
200
|
+
* @param {Boolean} isReconnecting should be set to true if this is a new
|
|
201
|
+
* media connection just after a reconnection
|
|
202
|
+
* @returns {Promise}
|
|
203
|
+
*/
|
|
204
|
+
doTurnDiscovery(meeting, isReconnecting) {
|
|
205
|
+
if (!meeting.config.experimental.enableTurnDiscovery) {
|
|
206
|
+
LoggerProxy.logger.info('Roap:turnDiscovery#doTurnDiscovery --> TURN discovery disabled in config, skipping it');
|
|
207
|
+
|
|
208
|
+
return Promise.resolve(undefined);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return this.sendRoapTurnDiscoveryRequest(meeting, isReconnecting)
|
|
212
|
+
.then(() => this.waitForTurnDiscoveryResponse())
|
|
213
|
+
.then(() => this.sendRoapOK(meeting))
|
|
214
|
+
.then(() => {
|
|
215
|
+
this.defer = undefined;
|
|
216
|
+
|
|
217
|
+
LoggerProxy.logger.info('Roap:turnDiscovery#doTurnDiscovery --> TURN discovery completed');
|
|
218
|
+
|
|
219
|
+
return this.turnInfo;
|
|
220
|
+
})
|
|
221
|
+
.catch((e) => {
|
|
222
|
+
// we catch any errors and resolve with no turn information so that the normal call join flow can continue without TURN
|
|
223
|
+
LoggerProxy.logger.info(`Roap:turnDiscovery#doTurnDiscovery --> TURN discovery failed, continuing without TURN: ${e}`);
|
|
224
|
+
|
|
225
|
+
Metrics.sendBehavioralMetric(
|
|
226
|
+
BEHAVIORAL_METRICS.TURN_DISCOVERY_FAILURE,
|
|
227
|
+
{
|
|
228
|
+
correlation_id: meeting.correlationId,
|
|
229
|
+
locus_id: meeting.locusUrl.split('/').pop(),
|
|
230
|
+
reason: e.message,
|
|
231
|
+
stack: e.stack
|
|
232
|
+
}
|
|
233
|
+
);
|
|
234
|
+
|
|
235
|
+
return Promise.resolve(undefined);
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
}
|
package/src/roap/util.js
CHANGED
|
@@ -893,6 +893,7 @@ describe('plugin-meetings', () => {
|
|
|
893
893
|
meeting.mediaProperties.peerConnection.connectionState = CONSTANTS.CONNECTION_STATE.CONNECTED;
|
|
894
894
|
resolve();
|
|
895
895
|
}));
|
|
896
|
+
meeting.roap.doTurnDiscovery = sinon.stub().resolves();
|
|
896
897
|
PeerConnectionManager.setContentSlides = sinon.stub().returns(true);
|
|
897
898
|
});
|
|
898
899
|
|
|
@@ -1008,22 +1009,56 @@ describe('plugin-meetings', () => {
|
|
|
1008
1009
|
|
|
1009
1010
|
it('should attach the media and return promise', async () => {
|
|
1010
1011
|
meeting.meetingState = 'ACTIVE';
|
|
1012
|
+
MediaUtil.createPeerConnection.resetHistory();
|
|
1011
1013
|
const media = meeting.addMedia({
|
|
1012
1014
|
mediaSettings: {}
|
|
1013
1015
|
});
|
|
1014
1016
|
|
|
1015
1017
|
assert.exists(media);
|
|
1016
1018
|
await media;
|
|
1019
|
+
assert.calledOnce(meeting.roap.doTurnDiscovery);
|
|
1020
|
+
assert.calledWith(meeting.roap.doTurnDiscovery, meeting, false);
|
|
1017
1021
|
assert.calledOnce(meeting.mediaProperties.setMediaDirection);
|
|
1018
1022
|
assert.calledOnce(Media.attachMedia);
|
|
1019
1023
|
assert.calledOnce(meeting.setMercuryListener);
|
|
1020
1024
|
assert.calledOnce(meeting.setRemoteStream);
|
|
1021
1025
|
assert.calledOnce(meeting.roap.sendRoapMediaRequest);
|
|
1026
|
+
assert.calledOnce(MediaUtil.createPeerConnection);
|
|
1027
|
+
assert.calledWith(MediaUtil.createPeerConnection, undefined);
|
|
1022
1028
|
/* statsAnalyzer is initiated inside of addMedia so there isn't
|
|
1023
1029
|
* a good way to mock it without mocking the constructor
|
|
1024
1030
|
*/
|
|
1025
1031
|
});
|
|
1026
1032
|
|
|
1033
|
+
it('should pass the turn server info to the peer connection', async () => {
|
|
1034
|
+
const FAKE_TURN_URL = 'turns:webex.com:3478';
|
|
1035
|
+
const FAKE_TURN_USER = 'some-turn-username';
|
|
1036
|
+
const FAKE_TURN_PASSWORD = 'some-password';
|
|
1037
|
+
|
|
1038
|
+
meeting.meetingState = 'ACTIVE';
|
|
1039
|
+
MediaUtil.createPeerConnection.resetHistory();
|
|
1040
|
+
|
|
1041
|
+
meeting.roap.doTurnDiscovery = sinon.stub().resolves({
|
|
1042
|
+
url: FAKE_TURN_URL,
|
|
1043
|
+
username: FAKE_TURN_USER,
|
|
1044
|
+
password: FAKE_TURN_PASSWORD
|
|
1045
|
+
});
|
|
1046
|
+
const media = meeting.addMedia({
|
|
1047
|
+
mediaSettings: {}
|
|
1048
|
+
});
|
|
1049
|
+
|
|
1050
|
+
assert.exists(media);
|
|
1051
|
+
await media;
|
|
1052
|
+
assert.calledOnce(meeting.roap.doTurnDiscovery);
|
|
1053
|
+
assert.calledWith(meeting.roap.doTurnDiscovery, meeting, false);
|
|
1054
|
+
assert.calledOnce(MediaUtil.createPeerConnection);
|
|
1055
|
+
assert.calledWith(MediaUtil.createPeerConnection, {
|
|
1056
|
+
url: FAKE_TURN_URL,
|
|
1057
|
+
username: FAKE_TURN_USER,
|
|
1058
|
+
password: FAKE_TURN_PASSWORD
|
|
1059
|
+
});
|
|
1060
|
+
});
|
|
1061
|
+
|
|
1027
1062
|
it('should attach the media and return promise', async () => {
|
|
1028
1063
|
meeting.meetingState = 'ACTIVE';
|
|
1029
1064
|
meeting.mediaProperties.peerConnection.connectionState = 'DISCONNECTED';
|
|
@@ -1948,6 +1983,18 @@ describe('plugin-meetings', () => {
|
|
|
1948
1983
|
assert.isRejected(meeting.changeVideoLayout(layoutType));
|
|
1949
1984
|
});
|
|
1950
1985
|
|
|
1986
|
+
it('should send no layoutType when layoutType is not provided', async () => {
|
|
1987
|
+
await meeting.changeVideoLayout(undefined, {main: {width: 100, height: 200}});
|
|
1988
|
+
|
|
1989
|
+
assert.calledWith(meeting.meetingRequest.changeVideoLayoutDebounced, {
|
|
1990
|
+
locusUrl: meeting.locusInfo.self.url,
|
|
1991
|
+
deviceUrl: meeting.deviceUrl,
|
|
1992
|
+
layoutType: undefined,
|
|
1993
|
+
main: {width: 100, height: 200},
|
|
1994
|
+
content: undefined
|
|
1995
|
+
});
|
|
1996
|
+
});
|
|
1997
|
+
|
|
1951
1998
|
it('throws if trying to send renderInfo for content when not receiving content', async () => {
|
|
1952
1999
|
assert.isRejected(meeting.changeVideoLayout(layoutTypeSingle, {content: {width: 1280, height: 720}}));
|
|
1953
2000
|
});
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import 'jsdom-global/register';
|
|
2
2
|
import {assert} from '@webex/test-helper-chai';
|
|
3
3
|
import sinon from 'sinon';
|
|
4
|
+
|
|
4
5
|
import PeerConnectionManager from '@webex/plugin-meetings/src/peer-connection-manager/index';
|
|
5
6
|
import StaticConfig from '@webex/plugin-meetings/src/common/config';
|
|
6
|
-
import {
|
|
7
|
+
import {InvalidSdpError} from '@webex/plugin-meetings/src/common/errors/webex-errors';
|
|
7
8
|
|
|
8
9
|
describe('Peerconnection Manager', () => {
|
|
9
10
|
describe('Methods', () => {
|
|
@@ -85,6 +86,45 @@ describe('Peerconnection Manager', () => {
|
|
|
85
86
|
|
|
86
87
|
assert.equal(result.sdp, remoteSdp);
|
|
87
88
|
});
|
|
89
|
+
|
|
90
|
+
it('removes xTLS candidates from the remote sdp', async () => {
|
|
91
|
+
StaticConfig.set({bandwidth: {}});
|
|
92
|
+
|
|
93
|
+
const remoteSdpWithXtlsCandidates = 'v=0\r\n' +
|
|
94
|
+
'm=video 5004 UDP/TLS/RTP/SAVPF 102 127 97 99\r\n' +
|
|
95
|
+
'a=candidate:1 1 UDP 2130706175 18.206.82.54 9000 typ host\r\n' +
|
|
96
|
+
'a=candidate:2 1 TCP 1962934271 18.206.82.54 5004 typ host tcptype passive\r\n' +
|
|
97
|
+
'a=candidate:3 1 TCP 1962934015 18.206.82.54 9000 typ host tcptype passive\r\n' +
|
|
98
|
+
'a=candidate:4 1 xTLS 1795162111 external-media2.aintm-a-6.int.infra.webex.com 443 typ host tcptype passive fingerprint sha-1;55:B8:1D:94:BC:9D:B2:A5:5E:82:E7:84:C6:C8:10:AC:D3:FD:96:26\r\n' +
|
|
99
|
+
'a=rtpmap:127 H264/90000\r\n' +
|
|
100
|
+
'a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\n' +
|
|
101
|
+
'm=video 9000 UDP/TLS/RTP/SAVPF 102 127 97 99\r\n' +
|
|
102
|
+
'a=candidate:1 1 xTLS 1795162111 external-media2.aintm-a-6.int.infra.webex.com 443 typ host tcptype passive fingerprint sha-1;55:B8:1D:94:BC:9D:B2:A5:5E:82:E7:84:C6:C8:10:AC:D3:FD:96:26\r\n' +
|
|
103
|
+
'a=candidate:2 1 TCP 1962934271 18.206.82.54 5004 typ host tcptype passive\r\n' +
|
|
104
|
+
'a=fmtp:127 profile-level-id=42e016;max-mbps=244800;max-fs=8160;max-fps=3000;max-dpb=12240;max-rcmd-nalu-size=196608;level-asymmetry-allowed=1\r\n';
|
|
105
|
+
|
|
106
|
+
// same as remoteSdpWithXtlsCandidates but without the xtls candidates
|
|
107
|
+
const resultSdp = 'v=0\r\n' +
|
|
108
|
+
'm=video 5004 UDP/TLS/RTP/SAVPF 102 127 97 99\r\n' +
|
|
109
|
+
'a=candidate:1 1 UDP 2130706175 18.206.82.54 9000 typ host\r\n' +
|
|
110
|
+
'a=candidate:2 1 TCP 1962934271 18.206.82.54 5004 typ host tcptype passive\r\n' +
|
|
111
|
+
'a=candidate:3 1 TCP 1962934015 18.206.82.54 9000 typ host tcptype passive\r\n' +
|
|
112
|
+
'a=rtpmap:127 H264/90000\r\n' +
|
|
113
|
+
'a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\n' +
|
|
114
|
+
'm=video 9000 UDP/TLS/RTP/SAVPF 102 127 97 99\r\n' +
|
|
115
|
+
'a=candidate:2 1 TCP 1962934271 18.206.82.54 5004 typ host tcptype passive\r\n' +
|
|
116
|
+
'a=fmtp:127 profile-level-id=42e016;max-mbps=244800;max-fs=8160;max-fps=3000;max-dpb=12240;max-rcmd-nalu-size=196608;level-asymmetry-allowed=1\r\n';
|
|
117
|
+
|
|
118
|
+
const peerConnection = {
|
|
119
|
+
signalingState: 'have-local-offer',
|
|
120
|
+
setRemoteDescription: sinon.stub().resolves(),
|
|
121
|
+
enableExtmap: true
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
await PeerConnectionManager.setRemoteSessionDetails(peerConnection, 'answer', remoteSdpWithXtlsCandidates, '');
|
|
125
|
+
|
|
126
|
+
assert.calledWith(peerConnection.setRemoteDescription, new global.window.RTCSessionDescription({sdp: resultSdp, type: 'answer'}));
|
|
127
|
+
});
|
|
88
128
|
});
|
|
89
129
|
|
|
90
130
|
describe('iceCandidate', () => {
|
|
@@ -123,13 +163,16 @@ describe('Peerconnection Manager', () => {
|
|
|
123
163
|
});
|
|
124
164
|
});
|
|
125
165
|
|
|
126
|
-
it('should
|
|
166
|
+
it('should still generate sdp even if onicecandidateerror is called ', async () => {
|
|
127
167
|
peerConnection.iceGatheringState = 'none';
|
|
128
168
|
setTimeout(() => {
|
|
129
169
|
peerConnection.onicecandidateerror();
|
|
170
|
+
peerConnection.onicecandidate({candidate: null});
|
|
130
171
|
}, 1000);
|
|
131
|
-
await
|
|
132
|
-
|
|
172
|
+
await PeerConnectionManager.iceCandidate(peerConnection, {remoteQualityLevel: 'HIGH'})
|
|
173
|
+
.then(() => {
|
|
174
|
+
assert(peerConnection.sdp.search('max-fs:8192'), true);
|
|
175
|
+
});
|
|
133
176
|
});
|
|
134
177
|
|
|
135
178
|
it('should throw generated SDP does not have candidates ', async () => {
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import {assert} from '@webex/test-helper-chai';
|
|
2
|
+
import sinon from 'sinon';
|
|
3
|
+
import TurnDiscovery from '@webex/plugin-meetings/src/roap/turnDiscovery';
|
|
4
|
+
import {ROAP} from '@webex/plugin-meetings/src/constants';
|
|
5
|
+
|
|
6
|
+
import RoapRequest from '@webex/plugin-meetings/src/roap/request';
|
|
7
|
+
import RoapHandler from '@webex/plugin-meetings/src/roap/handler';
|
|
8
|
+
import Roap from '@webex/plugin-meetings/src/roap/';
|
|
9
|
+
|
|
10
|
+
describe('Roap', () => {
|
|
11
|
+
describe('doTurnDiscovery', () => {
|
|
12
|
+
it('calls this.turnDiscovery.doTurnDiscovery() and forwards all the arguments', async () => {
|
|
13
|
+
const RESULT = {something: 'some value'};
|
|
14
|
+
const meeting = {id: 'some meeting id'};
|
|
15
|
+
|
|
16
|
+
const doTurnDiscoveryStub = sinon.stub(TurnDiscovery.prototype, 'doTurnDiscovery').resolves(RESULT);
|
|
17
|
+
|
|
18
|
+
const roap = new Roap({}, {parent: 'fake'});
|
|
19
|
+
|
|
20
|
+
// call with isReconnecting: true
|
|
21
|
+
const result = await roap.doTurnDiscovery(meeting, true);
|
|
22
|
+
|
|
23
|
+
assert.calledOnceWithExactly(doTurnDiscoveryStub, meeting, true);
|
|
24
|
+
assert.deepEqual(result, RESULT);
|
|
25
|
+
|
|
26
|
+
doTurnDiscoveryStub.resetHistory();
|
|
27
|
+
|
|
28
|
+
// and with isReconnecting: false
|
|
29
|
+
const result2 = await roap.doTurnDiscovery(meeting, false);
|
|
30
|
+
|
|
31
|
+
assert.calledOnceWithExactly(doTurnDiscoveryStub, meeting, false);
|
|
32
|
+
assert.deepEqual(result2, RESULT);
|
|
33
|
+
|
|
34
|
+
sinon.restore();
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
describe('sendRoapMediaRequest', () => {
|
|
39
|
+
let sendRoapStub;
|
|
40
|
+
let roapHandlerSubmitStub;
|
|
41
|
+
|
|
42
|
+
const meeting = {
|
|
43
|
+
id: 'some meeting id',
|
|
44
|
+
correlationId: 'correlation id',
|
|
45
|
+
selfUrl: 'self url',
|
|
46
|
+
mediaId: 'media id',
|
|
47
|
+
isAudioMuted: () => true,
|
|
48
|
+
isVideoMuted: () => false,
|
|
49
|
+
setRoapSeq: sinon.stub(),
|
|
50
|
+
config: {experimental: {enableTurnDiscovery: false}},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
beforeEach(() => {
|
|
54
|
+
sendRoapStub = sinon.stub(RoapRequest.prototype, 'sendRoap').resolves({});
|
|
55
|
+
roapHandlerSubmitStub = sinon.stub(RoapHandler.prototype, 'submit');
|
|
56
|
+
meeting.setRoapSeq.resetHistory();
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
afterEach(() => {
|
|
60
|
+
sinon.restore();
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
[
|
|
64
|
+
{reconnect: true, enableTurnDiscovery: true, expectEmptyMediaId: false},
|
|
65
|
+
{reconnect: true, enableTurnDiscovery: false, expectEmptyMediaId: true},
|
|
66
|
+
{reconnect: false, enableTurnDiscovery: true, expectEmptyMediaId: false},
|
|
67
|
+
{reconnect: false, enableTurnDiscovery: false, expectEmptyMediaId: false},
|
|
68
|
+
].forEach(({reconnect, enableTurnDiscovery, expectEmptyMediaId}) =>
|
|
69
|
+
it(`sends roap OFFER with ${expectEmptyMediaId ? 'empty ' : ''}mediaId when ${reconnect ? '' : 'not '}reconnecting and TURN discovery is ${enableTurnDiscovery ? 'enabled' : 'disabled'}`, async () => {
|
|
70
|
+
meeting.config.experimental.enableTurnDiscovery = enableTurnDiscovery;
|
|
71
|
+
|
|
72
|
+
const roap = new Roap({}, {parent: 'fake'});
|
|
73
|
+
|
|
74
|
+
await roap.sendRoapMediaRequest({
|
|
75
|
+
meeting, sdp: 'sdp', reconnect, roapSeq: 1
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const expectedRoapMessage = {
|
|
79
|
+
messageType: 'OFFER',
|
|
80
|
+
sdps: ['sdp'],
|
|
81
|
+
version: '2',
|
|
82
|
+
seq: 2,
|
|
83
|
+
tieBreaker: 4294967294
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
assert.calledOnce(sendRoapStub);
|
|
87
|
+
assert.calledWith(sendRoapStub, {
|
|
88
|
+
roapMessage: expectedRoapMessage,
|
|
89
|
+
correlationId: meeting.correlationId,
|
|
90
|
+
locusSelfUrl: meeting.selfUrl,
|
|
91
|
+
mediaId: expectEmptyMediaId ? '' : meeting.mediaId,
|
|
92
|
+
audioMuted: meeting.isAudioMuted(),
|
|
93
|
+
videoMuted: meeting.isVideoMuted(),
|
|
94
|
+
meetingId: meeting.id
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
assert.calledTwice(roapHandlerSubmitStub);
|
|
98
|
+
assert.calledWith(roapHandlerSubmitStub, {
|
|
99
|
+
type: ROAP.SEND_ROAP_MSG,
|
|
100
|
+
msg: expectedRoapMessage,
|
|
101
|
+
correlationId: meeting.correlationId
|
|
102
|
+
});
|
|
103
|
+
assert.calledWith(roapHandlerSubmitStub, {
|
|
104
|
+
type: ROAP.SEND_ROAP_MSG_SUCCESS,
|
|
105
|
+
seq: 2,
|
|
106
|
+
correlationId: meeting.correlationId
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
assert.calledOnce(meeting.setRoapSeq);
|
|
110
|
+
assert.calledWith(meeting.setRoapSeq, 2);
|
|
111
|
+
}));
|
|
112
|
+
});
|
|
113
|
+
});
|