@telnyx/webrtc
Version:
Telnyx WebRTC Client
99 lines (98 loc) • 2.98 kB
TypeScript
import Call from '../Modules/Verto/webrtc/Call';
import { Environment, INotificationEventData } from '../Modules/Verto/util/interfaces';
export interface ICredentials {
username?: string;
password?: string;
token?: string;
}
export interface TargetParams {
conversation_id?: string;
[key: string]: unknown;
}
export interface IClientOptions {
login_token?: string;
login?: string;
password?: string;
ringtoneFile?: string;
ringbackFile?: string;
debug?: boolean;
debugOutput?: 'socket' | 'file';
prefetchIceCandidates?: boolean;
forceRelayCandidate?: boolean;
trickleIce?: boolean;
keepConnectionAliveOnSocketClose?: boolean;
hangupOnBeforeUnload?: boolean;
region?: string;
anonymous_login?: {
target_type: string;
target_id: string;
target_version_id?: string;
target_params?: TargetParams;
};
rtcIp?: string;
rtcPort?: number;
useCanaryRtcServer?: boolean;
skipLastVoiceSdkId?: boolean;
skipTrailing?: boolean;
env?: Environment;
iceServers?: RTCIceServer[];
mutedMicOnStart?: boolean;
maxReconnectAttempts?: number;
enableCallReports?: boolean;
callReportInterval?: number;
callReportFlushInterval?: number;
enableCallRecording?: boolean;
callRecordingFlushIntervalMs?: number;
callRecordingMaxBufferBytes?: number;
callRecordingSampleRate?: number;
callRecordingTracks?: Array<'local' | 'remote'>;
callRecordingEndpoint?: string;
mediaPermissionsRecovery?: {
enabled: boolean;
timeout: number;
onSuccess?: () => void;
onError?: (error: Error) => void;
};
}
export interface ICallOptions {
destinationNumber?: string;
callerNumber?: string;
callerName?: string;
id?: string;
telnyxCallControlId?: string;
telnyxSessionId?: string;
telnyxLegId?: string;
clientState?: string;
localStream?: MediaStream;
remoteStream?: MediaStream;
localElement?: HTMLMediaElement | string;
remoteElement?: HTMLMediaElement | string;
iceServers?: RTCIceServer[];
audio?: boolean | MediaTrackConstraints;
video?: boolean;
useStereo?: boolean;
micId?: string;
camId?: string;
speakerId?: string;
onNotification?: Function;
mediaSettings?: {
useSdpASBandwidthKbps?: boolean;
sdpASBandwidthKbps?: number;
};
customHeaders?: {
name: string;
value: string;
}[];
debug?: boolean;
debugOutput?: 'socket' | 'file';
preferred_codecs?: RTCRtpCodecCapability[];
prefetchIceCandidates?: boolean;
forceRelayCandidate?: boolean;
trickleIce?: boolean;
keepConnectionAliveOnSocketClose?: boolean;
}
export interface INotification extends Omit<INotificationEventData, 'call'> {
type: string;
call?: Call;
error?: Error;
}