From 94c7de6c65fbaf04b50dc45de57a370df071b3d0 Mon Sep 17 00:00:00 2001 From: adel-signal Date: Fri, 29 Mar 2024 10:17:56 -0700 Subject: [PATCH] calling: update getIceServers to use new turn routing endpoint Co-authored-by: Adel Lahlou --- ts/services/calling.ts | 10 +++++++++- ts/textsecure/WebAPI.ts | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ts/services/calling.ts b/ts/services/calling.ts index f64af71909..9003f7091d 100644 --- a/ts/services/calling.ts +++ b/ts/services/calling.ts @@ -2613,12 +2613,20 @@ export class CallingClass { const isContactUntrusted = !isInSystemContacts(conversation.attributes); const callSettings = { + // only include hostname with urlsWithIps + // proritize ice servers with IPs to avoid DNS iceServers: [ + { + hostname: iceServer.hostname, + username: iceServer.username, + password: iceServer.password, + urls: (iceServer.urlsWithIps ?? []).slice(), + }, { hostname: '', username: iceServer.username, password: iceServer.password, - urls: iceServer.urls.slice(), + urls: (iceServer.urls ?? []).slice(), }, ], hideIp: shouldRelayCalls || isContactUntrusted, diff --git a/ts/textsecure/WebAPI.ts b/ts/textsecure/WebAPI.ts index 0344ec0928..7547c6e8af 100644 --- a/ts/textsecure/WebAPI.ts +++ b/ts/textsecure/WebAPI.ts @@ -503,7 +503,7 @@ const URL_CALLS = { discovery: 'v1/discovery', getGroupAvatarUpload: 'v1/groups/avatar/form', getGroupCredentials: 'v1/certificate/auth/group', - getIceServers: 'v1/accounts/turn', + getIceServers: 'v1/calling/relays', getOnboardingStoryManifest: 'dynamic/desktop/stories/onboarding/manifest.json', getStickerPackUpload: 'v1/sticker/pack/form', @@ -735,6 +735,8 @@ export type GetIceServersResultType = Readonly<{ username: string; password: string; urls: ReadonlyArray; + urlsWithIps: ReadonlyArray; + hostname: string; }>; export type GetDevicesResultType = ReadonlyArray<