SINCallClient

Objective-C

@protocol SINCallClient <NSObject>

Swift

protocol SINCallClient : NSObjectProtocol

SINCallClient provides the entry point to the calling functionality of the Sinch SDK. A SINCallClient can be acquired via SINClient.

  • Exmaple:

    
    id<SINClient> sinchClient;
    [sinchClient start];
    ...
    
    // Place outgoing call.
    id<SINCallClient> callClient = [sinchClient callClient];
    id<SINCall> call = [callClient callUserWithId:@"<REMOTE USERID>"];
    
    // Set the call delegate that handles all the call state changes
    call.delegate= ... ;
    
    // ...
    
    // Hang up the call
    [call hangup];
    
  • The object that acts as the delegate of the call client.

    The delegate object handles call state change events and must adopt the SINCallClientDelegate protocol.

    Declaration

    Objective-C

    @property (nonatomic, weak, readwrite) id<SINCallClientDelegate> delegate;

    Swift

    weak var delegate: SINCallClientDelegate! { get set }
  • Make a call to the user with the given id.

    Throws

    NSInternalInconsistencyException if attempting to initiate a call before the SINClient is started.

    Declaration

    Objective-C

    - (id<SINCall>)callUserWithId:(NSString *)userId;

    Parameters

    userId

    The application specific id of the user to call.

    Return Value

    SINCall Outgoing call

  • Calls the user with the given id and the given headers.

    Throws

    Throws:

    • NSInternalInconsistencyException if attempting to initiate a call before the SINClient is started.
    • NSInvalidArgumentException if headers are not strictly containing only keys and values that are of type NSString, or if the size of all header strings exceeds 1024 bytes when encoded as UTF-8.

    Declaration

    Objective-C

    - (id<SINCall>)callUserWithId:(NSString *)userId
                          headers:(NSDictionary *)headers;

    Parameters

    userId

    The application specific id of the user to call.

    headers

    NSString key-value pairs to pass with the call. The total size of header keys + values (when encoded with NSUTF8StringEncoding) must not exceed 1024 bytes.

    Return Value

    SINCall Outgoing call

  • Make a video call to the user with the given id

    Throws

    NSInternalInconsistencyException if attempting to initiate a call before the SINClient is started.

    Declaration

    Objective-C

    - (id<SINCall>)callUserVideoWithId:(NSString *)userId;

    Parameters

    userId

    The application specific id of the user to call.

    Return Value

    SINCall Outgoing call

  • Make a video call to the user with the given id and the give headers

    Throws

    Throws:

    • NSInternalInconsistencyException if attempting to initiate a call before the SINClient is started.
    • NSInvalidArgumentException Throws an exception if headers are not strictly containing only keys and values that are of type NSString, or if the size of all header strings exceeds 1024 bytes when encoded as UTF-8.

    Declaration

    Objective-C

    - (id<SINCall>)callUserVideoWithId:(NSString *)userId
                               headers:(NSDictionary *)headers;

    Parameters

    userId

    The application specific id of the user to call.

    headers

    NSString key-value pairs to pass with the call. The total size of header keys + values (when encoded with NSUTF8StringEncoding) must not exceed 1024 bytes.

    Return Value

    SINCall Outgoing call

  • Calls a phone number and terminates the call to the PSTN-network (Publicly Switched Telephone Network).

    Throws

    NSInternalInconsistencyException if attempting to initiate a call before the SINClient is started.

    Declaration

    Objective-C

    - (id<SINCall>)callPhoneNumber:(NSString *)phoneNumber;

    Parameters

    phoneNumber

    The phone number to call. The phone number should be given according to E.164 number formatting (http://en.wikipedia.org/wiki/E.164) and should be prefixed with a ‘+’. E.g. to call the US phone number 415 555 0101, it should be specified as “+14155550101”, where the ‘+’ is the required prefix and the US country code ‘1’ added before the local subscriber number.

    Return Value

    SINCall Outgoing call

  • Calls a phone number and terminate the call to the PSTN-network (Publicly Switched Telephone Network).

    Throws

    Throws:

    • NSInternalInconsistencyException if attempting to initiate a call before the SINClient is started.
    • NSInvalidArgumentException if headers are not strictly containing only keys and values that are of type NSString, or if the size of all header strings exceeds 1024 bytes when encoded as UTF-8.

    Declaration

    Objective-C

    - (id<SINCall>)callPhoneNumber:(NSString *)phoneNumber
                           headers:(NSDictionary *)headers;

    Parameters

    phoneNumber

    The phone number to call. The phone number should be given according to E.164 number formatting (http://en.wikipedia.org/wiki/E.164) and should be prefixed with a ‘+’. E.g. to call the US phone number 415 555 0101, it should be specified as “+14155550101”, where the ‘+’ is the required prefix and the US country code ‘1’ added before the local subscriber number.

    headers

    NSString key-value pairs to pass with the call. The total size of header keys + values (when encoded with NSUTF8StringEncoding) must not exceed 1024 bytes.

    Return Value

    SINCall Outgoing call

  • Make a SIP call to user with the given SIP Identity.

    Throws

    NSInternalInconsistencyException if attempting to initiate a call before the SINClient is started.

    Declaration

    Objective-C

    - (id<SINCall>)callSIP:(NSString *)sipIdentity;

    Parameters

    sipIdentity

    The SIP identity string of the user to call, should be in the form of “user@domain”.

    Return Value

    SINCall Outgoing call

  • Make a SIP call to user with the given SIP Identity and adding the given headers.

    Throws

    NSInternalInconsistencyException if attempting to initiate a call before the SINClient is started.

    Declaration

    Objective-C

    - (id<SINCall>)callSIP:(NSString *)sipIdentity headers:(NSDictionary *)headers;

    Parameters

    sipIdentity

    The SIP identity string of the user to call, should be in the form of “user@domain”.

    headers

    NSString key-value pairs to pass with the call. The total size of header keys + values (when encoded with NSUTF8StringEncoding) must not exceed 1024 bytes.

    Return Value

    SINCall Outgoing call

  • Calls the conference with the given id.

    Throws

    Throws:

    • NSInternalInconsistencyException if attempting to initiate a call before the SINClient is started.
    • NSInvalidArgumentException if conferenceId is longer than the maximum allowed 64 characters.

    Declaration

    Objective-C

    - (id<SINCall>)callConferenceWithId:(NSString *)conferenceId;

    Parameters

    conferenceId

    The application specific id of the conference to call.

    Return Value

    SINCall Outgoing call

  • Calls the conference with the given id and the given headers.

    Throws

    Throws:

    • NSInternalInconsistencyException Throws an exception if attempting to initiate a call before the SINClient is started.
    • NSInvalidArgumentException Throws an exception if conferenceId is longer than the maximum allowed 64 characters.
    • NSInvalidArgumentException Throws an exception if headers are not strictly containing only keys and values that are of type NSString, or if the size of all header strings exceeds 1024 bytes when encoded as UTF-8.

    Declaration

    Objective-C

    - (id<SINCall>)callConferenceWithId:(NSString *)conferenceId
                                headers:(NSDictionary *)headers;

    Parameters

    conferenceId

    The application specific id of the conference to call.

    headers

    NSString key-value pairs to pass with the call. The total size of header keys + values (when encoded with NSUTF8StringEncoding) must not exceed 1024 bytes.

    Return Value

    SINCall Outgoing call

  • This API is introduced to support CallKit integration. Invoke this method to notify the Sinch SDK that the App has received the didActivateAudioSession callback from CXProviderDelegate. When CallKit is integrated in the App and an incoming call is received in the background, this method has to be invoked for the Sinch SDK to start the media for the call.

    Declaration

    Objective-C

    - (void)provider:(CXProvider *)provider
        didActivateAudioSession:(AVAudioSession *)audioSession;

    Swift

    func provider(_ provider: CXProvider!, didActivate audioSession: AVAudioSession!)

    Parameters

    audioSession

    The audioSession from the didActivateAudioSession callback of CXProviderDelegate.

  • This API is introduced to support CallKit integration. Invoke this method to notify the Sinch SDK that the App has received the didDeactivateAudioSession callback from CXProviderDelegate. When CallKit is integrated in the App, this method has to be invoked to pass the didDeactivateAudioSession event from CallKit to the Sinch SDK for correct audio session management.

    Declaration

    Objective-C

    - (void)provider:(CXProvider *)provider
        didDeactivateAudioSession:(AVAudioSession *)audioSession;

    Swift

    func provider(_ provider: CXProvider!, didDeactivate audioSession: AVAudioSession!)

    Parameters

    audioSession

    The audioSession from the didActivateAudioSession callback of CXProviderDelegate.