vapi_client/models/byo_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 ByoPhoneNumber {
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 bring your own phone numbers from your own SIP trunks or Carriers.
22 #[serde(rename = "provider")]
23 pub provider: Provider,
24 /// This is the flag to toggle the E164 check for the `number` field. This is an advanced property which should be used if you know your use case requires it. Use cases: - `false`: To allow non-E164 numbers like `+001234567890`, `1234`, or `abc`. This is useful for dialing out to non-E164 numbers on your SIP trunks. - `true` (default): To allow only E164 numbers like `+14155551234`. This is standard for PSTN calls. If `false`, the `number` is still required to only contain alphanumeric characters (regex: `/^\\+?[a-zA-Z0-9]+$/`). @default true (E164 check is enabled)
25 #[serde(rename = "numberE164CheckEnabled", skip_serializing_if = "Option::is_none")]
26 pub number_e164_check_enabled: Option<bool>,
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 /// 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 number of the customer.
55 #[serde(rename = "number", skip_serializing_if = "Option::is_none")]
56 pub number: Option<String>,
57 /// This is the credential of your own SIP trunk or Carrier (type `byo-sip-trunk`) which can be used to make calls to this phone number. You can add the SIP trunk or Carrier credential in the Provider Credentials page on the Dashboard to get the credentialId.
58 #[serde(rename = "credentialId")]
59 pub credential_id: String,
60}
61
62impl ByoPhoneNumber {
63 pub fn new(provider: Provider, id: String, org_id: String, created_at: String, updated_at: String, credential_id: String) -> ByoPhoneNumber {
64 ByoPhoneNumber {
65 fallback_destination: None,
66 hooks: None,
67 provider,
68 number_e164_check_enabled: None,
69 id,
70 org_id,
71 created_at,
72 updated_at,
73 status: None,
74 name: None,
75 assistant_id: None,
76 squad_id: None,
77 server: None,
78 number: None,
79 credential_id,
80 }
81 }
82}
83/// This is to bring your own phone numbers from your own SIP trunks or Carriers.
84#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
85pub enum Provider {
86 #[serde(rename = "byo-phone-number")]
87 ByoPhoneNumber,
88}
89
90impl Default for Provider {
91 fn default() -> Provider {
92 Self::ByoPhoneNumber
93 }
94}
95/// This is the status of the phone number.
96#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
97pub enum Status {
98 #[serde(rename = "active")]
99 Active,
100 #[serde(rename = "activating")]
101 Activating,
102 #[serde(rename = "blocked")]
103 Blocked,
104}
105
106impl Default for Status {
107 fn default() -> Status {
108 Self::Active
109 }
110}
111