calling: update getIceServers to use new turn routing endpoint

Co-authored-by: Adel Lahlou <adel@signal.com>
This commit is contained in:
adel-signal 2024-03-29 10:17:56 -07:00 committed by GitHub
parent 32223acf5b
commit 94c7de6c65
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 2 deletions

View file

@ -2613,12 +2613,20 @@ export class CallingClass {
const isContactUntrusted = !isInSystemContacts(conversation.attributes); const isContactUntrusted = !isInSystemContacts(conversation.attributes);
const callSettings = { const callSettings = {
// only include hostname with urlsWithIps
// proritize ice servers with IPs to avoid DNS
iceServers: [ iceServers: [
{
hostname: iceServer.hostname,
username: iceServer.username,
password: iceServer.password,
urls: (iceServer.urlsWithIps ?? []).slice(),
},
{ {
hostname: '', hostname: '',
username: iceServer.username, username: iceServer.username,
password: iceServer.password, password: iceServer.password,
urls: iceServer.urls.slice(), urls: (iceServer.urls ?? []).slice(),
}, },
], ],
hideIp: shouldRelayCalls || isContactUntrusted, hideIp: shouldRelayCalls || isContactUntrusted,

View file

@ -503,7 +503,7 @@ const URL_CALLS = {
discovery: 'v1/discovery', discovery: 'v1/discovery',
getGroupAvatarUpload: 'v1/groups/avatar/form', getGroupAvatarUpload: 'v1/groups/avatar/form',
getGroupCredentials: 'v1/certificate/auth/group', getGroupCredentials: 'v1/certificate/auth/group',
getIceServers: 'v1/accounts/turn', getIceServers: 'v1/calling/relays',
getOnboardingStoryManifest: getOnboardingStoryManifest:
'dynamic/desktop/stories/onboarding/manifest.json', 'dynamic/desktop/stories/onboarding/manifest.json',
getStickerPackUpload: 'v1/sticker/pack/form', getStickerPackUpload: 'v1/sticker/pack/form',
@ -735,6 +735,8 @@ export type GetIceServersResultType = Readonly<{
username: string; username: string;
password: string; password: string;
urls: ReadonlyArray<string>; urls: ReadonlyArray<string>;
urlsWithIps: ReadonlyArray<string>;
hostname: string;
}>; }>;
export type GetDevicesResultType = ReadonlyArray< export type GetDevicesResultType = ReadonlyArray<