Call Class
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 
Parameters:
- 
                        
sinchSinchCreate Call for sinch instrance
 
Item Index
Methods
- ackIncomingCall
 - addEventListener
 - addEventListenerPrototype
 - answer
 - callFailure
 - establish
 - execListener
 - getCallId
 - getDetails
 - getDirection
 - getEndCause
 - getHeaders
 - getRemoteUserId
 - getState
 - hangup
 - mute
 - mxpAck
 - mxpCancel
 - mxpDeny
 - mxpFail
 - mxpHangup
 - mxpInjectIce
 - mxpJoin
 - mxpJoined
 - mxpPeerEventSdp
 - openDataChannel
 - placeCall
 - processRTCAnswer
 - progress
 - removeEventListener
 - sendDTMF
 - setEndCause
 - setParticipants
 - setStream
 - unmute
 
Methods
ackIncomingCall
        ()
        
            
        
        protected
    
    Internal: Recieve a call, do not use this directly! Only used internally.
Returns:
undefined
addEventListener
        - 
                        
eventListener 
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:
- 
                        
eventListenerObjectAn object containing a set of listeners for various actions
- 
                                    
[onCallProgressing]Function optionalCallback for calls progressing, this is where to start playing any ringtones.
 - 
                                    
[onCallEstablished]Function optionalCallback for established calls, this is where to start playing the media streams and stop playing any ringtones.
 - 
                                    
[onCallEnded]Function optionalCallback for calls which are ended, media stream as well as ringtones should stop here.
 - 
                                    
[onDataChannelAdded]Function optionalCallback 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('srcObject', call.incomingStream); //Ensure audio element has "autoplay" attribute set
    },
    onCallEnded: function(call): { console.log('Call is ended, cause:', call.getEndCause()); }
}
call.addEventListener(callListener);
            addEventListenerPrototype
        ()
        
            
        
        protected
    
    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
    
    Internal: Fail a current call, used in various error scenarios. Only used internally.
Returns:
undefined
establish
        ()
        
            
        
        protected
    
    Internal: Change call state to ESTABLISHED and do necessary related steps. Only used internally.
Returns:
undefined
execListener
        ()
        
            
        
        protected
    
    Internal: Execute a specific listener and pass argument dataObj. Only used internally.
Returns:
undefined
getCallId
        ()
        
            String
        
    
    Returns the call identifier.
Returns:
Call identifier
getDetails
        ()
        
            Object
        
    
    Returns metadata about the call.
Returns:
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:
CallEndCause
getHeaders
        ()
        
            Object
        
    
    Returns the Call Headers for this call
Returns:
Call headers passed with the call
getRemoteUserId
        ()
        
            String
        
    
    Returns the identifier of the remote participant in the call.
Returns:
Identifier of the remote participant in the call.
getState
        ()
        
            String
        
    
    Returns the Call State the call is currently in.
Returns:
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
mute
        ()
        
            
        
    
    Mute microphone in ongoing call. Must be active call.
Returns:
undefined
mxpAck
        ()
        
            
        
        protected
    
    Internal: Trigger actions based on MXP ACK message. Only used internally.
Returns:
undefined
mxpCancel
        ()
        
            
        
        protected
    
    Internal: Trigger actions based on MXP CANCEL message. Only used internally.
Returns:
undefined
mxpDeny
        ()
        
            
        
        protected
    
    Internal: Trigger actions based on MXP DENY message. Only used internally.
Returns:
undefined
mxpFail
        ()
        
            
        
        protected
    
    Internal: Trigger actions based on MXP FAIL message. Only used internally.
Returns:
undefined
mxpHangup
        ()
        
            
        
        protected
    
    Internal: Trigger actions based on MXP HANGUP message. Only used internally.
Returns:
undefined
mxpInjectIce
        ()
        
            
        
        protected
    
    Internal: Trigger actions based on ICE CANDIDATE. Only used internally.
Returns:
undefined
mxpJoin
        ()
        
            
        
        protected
    
    Internal: Trigger actions based on MXP JOIN message. Only used internally.
Returns:
undefined
mxpJoined
        ()
        
            
        
        protected
    
    Internal: Trigger actions based on MXP JOIN message. Only used internally.
Returns:
undefined
mxpPeerEventSdp
        ()
        
            
        
        protected
    
    Internal: Process a mxpPeerEventSdp. Only used internally.
Returns:
undefined
openDataChannel
        - 
                        
label 
Beta: Open data channel on ongoing call session. Can only be used with "new" data clients (i.e., not PSTN).
Parameters:
- 
                        
labelStringName of data channel
 
Returns:
channel
placeCall
        ()
        
            
        
        protected
    
    Internal: Start a call. Only used internally.
Returns:
undefined
processRTCAnswer
        ()
        
            
        
        protected
    
    Internal: Trigger actions based on MXP Sdp Answer. Only used internally.
Returns:
undefined
progress
        ()
        
            
        
        protected
    
    Internal: Change call state to PROGRESSING and do necessary related steps. Only used internally.
Returns:
undefined
removeEventListener
        - 
                        
eventListener 
Remove event lister objects from the call. Pass the same object as was used when adding the listener.
Parameters:
- 
                        
eventListenerObjectAn 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:
- 
                        
keysStringMay be a series of DTMF keys. Each key must be in [0-9, #, *, A-D].
 
Returns:
undefined
setEndCause
        ()
        
            
        
        protected
    
    Internal: Set call end cause. Only used internally.
Returns:
undefined
setParticipants
        ()
        
            
        
        protected
    
    Internal: Set participants in the ongoing call. Only used internally.
Returns:
undefined
setStream
        ()
        
            
        
        protected
    
    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
