Skip to content

Commit cb287f2

Browse files
authored
Extend TURN servers with tcp variant (#544)
1 parent d9f9c75 commit cb287f2

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/rpc/dial.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,17 @@ const processWebRTCOpts = async (
448448
);
449449
const additionalIceServers: RTCIceServer[] = config.additionalIceServers.map(
450450
(ice) => {
451+
const iceUrls = [];
452+
// always extend the list with tcp variants in order to facilitate cases
453+
// where udp might be blocked
454+
for (const iUrl of ice.urls) {
455+
if (iUrl.endsWith('udp')) {
456+
iceUrls.push(`${iUrl.slice(0, -3)}tcp`);
457+
}
458+
iceUrls.push(iUrl);
459+
}
451460
return {
452-
urls: ice.urls,
461+
urls: iceUrls,
453462
credential: ice.credential,
454463
username: ice.username,
455464
};

0 commit comments

Comments
 (0)