This page explains the key functions of direct call consisting of how to retrieve a direct call or a list of direct calls, update custom items, and delete custom items of a direct call.
Note: Right now, the Calls API supports retrieving calls and actions for custom items. Other actions should be done from the Calls SDK.
The following table shows the list of properties in a direct call resource.
Property name
Type
Description
call_id
string
A unique identifier for the call.
call_type
string
The type of the call.
is_video_call
string
Indicates whether the call is a video call.
state
string
The state of the call.
end_result
string
The result of how the call has ended. Valid values are completed, canceled, declined, connection_lost, no_answer, timed_out, and unknown.
* Some end results are shown differently on the Dashboard. The following respectively lists the corresponding end results shown in the dashboard: completed, canceled, declined, dropped, missed, timed out, and interrupted.
user_role
string
The user's role in the call. This appears either as dc_caller or as dc_callee when a user_id parameter is specified in a request.
The period from the call was accepted to when the call was ended, measured in milliseconds.
custom_items
nested object
Specifies a JSON object that has key-value custom items to update. The key must not have a comma (,) and its length is limited to 128 characters. The value must be a string and its length is limited to 128 characters. This parameter can have up to 10 custom items.
API endpoints are relative to the base URL allocated to your application. In this page, the /direct_calls endpoint refers to https://api-{application_id}.calls.sendbird.com/v1/direct_calls.
Note: If you want to know your application ID, sign in to your dashboard, go to the Settings > Application > General, and then check the Application ID.
It's recommended that the parameter values in API URLs be urlencoded, such as {user_id}.
Retrieves all direct calls within the application. The retrieved list of direct calls are sorted in reverse order, meaning the newest direct call appears first and the oldest last.
Specifies the value of the next property in the response to retrieve the next page in the result set.
user_ids
string
Searches for calls that include one or more users in the parameter value. The string should consist of multiple urlencoded user IDs separated by commas ( for example, ?user_ids=urlencoded_id_1, urlencoded_id_2).
* The user_id can be used interchangeably with this parameter, but can only specify one user ID. When both the user_id and the user_ids are specified, an error will be returned.
between_two_user_ids_only
string
Searches for calls between two users in the parameter value. The string should consist of only the two urlencoded user IDs separated by commas.
call_ts
long
Specifies the timestamp to be the reference point of the query, in Unix milliseconds. If specified along with the search_scope_from_call_ts, this parameter sets a time range and restricts the search scope to only retrieve calls of which started_at or ended_at is within the range.
search_scope_from_call_ts
long
Specifies the scope to add to the call_ts and determine the search scope range, in Unix milliseconds.
duration_range_min
int
Specifies the minimum value of the duration to restrict the search scope to only retrieve calls of which duration is equal to or greater than the specified value, in Unix milliseconds. This should be specified in conjunction with the duration_range_max parameter.
duration_range_max
int
Specifies the maximum value of the duration to restrict the search scope to only retrieve calls of which duration is less than the specified value, in Unix milliseconds. This should be specified in conjunction with the duration_range_min parameter.
state
string
Restrict the search scope to only retrieve calls of which state matches any of the specified value. Acceptable values are limited to current and ended.
end_result
string
Specifies a comma-separated string of one or more end results to only retrieve calls of which the end result that matches any of the specified values. Acceptable values are limited to completed, canceled, declined, connection_lost, no_answer, timed_out, and unknown.
The following table lists the properties of an HTTP request that this action supports.
Properties
Required
Type
Description
custom_items
nested object
Specifies a JSON object that has key-value custom items to update. The key must not have a comma (,) and its length is limited to 128 characters. The value must be a string and its length is limited to 128 characters. This parameter can have up to 10 custom items.
Optional
Type
Description
mode
string
Determines whether to update the existing custom items or add new custom items. Acceptable values are the following: - upsert (default): The existing items are updated with new values when there are already custom items with the keys. - insert: New key-value custom items are added when there are no items with the keys.