Skip to content

feat: add typed Service-Route (RFC 3608) header - #142

Open
rizwan3659 wants to merge 1 commit into
restsend:mainfrom
rizwan3659:feat/rfc3608-service-route
Open

feat: add typed Service-Route (RFC 3608) header#142
rizwan3659 wants to merge 1 commit into
restsend:mainfrom
rizwan3659:feat/rfc3608-service-route

Conversation

@rizwan3659

Copy link
Copy Markdown

What

Adds first-class support for the Service-Route header (RFC 3608), modelled on the existing Route/Record-Route headers:

  • untyped ServiceRoute storage + Header enum variant, Display, name and value() arms, and parser dispatch for Service-Route;
  • typed ServiceRoute (display_name, uri, params) reusing the shared name-addr parser and comma splitter, with parse_header_list, Display, and the usual From conversions;
  • service_route_headers() / service_route_header() / typed_service_route_headers() on HeadersExt;
  • Registration records the Service-Route set from a REGISTER 200 OK and exposes it via Registration::service_route().

Why

The stack already advertises Supported: path, outbound on REGISTER but never reads the registrar's answer back. Per RFC 3608, the Service-Route set returned in the REGISTER 200 OK is the route set a UA should use for subsequent out-of-dialog requests — in IMS this is the originating route set advertised by the S-CSCF. Today those headers fall through to Header::Other and are silently dropped.

Scope

This PR only learns and exposes the set. Applying it to outgoing requests (preloading Route headers) changes call behaviour and is intentionally left to the caller / a follow-up, so existing dialogs are unaffected.

Tests

Unit tests cover single/multi-value parsing, display round-trip, typed↔header conversion, and end-to-end extraction from a 200 OK. cargo build, cargo fmt --check and cargo clippy are clean; the full lib suite passes locally (the unrelated test_sip_dns_lookup fails in my sandbox because it needs DNS).

Model Service-Route as a typed header alongside Route/Record-Route:
untyped storage, the Header enum wiring and parser dispatch, a typed
`ServiceRoute` (display-name, uri, params) reusing the shared name-addr
parser and list splitter, and `service_route_headers()` /
`typed_service_route_headers()` accessors on HeadersExt.

Registration now records the Service-Route set from a REGISTER 200 OK and
exposes it via `Registration::service_route()`. This is the route set an
IMS S-CSCF advertises for originating requests. Applying it to outgoing
requests (preloading Route headers) is intentionally left to the caller,
so this change adds no behavioural change to existing dialogs.

Adds unit tests for single/multi-value parsing, display round-trip, the
typed<->header conversion, and end-to-end extraction from a 200 OK.
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