feat: preload the Service-Route set as Route headers on out-of-dialog requests - #143
Open
rizwan3659 wants to merge 2 commits into
Open
feat: preload the Service-Route set as Route headers on out-of-dialog requests#143rizwan3659 wants to merge 2 commits into
rizwan3659 wants to merge 2 commits into
Conversation
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.
… requests Builds on the Service-Route parsing added previously. Adds a `ServiceRoute -> Route` conversion (RFC 3608 §5.2) and `Registration::preloaded_route_set()`, which turns the learned Service-Route set into the Route set a UA preloads on later requests. `InviteOption` gains a `route_set` field; `make_invite_request` emits those entries as Route headers, in order, ahead of caller-supplied headers. The field defaults to empty, so requests that do not set it are unchanged. Tests cover the conversion, ordered Route preloading in `make_invite_request`, and the empty-route-set no-op.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on #142
What
Consumes the Service-Route set that #142 learns at registration and preloads it as a
Routeset on outgoing out-of-dialog requests (RFC 3608 §5.2):impl From<ServiceRoute> for Route— carries the name-addr over verbatim (only the field name differs on the wire);Registration::preloaded_route_set()— returns the learned set asVec<typed::Route>, in registrar order;InviteOption::route_set— a new field whose entriesmake_invite_requestemits as orderedRouteheaders ahead of caller-supplied headers.Why
RFC 3608 §5.2: after registering, a UA uses the returned Service-Route as the route set for subsequent out-of-dialog requests. In IMS this is how an INVITE is forced through the S-CSCF (and any P-CSCF) the network assigned at registration. #142 only learned the set; this PR lets a caller actually apply it:
Compatibility
InviteOption::route_setdefaults to empty (the struct derivesDefaultand all call sites use..Default::default()), so requests that don't set it produce byte-for-byte the same headers as before.Routeentries are pushed (notunique_pushed) because a route set legitimately has multipleRouteheaders.Tests
ServiceRoute -> Routeconversion preserves the name-addr;make_invite_requestpreloads both hops asRouteheaders in the advertised order;route_setadds noRouteheader.cargo build --all-targets,cargo fmt --checkandcargo clippyare clean (no new warnings); the full lib suite passes locally apart from the unrelatedtest_sip_dns_lookup, which needs DNS my sandbox lacks.