Repository navigation
fix(dialog): keep a caller-built INVITE Contact on stream transports - #213
Merged
yeoleobun merged 1 commit intoOct 24, 2026
Merged
Conversation
make_invite_request replaced the Contact host and port with the local address of the outgoing stream connection, and switched the scheme to sips over TLS, even when the caller had built the Contact deliberately. Behind NAT the caller usually needs the address a registrar reported (the Contact in the REGISTER 200 OK), so overwriting it sent an unreachable Contact, and some registrars reject a sips Contact paired with a sip Request-URI. A Contact that already names its transport is now treated as caller-built and sent unchanged. Contacts without a transport parameter keep the existing behavior, so current callers are unaffected. Refs restsend#209 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes #209.
Problem
make_invite_requestrewrites the Contact on stream transports: it replaces the host and port with the local address of the outgoing connection and switches the scheme tosipsover TLS. It does this even when the caller passed a Contact built on purpose.Behind NAT a UA usually wants to advertise the address the registrar reported (the Contact in the REGISTER 200 OK), so the rewrite produces an unreachable Contact. Over TLS it also pairs a
sips:Contact with asip:Request-URI, which some registrars reject with 400.Change
A Contact that already carries a
transportparameter is treated as built by the caller and sent unchanged. Contacts without one behave exactly as before, so existing callers are unaffected (the existing TCP, TLS and no-transport Contact tests pass unchanged).The behavior is documented on
InviteOption::contact.Tests
test_make_invite_request_keeps_caller_built_contact(TLS listener, caller-builtsip:...;transport=tlsContact): fails before this change, passes after.cargo test --lib: 482 passed.Only the two files above changed;
cargo fmtfrom a newer toolchain also reformatted unrelated files, and those changes were left out.🤖 Generated with Claude Code