Class: Vapi::TransportConfigurationTwilio

Inherits:
Object
  • Object
show all
Defined in:
lib/vapi_server_sdk/types/transport_configuration_twilio.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(provider:, timeout: OMIT, record: OMIT, recording_channels: OMIT, additional_properties: nil) ⇒ Vapi::TransportConfigurationTwilio

Parameters:

  • provider (String)
  • timeout (Float) (defaults to: OMIT)

    The integer number of seconds that we should allow the phone to ring before assuming there is no answer. The default is ‘60` seconds and the maximum is `600` seconds. For some call flows, we will add a 5-second buffer to the timeout value you provide. For this reason, a timeout value of 10 seconds could result in an actual timeout closer to 15 seconds. You can set this to a short time, such as `15` seconds, to hang up before reaching an answering machine or voicemail. @default 60

  • record (Boolean) (defaults to: OMIT)

    Whether to record the call. Can be ‘true` to record the phone call, or `false` to not. The default is `false`. @default false

  • recording_channels (Vapi::TransportConfigurationTwilioRecordingChannels) (defaults to: OMIT)

    The number of channels in the final recording. Can be: ‘mono` or `dual`. The default is `mono`. `mono` records both legs of the call in a single channel of the recording file. `dual` records each leg to a separate channel of the recording file. The first channel of a dual-channel recording contains the parent call and the second channel contains the child call. @default ’mono’

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/vapi_server_sdk/types/transport_configuration_twilio.rb', line 69

def initialize(provider:, timeout: OMIT, record: OMIT, recording_channels: OMIT, additional_properties: nil)
  @provider = provider
  @timeout = timeout if timeout != OMIT
  @record = record if record != OMIT
  @recording_channels = recording_channels if recording_channels != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "provider": provider,
    "timeout": timeout,
    "record": record,
    "recordingChannels": recording_channels
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



37
38
39
# File 'lib/vapi_server_sdk/types/transport_configuration_twilio.rb', line 37

def additional_properties
  @additional_properties
end

#providerString (readonly)

Returns:

  • (String)


10
11
12
# File 'lib/vapi_server_sdk/types/transport_configuration_twilio.rb', line 10

def provider
  @provider
end

#recordBoolean (readonly)

Returns Whether to record the call. Can be ‘true` to record the phone call, or `false` to not. The default is `false`. @default false.

Returns:

  • (Boolean)

    Whether to record the call. Can be ‘true` to record the phone call, or `false` to not. The default is `false`. @default false



26
27
28
# File 'lib/vapi_server_sdk/types/transport_configuration_twilio.rb', line 26

def record
  @record
end

#recording_channelsVapi::TransportConfigurationTwilioRecordingChannels (readonly)

Returns The number of channels in the final recording. Can be: ‘mono` or `dual`. The default is `mono`. `mono` records both legs of the call in a single channel of the recording file. `dual` records each leg to a separate channel of the recording file. The first channel of a dual-channel recording contains the parent call and the second channel contains the child call. @default ’mono’.

Returns:

  • (Vapi::TransportConfigurationTwilioRecordingChannels)

    The number of channels in the final recording. Can be: ‘mono` or `dual`. The default is `mono`. `mono` records both legs of the call in a single channel of the recording file. `dual` records each leg to a separate channel of the recording file. The first channel of a dual-channel recording contains the parent call and the second channel contains the child call. @default ’mono’



35
36
37
# File 'lib/vapi_server_sdk/types/transport_configuration_twilio.rb', line 35

def recording_channels
  @recording_channels
end

#timeoutFloat (readonly)

Returns The integer number of seconds that we should allow the phone to ring before assuming there is no answer. The default is ‘60` seconds and the maximum is `600` seconds. For some call flows, we will add a 5-second buffer to the timeout value you provide. For this reason, a timeout value of 10 seconds could result in an actual timeout closer to 15 seconds. You can set this to a short time, such as `15` seconds, to hang up before reaching an answering machine or voicemail. @default 60.

Returns:

  • (Float)

    The integer number of seconds that we should allow the phone to ring before assuming there is no answer. The default is ‘60` seconds and the maximum is `600` seconds. For some call flows, we will add a 5-second buffer to the timeout value you provide. For this reason, a timeout value of 10 seconds could result in an actual timeout closer to 15 seconds. You can set this to a short time, such as `15` seconds, to hang up before reaching an answering machine or voicemail. @default 60



21
22
23
# File 'lib/vapi_server_sdk/types/transport_configuration_twilio.rb', line 21

def timeout
  @timeout
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::TransportConfigurationTwilio

Deserialize a JSON object to an instance of TransportConfigurationTwilio

Parameters:

  • json_object (String)

Returns:



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/vapi_server_sdk/types/transport_configuration_twilio.rb', line 89

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  provider = parsed_json["provider"]
  timeout = parsed_json["timeout"]
  record = parsed_json["record"]
  recording_channels = parsed_json["recordingChannels"]
  new(
    provider: provider,
    timeout: timeout,
    record: record,
    recording_channels: recording_channels,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given

hash and check each fields type against the current object's property
definitions.

Parameters:

  • obj (Object)

Returns:

  • (Void)


118
119
120
121
122
123
# File 'lib/vapi_server_sdk/types/transport_configuration_twilio.rb', line 118

def self.validate_raw(obj:)
  obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.")
  obj.timeout&.is_a?(Float) != false || raise("Passed value for field obj.timeout is not the expected type, validation failed.")
  obj.record&.is_a?(Boolean) != false || raise("Passed value for field obj.record is not the expected type, validation failed.")
  obj.recording_channels&.is_a?(Vapi::TransportConfigurationTwilioRecordingChannels) != false || raise("Passed value for field obj.recording_channels is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of TransportConfigurationTwilio to a JSON object

Returns:

  • (String)


108
109
110
# File 'lib/vapi_server_sdk/types/transport_configuration_twilio.rb', line 108

def to_json(*_args)
  @_field_set&.to_json
end