Class: Vapi::TransferDestinationNumber
- Inherits:
-
Object
- Object
- Vapi::TransferDestinationNumber
- Defined in:
- lib/vapi_server_sdk/types/transfer_destination_number.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#caller_id ⇒ String
readonly
This is the caller ID to use when transferring the call to the ‘number`.
-
#description ⇒ String
readonly
This is the description of the destination, used by the AI to choose when and how to transfer the call.
-
#extension ⇒ String
readonly
This is the extension to dial after transferring the call to the ‘number`.
-
#message ⇒ Vapi::TransferDestinationNumberMessage
readonly
This is spoken to the customer before connecting them to the destination.
-
#number ⇒ String
readonly
This is the phone number to transfer the call to.
-
#number_e_164_check_enabled ⇒ Boolean
readonly
This is the flag to toggle the E164 check for the ‘number` field.
-
#transfer_plan ⇒ Vapi::TransferPlan
readonly
This configures how transfer is executed and the experience of the destination party receiving the call.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::TransferDestinationNumber
Deserialize a JSON object to an instance of TransferDestinationNumber.
-
.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.
Instance Method Summary collapse
- #initialize(number:, message: OMIT, number_e_164_check_enabled: OMIT, extension: OMIT, caller_id: OMIT, transfer_plan: OMIT, description: OMIT, additional_properties: nil) ⇒ Vapi::TransferDestinationNumber constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of TransferDestinationNumber to a JSON object.
Constructor Details
#initialize(number:, message: OMIT, number_e_164_check_enabled: OMIT, extension: OMIT, caller_id: OMIT, transfer_plan: OMIT, description: OMIT, additional_properties: nil) ⇒ Vapi::TransferDestinationNumber
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/vapi_server_sdk/types/transfer_destination_number.rb', line 113 def initialize(number:, message: OMIT, number_e_164_check_enabled: OMIT, extension: OMIT, caller_id: OMIT, transfer_plan: OMIT, description: OMIT, additional_properties: nil) = if != OMIT @number_e_164_check_enabled = number_e_164_check_enabled if number_e_164_check_enabled != OMIT @number = number @extension = extension if extension != OMIT @caller_id = caller_id if caller_id != OMIT @transfer_plan = transfer_plan if transfer_plan != OMIT @description = description if description != OMIT @additional_properties = additional_properties @_field_set = { "message": , "numberE164CheckEnabled": number_e_164_check_enabled, "number": number, "extension": extension, "callerId": caller_id, "transferPlan": transfer_plan, "description": description }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
61 62 63 |
# File 'lib/vapi_server_sdk/types/transfer_destination_number.rb', line 61 def additional_properties @additional_properties end |
#caller_id ⇒ String (readonly)
Returns This is the caller ID to use when transferring the call to the ‘number`. Usage:
-
If not provided, the caller ID will be the number the call is coming from.
Example, 14151111111 calls in to and the assistant transfers out to 16470000000. 16470000000 will see 14151111111 as the caller.
-
To change this behavior, provide a ‘callerId`.
-
Set to ‘Vapi::TransferDestinationNumber.{customer{customer.number}’ to always use the customer’s number as the caller
ID.
-
Set to ‘Vapi::TransferDestinationNumber.{phoneNumber{phoneNumber.number}’ to always use the phone number of the
assistant as the caller ID.
-
Set to any E164 number to always use that number as the caller ID. This needs
to be a number that is owned or verified by your Transport provider like Twilio. For Twilio, you can read up more here: www.twilio.com/docs/voice/twiml/dial#callerid.
52 53 54 |
# File 'lib/vapi_server_sdk/types/transfer_destination_number.rb', line 52 def caller_id @caller_id end |
#description ⇒ String (readonly)
Returns This is the description of the destination, used by the AI to choose when and how to transfer the call.
59 60 61 |
# File 'lib/vapi_server_sdk/types/transfer_destination_number.rb', line 59 def description @description end |
#extension ⇒ String (readonly)
Returns This is the extension to dial after transferring the call to the ‘number`.
37 38 39 |
# File 'lib/vapi_server_sdk/types/transfer_destination_number.rb', line 37 def extension @extension end |
#message ⇒ Vapi::TransferDestinationNumberMessage (readonly)
Returns This is spoken to the customer before connecting them to the destination. Usage:
-
If this is not provided and transfer tool messages is not provided, default is
“Transferring the call now”.
-
If set to “”, nothing is spoken. This is useful when you want to silently
transfer. This is especially useful when transferring between assistants in a squad. In this scenario, you likely also want to set ‘assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message` for the destination assistant. This accepts a string or a ToolMessageStart class. Latter is useful if you want to specify multiple messages for different languages through the `contents` field.
22 23 24 |
# File 'lib/vapi_server_sdk/types/transfer_destination_number.rb', line 22 def end |
#number ⇒ String (readonly)
Returns This is the phone number to transfer the call to.
35 36 37 |
# File 'lib/vapi_server_sdk/types/transfer_destination_number.rb', line 35 def number @number end |
#number_e_164_check_enabled ⇒ Boolean (readonly)
Returns This is the flag to toggle the E164 check for the ‘number` field. This is an advanced property which should be used if you know your use case requires it. Use cases:
-
‘false`: To allow non-E164 numbers like `+001234567890`, `1234`, or `abc`.
This is useful for dialing out to non-E164 numbers on your SIP trunks.
-
‘true` (default): To allow only E164 numbers like `+14155551234`. This is
standard for PSTN calls. If ‘false`, the `number` is still required to only contain alphanumeric characters (regex: `/^+?[a-zA-Z0-9]+$/`). @default true (E164 check is enabled).
33 34 35 |
# File 'lib/vapi_server_sdk/types/transfer_destination_number.rb', line 33 def number_e_164_check_enabled @number_e_164_check_enabled end |
#transfer_plan ⇒ Vapi::TransferPlan (readonly)
Returns This configures how transfer is executed and the experience of the destination party receiving the call. Defaults to ‘blind-transfer`. @default `transferPlan.mode=’blind-transfer’‘.
56 57 58 |
# File 'lib/vapi_server_sdk/types/transfer_destination_number.rb', line 56 def transfer_plan @transfer_plan end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::TransferDestinationNumber
Deserialize a JSON object to an instance of TransferDestinationNumber
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/vapi_server_sdk/types/transfer_destination_number.rb', line 140 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) if parsed_json["message"].nil? = nil else = parsed_json["message"].to_json = Vapi::TransferDestinationNumberMessage.from_json(json_object: ) end number_e_164_check_enabled = parsed_json["numberE164CheckEnabled"] number = parsed_json["number"] extension = parsed_json["extension"] caller_id = parsed_json["callerId"] if parsed_json["transferPlan"].nil? transfer_plan = nil else transfer_plan = parsed_json["transferPlan"].to_json transfer_plan = Vapi::TransferPlan.from_json(json_object: transfer_plan) end description = parsed_json["description"] new( message: , number_e_164_check_enabled: number_e_164_check_enabled, number: number, extension: extension, caller_id: caller_id, transfer_plan: transfer_plan, description: description, 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.
185 186 187 188 189 190 191 192 193 |
# File 'lib/vapi_server_sdk/types/transfer_destination_number.rb', line 185 def self.validate_raw(obj:) obj..nil? || Vapi::TransferDestinationNumberMessage.validate_raw(obj: obj.) obj.number_e_164_check_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.number_e_164_check_enabled is not the expected type, validation failed.") obj.number.is_a?(String) != false || raise("Passed value for field obj.number is not the expected type, validation failed.") obj.extension&.is_a?(String) != false || raise("Passed value for field obj.extension is not the expected type, validation failed.") obj.caller_id&.is_a?(String) != false || raise("Passed value for field obj.caller_id is not the expected type, validation failed.") obj.transfer_plan.nil? || Vapi::TransferPlan.validate_raw(obj: obj.transfer_plan) obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of TransferDestinationNumber to a JSON object
175 176 177 |
# File 'lib/vapi_server_sdk/types/transfer_destination_number.rb', line 175 def to_json(*_args) @_field_set&.to_json end |