Class: Vapi::SipTrunkGateway
- Inherits:
-
Object
- Object
- Vapi::SipTrunkGateway
- Defined in:
- lib/vapi_server_sdk/types/sip_trunk_gateway.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#inbound_enabled ⇒ Boolean
readonly
This is whether inbound calls are allowed from this gateway.
-
#ip ⇒ String
readonly
This is the address of the gateway.
-
#netmask ⇒ Float
readonly
This is the netmask of the gateway.
-
#options_ping_enabled ⇒ Boolean
readonly
This is whether to send options ping to the gateway.
-
#outbound_enabled ⇒ Boolean
readonly
This is whether outbound calls should be sent to this gateway.
-
#outbound_protocol ⇒ Vapi::SipTrunkGatewayOutboundProtocol
readonly
This is the protocol to use for SIP signaling outbound calls.
-
#port ⇒ Float
readonly
This is the port number of the gateway.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::SipTrunkGateway
Deserialize a JSON object to an instance of SipTrunkGateway.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(ip:, port: OMIT, netmask: OMIT, inbound_enabled: OMIT, outbound_enabled: OMIT, outbound_protocol: OMIT, options_ping_enabled: OMIT, additional_properties: nil) ⇒ Vapi::SipTrunkGateway constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of SipTrunkGateway to a JSON object.
Constructor Details
#initialize(ip:, port: OMIT, netmask: OMIT, inbound_enabled: OMIT, outbound_enabled: OMIT, outbound_protocol: OMIT, options_ping_enabled: OMIT, additional_properties: nil) ⇒ Vapi::SipTrunkGateway
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/vapi_server_sdk/types/sip_trunk_gateway.rb', line 66 def initialize(ip:, port: OMIT, netmask: OMIT, inbound_enabled: OMIT, outbound_enabled: OMIT, outbound_protocol: OMIT, options_ping_enabled: OMIT, additional_properties: nil) @ip = ip @port = port if port != OMIT @netmask = netmask if netmask != OMIT @inbound_enabled = inbound_enabled if inbound_enabled != OMIT @outbound_enabled = outbound_enabled if outbound_enabled != OMIT @outbound_protocol = outbound_protocol if outbound_protocol != OMIT = if != OMIT @additional_properties = additional_properties @_field_set = { "ip": ip, "port": port, "netmask": netmask, "inboundEnabled": inbound_enabled, "outboundEnabled": outbound_enabled, "outboundProtocol": outbound_protocol, "optionsPingEnabled": }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
37 38 39 |
# File 'lib/vapi_server_sdk/types/sip_trunk_gateway.rb', line 37 def additional_properties @additional_properties end |
#inbound_enabled ⇒ Boolean (readonly)
Returns This is whether inbound calls are allowed from this gateway. Default is true. @default true.
20 21 22 |
# File 'lib/vapi_server_sdk/types/sip_trunk_gateway.rb', line 20 def inbound_enabled @inbound_enabled end |
#ip ⇒ String (readonly)
Returns 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.
11 12 13 |
# File 'lib/vapi_server_sdk/types/sip_trunk_gateway.rb', line 11 def ip @ip end |
#netmask ⇒ Float (readonly)
Returns This is the netmask of the gateway. Defaults to 32. @default 32.
17 18 19 |
# File 'lib/vapi_server_sdk/types/sip_trunk_gateway.rb', line 17 def netmask @netmask end |
#options_ping_enabled ⇒ Boolean (readonly)
Returns 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 36 37 |
# File 'lib/vapi_server_sdk/types/sip_trunk_gateway.rb', line 35 def end |
#outbound_enabled ⇒ Boolean (readonly)
Returns 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.
25 26 27 |
# File 'lib/vapi_server_sdk/types/sip_trunk_gateway.rb', line 25 def outbound_enabled @outbound_enabled end |
#outbound_protocol ⇒ Vapi::SipTrunkGatewayOutboundProtocol (readonly)
Returns This is the protocol to use for SIP signaling outbound calls. Default is udp. @default udp.
28 29 30 |
# File 'lib/vapi_server_sdk/types/sip_trunk_gateway.rb', line 28 def outbound_protocol @outbound_protocol end |
#port ⇒ Float (readonly)
Returns This is the port number of the gateway. Default is 5060. @default 5060.
14 15 16 |
# File 'lib/vapi_server_sdk/types/sip_trunk_gateway.rb', line 14 def port @port end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::SipTrunkGateway
Deserialize a JSON object to an instance of SipTrunkGateway
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/vapi_server_sdk/types/sip_trunk_gateway.rb', line 93 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) ip = parsed_json["ip"] port = parsed_json["port"] netmask = parsed_json["netmask"] inbound_enabled = parsed_json["inboundEnabled"] outbound_enabled = parsed_json["outboundEnabled"] outbound_protocol = parsed_json["outboundProtocol"] = parsed_json["optionsPingEnabled"] new( ip: ip, port: port, netmask: netmask, inbound_enabled: inbound_enabled, outbound_enabled: outbound_enabled, outbound_protocol: outbound_protocol, options_ping_enabled: , additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given
hash and check each fields type against the current object's property
definitions.
128 129 130 131 132 133 134 135 136 |
# File 'lib/vapi_server_sdk/types/sip_trunk_gateway.rb', line 128 def self.validate_raw(obj:) obj.ip.is_a?(String) != false || raise("Passed value for field obj.ip is not the expected type, validation failed.") obj.port&.is_a?(Float) != false || raise("Passed value for field obj.port is not the expected type, validation failed.") obj.netmask&.is_a?(Float) != false || raise("Passed value for field obj.netmask is not the expected type, validation failed.") obj.inbound_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.inbound_enabled is not the expected type, validation failed.") obj.outbound_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.outbound_enabled is not the expected type, validation failed.") obj.outbound_protocol&.is_a?(Vapi::SipTrunkGatewayOutboundProtocol) != false || raise("Passed value for field obj.outbound_protocol is not the expected type, validation failed.") obj.&.is_a?(Boolean) != false || raise("Passed value for field obj.options_ping_enabled is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of SipTrunkGateway to a JSON object
118 119 120 |
# File 'lib/vapi_server_sdk/types/sip_trunk_gateway.rb', line 118 def to_json(*_args) @_field_set&.to_json end |