Skip to main content

Ringing

The Call object provides several options to ring and notify users about a call.

Ringing

If a call was not created before, you should first create it and pass the ring value to true. For this, you can use the create method from the Call object.

let call = streamVideo.call(callType: "default", callId: callId)
let callResponse = try await call.create(members: members, ring: true)

When ring is true, a VoIP notification will be sent to the members, provided you have the required setup for CallKit and PushKit. If you don't have a VoIP push setup, a regular push notification will be sent to the members. For more details around push notifications, please check this page.

If ring is false, no push notification will be sent.

If a call was created before, the method will just get it and send the notifications. If you are sure that a call exists, you can use the get method instead:

let call = streamVideo.call(callType: "default", callId: callId)
let callResponse = try await call.get(ring: true)

Additionally, you can use the ring method which is just a shortcut for the method above:

let call = streamVideo.call(callType: "default", callId: callId)
let callResponse = try await call.ring()

Notifying users

In some cases, you just want to notify users that you joined a call, instead of ringing. To do this, you should use the notify option:

let call = streamVideo.call(callType: "default", callId: callId)
let callResponse = try await call.create(members: members, notify: true)

When notify is true, a regular push notification will be sent to all the members. This can be useful for livestreams apps or huddles.

Similarly to ringing, you can use the get method if you are sure that the call exists:

let call = streamVideo.call(callType: "default", callId: callId)
let callResponse = try await call.get(notify: true)

You can also use a shortcut of this method, with the notify method:

let call = streamVideo.call(callType: "default", callId: callId)
let callResponse = try await call.notify()

Did you find this page helpful?