Class: Vapi::TransferPlan

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mode:, message: OMIT, sip_verb: OMIT, summary_plan: OMIT, additional_properties: nil) ⇒ Vapi::TransferPlan

Parameters:

  • mode (Vapi::TransferPlanMode)

    This configures how transfer is executed and the experience of the destination party receiving the call. Usage:

    • blind-transfer: The assistant forwards the call to the destination without

    any message or summary.

    • blind-transfer-add-summary-to-sip-header: The assistant forwards the call to

    the destination and adds a SIP header X-Transfer-Summary to the call to include the summary.

    • warm-transfer-say-message: The assistant dials the destination, delivers the

    message to the destination party, connects the customer, and leaves the call.

    • warm-transfer-say-summary: The assistant dials the destination, provides a

    summary of the call to the destination party, connects the customer, and leaves the call.

    • warm-transfer-wait-for-operator-to-speak-first-and-then-say-message: The

    assistant dials the destination, waits for the operator to speak, delivers the message to the destination party, and then connects the customer.

    • warm-transfer-wait-for-operator-to-speak-first-and-then-say-summary: The

    assistant dials the destination, waits for the operator to speak, provides a summary of the call to the destination party, and then connects the customer. @default ‘blind-transfer’

  • message (Vapi::TransferPlanMessage) (defaults to: OMIT)

    This is the message the assistant will deliver to the destination party before connecting the customer. Usage:

    • Used only when mode is blind-transfer-add-summary-to-sip-header,

    warm-transfer-say-message or warm-transfer-wait-for-operator-to-speak-first-and-then-say-message.

  • sip_verb (Hash{String => Object}) (defaults to: OMIT)

    This specifies the SIP verb to use while transferring the call.

    • ‘refer’: Uses SIP REFER to transfer the call (default)

    • ‘bye’: Ends current call with SIP BYE

  • summary_plan (Vapi::SummaryPlan) (defaults to: OMIT)

    This is the plan for generating a summary of the call to present to the destination party. Usage:

    • Used only when mode is blind-transfer-add-summary-to-sip-header or

    warm-transfer-say-summary or warm-transfer-wait-for-operator-to-speak-first-and-then-say-summary.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/vapi_server_sdk/types/transfer_plan.rb', line 95

def initialize(mode:, message: OMIT, sip_verb: OMIT, summary_plan: OMIT, additional_properties: nil)
  @mode = mode
  @message = message if message != OMIT
  @sip_verb = sip_verb if sip_verb != OMIT
  @summary_plan = summary_plan if summary_plan != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "mode": mode,
    "message": message,
    "sipVerb": sip_verb,
    "summaryPlan": summary_plan
  }.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



51
52
53
# File 'lib/vapi_server_sdk/types/transfer_plan.rb', line 51

def additional_properties
  @additional_properties
end

#messageVapi::TransferPlanMessage (readonly)

Returns This is the message the assistant will deliver to the destination party before connecting the customer. Usage:

  • Used only when mode is blind-transfer-add-summary-to-sip-header,

warm-transfer-say-message or warm-transfer-wait-for-operator-to-speak-first-and-then-say-message.

Returns:

  • (Vapi::TransferPlanMessage)

    This is the message the assistant will deliver to the destination party before connecting the customer. Usage:

    • Used only when mode is blind-transfer-add-summary-to-sip-header,

    warm-transfer-say-message or warm-transfer-wait-for-operator-to-speak-first-and-then-say-message.



38
39
40
# File 'lib/vapi_server_sdk/types/transfer_plan.rb', line 38

def message
  @message
end

#modeVapi::TransferPlanMode (readonly)

Returns This configures how transfer is executed and the experience of the destination party receiving the call. Usage:

  • blind-transfer: The assistant forwards the call to the destination without

any message or summary.

  • blind-transfer-add-summary-to-sip-header: The assistant forwards the call to

the destination and adds a SIP header X-Transfer-Summary to the call to include the summary.

  • warm-transfer-say-message: The assistant dials the destination, delivers the

message to the destination party, connects the customer, and leaves the call.

  • warm-transfer-say-summary: The assistant dials the destination, provides a

summary of the call to the destination party, connects the customer, and leaves the call.

  • warm-transfer-wait-for-operator-to-speak-first-and-then-say-message: The

assistant dials the destination, waits for the operator to speak, delivers the message to the destination party, and then connects the customer.

  • warm-transfer-wait-for-operator-to-speak-first-and-then-say-summary: The

assistant dials the destination, waits for the operator to speak, provides a summary of the call to the destination party, and then connects the customer. @default ‘blind-transfer’.

Returns:

  • (Vapi::TransferPlanMode)

    This configures how transfer is executed and the experience of the destination party receiving the call. Usage:

    • blind-transfer: The assistant forwards the call to the destination without

    any message or summary.

    • blind-transfer-add-summary-to-sip-header: The assistant forwards the call to

    the destination and adds a SIP header X-Transfer-Summary to the call to include the summary.

    • warm-transfer-say-message: The assistant dials the destination, delivers the

    message to the destination party, connects the customer, and leaves the call.

    • warm-transfer-say-summary: The assistant dials the destination, provides a

    summary of the call to the destination party, connects the customer, and leaves the call.

    • warm-transfer-wait-for-operator-to-speak-first-and-then-say-message: The

    assistant dials the destination, waits for the operator to speak, delivers the message to the destination party, and then connects the customer.

    • warm-transfer-wait-for-operator-to-speak-first-and-then-say-summary: The

    assistant dials the destination, waits for the operator to speak, provides a summary of the call to the destination party, and then connects the customer. @default ‘blind-transfer’



31
32
33
# File 'lib/vapi_server_sdk/types/transfer_plan.rb', line 31

def mode
  @mode
end

#sip_verbHash{String => Object} (readonly)

Returns This specifies the SIP verb to use while transferring the call.

  • ‘refer’: Uses SIP REFER to transfer the call (default)

  • ‘bye’: Ends current call with SIP BYE.

Returns:

  • (Hash{String => Object})

    This specifies the SIP verb to use while transferring the call.

    • ‘refer’: Uses SIP REFER to transfer the call (default)

    • ‘bye’: Ends current call with SIP BYE



42
43
44
# File 'lib/vapi_server_sdk/types/transfer_plan.rb', line 42

def sip_verb
  @sip_verb
end

#summary_planVapi::SummaryPlan (readonly)

Returns This is the plan for generating a summary of the call to present to the destination party. Usage:

  • Used only when mode is blind-transfer-add-summary-to-sip-header or

warm-transfer-say-summary or warm-transfer-wait-for-operator-to-speak-first-and-then-say-summary.

Returns:

  • (Vapi::SummaryPlan)

    This is the plan for generating a summary of the call to present to the destination party. Usage:

    • Used only when mode is blind-transfer-add-summary-to-sip-header or

    warm-transfer-say-summary or warm-transfer-wait-for-operator-to-speak-first-and-then-say-summary.



49
50
51
# File 'lib/vapi_server_sdk/types/transfer_plan.rb', line 49

def summary_plan
  @summary_plan
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::TransferPlan

Deserialize a JSON object to an instance of TransferPlan

Parameters:

  • json_object (String)

Returns:



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/vapi_server_sdk/types/transfer_plan.rb', line 115

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  mode = parsed_json["mode"]
  if parsed_json["message"].nil?
    message = nil
  else
    message = parsed_json["message"].to_json
    message = Vapi::TransferPlanMessage.from_json(json_object: message)
  end
  sip_verb = parsed_json["sipVerb"]
  if parsed_json["summaryPlan"].nil?
    summary_plan = nil
  else
    summary_plan = parsed_json["summaryPlan"].to_json
    summary_plan = Vapi::SummaryPlan.from_json(json_object: summary_plan)
  end
  new(
    mode: mode,
    message: message,
    sip_verb: sip_verb,
    summary_plan: summary_plan,
    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)


154
155
156
157
158
159
# File 'lib/vapi_server_sdk/types/transfer_plan.rb', line 154

def self.validate_raw(obj:)
  obj.mode.is_a?(Vapi::TransferPlanMode) != false || raise("Passed value for field obj.mode is not the expected type, validation failed.")
  obj.message.nil? || Vapi::TransferPlanMessage.validate_raw(obj: obj.message)
  obj.sip_verb&.is_a?(Hash) != false || raise("Passed value for field obj.sip_verb is not the expected type, validation failed.")
  obj.summary_plan.nil? || Vapi::SummaryPlan.validate_raw(obj: obj.summary_plan)
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of TransferPlan to a JSON object

Returns:

  • (String)


144
145
146
# File 'lib/vapi_server_sdk/types/transfer_plan.rb', line 144

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