var callType = StreamCallType.Default; // Call type affects default permissions
var callId = "my-call-id";
// Notice that we pass create argument as true - this will create the call if it doesn't already exist
var streamCall = await _client.JoinCallAsync(callType, callId, create: true, ring: true, notify: false);
Joining & Creating Calls
Joining a call
Most commonly, you will want to either join another call or create a new call and join it immediately.
You can easily achieve this with the _client.JoinCallAsync
method and setting the create
argument to true if you’re creating a new call or false if you’re joining another call.
The call type controls which features are enabled, and sets up permissions. You can read more about the call typeshere
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.
Creating a call
If you wish to only create a call object, that you’ll join later, you can use the _client.GetOrCreateCallAsync
method.
var callType = StreamCallType.Default; // Call type affects default permissions
var callId = "my-call-id";
// Get call or create if it doesn't exist
var streamCall = await _client.GetOrCreateCallAsync(callType, callId);
Get a call
To get a call by id and the call type you can use the _client.GetCallAsync
method. This method will return the call object if it exists or return null if the call was not found.
var callType = StreamCallType.Default; // Call type affects default permissions
var callId = "my-call-id";
// Try to get call - will return null if the call doesn't exist
var streamCall = await _client.GetCallAsync(callType, callId);
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.
var filters = new List<IFieldFilterRule>
{
CallMemberFilter.Role.EqualsTo("admin")
};
var result = await streamCall.QueryMembersAsync(filters, CallMemberSort.OrderByDescending(CallMemberSortField.LastActive), limit: 25);
// queried members, depending on how many members satisfy the filter this can be only a subset or a single "page" of results
var members = result.Members;
// In order to get the next "page" of results, use this token as a "next" argument in the QueryMembersAsync method
var next = result.Next;
// In order to get the previous "page" of results, use this token as a "prev" argument in the QueryMembersAsync method
var prev = result.Prev;
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 |