Class: Vapi::TransferDestinationSip
- Inherits:
-
Object
- Object
- Vapi::TransferDestinationSip
- Defined in:
- lib/vapi_server_sdk/types/transfer_destination_sip.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#description ⇒ String
readonly
This is the description of the destination, used by the AI to choose when and how to transfer the call.
-
#message ⇒ Vapi::TransferDestinationSipMessage
readonly
This is spoken to the customer before connecting them to the destination.
-
#sip_headers ⇒ Hash{String => Object}
readonly
These are custom headers to be added to SIP refer during transfer call.
-
#sip_uri ⇒ String
readonly
This is the SIP URI to transfer the call to.
-
#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::TransferDestinationSip
Deserialize a JSON object to an instance of TransferDestinationSip.
-
.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(sip_uri:, message: OMIT, transfer_plan: OMIT, sip_headers: OMIT, description: OMIT, additional_properties: nil) ⇒ Vapi::TransferDestinationSip constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of TransferDestinationSip to a JSON object.
Constructor Details
#initialize(sip_uri:, message: OMIT, transfer_plan: OMIT, sip_headers: OMIT, description: OMIT, additional_properties: nil) ⇒ Vapi::TransferDestinationSip
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/vapi_server_sdk/types/transfer_destination_sip.rb', line 63 def initialize(sip_uri:, message: OMIT, transfer_plan: OMIT, sip_headers: OMIT, description: OMIT, additional_properties: nil) @message = if != OMIT @sip_uri = sip_uri @transfer_plan = transfer_plan if transfer_plan != OMIT @sip_headers = sip_headers if sip_headers != OMIT @description = description if description != OMIT @additional_properties = additional_properties @_field_set = { "message": , "sipUri": sip_uri, "transferPlan": transfer_plan, "sipHeaders": sip_headers, "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.
35 36 37 |
# File 'lib/vapi_server_sdk/types/transfer_destination_sip.rb', line 35 def additional_properties @additional_properties 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.
33 34 35 |
# File 'lib/vapi_server_sdk/types/transfer_destination_sip.rb', line 33 def description @description end |
#message ⇒ Vapi::TransferDestinationSipMessage (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_sip.rb', line 22 def @message end |
#sip_headers ⇒ Hash{String => Object} (readonly)
Returns These are custom headers to be added to SIP refer during transfer call.
30 31 32 |
# File 'lib/vapi_server_sdk/types/transfer_destination_sip.rb', line 30 def sip_headers @sip_headers end |
#sip_uri ⇒ String (readonly)
Returns This is the SIP URI to transfer the call to.
24 25 26 |
# File 'lib/vapi_server_sdk/types/transfer_destination_sip.rb', line 24 def sip_uri @sip_uri 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’‘.
28 29 30 |
# File 'lib/vapi_server_sdk/types/transfer_destination_sip.rb', line 28 def transfer_plan @transfer_plan end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::TransferDestinationSip
Deserialize a JSON object to an instance of TransferDestinationSip
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/vapi_server_sdk/types/transfer_destination_sip.rb', line 86 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::TransferDestinationSipMessage.from_json(json_object: ) end sip_uri = parsed_json["sipUri"] 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 sip_headers = parsed_json["sipHeaders"] description = parsed_json["description"] new( message: , sip_uri: sip_uri, transfer_plan: transfer_plan, sip_headers: sip_headers, 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.
127 128 129 130 131 132 133 |
# File 'lib/vapi_server_sdk/types/transfer_destination_sip.rb', line 127 def self.validate_raw(obj:) obj..nil? || Vapi::TransferDestinationSipMessage.validate_raw(obj: obj.) obj.sip_uri.is_a?(String) != false || raise("Passed value for field obj.sip_uri is not the expected type, validation failed.") obj.transfer_plan.nil? || Vapi::TransferPlan.validate_raw(obj: obj.transfer_plan) obj.sip_headers&.is_a?(Hash) != false || raise("Passed value for field obj.sip_headers is not the expected type, validation failed.") 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 TransferDestinationSip to a JSON object
117 118 119 |
# File 'lib/vapi_server_sdk/types/transfer_destination_sip.rb', line 117 def to_json(*_args) @_field_set&.to_json end |