Skip to main content

1-to-1 call

This page describes the current public 1-to-1 calling capabilities in Nexconn Call SDK for iOS.

Key types

TypeDescription
NCCallEngineCall entry point. Starts, accepts, and ends calls, controls devices, and queries call logs.
NCCallSessionCurrent call session object. Includes callId, callType, mediaType, participants, and related data.
NCCallUserParticipant state object.
NCCallEventDelegateDelegate for incoming calls, connected calls, ended calls, participant state changes, and call logs.
NCCallAPIResultDelegateAsynchronous result delegate for startCall, acceptCall, endCall, media switching, and related APIs.

Add delegates

Objective C
NCCallEngine *engine = [NCCallEngine sharedInstance];
[engine setCallEventsDelegate:self];
[engine setAPIResultListener:self];

If you need quality metrics, also set:

Objective C
[engine setConnectionQualityDelegate:self];

Set video views

Use NCCallLocalVideoView for the local preview and NCCallRemoteVideoView for the remote stream:

Objective C
NCCallLocalVideoView *localView = [NCCallLocalVideoView new];
localView.userId = self.currentUserId;
localView.renderMode = NCCallRenderModeAspectFit;

NCCallRemoteVideoView *remoteView = [NCCallRemoteVideoView new];
remoteView.userId = self.remoteUserId;
remoteView.renderMode = NCCallRenderModeAspectFit;
remoteView.isTiny = NO;

NCCallEngine *engine = [NCCallEngine sharedInstance];
[engine setVideoView:localView];
[engine setVideoView:remoteView];

If you no longer need to show a remote user's video, call:

Objective C
[[NCCallEngine sharedInstance] removeVideoView:self.remoteUserId];

Start a 1-to-1 call

For a 1-to-1 call, callType must be NCCallSingleType, and userIds must contain exactly one remote user.

Objective C
[[NCCallEngine sharedInstance] startCall:@[self.remoteUserId]
callType:NCCallSingleType
mediaType:NCCallAudioVideoMediaType];

If you need to pass push fields or business extra data, use NCCallPushConfig or NCCallOption:

Objective C
NCCallPushConfig *pushConfig = [NCCallPushConfig new];
pushConfig.pushTitle = @"New call invitation";
pushConfig.pushContent = @"Please answer";

[[NCCallEngine sharedInstance] startCall:@[self.remoteUserId]
callType:NCCallSingleType
mediaType:NCCallAudioVideoMediaType
pushConfig:pushConfig
extra:@"business-extra"];

Receive and accept an incoming call

The callee receives the incoming call through didCallReceived:extra::

Objective C
- (void)didCallReceived:(NCCallSession *)session extra:(NSString *)extra {
[[NCCallEngine sharedInstance] acceptCall:session.callId];
}

If you need to attach push fields when accepting the call, use acceptCall:pushConfig:.

End the call

Objective C
[[NCCallEngine sharedInstance] endCall];
// Or
[[NCCallEngine sharedInstance] endCall:callId];

The asynchronous result is returned through didEndCall:callId:, and the call end event is returned through didCallEnded:reason:.

Control devices during the call

Microphone and speaker

Objective C
NCCallEngine *engine = [NCCallEngine sharedInstance];

engine.enableMicrophone = YES;
engine.enableSpeaker = YES;

Camera

Objective C
[[NCCallEngine sharedInstance] enableCamera:YES];
[[NCCallEngine sharedInstance] switchCamera];

The current header comments indicate that the camera is enabled by default after a video call is connected.

Audio and video configuration

Before the call is connected, configure capture parameters through setVideoConfig: and setAudioConfig::

Objective C
NCCallVideoConfig *videoConfig = [NCCallVideoConfig new];
videoConfig.videoResolution = NCCallVideoResolution640x480;
videoConfig.frameRate = NCCallVideoFrameRate15;
videoConfig.minVideoBitrate = 200;
videoConfig.maxVideoBitrate = 900;

[[NCCallEngine sharedInstance] setVideoConfig:videoConfig];

NCCallAudioConfig *audioConfig = [NCCallAudioConfig new];
audioConfig.audioQuality = NCCallAudioQualitySpeech;
audioConfig.audioScenario = NCCallAudioScenarioDefault;

[[NCCallEngine sharedInstance] setAudioConfig:audioConfig];

Switch media type

1-to-1 calls support switching between audio and audio-video modes.

Send a change request

Objective C
[[NCCallEngine sharedInstance] requestChangeMediaType:NCCallAudioVideoMediaType];

The result is returned through didRequestChangeMediaType:code:transactionId:callId:.

Receive and respond to a request

Objective C
- (void)didMediaTypeChangeRequestReceived:(NCCallMediaType)mediaType
transactionId:(NSString *)transactionId
userId:(NSString *)userId {
[[NCCallEngine sharedInstance] replyChangeMediaType:transactionId isAgreed:YES];
}

The final result is returned through didMediaTypeChangeResultReceived:transactionId:userId:code:. To cancel an existing request, call cancelChangeMediaType:.

Call logs

Call log callbacks after the call ends

  • didLocalCallLogReceived:
  • didServerCallLogReceived:

Query history with pagination

Objective C
[[NCCallEngine sharedInstance] getHistoryCallLogsWithTime:-1
count:20
order:1];

The result is returned through didGetHistoryCallLogs:hasMore:syncTime:order:code:. In the current documentation:

  • 0: ascending
  • 1: descending

Delete logs

Objective C
[[NCCallEngine sharedInstance] deleteCallLogsForMe:@[callId]];
[[NCCallEngine sharedInstance] deleteAllCallLogsForMe];

Quality metrics and capture delegates

If you need volume or network quality metrics, set NCCallConnectionQualityDelegate. If you need local captured audio and video frames, set:

  • setVideoFrameCaptureDelegate:
  • setAudioFrameCaptureDelegate: