1 year ago

#321350

test-img

Lukasz Pyrzyk

Using different ICE servers for WebRTC connection

Should both parties in the WebRTC connection use the same ICE servers? What is the risk of using different ICE servers or even TURN providers at the same time by different sides of the call?

For example, I wonder about a situation where

  1. client1 uses Xirsys STUN/TURN servers
  2. client2 uses Twilio STUN/TURN servers
  3. Or just about an edge case where client1 uses Twilio East US, and client2 West US.

In many places I see notes saying that only one client should receive ICE servers and send them to the second client. But why? Shouldn't clients use their closest servers to improve overall performance? Since TURN is just a technology, location of the server or provider shouldn't matter.

In the book WebRTC for the Curious I see paragraph about TURN permission policy

The remote host needs to give you the IP and port as it appears to the TURN server. This means it should send a STUN Binding Request to the TURN Server. A common error case is that a remote host will send a STUN Binding Request to a different server. They will then ask you to create a permission for this IP.

So, it sounds like using different ICE servers may lead to situation where the client2 is unable to establish a direct connection to a client1 TURN server (Twilio), because NAT Mapping has Address Dependent Mapping to Xirsys STUN server.

client1 <--> client1 TURN Twilio <--> srfx client2 
(failed, client2 cannot receive data from client1 TURN server because of the NAT Mapping is Address Dependant and it was created for Xirys, not Twilio)

and because of that, it will be forced to use two TURN servers.

client1 <--> client1 TURN Twilio <--> client2 TURN Xirsys <--> client2

So, is using different ICE servers a risk that connection will be handled by two TURN servers instead of only one?

twilio

webrtc

stun

turn

ice

0 Answers

Your Answer

Accepted video resources