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

feat: add option to allow ice candidate prefetching #396

Merged
merged 2 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/js/src/Modules/Verto/util/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface IVertoOptions {

debug?: boolean;
debugOutput?: 'socket' | 'file';
prefetchIceCandidates?: boolean;
}
export interface SubscribeParams {
channels?: string[];
Expand Down
3 changes: 2 additions & 1 deletion packages/js/src/Modules/Verto/webrtc/Peer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -463,10 +463,11 @@ export default class Peer {
}

private _config(): RTCConfiguration {
const { iceServers = [] } = this.options;
const { iceServers = [], prefetchIceCandidates } = this.options;

const config: RTCConfiguration = {
bundlePolicy: 'max-compat',
iceCandidatePoolSize: prefetchIceCandidates ? 10 : 0,
iceServers,
};

Expand Down
1 change: 1 addition & 0 deletions packages/js/src/Modules/Verto/webrtc/VertoHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class VertoHandler {
mediaSettings: params.mediaSettings,
debug: session.options.debug ?? false,
debugOutput: session.options.debugOutput ?? 'socket',
prefetchIceCandidates: session.options.prefetchIceCandidates ?? false,
};

if (params.telnyx_call_control_id) {
Expand Down
1 change: 1 addition & 0 deletions packages/js/src/Modules/Verto/webrtc/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export interface IVertoCallOptions {
debug?: boolean;
debugOutput?: 'socket' | 'file';
preferred_codecs?: RTCRtpCodecCapability[];
prefetchIceCandidates?: boolean;
}

export interface IStatsBinding {
Expand Down
21 changes: 21 additions & 0 deletions packages/js/src/utils/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,22 @@ export interface IClientOptions {
* "Generate Ringback Tone" in your SIP Connection.
*/
ringbackFile?: string;

/**
* Enable debug mode for this client.
* This will gather WebRTC debugging information.
*/
debug?: boolean;

/**
* Debug output option
*/
debugOutput?: 'socket' | 'file';

/**
* Enable or disable prefetching ICE candidates.
*/
prefetchIceCandidates?: boolean;
}

export interface ISIPCallOptions {
Expand Down Expand Up @@ -201,6 +217,11 @@ export interface ICallOptions {
* Preferred codecs for the call.
*/
preferred_codecs?: RTCRtpCodecCapability[];

/**
* ICE Candidate Prefetching.
*/
prefetchIceCandidates?: boolean;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/react-client/src/useTelnyxRTC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import { TelnyxRTC, IClientOptions } from '@telnyx/webrtc';

type TokenCredential = {
login_token: string;
debug?: boolean
debug?: boolean;
};

type UsernameCredential = {
login: string;
password: string;
debug?: boolean
debug?: boolean;
};

export type CredentialOptions = TokenCredential | UsernameCredential;
Expand Down
Loading