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};
12
13use crate::models;
14
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct VapiPhoneNumber {
17    #[serde(
18        rename = "fallbackDestination",
19        skip_serializing_if = "Option::is_none"
20    )]
21    pub fallback_destination: Option<models::ImportTwilioPhoneNumberDtoFallbackDestination>,
22    /// This is to create free SIP phone numbers on Vapi.
23    #[serde(rename = "provider")]
24    pub provider: Provider,
25    /// This is the unique identifier for the phone number.
26    #[serde(rename = "id")]
27    pub id: String,
28    /// This is the unique identifier for the org that this phone number belongs to.
29    #[serde(rename = "orgId")]
30    pub org_id: String,
31    /// This is the ISO 8601 date-time string of when the phone number was created.
32    #[serde(rename = "createdAt")]
33    pub created_at: String,
34    /// This is the ISO 8601 date-time string of when the phone number was last updated.
35    #[serde(rename = "updatedAt")]
36    pub updated_at: String,
37    /// This is the status of the phone number.
38    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
39    pub status: Option<Status>,
40    /// These are the digits of the phone number you purchased from Vapi.
41    #[serde(rename = "number", skip_serializing_if = "Option::is_none")]
42    pub number: Option<String>,
43    /// This is the name of the phone number. This is just for your own reference.
44    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
45    pub name: Option<String>,
46    /// 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.
47    #[serde(rename = "assistantId", skip_serializing_if = "Option::is_none")]
48    pub assistant_id: Option<String>,
49    /// 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.
50    #[serde(rename = "squadId", skip_serializing_if = "Option::is_none")]
51    pub squad_id: Option<String>,
52    /// 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
53    #[serde(rename = "server", skip_serializing_if = "Option::is_none")]
54    pub server: Option<models::Server>,
55    /// This is the area code of the phone number to purchase.
56    #[serde(
57        rename = "numberDesiredAreaCode",
58        skip_serializing_if = "Option::is_none"
59    )]
60    pub number_desired_area_code: Option<String>,
61    /// 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.
62    #[serde(rename = "sipUri", skip_serializing_if = "Option::is_none")]
63    pub sip_uri: Option<String>,
64    /// 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.
65    #[serde(rename = "authentication", skip_serializing_if = "Option::is_none")]
66    pub authentication: Option<models::SipAuthentication>,
67}
68
69impl VapiPhoneNumber {
70    pub fn new(
71        provider: Provider,
72        id: String,
73        org_id: String,
74        created_at: String,
75        updated_at: String,
76    ) -> VapiPhoneNumber {
77        VapiPhoneNumber {
78            fallback_destination: None,
79            provider,
80            id,
81            org_id,
82            created_at,
83            updated_at,
84            status: None,
85            number: None,
86            name: None,
87            assistant_id: None,
88            squad_id: None,
89            server: None,
90            number_desired_area_code: None,
91            sip_uri: None,
92            authentication: None,
93        }
94    }
95}
96/// This is to create free SIP phone numbers on Vapi.
97#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
98pub enum Provider {
99    #[serde(rename = "vapi")]
100    Vapi,
101}
102
103impl Default for Provider {
104    fn default() -> Provider {
105        Self::Vapi
106    }
107}
108/// This is the status of the phone number.
109#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
110pub enum Status {
111    #[serde(rename = "active")]
112    Active,
113    #[serde(rename = "activating")]
114    Activating,
115    #[serde(rename = "blocked")]
116    Blocked,
117}
118
119impl Default for Status {
120    fn default() -> Status {
121        Self::Active
122    }
123}