Class: Call

Call

Call

Designates a 1-1 call with another contact.
During a call, both the user and the contact may publish and subscribe to each other's streams.

Extends

Methods


<static> getAvailableEvents()

Returns available events for this class

Returns:
Type
Array.<string>

destroy()

Cleans up all resources attached to this one.


getContact()

Returns called contact

Returns:

Called contact

Type
Contact

getId()

Returns call id

Returns:

Call id

Type
string

getPublishedStreams()

Returns call's currently published streams

Returns:

Array of call currently published streams

Type
Array.<Streams>

getReceivedStreams()

Returns call's currently received streams

Returns:

Array of call currently received streams

Type
Array.<Streams>

getRecordingInfo()

Returns the recoding information, if any.

Returns:
Type
RecordingInfo | null

getStatus()

Returns called status

Returns:

Call status, value can be CALL_STATUS_WAITING_FOR_CALLEE, CALL_STATUS_ONGOING, CALL_STATUS_ENDED

Type
Symbol

hangUp()

Stops call with contact

Returns:
Type
Void

isRecorded()

Returns whether call is recorded or not

Returns:
Type
boolean

on(listener)

Adds a listener to a Observable event

Parameters:
Name Type Description
listener function
Inherited From:
Overrides:
Returns:

this instance for chaining

Type
Observable

removeListener(eventType, listener)

Remove existing listener to Observable event

Parameters:
Name Type Description
eventType String
listener function
Inherited From:
Overrides:
Returns:

this instance for chaining

Type
Observable

replacePublishedStreams(newStream, callbacks)

Replaces the currently published stream by a given one.
If the first parameter is null then the second parameter must provides a property named
getStream. The getStream property shall be a function returning a Promise of a Stream.

Parameters:
Name Type Description
newStream Stream

New stream to be published

callbacks object

Callbacks.

Properties
Name Type Description
getStream function

A function returning a promise of a stream.

Returns:

The newly assigned stream.

Type
Promise.<Stream>

startRecording()

Starts recording the call represented by this one.
Only available for initially recorded call.

Returns:
Type
Promise

stopPublishedStreams(options)

Stops the currently published stream.

Parameters:
Name Type Description
options object

Options.

Returns:

When it is done.

Type
Promise.<Stream>

stopRecording()

Stops recording the call represented by this one.
Only available for initially recorded call.

Returns:
Type
Promise

Events


accepted

Fired when contact accepts call

Type: Void

declined

Fired when contact decline call

Type: object
Properties:
Name Type Description
reason string

can be User_Busy, User_Refused_Call, User_Media_Error, Hangup_From_Callee, Hangup_From_Caller, stop_ScreenSharing, Ice_disconnected, Ice_failed, WebRTC_Plugin_Installation_needed, User_Not_Found, disconnected, call take on other device, bye on other device, DataChannel_Not_Supported


desktopCapture

Fired on user media access error :
This event is fired when user has not granted the access to his micro and webcam or brower was not able to access medias

Type: object
Properties:
Name Type Description
event String

event that has happened. Values can be : UserMediaError_HTTPS_needed, UserMediaError, Extension_installation_Error, Extension_not_installed, Browser_Not_Compatible


disconnectionWarning

Fired when an disconnection is detected
This event is fired as a warning once a disconnection error was detected on the call.

Type: object
Properties:
Name Type Description
tries string

number of warning send


error

Fired when an error is detected
This event is fired once an error was detected on the call.

Type: object
Properties:
Name Type Description
errorCode String

Code description of the error. Check possible values below.

errorInfo String

Code information about the error. Check possible values below.

Possible errors values are the following: (errorInfo, errorCode)

Connection errors:
  • ice disconnection detected: ICE_CONNECTION_STATE_DISCONNECTED
  • ice connection failed detected: ICE_CONNECTION_STATE_FAILED
  • distant ice disconnection detected: DISTANT_ICE_CONNECTION_STATE_DISCONNECTED
  • distant ice connection failed detected: DISTANT_ICE_CONNECTION_STATE_FAILED
Errors on signaling processing:
  • 200OK received but callId is not matching, no process : NOT_MATCHING_CALLID_ON_200OK
  • Cannot find call to process Update : CALL_NOT_FOUND_ON_UPDATE
  • Cannot find call to process 200 Update : CALL_NOT_FOUND_ON_200UPDATE
  • Call aborted after calls retries (maxCallsRetriesDuration reached) : CALL_ABORTED
Errors on Media establishment processing:
  • Set local Description Failure : SET_LOCAL_DESCRIPTION_FAILURE
  • Set remote Description Failure : SET_REMOTE_DESCRIPTION_FAILURE
Errors on calling API:
  • parameter error when calling function: setUnidirectionalCall(): PARAMETER_ERROR_SETUNIDIRCALL
  • parameter error when calling function: setNtoNConf(): PARAMETER_ERROR_SETNTONCONF
  • parameter error when calling function: setRTPMedia(): PARAMETER_ERROR_SETRTPMEDIA
  • parameter error when calling function: setMediaRoutingMode(): PARAMETER_ERROR_SETMEDIAROUTINGMODE
  • parameter error when calling function: setUserAcceptOnIncomingCall(): PARAMETER_ERROR_SETUSERACCEPTONINCOCALL
  • Trying to add a listener on an unknown event: UNKNOWN_EVENT_ON_ADDLISTENER
  • parameter error when calling function: setAllowMultipleCalls(): PARAMETER_ERROR_SETALLOWMULTIPLECALLS
Errors about recording :
  • Room not found when starting recording: START_RECORD_ROOM_NOT_FOUND
  • Caller not found when starting recording: START_RECORD_CALLER_NOT_FOUND
  • Media not found when starting recording: START_RECORD_MEDIA_FOUND
  • Recording is already ongoing: START_RECORD_ALREADY_ON
  • Room not found when stopping recording: STOP_RECORD_ROOM_NOT_FOUND
  • Caller not found when stopping recording: STOP_RECORD_CALLER_NOT_FOUND
  • Media not found when stopping recording: STOP_RECORD_MEDIA_FOUND
  • Recorder not found when stopping recording: STOP_RECORD_ENDPOINT_NOT_FOUND
  • Recording is not started stopping recording: STOP_RECORD_NOT_STARTED
  • Recorder is not ready yet, record is not started: STOP_RECORD_RECORDER_NOT_READY
Errors about media play:
  • Autoplay was prevented: IOS_AUTOPLAY_PREVENTED
Errors about media streams:
  • Error during media update on call: MEDIA_UPDATE_ERROR
Errors about user media:
  • Error during media media access: USER_MEDIA_ERROR
Errors about remote stream:
  • Error during subscription: STREAM_NOT_AVAILABLE
descriptor CallIceErrorDescriptor | object

Detailed descriptor of the error


hangup

Fired when contact hangs up from 1-1 call
'from' property indicates which side initiated the hangup, either 'remote' or 'local'

Type: object
Properties:
Name Type Description
from string
reason string

can be User_Busy, User_Refused_Call, User_Media_Error, Hangup_From_Callee, Hangup_From_Caller, stop_ScreenSharing, Ice_disconnected, Ice_failed, WebRTC_Plugin_Installation_needed, User_Not_Found, disconnected, call take on other device, bye on other device, DataChannel_Not_Supported


localStreamAvailable

Fired when local stream is available after calling the contact

Type: Stream

recordAvailable

Fired when call record is available.
This event is fired once the call is ended for both peers if the call was recorded.

Type: object
Properties:
Name Type Description
mediaURL string

video file URL


recordingAvailable

Fired when a recording is available for play or download.

Type: RecordingInfo

recordingStarted

Fired when a recording started.

Type: RecordingInfo

recordingStopped

Fired when a recording stopped.

Type: RecordingInfo

remoteStreamIdUpdated

Fired when remote streamId is changed after a call to replacePublishedStream().

Type: object
Properties:
Name Type Description
callId string

callId

newStreamId string

the new streamId

oldStreamId string

former streamId


remoteStreamIdUpdated

Fired when remote streamId is changed after a call to replacePublishedStream().

Type: object
Properties:
Name Type Description
callId string

callId

newStreamId string

the new streamId

oldStreamId string

former streamId


remoteStreamUpdated

Fired when remote stream properties changed.

Type: object
Properties:
Name Type Description
callId string

callId

audio boolean

whether an audio line has been negotiated and active.

audioMuted boolean

whether the audio line is muted.

video boolean

whether a video line has been negotiated and active.

videoMuted boolean

whether the video line is muted.


response

Fired when contact accepted or declined call

Type: Void

statsUpdate

Fired when call record is available.
This event is fired once the call is ended for both peers if the call was recorded.

Type: CallStats

streamAdded

Fired when contact's stream is received from 1-1 call

Type: Stream

streamRemoved

Fired when contact's stream is removed from 1-1 call, stream may be null

Type: Stream

userMediaError

Fired on user media access error :
This event is fired when user has not granted the access to his micro and webcam or brower was not able to access medias

Type: object
Properties:
Name Type Description
onCallEstablishment String

true or false, indicate whether access to media has been requested on call establishment or not (can be requested on autoAnswer feature activation)

callType String

value can be 'media' or screenSharing

error Object

error given by WebRTC API

userMediaStreamId String

stream id

tryAudioCallActivated Boolean

whether apiRTC will try to establish the call in audio only after this error detection