CPCallService

Objective-C

@interface CPCallService : NSObject <CPServiceProtocol>

Swift

class CPCallService : NSObject

Service Class for Call. Retrieves notification from Notification Manager and redirects them to related classes. Sends reqiured callbacks to application layer.

Since

1.0.0
  • Provides reference for sending callbacks to application

    Declaration

    Objective-C

    @property (nonatomic, strong) id<CPCallApplicationDelegate> callApplicationDelegate;

    Return Value

    CPCallApplicationDelegate

  • If YES, MobileSDK will not initialize the audio unit automatically when an audio track is ready for playout or recording. Instead, applications should call setVoipAudioEnabled. If NO, MobileSDK will initialize the audio unit as soon as an audio track is ready for playout or recording.

    Important

    Default value is NO.

    Since

    1.0.0

    Declaration

    Objective-C

    @property (nonatomic) BOOL useManualAudio;

    Swift

    var useManualAudio: Bool { get set }

    Return Value

    Boolean

  • This property is only effective if useManualAudio is YES. Represents permission for MobileSDK to initialize the VoIP audio unit. When set to NO, if the VoIP audio unit used by MobileSDK is active, it will be stopped and uninitialized. This will stop incoming and outgoing audio. When set to YES, MobileSDK will initialize and start the audio unit when it is needed (e.g. due to establishing an audio connection).

    Important

    Default value is NO.

    Since

    1.0.0

    Declaration

    Objective-C

    @property (nonatomic, assign, unsafe_unretained, readwrite,
              getter=isVoipAudioEnabled) BOOL voipAudioEnabled;

    Swift

    var isVoipAudioEnabled: Bool { get set }

    Return Value

    Boolean

  • Initializes Call Service Instance with the given configuration.

    Since

    1.0.0

    Declaration

    Objective-C

    - (id)initWithUserInfo:(CPUserInfo *)userInfo info:(CPServiceInfo *)serviceInfo;

    Swift

    init!(userInfo: CPUserInfo!, info serviceInfo: CPServiceInfo!)

    Parameters

    config

    CPUserInfo

    serviceInfo

    ServiceInformation

  • This method is to create outgoing/mobile originated calls

    Since

    1.0.0

    Declaration

    Objective-C

    - (void)createOutGoingCall:(id<CPCallApplicationDelegate>)app
                 andOriginator:(CPUriAddress *)originator
                 andTerminator:(CPUriAddress *)terminator
                    completion:(void (^)(id<CPOutgoingCallDelegate>,
                                         CPError *))callHandler;

    Parameters

    app

    delegete of application to return callbacks for call

    originator

    address of caller

    terminator

    address of callee

    callHandler

    completion block with call to establish call

  • This method is to create outgoing/mobile originated calls

    Since

    1.0.0

    Declaration

    Objective-C

    - (void)createOutGoingCall:(id<CPCallApplicationDelegate>)app
                 andTerminator:(CPUriAddress *)terminator
                    completion:(void (^)(id<CPOutgoingCallDelegate>,
                                         CPError *))callHandler;

    Parameters

    app

    delegete of application to return callbacks for call

    terminator

    address of callee

    callHandler

    completion block with call to establish call

  • @brief This method creates Three Way Call. For now this api just supports to merge two calls.

    @since 2.1.0

    Declaration

    Objective-C

    - (void)createThreeWayCallWithFirstCall:(id)firstCall
                                 secondCall:(id)secondCall
                                 completion:(void (^)(id<CPOutgoingCallDelegate>,
                                                      CPError *))callHandler;

    Parameters

    firstCall

    specifies the first call which will be joined to ThreeWay Call

    secondCall

    specifies the second call which will be joined to ThreeWay Call

    completion

    completion block with call to establish call

  • @brief Rotates camera to specified orientation. Calling this method with parameters UIDeviceOrientationUnknown, UIDeviceOrientationFaceUpand UIDeviceOrientationFaceDown will not cause any changes on the camera.

    @since 2.14.0

    Declaration

    Objective-C

    - (void)rotateCameraWithOrientation:(id)orientation;

    Swift

    func rotateCamera(withOrientation orientation: Any!)

    Parameters

    orientation

    UIDeviceOrientation value that will be used for camera orientation.

  • Deprecated

    Use rotateCameraWithOrientation: instead

    Rotates camera to specified orientation

    Since

    1.0.0

    Declaration

    Objective-C

    - (void)rotateCameraOrientationToPosition:(id)orientation;

    Swift

    func rotateCameraOrientation(toPosition orientation: Any!)

    Parameters

    orientation

    AVCaptureVideoOrientation value that will be used for camera orientation

  • Returns the active call objects.

    Since

    1.0.0

    Declaration

    Objective-C

    - (NSArray *)getActiveCalls;

    Swift

    func getActiveCalls() -> [Any]!

    Return Value

    Immutable call list

  • Delegate method to subscribe for call service.

    Since

    1.0.0

    Declaration

    Objective-C

    - (void)subscribeWithChannelID:(NSString *)channelID
                        completion:(void (^)(NSString *_Nonnull,
                                             CPError *_Nullable))completion;

    Swift

    func subscribe(withChannelID channelID: String!) async -> (String, CPError?)

    Parameters

    channelID

    The channel on which to subscribe for call service.

    completion

    Code block to execute upon subscription completion.

    notification

    Returns service name

    error

    Returns nil unless any error occurs.

  • Delegate method to unsubscribe from call service.

    Since

    1.0.0

    Declaration

    Objective-C

    - (void)unsubscribeWithChannelID:(NSString *)channelID
                          completion:(void (^)(CPError *_Nullable))completion;

    Swift

    func unsubscribe(withChannelID channelID: String!) async -> CPError?

    Parameters

    channelID

    The channel on which to unsubscribe for call service.

    completion

    Code block to execute upon unsubscription completion.

    error

    Returns nil unless any error occurs.