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