fix: detect lr parameter with value as loose routing in ACK#105
Merged
yeoleobun merged 1 commit intorestsend:mainfrom Mar 23, 2026
Merged
fix: detect lr parameter with value as loose routing in ACK#105yeoleobun merged 1 commit intorestsend:mainfrom
yeoleobun merged 1 commit intorestsend:mainfrom
Conversation
Some SIP proxies (e.g., Kamailio) send Record-Route with ;lr=on
instead of bare ;lr. The rsip crate parses ;lr=on as
Param::Other("lr", Some("on")) since Param::Lr only matches the
valueless form (;lr with no =value).
This causes make_ack to fall into the strict routing branch,
putting the Record-Route URI as the Request-URI and the Contact
as the Route header. The ACK is then sent to the Contact address
(often an unreachable internal IP behind a load balancer) instead
of through the Record-Route proxy. The remote side never receives
the ACK and terminates the call with "ACK Timeout".
The fix checks for both Param::Lr and Param::Other where the
name is "lr" (case-insensitive), matching ;lr, ;lr=on, ;lr=true,
etc. as loose routing per RFC 3261 Section 16.6.
cd49cf6 to
2826f12
Compare
Collaborator
|
Thanks |
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.
Problem
Some SIP proxies (e.g., Kamailio) send
Record-Routewith;lr=oninstead of bare;lr:The
rsipcrate parses;lr=onasParam::Other("lr", Some("on"))sinceParam::Lronly matches the valueless form (;lrwith no=value).This causes
make_ackto fall into the strict routing branch instead of loose routing:10.x.x.x) is placed in the Route headerdestination_from_requestpicks the Route header as the UDP destinationThis is similar to the issue fixed in PR #100 (incorrect Request-URI for ACK), but for the
lrparameter detection specifically.Fix
Check for both
Param::LrandParam::Otherwhere the name is"lr"(case-insensitive):This matches
;lr,;lr=on,;lr=true, etc. as loose routing per RFC 3261 Section 16.6.Testing
Tested with a SIP proxy that sends
Record-Route: <sip:proxy.example.com;lr=on;...>:10.x.x.x:5060), call dies after 30sNote
The root cause is in the
rsipcrate'sParamparser which only matches bare;lrasParam::Lr(line 119 inrsip/src/common/uri/param/mod.rs). A fix there would also resolve this, but the workaround inmake_ackis simpler and handles anylrvariant.