File tree Expand file tree Collapse file tree
app/src/main/java/org/thoughtcrime/securesms/service/webrtc
core-util/src/main/java/org/signal/core/util
libsignal-service/src/main/java/org/whispersystems/signalservice Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414import com .annimon .stream .Stream ;
1515
1616import org .greenrobot .eventbus .EventBus ;
17+ import org .signal .core .util .ListUtil ;
1718import org .signal .core .util .concurrent .SignalExecutors ;
1819import org .signal .core .util .logging .Log ;
1920import org .signal .libsignal .protocol .util .Pair ;
@@ -994,7 +995,20 @@ public void retrieveTurnServers(@NonNull RemotePeer remotePeer) {
994995 TurnServerInfo turnServerInfo = ApplicationDependencies .getSignalServiceAccountManager ().getTurnServerInfo ();
995996
996997 List <PeerConnection .IceServer > iceServers = new LinkedList <>();
997- for (String url : turnServerInfo .getUrls ()) {
998+ for (String url : ListUtil .emptyIfNull (turnServerInfo .getUrlsWithIps ())) {
999+ if (url .startsWith ("turn" )) {
1000+ iceServers .add (PeerConnection .IceServer .builder (url )
1001+ .setUsername (turnServerInfo .getUsername ())
1002+ .setPassword (turnServerInfo .getPassword ())
1003+ .setHostname (turnServerInfo .getHostname ())
1004+ .createIceServer ());
1005+ } else {
1006+ iceServers .add (PeerConnection .IceServer .builder (url )
1007+ .setHostname (turnServerInfo .getHostname ())
1008+ .createIceServer ());
1009+ }
1010+ }
1011+ for (String url : ListUtil .emptyIfNull (turnServerInfo .getUrls ())) {
9981012 if (url .startsWith ("turn" )) {
9991013 iceServers .add (PeerConnection .IceServer .builder (url )
10001014 .setUsername (turnServerInfo .getUsername ())
Original file line number Diff line number Diff line change 44
55import java .util .ArrayList ;
66import java .util .Collection ;
7+ import java .util .Collections ;
78import java .util .List ;
89import java .util .stream .Stream ;
910
@@ -31,4 +32,8 @@ public static <T> List<T> concat(Collection<T>... items) {
3132
3233 return concat ;
3334 }
35+
36+ public static <T > List <T > emptyIfNull (List <T > list ) {
37+ return list == null ? Collections .emptyList () : list ;
38+ }
3439}
Original file line number Diff line number Diff line change @@ -13,9 +13,15 @@ public class TurnServerInfo {
1313 @ JsonProperty
1414 private String password ;
1515
16+ @ JsonProperty
17+ private String hostname ;
18+
1619 @ JsonProperty
1720 private List <String > urls ;
1821
22+ @ JsonProperty
23+ private List <String > urlsWithIps ;
24+
1925 public String getUsername () {
2026 return username ;
2127 }
@@ -24,7 +30,16 @@ public String getPassword() {
2430 return password ;
2531 }
2632
33+ // Hostname for the ips in urlsWithIps
34+ public String getHostname () {
35+ return hostname ;
36+ }
37+
2738 public List <String > getUrls () {
2839 return urls ;
2940 }
41+
42+ public List <String > getUrlsWithIps () {
43+ return urlsWithIps ;
44+ }
3045}
Original file line number Diff line number Diff line change @@ -216,7 +216,6 @@ public class PushServiceSocket {
216216 private static final String TAG = PushServiceSocket .class .getSimpleName ();
217217
218218 private static final String REGISTER_GCM_PATH = "/v1/accounts/gcm/" ;
219- private static final String TURN_SERVER_INFO = "/v1/accounts/turn" ;
220219 private static final String SET_ACCOUNT_ATTRIBUTES = "/v1/accounts/attributes/" ;
221220 private static final String PIN_PATH = "/v1/accounts/pin/" ;
222221 private static final String REGISTRATION_LOCK_PATH = "/v1/accounts/registration_lock" ;
@@ -238,6 +237,7 @@ public class PushServiceSocket {
238237 private static final String PREKEY_DEVICE_PATH = "/v2/keys/%s/%s" ;
239238 private static final String PREKEY_CHECK_PATH = "/v2/keys/check" ;
240239
240+ private static final String TURN_SERVER_INFO = "/v1/calling/relays" ;
241241
242242 private static final String PROVISIONING_CODE_PATH = "/v1/devices/provisioning/code" ;
243243 private static final String PROVISIONING_MESSAGE_PATH = "/v1/provisioning/%s" ;
You can’t perform that action at this time.
0 commit comments