Skip to content

Conversation

@Gokaysim
Copy link
Contributor

@Gokaysim Gokaysim commented Nov 10, 2025

Summary

This MR introduces support for configuring custom TURN servers in the AnamClient setup. It allows developers to define their own TURN/STUN infrastructure instead of relying solely on default provider (Metered).

Motivation

Some organizations have strict network policies or limitations that prevent them from allowing wide IP ranges. Providing the ability to use a custom TURN server has less IPs.

Example Usage

const anamClient = createClient(sessionToken, {
    iceServers: [
      {
        urls: ['turn:turn.example.com:3478'],
        username: 'user',
        credential: 'pass',
      },
    ],
})

Summary by cubic

Added support for custom TURN/STUN servers in AnamClient. If provided, the client uses your RTCIceServer list instead of the server-provided ICE servers.

  • New Features
    • Added iceServers?: RTCIceServer[] to AnamPublicClientOptions.
    • Client prefers iceServers over server-provided ICE servers, with fallback.

Written for commit b32620b. Summary will update automatically on new commits.

Copilot AI review requested due to automatic review settings November 10, 2025 11:53
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for custom ICE servers by allowing users to specify them via the customTurnServers option in the client configuration. When provided, these custom servers override the default ICE servers received from the backend.

Key Changes:

  • Added customTurnServers optional property to AnamPublicClientOptions
  • Modified session initialization logic to use custom servers when provided, falling back to server-provided ICE servers

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/types/AnamPublicClientOptions.ts Added optional customTurnServers field to support custom ICE server configuration
src/AnamClient.ts Implemented logic to use custom ICE servers when provided, refactored ICE server handling with renamed variable

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

sessionId: this.sessionId,
});

// Use custom TURN server if provided, otherwise use server-provided ICE servers
Copy link

Copilot AI Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment refers to 'custom TURN server' (singular) but the property accepts an array of RTCIceServer which can include both STUN and TURN servers. The comment should be updated to 'Use custom ICE servers if provided, otherwise use server-provided ICE servers' for accuracy and consistency with the codebase terminology.

Suggested change
// Use custom TURN server if provided, otherwise use server-provided ICE servers
// Use custom ICE servers if provided, otherwise use server-provided ICE servers

Copilot uses AI. Check for mistakes.
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

@ao-anam ao-anam merged commit eb22ad0 into anam-org:main Nov 14, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants