Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(plugin-meetings): add to peer connection bare turn tcp server #3808

Merged
merged 5 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions packages/@webex/plugin-meetings/src/media/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,19 @@ Media.createMediaConnection = (
// we might not have any TURN server if TURN discovery failed or wasn't done or
// we might get an empty TURN url if we land on a video mesh node
if (turnServerInfo?.url) {
if (!isBrowser('firefox')) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Limiting it to non-firefox, as we might be not handling it properly with Full-ICE. Once we test it properly with Firefox, we should enable it also for Firefox.

let bareTurnServer = turnServerInfo.url;
bareTurnServer = bareTurnServer.replace('turns:', 'turn:');
bareTurnServer = bareTurnServer.replace('443', '5004');

iceServers.push({
urls: bareTurnServer,
username: turnServerInfo.username || '',
credential: turnServerInfo.password || '',
});
}

// TURN-TLS server
iceServers.push({
urls: turnServerInfo.url,
username: turnServerInfo.username || '',
Expand Down
52 changes: 34 additions & 18 deletions packages/@webex/plugin-meetings/test/unit/spec/media/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,39 +16,39 @@ describe('createMediaConnection', () => {
id: 'roap media connection',
};
const fakeTrack = {
id: 'any fake track'
}
id: 'any fake track',
};
const fakeAudioStream = {
outputStream: {
getTracks: () => {
return [fakeTrack];
}
}
},
},
};
const fakeVideoStream = {
outputStream: {
getTracks: () => {
return [fakeTrack];
}
}
},
},
};
const fakeShareVideoStream = {
outputStream: {
getTracks: () => {
return [fakeTrack];
}
}
},
},
};
const fakeShareAudioStream = {
outputStream: {
getTracks: () => {
return [fakeTrack];
}
}
},
},
};
afterEach(() => {
sinon.restore();
clock.uninstall()
clock.uninstall();
});

it('creates a RoapMediaConnection when multistream is disabled', () => {
Expand Down Expand Up @@ -80,7 +80,7 @@ describe('createMediaConnection', () => {
enableRtx: ENABLE_RTX,
enableExtmap: ENABLE_EXTMAP,
turnServerInfo: {
url: 'turn server url',
url: 'turns:turn-server-url:443?transport=tcp',
username: 'turn username',
password: 'turn password',
},
Expand All @@ -91,7 +91,12 @@ describe('createMediaConnection', () => {
{
iceServers: [
{
urls: 'turn server url',
urls: 'turn:turn-server-url:5004?transport=tcp',
username: 'turn username',
credential: 'turn password',
},
{
urls: 'turns:turn-server-url:443?transport=tcp',
username: 'turn username',
credential: 'turn password',
},
Expand Down Expand Up @@ -146,7 +151,7 @@ describe('createMediaConnection', () => {
},
},
turnServerInfo: {
url: 'turn server url',
url: 'turns:turn-server-url:443?transport=tcp',
username: 'turn username',
password: 'turn password',
},
Expand All @@ -158,7 +163,12 @@ describe('createMediaConnection', () => {
{
iceServers: [
{
urls: 'turn server url',
urls: 'turn:turn-server-url:5004?transport=tcp',
username: 'turn username',
credential: 'turn password',
},
{
urls: 'turns:turn-server-url:443?transport=tcp',
username: 'turn username',
credential: 'turn password',
},
Expand All @@ -171,7 +181,10 @@ describe('createMediaConnection', () => {

[
{testCase: 'turnServerInfo is undefined', turnServerInfo: undefined},
{testCase: 'turnServerInfo.url is empty string', turnServerInfo: {url: '', username: 'turn username', password: 'turn password'}},
{
testCase: 'turnServerInfo.url is empty string',
turnServerInfo: {url: '', username: 'turn username', password: 'turn password'},
},
].forEach(({testCase, turnServerInfo}) => {
it(`passes empty ICE servers array to MultistreamRoapMediaConnection if ${testCase} (multistream enabled)`, () => {
const multistreamRoapMediaConnectionConstructorStub = sinon
Expand All @@ -198,7 +211,7 @@ describe('createMediaConnection', () => {
iceServers: [],
},
'meeting id'
);
);
});
});

Expand Down Expand Up @@ -232,7 +245,10 @@ describe('createMediaConnection', () => {

[
{testCase: 'turnServerInfo is undefined', turnServerInfo: undefined},
{testCase: 'turnServerInfo.url is empty string', turnServerInfo: {url: '', username: 'turn username', password: 'turn password'}},
{
testCase: 'turnServerInfo.url is empty string',
turnServerInfo: {url: '', username: 'turn username', password: 'turn password'},
},
].forEach(({testCase, turnServerInfo}) => {
it(`passes empty ICE servers array to RoapMediaConnection if ${testCase} (multistream disabled)`, () => {
const roapMediaConnectionConstructorStub = sinon
Expand Down
Loading
Loading