The Calls SDK adds call features to your app with a few simple steps. To make your first call, do the following steps:
SendBirdCall instance must be initialized when a client app is launched. Initialization is done by using the
APP_ID of your Sendbird application in the dashboard. If the instance is initialized with a different
APP_ID, all existing call-related data in a client app will be cleared and the
SendBirdCall instance will be initialized again with the new
To make and receive calls, authenticate a user to Sendbird server by using their user ID through the
authenticate() method. To receive calls, the
SendBirdCall instance should be connected with Sendbird server. Connect socket by using the
SendBirdCall.connectWebSocket() method after a user’s authentication has been completed.
Note: You can implement both the Chat and Calls SDKs to your app. Two SDKs can work on the same Sendbird application for them to share users. In this case, you can allow Calls to retrieve a list of users in the client app by using the Chat SDK’s method or Chat API.
Add a device-specific
SendBirdCallListener event handler using the
SendBirdCall.addListener() method. Once the event handler is added, responding to device events such as incoming calls can be managed as shown below:
Note: If a
SendBirdCallListenerevent handler isn’t registered, a user can't receive an
onRingingcallback event, thus recommended to add this handler at the initialization of the app. Also, a
SendBirdCallListenerevent handler is automatically removed when the app closes by default.
Initiate a call by providing the callee’s user ID into the
SendBirdCall.dial() method. Use the
CallOption object to choose initial call configuration, such as audio or video capabilities, video settings, and mute settings.
Note: A media viewer is a HTMLMediaElement such as
<video>to display media stream. The
remoteMediaViewis required for the remote media stream to be displayed. It is also recommended to set a media viewer's
autoplayproperty to true.
Note: Media viewers can also be set using the
To receive an incoming call, a
SendBirdCallListener event handler should already be registered in the callee’s client app. Accept or decline the call using the
directCall.accept() or the
directCall.end() method. If the call is accepted, a media session will automatically be established by the Calls SDK.
Before accepting the call, the call-specific
DirectCallListener event handler must be added to the call object. It enables the callee’s app to react to events happening during the call through its callback methods.
Note: If media viewer elements have been set by the
call.setRemoteMediaView()methods, make sure that the same media viewers are set in the
callOption. If not, they will be overridden during executing the
The callee’s client app receives an incoming call through the connection with Sendbird server established by the