import { BaseObservableValue } from "../../observable/value"; import { IDisposable } from "../../utils/Disposables"; import { WebRTC } from "../../platform/types/WebRTC"; import { Stream } from "../../platform/types/MediaDevices"; import { MuteSettings } from "./common"; import { CallErrorCode } from "./callEventTypes"; import type { ILogItem } from "../../logging/types"; import type { TimeoutCreator } from "../../platform/types/types"; import type { LocalMedia } from "./LocalMedia"; import type { MCallBase, SignallingMessage } from "./callEventTypes"; import type { ErrorBoundary } from "../../utils/ErrorBoundary"; export type Options = { webRTC: WebRTC; forceTURN: boolean; turnServer: BaseObservableValue; createTimeout: TimeoutCreator; emitUpdate: (peerCall: PeerCall, params: any, log: ILogItem) => void; errorBoundary: ErrorBoundary; sendSignallingMessage: (message: SignallingMessage, log: ILogItem) => Promise; }; export declare enum IncomingMessageAction { InviteGlare = 0, Handle = 1, Ignore = 2 } export declare class RemoteMedia { userMedia?: Stream | undefined; screenShare?: Stream | undefined; constructor(userMedia?: Stream | undefined, screenShare?: Stream | undefined); } /** * Does WebRTC signalling for a single PeerConnection, and deals with WebRTC wrappers from platform * */ /** Implements a call between two peers with the signalling state keeping, while still delegating the signalling message sending. Used by GroupCall.*/ export declare class PeerCall implements IDisposable { private callId; private readonly options; private readonly logItem; private readonly peerConnection; private _state; private direction; private localMedia?; private localMuteSettings?; private candidateSendQueue; private remoteCandidateBuffer?; private remoteSDPStreamMetadata?; private responsePromiseChain?; private opponentPartyId?; private hangupParty; private disposables; private statePromiseMap; private _remoteTrackToStreamId; private _remoteStreams; private makingOffer; private ignoreOffer; private sentEndOfCandidates; private iceDisconnectedTimeout?; private _dataChannel?; private _hangupReason?; private _remoteMedia; private _remoteMuteSettings; private flushCandidatesLog?; constructor(callId: string, options: Options, logItem: ILogItem); get dataChannel(): any | undefined; get state(): CallState; get hangupReason(): CallErrorCode | undefined; get remoteMedia(): Readonly; get remoteMuteSettings(): MuteSettings; call(localMedia: LocalMedia, localMuteSettings: MuteSettings, log: ILogItem): Promise; answer(localMedia: LocalMedia, localMuteSettings: MuteSettings, log: ILogItem): Promise; setMedia(localMedia: LocalMedia, log: ILogItem): Promise; setMuted(localMuteSettings: MuteSettings, log: ILogItem): Promise; hangup(errorCode: CallErrorCode, log: ILogItem): Promise; private _hangup; getMessageAction(message: SignallingMessage): IncomingMessageAction; handleIncomingSignallingMessage(message: SignallingMessage, partyId: PartyId, log: ILogItem): ILogItem; private sendHangupWithCallId; private handleNegotiation; /** * @returns {boolean} whether or not this call should be replaced * */ handleInviteGlare(message: SignallingMessage, partyId: PartyId, log: ILogItem): { shouldReplace: boolean; log?: ILogItem; }; private handleHangupReceived; private handleFirstInvite; private handleInvite; private handleAnswer; private handleIceGatheringState; private handleLocalIceCandidate; private handleRemoteIceCandidates; private onNegotiateReceived; private sendAnswer; private queueCandidate; private sendCandidateQueue; private updateRemoteSDPStreamMetadata; private addBufferedIceCandidates; private addIceCandidates; private onIceConnectionStateChange; private setState; private waitForState; private terminate; private getSDPMetadata; private findReceiverForStream; private findTransceiverForTrack; private onRemoteTrack; private updateRemoteMedia; private updateLocalMedia; private delay; private sendSignallingMessage; dispose(): void; close(reason: CallErrorCode | undefined, log: ILogItem): void; } type PartyId = string | null; export declare enum CallParty { Local = "local", Remote = "remote" } export declare enum CallState { Fledgling = "fledgling", CreateOffer = "create_offer", InviteSent = "invite_sent", CreateAnswer = "create_answer", Connecting = "connecting", Connected = "connected", Ringing = "ringing", Ending = "ending", Ended = "ended" } export declare enum CallDirection { Inbound = "inbound", Outbound = "outbound" } export declare class CallError extends Error { code: string; constructor(code: CallErrorCode, msg: string, err: Error); } export declare function handlesEventType(eventType: string): boolean; export {}; /** * tests to write: * * upgradeCall: adding a track with setMedia calls the correct methods on the peerConnection * upgradeCall: removing a track with setMedia calls the correct methods on the peerConnection * upgradeCall: replacing compatible track with setMedia calls the correct methods on the peerConnection * upgradeCall: replacing incompatible track (sender.replaceTrack throws) with setMedia calls the correct methods on the peerConnection * * */