FDE Times dataFDE jobs open 922▼2 Change in open roles over 7 days, like-for-like: roles from companies we started tracking this week are left outNew in 7 days 64Companies hiring 201Remote-friendly 23%Median US pay $202kTop hirer Databricks 113
中文VI

The newspaper of the Forward Deployed Engineer

Guides

When a voice agent goes deaf, one line of SDP may be to blame

Establish which direction of audio is missing, and the SDP and RTP packets will show whether to fix an address, a firewall or a codec.

ShareLinkedInFacebookX

In brief

  • The address in SDP tells the other side where to send audio, so advertising a LAN IP usually breaks what the advertising side hears.
  • Opening signaling port 5060 is not enough: RTP ranges vary by platform and must be opened separately.
  • Fix addresses and firewalls first; latching carries security risks that both Twilio and the IETF warn about.
Chart of three port ranges on one axis: the old firewall rule allows far-end ports 10000-20000; ElevenLabs uses 10000-60000, so only 10,001 of its 50,001 ports are covered; Vapi uses 40000-60000, so no ports overlap.
Take a hypothetical old rule allowing only far-end ports 10000-20000: switching to Vapi leaves no ports covered, while after switching to ElevenLabs some calls fall within the open range and others do not. Source: Vapi and ElevenLabs documentation; calculations in the article.

A single LAN address misplaced in SDP is enough to let a caller hear the phone system clearly while the phone system hears nothing back. It is one of the causes Twilio’s troubleshooting guide lists for audio that flows in only one direction.

In voice AI, the fault is easily misdiagnosed. The caller hears the whole greeting, answers, then waits; the agent receives no sound, so it stays silent or asks again. From the outside it looks like a speech recognition failure, and an engineer can lose half a day tuning the model when the audio packets never reached the server.

FDEs who build voice agents therefore need one habit: prove that the audio left and arrived before suspecting the software behind it. You do not have to be a telecoms expert to do so. You only need to read two lines of text and a packet capture.

A ringing phone proves only half the path

A SIP call needs two clear paths. The signaling path carries the invitation, the ringing and the media negotiation; the media path carries audio over RTP. LiveKit’s documentation for self-hosted deployments is explicit: signaling port 5060 and the media range 10000-20000 must both be reachable from the Internet.

If only 5060 is open, the phone can still ring. The client will tell you “the trunk is up,” and as far as signaling goes, they are right. The rest remains untested.

SDP links the two paths. Under RFC 3264, the address and port in an offer state where the offering side wants to receive media, for recvonly or sendrecv streams. The word “receive” is often read backward: if you advertise your own address incorrectly, you break the audio coming to you.

One call, two questions, one wrong line

Take a hypothetical case. Your agent connects to a self-hosted Asterisk server behind the client’s NAT; its internal IP is 10.0.4.17 and its public IP is 203.0.113.25. The caller hears the greeting, but the recording on the agent side is empty.

The first question: which direction is missing? Here, audio still flows from the agent to the caller, but audio from the caller to the agent is lost. Put that sentence in the ticket, with the time and call ID, because “audio is broken” gives nobody enough to act on.

The second question: are the packets arriving? Adjust the port range below to match your configuration, run the command on the SIP server, place a test call, then open the file in Wireshark. If the trunk encrypts signaling, get the SDP from the server’s logs.

sudo tcpdump -ni any -w call.pcap \
  'udp port 5060 or udp portrange 10000-20000'

Asterisk sits between two legs here: one to the trunk, one to the agent. Because -i any captures on every interface, the file may mix RTP from both, and packets arriving from the agent side prove nothing about the caller.

Filter by the trunk’s media IP, taken from the c= line in the SDP the provider sends you. Say it is 198.51.100.20. Two Wireshark display filters then separate the directions:

ip.src == 198.51.100.20 && udp   # from trunk to server
ip.dst == 198.51.100.20 && udp   # from server to trunk

In this example, the trunk leg has outbound RTP but no inbound RTP. In the SDP that Asterisk sends to the trunk provider, you find:

v=0
o=- 1001 1 IN IP4 10.0.4.17
s=-
c=IN IP4 10.0.4.17
t=0 0
m=audio 12040 RTP/AVP 0
a=rtpmap:0 PCMU/8000
a=sendrecv

The c= line advertises 10.0.4.17, and m=audio advertises port 12040. The server is asking the trunk side to send audio to a private address that the Internet cannot route to. To be sure packets are not coming from another of the provider’s IPs, also filter on udp.dstport == 12040.

If that still returns nothing, the symptom, the capture and the SDP all point to the same place, which is enough evidence to make the fix.

Twilio’s guidance is to advertise the WAN IP instead of the LAN IP. In Asterisk PJSIP, external_media_address sets the public IP used for RTP, alongside local_net, which defines the networks treated as internal. The relevant part of the configuration is:

[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0
local_net=10.0.0.0/16
external_media_address=203.0.113.25

Reload the configuration in the way your system requires, call again and read the new SDP: c= must be 203.0.113.25. Then check that RTP is arriving from the trunk. If both sides are talking and the new call still uses port 12040, a healthy trunk leg will show a continuous flow of packets in both directions, such as:

198.51.100.20:30500 -> 10.0.4.17:12040   RTP, PCMU   # caller speaking
10.0.4.17:12040 -> 198.51.100.20:30500   RTP, PCMU   # agent speaking

Seeing 10.0.4.17 here is normal: you are capturing on the server, inside the NAT. Only the address advertised in SDP has to be the public IP. If that address is correct and the first line is still missing, the next suspect is the firewall or NAT rule for the media range.

For self-hosted LiveKit SIP, the company’s documentation names failure to advertise the public IP as the most common cause of one-way audio; the corresponding setting is use_external_ip: true. ElevenLabs also notes that an endpoint behind NAT advertising a private address can send both signaling and audio astray. Check the signaling address as well as the media address.

Reverse the symptom and the suspects change

Now take the opposite direction: the agent hears the caller, but the caller cannot hear the agent. Here the causes Twilio gives include a firewall blocking RTP from the PBX to Twilio, ISP blocking, or too low a TTL on RTP packets. Changing your own public address at this point is likely to be a fix in the wrong place.

Find where the packets disappear, again on the trunk leg. If no RTP leaves the server for the trunk, look at the application and the result of media negotiation. If RTP does leave the server, capture again outside the firewall: if the packets are gone there, the network administrator has the evidence needed to look for a blocking rule.

Check the port number in m=audio too. LiveKit explains that port 0, as in m=audio 0 RTP/AVP 0, means the media stream was rejected during negotiation, and advises confirming that offer and answer share at least one codec. If you see a 0, examine the codecs before asking anyone to open a firewall.

A more awkward case is SDP that leaves the server correct but leaves the router altered. SIP ALG is a router feature that can rewrite packets passing through, and SonicWall lists one-way audio among the symptoms that call for disabling it. Compare the SDP on both sides of the router before asking for it to be turned off; altered content is your evidence.

Port ranges do not carry over between projects

Firewall rules copied from an old project are an easy trap. Platforms do not share a single RTP range, and the numbers in their documentation do not all belong to the same side:

Platform Media range Whose ports What to ask the client
Self-hosted LiveKit SIP 10000-20000 Your server Is the server’s range reachable from the Internet?
Vapi UDP 40000-60000 Vapi’s side Do the existing rules include this range at the far end?
ElevenLabs UDP 10000-60000 ElevenLabs’ side Are both directions allowed?

With self-hosted LiveKit, you ask for destination ports to be opened on your own machine for packets coming in from the Internet. With Vapi or ElevenLabs, the range refers to ports at the far end: destination ports when packets leave the client’s network, source ports when they return.

If the client also puts its own PBX in the middle, the PBX has a separate RTP range, found in its configuration. A request to open ports must therefore say whose ports they are and which way the packets travel.

Test the arithmetic with an old rule that allows only far-end ports 10000-20000. Move to Vapi and the overlap is 0 ports. Move to ElevenLabs and the rule covers only 10,001 of 50,001 ports, so some calls land in the open portion and others do not.

An intermittent fault is easily blamed on a “flaky network.” Record the media ports at both ends of every good call and every failed one, then set them beside the firewall rules. Do this before opening a ticket with the provider.

Latching may cure the fault, but it leaves a debt

One tempting cure is to ignore the advertised address and send audio back to wherever packets just came from. Asterisk does this with rtp_symmetric; Twilio’s Symmetric RTP feature can also resolve one-way audio caused by a NAT that does not understand SIP. It is useful when the remote endpoint sits behind a NAT you cannot fix.

But Twilio disables Symmetric RTP by default on Elastic SIP Trunks and strongly advises against enabling it, because of the risk that RTP could be injected or leak into another call.

RFC 7362 likewise advises against using latching over the Internet unless the security issues are addressed, and mentions alternatives such as ICE. On a client site, fix the address and firewall first; if latching is still needed, the person responsible for security must know and agree.

Send evidence instead of guesses

Client network administrators often get messages like “please open all the ports.” A better request is narrow and verifiable. This template fits the example above, in the situation where the SDP has been corrected but RTP from the trunk still does not arrive:

Symptom: caller hears the agent; agent does not hear the caller.
Evidence: SDP advertises 203.0.113.25; server receives no RTP
  from the trunk in call [call ID], at [time, time zone].
Request: check NAT/UDP rules from the trunk to 10.0.4.17,
  destination ports 10000-20000; report where packets are blocked.
Retest: two test calls, passing when the trunk leg
  has RTP in both directions.

The common mistakes all come from skipping the evidence: reading the other side’s SDP by accident, changing three settings at once, or declaring success after hearing only the greeting. Change one thing at a time. Accept the fix on a conversation in which both sides speak, on inbound and outbound calls alike.

The skill is also easy to demonstrate in a job search. If an FDE posting mentions SIP, telephony or RTP, prepare a story with a packet capture, a hypothesis, a change and a result. On a resume, “isolated a one-way audio fault from SDP and RTP” says more than “experience with voice AI.”

An exercise for this week: set up Asterisk in your lab and place test calls until both sides hear each other clearly. Then deliberately set the wrong media address.

Before you place the call, write down which direction will fail and which packets will be missing. Check your prediction against the capture, fix the setting and call again.

Once you can predict the result before picking up the phone, a silent call at a client site becomes far less daunting.

Was this article useful?

Use with your AI assistantAsk Claude ↗Ask ChatGPT ↗
10 sources
Read next on the roadmap · Stage 3: Applied AITesting LLMs without an answer key, using nothing but pytestYou may not know the right answer, but you can still know how two answers must relate, and that is enough to test on unlabeled client data.