ICE (Interactive Connectivity Establishment)  RFC 5245 is built in the linphone library, with TURN - RFC 8656 protocol support.

Thanks to ICE protocol, streaming is established end to end between clients during calls most of times. However, a media relay service is required as a fallback for a minority of cases where direct exchange is not possible due to firewall policies.

However you need to activate it in your application by setting the appropriate nat policy. To do so call the linphone_core_set_nat_policy() function passing a LinphoneNatPolicy object in which ICE is enabled. You also need to define a STUN server that will be used to discover the public addresses. with linphone_nat_policy_set_stun_server() function.

Interoperability

The implementation of ICE in liblinphone is known to be interoperable with the one from WebRTC.

Relay service

The relay service can be done in two ways:

  • with a SIP server supporting adding relay candidates, for example our Flexisip SIP Proxy server or Kamailio with rtpengine, in which case rtpengine needs to be configured to use the ICE=force-relay flag in the rtpengine_offer() function for it to add the relay candidates in the SDP (see the corresponding rtpengine documentation ).
  • thanks to a TURN server, which is actually the standard solution promoted by IETF for media-relay. For this, TURN is to be enabled in the LinphoneNatPolicy. We recommend COTURN as open-source TURN server implementation.

The relay is not strictly mandatory, however it is strongly recommended for usage over internet because ICE alone can never guarantee that a direct path will work between two NAT'd clients.