Skip to content

fix: bind SIP media sockets to signaling interface#659

Open
8thgencore wants to merge 1 commit intolivekit:mainfrom
8thgencore:fix/sip-bindip
Open

fix: bind SIP media sockets to signaling interface#659
8thgencore wants to merge 1 commit intolivekit:mainfrom
8thgencore:fix/sip-bindip

Conversation

@8thgencore
Copy link
Copy Markdown

Summary

This change binds SIP media sockets to the same local interface used for SIP signaling instead of listening on 0.0.0.0.

Problem

In multi-homed / NATed production environments, SIP signaling and RTP could leave the host through different interfaces/IPs:

  • SIP signaling was advertised and sent using the configured signaling IP
  • RTP sockets were created on 0.0.0.0
  • The kernel could then route media through a different interface/public IP

Some SIP providers validate that registration/signaling and call media originate from the same IP. In our case this caused providers to reject calls as illegitimate.

Change

  • Added BindIP to MediaOptions
  • Changed NewMediaPortWith to bind RTP sockets to BindIP when provided
  • Passed SignalingIPLocal as BindIP for both outbound and inbound SIP media

Expected result

RTP now uses the same local interface as SIP signaling, which makes the effective external path much more stable and avoids cases where providers reject calls because signaling and media appear to originate from different IPs.

Notes

This change is intentionally narrow:

  • no registration logic changes
  • no config/API changes
  • only socket binding behavior for SIP media

@8thgencore 8thgencore requested a review from a team as a code owner April 18, 2026 12:19
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 18, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.26%. Comparing base (0460b40) to head (115898d).
⚠️ Report is 264 commits behind head on main.

Files with missing lines Patch % Lines
pkg/sip/media_port.go 50.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main     #659    +/-   ##
========================================
  Coverage   65.25%   65.26%            
========================================
  Files          51       37    -14     
  Lines        6588     7148   +560     
========================================
+ Hits         4299     4665   +366     
- Misses       1915     2012    +97     
- Partials      374      471    +97     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants