fix: bind SIP media sockets to signaling interface - #784
Open
AlexanderMatveev wants to merge 4 commits into
Open
fix: bind SIP media sockets to signaling interface#784AlexanderMatveev wants to merge 4 commits into
AlexanderMatveev wants to merge 4 commits into
Conversation
RTP previously always listened on 0.0.0.0, so on multi-homed hosts media could egress via a different IP than SIP signaling. Bind media sockets to SignalingIPLocal so announce and source IP stay aligned.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #784 +/- ##
==========================================
+ Coverage 65.25% 67.04% +1.78%
==========================================
Files 51 41 -10
Lines 6588 8122 +1534
==========================================
+ Hits 4299 5445 +1146
- Misses 1915 2183 +268
- Partials 374 494 +120 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
SignalingIPLocal is an announce value and may equal nat_1_to_1_ip when that address is not local. Bind media via media_listen_ip, then listen_ip, then SignalingIPLocal only if present on an interface; otherwise keep 0.0.0.0.
Do not infer BindIP from SignalingIPLocal. Default remains 0.0.0.0 so multi-interface receive behavior is unchanged unless operators explicitly pin the media NIC.
AlexanderMatveev
force-pushed
the
fix/sip-bindip
branch
from
August 8, 2026 23:04
3ca3288 to
3f62e9d
Compare
Reject unparseable or unspecified media_listen_ip at startup so typos fail fast instead of silently falling back to 0.0.0.0.
AlexanderMatveev
marked this pull request as draft
August 9, 2026 00:51
AlexanderMatveev
marked this pull request as ready for review
August 9, 2026 13:39
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
Adds an opt-in way to bind SIP media (RTP) sockets to a specific local interface, instead of always listening on
0.0.0.0.This is a rebased revival of #659 (closed without merge), updated for review feedback: do not change the default bind address.
Problem
On multi-homed hosts, SIP signaling may use one interface/IP while RTP sockets bound to
0.0.0.0egress via another. Some SIP providers require signaling and media to originate from the same IP.nat_1_to_1_ip/media_nat_1_to_1_iponly affect announce; they do not bind the RTP socket.listen_iponly covers SIP signaling.Change
BindIPtoMediaOptionsmedia_listen_ipmedia_listen_ip→ specificlisten_ip→ else0.0.0.0SignalingIPLocal(announce/discovery value; unsafe as a default bind)BindIPsocket bindOperators who need same-IP media/signaling on multi-homed hosts set
media_listen_ip(or a specificlisten_ip). Everyone else keeps today’s0.0.0.0behavior.Test plan
go test ./pkg/sip/ -run 'TestParseSpecificListenIP|TestResolveMediaBindIP|TestMediaPortBindIP'media_listen_ipset to the signaling NIC