vapi_client/models/
create_vapi_phone_number_dto.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 CreateVapiPhoneNumberDto {
16    #[serde(rename = "fallbackDestination", skip_serializing_if = "Option::is_none")]
17    pub fallback_destination: Option<Box<models::ImportTwilioPhoneNumberDtoFallbackDestination>>,
18    /// This is to create free SIP phone numbers on Vapi.
19    #[serde(rename = "provider")]
20    pub provider: Provider,
21    /// This is the area code of the phone number to purchase.
22    #[serde(rename = "numberDesiredAreaCode", skip_serializing_if = "Option::is_none")]
23    pub number_desired_area_code: Option<String>,
24    /// 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.
25    #[serde(rename = "sipUri", skip_serializing_if = "Option::is_none")]
26    pub sip_uri: Option<String>,
27    /// 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.
28    #[serde(rename = "authentication", skip_serializing_if = "Option::is_none")]
29    pub authentication: Option<Box<models::SipAuthentication>>,
30    /// This is the name of the phone number. This is just for your own reference.
31    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
32    pub name: Option<String>,
33    /// 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.
34    #[serde(rename = "assistantId", skip_serializing_if = "Option::is_none")]
35    pub assistant_id: Option<String>,
36    /// 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.
37    #[serde(rename = "squadId", skip_serializing_if = "Option::is_none")]
38    pub squad_id: Option<String>,
39    /// 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
40    #[serde(rename = "server", skip_serializing_if = "Option::is_none")]
41    pub server: Option<Box<models::Server>>,
42}
43
44impl CreateVapiPhoneNumberDto {
45    pub fn new(provider: Provider) -> CreateVapiPhoneNumberDto {
46        CreateVapiPhoneNumberDto {
47            fallback_destination: None,
48            provider,
49            number_desired_area_code: None,
50            sip_uri: None,
51            authentication: None,
52            name: None,
53            assistant_id: None,
54            squad_id: None,
55            server: None,
56        }
57    }
58}
59/// This is to create free SIP phone numbers on Vapi.
60#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
61pub enum Provider {
62    #[serde(rename = "vapi")]
63    Vapi,
64}
65
66impl Default for Provider {
67    fn default() -> Provider {
68        Self::Vapi
69    }
70}
71