SINCallClient Protocol Reference

Conforms to NSObject
Declared in SINCallClient.h

Overview

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

Example

id<SINClient> sinchClient;
[sinchClient setSupportCalling:YES];
[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];

  delegate required method

The object that acts as the delegate of the call client.

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

Discussion

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

Declared In

SINCallClient.h

– callUserWithId: required method

Make a call to the user with the given id.

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

Parameters

userId

The application specific id of the user to call.

Return Value

SINCall Outgoing call

Exceptions

NSInternalInconsistencyException

Throws an exception if attempting to initiate a call before the SINClient is started.

Declared In

SINCallClient.h

– callUserWithId:headers: required method

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

- (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

Exceptions

NSInternalInconsistencyException

Throws an exception 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.

Declared In

SINCallClient.h

– callUserVideoWithId: required method

Make a video call to the user with the given id

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

Parameters

userId

The application specific id of the user to call.

Return Value

SINCall Outgoing call

Exceptions

NSInternalInconsistencyException

Throws an exception if attempting to initiate a call before the SINClient is started.

Declared In

SINCallClient.h

– callUserVideoWithId:headers: required method

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

- (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

Exceptions

NSInternalInconsistencyException

Throws an exception 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.

Declared In

SINCallClient.h

– callPhoneNumber: required method

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

- (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

Exceptions

NSInternalInconsistencyException

Throws an exception if attempting to initiate a call before the SINClient is started.

Declared In

SINCallClient.h

– callPhoneNumber:headers: required method

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

- (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

Exceptions

NSInternalInconsistencyException

Throws an exception 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.

Declared In

SINCallClient.h

– callSIP: required method

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

- (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

Exceptions

NSInternalInconsistencyException

Throws an exception if attempting to initiate a call before the SINClient is started.

Declared In

SINCallClient.h

– callSIP:headers: required method

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

- (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

Exceptions

NSInternalInconsistencyException

Throws an exception if attempting to initiate a call before the SINClient is started.

Declared In

SINCallClient.h

– callConferenceWithId: required method

Calls the conference with the given id.

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

Parameters

conferenceId

The application specific id of the conference to call.

Return Value

SINCall Outgoing call

Exceptions

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.

Declared In

SINCallClient.h

– callConferenceWithId:headers: required method

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

- (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

Exceptions

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.

Declared In

SINCallClient.h

– provider:didActivateAudioSession: required method

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.

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

Parameters

audioSession

The audioSession from the didActivateAudioSession callback of CXProviderDelegate.

Declared In

SINCallClient.h

– provider:didDeactivateAudioSession: required method

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.

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

Parameters

audioSession

The audioSession from the didActivateAudioSession callback of CXProviderDelegate.

Declared In

SINCallClient.h