Call | sinch-rtc
Description: Documentation for sinch-rtc

# Interface Call

interface Call {
details: CallDetails;
direction: Direction;
headers: undefined | Record<string, string>;
id: string;
incomingStream: undefined | MediaStream;
outgoingStream: undefined | MediaStream;
remoteUserDisplayName?: string;
remoteUserId: string;
state: CallState;
addListener(listener: CallListener): void;
answer(): Promise<void>;
hangup(): void;
mute(): void;
pauseVideo(): void;
removeListener(listener: CallListener): void;
resumeVideo(): void;
sendDtmf(keys: string): void;
setLocalAudioFrameListener(
listener: null | LocalAudioFrameListener,
): Promise<void>;
unmute(): void;
}

##### Index

### Properties

details
direction
headers
id
incomingStream
outgoingStream
remoteUserDisplayName?
remoteUserId
state

### Methods

addListener
answer
hangup
mute
pauseVideo
removeListener
resumeVideo
sendDtmf
setLocalAudioFrameListener
unmute

## Properties

### details

details: CallDetails

Returns metadata about the call.

#### Returns

a CallDetails containing metadata about the call.

### direction

direction: Direction

Returns the Direction of the call.

#### Returns

the direction of the call.

### headers

headers: undefined | Record<string, string>

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 CallListener are called.

#### Returns

the headers.

### id

id: string

Returns the call identifier.

#### Returns

the call identifier.

### incomingStream

incomingStream: undefined | MediaStream

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

### outgoingStream

outgoingStream: undefined | MediaStream

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.

### `Optional`remoteUserDisplayName

remoteUserDisplayName?: string

Returns the callers displayName.

#### Returns

the callers displayName.

### remoteUserId

remoteUserId: string

Returns the identifier of the remote participant in the call.

#### Returns

the identifier of the remote participant in the call.

### state

state: CallState

Returns the CallState the call is currently in.

#### Returns

the state the call is currently in.

## Methods

### addListener

- addListener(listener: CallListener): void

  Adds a listener to the call.

  #### Parameters

  - listener: CallListener

    the CallListener

  #### Returns void

### answer

- answer(): Promise<void>

  Answers an incoming call.

  #### Returns Promise<void>

  #### Throws

  InvalidOperationError If the call is not incoming.

  #### Throws

  InvalidOperationError If the user hasn't granted required media permissions.

### hangup

- hangup(): 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.

  #### Returns void

### mute

- mute(): void

  Mute audio.

  #### Returns void

### pauseVideo

- pauseVideo(): void

  Pause the video capturing.

  #### Returns void

### removeListener

- removeListener(listener: CallListener): void

  Removes a listener from the call.

  #### Parameters

  - listener: CallListener

    the CallListener

  #### Returns void

### resumeVideo

- resumeVideo(): void

  Resume the video capturing.

  #### Returns void

### sendDtmf

- sendDtmf(keys: string): void

  Sends one or more DTMF tones for tone dialing. (Only applicable for calls terminated to PSTN (Publicly Switched Telephone Network)).

  #### Parameters

  - keys: string

    May be a series of DTMF keys. Each key must be in [0-9, #, *, A-D].

  #### Returns void

  #### Throws

  IllegalArgumentException if any of the given DTMF keys is invalid

### setLocalAudioFrameListener

- setLocalAudioFrameListener(
  listener: null | LocalAudioFrameListener,
  ): Promise<void>

  Installs (or clears, when `null`) an `AudioWorklet` based processor on the outgoing (local microphone) audio path. The processed audio is what is sent to the remote peer and is reflected by outgoingStream.

  Loading the worklet module is asynchronous; the returned promise resolves once the processor is active. Passing `null` tears down the graph and restores the raw microphone audio. May be called before or during a call, and repeatedly to swap processors.

  If installing the listener fails, the returned promise rejects and the outgoing audio is left on the unprocessed (native) microphone — any previously installed listener is removed rather than restored. Outbound audio therefore always keeps flowing.

  #### Parameters

  - listener: null | LocalAudioFrameListener

    the LocalAudioFrameListener to install, or `null` to remove any currently installed processor.

  #### Returns Promise<void>

  a promise that resolves once the processor has been installed or removed, and rejects if installation failed (leaving unprocessed audio on the wire).

### unmute

- unmute(): void

  Unmute audio.

  #### Returns void