TwilioVoice Class Reference

Inherits from NSObject
Declared in TwilioVoice.h

Overview

TwilioVoice is the entry point to the Twilio Voice SDK. You can register for VoIP push notifications, make outgoing Calls, receive CallInvites and audio device assignment using this class.

CallKit Audio Session Handling

Other Methods

  logLevel

The current logging level used by the SDK.

@property (nonatomic, assign, class) TVOLogLevel logLevel

Discussion

The default logging level is TVOLogLevelError. TwilioVoice and its components use NSLog internally.

See Also

Declared In

TwilioVoice.h

  audioDevice

The TVOAudioDevice used to record and playback audio in a Call.

@property (class, nonatomic, strong, nonnull) id<TVOAudioDevice> audioDevice

Discussion

If you wish to provide your own TVOAudioDevice then you must set it before performing any other actions with the SDK like connecting to a Call. It is also possible to change the device when you are no longer connected to any Calls and have destroyed all other SDK objects.

See Also

Declared In

TwilioVoice.h

+ sdkVersion

Returns the version of the SDK.

+ (nonnull NSString *)sdkVersion

Return Value

The version of the SDK.

Declared In

TwilioVoice.h

+ setLogLevel:module:

Sets the logging level for an individual module.

+ (void)setLogLevel:(TVOLogLevel)logLevel module:(TVOLogModule)module

Parameters

logLevel

The TVOLogLevel level to be used by the module.

module

The TVOLogModule for which the logging level is to be set.

Declared In

TwilioVoice.h

+ logLevelForModule:

Retrieve the log level for a specific module in the TwilioVoice SDK.

+ (TVOLogLevel)logLevelForModule:(TVOLogModule)module

Parameters

module

The TVOLogModule for which the log level needs to be set.

Return Value

The current log level for the specified module.

Declared In

TwilioVoice.h

Managing VoIP Push Notifications

+ registerWithAccessToken:deviceToken:completion:

Registers for Twilio VoIP push notifications.

+ (void)registerWithAccessToken:(nonnull NSString *)accessToken deviceToken:(nonnull NSString *)deviceToken completion:(nullable void ( ^ ) ( NSError *__nullable error ))completion

Parameters

accessToken

Twilio Access Token.

deviceToken

The push registry token for Apple VoIP Service.

completion

Callback block to receive the result of the registration.

Discussion

Registering for push notifications is required to receive incoming Calls through Twilio’s infrastructure. Once you’ve successfully registered it’s not necessary to do so again unless your device token changes.

Declared In

TwilioVoice.h

+ unregisterWithAccessToken:deviceToken:completion:

Unregisters from Twilio VoIP push notifications.

+ (void)unregisterWithAccessToken:(nonnull NSString *)accessToken deviceToken:(nonnull NSString *)deviceToken completion:(nullable void ( ^ ) ( NSError *__nullable error ))completion

Parameters

accessToken

Twilio Access Token.

deviceToken

The push registry token for Apple VoIP Service.

completion

Callback block to receive the result of the unregistration.

Discussion

Call this method when you no longer want to receive push notifications for incoming Calls. If your device token changes you should call this method to unregister your previous invalid token.

Declared In

TwilioVoice.h

+ handleNotification:delegate:

Processes an incoming VoIP push notification payload.

+ (BOOL)handleNotification:(nonnull NSDictionary *)payload delegate:(nonnull id<TVONotificationDelegate>)delegate

Parameters

payload

Push notification payload.

delegate

A TVONotificationDelegate to receive incoming push notification callbacks.

Return Value

A BOOL value that indicates whether the payload is a valid notification sent by Twilio.

Discussion

This method will synchronously process your notification payload and call the provided delegate on the same dispatch queue.

Declared In

TwilioVoice.h

+ connectWithAccessToken:delegate:

Connect an outgoing Call.

+ (nonnull TVOCall *)connectWithAccessToken:(nonnull NSString *)accessToken delegate:(nonnull id<TVOCallDelegate>)delegate

Parameters

accessToken

The access token.

delegate

A TVOCallDelegate to receive Call state updates.

Return Value

A TVOCall object.

Discussion

This method is guaranteed to return a TVOCall object. It’s possible for the returned Call to either succeed or fail to connect.

Declared In

TwilioVoice.h

+ connectWithOptions:delegate:

Connect an outgoing Call.

+ (nonnull TVOCall *)connectWithOptions:(nonnull TVOConnectOptions *)options delegate:(nonnull id<TVOCallDelegate>)delegate

Parameters

options

The connect options.

delegate

A TVOCallDelegate to receive Call state updates.

Return Value

A TVOCall object.

Discussion

This method is guaranteed to return a TVOCall object. It’s possible for the returned Call to either succeed or fail to connect. Use the TVOConnectOptions builder to specify Call parameters and UUID

Declared In

TwilioVoice.h