API Docs for: 0.9.9
Show:

Call Class

Defined in: src/SDK/Call.js:11
Module: SinchInternal

A class for managing individual calls.

Note: Do not instantiate Call, rather use relevant methods for placing or receiving calls in CallClient. See the examples below.

Constructor

Call

(
  • sinch
)
protected

Defined in src/SDK/Call.js:11

Parameters:

  • sinch Sinch

    Create Call for sinch instrance

Methods

ackIncomingCall

() protected

Internal: Recieve a call, do not use this directly! Only used internally.

Returns:

undefined

addEventListener

(
  • eventListener
)

Defined in src/SDK/Call.js:126

Add event listeners to the call, multiple listeners can be added with this method. Listeners are processed in the order they're added. Listeners can be removed, using the removeEventListener method.

Parameters:

  • eventListener Object

    An object containing a set of listeners for various actions

    • [onCallProgressing] Function optional

      Callback for calls progressing, this is where to start playing any ringtones.

    • [onCallEstablished] Function optional

      Callback for established calls, this is where to start playing the media streams and stop playing any ringtones.

    • [onCallEnded] Function optional

      Callback for calls which are ended, media stream as well as ringtones should stop here.

    • [onDataChannelAdded] Function optional

      Callback for datachannel added will pass call object ("this") as first parameter and the dataChannel as second. (Beta)

Returns:

undefined

Example:

var callListener = {
    onProgressing: function(call): { console.log('Call is progressing'); },
    onEstablished: function(call): { 
        console.log('Call is established, hook up audio.');
        $('audio').attr('src', call.incomingStreamURL); //Ensure audio element has "autoplay" attribute set
    },
    onCallEnded: function(call): { console.log('Call is ended, cause:', call.getEndCause()); }
}

call.addEventListener(callListener);

addEventListenerPrototype

() protected

Defined in src/SDK/Call.js:928

Internal: Prototype used in call when adding callbacks to data channels. Only used internally.

Returns:

undefined

answer

()

Pick up an incoming call which is currently ringing.

Returns:

undefined

callFailure

() protected

Defined in src/SDK/Call.js:898

Internal: Fail a current call, used in various error scenarios. Only used internally.

Returns:

undefined

establish

() protected

Defined in src/SDK/Call.js:267

Internal: Change call state to ESTABLISHED and do necessary related steps. Only used internally.

Returns:

undefined

execListener

() protected

Defined in src/SDK/Call.js:186

Internal: Execute a specific listener and pass argument dataObj. Only used internally.

Returns:

undefined

getCallId

() String

Returns the call identifier.

Returns:

String:

Call identifier

getDetails

() Object

Returns metadata about the call.

Returns:

Object:

Object containing metadata about the call.

getDirection

()

Returns the call direction of the call.

Returns:

bool True for outgoing, false for incoming.

getEndCause

() String

Returns the Call End Cause for the call

Returns:

String:

CallEndCause

getHeaders

() Object

Returns the Call Headers for this call

Returns:

Object:

Call headers passed with the call

getRemoteUserId

() String

Returns the identifier of the remote participant in the call.

Returns:

String:

Identifier of the remote participant in the call.

getState

() String

Returns the Call State the call is currently in.

Returns:

String:

CallState

hangup

()

End 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:

undefined

initPC

() protected

Defined in src/SDK/Call.js:944

Internal: Initialize peer connection and configure all callbacks. Only used internally.

Returns:

undefined

injectIce

() protected

Defined in src/SDK/Call.js:541

Internal: Internal method to inject ICE in PC. Only used internally.

Returns:

undefined

mute

()

Mute microphone in ongoing call. Must be active call.

Returns:

undefined

mxpAck

() protected

Defined in src/SDK/Call.js:312

Internal: Trigger actions based on MXP ACK message. Only used internally.

Returns:

undefined

mxpCancel

() protected

Defined in src/SDK/Call.js:832

Internal: Trigger actions based on MXP CANCEL message. Only used internally.

Returns:

undefined

mxpDeny

() protected

Defined in src/SDK/Call.js:790

Internal: Trigger actions based on MXP DENY message. Only used internally.

Returns:

undefined

mxpFail

() protected

Defined in src/SDK/Call.js:869

Internal: Trigger actions based on MXP FAIL message. Only used internally.

Returns:

undefined

mxpHangup

() protected

Defined in src/SDK/Call.js:748

Internal: Trigger actions based on MXP HANGUP message. Only used internally.

Returns:

undefined

mxpInjectIce

() protected

Defined in src/SDK/Call.js:511

Internal: Trigger actions based on ICE CANDIDATE. Only used internally.

Returns:

undefined

mxpJoin

() protected

Defined in src/SDK/Call.js:592

Internal: Trigger actions based on MXP JOIN message. Only used internally.

Returns:

undefined

mxpJoined

() protected

Defined in src/SDK/Call.js:690

Internal: Trigger actions based on MXP JOIN message. Only used internally.

Returns:

undefined

mxpPeerEventSdp

() protected

Defined in src/SDK/Call.js:437

Internal: Process a mxpPeerEventSdp. Only used internally.

Returns:

undefined

openDataChannel

(
  • label
)
RTCDataChannel protected

Beta: Open data channel on ongoing call session. Can only be used with "new" data clients (i.e., not PSTN).

Parameters:

  • label String

    Name of data channel

Returns:

RTCDataChannel:

channel

placeCall

() protected

Internal: Start a call. Only used internally.

Returns:

undefined

processRTCAnswer

() protected

Defined in src/SDK/Call.js:388

Internal: Trigger actions based on MXP Sdp Answer. Only used internally.

Returns:

undefined

progress

() protected

Defined in src/SDK/Call.js:232

Internal: Change call state to PROGRESSING and do necessary related steps. Only used internally.

Returns:

undefined

removeEventListener

(
  • eventListener
)

Defined in src/SDK/Call.js:154

Remove event lister objects from the call. Pass the same object as was used when adding the listener.

Parameters:

  • eventListener Object

    An object containing a set of listeners for various actions, that has previously been added to this callClient

Returns:

undefined

Example:

call.addEventListener(myListener);
call.removeEventListener(myListener);

sendDTMF

(
  • keys
)

Sends one or more DTMF tones for tone dialing.

Parameters:

  • keys String

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

Returns:

undefined

setEndCause

() protected

Defined in src/SDK/Call.js:206

Internal: Set call end cause. Only used internally.

Returns:

undefined

setParticipants

() protected

Defined in src/SDK/Call.js:219

Internal: Set participants in the ongoing call. Only used internally.

Returns:

undefined

setStream

() protected

Defined in src/SDK/Call.js:168

Internal: Set media streams, this is used internally by the call object. Internal function!

Returns:

undefined

unmute

()

Un-mute microphone in ongoing call. Must be active call.

Returns:

undefined