Group call
This page describes the public group calling capabilities in Nexconn Call SDK for iOS, including how to start a group call, join a call, invite participants, and handle call type upgrades.
Related APIs
| Capability | API |
|---|---|
| Start a group call | startCall: with NCCallStartCallParams |
| Join an existing group call | joinCall: with NCCallJoinCallParams |
| Invite participants | inviteToCall: with NCCallInviteToCallParams |
| End the call | endCall: with NCCallEndCallParams |
Start a group call
Set callType to NCCallTypeMultiple for group calls.
NCCallStartCallParams *params =
[[NCCallStartCallParams alloc] initWithCalleeIds:@[ @"user_a", @"user_b" ]
callType:NCCallTypeMultiple
mediaType:NCCallMediaTypeAudioVideo];
[[NCCallEngine getInstance] startCall:params];
If you need to pass push fields, business extra, or a group targetId together, set them on NCCallStartCallParams after initialization:
NCCallPushConfig *pushConfig = [NCCallPushConfig new];
pushConfig.pushTitle = @"New group call";
pushConfig.pushContent = @"Tap to join";
NCCallStartCallParams *params =
[[NCCallStartCallParams alloc] initWithCalleeIds:@[ @"user_a", @"user_b" ]
callType:NCCallTypeMultiple
mediaType:NCCallMediaTypeAudioVideo];
params.pushConfig = pushConfig;
params.extra = @"business-extra";
params.targetId = @"group-id";
[[NCCallEngine getInstance] startCall:params];
The asynchronous result is onStartCall: (NCCallStartCallResult) on NCCallAPIResultHandler.
Receive, accept, reject, or join a group call
Invited users receive the incoming call through onCallReceived::
- (void)onCallReceived:(NCCallReceivedEvent *)event {
NCCallAcceptCallParams *accept =
[[NCCallAcceptCallParams alloc] initWithCallId:event.session.callId];
[[NCCallEngine getInstance] acceptCall:accept];
}
If you already have a valid callId, join with NCCallJoinCallParams:
NCCallJoinCallParams *joinParams = [[NCCallJoinCallParams alloc] initWithCallId:callId];
[[NCCallEngine getInstance] joinCall:joinParams];
Invite additional users
NCCallInviteToCallParams *invite =
[[NCCallInviteToCallParams alloc] initWithCalleeIds:@[ @"user_c", @"user_d" ]];
[[NCCallEngine getInstance] inviteToCall:invite];
If you need to include push fields and extra:
NCCallPushConfig *pushConfig = [NCCallPushConfig new];
pushConfig.pushTitle = @"New call invitation";
pushConfig.pushContent = @"You're invited to join the current call";
NCCallInviteToCallParams *invite =
[[NCCallInviteToCallParams alloc] initWithCalleeIds:@[ @"user_c" ]];
invite.pushConfig = pushConfig;
invite.extra = @"invite-extra";
[[NCCallEngine getInstance] inviteToCall:invite];
The result is onInviteToCall: (NCCallInviteToCallResult; check result.userIds, result.busyLineUserList, and result.callId). Other participants receive onRemoteUserInvited: (NCCallRemoteUserInvitedEvent with event.callId, event.inviteeUserList, and event.inviterUserId).
Upgrade a 1-to-1 call to a group call
When a third participant is successfully invited into a 1-to-1 call, the SDK reports the upgraded call type through onCallTypeChanged::
- (void)onCallTypeChanged:(NCCallTypeChangedEvent *)event {
if (event.callType == NCCallTypeMultiple) {
// The current session has been upgraded to a group call
}
}
Video views in a group call
Use NCCallLocalVideoView for the local preview and NCCallRemoteVideoView for remote participants:
NCCallLocalVideoView *localView = [NCCallLocalVideoView new];
localView.userId = self.currentUserId;
localView.renderMode = NCCallRenderModeAspectFit;
[[NCCallEngine getInstance] setLocalVideoView:localView];
NCCallRemoteVideoView *remoteView = [NCCallRemoteVideoView new];
remoteView.userId = @"user_a";
remoteView.renderMode = NCCallRenderModeAspectFit;
remoteView.enableLowResolutionStream = NO;
[[NCCallEngine getInstance] setRemoteVideoView:@[ remoteView ]];
If you no longer need to show one or more remote participants, pass their user IDs in an array:
[[NCCallEngine getInstance] removeVideoView:@[ @"user_a" ]];
End the call and manage call logs
- Use
[[NCCallEngine getInstance] getCurrentCallSession]to read the activecallId. - To leave the current group call, build
NCCallEndCallParamswith the activecallIdand optionalpushConfig, then callendCall:. - The async result is
onEndCall:(NCCallEndCallResult). - Query call history with
getHistoryCallLogs:andNCCallGetHistoryCallLogsParams. - Query ongoing calls with
getOngoingCallLogs.