Update to new calling turn info endpoint, add support for turn server ips.
Co-authored-by: Adel Lahlou <adel@signal.com>
This commit is contained in:
parent
03d3ae7043
commit
f01e044662
4 changed files with 36 additions and 2 deletions
|
@ -14,6 +14,7 @@ import androidx.annotation.Nullable;
|
|||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.signal.core.util.ListUtil;
|
||||
import org.signal.core.util.concurrent.SignalExecutors;
|
||||
import org.signal.core.util.logging.Log;
|
||||
import org.signal.libsignal.protocol.util.Pair;
|
||||
|
@ -994,7 +995,20 @@ public final class SignalCallManager implements CallManager.Observer, GroupCall.
|
|||
TurnServerInfo turnServerInfo = ApplicationDependencies.getSignalServiceAccountManager().getTurnServerInfo();
|
||||
|
||||
List<PeerConnection.IceServer> iceServers = new LinkedList<>();
|
||||
for (String url : turnServerInfo.getUrls()) {
|
||||
for (String url : ListUtil.emptyIfNull(turnServerInfo.getUrlsWithIps())) {
|
||||
if (url.startsWith("turn")) {
|
||||
iceServers.add(PeerConnection.IceServer.builder(url)
|
||||
.setUsername(turnServerInfo.getUsername())
|
||||
.setPassword(turnServerInfo.getPassword())
|
||||
.setHostname(turnServerInfo.getHostname())
|
||||
.createIceServer());
|
||||
} else {
|
||||
iceServers.add(PeerConnection.IceServer.builder(url)
|
||||
.setHostname(turnServerInfo.getHostname())
|
||||
.createIceServer());
|
||||
}
|
||||
}
|
||||
for (String url : ListUtil.emptyIfNull(turnServerInfo.getUrls())) {
|
||||
if (url.startsWith("turn")) {
|
||||
iceServers.add(PeerConnection.IceServer.builder(url)
|
||||
.setUsername(turnServerInfo.getUsername())
|
||||
|
|
|
@ -4,6 +4,7 @@ import androidx.annotation.NonNull;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
@ -31,4 +32,8 @@ public final class ListUtil {
|
|||
|
||||
return concat;
|
||||
}
|
||||
|
||||
public static <T> List<T> emptyIfNull(List<T> list) {
|
||||
return list == null ? Collections.emptyList() : list;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,9 +13,15 @@ public class TurnServerInfo {
|
|||
@JsonProperty
|
||||
private String password;
|
||||
|
||||
@JsonProperty
|
||||
private String hostname;
|
||||
|
||||
@JsonProperty
|
||||
private List<String> urls;
|
||||
|
||||
@JsonProperty
|
||||
private List<String> urlsWithIps;
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
@ -24,7 +30,16 @@ public class TurnServerInfo {
|
|||
return password;
|
||||
}
|
||||
|
||||
// Hostname for the ips in urlsWithIps
|
||||
public String getHostname() {
|
||||
return hostname;
|
||||
}
|
||||
|
||||
public List<String> getUrls() {
|
||||
return urls;
|
||||
}
|
||||
|
||||
public List<String> getUrlsWithIps() {
|
||||
return urlsWithIps;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -216,7 +216,6 @@ public class PushServiceSocket {
|
|||
private static final String TAG = PushServiceSocket.class.getSimpleName();
|
||||
|
||||
private static final String REGISTER_GCM_PATH = "/v1/accounts/gcm/";
|
||||
private static final String TURN_SERVER_INFO = "/v1/accounts/turn";
|
||||
private static final String SET_ACCOUNT_ATTRIBUTES = "/v1/accounts/attributes/";
|
||||
private static final String PIN_PATH = "/v1/accounts/pin/";
|
||||
private static final String REGISTRATION_LOCK_PATH = "/v1/accounts/registration_lock";
|
||||
|
@ -238,6 +237,7 @@ public class PushServiceSocket {
|
|||
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 TURN_SERVER_INFO = "/v1/calling/relays";
|
||||
|
||||
private static final String PROVISIONING_CODE_PATH = "/v1/devices/provisioning/code";
|
||||
private static final String PROVISIONING_MESSAGE_PATH = "/v1/provisioning/%s";
|
||||
|
|
Loading…
Add table
Reference in a new issue