Skip to main content

Overview

This section demonstrates how to start a call session in an iOS application. Previously known as Direct Calling. Before you begin, we strongly recommend you read the calling setup guide.
If you want to implement a complete calling experience with ringing functionality (incoming/outgoing call UI), follow the Ringing guide first. Once the call is accepted, return here to start the call session.

Generate Call Token

A call token is required for secure access to a call session. Each token is unique to a specific session and user combination, ensuring that only authorized users can join the call. You can generate the token just before starting the call, or generate and store it ahead of time based on your use case. Use the generateToken() method to create a call token:

Start Call Session

Use the startSession() method to join a call session. This method requires a call token (generated in the previous step) and a CallSettings object that configures the call UI and behavior. The CallSettings class configures the call UI and behavior. Use CallSettingsBuilder to create a CallSettings instance with the following required parameters:

Call Settings

Configure the call experience using the following CallSettingsBuilder methods:

Call Listeners

The CallsEventsDelegate protocol provides real-time callbacks for call session events, including participant changes, call state updates, and error conditions. To receive call events, conform to CallsEventsDelegate and set the delegate in CallSettingsBuilder using setDelegate(self).

Events

End Call Session

Ending a call session properly is essential to release media resources (camera, microphone, network connections) and update call state across all participants.

Ringing Flow

When using the Ringing flow, you must coordinate between the CometChat Chat SDK and the Calls SDK to properly terminate the call.
The Ringing flow requires calling methods from both the Chat SDK (CometChat.endCall()) and the Calls SDK (CometChatCalls.endSession()) to ensure proper call termination.
User who initiates the end call: When the user presses the end call button, the onCallEndButtonPressed() callback is triggered. Inside this callback, call CometChat.endCall(). On success, call CometChat.clearActiveCall() and CometChatCalls.endSession().
Remote participant (receives onCallEnded() callback):

Session Only Flow

When using the Session Only flow (without ringing), you only need to call the Calls SDK method to end the session.

Methods

These methods are available for performing custom actions during an active call session. Use them to build custom UI controls or implement specific behaviors based on your use case.
These methods can only be called when a call session is active.

Switch Camera

Toggles between the front and rear camera during a video call.

Mute Audio

Controls the local audio stream transmission.

Pause Video

Controls the local video stream transmission.

Set Audio Mode

Routes the audio output to a specific device.

Enter PIP Mode

Enters Picture-in-Picture mode.

Exit PIP Mode

Exits Picture-in-Picture mode.

Switch To Video Call

Upgrades an ongoing audio call to a video call.

Start Recording

Starts recording the call session.

Stop Recording

Stops an ongoing call recording.

End Call

Terminates the current call session and releases all media resources.