Repository navigation
Conversation
th_params_dup() pointed the callee username at the start of the
block, over the caller one, so the caller's bytes were overwritten
by the callee's. topo_dlg_onroute() reads the caller username from
that copy, so in-dialog requests towards the callee carried the
callee username, cut to the caller's length: with
topology_hiding("U", "/alice/bobbylonger") a re-INVITE went out
with Contact sip:bobby@...
Lay the two out one after the other, and skip the copy of a username
that is not set.
Lt-Flash
force-pushed
the
fix/th-dlg-contact-users
branch
from
December 1, 2026 09:51
f7b96c7 to
432eefb
Compare
topo_dlg_onroute() read the saved usernames as a single str, so every in-dialog request used the caller username, the one meant for the caller, whatever its direction. A caller re-INVITE showed the callee the caller username, while the initial INVITE had shown it the callee one. Pick the username by direction, the way dlg_th_onreply() does for replies: the caller username upstream, the callee one downstream.
Lt-Flash
force-pushed
the
fix/th-dlg-contact-users
branch
from
December 1, 2026 18:07
432eefb to
1b50d52
Compare
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.
Summary
With
topology_hiding("U", "/caller/callee")in dialog mode, in-dialog requests carry the wrong Contact username in both directions. Fixes #4513.Details
The
callerusername is the one shown to the caller, and thecalleeusername is the one shown to the callee. The initial INVITE and its replies get this right. In-dialog requests take the usernames from a copy kept on the dialog, and that path has two bugs:th_params_dup()pointed the callee username at the start of the block, over the caller username, so the callee's bytes overwrote the caller's.topo_dlg_onroute()read the copy as a singlestr, so every in-dialog request used the caller username, whichever way it went.With
topology_hiding("U", "/alice/bobbylonger"), both a caller re-INVITE and a callee re-INVITE went out withsip:bobby@. The caller re-INVITE should carrybobbylongerand the callee re-INVITEalice.Solution
th_params_dup(): the caller username now goes at the start of the block and the callee username right after it. A username that is not set is not copied.topo_dlg_onroute(): the username is chosen by direction: the caller username upstream and the callee username downstream. This is howdlg_th_onreply()already does it for replies.Dialogs restored from the database or a cluster peer use the same code, so they are fixed too.
Compatibility
In-dialog requests now carry the username the script asked for. Calls that don't pass any usernames are not affected.
Testing
Tested on master 98ee38b with a SIP test script against a dialog-mode proxy using the config above. The script sends INVITE, 200, ACK, then a re-INVITE from each side, and checks the Contact that each side receives:
The module also builds clean with gcc and clang-19
-Werror.