TVOCallMessage Class Reference
| Inherits from | NSObject |
|---|---|
| Declared in | TVOCallMessage.h |
Overview
Message builder to use when using the [TVOCall sendMessage:] method. Example:
let messageContent = "{\"foo\": \"bar\"}"
let callMessage = CallMessage(content: messageContent, messageType: "user-defined-message")
let voiceEventSid = call.sendMessage(callMessage)
messageType
The type for the message. The SDK does not validate the value and treats it as a pass-through for both
inbound and outbound call messages. To send a user defined message with the [TVOCall sendMessage:] method,
set the messageType to user-defined-message.
@property (nonatomic, readonly, copy, nonnull) NSString *messageTypeDeclared In
TVOCallMessage.h
contentType
The MIME type for the message.
@property (nonatomic, copy, readonly, nullable) NSString *contentTypeDiscussion
Currently the only supported type is “application/json”, which is also the default value.
Declared In
TVOCallMessage.h
content
The content body of the message.
@property (nonatomic, copy, readonly, nonnull) NSString *contentDiscussion
The format of the message body must match the content type. The size limit of the message content
is 10 KB. [TVOCall sendMessage:] with message content that exceeds the size limitation will result in the
[TVOCallMessageDelegate call:didFailToSendMessage:error] callback.
A call message with content that does not match the content type will not result in the [TVOCallMessageDelegate call:didFailToSendMessage:error]
callback but will generate an error in your Twilio developer console. For example, a call message with content type “application/json” but
with the content “Hello World”, which is not a valid JSON object, will result in such error.
Declared In
TVOCallMessage.h
voiceEventSid
The unique identifier of the message.
@property (nonatomic, copy, readonly, nonnull) NSString *voiceEventSidDeclared In
TVOCallMessage.h
– init
Developers shouldn’t initialize this class directly.
- (null_unspecified instancetype)initDiscussion
Use the TVOCallMessage builder method instead.
Declared In
TVOCallMessage.h
+ messageWithContent:
Creates TVOCallMessage with the message content.
+ (nonnull instancetype)messageWithContent:(nonnull NSString *)contentParameters
content |
The message content. |
|---|
Return Value
An instance of TVOCallMessage.
Discussion
Default value application/json will be used as contentType.
Declared In
TVOCallMessage.h
+ messageWithContent:messageType:block:
Creates TVOCallMessage with the message content and message type.
+ (nonnull instancetype)messageWithContent:(nonnull NSString *)content messageType:(nonnull NSString *)messageType block:(nullable TVOCallMessageBuilderBlock)builderBlockParameters
content |
The message content. |
|---|---|
messageType |
The message type. |
builderBlock |
The |
Return Value
An instance of TVOCallMessage.
Discussion
The SDK does not validate the value and treats it as a pass-through for both inbound and outbound call messages.
To send a user defined message with the [TVOCall sendMessage:] method, set the messageType to user-defined-message.
Default value application/json will be used as contentType if not explicitly specified in the builderBlock.
Declared In
TVOCallMessage.h