Class: Call

Call(application, conversation, from)

new Call(application, conversation, from)

Conversation Call Object.
Parameters:
Name Type Description
application Application The Application object.
conversation Conversation The Conversation object that belongs to this call.
from Member The member that initiated the call.
Properties:
Name Type Default Description
application Application The Application object that the call belongs to.
conversation Conversation The Conversation object that belongs to this call.
from Member The caller. The member object of the caller (not a reference to the one in conversation.members)
to Map.<string, Member> The callees keyed by a member's id. The members that receive the call (not a reference to conversation.members)
id String The call id (our member's leg_id, comes from rtc:answer event, or member:media)
CALL_STATUS Call.CALL_STATUS "started" the available call statuses
direction Call.CALL_DIRECTION the Direction of the call, Outbound, Inbound
MEMBER_CALL_STATES Call.MEMBER_CALL_STATES the available member call states
STATUS_PERMITTED_FLOW Call.STATUS_PERMITTED_FLOW the permitted call status transition map, describes the "from" and allowed "to" transitions
Source:
Fires:

Members

(static, readonly) CALL_DIRECTION :string

Enum for Call direction.
Type:
  • string
Properties:
Name Type Description
INBOUND string The Call started from another end
OUTBOUND string The Call started from this client
Source:

(static, readonly) CALL_STATUS :string

Enum for Call status.
Type:
  • string
Properties:
Name Type Description
STARTED string The Call is in started status
RINGING string The Call is in ringing status
ANSWERED string The Call is in answered status
COMPLETED string The Call is in completed status
BUSY string The Call is in busy status
TIMEOUT string The Call is in timeout status
UNANSWERED string The Call is in unanswered status
REJECTED string The Call is in rejected status
FAILED string The Call is in failed status
Source:

(static, readonly) MEMBER_CALL_STATES :string

Enum for Call Member states.
Type:
  • string
Properties:
Name Type Description
RINGING string A Member is in ringing state
HUNGUP string A Member hung up the call
ANSWERED string A Member answered the call
REJECTED string A Member rejected the call
Source:

(static, readonly) STATUS_PERMITTED_FLOW :Map.<string, Set.<Call.CALL_STATUS>>

Enum for the permitted call status transition.
Type:
Source:

Methods

answer(autoPlayAudioopt) → {Promise.<Audio>}

Answers an incoming call Join the conversation that you are invited Create autoplay Audio object
Parameters:
Name Type Attributes Default Description
autoPlayAudio boolean <optional>
true attach the audio stream automatically to start playing (default true)
Source:
Returns:
Type
Promise.<Audio>

hangUp() → {Promise}

Hangs up the call If there is a knocking active, do a knocking:delete otherwise Leave from the conversation Disable the audio
Source:
Returns:
Type
Promise

hangUpIfAllLeft() → {Promise}

Go through the members of the conversation and if .me is the only one (JOINED or INVITED) call call.hangUp().
Source:
Returns:
- empty promise or the call.hangUp promise chain
Type
Promise

reject() → {Promise}

Rejects an incoming call Leave from the conversation that you are invited
Source:
Returns:
Type
Promise

Events

member:call:state

Call listening for member state changed events.
Properties:
Name Type Description
from Member the member that is changed
state Call.MEMBER_CALL_STATES the new state
event Event the actual event
Source:
Example

listen for member state events

 call.on("member:call:state",(from, state, event) => {
             console.log("member: " + member.user.name + " has " + state);
      });
  });