vapi_client/models/
server_message_phone_call_control.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 ServerMessagePhoneCallControl {
16    #[serde(rename = "phoneNumber", skip_serializing_if = "Option::is_none")]
17    pub phone_number: Option<models::ClientMessageWorkflowNodeStartedPhoneNumber>,
18    /// This is the type of the message. \"phone-call-control\" is an advanced type of message.  When it is requested in `assistant.serverMessages`, the hangup and forwarding responsibilities are delegated to your server. Vapi will no longer do the actual transfer and hangup.
19    #[serde(rename = "type")]
20    pub r#type: TypeTrue,
21    /// This is the request to control the phone call.
22    #[serde(rename = "request")]
23    pub request: RequestTrue,
24    #[serde(rename = "destination", skip_serializing_if = "Option::is_none")]
25    pub destination: Option<models::ServerMessagePhoneCallControlDestination>,
26    /// This is the timestamp of the message.
27    #[serde(rename = "timestamp", skip_serializing_if = "Option::is_none")]
28    pub timestamp: Option<f64>,
29    /// This is a live version of the `call.artifact`.  This matches what is stored on `call.artifact` after the call.
30    #[serde(rename = "artifact", skip_serializing_if = "Option::is_none")]
31    pub artifact: Option<models::Artifact>,
32    /// This is the assistant that the message is associated with.
33    #[serde(rename = "assistant", skip_serializing_if = "Option::is_none")]
34    pub assistant: Option<models::CreateAssistantDto>,
35    /// This is the customer that the message is associated with.
36    #[serde(rename = "customer", skip_serializing_if = "Option::is_none")]
37    pub customer: Option<models::CreateCustomerDto>,
38    /// This is the call that the message is associated with.
39    #[serde(rename = "call", skip_serializing_if = "Option::is_none")]
40    pub call: Option<models::Call>,
41    /// This is the chat object.
42    #[serde(rename = "chat", skip_serializing_if = "Option::is_none")]
43    pub chat: Option<models::Chat>,
44}
45
46impl ServerMessagePhoneCallControl {
47    pub fn new(r#type: TypeTrue, request: RequestTrue) -> ServerMessagePhoneCallControl {
48        ServerMessagePhoneCallControl {
49            phone_number: None,
50            r#type,
51            request,
52            destination: None,
53            timestamp: None,
54            artifact: None,
55            assistant: None,
56            customer: None,
57            call: None,
58            chat: None,
59        }
60    }
61}
62/// This is the type of the message. \"phone-call-control\" is an advanced type of message.  When it is requested in `assistant.serverMessages`, the hangup and forwarding responsibilities are delegated to your server. Vapi will no longer do the actual transfer and hangup.
63#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
64pub enum TypeTrue {
65    #[serde(rename = "phone-call-control")]
66    PhoneCallControl,
67}
68
69impl Default for TypeTrue {
70    fn default() -> TypeTrue {
71        Self::PhoneCallControl
72    }
73}
74/// This is the request to control the phone call.
75#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
76pub enum RequestTrue {
77    #[serde(rename = "forward")]
78    Forward,
79    #[serde(rename = "hang-up")]
80    HangUp,
81}
82
83impl Default for RequestTrue {
84    fn default() -> RequestTrue {
85        Self::Forward
86    }
87}