/*
* Vapi API
*
* Voice AI for developers.
*
* The version of the OpenAPI document: 1.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct TransferPlan {
/// 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'
#[serde(rename = "mode")]
pub mode: ModeTrue,
#[serde(rename = "message", skip_serializing_if = "Option::is_none")]
pub message: Option<models::TransferPlanMessage>,
/// This is the timeout in seconds for the warm-transfer-wait-for-operator-to-speak-first-and-then-say-message/summary @default 60
#[serde(rename = "timeout", skip_serializing_if = "Option::is_none")]
pub timeout: Option<f64>,
/// 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
#[serde(rename = "sipVerb", skip_serializing_if = "Option::is_none")]
pub sip_verb: Option<SipVerbTrue>,
/// 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.
#[serde(rename = "holdAudioUrl", skip_serializing_if = "Option::is_none")]
pub hold_audio_url: Option<String>,
/// 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.
#[serde(
rename = "transferCompleteAudioUrl",
skip_serializing_if = "Option::is_none"
)]
pub transfer_complete_audio_url: Option<String>,
/// 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> ```
#[serde(rename = "twiml", skip_serializing_if = "Option::is_none")]
pub twiml: Option<String>,
/// 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`.
#[serde(rename = "summaryPlan", skip_serializing_if = "Option::is_none")]
pub summary_plan: Option<models::SummaryPlan>,
/// This flag includes the sipHeaders from above in the refer to sip uri as url encoded query params. @default false
#[serde(
rename = "sipHeadersInReferToEnabled",
skip_serializing_if = "Option::is_none"
)]
pub sip_headers_in_refer_to_enabled: Option<bool>,
/// 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.
#[serde(rename = "fallbackPlan", skip_serializing_if = "Option::is_none")]
pub fallback_plan: Option<models::TransferFallbackPlan>,
}
impl TransferPlan {
pub fn new(mode: ModeTrue) -> TransferPlan {
TransferPlan {
mode,
message: None,
timeout: None,
sip_verb: None,
hold_audio_url: None,
transfer_complete_audio_url: None,
twiml: None,
summary_plan: None,
sip_headers_in_refer_to_enabled: None,
fallback_plan: None,
}
}
}
/// 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'
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ModeTrue {
#[serde(rename = "blind-transfer")]
BlindTransfer,
#[serde(rename = "blind-transfer-add-summary-to-sip-header")]
BlindTransferAddSummaryToSipHeader,
#[serde(rename = "warm-transfer-say-message")]
WarmTransferSayMessage,
#[serde(rename = "warm-transfer-say-summary")]
WarmTransferSaySummary,
#[serde(rename = "warm-transfer-twiml")]
WarmTransferTwiml,
#[serde(rename = "warm-transfer-wait-for-operator-to-speak-first-and-then-say-message")]
WarmTransferWaitForOperatorToSpeakFirstAndThenSayMessage,
#[serde(rename = "warm-transfer-wait-for-operator-to-speak-first-and-then-say-summary")]
WarmTransferWaitForOperatorToSpeakFirstAndThenSaySummary,
#[serde(rename = "warm-transfer-experimental")]
WarmTransferExperimental,
}
impl Default for ModeTrue {
fn default() -> ModeTrue {
Self::BlindTransfer
}
}
/// 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
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum SipVerbTrue {
#[serde(rename = "refer")]
Refer,
#[serde(rename = "bye")]
Bye,
#[serde(rename = "dial")]
Dial,
}
impl Default for SipVerbTrue {
fn default() -> SipVerbTrue {
Self::Refer
}
}