Skip to content

Commit 61bcd38

Browse files
feat: add conversation type and dial timeout to Twilio SMS transport
Enhance the Twilio SMS chat transport with new configuration options for better call handling. Add conversation type specification and dial timeout control for SIP transfers. Key changes: - Add conversation_type field to TwilioSmsChatTransport with new enum type - Add dial_timeout parameter to TransferPlan for SIP DIAL operations - Remove X-Fern-SDK-Version header from request headers - Add new type export for TwilioSmsChatTransportConversationType - Update documentation and validation for new fields 🌿 Generated with Fern
1 parent 62cc975 commit 61bcd38

File tree

8 files changed

+61
-6
lines changed

8 files changed

+61
-6
lines changed

changelog.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## 0.11.0 - 2025-11-19
2+
* feat: add conversation type and dial timeout to Twilio SMS transport
3+
* Enhance the Twilio SMS chat transport with new configuration options for better call handling. Add conversation type specification and dial timeout control for SIP transfers.
4+
* Key changes:
5+
* Add conversation_type field to TwilioSmsChatTransport with new enum type
6+
* Add dial_timeout parameter to TransferPlan for SIP DIAL operations
7+
* Remove X-Fern-SDK-Version header from request headers
8+
* Add new type export for TwilioSmsChatTransportConversationType
9+
* Update documentation and validation for new fields
10+
* 🌿 Generated with Fern
11+

lib/requests.rb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ def get_url(request_options: nil)
4545

4646
# @return [Hash{String => String}]
4747
def get_headers
48-
headers = { "X-Fern-Language": "Ruby", "X-Fern-SDK-Name": "vapi_server_sdk", "X-Fern-SDK-Version": "0.10.0" }
48+
headers = {
49+
"X-Fern-Language": "Ruby",
50+
"X-Fern-SDK-Name": "vapi_server_sdk",
51+
"X-Fern-SDK-Version": "0.11.0"
52+
}
4953
headers["Authorization"] = ((@token.is_a? Method) ? @token.call : @token) unless @token.nil?
5054
headers
5155
end
@@ -90,7 +94,11 @@ def get_url(request_options: nil)
9094

9195
# @return [Hash{String => String}]
9296
def get_headers
93-
headers = { "X-Fern-Language": "Ruby", "X-Fern-SDK-Name": "vapi_server_sdk", "X-Fern-SDK-Version": "0.10.0" }
97+
headers = {
98+
"X-Fern-Language": "Ruby",
99+
"X-Fern-SDK-Name": "vapi_server_sdk",
100+
"X-Fern-SDK-Version": "0.11.0"
101+
}
94102
headers["Authorization"] = ((@token.is_a? Method) ? @token.call : @token) unless @token.nil?
95103
headers
96104
end

lib/types_export.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,7 @@
790790
require_relative "vapi_server_sdk/types/chat_messages_item"
791791
require_relative "vapi_server_sdk/types/chat_output_item"
792792
require_relative "vapi_server_sdk/types/chat_costs_item"
793+
require_relative "vapi_server_sdk/types/twilio_sms_chat_transport_conversation_type"
793794
require_relative "vapi_server_sdk/types/twilio_sms_chat_transport_type"
794795
require_relative "vapi_server_sdk/types/twilio_sms_chat_transport"
795796
require_relative "vapi_server_sdk/types/get_chat_paginated_dto_sort_order"

lib/vapi_server_sdk/chats/client.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,7 @@ def list(assistant_id: nil, squad_id: nil, session_id: nil, previous_chat_id: ni
507507
# If sessionId is provided without transport fields, uses existing session data.
508508
# Cannot specify both sessionId and transport fields (phoneNumberId/customer)
509509
# together.Request of type Vapi::TwilioSmsChatTransport, as a Hash
510+
# * :conversation_type (Vapi::TwilioSmsChatTransportConversationType)
510511
# * :phone_number_id (String)
511512
# * :customer (Hash)
512513
# * :number_e_164_check_enabled (Boolean)
@@ -1140,6 +1141,7 @@ def delete(id:, request_options: nil)
11401141
# If sessionId is provided without transport fields, uses existing session data.
11411142
# Cannot specify both sessionId and transport fields (phoneNumberId/customer)
11421143
# together.Request of type Vapi::TwilioSmsChatTransport, as a Hash
1144+
# * :conversation_type (Vapi::TwilioSmsChatTransportConversationType)
11431145
# * :phone_number_id (String)
11441146
# * :customer (Hash)
11451147
# * :number_e_164_check_enabled (Boolean)
@@ -1808,6 +1810,7 @@ def list(assistant_id: nil, squad_id: nil, session_id: nil, previous_chat_id: ni
18081810
# If sessionId is provided without transport fields, uses existing session data.
18091811
# Cannot specify both sessionId and transport fields (phoneNumberId/customer)
18101812
# together.Request of type Vapi::TwilioSmsChatTransport, as a Hash
1813+
# * :conversation_type (Vapi::TwilioSmsChatTransportConversationType)
18111814
# * :phone_number_id (String)
18121815
# * :customer (Hash)
18131816
# * :number_e_164_check_enabled (Boolean)
@@ -2447,6 +2450,7 @@ def delete(id:, request_options: nil)
24472450
# If sessionId is provided without transport fields, uses existing session data.
24482451
# Cannot specify both sessionId and transport fields (phoneNumberId/customer)
24492452
# together.Request of type Vapi::TwilioSmsChatTransport, as a Hash
2453+
# * :conversation_type (Vapi::TwilioSmsChatTransportConversationType)
24502454
# * :phone_number_id (String)
24512455
# * :customer (Hash)
24522456
# * :number_e_164_check_enabled (Boolean)

lib/vapi_server_sdk/types/transfer_plan.rb

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ class TransferPlan
5656
# - 'bye': Ends current call with SIP BYE
5757
# - 'dial': Uses SIP DIAL to transfer the call
5858
attr_reader :sip_verb
59+
# @return [Float] This sets the timeout for the dial operation in seconds. This is the duration
60+
# the call will ring before timing out.
61+
# Only applicable when `sipVerb='dial'`. Not applicable for SIP REFER or BYE.
62+
# @default 60
63+
attr_reader :dial_timeout
5964
# @return [String] This is the URL to an audio file played while the customer is on hold during
6065
# transfer.
6166
# Usage:
@@ -169,6 +174,10 @@ class TransferPlan
169174
# - 'refer': Uses SIP REFER to transfer the call (default)
170175
# - 'bye': Ends current call with SIP BYE
171176
# - 'dial': Uses SIP DIAL to transfer the call
177+
# @param dial_timeout [Float] This sets the timeout for the dial operation in seconds. This is the duration
178+
# the call will ring before timing out.
179+
# Only applicable when `sipVerb='dial'`. Not applicable for SIP REFER or BYE.
180+
# @default 60
172181
# @param hold_audio_url [String] This is the URL to an audio file played while the customer is on hold during
173182
# transfer.
174183
# Usage:
@@ -227,12 +236,13 @@ class TransferPlan
227236
# will be used.
228237
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
229238
# @return [Vapi::TransferPlan]
230-
def initialize(mode:, message: OMIT, timeout: OMIT, sip_verb: OMIT, hold_audio_url: OMIT,
239+
def initialize(mode:, message: OMIT, timeout: OMIT, sip_verb: OMIT, dial_timeout: OMIT, hold_audio_url: OMIT,
231240
transfer_complete_audio_url: OMIT, context_engineering_plan: OMIT, twiml: OMIT, summary_plan: OMIT, sip_headers_in_refer_to_enabled: OMIT, fallback_plan: OMIT, additional_properties: nil)
232241
@mode = mode
233242
@message = message if message != OMIT
234243
@timeout = timeout if timeout != OMIT
235244
@sip_verb = sip_verb if sip_verb != OMIT
245+
@dial_timeout = dial_timeout if dial_timeout != OMIT
236246
@hold_audio_url = hold_audio_url if hold_audio_url != OMIT
237247
@transfer_complete_audio_url = transfer_complete_audio_url if transfer_complete_audio_url != OMIT
238248
@context_engineering_plan = context_engineering_plan if context_engineering_plan != OMIT
@@ -246,6 +256,7 @@ def initialize(mode:, message: OMIT, timeout: OMIT, sip_verb: OMIT, hold_audio_u
246256
"message": message,
247257
"timeout": timeout,
248258
"sipVerb": sip_verb,
259+
"dialTimeout": dial_timeout,
249260
"holdAudioUrl": hold_audio_url,
250261
"transferCompleteAudioUrl": transfer_complete_audio_url,
251262
"contextEngineeringPlan": context_engineering_plan,
@@ -274,6 +285,7 @@ def self.from_json(json_object:)
274285
end
275286
timeout = parsed_json["timeout"]
276287
sip_verb = parsed_json["sipVerb"]
288+
dial_timeout = parsed_json["dialTimeout"]
277289
hold_audio_url = parsed_json["holdAudioUrl"]
278290
transfer_complete_audio_url = parsed_json["transferCompleteAudioUrl"]
279291
if parsed_json["contextEngineeringPlan"].nil?
@@ -301,6 +313,7 @@ def self.from_json(json_object:)
301313
message: message,
302314
timeout: timeout,
303315
sip_verb: sip_verb,
316+
dial_timeout: dial_timeout,
304317
hold_audio_url: hold_audio_url,
305318
transfer_complete_audio_url: transfer_complete_audio_url,
306319
context_engineering_plan: context_engineering_plan,
@@ -330,6 +343,7 @@ def self.validate_raw(obj:)
330343
obj.message.nil? || Vapi::TransferPlanMessage.validate_raw(obj: obj.message)
331344
obj.timeout&.is_a?(Float) != false || raise("Passed value for field obj.timeout is not the expected type, validation failed.")
332345
obj.sip_verb&.is_a?(Hash) != false || raise("Passed value for field obj.sip_verb is not the expected type, validation failed.")
346+
obj.dial_timeout&.is_a?(Float) != false || raise("Passed value for field obj.dial_timeout is not the expected type, validation failed.")
333347
obj.hold_audio_url&.is_a?(String) != false || raise("Passed value for field obj.hold_audio_url is not the expected type, validation failed.")
334348
obj.transfer_complete_audio_url&.is_a?(String) != false || raise("Passed value for field obj.transfer_complete_audio_url is not the expected type, validation failed.")
335349
obj.context_engineering_plan.nil? || Vapi::TransferPlanContextEngineeringPlan.validate_raw(obj: obj.context_engineering_plan)

lib/vapi_server_sdk/types/twilio_sms_chat_transport.rb

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
# frozen_string_literal: true
22

3+
require_relative "twilio_sms_chat_transport_conversation_type"
34
require_relative "create_customer_dto"
45
require_relative "twilio_sms_chat_transport_type"
56
require "ostruct"
67
require "json"
78

89
module Vapi
910
class TwilioSmsChatTransport
11+
# @return [Vapi::TwilioSmsChatTransportConversationType] This is the conversation type of the call (ie, voice or chat).
12+
attr_reader :conversation_type
1013
# @return [String] This is the phone number that will be used to send the SMS.
1114
# If provided, will create a new session. If not provided, uses existing session's
1215
# phoneNumberId.
@@ -33,6 +36,7 @@ class TwilioSmsChatTransport
3336

3437
OMIT = Object.new
3538

39+
# @param conversation_type [Vapi::TwilioSmsChatTransportConversationType] This is the conversation type of the call (ie, voice or chat).
3640
# @param phone_number_id [String] This is the phone number that will be used to send the SMS.
3741
# If provided, will create a new session. If not provided, uses existing session's
3842
# phoneNumberId.
@@ -49,8 +53,9 @@ class TwilioSmsChatTransport
4953
# Currently supports 'twilio.sms' for SMS delivery via Twilio.
5054
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
5155
# @return [Vapi::TwilioSmsChatTransport]
52-
def initialize(type:, phone_number_id: OMIT, customer: OMIT, use_llm_generated_message_for_outbound: OMIT,
53-
additional_properties: nil)
56+
def initialize(type:, conversation_type: OMIT, phone_number_id: OMIT, customer: OMIT,
57+
use_llm_generated_message_for_outbound: OMIT, additional_properties: nil)
58+
@conversation_type = conversation_type if conversation_type != OMIT
5459
@phone_number_id = phone_number_id if phone_number_id != OMIT
5560
@customer = customer if customer != OMIT
5661
if use_llm_generated_message_for_outbound != OMIT
@@ -59,6 +64,7 @@ def initialize(type:, phone_number_id: OMIT, customer: OMIT, use_llm_generated_m
5964
@type = type
6065
@additional_properties = additional_properties
6166
@_field_set = {
67+
"conversationType": conversation_type,
6268
"phoneNumberId": phone_number_id,
6369
"customer": customer,
6470
"useLLMGeneratedMessageForOutbound": use_llm_generated_message_for_outbound,
@@ -75,6 +81,7 @@ def initialize(type:, phone_number_id: OMIT, customer: OMIT, use_llm_generated_m
7581
def self.from_json(json_object:)
7682
struct = JSON.parse(json_object, object_class: OpenStruct)
7783
parsed_json = JSON.parse(json_object)
84+
conversation_type = parsed_json["conversationType"]
7885
phone_number_id = parsed_json["phoneNumberId"]
7986
if parsed_json["customer"].nil?
8087
customer = nil
@@ -85,6 +92,7 @@ def self.from_json(json_object:)
8592
use_llm_generated_message_for_outbound = parsed_json["useLLMGeneratedMessageForOutbound"]
8693
type = parsed_json["type"]
8794
new(
95+
conversation_type: conversation_type,
8896
phone_number_id: phone_number_id,
8997
customer: customer,
9098
use_llm_generated_message_for_outbound: use_llm_generated_message_for_outbound,
@@ -107,6 +115,7 @@ def to_json(*_args)
107115
# @param obj [Object]
108116
# @return [Void]
109117
def self.validate_raw(obj:)
118+
obj.conversation_type&.is_a?(Vapi::TwilioSmsChatTransportConversationType) != false || raise("Passed value for field obj.conversation_type is not the expected type, validation failed.")
110119
obj.phone_number_id&.is_a?(String) != false || raise("Passed value for field obj.phone_number_id is not the expected type, validation failed.")
111120
obj.customer.nil? || Vapi::CreateCustomerDto.validate_raw(obj: obj.customer)
112121
obj.use_llm_generated_message_for_outbound&.is_a?(Boolean) != false || raise("Passed value for field obj.use_llm_generated_message_for_outbound is not the expected type, validation failed.")
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# frozen_string_literal: true
2+
3+
module Vapi
4+
# This is the conversation type of the call (ie, voice or chat).
5+
class TwilioSmsChatTransportConversationType
6+
CHAT = "chat"
7+
end
8+
end

vapi_server_sdk.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ require_relative "lib/gemconfig"
44

55
Gem::Specification.new do |spec|
66
spec.name = "vapi_server_sdk"
7-
spec.version = "0.10.0"
7+
spec.version = "0.11.0"
88
spec.authors = Vapi::Gemconfig::AUTHORS
99
spec.email = Vapi::Gemconfig::EMAIL
1010
spec.summary = Vapi::Gemconfig::SUMMARY

0 commit comments

Comments
 (0)