Skip to main content
setIceConfig(iceConfig?)
This is part of the Advanced Firewall Control add-on. Contact Sales to enable this feature.
Configures custom TURN servers to use instead of (or alongside) Daily’s default TURN servers. Call this periodically — at least once an hour — to keep ICE credentials fresh for reconnections and new peer connections. For best results, use TURN credentials with a validity period greater than one hour.

Parameters

iceServers
RTCIceServer[]
Array of TURN/STUN server configurations. Each entry follows the RTCIceServer shape:
  • urls: string | string[] (required): Single or multiple STUN/TURN URLs.
  • username: string (optional): Username for the TURN server(s) specified.
  • credential: string (optional): Credential for the TURN server(s) specified.
placement
'front' | 'back' | 'replace'
Controls how custom servers are ordered relative to Daily’s defaults:
  • 'front' — custom servers are tried first (default)
  • 'back' — Daily’s servers are tried first
  • 'replace' — only custom servers are used
Most implementations try all servers and pick the lowest-latency option, so ordering rarely matters. Use 'replace' only when you need to force all traffic through your own TURN servers.
iceTransportPolicy
'all' | 'relay'
  • 'all' (default) uses all candidates.
  • 'relay' forces relay-only (TURN) candidates — useful for testing firewall traversal but not recommended for production.

Return value

Returns this for chaining.

Example

call.setIceConfig({
  iceServers: [
    {
      urls: [
        'turn:turnserver.example.org:3478?transport=udp',
        'turns:turnserver.example.org:443?transport=tcp',
      ],
      username: 'USER_NAME',
      credential: 'CREDENTIAL',
    },
  ],
  placement: 'front',
});

// Refresh credentials every hour
setInterval(() => call.setIceConfig({ iceServers: [...] }), 60 * 60 * 1000);

See also