SIGN UP

VICall

Interface that may be used for call operations like answer, reject, hang up and mid-call operations like hold, start/stop video and others.

Methods

- (void)addDelegate:(id<VICallDelegate>)delegate

Add call delegate to handle call events.

Parameters

- (void)answerWithSendVideo:(BOOL)sendVideo
               receiveVideo:(BOOL)receiveVideo
                 customData:(nullable NSString *)customData
                    headers:(nullable NSDictionary *)headers

Answer incoming call.

Parameters

  • sendVideo:

    BOOL

    Specify if video send is enabled for a call.

  • receiveVideo:

    BOOL

    Specify if video receive is enabled for a call.

  • customData:

    nullable NSString *

    Custom string associated with the call session. It can be passed to the cloud to be obtained from the CallAlerting event or Call History using HTTP API. Maximum size is 200 bytes. Use the [VICall sendMessage:] method to pass a string over the limit; in order to pass a large data use media_session_access_url on your backend.

  • headers:

    nullable NSDictionary *

    Optional set of headers to be sent with message. Names must begin with "X-" to be processed by SDK.

- (void)answerWithSettings:(VICallSettings *)settings

Answer incoming call.

Parameters

  • settings:

    VICallSettings *

    Call settings with additional call parameters, such as preferred video codec, custom data, extra headers etc.

- (NSTimeInterval)duration

Get the call duration.

Returns

  • Return:

    NSTimeInterval

    Call duration.

- (void)hangupWithHeaders:(nullable NSDictionary *)headers

Terminates call. Call should be either established, or outgoing progressing.

Parameters

  • headers:

    nullable NSDictionary *

    Optional set of headers to be sent with message. Names must begin with "X-" to be processed by SDK.

- (void)rejectWithHeaders:(nullable NSDictionary *)headers

Reject incoming call with mode VIRejectModeBusy.

Parameters

  • headers:

    nullable NSDictionary *

    Optional set of headers to be sent with message. Names must begin with "X-" to be processed by SDK.

- (void)rejectWithMode:(VIRejectMode)mode
               headers:(nullable NSDictionary *)headers

Reject incoming call.

Parameters

  • Specify mode of call rejection.

  • headers:

    nullable NSDictionary *

    Optional set of headers to be sent with message. Names must begin with "X-" to be processed by SDK.

- (void)removeDelegate:(id<VICallDelegate>)delegate

Remove previously added delegate.

Parameters

- (BOOL)sendDTMF:(NSString *)dtmf

Send DTMF within the call.

Parameters

  • dtmf:

    NSString *

    DTMFs.

Returns

  • Return:

    BOOL

    YES if DTMFs are sent successfully, NO otherwise.

- (void)sendInfo:(NSString *)body
        mimeType:(NSString *)mimeType
         headers:(nullable NSDictionary *)headers

Send INFO message within the call.

Parameters

  • body:

    NSString *

    Custom string data.

  • mimeType:

    NSString *

    MIME type of info.

  • headers:

    nullable NSDictionary *

    Optional set of headers to be sent with message. Names must begin with "X-" to be processed by SDK

- (void)sendMessage:(NSString *)message

Send message within the call. Implemented atop SIP INFO for communication between call endpoint and Voximplant cloud, and is separated from Voximplant messaging API.

Parameters

  • message:

    NSString *

    Message text.

- (void)setHold:(BOOL)hold
     completion:(nullable VICompletionBlock)completion

Hold or unhold the call.

Parameters

  • hold:

    BOOL

    YES if the call should be put on hold, NO for unhold.

  • completion:

    nullable VICompletionBlock

    Completion block to handle the result of the operation.

    typedef void (^VICompletionBlock)(NSError *__nullable error);
    • error: If set to 'nil' this means success.
- (void)setSendVideo:(BOOL)video
          completion:(nullable VICompletionBlock)completion

Start or stop sending video for the call.

Parameters

  • video:

    BOOL

    YES if video should be sent, NO otherwise.

  • completion:

    nullable VICompletionBlock

    Completion block to handle the result of the operation.

    typedef void (^VICompletionBlock)(NSError *__nullable error);
    • error: If set to 'nil' this means success.
- (void)start

Start outgoing call.

- (void)startReceiveVideoWithCompletion:(nullable VICompletionBlock)completion

Start receive video if video receive was not enabled before. Stop receiving video during the call is not supported.

Parameters

  • completion:

    nullable VICompletionBlock

    Completion block to handle the result of operation.

    typedef void (^VICompletionBlock)(NSError *__nullable error);
    • error: If set to 'nil' this means success.
- (void)startWithHeaders:(nullable NSDictionary *)headers

Start outgoing call.

Parameters

  • headers:

    nullable NSDictionary *

    Optional set of headers to be sent with message. Names must begin with "X-" to be processed by SDK.

- (void)stopWithHeaders:(nullable NSDictionary *)headers

Terminate established or outgoing processing call.

Parameters

  • headers:

    nullable NSDictionary *

    Optional set of headers to be sent with message. Names must begin with "X-" to be processed by SDK.

Properties

@property (nonatomic, strong, readonly) NSString *callId

The call id.

@property (nonatomic, strong, readonly) NSArray<VIEndpoint *> *endpoints

Array of the endpoints associated with the call.

@property (nonatomic, strong, readonly) NSArray<VIVideoStream *> *localVideoStreams

Local video streams associated with the call.

@property (nonatomic, strong) NSString *preferredVideoCodec

Preferred video codec, for example: @"H264". Nil by default. Must be set before using [VICall startWithHeaders:], if needed.

@property (nonatomic, assign) BOOL sendAudio

Enables or disables audio transfer from microphone into the call.

@property (nonatomic, strong, readonly) VICallStat *stat

Call statistics. Updated every 5 seconds.

@property (nonatomic, strong) VIVideoSource *videoSource

Video source. By default [VICameraManager sharedCameraManager] is used that gets video from back or front camera. Must be set before using [VICall startWithHeaders:] and [VICall answerWithSendVideo:receiveVideo:customData:headers:], if needed.