Use v2/calling/relays endpoint.
This commit is contained in:
parent
4220068835
commit
47300bbd56
5 changed files with 25 additions and 23 deletions
|
@ -1027,14 +1027,7 @@ public final class SignalCallManager implements CallManager.Observer, GroupCall.
|
||||||
public void retrieveTurnServers(@NonNull RemotePeer remotePeer) {
|
public void retrieveTurnServers(@NonNull RemotePeer remotePeer) {
|
||||||
networkExecutor.execute(() -> {
|
networkExecutor.execute(() -> {
|
||||||
try {
|
try {
|
||||||
TurnServerInfo turnServerInfo = AppDependencies.getSignalServiceAccountManager().getTurnServerInfo();
|
List<TurnServerInfo> turnServerInfos = AppDependencies.getSignalServiceAccountManager().getTurnServerInfo();
|
||||||
|
|
||||||
List<TurnServerInfo> turnServerInfos = new ArrayList<>();
|
|
||||||
if (turnServerInfo != null) {
|
|
||||||
turnServerInfos.add(turnServerInfo);
|
|
||||||
turnServerInfos.addAll(turnServerInfo.getIceServers());
|
|
||||||
}
|
|
||||||
|
|
||||||
List<PeerConnection.IceServer> iceServers = mapToIceServers(turnServerInfos);
|
List<PeerConnection.IceServer> iceServers = mapToIceServers(turnServerInfos);
|
||||||
process((s, p) -> {
|
process((s, p) -> {
|
||||||
RemotePeer activePeer = s.getCallInfoState().getActivePeer();
|
RemotePeer activePeer = s.getCallInfoState().getActivePeer();
|
||||||
|
|
|
@ -552,8 +552,9 @@ public class SignalServiceAccountManager {
|
||||||
this.pushServiceSocket.removeDevice(deviceId);
|
this.pushServiceSocket.removeDevice(deviceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TurnServerInfo getTurnServerInfo() throws IOException {
|
public List<TurnServerInfo> getTurnServerInfo() throws IOException {
|
||||||
return this.pushServiceSocket.getTurnServerInfo();
|
List<TurnServerInfo> relays = this.pushServiceSocket.getCallingRelays().getRelays();
|
||||||
|
return relays != null ? relays : Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkNetworkConnection() throws IOException {
|
public void checkNetworkConnection() throws IOException {
|
||||||
|
|
|
@ -3,7 +3,6 @@ package org.whispersystems.signalservice.api.messages.calls;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class TurnServerInfo {
|
public class TurnServerInfo {
|
||||||
|
@ -23,9 +22,6 @@ public class TurnServerInfo {
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
private List<String> urlsWithIps;
|
private List<String> urlsWithIps;
|
||||||
|
|
||||||
@JsonProperty
|
|
||||||
private List<TurnServerInfo> iceServers;
|
|
||||||
|
|
||||||
public String getUsername() {
|
public String getUsername() {
|
||||||
return username;
|
return username;
|
||||||
}
|
}
|
||||||
|
@ -46,8 +42,4 @@ public class TurnServerInfo {
|
||||||
public List<String> getUrlsWithIps() {
|
public List<String> getUrlsWithIps() {
|
||||||
return urlsWithIps;
|
return urlsWithIps;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TurnServerInfo> getIceServers() {
|
|
||||||
return (iceServers != null) ? iceServers : Collections.emptyList();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2024 Signal Messenger, LLC
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.whispersystems.signalservice.internal.push
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
import org.whispersystems.signalservice.api.messages.calls.TurnServerInfo
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Response body for GetCallingRelays
|
||||||
|
*/
|
||||||
|
data class GetCallingRelaysResponse @JsonCreator constructor(
|
||||||
|
@JsonProperty("relays") val relays: List<TurnServerInfo>?
|
||||||
|
)
|
|
@ -71,7 +71,6 @@ import org.whispersystems.signalservice.api.link.WaitForLinkedDeviceResponse;
|
||||||
import org.whispersystems.signalservice.api.messages.SignalServiceAttachment.ProgressListener;
|
import org.whispersystems.signalservice.api.messages.SignalServiceAttachment.ProgressListener;
|
||||||
import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentRemoteId;
|
import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentRemoteId;
|
||||||
import org.whispersystems.signalservice.api.messages.calls.CallingResponse;
|
import org.whispersystems.signalservice.api.messages.calls.CallingResponse;
|
||||||
import org.whispersystems.signalservice.api.messages.calls.TurnServerInfo;
|
|
||||||
import org.whispersystems.signalservice.api.messages.multidevice.DeviceInfo;
|
import org.whispersystems.signalservice.api.messages.multidevice.DeviceInfo;
|
||||||
import org.whispersystems.signalservice.api.payments.CurrencyConversions;
|
import org.whispersystems.signalservice.api.payments.CurrencyConversions;
|
||||||
import org.whispersystems.signalservice.api.profiles.ProfileAndCredential;
|
import org.whispersystems.signalservice.api.profiles.ProfileAndCredential;
|
||||||
|
@ -249,7 +248,7 @@ public class PushServiceSocket {
|
||||||
private static final String PREKEY_DEVICE_PATH = "/v2/keys/%s/%s";
|
private static final String PREKEY_DEVICE_PATH = "/v2/keys/%s/%s";
|
||||||
private static final String PREKEY_CHECK_PATH = "/v2/keys/check";
|
private static final String PREKEY_CHECK_PATH = "/v2/keys/check";
|
||||||
|
|
||||||
private static final String TURN_SERVER_INFO = "/v1/calling/relays";
|
private static final String CALLING_RELAYS = "/v2/calling/relays";
|
||||||
|
|
||||||
private static final String PROVISIONING_CODE_PATH = "/v1/devices/provisioning/code";
|
private static final String PROVISIONING_CODE_PATH = "/v1/devices/provisioning/code";
|
||||||
private static final String PROVISIONING_MESSAGE_PATH = "/v1/provisioning/%s";
|
private static final String PROVISIONING_MESSAGE_PATH = "/v1/provisioning/%s";
|
||||||
|
@ -1551,9 +1550,9 @@ public class PushServiceSocket {
|
||||||
return getAuthCredentials(PAYMENTS_AUTH_PATH);
|
return getAuthCredentials(PAYMENTS_AUTH_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TurnServerInfo getTurnServerInfo() throws IOException {
|
public GetCallingRelaysResponse getCallingRelays() throws IOException {
|
||||||
String response = makeServiceRequest(TURN_SERVER_INFO, "GET", null);
|
String response = makeServiceRequest(CALLING_RELAYS, "GET", null);
|
||||||
return JsonUtil.fromJson(response, TurnServerInfo.class);
|
return JsonUtil.fromJson(response, GetCallingRelaysResponse.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getStorageAuth() throws IOException {
|
public String getStorageAuth() throws IOException {
|
||||||
|
|
Loading…
Add table
Reference in a new issue