Skip to content

feat: complete SipConfiguration attributes for API 2026-04-16 - #114

Merged
Fivell merged 5 commits into
masterfrom
feat/incoming-auth-credentials
May 5, 2026
Merged

feat: complete SipConfiguration attributes for API 2026-04-16#114
Fivell merged 5 commits into
masterfrom
feat/incoming-auth-credentials

Conversation

@Fivell

@Fivell Fivell commented Apr 30, 2026

Copy link
Copy Markdown
Member

Summary

Completes the API 2026-04-16 Sip configuration attribute set. Mirrors the Ruby reference PR #80.

5 writable attributes (missed during the original 2026-04-16 rollout)

These attributes the server accepts under API 2026-04-16 and are listed in the public 2026-04-16 changelog, but were absent from both this SDK and the public Postman collection. Server is authoritative — added all five:

PHP method Wire Type
getEnabledSipRegistration / setEnabledSipRegistration enabled_sip_registration bool
getUseDidInRuri / setUseDidInRuri use_did_in_ruri bool
getNetworkProtocolPriority / setNetworkProtocolPriority network_protocol_priority NetworkProtocolPriority enum
getDiversionInjectMode / setDiversionInjectMode diversion_inject_mode DiversionInjectMode enum
getCnamLookup / setCnamLookup cnam_lookup bool

Two new backed enums added under Didww\Enum\:

  • DiversionInjectModenone, did_number
  • NetworkProtocolPriorityforce_ipv4, force_ipv6, any, prefer_ipv4, prefer_ipv6

2 read-only attributes

Server-generated, returned only when enabled_sip_registration is true:

  • incoming_auth_username (getIncomingAuthUsername)
  • incoming_auth_password (getIncomingAuthPassword)

The API rejects writes (400 Param not allowed). To prevent accidental round-trip echo, Sip::toJsonApiArray() strips the read-only attributes from the JSON:API payload before serialization. The list is declared as a class constant (Sip::READ_ONLY_ATTRIBUTES) for clarity.

Misc

  • No composer.json version bump (Packagist resolves from git tag — bump happens at release time).

Test plan

  • vendor/bin/phpunit — 244 tests / 1232 assertions, all passing
  • composer check-style (php-cs-fixer --dry-run) — clean
  • New tests cover reader access for all 7 2026-04-16 attrs and the read-only-strip regression
  • CI green

@Fivell Fivell changed the title feat: complete V3.5 SipConfiguration attributes for API 2026-04-16 feat: complete SipConfiguration attributes for API 2026-04-16 May 4, 2026
@Fivell
Fivell force-pushed the feat/incoming-auth-credentials branch from 27b05d5 to f27189a Compare May 4, 2026 15:02
Fivell added 2 commits May 4, 2026 17:37
Adds the 5 writable + 2 read-only SIP registration attributes
introduced in API 2026-04-16: enabled_sip_registration,
use_did_in_ruri, cnam_lookup, network_protocol_priority,
diversion_inject_mode plus server-generated incoming_auth_username
and incoming_auth_password (returned only when sip_registration is
enabled, stripped from POST/PATCH bodies because the API rejects
writes with 400 Param not allowed).

Includes wire-format coverage of the create / read / disable PATCH
flows, fixture alignment with real sandbox responses, and the
SDK-specific changes needed to land the feature cleanly (typing /
nullability fixes, read-only enforcement at the type level,
constructor / builder ergonomics).
Override the SDK's idiomatic debug/log surface to replace credential
field values with [FILTERED] before they reach default print(),
logger output, debugger inspection, or unhandled exception traces.
The wire payload is unaffected — serializers continue to emit the
real values (or strip read-only ones via the existing read-only
mechanism).

Marks SIP auth_password and the server-generated incoming_auth_*
on SipConfiguration, plus username and password on the
credentials_and_ip authentication method, as sensitive.
@Fivell
Fivell force-pushed the feat/incoming-auth-credentials branch from 19ed69a to b476b94 Compare May 4, 2026 15:37
@sonarqubecloud

sonarqubecloud Bot commented May 4, 2026

Copy link
Copy Markdown

@Fivell
Fivell force-pushed the feat/incoming-auth-credentials branch from b476b94 to 11ad99d Compare May 4, 2026 16:19
Fivell added 3 commits May 5, 2026 00:30
The server enforces multi-field invariants on the sip_registration
toggle (host / port must be absent when enabled, use_did_in_ruri
must be false when disabled). The SDK now applies those cascades
automatically so caller code never has to enumerate the rule set:

  - enabled_sip_registration = true  -> host = null, port = null
                                         (always emitted on the wire,
                                         even on a fresh config)
  - enabled_sip_registration = false -> use_did_in_ruri = false
  - host = <non-blank>               -> enabled_sip_registration = false,
                                         use_did_in_ruri = false

The host/port nullification fires unconditionally so a PATCH against
an existing trunk that already has them persisted server-side is
told to clear them — a conditional cascade would silently drop the
fields and the server would reject the merged request with 422.

The cascade fires only on application-driven assignments;
deserialization of server responses (which are already internally
consistent) bypasses it so existing combinations are not
clobbered.
Add a SIP registration usage section to the README that explains
the cascade rules and shows the enable / disable examples. The
disable example is a single setHost() / config.host = '...' call —
the cascade flips the dependent fields automatically.
The same 12-line __debugInfo() override that masks credential
attributes lives on two unrelated base classes: Item\Configuration\Base
and Item\AuthenticationMethod\Base. Extract the shared logic and
the $sensitiveAttributes property into a Didww\Traits\Redacts-
SensitiveAttributes trait, mirroring the existing Didww\Traits\
HasSafeAttributes / HasEnumAttributes pattern. Both base classes now
`use RedactsSensitiveAttributes` and the duplicate is gone.

Behaviour is unchanged — the trait's `__debugInfo()` body is
character-for-character identical to the previous inline methods, and
the existing redaction tests on both base classes continue to pass.
@Fivell
Fivell force-pushed the feat/incoming-auth-credentials branch from bc7396f to 8d89eda Compare May 4, 2026 22:31
@sonarqubecloud

sonarqubecloud Bot commented May 4, 2026

Copy link
Copy Markdown

@Fivell
Fivell merged commit 2667396 into master May 5, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant