react-js-sdk
This document covers the 555 JavaScript SDK's React Component.
Getting started
$ npm install iris-react-sdk --save
Usage - Examples
;
-
Make connection using
iristoken
androutingId
// Call connection methodRtcSdk;//Listen to onConnected eventRtcSdk {console;}//Listen to notification eventRtcSdk {console;}//Listen to iris diconnected eventRtcSdk {console;}//Listen to connection errorsRtcSdk {console;} -
Using
RoomContainer
to initiate/accept call
return <RoomContainer ref="room" Type=thisstateType RoomId=thisstateRoomId Config=thisstateConfig NotificationPayload=thisstateNotificationPayload onLocalStream=thisonLocalStream onRemoteStream=thisonRemoteStream onSessionCreated=thisonSessionCreated onSessionJoined=thisonSessionJoined onSessionConnected=thisonSessionConnected onSessionParticipantJoined=thisonSessionParticipantJoined onSessionParticipantAudioMuted=thisonSessionParticipantAudioMuted onSessionParticipantLeft=thisonSessionParticipantLeft onSessionEnd=thisonSessionEnd onUserProfileChange=thisonUserProfileChange onSessionSIPStatus=thisonSessionSIPStatus onError=thisonError onEvent=thisonEvent /> ... let roomId = responseroom_id;let Config = irisToken: "" routingId: "" toTN: "" fromTN: "" toRoutingId: "" traceId: "" userData: "" SessionType: 'outgoing' notificationPayload: '';this;
APIs
connect
Connection APIs - Make a connection using - Example
;RtcSdk;
-
Params
serverUrl
{String}: The url to event manageririsToken
{String}: A valid IRIS tokenroutingId
{String}: Routing id of the user who is trying to login
disconnect
Connection APIs - Disconnect using - Example
;RtcSdk;
-
Params
- None
getMediaDevices
Media devices - Get a list of meida devices with Returns a promise with list of available audio and video devies
- Example
;RtcSdk;
requestMediaPermission
Request Media Device Permission - Returns a promise with boolean whether permission is acquired or not
- Example
;let deviceType = 'microphone'RtcSdk;
pstnHold
PSTN APIs - Hold a PSTN call using - Example
thisrefsroom;
-
Params
roomId
{String} : Room IdparticipantJid
{String}: Remote participant routingId/resourceId
pstnUnHold
PSTN APIs - UnHold a PSTN call using - Example
thisrefsroom;
-
Params
roomId
{String} : Room IdparticipantJid
{String}: Remote participant routingId/resourceId
pstnMerge
PSTN APIs - Merge two PSTN calls using - Example
thisrefsroom;
-
Params
roomId
{String} : Room IdfirstParticipantJid
{String}: First remote participant's routingId/resourceIdsecondSession
{object}: IrisRtcSession object of the session to be mergedsecondParticipantJid
{String}: Second remote participant's routingId/resourceId
pstnHangup
PSTN APIs - End PSTN call using - Example
thisrefsroom;
-
Params
roomId
{String} : Room IdparticipantJid
{String}: Remote participant's routingId/resourceId
Callbacks
onConnected
Connection - For connection successful listen to - Example
RtcSdk { console;}
-
Params
- None
onNotification
Connection - For Notification listen to - Example
RtcSdk { console;}
-
Params
notificationPayload
{json} : Notification payload with the information to join session
onSessionSIPStatus
Session - For PSTN SIP Status listen to - Example
{ console;}
-
Params
roomId
{String} : RoomId of the sessionparticipantJid
{String} : Jid of the participantstatus
{String} : PSTN Status ex. initializing, connecting, ringing, connected.
onLocalStream
RoomContainer - For local media stream - Example
{ console;}
-
Params
stream
{object} : Local media stream