import { CallLinkState, CallLinkRestrictions, CallLinkRootKey } from './CallLinks'; import type { CallSummary } from './CallSummary'; export declare const callIdFromEra: (era: string) => CallId; export declare function callIdFromRingId(ringId: bigint): CallId; declare class Config { field_trials: Record | undefined; } type GroupId = Uint8Array; type GroupCallUserId = Uint8Array; export type PeekDeviceInfo = { demuxId: number; userId?: GroupCallUserId; }; export type Reaction = { demuxId: number; value: string; }; /** type returned by Rust */ export type RawPeekInfo = { devices: Array; creator?: GroupCallUserId; eraId?: string; maxDevices?: number; /** @deprecated Use {@link #deviceCountIncludingPendingDevices} and {@link #deviceCountExcludingPendingDevices} as appropriate */ deviceCount: number; deviceCountIncludingPendingDevices: number; deviceCountExcludingPendingDevices: number; pendingUsers: Array; callLinkState?: RawCallLinkState; }; /** type derived from RawPeekInfo */ export type PeekInfo = { devices: Array; creator?: GroupCallUserId; eraId?: string; maxDevices?: number; /** @deprecated Use {@link #deviceCountIncludingPendingDevices} and {@link #deviceCountExcludingPendingDevices} as appropriate */ deviceCount: number; deviceCountIncludingPendingDevices: number; deviceCountExcludingPendingDevices: number; pendingUsers: Array; callLinkState?: CallLinkState; }; export declare enum PeekStatusCodes { EXPIRED_CALL_LINK = 703, INVALID_CALL_LINK = 704 } declare enum NetworkAdapterType { Unknown = 0, Ethernet = 1, Wifi = 2, Cellular = 4, Vpn = 8, Loopback = 16, Default = 32, Cellular2G = 64, Cellular3G = 128, Cellular4G = 256, Cellular5G = 512 } export declare class NetworkRoute { localAdapterType: NetworkAdapterType; constructor(); } export type RawAudioLevel = number; export type NormalizedAudioLevel = number; export declare class ReceivedAudioLevel { demuxId: number; level: RawAudioLevel; constructor(demuxId: number, level: RawAudioLevel); } type RawCallLinkState = { name: string; rawRestrictions: number; revoked: boolean; expiration: Date; rootKey: Uint8Array; }; export type EmptyObj = Record; export type HttpResult = { success: true; value: T; } | { success: false; errorStatusCode: number; }; export declare class RingRTCType { private readonly callManager; private _call; private readonly _groupCallByClientId; private readonly _peekRequests; private readonly _callLinkRequests; private readonly _emptyRequests; private readonly _callInfoByCallId; private getCallInfoKey; handleOutgoingSignaling: ((remoteUserId: UserId, message: CallingMessage) => Promise) | null; handleIncomingCall: ((call: Call) => Promise) | null; handleStartCall: ((call: Call) => Promise) | null; handleOutputDeviceChanged: ((devices: Array) => Promise) | null; handleInputDeviceChanged: ((devices: Array) => Promise) | null; handleRejectedIncomingCallRequest: ((callId: CallId, remoteUserId: UserId, reason: CallRejectReason, ageSec: number, wasVideoCall: boolean, receivedAtCounter: number | undefined, receivedAtDate: number | undefined) => void) | null; handleLogMessage: ((level: CallLogLevel, fileName: string, line: number, message: string) => void) | null; handleSendHttpRequest: ((requestId: number, url: string, method: HttpMethod, headers: { [name: string]: string; }, body: Uint8Array | undefined) => void) | null; handleSendCallMessage: ((recipientUuid: Uint8Array, message: Uint8Array, urgency: CallMessageUrgency) => void) | null; handleSendCallMessageToGroup: ((groupId: GroupId, message: Uint8Array, urgency: CallMessageUrgency, overrideRecipients: Array>) => void) | null; handleSendCallMessageToAdhocGroup: ((message: Uint8Array, urgency: CallMessageUrgency, expiration: Date, recipientsAndEndorsements: Array<{ recipientId: Uint8Array; endorsement: Uint8Array; }>) => void) | null; handleGroupCallRingUpdate: ((groupId: GroupId, ringId: bigint, sender: GroupCallUserId, update: RingUpdate) => void) | null; handleRtcStatsReport: ((reportJson: string) => void) | null; constructor(); setConfig(config: Config): void; setSelfUuid(uuid: Uint8Array): void; addAsset(assetGroup: string, asset: { filePath: string; } | { content: Uint8Array; }): void; startOutgoingCall(remoteUserId: UserId, isVideoCall: boolean, localDeviceId: DeviceId): Call; cancelGroupRing(groupId: GroupId, ringId: bigint, reason: RingCancelReason | null): void; onStartOutgoingCall(remoteUserId: UserId, callId: CallId): void; onStartIncomingCall(remoteUserId: UserId, callId: CallId, isVideoCall: boolean): void; proceed(callId: CallId, settings: CallSettings): void; onCallState(remoteUserId: UserId, state: CallState): void; onCallRejected(remoteUserId: UserId, callId: CallId, reason: CallRejectReason, ageSec: number): void; onCallEnded(remoteUserId: UserId, callId: CallId, reason: CallEndReason, summary: CallSummary): void; onRemoteAudioEnabled(remoteUserId: UserId, enabled: boolean): void; onRemoteVideoEnabled(remoteUserId: UserId, enabled: boolean): void; onRemoteSharingScreen(remoteUserId: UserId, enabled: boolean): void; onNetworkRouteChanged(remoteUserId: UserId, localNetworkAdapterType: NetworkAdapterType): void; onAudioLevels(remoteUserId: UserId, capturedLevel: RawAudioLevel, receivedLevel: RawAudioLevel): void; onLowBandwidthForVideo(remoteUserId: UserId, recovered: boolean): void; renderVideoFrame(width: number, height: number, buffer: Uint8Array): void; onSendOffer(remoteUserId: UserId, remoteDeviceId: DeviceId, callId: CallId, broadcast: boolean, offerType: OfferType, opaque: Uint8Array): void; onSendAnswer(remoteUserId: UserId, remoteDeviceId: DeviceId, callId: CallId, broadcast: boolean, opaque: Uint8Array): void; onSendIceCandidates(remoteUserId: UserId, remoteDeviceId: DeviceId, callId: CallId, broadcast: boolean, candidates: Array>): void; onSendHangup(remoteUserId: UserId, remoteDeviceId: DeviceId, callId: CallId, broadcast: boolean, hangupType: HangupType, deviceId: DeviceId | null): void; onSendBusy(remoteUserId: UserId, remoteDeviceId: DeviceId, callId: CallId, broadcast: boolean): void; private sendSignaling; /** * Asynchronous request to get information about a call link. * * @param sfuUrl - the URL to use when accessing the SFU * @param authCredentialPresentation - a serialized CallLinkAuthCredentialPresentation * @param linkRootKey - the root key for the call link * * Expected failure codes include: * - 404: the room does not exist (or expired so long ago that it has been removed from the server) */ readCallLink(sfuUrl: string, authCredentialPresentation: Uint8Array, linkRootKey: CallLinkRootKey): Promise>; /** * Asynchronous request to create a new call link. * * This request is idempotent; if it fails due to a network issue, it is safe to retry. * * @example * const linkKey = CallLinkRootKey.generate(); * const adminPasskey = CallLinkRootKey.generateAdminPasskey(); * const roomId = linkKey.deriveRoomId(); * const credential = requestCreateCredentialFromChatServer(roomId); // using libsignal * const secretParams = CallLinkSecretParams.deriveFromRootKey(linkKey.bytes); * const credentialPresentation = credential.present(roomId, secretParams).serialize(); * const serializedPublicParams = secretParams.getPublicParams().serialize(); * const restrictions = CallLinkState.Restrictions.None; * const result = await RingRTC.createCallLink(sfuUrl, credentialPresentation, linkKey, adminPasskey, serializedPublicParams, restrictions); * if (result.success) { * const state = result.value; * // In actuality you may not want to do this until the user clicks Done. * saveToDatabase(linkKey.bytes, adminPasskey, state); * syncToOtherDevices(linkKey.bytes, adminPasskey); * } else { * switch (result.errorStatusCode) { * case 409: * // The room already exists (and isn't yours), i.e. you've hit a 1-in-a-billion conflict. * // Fall through to kicking the user out to try again later. * default: * // Unexpected error, kick the user out for now. * } * } * * @param sfuUrl - the URL to use when accessing the SFU * @param createCredentialPresentation - a serialized CreateCallLinkCredentialPresentation * @param linkRootKey - the root key for the call link * @param adminPasskey - the arbitrary passkey to use for the new room * @param callLinkPublicParams - the serialized CallLinkPublicParams for the new room */ createCallLink(sfuUrl: string, createCredentialPresentation: Uint8Array, linkRootKey: CallLinkRootKey, adminPasskey: Uint8Array, callLinkPublicParams: Uint8Array, restrictions: Exclude): Promise>; /** * Asynchronous request to update a call link's name. * * Possible failure codes include: * - 401: the room does not exist (and this is the wrong API to create a new room) * - 403: the admin passkey is incorrect * * This request is idempotent; if it fails due to a network issue, it is safe to retry. * * @param sfuUrl - the URL to use when accessing the SFU * @param authCredentialPresentation - a serialized CallLinkAuthCredentialPresentation * @param linkRootKey - the root key for the call link * @param adminPasskey - the passkey specified when the link was created * @param newName - the new name to use */ updateCallLinkName(sfuUrl: string, authCredentialPresentation: Uint8Array, linkRootKey: CallLinkRootKey, adminPasskey: Uint8Array, newName: string): Promise>; /** * Asynchronous request to update a call link's restrictions. * * Possible failure codes include: * - 401: the room does not exist (and this is the wrong API to create a new room) * - 403: the admin passkey is incorrect * - 409: the room is currently in use, so restrictions cannot be changed at the moment * * This request is idempotent; if it fails due to a network issue, it is safe to retry. * * @param sfuUrl - the URL to use when accessing the SFU * @param authCredentialPresentation - a serialized CallLinkAuthCredentialPresentation * @param linkRootKey - the root key for the call link * @param adminPasskey - the passkey specified when the link was created * @param restrictions - the new restrictions to use */ updateCallLinkRestrictions(sfuUrl: string, authCredentialPresentation: Uint8Array, linkRootKey: CallLinkRootKey, adminPasskey: Uint8Array, restrictions: Exclude): Promise>; /** * Asynchronous request to delete a call link. * * Possible failure codes include: * - 403: the admin passkey is incorrect * - 409: conflict - there is an ongoing call for this room. * * This request is idempotent; if it fails due to a network issue, it is safe to retry. * * @param sfuUrl - the URL to use when accessing the SFU * @param authCredentialPresentation - a serialized CallLinkAuthCredentialPresentation * @param linkRootKey - the root key for the call link * @param adminPasskey - the passkey specified when the link was created */ deleteCallLink(sfuUrl: string, authCredentialPresentation: Uint8Array, linkRootKey: CallLinkRootKey, adminPasskey: Uint8Array): Promise>; receivedHttpResponse(requestId: number, status: number, body: Uint8Array): void; httpRequestFailed(requestId: number, debugInfo: string | undefined): void; getGroupCall(groupId: GroupId, sfuUrl: string, hkdfExtraInfo: Uint8Array, audioLevelsIntervalMillis: number | undefined, dredDuration: number | undefined, observer: GroupCallObserver): GroupCall | undefined; getCallLinkCall(sfuUrl: string, endorsementPublicKey: Uint8Array, authCredentialPresentation: Uint8Array, rootKey: CallLinkRootKey, adminPasskey: Uint8Array | undefined, hkdfExtraInfo: Uint8Array, audioLevelsIntervalMillis: number | undefined, dredDuration: number | undefined, observer: GroupCallObserver): GroupCall | undefined; peekGroupCall(sfuUrl: string, membershipProof: Uint8Array, groupMembers: Array): Promise; setMicrophoneWarmupEnabled(warmup: boolean): void; peekCallLinkCall(sfuUrl: string, authCredentialPresentation: Uint8Array, rootKey: CallLinkRootKey): Promise>; requestMembershipProof(clientId: GroupCallClientId): void; requestGroupMembers(clientId: GroupCallClientId): void; handleConnectionStateChanged(clientId: GroupCallClientId, connectionState: ConnectionState): void; handleJoinStateChanged(clientId: GroupCallClientId, joinState: JoinState, demuxId: number | undefined): void; handleNetworkRouteChanged(clientId: GroupCallClientId, localNetworkAdapterType: NetworkAdapterType): void; handleAudioLevels(clientId: GroupCallClientId, capturedLevel: RawAudioLevel, receivedLevels: Array): void; handleLowBandwidthForVideo(clientId: GroupCallClientId, recovered: boolean): void; handleReactions(clientId: GroupCallClientId, reactions: Array): void; handleRaisedHands(clientId: GroupCallClientId, raisedHands: Array): void; handleRemoteDevicesChanged(clientId: GroupCallClientId, remoteDeviceStates: Array): void; handlePeekChanged(clientId: GroupCallClientId, rawInfo: RawPeekInfo): void; handlePeekResponse(requestId: number, statusCode: number, rawInfo: RawPeekInfo | undefined): void; handleCallLinkResponse(requestId: number, statusCode: number, state: RawCallLinkState | undefined): void; handleEmptyResponse(requestId: number, statusCode: number, state: EmptyObj | undefined): void; handleEnded(clientId: GroupCallClientId, reason: CallEndReason, summary: CallSummary): void; groupCallRingUpdate(groupId: GroupId, ringId: bigint, sender: GroupCallUserId, state: RingUpdate): void; handleRtcStatsReportComplete(reportJson: string): void; handleSpeechEvent(clientId: GroupCallClientId, event: SpeechEvent): void; onRemoteMute(clientId: GroupCallClientId, demuxId: number): void; onObservedRemoteMute(clientId: GroupCallClientId, sourceDemuxId: number, targetDemuxId: number): void; onOutputDeviceChanged(devices: Array): void; onInputDeviceChanged(devices: Array): void; onLogMessage(level: number, fileName: string, line: number, message: string): void; logError(message: string): void; logWarn(message: string): void; logInfo(message: string): void; handleCallingMessage(message: CallingMessage, options: { remoteUserId: UserId; remoteUuid?: Uint8Array; remoteDeviceId: DeviceId; localDeviceId: DeviceId; ageSec: number; receivedAtCounter: number; receivedAtDate: number; senderIdentityKey: Uint8Array; receiverIdentityKey: Uint8Array; }): void; sendHttpRequest(requestId: number, url: string, method: HttpMethod, headers: { [name: string]: string; }, body: Uint8Array | undefined): void; sendCallMessage(recipientUuid: Uint8Array, message: Uint8Array, urgency: CallMessageUrgency): void; sendCallMessageToGroup(groupId: GroupId, message: Uint8Array, urgency: CallMessageUrgency, overrideRecipients: Array>): void; sendCallMessageToAdhocGroup(message: Uint8Array, urgency: CallMessageUrgency, expiration: Date, recipientsAndEndorsements: Array<{ recipientId: Uint8Array; endorsement: Uint8Array; }>): void; get call(): Call | null; getCall(callId: CallId): Call | null; accept(callId: CallId): void; decline(callId: CallId): void; ignore(callId: CallId): void; hangup(callId: CallId): void; getAudioInputs(): Array; setAudioInput(index: number): void; getAudioOutputs(): Array; setAudioOutput(index: number): void; /** * Enables or disables different voice processing techniques including: * - Acoustic Echo Cancellation (AEC) * - Noise Supression (NS) * - Automatic Gain Control (AGC) * * This request is idempotent * * @param enabled - whether to enable voice processing */ setVoiceProcessingEnabled(enabled: boolean): void; } export type CallSettings = { iceServers: Array; hideIp: boolean; dataMode: DataMode; audioLevelsIntervalMillis?: number; dredDuration?: number; }; type IceServer = { username?: string; password?: string; /** Provide hostname when urls contain IP addresses instead of hostname */ hostname?: string; urls: Array; }; export type AudioDevice = { name: string; index: number; uniqueId: string; i18nKey?: string; }; export declare enum VideoPixelFormatEnum { I420 = 0, Nv12 = 1, Rgba = 2 } export declare function videoPixelFormatToEnum(format: VideoPixelFormat): VideoPixelFormatEnum | undefined; /** * Interface for sending video frames to the RingRTC library. * * VideoFrameSender is used to transmit video frames (from a camera or screen share) over * RTP via the RingRTC library. */ export type VideoFrameSender = { /** * Sends a video frame to be transmitted via RingRTC. * * @param width - The width of the video frame in pixels * @param height - The height of the video frame in pixels * @param format - The pixel format of the video data * @param buffer - The raw video frame data */ sendVideoFrame(width: number, height: number, format: VideoPixelFormatEnum, buffer: Uint8Array): void; }; /** * Interface for retrieving received video frames from the RingRTC library. */ export type VideoFrameSource = { /** * Copies the latest frame into `buffer`. * * Note that `maxWidth` and `maxHeight` specify maximum dimensions, but allow for rotation, * i.e. a maximum of 1920x1080 will also allow portrait-mode 1080x1920. * * @param buffer - The destination buffer where the frame will be copied * @param maxWidth - Maximum width of the frame to receive * @param maxHeight - Maximum height of the frame to receive * @returns * A tuple of [width, height] of the received frame, containing: * - The width in pixels of the received frame * - The height in pixels of the received frame * * Returns undefined if no new frame is available */ receiveVideoFrame(buffer: Uint8Array, maxWidth: number, maxHeight: number): [number, number] | undefined; }; export declare class Call { private readonly _callManager; private readonly _remoteUserId; callId: CallId; private readonly _isIncoming; private readonly _isVideoCall; private _state; private _mediaSessionStarted; private _outgoingAudioEnabled; private _outgoingVideoEnabled; private _outgoingVideoIsScreenShare; private _remoteAudioEnabled; private _remoteVideoEnabled; outgoingAudioLevel: NormalizedAudioLevel; remoteAudioLevel: NormalizedAudioLevel; remoteSharingScreen: boolean; networkRoute: NetworkRoute; endedReason?: CallEndReason; summary?: CallSummary; handleStateChanged?: () => void; handleRemoteAudioEnabled?: () => void; handleRemoteVideoEnabled?: () => void; handleRemoteSharingScreen?: () => void; handleNetworkRouteChanged?: () => void; handleAudioLevels?: () => void; /** * Notification of low upload bandwidth for sending video. * * When this is first called, recovered will be false. The second call (if * any) will have recovered set to true and will be called when the upload * bandwidth is high enough to send video. * * @param recovered - whether there is enough bandwidth to send video reliably */ handleLowBandwidthForVideo?: (recovered: boolean) => void; renderVideoFrame?: (width: number, height: number, buffer: Uint8Array) => void; constructor(callManager: CallManager, remoteUserId: UserId, callId: CallId, isIncoming: boolean, isVideoCall: boolean, state: CallState); get remoteUserId(): UserId; get isIncoming(): boolean; get isVideoCall(): boolean; get state(): CallState; set state(state: CallState); setCallEnded(): void; accept(): void; decline(): void; ignore(): void; hangup(): void; get remoteAudioEnabled(): boolean; set remoteAudioEnabled(enabled: boolean); get remoteVideoEnabled(): boolean; set remoteVideoEnabled(enabled: boolean); setOutgoingAudioMuted(muted: boolean): void; setOutgoingVideoMuted(muted: boolean): void; setOutgoingVideoIsScreenShare(isScreenShare: boolean): void; sendVideoFrame(width: number, height: number, format: VideoPixelFormatEnum, buffer: Uint8Array): void; receiveVideoFrame(buffer: Uint8Array, maxWidth: number, maxHeight: number): [number, number] | undefined; updateDataMode(dataMode: DataMode): void; } export type GroupCallClientId = number; export declare enum ConnectionState { NotConnected = 0, Connecting = 1, Connected = 2, Reconnecting = 3 } export declare enum JoinState { NotJoined = 0, Joining = 1, Pending = 2, Joined = 3 } export declare enum SpeechEvent { StoppedSpeaking = 0, LowerHandSuggestion = 1 } export declare enum CallMessageUrgency { Droppable = 0, HandleImmediately = 1 } export declare enum RingUpdate { Requested = 0, ExpiredRequest = 1, AcceptedOnAnotherDevice = 2, DeclinedOnAnotherDevice = 3, BusyLocally = 4, BusyOnAnotherDevice = 5, CancelledByRinger = 6 } export declare enum HttpMethod { Get = 0, Put = 1, Post = 2, Delete = 3 } export declare class LocalDeviceState { connectionState: ConnectionState; joinState: JoinState; demuxId?: number; audioMuted: boolean; videoMuted: boolean; audioLevel: NormalizedAudioLevel; presenting: boolean; sharingScreen: boolean; networkRoute: NetworkRoute; constructor(); } export declare class RemoteDeviceState { demuxId: number; userId: Uint8Array; mediaKeysReceived: boolean; audioMuted: boolean | undefined; videoMuted: boolean | undefined; audioLevel: NormalizedAudioLevel; presenting: boolean | undefined; sharingScreen: boolean | undefined; videoAspectRatio: number | undefined; addedTime: string; speakerTime: string; forwardingVideo: boolean | undefined; isHigherResolutionPending: boolean; constructor(demuxId: number, userId: Uint8Array, addedTime: string, speakerTime: string, mediaKeysReceived: boolean); } export declare class GroupMemberInfo { userId: Uint8Array; userIdCipherText: Uint8Array; constructor(userId: Uint8Array, userIdCipherText: Uint8Array); } export declare class VideoRequest { demuxId: number; width: number; height: number; framerate: number | undefined; constructor(demuxId: number, width: number, height: number, framerate: number | undefined); } export declare enum GroupCallKind { SignalGroup = 0, CallLink = 1 } export type GroupCallObserver = { requestMembershipProof(groupCall: GroupCall): void; requestGroupMembers(groupCall: GroupCall): void; onLocalDeviceStateChanged(groupCall: GroupCall): void; onRemoteDeviceStatesChanged(groupCall: GroupCall): void; onAudioLevels(groupCall: GroupCall): void; onLowBandwidthForVideo(groupCall: GroupCall, recovered: boolean): void; onReactions(groupCall: GroupCall, reactions: Array): void; onRaisedHands(groupCall: GroupCall, raisedHands: Array): void; onPeekChanged(groupCall: GroupCall): void; onEnded(groupCall: GroupCall, reason: CallEndReason, summary: CallSummary): void; onSpeechEvent(groupCall: GroupCall, event: SpeechEvent): void; onRemoteMute(groupCall: GroupCall, demuxId: number): void; onObservedRemoteMute(groupCall: GroupCall, sourceDemuxId: number, targetDemuxId: number): void; }; export declare class GroupCall { private readonly _kind; private readonly _callManager; private readonly _observer; private readonly _clientId; get clientId(): GroupCallClientId; private readonly _localDeviceState; private _remoteDeviceStates; private _peekInfo; constructor(kind: GroupCallKind, callManager: CallManager, observer: GroupCallObserver, clientId: GroupCallClientId); getKind(): GroupCallKind; connect(): void; join(): void; leave(): void; disconnect(): void; getLocalDeviceState(): LocalDeviceState; getRemoteDeviceStates(): Array | undefined; getPeekInfo(): PeekInfo | undefined; getCallId(): CallId | undefined; setOutgoingAudioMuted(muted: boolean): void; setOutgoingAudioMutedRemotely(source: number): void; sendRemoteMuteRequest(target: number): void; react(value: string): void; raiseHand(raise: boolean): void; setOutgoingVideoMuted(muted: boolean): void; setPresenting(presenting: boolean): void; setOutgoingVideoIsScreenShare(isScreenShare: boolean): void; ringAll(): void; resendMediaKeys(): void; setDataMode(dataMode: DataMode): void; requestVideo(resolutions: Array, activeSpeakerHeight: number): void; approveUser(otherUserId: Uint8Array): void; denyUser(otherUserId: Uint8Array): void; removeClient(otherClientDemuxId: number): void; blockClient(otherClientDemuxId: number): void; setGroupMembers(members: Array): void; setMembershipProof(proof: Uint8Array): void; requestMembershipProof(): void; requestGroupMembers(): void; handleConnectionStateChanged(connectionState: ConnectionState): void; handleJoinStateChanged(joinState: JoinState, demuxId: number | undefined): void; handleNetworkRouteChanged(localNetworkAdapterType: NetworkAdapterType): void; handleAudioLevels(capturedLevel: RawAudioLevel, receivedLevels: Array): void; handleLowBandwidthForVideo(recovered: boolean): void; handleReactions(reactions: Array): void; handleRaisedHands(raisedHands: Array): void; handleRemoteDevicesChanged(remoteDeviceStates: Array): void; handlePeekChanged(info: PeekInfo): void; handleEnded(reason: CallEndReason, summary: CallSummary): void; sendVideoFrame(width: number, height: number, format: VideoPixelFormatEnum, buffer: Uint8Array): void; getVideoSource(remoteDemuxId: number): GroupCallVideoFrameSource; setRemoteAspectRatio(remoteDemuxId: number, aspectRatio: number): void; setRtcStatsInterval(intervalMillis: number): void; handleSpeechEvent(event: SpeechEvent): void; onRemoteMute(demuxId: number): void; onObservedRemoteMute(sourceDemuxId: number, targetDemuxId: number): void; } declare class GroupCallVideoFrameSource { private readonly _callManager; private readonly _groupCall; private readonly _remoteDemuxId; constructor(callManager: CallManager, groupCall: GroupCall, remoteDemuxId: number); receiveVideoFrame(buffer: Uint8Array, maxWidth: number, maxHeight: number): [number, number] | undefined; } export type UserId = string; export type DeviceId = number; export type CallId = bigint; export declare class CallingMessage { offer?: OfferMessage; answer?: AnswerMessage; iceCandidates?: Array; busy?: BusyMessage; hangup?: HangupMessage; opaque?: OpaqueMessage; destinationDeviceId?: DeviceId; } export declare class OfferMessage { callId: CallId; type: OfferType; opaque: Uint8Array; constructor(callId: CallId, type: OfferType, opaque: Uint8Array); } export declare enum OfferType { AudioCall = 0, VideoCall = 1 } export declare class AnswerMessage { callId: CallId; opaque: Uint8Array; constructor(callId: CallId, opaque: Uint8Array); } export declare class IceCandidateMessage { callId: CallId; opaque: Uint8Array; constructor(callId: CallId, opaque: Uint8Array); } export declare class BusyMessage { callId: CallId; constructor(callId: CallId); } export declare class HangupMessage { callId: CallId; type: HangupType; deviceId: DeviceId; constructor(callId: CallId, type: HangupType, deviceId: DeviceId); } export declare class OpaqueMessage { data?: Uint8Array; } export declare enum HangupType { Normal = 0, Accepted = 1, Declined = 2, Busy = 3, NeedPermission = 4 } export declare enum DataMode { Low = 0, Normal = 1 } export declare enum RingCancelReason { DeclinedByUser = 0, Busy = 1 } export type CallManager = { setConfig(config: Config): void; setSelfUuid(uuid: Uint8Array): void; addAsset(assetGroup: string, filePath: string | null, content: Uint8Array | null): void; createOutgoingCall(remoteUserId: UserId, isVideoCall: boolean, localDeviceId: DeviceId): CallId; proceed(callId: CallId, iceServers: Array, hideIp: boolean, dataMode: DataMode, audioLevelsIntervalMillis: number, dredDuration: number): void; accept(callId: CallId): void; ignore(callId: CallId): void; hangup(): void; cancelGroupRing(groupId: GroupId, ringId: string, reason: RingCancelReason | null): void; signalingMessageSent(callId: CallId): void; signalingMessageSendFailed(callId: CallId): void; setOutgoingAudioEnabled(enabled: boolean): void; setMicrophoneWarmupEnabled(enabled: boolean): void; setOutgoingVideoEnabled(enabled: boolean): void; setOutgoingVideoIsScreenShare(enabled: boolean): void; updateDataMode(dataMode: DataMode): void; sendVideoFrame(width: number, height: number, format: VideoPixelFormatEnum, buffer: Uint8Array): void; receiveVideoFrame(buffer: Uint8Array, maxWidth: number, maxHeight: number): [number, number] | undefined; receivedOffer(remoteUserId: UserId, remoteDeviceId: DeviceId, localDeviceId: DeviceId, messageAgeSec: number, callId: CallId, offerType: OfferType, opaque: Uint8Array, senderIdentityKey: Uint8Array, receiverIdentityKey: Uint8Array): void; receivedAnswer(remoteUserId: UserId, remoteDeviceId: DeviceId, callId: CallId, opaque: Uint8Array, senderIdentityKey: Uint8Array, receiverIdentityKey: Uint8Array): void; receivedIceCandidates(remoteUserId: UserId, remoteDeviceId: DeviceId, callId: CallId, candidates: Array>): void; receivedHangup(remoteUserId: UserId, remoteDeviceId: DeviceId, callId: CallId, hangupType: HangupType, hangupDeviceId: DeviceId | null): void; receivedBusy(remoteUserId: UserId, remoteDeviceId: DeviceId, callId: CallId): void; receivedCallMessage(remoteUserId: Uint8Array, remoteDeviceId: DeviceId, localDeviceId: DeviceId, data: Uint8Array, messageAgeSec: number): void; receivedHttpResponse(requestId: number, status: number, body: Uint8Array): void; httpRequestFailed(requestId: number, debugInfo: string | undefined): void; createGroupCallClient(groupId: GroupId, sfuUrl: string, hkdfExtraInfo: Uint8Array, audioLevelsIntervalMillis: number, dredDuration: number): GroupCallClientId; createCallLinkCallClient(sfuUrl: string, endorsementPublicKey: Uint8Array, authCredentialPresentation: Uint8Array, linkRootKey: Uint8Array, adminPasskey: Uint8Array | undefined, hkdfExtraInfo: Uint8Array, audioLevelsIntervalMillis: number, dredDuration: number): GroupCallClientId; deleteGroupCallClient(clientId: GroupCallClientId): void; connect(clientId: GroupCallClientId): void; join(clientId: GroupCallClientId): void; leave(clientId: GroupCallClientId): void; disconnect(clientId: GroupCallClientId): void; setOutgoingAudioMuted(clientId: GroupCallClientId, muted: boolean): void; setOutgoingAudioMutedRemotely(clientId: GroupCallClientId, source: number): void; sendRemoteMuteRequest(clientId: GroupCallClientId, target: number): void; setOutgoingVideoMuted(clientId: GroupCallClientId, muted: boolean): void; setPresenting(clientId: GroupCallClientId, presenting: boolean): void; setOutgoingGroupCallVideoIsScreenShare(clientId: GroupCallClientId, isScreenShare: boolean): void; groupRing(clientId: GroupCallClientId, recipient: Uint8Array | undefined): void; groupReact(clientId: GroupCallClientId, value: string): void; groupRaiseHand(clientId: GroupCallClientId, raise: boolean): void; resendMediaKeys(clientId: GroupCallClientId): void; setDataMode(clientId: GroupCallClientId, dataMode: DataMode): void; requestVideo(clientId: GroupCallClientId, resolutions: Array, activeSpeakerHeight: number): void; approveUser(clientId: GroupCallClientId, otherUserId: Uint8Array): void; denyUser(clientId: GroupCallClientId, otherUserId: Uint8Array): void; removeClient(clientId: GroupCallClientId, otherClientDemuxId: number): void; blockClient(clientId: GroupCallClientId, otherClientDemuxId: number): void; setGroupMembers(clientId: GroupCallClientId, members: Array): void; setMembershipProof(clientId: GroupCallClientId, proof: Uint8Array): void; receiveGroupCallVideoFrame(clientId: GroupCallClientId, remoteDemuxId: number, buffer: Uint8Array, maxWidth: number, maxHeight: number): [number, number] | undefined; setRtcStatsInterval(clientId: GroupCallClientId, intervalMillis: number): void; readCallLink(requestId: number, sfuUrl: string, authCredentialPresentation: Uint8Array, linkRootKey: Uint8Array): void; createCallLink(requestId: number, sfuUrl: string, createCredentialPresentation: Uint8Array, linkRootKey: Uint8Array, adminPasskey: Uint8Array, callLinkPublicParams: Uint8Array, restrictions: number | undefined): void; updateCallLink(requestId: number, sfuUrl: string, authCredentialPresentation: Uint8Array, linkRootKey: Uint8Array, adminPasskey: Uint8Array, newName: string | undefined, newRestrictions: number | undefined, newRevoked: boolean | undefined): void; deleteCallLink(requestId: number, sfuUrl: string, authCredentialPresentation: Uint8Array, linkRootKey: Uint8Array, adminPasskey: Uint8Array): void; peekGroupCall(requestId: number, sfu_url: string, membership_proof: Uint8Array, group_members: Array): void; peekCallLinkCall(requestId: number, sfuUrl: string, authCredentialPresentation: Uint8Array, linkRootKey: Uint8Array): void; getAudioInputs(): Array; setAudioInput(index: number): void; getAudioOutputs(): Array; setAudioOutput(index: number): void; setVoiceProcessingEnabled(enabled: boolean): void; }; export type CallManagerCallbacks = { onStartOutgoingCall(remoteUserId: UserId, callId: CallId): void; onStartIncomingCall(remoteUserId: UserId, callId: CallId, isVideoCall: boolean): void; onCallState(remoteUserId: UserId, state: CallState): void; onCallRejected(remoteUserId: UserId, callId: CallId, rejectReason: CallRejectReason, ageSec: number): void; onCallEnded(remoteUserId: UserId, callId: CallId, endedReason: CallEndReason, summary: CallSummary): void; onRemoteAudioEnabled(remoteUserId: UserId, enabled: boolean): void; onRemoteVideoEnabled(remoteUserId: UserId, enabled: boolean): void; onRemoteSharingScreen(remoteUserId: UserId, enabled: boolean): void; onSendOffer(remoteUserId: UserId, remoteDeviceId: DeviceId, callId: CallId, broadcast: boolean, mediaType: number, opaque: Uint8Array): void; onSendAnswer(remoteUserId: UserId, remoteDeviceId: DeviceId, callId: CallId, broadcast: boolean, opaque: Uint8Array): void; onSendIceCandidates(remoteUserId: UserId, remoteDeviceId: DeviceId, callId: CallId, broadcast: boolean, candidates: Array>): void; onSendHangup(remoteUserId: UserId, remoteDeviceId: DeviceId, callId: CallId, broadcast: boolean, HangupType: HangupType, hangupDeviceId: DeviceId | null): void; onSendBusy(remoteUserId: UserId, remoteDeviceId: DeviceId, callId: CallId, broadcast: boolean): void; sendCallMessage(recipientUuid: Uint8Array, message: Uint8Array, urgency: CallMessageUrgency): void; sendCallMessageToGroup(groupId: GroupId, message: Uint8Array, urgency: CallMessageUrgency, overrideRecipients: Array>): void; sendCallMessageToAdhocGroup(message: Uint8Array, urgency: CallMessageUrgency, expiration: Date, recipientsAndEndorsements: Array<{ recipientId: Uint8Array; endorsement: Uint8Array; }>): void; sendHttpRequest(requestId: number, url: string, method: HttpMethod, headers: { [name: string]: string; }, body: Uint8Array | undefined): void; requestMembershipProof(clientId: GroupCallClientId): void; requestGroupMembers(clientId: GroupCallClientId): void; handleConnectionStateChanged(clientId: GroupCallClientId, connectionState: ConnectionState): void; handleJoinStateChanged(clientId: GroupCallClientId, joinState: JoinState, demuxId: number | undefined): void; handleRemoteDevicesChanged(clientId: GroupCallClientId, remoteDeviceStates: Array): void; handlePeekChanged(clientId: GroupCallClientId, rawInfo: RawPeekInfo): void; handlePeekResponse(requestId: number, statusCode: number, rawInfo: RawPeekInfo | undefined): void; handleEnded(clientId: GroupCallClientId, reason: CallEndReason, summary: CallSummary): void; onLogMessage(level: number, fileName: string, line: number, message: string): void; }; export declare enum CallState { Prering = "idle", Ringing = "ringing", Accepted = "connected", Reconnecting = "connecting", Ended = "ended" } export declare enum CallEndReason { LocalHangup = 0, RemoteHangup = 1, RemoteHangupNeedPermission = 2, RemoteHangupAccepted = 3, RemoteHangupDeclined = 4, RemoteHangupBusy = 5, RemoteBusy = 6, RemoteGlare = 7, RemoteReCall = 8, Timeout = 9, InternalFailure = 10, SignalingFailure = 11, ConnectionFailure = 12, AppDroppedCall = 13, DeviceExplicitlyDisconnected = 14, ServerExplicitlyDisconnected = 15, DeniedRequestToJoinCall = 16, RemovedFromCall = 17, CallManagerIsBusy = 18, SfuClientFailedToJoin = 19, FailedToCreatePeerConnectionFactory = 20, FailedToNegotiatedSrtpKeys = 21, FailedToCreatePeerConnection = 22, FailedToStartPeerConnection = 23, FailedToUpdatePeerConnection = 24, FailedToSetMaxSendBitrate = 25, IceFailedWhileConnecting = 26, IceFailedAfterConnected = 27, ServerChangedDemuxId = 28, HasMaxDevices = 29 } export declare enum CallRejectReason { GlareHandlingFailure = 0, ReceivedOfferExpired = 1, ReceivedOfferWhileActive = 2, ReceivedOfferWithGlare = 3 } export declare enum CallLogLevel { Off = 0, Error = 1, Warn = 2, Info = 3, Debug = 4, Trace = 5 } export {};