vapi_client/models/
vapi_phone_number.rs

1/*
2 * Vapi API
3 *
4 * API for building voice assistants
5 *
6 * The version of the OpenAPI document: 1.0
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use serde::{Deserialize, Serialize};
12use utoipa::OpenApi;
13
14
15use crate::models;
16
17#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, OpenApi)]
18pub struct VapiPhoneNumber {
19    #[serde(
20        rename = "fallbackDestination",
21        skip_serializing_if = "Option::is_none"
22    )]
23    pub fallback_destination: Option<models::ImportTwilioPhoneNumberDtoFallbackDestination>,
24    /// This is to create free SIP phone numbers on Vapi.
25    #[serde(rename = "provider")]
26    pub provider: Provider,
27    /// This is the unique identifier for the phone number.
28    #[serde(rename = "id")]
29    pub id: String,
30    /// This is the unique identifier for the org that this phone number belongs to.
31    #[serde(rename = "orgId")]
32    pub org_id: String,
33    /// This is the ISO 8601 date-time string of when the phone number was created.
34    #[serde(rename = "createdAt")]
35    pub created_at: String,
36    /// This is the ISO 8601 date-time string of when the phone number was last updated.
37    #[serde(rename = "updatedAt")]
38    pub updated_at: String,
39    /// This is the status of the phone number.
40    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
41    pub status: Option<Status>,
42    /// These are the digits of the phone number you purchased from Vapi.
43    #[serde(rename = "number", skip_serializing_if = "Option::is_none")]
44    pub number: Option<String>,
45    /// This is the name of the phone number. This is just for your own reference.
46    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
47    pub name: Option<String>,
48    /// This is the assistant that will be used for incoming calls to this phone number.  If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the shape of the message and response that is expected.
49    #[serde(rename = "assistantId", skip_serializing_if = "Option::is_none")]
50    pub assistant_id: Option<String>,
51    /// This is the squad that will be used for incoming calls to this phone number.  If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the shape of the message and response that is expected.
52    #[serde(rename = "squadId", skip_serializing_if = "Option::is_none")]
53    pub squad_id: Option<String>,
54    /// This is where Vapi will send webhooks. You can find all webhooks available along with their shape in ServerMessage schema.  The order of precedence is:  1. assistant.server 2. phoneNumber.server 3. org.server
55    #[serde(rename = "server", skip_serializing_if = "Option::is_none")]
56    pub server: Option<models::Server>,
57    /// This is the area code of the phone number to purchase.
58    #[serde(
59        rename = "numberDesiredAreaCode",
60        skip_serializing_if = "Option::is_none"
61    )]
62    pub number_desired_area_code: Option<String>,
63    /// This is the SIP URI of the phone number. You can SIP INVITE this. The assistant attached to this number will answer.  This is case-insensitive.
64    #[serde(rename = "sipUri", skip_serializing_if = "Option::is_none")]
65    pub sip_uri: Option<String>,
66    /// This enables authentication for incoming SIP INVITE requests to the `sipUri`.  If not set, any username/password to the 401 challenge of the SIP INVITE will be accepted.
67    #[serde(rename = "authentication", skip_serializing_if = "Option::is_none")]
68    pub authentication: Option<models::SipAuthentication>,
69}
70
71impl VapiPhoneNumber {
72    pub fn new(
73        provider: Provider,
74        id: String,
75        org_id: String,
76        created_at: String,
77        updated_at: String,
78    ) -> VapiPhoneNumber {
79        VapiPhoneNumber {
80            fallback_destination: None,
81            provider,
82            id,
83            org_id,
84            created_at,
85            updated_at,
86            status: None,
87            number: None,
88            name: None,
89            assistant_id: None,
90            squad_id: None,
91            server: None,
92            number_desired_area_code: None,
93            sip_uri: None,
94            authentication: None,
95        }
96    }
97}
98/// This is to create free SIP phone numbers on Vapi.
99#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, OpenApi)]
100pub enum Provider {
101    #[serde(rename = "vapi")]
102    Vapi,
103}
104
105impl Default for Provider {
106    fn default() -> Provider {
107        Self::Vapi
108    }
109}
110/// This is the status of the phone number.
111#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, OpenApi)]
112pub enum Status {
113    #[serde(rename = "active")]
114    Active,
115    #[serde(rename = "activating")]
116    Activating,
117    #[serde(rename = "blocked")]
118    Blocked,
119}
120
121impl Default for Status {
122    fn default() -> Status {
123        Self::Active
124    }
125}