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(
17        rename = "fallbackDestination",
18        skip_serializing_if = "Option::is_none"
19    )]
20    pub fallback_destination: Option<models::ImportTwilioPhoneNumberDtoFallbackDestination>,
21    /// This is the hooks that will be used for incoming calls to this phone number.
22    #[serde(rename = "hooks", skip_serializing_if = "Option::is_none")]
23    pub hooks: Option<Vec<models::ImportTwilioPhoneNumberDtoHooksInner>>,
24    /// This is to create free SIP phone numbers on Vapi.
25    #[serde(rename = "provider")]
26    pub provider: ProviderTrue,
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<StatusTrue>,
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`, `squadId` nor `workflowId` 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 workflow that will be used for incoming calls to this phone number.  If neither `assistantId`, `squadId`, nor `workflowId` 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 = "workflowId", skip_serializing_if = "Option::is_none")]
53    pub workflow_id: Option<String>,
54    /// This is the squad that will be used for incoming calls to this phone number.  If neither `assistantId`, `squadId`, nor `workflowId` 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.
55    #[serde(rename = "squadId", skip_serializing_if = "Option::is_none")]
56    pub squad_id: Option<String>,
57    /// 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
58    #[serde(rename = "server", skip_serializing_if = "Option::is_none")]
59    pub server: Option<models::Server>,
60    /// This is the area code of the phone number to purchase.
61    #[serde(
62        rename = "numberDesiredAreaCode",
63        skip_serializing_if = "Option::is_none"
64    )]
65    pub number_desired_area_code: Option<String>,
66    /// 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.
67    #[serde(rename = "sipUri", skip_serializing_if = "Option::is_none")]
68    pub sip_uri: Option<String>,
69    /// 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.
70    #[serde(rename = "authentication", skip_serializing_if = "Option::is_none")]
71    pub authentication: Option<models::SipAuthentication>,
72}
73
74impl VapiPhoneNumber {
75    pub fn new(
76        provider: ProviderTrue,
77        id: String,
78        org_id: String,
79        created_at: String,
80        updated_at: String,
81    ) -> VapiPhoneNumber {
82        VapiPhoneNumber {
83            fallback_destination: None,
84            hooks: None,
85            provider,
86            id,
87            org_id,
88            created_at,
89            updated_at,
90            status: None,
91            number: None,
92            name: None,
93            assistant_id: None,
94            workflow_id: None,
95            squad_id: None,
96            server: None,
97            number_desired_area_code: None,
98            sip_uri: None,
99            authentication: None,
100        }
101    }
102}
103/// This is to create free SIP phone numbers on Vapi.
104#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
105pub enum ProviderTrue {
106    #[serde(rename = "vapi")]
107    Vapi,
108}
109
110impl Default for ProviderTrue {
111    fn default() -> ProviderTrue {
112        Self::Vapi
113    }
114}
115/// This is the status of the phone number.
116#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
117pub enum StatusTrue {
118    #[serde(rename = "active")]
119    Active,
120    #[serde(rename = "activating")]
121    Activating,
122    #[serde(rename = "blocked")]
123    Blocked,
124}
125
126impl Default for StatusTrue {
127    fn default() -> StatusTrue {
128        Self::Active
129    }
130}