diff --git a/apps/android/app/src/main/assets/www/call.js b/apps/android/app/src/main/assets/www/call.js index 7267b0ba35..4c331cc539 100644 --- a/apps/android/app/src/main/assets/www/call.js +++ b/apps/android/app/src/main/assets/www/call.js @@ -25,8 +25,8 @@ let activeCall; let answerTimeout = 30000; const processCommand = (function () { const defaultIceServers = [ - { urls: ["stun:stun.simplex.im:443"] }, - { urls: ["turn:turn.simplex.im:443"], username: "private", credential: "yleob6AVkiNI87hpR94Z" }, + { urls: ["stun:stun.simplex.im:443?transport=tcp"] }, + { urls: ["turn:turn.simplex.im:443?transport=tcp"], username: "private", credential: "yleob6AVkiNI87hpR94Z" }, ]; function getCallConfig(encodedInsertableStreams, iceServers, relay) { return { diff --git a/apps/android/app/src/main/java/chat/simplex/app/views/call/WebRTC.kt b/apps/android/app/src/main/java/chat/simplex/app/views/call/WebRTC.kt index 7f850a35d1..93b3bd8a6f 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/views/call/WebRTC.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/views/call/WebRTC.kt @@ -1,9 +1,9 @@ package chat.simplex.app.views.call +import android.util.Log import androidx.compose.runtime.Composable import androidx.compose.ui.res.stringResource -import chat.simplex.app.R -import chat.simplex.app.SimplexApp +import chat.simplex.app.* import chat.simplex.app.model.Contact import chat.simplex.app.model.User import chat.simplex.app.views.helpers.generalGetString @@ -159,8 +159,8 @@ data class ConnectionState( ) // the servers are expected in this format: -// stun:stun.simplex.im:443 -// turn:private:yleob6AVkiNI87hpR94Z@turn.simplex.im:443 +// stun:stun.simplex.im:443?transport=tcp +// turn:private:yleob6AVkiNI87hpR94Z@turn.simplex.im:443?transport=tcp fun parseRTCIceServer(str: String): RTCIceServer? { var s = replaceScheme(str, "stun:") s = replaceScheme(s, "turn:") @@ -171,8 +171,9 @@ fun parseRTCIceServer(str: String): RTCIceServer? { val port = u.port if (u.path == "" && (scheme == "stun" || scheme == "turn")) { val userInfo = u.userInfo?.split(":") + val query = if (u.query == null || u.query == "") "" else "?${u.query}" return RTCIceServer( - urls = listOf("$scheme:$host:$port"), + urls = listOf("$scheme:$host:$port$query"), username = userInfo?.getOrNull(0), credential = userInfo?.getOrNull(1) ) diff --git a/apps/ios/Shared/Views/Call/WebRTC.swift b/apps/ios/Shared/Views/Call/WebRTC.swift index 930410af97..e74d05d643 100644 --- a/apps/ios/Shared/Views/Call/WebRTC.swift +++ b/apps/ios/Shared/Views/Call/WebRTC.swift @@ -396,8 +396,8 @@ struct RTCIceServer: Codable, Equatable { } // the servers are expected in this format: -// stun:stun.simplex.im:443 -// turn:private:yleob6AVkiNI87hpR94Z@turn.simplex.im:443 +// stun:stun.simplex.im:443?transport=tcp +// turn:private:yleob6AVkiNI87hpR94Z@turn.simplex.im:443?transport=tcp func parseRTCIceServer(_ str: String) -> RTCIceServer? { var s = replaceScheme(str, "stun:") s = replaceScheme(s, "turn:") @@ -406,8 +406,9 @@ func parseRTCIceServer(_ str: String) -> RTCIceServer? { let host = u.host, let port = u.port, u.path == "" && (scheme == "stun" || scheme == "turn") { + let query = u.query == nil || u.query == "" ? "" : "?" + (u.query ?? "") return RTCIceServer( - urls: ["\(scheme):\(host):\(port)"], + urls: ["\(scheme):\(host):\(port)\(query)"], username: u.user, credential: u.password ) diff --git a/packages/simplex-chat-webrtc/src/call.ts b/packages/simplex-chat-webrtc/src/call.ts index ec1691c8d1..773280ec79 100644 --- a/packages/simplex-chat-webrtc/src/call.ts +++ b/packages/simplex-chat-webrtc/src/call.ts @@ -218,8 +218,8 @@ const processCommand = (function () { } const defaultIceServers: RTCIceServer[] = [ - {urls: ["stun:stun.simplex.im:443"]}, - {urls: ["turn:turn.simplex.im:443"], username: "private", credential: "yleob6AVkiNI87hpR94Z"}, + {urls: ["stun:stun.simplex.im:443?transport=tcp"]}, + {urls: ["turn:turn.simplex.im:443?transport=tcp"], username: "private", credential: "yleob6AVkiNI87hpR94Z"}, ] function getCallConfig(encodedInsertableStreams: boolean, iceServers?: RTCIceServer[], relay?: boolean): CallConfig {