Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENGDESK-38176] [Feature] Add forceRelayCandidate to Force TURN Relay and Prevent Local Network Permission Request on iOS #174

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

ai-swe-agent
Copy link

@ai-swe-agent ai-swe-agent commented Feb 10, 2025

[ENGDESK-38176][Feature]-Add forceRelayCandidate to Force TURN Relay and Prevent Local Network Permission Request on iOS

Description

This PR introduces a new configuration option to control ICE transport policy, allowing developers to manage whether the SDK triggers the local network access permission request on iOS 15 and 17. By default, WebRTC gathers ICE candidates from the local network, which can prompt a permission request.

To align with the JS SDK, we are adding the forceRelayCandidate configuration, which enables developers to enforce TURN relay and avoid local network access.

Changes

  • Implemented ICE transport policy control in Peer.swift.
  • When forceRelayCandidate = true, the SDK:
    • Forces iceTransportPolicy = .relay.
    • Uses only TURN servers for media relay.
    • Prevents the local network permission popup.

How it Works

  • By default, WebRTC's peer connection gathers ICE candidates from the local network, triggering a permission request on iOS 17 and earlier.
  • Setting forceRelayCandidate = true ensures that only TURN servers are used, avoiding local network candidate discovery and preventing the popup.

Usage

  • Developers can configure forceRelayCandidate in TxConfig to customize ICE transport behavior.
  • Default: false (to maintain optimal call quality).
📓  Note: This allows control over the local network permission request on iOS devices. When forceRelayCandidate is set to true, all connections will be established exclusively through TURN servers, preventing local network candidate gathering.

Example when using forceRelayCandidate: true
Screenshot 2025-02-11 at 1 56 37 PM

Example when using forceRelayCandidate: false
Screenshot 2025-02-11 at 1 57 45 PM

- Add enableLocalNetworkAccess flag to TxConfig to control local network access
- Implement local network access control in Peer configuration
- Force TURN relay when local network access is disabled to prevent permission popup

This change allows SDK users to control whether the local network permission popup appears by configuring the ICE transport policy. When local network access is disabled, only TURN relay candidates will be used, preventing the popup from appearing.
- Renamed enableLocalNetworkAccess parameter to forceRelayCandidate for better clarity
- Updated logic to use forceRelayCandidate for controlling ICE transport policy
- Updated documentation and examples in README.md
- Default value set to false to maintain backward compatibility
…k permission popup

- Renamed enableLocalNetworkAccess to forceRelayCandidate in TxConfig
- Updated documentation to better explain the purpose and behavior
- Changed default value to false to maintain backward compatibility
- Added parameter propagation from TxConfig through Call to Peer
- When enabled, forces ICE transport policy to relay mode to prevent local network access
@gbattistel gbattistel changed the title ENGDESK-38176: Add local network permission control [ENGDESK-38176] [Feature] Add forceRelayCandidate to Force TURN Relay and Prevent Local Network Permission Request on iOS Feb 10, 2025
@gbattistel gbattistel marked this pull request as ready for review February 10, 2025 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants