UNPKG

sinch-rtc

Version:

RTC JavaScript/Web SDK

115 lines (114 loc) 3.48 kB
import { Direction } from "../session/Direction"; import { CallListener } from "./listeners/CallListener"; import { CallDetails } from "./CallDetails"; import { CallState } from "./models"; export interface Call { /** * Adds a listener to the call. * * @param listener - the {@link CallListener} */ addListener(listener: CallListener): void; /** * Removes a listener from the call. * * @param listener - the {@link CallListener} */ removeListener(listener: CallListener): void; /** * Ends the call, regardless of what state it is in. If the call is an * incoming call that has not yet been answered, the call will be reported * as denied to the caller. */ hangup(): void; /** * Answers an incoming call. * * @throws InvalidOperationError If the call is not incoming. * @throws InvalidOperationError If the user hasn't granted required media permissions. */ answer(): Promise<void>; /** * Mute audio. */ mute(): void; /** * Unmute audio. */ unmute(): void; /** * Pause the video capturing. */ pauseVideo(): void; /** * Resume the video capturing. */ resumeVideo(): void; /** * Sends one or more DTMF tones for tone dialing. (Only applicable for calls terminated * to PSTN (Publicly Switched Telephone Network)). * * @param keys - May be a series of DTMF keys. Each key must be in [0-9, #, *, A-D]. * @throws IllegalArgumentException if any of the given DTMF keys is invalid */ sendDtmf(keys: string): void; /** * Returns metadata about the call. * * @returns a {@link CallDetails} containing metadata about the call. */ details: CallDetails; /** * Returns the headers. * * IMPORTANT: Headers may not be immediately available due to * push payload size limitations. * If it's not immediately available, it will be available after the `onCallProgressing` * or `onCallEstablished` callbacks for {@link CallListener} are called. * * @returns the headers. */ headers: Record<string, string> | undefined; /** * Returns the identifier of the remote participant in the call. * * @returns the identifier of the remote participant in the call. */ remoteUserId: string; /** * Returns the {@link CallState} the call is currently in. * * @returns the state the call is currently in. */ state: CallState; /** * Returns the call identifier. * * @returns the call identifier. */ id: string; /** * Returns the {@link Direction} of the call. * * @returns the direction of the call. */ direction: Direction; /** * Returns the MediaStream that is received to your device from the remote peer during a call. * * @returns the MediaStream that is received to your device from the remote peer during a call */ incomingStream: MediaStream | undefined; /** * Returns the MediaStream that is sent from your device to the remote peer during a call. * * @returns the MediaStream that is sent from your device to the remote peer during a call. */ outgoingStream: MediaStream | undefined; /** * Returns the callers displayName. * * @returns the callers displayName. */ remoteUserDisplayName?: string; }