CometChat.initiateCall created the call, a CallListener on the Chat SDK’s real-time connection told the callee, and acceptCall, rejectCall and endCall answered, declined and ended it. Ringing now runs on the Calls SDK: it creates the call, prepares and joins the session, and ends the ring. The Chat SDK’s calling methods are superseded by the Calls SDK and no longer used. On the web, the Chat SDK’s CallListener stays: it is still how an incoming call reaches an open tab.
This page is the diff. For the full description of the current flow see Ringing.
Before you start
Ringing with the Calls SDK is opt-in on the client: update your app to the APIs below. While some of your users are still on legacy ringing, one dashboard setting lets the two flows call each other; see While some users are still on legacy ringing. This page is for apps that use the SDKs directly. If you use the CometChat UI Kit, its support for this flow comes with a coming UI Kit release; keep legacy ringing until then.Web and mobile apps ring each other on this flow when the mobile app also rings with the Calls SDK 5.1 and the Push Notifications SDK 2.0. Calls between an app on legacy ringing and an app on this flow ring once Connect legacy ringing is on in the dashboard; see While some users are still on legacy ringing.
Why it changed
Before and after
Step 1: Update dependencies
initiateCall, connect and endCall, the Chat SDK for the incoming call message.
For TypeScript: in 5.1 the error type of joinSession() and session.join(container) is JoinSessionException (it was VerifyTokenException in 5.0), which adds SESSION_SETTINGS_REQUIRED, SESSION_ALREADY_PREPARED and SESSION_CANCELLED. See “5.0 to 5.1” in the v5 migration guide.
Step 2: Rewrite the caller
- Before
- After
Step 3: Rewrite the callee
- Before
- After
Step 4: Replace the remaining calls
While some users are still on legacy ringing
Your users don’t all update at once, so during the rollout one CometChat app has devices on both flows. A device’s flow comes from its push registration: a device on the Calls SDK 5.1 and Push Notifications SDK 2.0 receives only the call-initiated push, and a device still on legacy ringing keeps receiving the legacy call events. To let users on the two flows call each other, turn on Connect legacy ringing in the CometChat dashboard under Voice & Video Calls → Settings. CometChat then also sends calls made on this flow as legacy call events, so devices on either flow ring for calls from the other.- Turn it on before the first users update, and leave it on while any version of your apps still in use rings the legacy way.
- It can’t be turned off from the dashboard.
- The six legacy call events (ongoing, cancelled, rejected, unanswered, busy and ended) are under Show legacy in Notifications → Settings → Call Preferences. They only reach devices on legacy ringing.
What users will notice
- The caller sees “Ringing…” once the callee’s tab or phone is reached, and the call screen closes when the call is declined, busy or missed (from
onOutgoingCallRejected, the status poll, or the ring timer). - Answering joins almost at once, because the session was prepared while it rang.
- Calls ring between web and mobile users in both directions, when the mobile app also rings with the Calls SDK 5.1 and the Push Notifications SDK 2.0. Calls between an app on legacy ringing and an app on this flow ring too, once Connect legacy ringing is on in the dashboard.
- The browser asks for the camera and microphone when the call is joined, not while it rings.
Checklist
-
@cometchat/calls-sdk-javascript5.1; the Chat SDK (4.2.1 or later) stays, initialized and logged in as the same user - The mobile apps your web app calls also ring with the Calls SDK 5.1 and the Push Notifications SDK 2.0, or Connect legacy ringing is on in the dashboard
-
initiateCallpassessessionSettingswithsessionType, andisPeerCall: truefor a 1:1 call - Caller listens for
onParticipantConnected/onParticipantJoined/onConnectionClosedand joins only ononParticipantJoinedwithdata.session.join(container) - Caller ends the screen on
onOutgoingCallRejected, polls the call’s status every 3 s while ringing as a backstop, and runs a ring timer that ends the call asunanswered - Callee skips its own outgoing calls, prepares with
connect, and answers withsession.join(container) - Callee stops ringing on
onIncomingCallCancelled,onConnectionClosed, its ring timer and the status poll - Decline, busy and cancel use
CometChatCalls.endCall; noCometChat.acceptCall,rejectCallorendCallleft - Hang-up uses
session.leave()orCometChatCalls.leaveSession() - Tested: web to web, web to phone and phone to web; decline, busy, cancel, no answer; two open tabs