Skip to content
Snippets Groups Projects
Closed Connectivity: be more resilient if a TURN server is not available
  • View options
  • Connectivity: be more resilient if a TURN server is not available

  • View options
  • Closed Issue created by Sébastien Blin

    Reproduce steps

    • In the settings change the turn address to something that will not work but resolvable (ex: enconn.fr)
    • Try to do a call

    Expected results

    • The call should work as soon as possible with the TURN ignored

    Current result

    • The client try to connect to the TURN server for each ICE and result with a timeout of several seconds (UI or UX on linux) for each ICE negotiations making the call just unusable

    Why?

    When making a call, the first step is to gather all candidates and send this message through the DHT (or direct p2p connection if available). But to gather the TURN candidate, pjsip needs to connect to it and ask for a new session. For TCP connections, the connect() will take a lot of time to timeout (depending on /proc/sys/net/ipv4/tcp_syn_retries), for UDP I didn't dig enough to fully understand what pjsip is waiting, but I think it's something related to that candidate allocation.

    Solutions

    Several solutions can be created:

    1. (pjsip specific) A new timer for TURN candidate creation can be created inside pjsip, to be able to ignore TURN candidates if it's taking too long. Because Jami is a real time communication app, if the allocation is taking more than 3 seconds, this means that we are taking too much time and it's not acceptable.
    2. (system + pjsip specific) Manually set the connection timeout on the sockets. For TCP, we need to do a setsockopt on TCP_SYNCNT. 2 SYN retries is acceptable imho (that's about 3 seconds. First packet + 1 retry). A solution need to be created for platforms not supporting this op. For UDP as I didn't dig enough, I don't really know what's really blocking so this will need further investigation
    3. (best solution imho) Support the RFC for Trickle ICE. I don't really like 1 or 2 because sometimes TURN can work and we will ignore that fact if it's taking too long. Trickle ICE will allow us to send candidates as soon as it's gathered. This means we will be able to send separately host candidates, UPnP, relays like TURN. This is clearly the solution that will take the more time to implement, but the best solution imho.

    Note for 3: the drawback I see is that, because we will send candidates separately, this will generate multiple values on the DHT instead of one. Which is a bit bad.

    Edited by Sébastien Blin

    Linked items 0

  • Link items together to show that they're related or that one is blocking others.

    Activity

    • All activity
    • Comments only
    • History only
    • Newest first
    • Oldest first
    Loading Loading Loading Loading Loading Loading Loading Loading Loading Loading