Lesson 8 / Unit 2: Self-Hosted Stack
NAT Troubleshooting
Calls connected and the caller heard nothing. We fixed the advertised IP and the audio stayed one way. Three days later: NAT had rewritten the port too. The one-line fix.
Calls connected. Signalling was clean. The caller sent RTP and received nothing.
The original diagnosis took three days. Comparing SDP with observed RTP made the missing piece visible.
You’ll see why fixing the advertised address is necessary and still not enough, what NAT does to the source port, how to confirm it in a packet capture, and the one config line that fixes it.
Advertised Addresses
The SDP answer advertised a private address, so the cause looked clear: the media server was telling the caller to send audio to an address the caller could not reach. Fix the advertised address, fix the call.
On the LiveKit SIP service, that part of the fix is use_external_ip: true (or an explicit nat_1_to_1_ip), and LiveKit’s own SIP troubleshooting guide names it as the most common cause of one-way audio when self-hosting.
We fixed the address. The audio stayed one way.
NAT Translation
An SDP answer says: send media to this address and this port. The caller obeys. The packets arrive having passed through NAT, which rewrote the source address and, critically, the source port.
The media server then replies to the address and port in the caller’s SDP, which is what the caller believed about itself before NAT touched the packets. The caller cannot actually be reached there.
Here is what that looks like with example addresses:
| What | Address and port |
|---|---|
| Caller’s SDP says “send to me at” | 10.0.4.17:16384 |
| RTP actually arrives from | 198.51.100.23:9012 |
| Server replies (case study) | 10.0.4.17:16384 |
| Server replies (symmetric RTP) | 198.51.100.23:9012 |
Correcting the advertised address fixes half the problem and leaves the other half, because NAT rewrites the port too. There is no address you can put in an SDP that survives a translation the sender cannot see.
NAT rewrites the source port. Replying to the SDP address loses the audio; replying to where the packets came from brings it back.
Open full sizeSymmetric RTP
Tell the SIP service to reply to where the packets actually came from:
# livekit sip config.yamlsymmetric_rtp: trueWith it set, the service sends RTP back to the observed source address and port of the caller’s media, whatever the SDP said. Use this only with the expected, authenticated carrier media path. The setting is present in the LiveKit SIP configuration source; it is not a substitute for trunk authentication or firewall policy.
The name comes from RFC 4961, which defines symmetric RTP as sending and receiving a stream on the same address and port. An endpoint that behaves that way is one you can safely reply to at its observed source.
Packet Inspection
Put the SDP and the RTP side by side. On the SIP host, capture while you place a test call:
tcpdump -n -i any -w call.pcap udp port 5060 or udp portrange 10000-20000Open the file in Wireshark and compare two things:
- The
c=address andm=audioport in the caller’s SDP. - The source address and port of the RTP packets that arrive from the caller.
If they differ, investigate NAT or an intermediate media relay, and replying to the SDP values will send your audio nowhere. If the service’s outbound RTP goes to the SDP values while inbound RTP arrives from somewhere else, you are looking at this bug.
Why it took three days: the failure has no error. The call establishes, holds its full duration, and tears down cleanly. The signalling counters we inspected read healthy. And we had a plausible wrong answer early: the advertised address genuinely was wrong, and fixing it genuinely was necessary. It just was not sufficient. A partially correct diagnosis is harder to abandon than a clearly wrong one.
The same shape (the call is up, the audio is gone, no log line anywhere) comes back at scale in port exhaustion, and it is the whole subject of failures your metrics don’t show. If you haven’t opened the SIP RTP range yet, start with the SIP service’s port list.
Debugging habit
When a fix is clearly correct and changes nothing, stop asking whether it was correct and ask what else is true at the same time. That question, asked on day one, is worth three days.
Common questions
Why do LiveKit SIP calls connect with one-way audio?
NAT is one possible cause, alongside firewall rules, codec negotiation and track subscriptions. First check that the SIP service advertises its public IP in SDP (use_external_ip: true). If captures show a different source port, and the service is replying to the port in the caller's SDP instead of where the packets came from.
What does symmetric_rtp do in the LiveKit SIP config?
It makes the SIP service send media back to the address and port the caller's RTP actually arrived from, ignoring what the caller's SDP claimed. That survives NAT, which rewrites the source port in a way the caller cannot see or advertise.
We do this work for teams shipping voice agents: Self-Hosted Voice Agent .
Edit this lesson on GitHub ↗Discussion
Questions, corrections and war stories welcome. Sign in with GitHub to comment.