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 Call invites and set audio device to use in a Call using this class.
CallKit Audio Session Handling
Other Methods
logLevel
The current logging level used by the SDK.
@property (nonatomic, assign, class) TVOLogLevel logLevelDiscussion
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> audioDeviceDiscussion
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 *)sdkVersionReturn 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)moduleParameters
logLevel |
The |
|---|---|
module |
The |
See Also
Declared In
TwilioVoice.h
+ logLevelForModule:
Retrieve the log level for a specific module in the TwilioVoice SDK.
+ (TVOLogLevel)logLevelForModule:(TVOLogModule)moduleParameters
module |
The |
|---|
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 ))completionParameters
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 ))completionParameters
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>)delegateParameters
payload |
Push notification payload. |
|---|---|
delegate |
A |
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.
Twilio sends two types of notifications via Apple VoIP Service, call and cancel.
The notification type is encoded in the dictionary with the key twi_message_type and the values
twilio.voice.call and twilio.voice.cancel.
A call notification is sent when someone wants to reach the registered identity.
Passing a call notification into this method will result in a callInviteReceived: callback with a TVOCallInvite
object and return YES.
A cancel notification is sent when a call made to this identity is prematurely disconnected by the
caller, when the call is rejected, when the call is ignored, or when the call is accepted due to an
outstanding infrastructure issue.
Passing a cancel notification into this method will result in a cancelledCallInviteReceived: callback with
a TVOCancelledCallInvite object and return YES.
See Also
Declared In
TwilioVoice.h
+ connectWithAccessToken:delegate:
Make an outgoing Call.
+ (nonnull TVOCall *)connectWithAccessToken:(nonnull NSString *)accessToken delegate:(nonnull id<TVOCallDelegate>)delegateParameters
accessToken |
The access token. |
|---|---|
delegate |
A |
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.
See Also
Declared In
TwilioVoice.h
+ connectWithOptions:delegate:
Make an outgoing Call.
+ (nonnull TVOCall *)connectWithOptions:(nonnull TVOConnectOptions *)options delegate:(nonnull id<TVOCallDelegate>)delegateParameters
options |
The connect options. |
|---|---|
delegate |
A |
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.
See Also
Declared In
TwilioVoice.h