vapi_client/models/transfer_plan.rs
1/*
2 * Vapi API
3 *
4 * Voice AI for developers.
5 *
6 * The version of the OpenAPI document: 1.0
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct TransferPlan {
16 /// 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. - `warm-transfer-twiml`: The assistant dials the destination, executes the twiml instructions on the destination call leg, connects the customer, and leaves the call. - `warm-transfer-experimental`: The assistant puts the customer on hold, dials the destination, and if the destination answers (and is human), delivers a message or summary before connecting the customer. If the destination is unreachable or not human (e.g., with voicemail detection), the assistant delivers the `fallbackMessage` to the customer and optionally ends the call. @default 'blind-transfer'
17 #[serde(rename = "mode")]
18 pub mode: ModeTrue,
19 #[serde(rename = "message", skip_serializing_if = "Option::is_none")]
20 pub message: Option<models::TransferPlanMessage>,
21 /// This is the timeout in seconds for the warm-transfer-wait-for-operator-to-speak-first-and-then-say-message/summary @default 60
22 #[serde(rename = "timeout", skip_serializing_if = "Option::is_none")]
23 pub timeout: Option<f64>,
24 /// 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 - 'dial': Uses SIP DIAL to transfer the call
25 #[serde(rename = "sipVerb", skip_serializing_if = "Option::is_none")]
26 pub sip_verb: Option<SipVerbTrue>,
27 /// This is the URL to an audio file played while the customer is on hold during transfer. Usage: - Used only when `mode` is `warm-transfer-experimental`. - Used when transferring calls to play hold audio for the customer. - Must be a publicly accessible URL to an audio file. - Supported formats: MP3 and WAV. - If not provided, the default hold audio will be used.
28 #[serde(rename = "holdAudioUrl", skip_serializing_if = "Option::is_none")]
29 pub hold_audio_url: Option<String>,
30 /// This is the URL to an audio file played after the warm transfer message or summary is delivered to the destination party. It can be used to play a custom sound like 'beep' to notify that the transfer is complete. Usage: - Used only when `mode` is `warm-transfer-experimental`. - Used when transferring calls to play hold audio for the destination party. - Must be a publicly accessible URL to an audio file. - Supported formats: MP3 and WAV.
31 #[serde(
32 rename = "transferCompleteAudioUrl",
33 skip_serializing_if = "Option::is_none"
34 )]
35 pub transfer_complete_audio_url: Option<String>,
36 /// This is the TwiML instructions to execute on the destination call leg before connecting the customer. Usage: - Used only when `mode` is `warm-transfer-twiml`. - Supports only `Play`, `Say`, `Gather`, `Hangup` and `Pause` verbs. - Maximum length is 4096 characters. Example: ``` <Say voice=\"alice\" language=\"en-US\">Hello, transferring a customer to you.</Say> <Pause length=\"2\"/> <Say>They called about billing questions.</Say> ```
37 #[serde(rename = "twiml", skip_serializing_if = "Option::is_none")]
38 pub twiml: Option<String>,
39 /// 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` or `warm-transfer-experimental`.
40 #[serde(rename = "summaryPlan", skip_serializing_if = "Option::is_none")]
41 pub summary_plan: Option<models::SummaryPlan>,
42 /// This flag includes the sipHeaders from above in the refer to sip uri as url encoded query params. @default false
43 #[serde(
44 rename = "sipHeadersInReferToEnabled",
45 skip_serializing_if = "Option::is_none"
46 )]
47 pub sip_headers_in_refer_to_enabled: Option<bool>,
48 /// This configures the fallback plan when the transfer fails (destination unreachable, busy, or not human). Usage: - Used only when `mode` is `warm-transfer-experimental`. - If not provided when using `warm-transfer-experimental`, a default message will be used.
49 #[serde(rename = "fallbackPlan", skip_serializing_if = "Option::is_none")]
50 pub fallback_plan: Option<models::TransferFallbackPlan>,
51}
52
53impl TransferPlan {
54 pub fn new(mode: ModeTrue) -> TransferPlan {
55 TransferPlan {
56 mode,
57 message: None,
58 timeout: None,
59 sip_verb: None,
60 hold_audio_url: None,
61 transfer_complete_audio_url: None,
62 twiml: None,
63 summary_plan: None,
64 sip_headers_in_refer_to_enabled: None,
65 fallback_plan: None,
66 }
67 }
68}
69/// 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. - `warm-transfer-twiml`: The assistant dials the destination, executes the twiml instructions on the destination call leg, connects the customer, and leaves the call. - `warm-transfer-experimental`: The assistant puts the customer on hold, dials the destination, and if the destination answers (and is human), delivers a message or summary before connecting the customer. If the destination is unreachable or not human (e.g., with voicemail detection), the assistant delivers the `fallbackMessage` to the customer and optionally ends the call. @default 'blind-transfer'
70#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
71pub enum ModeTrue {
72 #[serde(rename = "blind-transfer")]
73 BlindTransfer,
74 #[serde(rename = "blind-transfer-add-summary-to-sip-header")]
75 BlindTransferAddSummaryToSipHeader,
76 #[serde(rename = "warm-transfer-say-message")]
77 WarmTransferSayMessage,
78 #[serde(rename = "warm-transfer-say-summary")]
79 WarmTransferSaySummary,
80 #[serde(rename = "warm-transfer-twiml")]
81 WarmTransferTwiml,
82 #[serde(rename = "warm-transfer-wait-for-operator-to-speak-first-and-then-say-message")]
83 WarmTransferWaitForOperatorToSpeakFirstAndThenSayMessage,
84 #[serde(rename = "warm-transfer-wait-for-operator-to-speak-first-and-then-say-summary")]
85 WarmTransferWaitForOperatorToSpeakFirstAndThenSaySummary,
86 #[serde(rename = "warm-transfer-experimental")]
87 WarmTransferExperimental,
88}
89
90impl Default for ModeTrue {
91 fn default() -> ModeTrue {
92 Self::BlindTransfer
93 }
94}
95/// 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 - 'dial': Uses SIP DIAL to transfer the call
96#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
97pub enum SipVerbTrue {
98 #[serde(rename = "refer")]
99 Refer,
100 #[serde(rename = "bye")]
101 Bye,
102 #[serde(rename = "dial")]
103 Dial,
104}
105
106impl Default for SipVerbTrue {
107 fn default() -> SipVerbTrue {
108 Self::Refer
109 }
110}