TVOCallInvite Class Reference
Inherits from | NSObject |
---|---|
Declared in | TVOCallInvite.h |
Overview
The TVOCallInvite
object represents an incoming Call Invite. TVOCallInvite
s are not created directly;
they are returned by the [TVONotificationDelegate callInviteReceived:]
delegate method.
Properties
from
From
value of the Call Invite.
@property (nonatomic, copy, readonly, nullable) NSString *from
Discussion
This may be nil
if the notification passed in [TwilioVoice handleNotification:delegate:delegateQueue:]
method does not have valid information in it.
Declared In
TVOCallInvite.h
to
To
value of the Call Invite.
@property (nonatomic, copy, readonly, nonnull) NSString *to
Declared In
TVOCallInvite.h
callSid
A server assigned identifier (SID) for the incoming Call.
@property (nonatomic, copy, readonly, nonnull) NSString *callSid
Discussion
Accepting a TVOCallInvite
yields a TVOCall
which inherits this SID.
See Also
TVOCall.sid
Declared In
TVOCallInvite.h
customParameters
Custom parameters embedded in the VoIP notification payload.
@property (nonatomic, strong, readonly, nullable) NSDictionary<NSString*NSString*> *customParameters
Discussion
The custom parameters will be received in the notification payload with the
twi_params
key and in query-string format, e.g. key1=value1&key2=value2
. To receive custom
parameters on the mobile client, add <Parameter>
tags into the <Client>
tag in the TwiML response.
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial callerId="client:alice">
<Client>
<Identity>bob</Identity>
<Parameter name="caller_first_name" value="alice" />
<Parameter name="caller_last_name" value="smith" />
</Client>
</Dial>
</Response>
The customParameters
value would be:
{
"caller_first_name" = "alice";
"caller_last_name" = "smith";
}
Note: While the value field passed into <Parameter>
gets URI encoded by the Twilio infrastructure
and URI decoded when parsed during the creation of a TVOCallInvite
, the name does not get URI encoded
or decoded. As a result, it is recommended that the name field only use ASCII characters.
Declared In
TVOCallInvite.h
callerInfo
The TVOCallerInfo
that represents SHAKEN/STIR status information about the caller.
@property (nonatomic, strong, readonly, nonnull) TVOCallerInfo *callerInfo
See Also
Declared In
TVOCallInvite.h
Call Invite Actions
– acceptWithDelegate:
Accepts the incoming Call Invite.
- (nonnull TVOCall *)acceptWithDelegate:(nonnull id<TVOCallDelegate>)delegate
Parameters
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.
The TVOCallDelegate
will receive the Call state update callbacks. The callbacks are listed here.
Callback Name | Description | Since version |
call:didFailToConnectWithError | The call failed to connect. An NSError object provides details of the root cause. | 3.0.0-preview1 |
callDidStartRinging: | This callback should not be invoked when calling [TVOCallInvite acceptWithDelegate:] . | 3.0.0-preview2 |
callDidConnect: | The Call has connected. | 3.0.0-preview1 |
call:didDisconnectWithError | The Call was disconnected. If the Call ends due to an error the NSError is non-null. If the call ends normally NSError is nil. | 3.0.0-preview1 |
If accept fails, call:didFailToConnectWithError:
or call:didDisconnectWithError:
callback is raised with an NSError
object. [error localizedDescription]
,
[error localizedFailureReason]
and [error code]
provide details of the failure.
If [TVOCallInvite acceptWithDelegate:]
fails due to an authentication error, the SDK receives the following error.
Authentication Errors | Error Code | Description |
TVOErrorAuthFailureCodeError | 20151 | Twilio failed to authenticate the client |
If any connection fails because of any other error then the SDK will receive one of the following errors.
Connection Errors | Error Code | Description |
TVOErrorConnectionError | 31005 | Connection error |
TVOErrorCallCancelledError | 31008 | Call Cancelled |
TVOErrorTransportError | 31009 | Transport error |
TVOErrorAuthorizationError | 31201 | Authorization error |
TVOErrorForbiddenError | 31403 | Forbidden |
TVOErrorRequestTimeoutError | 31408 | Request Timeout |
TVOErrorCallDoesNotExistError | 31481 | Call/Transaction Does Not Exist |
TVOErrorRequestTerminatedError | 31487 | Request Terminated |
TVOErrorInternalServerError | 31500 | Internal Server Error |
TVOErrorBadGatewayError | 31502 | Bad Gateway |
TVOErrorServiceUnavailableError | 31503 | Service Unavailable |
TVOErrorGatewayTimeoutError | 31504 | Gateway Timeout |
TVOErrorDNSResolutionError | 31530 | DNS Resolution Error |
TVOErrorDoesNotExistAnywhereError | 31604 | Does Not Exist Anywhere |
TVOErrorSignalingConnectionDisconnectedError | 53001 | Signaling connection disconnected |
TVOErrorMediaClientLocalDescFailedError | 53400 | Client is unable to create or apply a local media description |
TVOErrorMediaServerLocalDescFailedError | 53401 | Server is unable to create or apply a local media description |
TVOErrorMediaClientRemoteDescFailedError | 53402 | Client is unable to apply a remote media description |
TVOErrorMediaServerRemoteDescFailedError | 53403 | Server is unable to apply a remote media description |
TVOErrorMediaNoSupportedCodecError | 53404 | No supported codec |
TVOErrorMediaConnectionError | 53405 | Media connection failed |
Insights
Group Name | Event Name | Description | Since version |
connection | accepted-by-local | Call invite accepted | 3.0.0-beta2 |
settings | codec | negotiated selected codec is received and remote SDP is set | 5.1.1 |
If connection fails then an error event will be published.
Group Name | Event Name | Description | Since version |
connection | error | error description | 3.0.0-beta2 |
An example of using the acceptWithDelegate: API
@interface CallViewController () <TVOCallDelegate, TVONotificationDelegate, ... >
// property declarations
@end
@implementation CallViewController
// ViewController setup and other code ...
- (void)callInviteReceived:(TVOCallInvite *)callInvite {
self.call = [callInvite acceptWithDelegate:self];
}
#pragma mark - TVOCallDelegate
- (void)call:(TVOCall *)call didFailToConnectWithError:(NSError *)error {
NSLog("Failed to Connect the Call: %@\n\t - reason: %@", [error localizedDescription], [error localizedFailureReason]);
}
- (void)call:(TVOCall *)call didDisconnectWithError:(NSError *)error {
if (error) {
NSLog(@"Call disconnected with error: %@", error);
} else {
NSLog(@"Call disconnected");
}
}
- (void)callDidConnect:(TVOCall *)call {
NSLog(@"Call connected.");
}
@end
See Also
Declared In
TVOCallInvite.h
– acceptWithOptions:delegate:
Accepts the incoming Call Invite.
- (nonnull TVOCall *)acceptWithOptions:(nonnull TVOAcceptOptions *)options delegate:(nonnull id<TVOCallDelegate>)delegate
Parameters
options |
An accept 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.
The TVOCallDelegate
will receive the Call state update callbacks. The callbacks are same as acceptWithDelegate:
API.
If accept fails, call:didFailToConnectWithError:
or call:didDisconnectWithError:
callback is raised with an NSError
object. [error localizedDescription]
, [error localizedFailureReason]
and [error code]
provide details of the failure. The error codes are same as acceptWithDelegate:
API.
Insights
Group Name | Event Name | Description | Since version |
connection | accepted-by-local | Call invite accepted | 3.0.0-beta2 |
If connection fails then an error event will be published.
Group Name | Event Name | Description | Since version |
connection | error | error description | 3.0.0-beta2 |
An example of using the acceptWithOptions:delegate: API
@interface CallViewController () <TVOCallDelegate, TVONotificationDelegate, ... >
// property declarations
@end
@implementation CallViewController
// ViewController setup and other code ...
- (void)callInviteReceived:(TVOCallInvite *)callInvite {
TVOAcceptOptions *options = [TVOAcceptOptions optionsWithCallInvite:callInvite
block:^(TVOAcceptOptionsBuilder *builder) {
builder.uuid = callInvite.uuid;
}];
self.call = [callInvite acceptWithOptions:options delegate:self];
}
#pragma mark - TVOCallDelegate
- (void)call:(TVOCall *)call didFailToConnectWithError:(NSError *)error {
NSLog("Failed to Connect the Call: %@\n\t - reason: %@", [error localizedDescription], [error localizedFailureReason]);
}
- (void)call:(TVOCall *)call didDisconnectWithError:(NSError *)error {
if (error) {
NSLog(@"Call disconnected with error: %@", error);
} else {
NSLog(@"Call disconnected");
}
}
- (void)callDidConnect:(TVOCall *)call {
NSLog(@"Call connected.");
}
@end
See Also
Declared In
TVOCallInvite.h
– reject
Rejects the incoming Call Invite.
Insights
Group Name | Event Name | Description | Since version |
connection | rejected-by-local | Call invite rejected | 3.0.0-preview5 |
connection | error | The event will be sent with code 31600 and message “Busy Everywhere : SIP/2.0 600 Call Rejected” | 3.1.0 |
- (void)reject
Declared In
TVOCallInvite.h
– init
Call Invites cannot be instantiated directly. See TVONotificationDelegate
instead.
- (null_unspecified instancetype)init
See Also
Declared In
TVOCallInvite.h