val call = client.call("default", "123")
val result = call.create()
Joining & Creating Calls
Creating a call
You create a call by specifying a “call type” and a call id.
The call type controls which features are enabled, and sets up permissions.
For the call id there are a few things to note:
- You can reuse the same call multiple times.
- If you have a unique id for the call we recommend passing that as the id.
- If you don’t have a unique id you can leave it empty and we’ll generate one for you.
As an example, if you’re building a telemedicine app, calls will be connected to an appointment. Using your own appointment id as the call id makes it easy to find the call later.
Joining a call
Joining a call sets up the realtime communication for audio and video.
val call = client.call("default", "123")
val result = call.join()
Call CRUD
Basic CRUD operations are available on the call object
// create
val call = client.call("default", "123")
val result = call.create()
// update
val custom = mutableMapOf("secret" to secret)
val updateResult = call.update(custom = custom)
// get
val getResult = call.get()
Call Create Options
This example shows how to create a call with members and custom data:
val members = listOf("thierry", "tommaso")
val call = client.call("default", randomUUID())
val result = call.create(memberIds = members, custom = mapOf("color" to "red"), ring = true)
Members are permanently associated with a call. It allows you to:
- Restrict the ability to join a call only to members
- Send a push notification to members when the call starts
The following options are supported when creating a call:
Option | Description | Default |
---|---|---|
memberIds | A list of users ids to add as members to this call | - |
members | A list of members to add to this call. You can specify the role and custom data on these members | - |
custom | Any custom data you want to store | - |
settings | You can overwrite certain call settings for this specific call. This overwrites the call type standard settings | - |
startsAt | When the call will start. Used for calls scheduled in the future, livestreams, audio rooms etc | - |
team | Restrict the access to this call to a specific team | - |
ring | If you want the call to ring for each member | false |
Querying Members
You can query the members of the call. This is helpful if you have thousands of members in a call and want to paginate.
val filters = mapOf("user_id" to "jaewoong")
val response = call.queryMembers(filters, listOf(SortField.Desc("created_at")), 5)
You can filter the member list on these fields, and sort on the selected fields. Note that you can also query on custom data for the member or the user.
Option | Description | Sorting Supported |
---|---|---|
user_id | The user’s id | Yes |
role | The member’s role | No |
custom | The custom data on the member | No |
created_at | When the member was created | Yes |
updated_at | When the member was last updated | No |