Class: DIDWW::ComplexObject::Configuration::SipConfiguration
- Defined in:
- lib/didww/complex_objects/configurations/sip_configuration.rb
Constant Summary collapse
- DIVERSION_RELAY_POLICY_NONE =
Type: String Nullable: Yes Description: Server-generated SIP authentication password, returned in
responses when `enabled_sip_registration` is true. Read-only; the API rejects any write attempt with 400 Param not allowed. (API 2026-04-16) 'none'- DIVERSION_RELAY_POLICY_AS_IS =
'as_is'- DIVERSION_RELAY_POLICY_SIP =
'sip'- DIVERSION_RELAY_POLICY_TEL =
'tel'- DIVERSION_RELAY_POLICIES =
[ DIVERSION_RELAY_POLICY_NONE, DIVERSION_RELAY_POLICY_AS_IS, DIVERSION_RELAY_POLICY_SIP, DIVERSION_RELAY_POLICY_TEL ].freeze
- DIVERSION_INJECT_MODE_NONE =
'none'- DIVERSION_INJECT_MODE_DID_NUMBER =
'did_number'- DIVERSION_INJECT_MODES =
[ DIVERSION_INJECT_MODE_NONE, DIVERSION_INJECT_MODE_DID_NUMBER ].freeze
- NETWORK_PROTOCOL_PRIORITY_FORCE_IPV4 =
'force_ipv4'- NETWORK_PROTOCOL_PRIORITY_FORCE_IPV6 =
'force_ipv6'- NETWORK_PROTOCOL_PRIORITY_ANY =
'any'- NETWORK_PROTOCOL_PRIORITY_PREFER_IPV4 =
'prefer_ipv4'- NETWORK_PROTOCOL_PRIORITY_PREFER_IPV6 =
'prefer_ipv6'- NETWORK_PROTOCOL_PRIORITIES =
[ NETWORK_PROTOCOL_PRIORITY_FORCE_IPV4, NETWORK_PROTOCOL_PRIORITY_FORCE_IPV6, NETWORK_PROTOCOL_PRIORITY_ANY, NETWORK_PROTOCOL_PRIORITY_PREFER_IPV4, NETWORK_PROTOCOL_PRIORITY_PREFER_IPV6 ].freeze
- MEDIA_ENCRYPTION_MODES =
[ 'disabled', 'srtp_sdes', 'srtp_dtls', 'zrtp' ].freeze
- STIR_SHAKEN_MODES =
[ 'disabled', 'original', 'pai', 'original_pai', 'verstat' ].freeze
- DEFAULTS =
{ username: DID_PLACEHOLDER, port: '5060', tx_dtmf_format_id: 1, sst_min_timer: 600, sst_max_timer: 900, sst_refresh_method_id: 1, sst_accept_501: true, sip_timer_b: 8000, dns_srv_failover_timer: 2000, rtp_timeout: 30, auth_enabled: false, max_transfers: 0, max_30x_redirects: 0, codec_ids: DEFAULT_CODEC_IDS, rerouting_disconnect_code_ids: DEFAULT_REROUTING_DISCONNECT_CODE_IDS, transport_protocol_id: 1 }.freeze
- RECOMMENDED =
DEFAULTS.merge( #-- Authentication auth_user: '', auth_password: '', auth_from_user: '', auth_from_domain: '', #-- Media & DTMF rx_dtmf_format_id: 1, rtp_ping: false, force_symmetric_rtp: false, symmetric_rtp_ignore_rtcp: false, #-- Advanced Signalling Settings sst_enabled: false, sst_session_expires: '', ).freeze
Constants inherited from Base
Base::CODECS, Base::DEFAULT_CODEC_IDS, Base::DEFAULT_REROUTING_DISCONNECT_CODE_IDS, Base::DID_PLACEHOLDER, Base::REROUTING_DISCONNECT_CODES, Base::RX_DTMF_FORMATS, Base::SST_REFRESH_METHODS, Base::TRANSPORT_PROTOCOLS, Base::TX_DTMF_FORMATS
Constants inherited from Base
Instance Method Summary collapse
-
#enabled_sip_registration=(val) ⇒ Object
Auto-cascade for server-enforced field dependencies (2026-04-16).
- #host=(val) ⇒ Object
- #rx_dtmf_format ⇒ Object
- #sst_refresh_method ⇒ Object
- #transport_protocol ⇒ Object
- #tx_dtmf_format ⇒ Object
Methods inherited from Base
#[], #[]=, #as_json, #as_json_api, #attributes, cast, #initialize, #inspect, property, read_only_attributes, schema, sensitive_attributes, type, #type
Constructor Details
This class inherits a constructor from DIDWW::ComplexObject::Base
Instance Method Details
#enabled_sip_registration=(val) ⇒ Object
Auto-cascade for server-enforced field dependencies (2026-04-16).
The server validates these combinations and rejects mismatches with 422; the SDK fixes them up at assignment time so user code never has to track the full server-side rule set. Future server-required cascades are added here without the caller needing to know.
Rules:
* `enabled_sip_registration = true` => host = nil, port = nil
(server requires both blank when registration is enabled)
* `enabled_sip_registration = false` => use_did_in_ruri = false
(server requires use_did_in_ruri disabled when sip_registration is)
* `host = <non-nil>` => enabled_sip_registration = false,
use_did_in_ruri = false (host requires sip_registration disabled,
which in turn requires use_did_in_ruri disabled)
Constructor-time ‘[]=` assignments bypass these setters intentionally so that responses returned from the server (e.g. a fixture with `enabled_sip_registration: true` AND `host: nil`) deserialize as-is.
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 |
# File 'lib/didww/complex_objects/configurations/sip_configuration.rb', line 350 def enabled_sip_registration=(val) case val when true # Always emit host: null and port: null on the wire when # enabling sip_registration. The server requires both blank # (returns 422 otherwise) AND a PATCH against an existing # trunk that already has host/port set on the server side # MUST explicitly nullify them — the SDK's local attributes # hash starts empty, so there's nothing to "preserve". self[:host] = nil self[:port] = nil when false # Server requires use_did_in_ruri = false whenever sip_registration # is disabled. Always emit it on the wire so the server's check # passes regardless of the prior state of the field. self[:use_did_in_ruri] = false else # `nil` (or any non-bool) — caller is unsetting the field. No # cascade: dependent fields stay as the caller left them. end self[:enabled_sip_registration] = val end |
#host=(val) ⇒ Object
373 374 375 376 377 378 379 380 381 382 383 |
# File 'lib/didww/complex_objects/configurations/sip_configuration.rb', line 373 def host=(val) unless val.nil? # Setting host implies sip_registration is disabled (server-side # validation), which in turn implies use_did_in_ruri = false. # Always emit both on the wire so the server's checks pass # without the caller having to know the rule set. self[:enabled_sip_registration] = false self[:use_did_in_ruri] = false end self[:host] = val end |
#rx_dtmf_format ⇒ Object
319 320 321 |
# File 'lib/didww/complex_objects/configurations/sip_configuration.rb', line 319 def rx_dtmf_format RX_DTMF_FORMATS[rx_dtmf_format_id] end |
#sst_refresh_method ⇒ Object
315 316 317 |
# File 'lib/didww/complex_objects/configurations/sip_configuration.rb', line 315 def sst_refresh_method SST_REFRESH_METHODS[sst_refresh_method_id] end |
#transport_protocol ⇒ Object
327 328 329 |
# File 'lib/didww/complex_objects/configurations/sip_configuration.rb', line 327 def transport_protocol TRANSPORT_PROTOCOLS[transport_protocol_id] end |
#tx_dtmf_format ⇒ Object
323 324 325 |
# File 'lib/didww/complex_objects/configurations/sip_configuration.rb', line 323 def tx_dtmf_format TX_DTMF_FORMATS[tx_dtmf_format_id] end |