Class: Vapi::ByoSipTrunkCredential
- Inherits:
-
Object
- Object
- Vapi::ByoSipTrunkCredential
- Defined in:
- lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#created_at ⇒ DateTime
readonly
This is the ISO 8601 date-time string of when the credential was created.
-
#gateways ⇒ Array<Vapi::SipTrunkGateway>
readonly
This is the list of SIP trunk’s gateways.
-
#id ⇒ String
readonly
This is the unique identifier for the credential.
-
#name ⇒ String
readonly
This is the name of credential.
-
#org_id ⇒ String
readonly
This is the unique identifier for the org that this credential belongs to.
-
#outbound_authentication_plan ⇒ Vapi::SipTrunkOutboundAuthenticationPlan
readonly
This can be used to configure the outbound authentication if required by the SIP trunk.
-
#outbound_leading_plus_enabled ⇒ Boolean
readonly
This ensures the outbound origination attempts have a leading plus.
-
#provider ⇒ String
readonly
This can be used to bring your own SIP trunks or to connect to a Carrier.
-
#sbc_configuration ⇒ Vapi::SbcConfiguration
readonly
This is an advanced configuration for enterprise deployments.
-
#sip_diversion_header ⇒ String
readonly
This can be used to enable the SIP diversion header for authenticating the calling number if the SIP trunk supports it.
-
#tech_prefix ⇒ String
readonly
This can be used to configure the tech prefix on outbound calls.
-
#updated_at ⇒ DateTime
readonly
This is the ISO 8601 date-time string of when the assistant was last updated.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::ByoSipTrunkCredential
Deserialize a JSON object to an instance of ByoSipTrunkCredential.
-
.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(id:, org_id:, created_at:, updated_at:, gateways:, provider: OMIT, name: OMIT, outbound_authentication_plan: OMIT, outbound_leading_plus_enabled: OMIT, tech_prefix: OMIT, sip_diversion_header: OMIT, sbc_configuration: OMIT, additional_properties: nil) ⇒ Vapi::ByoSipTrunkCredential constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of ByoSipTrunkCredential to a JSON object.
Constructor Details
#initialize(id:, org_id:, created_at:, updated_at:, gateways:, provider: OMIT, name: OMIT, outbound_authentication_plan: OMIT, outbound_leading_plus_enabled: OMIT, tech_prefix: OMIT, sip_diversion_header: OMIT, sbc_configuration: OMIT, additional_properties: nil) ⇒ Vapi::ByoSipTrunkCredential
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb', line 76 def initialize(id:, org_id:, created_at:, updated_at:, gateways:, provider: OMIT, name: OMIT, outbound_authentication_plan: OMIT, outbound_leading_plus_enabled: OMIT, tech_prefix: OMIT, sip_diversion_header: OMIT, sbc_configuration: OMIT, additional_properties: nil) @provider = provider if provider != OMIT @id = id @org_id = org_id @created_at = created_at @updated_at = updated_at @name = name if name != OMIT @gateways = gateways @outbound_authentication_plan = outbound_authentication_plan if outbound_authentication_plan != OMIT @outbound_leading_plus_enabled = outbound_leading_plus_enabled if outbound_leading_plus_enabled != OMIT @tech_prefix = tech_prefix if tech_prefix != OMIT @sip_diversion_header = sip_diversion_header if sip_diversion_header != OMIT @sbc_configuration = sbc_configuration if sbc_configuration != OMIT @additional_properties = additional_properties @_field_set = { "provider": provider, "id": id, "orgId": org_id, "createdAt": created_at, "updatedAt": updated_at, "name": name, "gateways": gateways, "outboundAuthenticationPlan": outbound_authentication_plan, "outboundLeadingPlusEnabled": outbound_leading_plus_enabled, "techPrefix": tech_prefix, "sipDiversionHeader": sip_diversion_header, "sbcConfiguration": sbc_configuration }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
46 47 48 |
# File 'lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb', line 46 def additional_properties @additional_properties end |
#created_at ⇒ DateTime (readonly)
Returns This is the ISO 8601 date-time string of when the credential was created.
19 20 21 |
# File 'lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb', line 19 def created_at @created_at end |
#gateways ⇒ Array<Vapi::SipTrunkGateway> (readonly)
Returns This is the list of SIP trunk’s gateways.
25 26 27 |
# File 'lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb', line 25 def gateways @gateways end |
#id ⇒ String (readonly)
Returns This is the unique identifier for the credential.
15 16 17 |
# File 'lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb', line 15 def id @id end |
#name ⇒ String (readonly)
Returns This is the name of credential. This is just for your reference.
23 24 25 |
# File 'lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb', line 23 def name @name end |
#org_id ⇒ String (readonly)
Returns This is the unique identifier for the org that this credential belongs to.
17 18 19 |
# File 'lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb', line 17 def org_id @org_id end |
#outbound_authentication_plan ⇒ Vapi::SipTrunkOutboundAuthenticationPlan (readonly)
Returns This can be used to configure the outbound authentication if required by the SIP trunk.
28 29 30 |
# File 'lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb', line 28 def outbound_authentication_plan @outbound_authentication_plan end |
#outbound_leading_plus_enabled ⇒ Boolean (readonly)
Returns This ensures the outbound origination attempts have a leading plus. Defaults to false to match conventional telecom behavior. Usage:
-
Vonage/Twilio requires leading plus for all outbound calls. Set this to true.
@default false.
34 35 36 |
# File 'lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb', line 34 def outbound_leading_plus_enabled @outbound_leading_plus_enabled end |
#provider ⇒ String (readonly)
Returns This can be used to bring your own SIP trunks or to connect to a Carrier.
13 14 15 |
# File 'lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb', line 13 def provider @provider end |
#sbc_configuration ⇒ Vapi::SbcConfiguration (readonly)
Returns This is an advanced configuration for enterprise deployments. This uses the onprem SBC to trunk into the SIP trunk’s ‘gateways`, rather than the managed SBC provided by Vapi.
44 45 46 |
# File 'lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb', line 44 def sbc_configuration @sbc_configuration end |
#sip_diversion_header ⇒ String (readonly)
Returns This can be used to enable the SIP diversion header for authenticating the calling number if the SIP trunk supports it. This is an advanced property.
40 41 42 |
# File 'lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb', line 40 def sip_diversion_header @sip_diversion_header end |
#tech_prefix ⇒ String (readonly)
Returns This can be used to configure the tech prefix on outbound calls. This is an advanced property.
37 38 39 |
# File 'lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb', line 37 def tech_prefix @tech_prefix end |
#updated_at ⇒ DateTime (readonly)
Returns This is the ISO 8601 date-time string of when the assistant was last updated.
21 22 23 |
# File 'lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb', line 21 def updated_at @updated_at end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::ByoSipTrunkCredential
Deserialize a JSON object to an instance of ByoSipTrunkCredential
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb', line 113 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) provider = parsed_json["provider"] id = parsed_json["id"] org_id = parsed_json["orgId"] created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) name = parsed_json["name"] gateways = parsed_json["gateways"]&.map do |item| item = item.to_json Vapi::SipTrunkGateway.from_json(json_object: item) end if parsed_json["outboundAuthenticationPlan"].nil? outbound_authentication_plan = nil else outbound_authentication_plan = parsed_json["outboundAuthenticationPlan"].to_json outbound_authentication_plan = Vapi::SipTrunkOutboundAuthenticationPlan.from_json(json_object: outbound_authentication_plan) end outbound_leading_plus_enabled = parsed_json["outboundLeadingPlusEnabled"] tech_prefix = parsed_json["techPrefix"] sip_diversion_header = parsed_json["sipDiversionHeader"] if parsed_json["sbcConfiguration"].nil? sbc_configuration = nil else sbc_configuration = parsed_json["sbcConfiguration"].to_json sbc_configuration = Vapi::SbcConfiguration.from_json(json_object: sbc_configuration) end new( provider: provider, id: id, org_id: org_id, created_at: created_at, updated_at: updated_at, name: name, gateways: gateways, outbound_authentication_plan: outbound_authentication_plan, outbound_leading_plus_enabled: outbound_leading_plus_enabled, tech_prefix: tech_prefix, sip_diversion_header: sip_diversion_header, sbc_configuration: sbc_configuration, 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.
171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb', line 171 def self.validate_raw(obj:) obj.provider&.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.gateways.is_a?(Array) != false || raise("Passed value for field obj.gateways is not the expected type, validation failed.") obj.outbound_authentication_plan.nil? || Vapi::SipTrunkOutboundAuthenticationPlan.validate_raw(obj: obj.outbound_authentication_plan) obj.outbound_leading_plus_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.outbound_leading_plus_enabled is not the expected type, validation failed.") obj.tech_prefix&.is_a?(String) != false || raise("Passed value for field obj.tech_prefix is not the expected type, validation failed.") obj.sip_diversion_header&.is_a?(String) != false || raise("Passed value for field obj.sip_diversion_header is not the expected type, validation failed.") obj.sbc_configuration.nil? || Vapi::SbcConfiguration.validate_raw(obj: obj.sbc_configuration) end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of ByoSipTrunkCredential to a JSON object
161 162 163 |
# File 'lib/vapi_server_sdk/types/byo_sip_trunk_credential.rb', line 161 def to_json(*_args) @_field_set&.to_json end |