import { MediaChannel } from './media-channel'; import { Verto } from './verto/verto'; import { ZiwoEventType } from './events'; export declare enum CallStatus { Stopped = "stopped", Running = "running", OnHold = "onHold" } export interface CallState { state: ZiwoEventType; date: Date; dateUNIX: number; } /** * Call hold a physical instance of a call. * They provide useful information but also methods to change the state of the call. * * @callId : unique identifier used for Jorel protocol * @primaryCallId : link to first call of the chain if existing * @rtcPeerConnection : the WebRTC interface * @channel : holds the media stream (input/output) * @verto : holds a reference to Verto singleton * @phoneNumber : peer phone number * @direction : call's direction * @states : array containing all the call's status update with a Datetime. * @initialPayload : complete payload received/sent to start the call */ export declare class Call { readonly callId: string; readonly primaryCallId?: string; readonly rtcPeerConnection: RTCPeerConnection; readonly verto: Verto; readonly phoneNumber: string; readonly direction: 'outbound' | 'inbound' | 'internal' | 'service'; readonly states: CallState[]; channel: MediaChannel; private readonly initialPayload?; constructor(callId: string, verto: Verto, phoneNumber: string, login: string, rtcPeerConnection: RTCPeerConnection, channel: MediaChannel, direction: 'outbound' | 'inbound', initialPayload?: any); /** * Use when current state is `ringing` to switch the call to `active` */ answer(): void; /** * Use when current state is 'ringing' or 'active' to stop the call */ hangup(): void; /** * Recover the call currently in recovering state */ recover(): void; /** * Use to send a digit */ dtmf(char: string): void; /** * Set the call on hold */ hold(): void; /** * Unhold the call */ unhold(): void; /** * Mute user's microphone */ mute(): void; /** * Unmute user's microphone */ unmute(): void; /** * Start an attended transfer. * Attended transfer set the current call on hold and call @destination * Use `proceedAttendedTransfer` to confirm the transfer */ attendedTransfer(destination: string): Promise; /** * Confirm an attended transfer. * Stop the current call and create a new call between the initial correspondant and the @destination */ proceedAttendedTransfer(transferCall: Call): void; /** * Stop the current call and directly forward the correspondant to @destination */ blindTransfer(destination: string): void; /** * Push state add a new state in the stack and throw an event */ pushState(type: ZiwoEventType, payload?: any): void; private toggleSelfStream; }