vapi_client/models/
sip_trunk_gateway.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};
12use utoipa::ToSchema;
13
14
15use crate::models;
16
17#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, ToSchema)]
18pub struct SipTrunkGateway {
19    /// This is the address of the gateway. It can be an IPv4 address like 1.1.1.1 or a fully qualified domain name like my-sip-trunk.pstn.twilio.com.
20    #[serde(rename = "ip")]
21    pub ip: String,
22    /// This is the port number of the gateway. Default is 5060.  @default 5060
23    #[serde(rename = "port", skip_serializing_if = "Option::is_none")]
24    pub port: Option<f64>,
25    /// This is the netmask of the gateway. Defaults to 32.  @default 32
26    #[serde(rename = "netmask", skip_serializing_if = "Option::is_none")]
27    pub netmask: Option<f64>,
28    /// This is whether inbound calls are allowed from this gateway. Default is true.  @default true
29    #[serde(rename = "inboundEnabled", skip_serializing_if = "Option::is_none")]
30    pub inbound_enabled: Option<bool>,
31    /// This is whether outbound calls should be sent to this gateway. Default is true.  Note, if netmask is less than 32, it doesn't affect the outbound IPs that are tried. 1 attempt is made to `ip:port`.  @default true
32    #[serde(rename = "outboundEnabled", skip_serializing_if = "Option::is_none")]
33    pub outbound_enabled: Option<bool>,
34    /// This is the protocol to use for SIP signaling outbound calls. Default is udp.  @default udp
35    #[serde(rename = "outboundProtocol", skip_serializing_if = "Option::is_none")]
36    pub outbound_protocol: Option<OutboundProtocol>,
37    /// This is whether to send options ping to the gateway. This can be used to check if the gateway is reachable. Default is false.  This is useful for high availability setups where you want to check if the gateway is reachable before routing calls to it. Note, if no gateway for a trunk is reachable, outbound calls will be rejected.  @default false
38    #[serde(rename = "optionsPingEnabled", skip_serializing_if = "Option::is_none")]
39    pub options_ping_enabled: Option<bool>,
40}
41
42impl SipTrunkGateway {
43    pub fn new(ip: String) -> SipTrunkGateway {
44        SipTrunkGateway {
45            ip,
46            port: None,
47            netmask: None,
48            inbound_enabled: None,
49            outbound_enabled: None,
50            outbound_protocol: None,
51            options_ping_enabled: None,
52        }
53    }
54}
55/// This is the protocol to use for SIP signaling outbound calls. Default is udp.  @default udp
56#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, ToSchema)]
57pub enum OutboundProtocol {
58    #[serde(rename = "tls/srtp")]
59    TlsSlashSrtp,
60    #[serde(rename = "tcp")]
61    Tcp,
62    #[serde(rename = "tls")]
63    Tls,
64    #[serde(rename = "udp")]
65    Udp,
66}
67
68impl Default for OutboundProtocol {
69    fn default() -> OutboundProtocol {
70        Self::TlsSlashSrtp
71    }
72}