webex

1.x

webex-js-sdk

webex

The Cisco Webex JS SDK

Install

npm install --save webex

Usage

All of the examples in these API docs assume you've gotten an authenticated Webex instance (unless otherwise specified) using one of the methods below.

webex has three basic modes of operation:

Shell Script (Quick Start)

This is the quickest way to get up and running with our JavaScript SDK. Simply set the environment variable WEBEX_ACCESS_TOKEN to your access token and add the following line at the top of your JavaScript file to get a ready-to-use instance.

You can get your WEBEX_ACCESS_TOKEN from the Cisco Webex for Developers portal.

const webex = require(`webex/env`);

webex/env is also a great way to get started with bots.

Browser

Our JavaScript SDK provides out-of-the-box support for the OAuth 2.0 Implicit Grant Flow.

You'll need to register an OAuth Client to get your "authorization string"

Use the steps under Bundling (or something similar) to get the SDK into your browser, then use the following JavaScript to get started:

const webex = Webex.init({
  config: {
    authorizationString: <your auth URL>,
  }
});

webex.once(`ready`, () => {
  if (webex.canAuthorize) {
    /* Your application code goes here */
  }
  else {
    /* Your login code goes here */

    /*
      The following is a naive example of how to log in a user. Note that login should probably require a user action, otherwise errors can lead you into an infinite redirect loop.

      This will direct the user agent to the Cisco login page. Once the user logs in, they'll be redirected back to your app and the SDK will handle parsing the URL.
    */
    webex.authorization.initiateLogin();
  }
});

Bundling

You'll need to bundle the SDK to use it in a web browser. Right now, we do all our SDK testing with Browserify, but our Cisco Webex Widgets use webpack.

The following snippet is the bare minimum to get our code into a form suitable for a web browser. You'll probably want to additionally pipe it through a minifier like UglifyJS before going to production.

npm install webex
npm install -g browserify
echo "window.webex = require('webex')" > ./index.js
browserify index.js > bundle.js

Then, just load your bundle using:

<script src="/bundle.js"></script>

NodeJS

Though the implicit flow is great for single page apps, it's not ideal for integrations that might need to do things on your users' behalf months in the future. We additionally support the OAuth 2.0 Authorization Code Grant flow, but due to its complexity, there's a bit you'll need to wire up in your app to take advantage of it. The following is an example of how an Express app might do authentication.

var Webex = require('webex');
const assert = require(`assert`);

app.use(function(req, res, next) {
  req.webex = Webex.init({
    config: {
      credentials: {
        authorizationString: <your auth URL>,
        client_secret: <your client secret>
      },
    }
  });

  req.webex.once(`ready`, next);
});

app.get(`/login`, (req, res) => {
  // buildLoginUrl() defaults to the implicit grant flow so explicitly pass
  // `confidential` to generate a URL suitable to the Authorization Code grant
  // flow.
  res
    .redirect(req.webex.credentials.buildLoginUrl({clientType: 'confidential'}))
    .end();
});

app.get(`/oauth/redirect`, (req, res, next) => {
  assert(req.params.code);
  req.webex.requestAuthorizationCodeGrant(req.params)
    .then(() => {
      res.redirect(`/`).end();
    })
    .catch(next);
});

webex-js-sdk

webex

The Cisco Webex JS SDK

Install

npm install --save webex

Usage

All of the examples in these API docs assume you've gotten an authenticated Webex instance (unless otherwise specified) using one of the methods below.

webex has three basic modes of operation:

Shell Script (Quick Start)

This is the quickest way to get up and running with our JavaScript SDK. Simply set the environment variable WEBEX_ACCESS_TOKEN to your access token and add the following line at the top of your JavaScript file to get a ready-to-use instance.

You can get your WEBEX_ACCESS_TOKEN from the Cisco Webex for Developers portal.

const webex = require(`webex/env`);

webex/env is also a great way to get started with bots.

Browser

Our JavaScript SDK provides out-of-the-box support for the OAuth 2.0 Implicit Grant Flow.

You'll need to register an OAuth Client to get your "authorization string"

Use the steps under Bundling (or something similar) to get the SDK into your browser, then use the following JavaScript to get started:

const webex = Webex.init({
  config: {
    authorizationString: <your auth URL>,
  }
});

webex.once(`ready`, () => {
  if (webex.canAuthorize) {
    /* Your application code goes here */
  }
  else {
    /* Your login code goes here */

    /*
      The following is a naive example of how to log in a user. Note that login should probably require a user action, otherwise errors can lead you into an infinite redirect loop.

      This will direct the user agent to the Cisco login page. Once the user logs in, they'll be redirected back to your app and the SDK will handle parsing the URL.
    */
    webex.authorization.initiateLogin();
  }
});

Bundling

You'll need to bundle the SDK to use it in a web browser. Right now, we do all our SDK testing with Browserify, but our Cisco Webex Widgets use webpack.

The following snippet is the bare minimum to get our code into a form suitable for a web browser. You'll probably want to additionally pipe it through a minifier like UglifyJS before going to production.

npm install webex
npm install -g browserify
echo "window.webex = require('webex')" > ./index.js
browserify index.js > bundle.js

Then, just load your bundle using:

<script src="/bundle.js"></script>

NodeJS

Though the implicit flow is great for single page apps, it's not ideal for integrations that might need to do things on your users' behalf months in the future. We additionally support the OAuth 2.0 Authorization Code Grant flow, but due to its complexity, there's a bit you'll need to wire up in your app to take advantage of it. The following is an example of how an Express app might do authentication.

var Webex = require('webex');
const assert = require(`assert`);

app.use(function(req, res, next) {
  req.webex = Webex.init({
    config: {
      credentials: {
        authorizationString: <your auth URL>,
        client_secret: <your client secret>
      },
    }
  });

  req.webex.once(`ready`, next);
});

app.get(`/login`, (req, res) => {
  // buildLoginUrl() defaults to the implicit grant flow so explicitly pass
  // `confidential` to generate a URL suitable to the Authorization Code grant
  // flow.
  res
    .redirect(req.webex.credentials.buildLoginUrl({clientType: 'confidential'}))
    .end();
});

app.get(`/oauth/redirect`, (req, res, next) => {
  assert(req.params.code);
  req.webex.requestAuthorizationCodeGrant(req.params)
    .then(() => {
      res.redirect(`/`).end();
    })
    .catch(next);
});

See Browser Guide and Server Guide

new Webex()
Static Members
init(attrs)

Authorization

Authorization

Browser support for OAuth2. Automatically parses the URL hash for an access token

new AuthorizationBrowser()
Instance Members
isAuthorizing
initiateLogin(options)
initiateImplicitGrant(options)
initiateAuthorizationCodeGrant(options)
requestAccessTokenFromJwt(options)
logout(options)

NodeJS support for OAuth2

new AuthorizationNode()
Instance Members
isAuthorizing
requestAuthorizationCodeGrant(options)
requestAccessTokenFromJwt(options)

Calling

Calling

new Phone()
Instance Members
connected
defaultFacingMode
registered
isCallingSupported()
register()
deregister()
createLocalMediaStream(options)
dial(dialString, options)
Events
call:created
call:incoming
PhoneConfig

Type: Object

Properties
audioBandwidthLimit (number?)
videoBandwidthLimit (number?)
enableExperimentalGroupCallingSupport (boolean?) : Group calling support should work, but necessarily introduces some breaking changes to the API. In order to get feedback, we're keeping the API unchanged by default and requiring folks to opt-in to these breakages. As these changes evolve, you may see some breaking changes that don't necessarily follow semantic versioning. When we're ready to drop the "experimental" moniker, we'll release an official SemVer Major bump.
Example
{
  audioBandwidthLimit: 64000,
  videoBandwidthLimit: 1000000,
  enableExperimentalGroupCallingSupport: false,
  hangupIfLastActive: {
    call: true,
    meeting: false
  }
}
Static Members
HangupBehavior
new Call()
Instance Members
remoteAudioMuted
remoteVideoMuted
localMediaStream
remoteMember
from
state
status
roomId
remoteMediaStream
localScreenShare
acknowledge()
answer
createOrJoinLocus(target, options)
getRawStatsStream()
getStatsStream()
hangup()
reject()
sendDtmf(tones)
sendFeedback(feedback)
startReceivingAudio()
startReceivingVideo()
startSendingAudio()
startSendingVideo()
stopReceivingAudio()
stopReceivingVideo()
stopSendingAudio()
stopSendingVideo()
toggleFacingMode()
toggleReceivingAudio()
toggleReceivingVideo()
toggleSendingAudio()
toggleSendingVideo()
Events
active
initializing
inactive
terminating
localMediaStream:change
remoteMediaStream:change
membership:notified
membership:connected
membership:declined
membership:disconnected
memberships:add
memberships:remove
new CallMemberships()
new CallMembership()
Instance Members
isInitiator
state
audioMuted
videoMuted

Polls an RTCPeerConnection once per second and emits its RTCStatsReport

new StatsStream(pc: RTCPeerConnection)

Extends Readable

Parameters

Polls an RTCPeerConnection once per second and emits its RTCStatsReport RTCStatsReport

new StatsStream(config: Object)

Extends Readable

Parameters
config (Object = {})

Reforms the interesting data from an RTCStatsReport to a new format

new StatsFilter()

Extends Transform

Reforms the interesting data from an RTCStatsReport into something grokkable

new StatsFilter()

Extends Transform

Maintain a cache of meetings and sync with services.

new Meetings(args: ...any)

Extends WebexPlugin

Parameters
args (...any)
Static Members
register()
unregister()
setReachability()
getReachability()
startReachability()
getPersonalMeetingRoom()
create(destination, type = null)
getMeetingByType(type, value)
getAllMeetings(options)
syncMeetings()
getScheduledMeetings(options)
getAnalyzer()
getCalculator()
getDevices
Instance Members
personalMeetingRoom
registered
getLogger()
propertyName
propertyName
Events
meetings:ready
meeting:added
meeting:removed
meetings:registered
media:ready

Resources

These are the resources provided by Webex instances for interacting with our developer API

Resources

These are the resources provided by Webex instances for interacting with our developer API

Memberships represent a person's relationship to a room. Use this API to list members of any room that you're in or create memberships to invite someone to a room. Memberships can also be updated to make someone a moderator or deleted to remove them from the room.

new Memberships()
Instance Members
listen()
create(membership)
get(membership)
list(options)
listWithReadStatus(options)
remove(membership)
update(membership)
updateLastSeen(message)

Messages are how people communicate in rooms. Each message timestamped and represented in Webex as a distinct block of content. Messages can contain plain text and a single file attachment. See the Message Attachments Guide for a list of supported media types.

new Messages()
Instance Members
listen()
create(message)
get(message)
list(options)
remove(message)
new People()
Instance Members
get(person)
list(options, showAllTypes)

Rooms are virtual meeting places for getting stuff done. This resource represents the room itself. Check out the Memberships API to learn how to add and remove people from rooms and the Messages API for posting and managing content.

new Rooms()
Instance Members
listen()
create(room)
get(room, options)
list(options)
listWithReadStatus(maxRecent)
getWithReadStatus(roomId)
remove(room)
update(room)
new Teams()
Instance Members
create(team)
get(team, options)
list(options)
update(team)

Team Memberships represent a person's relationship to a team. Use this API to list members of any team that you're in or create memberships to invite someone to a team. Team memberships can also be updated to make someome a moderator or deleted to remove them from the team.

Just like in the Webex app, you must be a member of the team in order to list its memberships or invite people.

new TeamMemberships()
Instance Members
create(membership)
get(membership)
list(options)
remove(membership)
update(membership)

Webhooks allow your app to be notified via HTTP when a specific event occurs on Webex. For example, your app can register a webhook to be notified when a new message is posted into a specific room.

new Webhooks()
Instance Members
create(webhook)
get(webhook)
list(options)
remove(webhook)
update(webhook)

Logging

Logging

new Logger()
LoggerConfig

Type: Object

Properties
level (string?) : Maximum log level that should be printed to the console. One of silent|error|warn|log|info|debug|trace
historyLength (number?) : Maximum number of entries to store in the log buffer.
Example
{
  level: process.env.LOGGER_LEVEL,
  historyLength: 1000
}

Types

The following typedefs describes the responses of the various API calls.

Types

The following typedefs describes the responses of the various API calls.

Payload for Call#sendFeedback

FeedbackObject

Type: Object

Properties
userRating (number) : Number between 1 and 5 (5 being best) to let the user score the call
userComments (string) : Freeform feedback from the user about the call
includeLogs (Boolean) : set to true to submit client logs to the Webex Teams cloud. Note: at this time, all logs, not just call logs, generated by the sdk will be uploaded to the Webex Cloud. Care has been taken to avoid including PII in these logs, but if you've taken advantage of the SDK's logger, you should make sure to avoid logging PII as well.
MembershipObject

Type: Object

Properties
id (string) : Unique identifier for the membership
roomId (string) : The room ID
personId (string) : The person ID
personEmail (email) : The email address of the person / room member
isModerator (boolean) : Indicates whether the specified person should be a room moderator
isMonitor (boolean) : Indicates whether the specified member is a room monitor
created (isoDate) : The date and time that this membership was created
MessageObject

Type: Object

Properties
id (string) : (server generated) Unique identifier for the message
personId (string) : The ID for the author of the messasge
personEmail (email) : The email for the author of the messasge
roomId (string) : The ID for the room of the message
text (string) : The message posted to the room in plain text
markdown (string) : The message posted to the room in markdown
files (Array<string>) : The source URL(s) for the message attachment(s). See the Message Attachments Guide for a list of supported media types.
created (isoDate) : (server generated) The date and time that the message was created
PersonObject

Type: Object

Properties
id (string) : (server generated) Unique identifier for the person
emails (Array<email>) : Email addresses of the person
displayName (string) : Display name of the person
created (isoDate) : (server generated) The date and time that the person was created
RoomObject

Type: Object

Properties
id (string) : (server generated) Unique identifier for the room
title (string) : The display name for the room. All room members will see the title so make it something good
teamId (string) : (optional) The ID of the team to which the room belongs
created (isoDate) : (server generated) The date and time that the room was created
TeamObject

Type: Object

Properties
id (string) : (server generated) Unique identifier for the team
name (string) : The name of the team
created (isoDate) : (server generated) The date and time that the team was created
TeamMembershipObject

Type: Object

Properties
id (string) : (server generated) Unique identifier for the team membership
teamId (string) : The team ID
personId (string) : The person ID
personEmail (string) : The email address of the person
isModerator (boolean) : Set to true to make the person a team moderator
created (string) : (server generated) The date and time that the team membership was created
WebhookObject

Type: Object

Properties
id (string) : (server generated) Unique identifier for the webhook
resource (string) : The resource type for the webhook
event (string) : The event type for the webhook
filter (string) : The filter that defines the webhook scope
targetUrl (string) : The URL that receives POST requests for each event
name (string) : A user-friendly name for this webhook
created (string) : (server generated) The date and time that the webhook was created

An email address, as a string.

email

Type: string

The date and time, specified in ISO 8601 extended offset date/time format (e.g. 2015-10-18T14:26:16+00:00).

isoDate

Type: string

AttachmentActionObject

Type: Object

Properties
id (string) : (server generated) Unique identifier for the attachment action
messageId (string) : The ID of the message in which attachment action is to be performed
type (string) : The type of attachment action eg., submit
inputs (Object) : The inputs for form fields in attachment message
personId (string) : (server generated) The ID for the author of the attachment action
roomId (string) : (server generated) The ID for the room of the message
created (isoDate) : (server generated) The date and time that the message was created

Post a new attachment action for a message with attachment.

Parameters
attachmentAction (AttachmentActionObject)
Returns
Promise<AttachmentActionObject>:
Example
webex.rooms.create({title: 'Create Message Example'})
  .then(function(room) {
    return webex.messages.create({
      text: 'Howdy!',
      roomId: room.id,
      attachments:[ {
         contentType: 'application/vnd.microsoft.card.adaptive',
        content: {
          type: 'AdaptiveCard',
          version: '1.0',
          body: [
           {
            type: 'TextBlock',
            text: '',
            size: 'large'
            },
          {
            type: 'TextBlock',
            text: 'Adaptive Cards',
            separation: 'none'
          }
          {
          type: 'Input.Date',
          id: 'dueDate'
          }
      ],
    actions: [
        {
            type: 'Action.Submit',
            title: 'Due Date'
        }
    ]
  }
 }]
    });
  })
  .then(function(message) {
   return webex.attachmentActions.create({
     type: 'submit',
     messageId: message.id,
     inputs:{
       dueDate: '26/06/1995'
     }
   })
   .then(function(attachmentAction)){
     var assert = require('assert');
     assert(attachmentAction.id);
     assert(attachmentAction.type);
     assert(attachmentAction.personId);
     assert(attachmentAction.inputs);
     assert(attachmentAction.messageId);
     assert(attachmentAction.roomId);
     assert(attachmentAction.created);
     return 'success';
    }
  });
  // => success

Returns a single attachment action.

get(attachmentAction: string): Promise<AttachmentActionObject>
Parameters
attachmentAction (string)
Returns
Promise<AttachmentActionObject>:
Example
var attachmentAction;
webex.rooms.create({title: 'Get Message Example'})
  .then(function(room) {
    return webex.messages.create({
      text: 'Howdy!',
      roomId: room.id,
      attachments:[ {
         contentType: 'application/vnd.microsoft.card.adaptive',
        content: {
          type: 'AdaptiveCard',
          version: '1.0',
          body: [
           {
            type: 'TextBlock',
            text: '',
            size: 'large'
            },
          {
            type: 'TextBlock',
            text: 'Adaptive Cards',
            separation: 'none'
          },
          {
          type: 'Input.Date',
          id: 'dueDate'
          }
      ],
    actions: [
        {
            type: 'Action.Submit',
            title: 'Due Date'
        }
    ]
  }
 }]
    });
  })
  .then(function(message) {
    return webex.attachmentActions.create({
     type: 'submit',
     messageId: message.id,
     inputs:{
       dueDate: '26/06/1995'
     });
  })
  .then(function(attachmentAction) {
    return webex.attachmentActions.get(attachmentAction.id)
  })
   .then(function(attachmentAction){
       var assert = require('assert');
       assert.deepEqual(attachmentAction, attachmentAction);
       return 'success';
     })
  // => success

Gets a list of all recent devices associated with the user the device list gets populated from Redis

getAll(): Promise<Device>
Returns
Promise<Device>:

Gets a list of all recent devices associated with the user the device list gets populated from Redis

refresh(): Promise<Device>
Returns
Promise<Device>:

Search for a device by name

search(options: Object): Promise<Device>
Parameters
options (Object)
Name Description
options.searchQuery string
Returns
Promise<Device>:

Caches the device info and also registers to Redis for subsequent fetches

upsert(device: Object): deviceInfo
Parameters
device (Object)
Name Description
device.id string
Returns
deviceInfo:

Retreives device info of a particular device

get(token: string): Promise<deviceInfo>
Parameters
token (string)
Returns
Promise<deviceInfo>:

Unregisters the device from Redis, will not fetch in subsequent loads, similar to space.deleteBinding()

remove(deviceId: string): Promise<deviceInfo>
Parameters
deviceId (string)
Returns
Promise<deviceInfo>:

Requests to display PIN on the device

requestPin(device: object, options: object): Promise<deviceInfo>
Parameters
device (object)
options (object = {})
Name Description
options.data object
Returns
Promise<deviceInfo>:

pairs the device with the user (manual pairing), also adds it to user's recents list for subsequent fetches. similar to space.join()

pair(options: object): Promise<deviceInfo>
Parameters
options (object = {})
Name Description
options.pin number
Returns
Promise<deviceInfo>:

unpairs the device with the user (manual/ultrasonic pairing), but still keeps in the recents list/does not remove from Redis options.removeAllDevices will remove all associated devices to user similar to space.leave()

unpair(options: object): Promise<deviceInfo>
Parameters
options (object = {})
Name Description
options.removeAllDevices boolean
Returns
Promise<deviceInfo>:

binds the space to the paired device (if supported) similar to space.bindConversation()

bindSpace(options: object): Promise<deviceInfo>
Parameters
options (object = {})
Name Description
options.url boolean , conversation url
options.kmsResourceObjectUrl boolean of the convo
Returns
Promise<deviceInfo>:

unbinds the space to the paired device (if supported) similar to space.unbindConversation()

unbindSpace(): Promise<deviceInfo>
Returns
Promise<deviceInfo>:

Gets the audio state of the paired device similar to device.getAudioState()

getAudioState(): Promise<audioState>
Returns
Promise<audioState>:

Updates audio state of the paired device, should be called every 10 minutes or when mic or volume state is changed similar to device.putAudioState()

putAudioState(space: object, audioState: object): Promise<audioState>
Parameters
space (object)
audioState (object = {})
Returns
Promise<audioState>:

Mutes paired device similar to device.mute()

mute(): Promise<audioState>
Returns
Promise<audioState>:

Unmutes paired device similar to device.unmute()

unmute(): Promise<audioState>
Returns
Promise<audioState>:

Increases paired device's volume similar to device.increaseVolume()

increaseVolume(): Promise<audioState>
Returns
Promise<audioState>:

Decreases paired device's volume similar to device.decreaseVolume()

decreaseVolume(): Promise<audioState>
Returns
Promise<audioState>:

Sets paired device's volume but should use increase and decrease api instead similar to device.setVolume()

setVolume(level: number): Promise<audioState>
Parameters
level (number = 0)
Returns
Promise<audioState>:

Utility function to update decrypted device name on device object

_updateDeviceMetadata(deviceArray: Array): device
Parameters
deviceArray (Array = [])
Returns
device:

Utility function to update decrypted device name on device object

_decryptDeviceName(inDevice: object): device
Parameters
inDevice (object = {})
Returns
device:

Utility function to update device info on mercury updates

_receiveDeviceUpdates(device: object): device
Parameters
device (object)
Returns
device:

Metrics handles all the call metrics events

new Metrics()
Instance Members
initialSetup(meetingCollection, webexVersion)
postEvent(options)
initPayload(eventType, identifiers, options)

Hey there. Glad you found your way here. Please be sure to alphabetize your constants.


AUDIO

Type: string

new MeetingInfo()
Static Members
getMeetingInfo(id)
setMeetingInfo(id, info)
fetchMeetingInfo(destination, type = null)
new MeetingInfoCollection()
Static Members
get(id)
new MeetingInfoRequest()
Static Members
fetchMeetingInfo(options)
new MeetingInfoRequest()
Static Members
fetchMeetingInfo(options)

Helper function to check if a string matches a known meeting link pattern

isMeetingLink(value: String): Boolean
Parameters
value (String) string to parse and see if it matches a meeting link
Returns
Boolean:

Helper function to build up a correct locus url depending on the value passed

getResourceUrl(type: String, value: Object): Object
Parameters
type (String) One of [SIP_URI, PERSONAL_ROOM, MEETING_ID, CONVERSATION_URL, LOCUS_ID, MEETING_LINK]
value (Object) ?? value.value
Returns
Object: returns an object with {resource, method}

AudioVideo

AudioVideo

Type: Object

Properties
audio (Object)
video (Object)

SharePreferences

SharePreferences

Type: Object

Properties
shareConstraints (Object?)
highFrameRate (Boolean?)

JoinOptions

JoinOptions

Type: Object

Properties
resourceId (String?)
hostPin (String?)
moderator (Boolean?)

SendOptions

SendOptions

Type: Object

Properties
sendAudio (Boolean)
sendVideo (Boolean)
sendShare (Boolean)

SendOptions

SendOptions

Type: Object

Properties
sharePreferences (Object)

Meeting is the crux of the plugin

new Meeting()
Static Members
invite(invitee, alertIfActive = true)
admit(memberIds)
remove(memberId)
mute(memberId, mute)
transfer(memberId, moderator)
getMembers()
getStats(options, override)
createStats(options)
stopStats()
isAudioMuted()
isAudioSelf()
isVideoMuted()
isVideoSelf()
setRemoteStream(pc)
unsetRemoteStream()
closeRemoteStream()
setShareStream(pc)
setLocalTracks(localStream)
setLocalShareTrack(localShare)
unsetLocalVideoTrack()
unsetLocalShareTrack()
setPeerConnections()
closePeerConnections()
unsetPeerConnections(peerConnection)
muteAudio()
unmuteAudio()
muteVideo()
unmuteVideo()
joinWithMedia(options)
reconnect()
moveTo(resourceId)
moveFrom(resourceId)
getMediaStreams
addMedia(options)
updateMedia(options)
updateAudio(options, stream?)
updateVideo(options, stream?)
updateShare(options, stream?)
acknowledge(type)
decline(reason)
leave(options)
stopShare()
startRecording()
stopRecording()
pauseRecording()
resumeRecording()
lockMeeting()
unlockMeeting()
Instance Members
audio
video
meetingFiniteStateMachine
mediaProperties
canUpdateMedia()
Events
media:stopped
meeting:ringing
meeting:ringingStop
meeting:stoppedSharingLocal
meeting:locked
meeting:unlocked
meeting:actionsUpdate
meeting:self:mutedByOthers
meeting:self:guestAdmitted
meeting:self:lobbyWaiting
meeting:reconnectionStarting
meeting:reconnectionSuccess
meeting:reconnectionFailure
meeting:startedSharingLocal
media:stopped
media:stopped

MediaDirection

MediaDirection

Type: Object

Properties
sendAudio (boolean)
receiveAudio (boolean)
sendVideo (boolean)
receiveVideo (boolean)
sendShare (boolean)
receiveShare (boolean)

MediaDirection

MediaDirection

Type: Object

Properties
sendAudio (boolean)
receiveAudio (boolean)
sendVideo (boolean)
receiveVideo (boolean)
sendShare (boolean)
receiveShare (boolean)

The meeting instance to execute all state changes on

meeting

Specify joining via audio (option: pstn), video, screenshare

join(options: JoinOptions): Promise
Parameters
options (JoinOptions = {}) A configurable options object for joining a meeting
Returns
Promise: the join response

Roap options

RoapOptions

Type: Object

Properties
sdp (String)
meeting (Meeting)
roapSeq (Number)
SeqOptions

Type: Object

Properties
correlationId (String)
mediaId (String)
seq (Number)
new RoapHandler()
Instance Members
perform(session, meeting, action)
execute(signal, session, action, meeting, prefix)
handleAction(session, action, meeting, correlationId)
submit(action)
createState(roapRef: Roap): StateMachine
Parameters
roapRef (Roap) initializes the state machine
Returns
StateMachine: an instance of a state machine

Method to handle the transitions between states

to(signal: String, meeting: Meeting, roap: Object): String
Parameters
signal (String)
meeting (Meeting) instance of a Meeting
roap (Object)
Returns
String: new state value
to(remote: Object): String
Parameters
remote (Object)
Name Description
remote.remoteAnswered Boolean
remote.remoteDeclined Boolean
Returns
String:
to(audio: Object): String
Parameters
audio (Object) The audio options
Name Description
audio.mute Boolean Whether to mute the meeting or not
audio.self Boolean Whether the was muted by the end user
audio.remote Boolean Whether the meeting was muted by the server
Returns
String: returns a new value to set the state to
to(video: Object): String
Parameters
video (Object) current video data for the transition {mute, self}
Returns
String: a new state value for the transition

Event that fires after we've transitioned to a new state

onAfterStep(transition: Object): null
Parameters
transition (Object)
Returns
null:
new RoapRequest()
Instance Members
attachRechabilityData(localSdp, options)
sendRoap(options)
Media
Static Members
setLocalTrack(enabled, track)
reconnectMedia(peerConnection, meetingId)
generateLocalMedias(mediaId, audioMuted, videoMuted)
getLocalMedia(options)
checkTracks(trackType, track, receiveTracks)
attachMedia(mediaProperties, meetingId)
updateMedia(mediaProperties, meetingId)
setTrackOnTransceiver(transceiver, options)
updateTransceiver(meetingId, peerConnection, transceiver, options)
getDisplayMedia(options)
getMedia(audio, video)
getSupportedDevice(options?)
getDevices()
toggleStream()
stopTracks(track)
stopStream(stream)
getUserMedia(mediaSetting, audioVideo, sharePreferences)
new MediaProperties()

Initializes the StateMachine for the meeting

create(meetingRef: Meeting): StateMachine
Parameters
meetingRef (Meeting) A reference to a meeting instance
Returns
StateMachine:

Ring stop transition, to end the ring event for the meeting, and transition the state to ANSWERED OR DECLINED, only for outgoing meetings

onRemote(transition: Object, stop: Object): Boolean
Parameters
transition (Object) -- FiniteStateMachine automatically passed, not used
stop (Object) -- {remoteAnswered: {Boolean}, remoteDeclined: {Boolean}}
Returns
Boolean:

Ring transition, to cause the ring event for the meeting, and transition the state to RINGING, for both incoming, and outgoing meetings

onRing(transition: Object, type: String): Boolean
Parameters
transition (Object) -- FiniteStateMachine automatically passed, not used
type (String) -- incoming call === INCOMING / or other meetings have a ring type of JOIN
Returns
Boolean:

handle the error transition stage

onBeforeError(transition: Object, error: Error): Boolean
Parameters
transition (Object)
error (Error)
Returns
Boolean:

After ANY transition occurs, we want to know what state the meeting moved to for debugging

onAfterTransition(transition: Object): Boolean
Parameters
transition (Object)
Returns
Boolean:
create(mediaDirection: Object, meeting: Meeting): StateMachine
Parameters
mediaDirection (Object) An object that contains whether we send audio/video/screen streams
meeting (Meeting) the meeting instance we are using for this state machine
Returns
StateMachine: returns a StateMachine instance

Convenience method to return whether the call is muted or not

isMuted(): Boolen
Returns
Boolen: whether the audio is muted or not

Convenience function to tell whether we are muted or not

isMuted(): Boolen
Returns
Boolen: boolean that indicates whether the video is currently muted

Convenience method to expose this.self

isSelf(): Boolen
Returns
Boolen: this.self

Convenience function to tell who last muted/unmuted the video

isSelf(): Boolen
Returns
Boolen: boolean that indicates whether the video was muted by the end user or server
setData(audio: Object): null
Parameters
audio (Object) the audio state to change
Returns
null:
setData(video: Object): null
Parameters
video (Object) current video options to set on the state machine
Name Description
video.mute Boolean indicates if video is muted or not for a meeting
video.self Boolean indicates whether the end user or server muted the video
Returns
null:

Method that gets fired before the toggle state change. If this fails, return false will cancel the transition and the state will remain unchanged

onBeforeToggle(transition: Object, audio: Object): Object
Parameters
transition (Object) the StateMachine transition object
audio (Object) Audio options
Returns
Object: this.data which contains {muted, self}

Method that gets fired before the toggle state change. If this fails, return false will cancel the transition and the state will remain unchanged

onBeforeToggle(transition: Object, video: Object): Object
Parameters
transition (Object) the StateMachine transition object
video (Object) video options
Returns
Object: this.data which contains {muted, self}
onAfterToggle(transition: Object, audio: Object): Object
Parameters
transition (Object) StateMachine transition
audio (Object) audio options
Returns
Object: this.data which contains {muted, self}
onAfterToggle(transition: Object, video: Object): Object
Parameters
transition (Object) StateMachine transition
video (Object) video options
Returns
Object: this.data which contains {muted, self}
create(mediaDirection: Object, meeting: Meeting): Statemachine
Parameters
mediaDirection (Object) object containing media direction
Name Description
mediaDirection.sendVideo Boolean Whether or not to send video in the meeting
meeting (Meeting) an instance of a Meeting
Returns
Statemachine: returns a state machine instance

handles when the locus.host is updated

updateHostInfo(host: Object): undefined
Parameters
host (Object) the locus.host property
Returns
undefined:

handles when the locus.mediaShares is updated

updateMediaShares(mediaShares: Object): undefined
Parameters
mediaShares (Object) the locus.mediaShares property
Returns
undefined:

handles when the locus.self is updated

updateSelf(self: Object, participants: Array): undefined
Parameters
self (Object) the locus.mediaShares property
participants (Array) the locus.participants property
Returns
undefined:

Events plugin-meetings local Used to emit events internally between modules specific to an object

new EventsScope()

Extends ChildEmitter

parses the relevant values for self: muted, guest, moderator, mediaStatus, state, joinedWith, creator, id

parse(self: Object, deviceId: String): undefined
Parameters
self (Object)
deviceId (String)
Returns
undefined:

get the id from the self object

getSelfIdentity(self: Object): String
Parameters
self (Object)
Returns
String:

get the muted property from the self object

getMuted(self: Object): Boolean
Parameters
self (Object)
Returns
Boolean:
isLocusGuestUnadmitted(check: Object): Boolean
Parameters
check (Object)
Returns
Boolean:
isLocusGuestAdmitted(check: Object): Boolean
Parameters
check (Object)
Returns
Boolean:
isUnadmittedGuest(self: Object): Boolean
Parameters
self (Object)
Returns
Boolean:
Throws
  • Error: when self is undefined
isAdmittedGuest(oldSelf: Object, changedSelf: Object): Boolean
Parameters
oldSelf (Object)
changedSelf (Object)
Returns
Boolean:
Throws
  • Error: if changed self was undefined

extract the sipUrl from the partner

getSipUrl(partner: Object, type: any, sipUri: any, info: Object): Object
Parameters
partner (Object)
type (any)
sipUri (any)
info (Object)
Returns
Object:

parse the relevant host values that we care about: id

parse(host: Object): Object
Parameters
host (Object)
Returns
Object: parsed host or null if host was undefined

get the previous and current host values parsed, as well as the boolean updates

getHosts(oldHost: Object, newHost: Object): Object
Parameters
oldHost (Object)
newHost (Object)
Returns
Object: previous: {Object} old host, current: {Object} new host, updates: {isNewHost: {boolean}} boolean update values

determine by id if 2 hosts are different

isDifferentHosts(previousId: String, currentId: String): Boolean
Parameters
previousId (String)
currentId (String)
Returns
Boolean:

Extract the id from the host object

getId(host: Object): String
Parameters
host (Object)
Returns
String:

parse the relevant host values that we care about: id

parse(controls: LocusControls): Object
Parameters
controls (LocusControls)
Returns
Object: parsedObject - parsed host or null if host was undefined
Returns
String: parsedObject.recordingId

Extract the id from the record controls object

getId(controls: LocusControls): (String | null)
Parameters
controls (LocusControls)
Returns
(String | null):

Controls

LocusControls

Type: Object

Properties
record (Object)

parses the relevant values for mediaShares: contentId, disposition

parse(mediaShares: Object): undefined
Parameters
mediaShares (Object)
Returns
undefined:

get the previous and current mediaShares values parsed, as well as the boolean updates

getMediaShares(oldShare: Object, newShare: Object): Object
Parameters
oldShare (Object)
newShare (Object)
Returns
Object: previous: {Object} old share, current: {Object} new share,

get the floor disposition (released, granted)

getDisposition(mediaShares: Object): Boolean
Parameters
mediaShares (Object)
Returns
Boolean: disposition

extract the content property from media shares

extractContent(mediaShares: Object): Object
Parameters
mediaShares (Object)
Returns
Object:

extract the floor property from content object

extractFloor(content: Object): Object
Parameters
content (Object)
Returns
Object:

extract the content's floor from media shares

extractContentFloor(mediaShares: Object): Object
Parameters
mediaShares (Object)
Returns
Object:

get who is sharing from media shares

getContentId(mediaShares: Object): Object
Parameters
mediaShares (Object)
Returns
Object:
new ReconnectionManager()
Static Members
reconnect(meeting)
new MeetingRequest()
Instance Members
joinMeeting(options)
syncMeeting(options)
getFullLocus(options)
leaveMeeting(options)
acknowledgeMeeting(options)
recordMeeting(options)
declineMeeting(options)
remoteAudioVideoToggle(options)
changeMeetingFloor(options)
getActiveMeetings()
determineRedirections(responseBody)
new MeetingRequest()
Instance Members
joinMeeting(options)
syncMeeting(options)
getFullLocus(options)
leaveMeeting(options)
acknowledgeMeeting(options)
recordMeeting(options)
declineMeeting(options)
remoteAudioVideoToggle(options)
changeMeetingFloor(options)
getActiveMeetings()
determineRedirections(responseBody)
new Members()
Static Members
setLocusUrl(locus, locusUrl = null)
setHostId(locus, hostId = null)
setType(fullState, type = null)
setSelfId(locus, selfId = null)
setMediaShareContentId(locus, contentId?)
addMember(invitee, alertIfActive?)
admitMembers(memberIds)
removeMember(memberId)
muteMember(memberId, mute = true)
transferHostToMember(memberId, moderator = true)
Events
members:content:update
members:update
members:self:update
members:host:update
new Member()
Static Members
setIsContentSharing(flag)
setIsHost(flag)
setIsSelf(flag)
processIsContentSharing(participant, sharingId)
processIsRecording(participant, recordingId)
Instance Members
associatedUser