/// import { EventEmitter } from 'events'; import { IQ } from 'stanza/protocol'; import { LRUCache } from 'lru-cache'; import { SessionManager } from 'stanza/jingle'; import { SessionOpts } from 'stanza/jingle/Session'; import { Client } from './client'; import { ExtendedRTCIceServer, IClientOptions, SessionTypes, IPendingSession, StreamingClientExtension, NRProxyStat, InsightAction } from './types/interfaces'; import { NamedAgent } from './types/named-agent'; import { StanzaMediaSession } from './types/stanza-media-session'; import { IMediaSession } from './types/media-session'; export interface InitRtcSessionOptions { stream?: MediaStream; provideVideo?: boolean; provideAudio?: boolean; mediaPurpose?: string; jid?: string; conversationId?: string; sourceCommunicationId?: string; } export declare class WebrtcExtension extends EventEmitter implements StreamingClientExtension { client: Client; ignoredSessions: LRUCache; private earlyIceCandidates; logger: any; pendingSessions: { [sessionId: string]: IPendingSession; }; config: { allowIPv6: boolean; optOutOfWebrtcStatsTelemetry?: boolean; }; private statsArr; private throttleSendStatsInterval; private currentMaxStatSize; private statsSizeDecreaseAmount; private statBuffer; private throttledSendStats; private discoRetries; private refreshIceServersRetryPromise; private refreshIceServersTimer; private iceServers; private stanzaInstance?; private webrtcSessions; private reinviteCache; private sessionsMap; get jid(): string | undefined; constructor(client: Client, clientOptions: IClientOptions); private onOnlineStatusChange; handleStanzaInstanceChange(stanzaInstance: NamedAgent): Promise; configureNewStanzaInstance(stanzaInstance: NamedAgent): Promise; private configureStanzaIceServers; private handleGenesysOffer; private applyEarlyIceCandidates; private handleGenesysRenegotiate; private handleGenesysIceCandidate; private handleGenesysTerminate; private getSessionById; sendIq(iq: IQ): Promise; handleMessage(msg: any): Promise; handleGenesysWebrtcStanza(iq: IQ): Promise; prepareSession(options: SessionOpts): StanzaMediaSession | undefined; proxyStatsForSession(session: IMediaSession): void; addStatToQueue(stat: InsightAction): void; getLogDetailsForPendingSessionId(sessionId: string): { conversationId?: string; sessionId: string; sessionType?: SessionTypes; }; sendStatsImmediately(): void; sendStats(): Promise; addEventListeners(): void; /** * Stanza Handlers */ private handlePropose; private handleRetract; /** * Inform the client that another client has already taken care of the pendingSession */ private handledIncomingRtcSession; /** * Exposed Api */ initiateRtcSession(opts: InitRtcSessionOptions): Promise; acceptRtcSession(sessionId: string): Promise; rejectRtcSession(sessionId: string, ignore?: boolean): Promise; rtcSessionAccepted(sessionId: string): Promise; notifyScreenShareStart(session: IMediaSession): Promise; notifyScreenShareStop(session: IMediaSession): Promise; cancelRtcSession(sessionId: string): Promise; refreshIceServers(): Promise; _refreshIceServers(stanzaInstance?: NamedAgent): Promise; setIceServers(iceServers: any[], stanzaInstance: NamedAgent): void; getIceTransportPolicy(): "all" | "relay" | undefined; setIceTransportPolicy(policy: 'relay' | 'all', stanzaInstance: NamedAgent): void; getSessionTypeByJid(jid: string): SessionTypes; getSessionManager(): SessionManager | undefined; getAllSessions(): IMediaSession[]; proxyNRStat(stat: NRProxyStat): void; get expose(): WebrtcExtensionAPI; } export interface WebrtcExtensionAPI { on: (event: string, handler: (...args: any) => void) => void; once: (event: string, handler: (...args: any) => void) => void; off: (event: string, handler: (...args: any) => void) => void; removeAllListeners(event?: string | symbol): void; removeListener(event: string | symbol, listener: (...args: any[]) => void): void; refreshIceServers(): Promise; acceptRtcSession(sessionId: string): void; rejectRtcSession(sessionId: string, ignore?: boolean): void; cancelRtcSession(sessionId: string): void; rtcSessionAccepted(sessionId: string): void; initiateRtcSession(opts: InitRtcSessionOptions): Promise; notifyScreenShareStart(session: IMediaSession): void; notifyScreenShareStop(session: IMediaSession): void; getSessionTypeByJid(jid: string): SessionTypes; getSessionManager: () => SessionManager | undefined; getAllSessions: () => IMediaSession[]; proxyNRStat: (stat: NRProxyStat) => void; }