Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 40 additions & 2 deletions calls/flutter/ringing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,44 @@ CometChat.initiateCall(call,
| `receiverID` | String | UID of the user or GUID of the group to call |
| `receiverType` | String | `CometChatConstants.receiverTypeUser` or `receiverTypeGroup` |
| `callType` | String | `CometChatConstants.callTypeVideo` or `callTypeAudio` |
| `timeout` | int | Optional. The timeout duration in seconds for the call to be answered before it's automatically cancelled. Defaults to 45 seconds. |

## Call Timeout

By default, if the receiver does not answer within **45 seconds**, the call is automatically marked as `unanswered` and the caller receives the `onOutgoingCallRejected` callback. You can customize this duration by passing a `timeout` parameter (in seconds) when initiating the call.

```dart
String receiverID = "USER_ID";
String receiverType = CometChatConstants.receiverTypeUser;
String callType = CometChatConstants.callTypeVideo;

Call call = Call(receiverID, receiverType, callType);

// Set a custom timeout of 30 seconds
CometChat.initiateCall(call,
timeout: 30,
onSuccess: (Call call) {
debugPrint("Call initiated: ${call.sessionId}");
},
onError: (CometChatException e) {
debugPrint("Call initiation failed: ${e.message}");
},
);
```

| Parameter | Type | Description |
|-----------|------|-------------|
| `call` | Call | The call object with receiver and call type details |
| `timeout` | int | Time in seconds to wait before marking the call as unanswered. Defaults to `45`. Values ≤ 0 fall back to the default `45` seconds. |

When the timeout expires without the call being accepted, the SDK automatically:
1. Sends an `unanswered` call status to the server.
2. Triggers the `onOutgoingCallRejected` callback on the caller's side with the call status set to `unanswered`.
3. Cleans up the call session.

<Note>
If the call is accepted, rejected, or cancelled before the timeout expires, the timer is automatically stopped and the timeout has no effect.
</Note>

## Listen for Incoming Calls

Expand Down Expand Up @@ -93,7 +131,7 @@ CometChat.addCallListener(listenerID, CallListener(
|----------|-------------|
| `onIncomingCallReceived` | A new incoming call is received |
| `onOutgoingCallAccepted` | The receiver accepted your outgoing call |
| `onOutgoingCallRejected` | The receiver rejected your outgoing call |
| `onOutgoingCallRejected` | The receiver rejected your outgoing call, or the call timed out as unanswered |
| `onIncomingCallCancelled` | The caller cancelled the incoming call |
| `onCallEndedMessageReceived` | The call has ended |

Expand Down Expand Up @@ -265,4 +303,4 @@ CometChat.addCallListener(listenerID, CallListener(
| `cancelled` | Caller cancelled before receiver answered |
| `ended` | Call ended normally |
| `missed` | Receiver didn't answer in time |
| `unanswered` | Call was not answered |
| `unanswered` | Call was not answered within the timeout duration |
28 changes: 28 additions & 0 deletions sdk/flutter/default-call.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,39 @@ CometChat.initiateCall(
);
```

```dart
// User call with custom timeout
String receiverID = "UID";
String receiverType = CometChatConstants.RECEIVER_TYPE_USER;
String callType = CometChatConstants.CALL_TYPE_VIDEO;

Call call = Call(
receiverUid: receiverID,
receiverType: receiverType,
type: callType,
);

// Set a custom timeout of 30 seconds (default is 45 seconds)
CometChat.initiateCall(
call,
timeout: 30,
onSuccess: (Call call) {
debugPrint("Call initiated: ${call.sessionId}");
// Show outgoing call UI
// Store call.sessionId for later use
},
onError: (CometChatException e) {
debugPrint("Call initiation failed: $e");
},
);
```

| Parameter | Description |
| -------------- | ------------------------------------------------------------------------------------------------------------------ |
| `receiverID` | The UID or GUID of the recipient |
| `receiverType` | The type of the receiver: `CometChatConstants.RECEIVER_TYPE_USER` or `CometChatConstants.RECEIVER_TYPE_GROUP` |
| `callType` | The type of the call: `CometChatConstants.CALL_TYPE_AUDIO` or `CometChatConstants.CALL_TYPE_VIDEO` |
| `timeout` | Optional. The timeout duration in seconds for the call to be answered before it's automatically cancelled. Defaults to 45 seconds. |

On success, a `Call` object is returned containing the call details including a unique `sessionId` required for starting the call session.

Expand Down
2 changes: 1 addition & 1 deletion sdk/flutter/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Minimum Requirements
<Tabs>
<Tab title="Dart">
```dart
cometchat_sdk: ^4.0.33
cometchat_sdk: ^4.1.1
```

</Tab>
Expand Down
2 changes: 1 addition & 1 deletion sdk/flutter/setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Minimum Requirement
<Tabs>
<Tab title="Dart">
```dart
cometchat_sdk: ^4.0.33
cometchat_sdk: ^4.1.1
```

</Tab>
Expand Down
2 changes: 1 addition & 1 deletion ui-kit/flutter/calling-integration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Add the following dependency to your `pubspec.yaml` file:

```yaml
dependencies:
cometchat_calls_uikit: ^5.0.12
cometchat_calls_uikit: ^5.0.14
```
## Step 2: Update Android build.gradle
Expand Down
2 changes: 1 addition & 1 deletion ui-kit/flutter/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ dependencies:
flutter:
sdk: flutter
cometchat_chat_uikit: ^5.2.13
cometchat_calls_uikit: ^5.0.13 # Optional: for voice/video calling
cometchat_calls_uikit: ^5.0.14 # Optional: for voice/video calling
```
Then run:
Expand Down