vapi_client/models/
sip_trunk_gateway.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 SipTrunkGateway {
16    /// 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.
17    #[serde(rename = "ip")]
18    pub ip: String,
19    /// This is the port number of the gateway. Default is 5060.  @default 5060
20    #[serde(rename = "port", skip_serializing_if = "Option::is_none")]
21    pub port: Option<f64>,
22    /// This is the netmask of the gateway. Defaults to 32.  @default 32
23    #[serde(rename = "netmask", skip_serializing_if = "Option::is_none")]
24    pub netmask: Option<f64>,
25    /// This is whether inbound calls are allowed from this gateway. Default is true.  @default true
26    #[serde(rename = "inboundEnabled", skip_serializing_if = "Option::is_none")]
27    pub inbound_enabled: Option<bool>,
28    /// 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
29    #[serde(rename = "outboundEnabled", skip_serializing_if = "Option::is_none")]
30    pub outbound_enabled: Option<bool>,
31    /// This is the protocol to use for SIP signaling outbound calls. Default is udp.  @default udp
32    #[serde(rename = "outboundProtocol", skip_serializing_if = "Option::is_none")]
33    pub outbound_protocol: Option<OutboundProtocolTrue>,
34    /// 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
35    #[serde(rename = "optionsPingEnabled", skip_serializing_if = "Option::is_none")]
36    pub options_ping_enabled: Option<bool>,
37}
38
39impl SipTrunkGateway {
40    pub fn new(ip: String) -> SipTrunkGateway {
41        SipTrunkGateway {
42            ip,
43            port: None,
44            netmask: None,
45            inbound_enabled: None,
46            outbound_enabled: None,
47            outbound_protocol: None,
48            options_ping_enabled: None,
49        }
50    }
51}
52/// This is the protocol to use for SIP signaling outbound calls. Default is udp.  @default udp
53#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
54pub enum OutboundProtocolTrue {
55    #[serde(rename = "tls/srtp")]
56    TlsSlashSrtp,
57    #[serde(rename = "tcp")]
58    Tcp,
59    #[serde(rename = "tls")]
60    Tls,
61    #[serde(rename = "udp")]
62    Udp,
63}
64
65impl Default for OutboundProtocolTrue {
66    fn default() -> OutboundProtocolTrue {
67        Self::TlsSlashSrtp
68    }
69}