element-hq / element-android

A Matrix collaboration client for Android.
https://element.io/
GNU Affero General Public License v3.0
3.36k stars 713 forks source link

allow to use fallback call assist server (turn.matrix.org) #2329

Open huguesdk opened 3 years ago

huguesdk commented 3 years ago

it seems that element android does not allow to use the fallback call assist server (turn.matrix.org), while riot android did, and element web does.

this option is useful for people running their own homeserver without a turn server. ideally, each homeserver should have its turn server, but it is not always possible to run one. it can be because of network traffic or computing power limitations, or because of network setup constraints. for example, when the homeserver is running in a home network behind nat and has a different ip address inside and outside the home network, running a turn server on it does not seem to work (or if it is, its configuration seems pretty challenging).

will you please add this option?

bkil commented 3 years ago

Or it could also be a case that the homeserver is not configured correctly or there were unintended network configuration changes either by the operator or the host. So it should definitely be useful to have backup servers listed. See my comment here: https://github.com/vector-im/element-android/issues/2033#issuecomment-720012557

huguesdk commented 3 years ago

is this being considered?

bmarty commented 3 years ago

@ganfra can we close this issue, i.e. is it implemented now?

ouchadam commented 2 years ago

From my understanding it doesn't look like we currently provide a fallback

Call flow

When the homeserver doesn't have turn enabled it has an no uris meaning we provide an empty IceServers list to the RTCConfiguration

TurnServerResponse(username=null, password=null, uris=null, ttl=null)

compared to a matrix.org account

TurnServerResponse(username=redacted, password=redacted, uris=[turn:turn.matrix.org:3478?transport=udp, turn:turn.matrix.org:3478?transport=tcp, turns:turn.matrix.org:443?transport=tcp], ttl=86400)

https://github.com/vector-im/element-android/blob/develop/vector/src/main/java/im/vector/app/features/call/webrtc/WebRtcCall.kt#L273


The rtc connection also requires a username and password which is provided to us by the homeserver turn response, is it possible to have a client side fallback? :thinking:

opusforlife2 commented 2 years ago

@ouchadam Question: does the lack of this fallback mean that users (clients) on a VoIP call cannot connect to each other after picking the other's call?

Or is this something different altogether?

ouchadam commented 2 years ago

@opusforlife2 it depends~ on my personal homeserver without turn I can make calls fine on WiFi but mobile data fails to connect

It's related to call stability and compatibility due to network configuration (firewalls/port forwarding etc)

More references to defaults/fallbacks from riot https://github.com/vector-im/riot-android/pull/3286 https://github.com/vector-im/riot-android/issues/3251


After speaking internally

opusforlife2 commented 2 years ago

Any idea why out of 2 devices on the same WLAN, I (on another wifi network) can successfully establish a VoIP call with one of them but not the other? Same ISP and same Wifi router for both devices, so you'd think the network configuration would be the same.

From reading this issue I thought it might have to do with turn, but from your latest comment it seems like that's not the case.

CicadaCinema commented 2 years ago

Could someone test my builds in #4391 with a homeserver that doesn't have its own turn server? You need to enable the fallback option in Settings>Voice & Video first. Myself, I've had mixed results on an emulator.

Galbar commented 2 years ago

I was wondering what was blocking this feature from being done. There seems to be a PR that does the thing since some time ago.

Is there anything I can help with to help to have this merged?

CicadaCinema commented 2 years ago

I was wondering what was blocking this feature from being done. There seems to be a PR that does the thing since some time ago.

Is there anything I can help with to help to have this merged?

you could visit the following link, download the correct .apk build for your device, install it, sign in with your Matrix account, enable the turn server fallback option in the "voice and video" section of the settings, attempt to make calls between various devices (of course, the other device should be verified as working) and report the results/any bugs you encounter

https://buildkite.com/matrix-dot-org/element-android/builds/7567

these are just the auto-generated builds that have been created as a result of the changes in my pull request ( #5781 )