SIP ALG is a router feature that is meant to help VoIP through NAT but often stops it working. This is a practical guide: how to tell whether SIP ALG is affecting your phones, how to switch it off on common routers, and what to do when you can't.
What SIP ALG does, in one paragraph
An Application Layer Gateway for SIP watches unencrypted SIP traffic, normally on port 5060, and rewrites the private IP addresses inside SIP headers and SDP bodies so that they match the router's public address. Each implementation does this differently, and many get it wrong: they rewrite headers that should be left alone, miss some addresses, or open the wrong ports for audio. The phone system and the phone then disagree about where audio and signalling should go.
The problem SIP ALG was meant to solve
SIP puts IP addresses inside its messages: in the Via and Contact headers, and in the SDP body that says where to send the audio. A phone on an office network writes its private address (for example 192.168.1.20) into those fields. Once the router has translated the packet to its public address, the PBX or provider on the internet sees an address it cannot reach. Without help, calls connect with no audio, or incoming calls never arrive.
A SIP ALG tries to fix this inside the router. It reads unencrypted SIP, replaces private addresses with public ones, and opens temporary firewall holes for the audio ports it finds in the SDP.
What it does not affect
An ALG can only change what it can read. SIP over TLS (usually port 5061) is encrypted, so the ALG cannot see it. Browser softphones carry SIP over an encrypted WebSocket and find a route for audio with ICE, STUN and TURN, so a SIP ALG is not normally the cause of problems with WebRTC calls. The Siperb knowledge base has a short explainer on what STUN is, and SoftPage's article on STUN and TURN servers goes further.
Symptoms
- Phones register, then drop off or fail to re-register.
- One-way or no audio on calls that connect.
- Calls that end after about 30 seconds, because the acknowledgement of the answered call does not reach the phone that answered.
- Inbound calls that never ring, while outbound calls work.
None of these proves SIP ALG on its own; firewall rules and NAT settings on the PBX cause the same symptoms. The guide to fixing one-way audio covers the other causes.
How to check
Capture the same SIP message at both ends: on the phone's network (or in the phone's own log) and on the PBX, with sngrep or Wireshark. Compare the Via and Contact headers and the c= line of the SDP. If addresses or ports changed between the two captures in ways your own NAT settings don't explain, something in the path is rewriting SIP, and the router's ALG is the usual suspect.
A quick test is to move the phone to TLS on port 5061, or to a non-standard SIP port. If the problem disappears, an ALG on port 5060 was very likely the cause.
Prove it with a controlled A/B test
Before changing any PBX settings:
- Place a call from a network you control (where you can change router settings).
- Capture a PCAP on the PBX/SBC side, or at least on the client LAN.
- Disable SIP ALG on the router or firewall.
- Place the same call again and compare.
For the media side, Wireshark's RTP Player is still one of the quickest ways to stop arguing and start proving. If one-way audio disappears as soon as ALG is off, you have your culprit, or at least you've removed a major source of SDP/RTP distortion.
How to disable it
- MikroTik (RouterOS):
/ip firewall service-port disable sip - Ubiquiti EdgeRouter and USG (EdgeOS): in configuration mode,
set system conntrack modules sip disable, thencommitandsave. Intermedia's EdgeRouter X configuration guide shows the same steps. - Netgear: on most models the option is under the WAN or advanced settings as "Disable SIP ALG"; see Netgear's own instructions.
- Linux-based firewalls: the SIP helper is the
nf_conntrack_sipkernel module; unload it and stop it loading at boot. - ISP-supplied routers: many have no visible setting. Ask the provider to switch the ALG off, or put the router into bridge or modem mode and use your own firewall.
Restart the phones afterwards so they register afresh. Some routers only apply the setting after a reboot.
When you cannot switch it off
Moving SIP to TLS (port 5061) hides the signalling from the ALG, and moving to a non-standard UDP port usually takes it out of the path. Where WebRTC calls still lose audio, the cause is normally elsewhere; Innovate Asterisk's STUN and TURN NAT guide for Asterisk is a good next step.
The catch: SIP ALG can mask deeper NAT problems
Sometimes the ALG made things "sort of" work by accident. Disabling it can expose NAT issues you still need to fix properly:
- Source-port rewriting that breaks RTP return paths.
- UDP timeouts too aggressive for real-world VoIP.
- Inconsistent NAT policies across interfaces or VLANs.
If you run pfSense, Netgate's Configuring NAT for VoIP Phones is worth bookmarking.
Post-fix verification checklist
- SDP sanity: are the advertised IPs and ports believable for the call leg?
- RTP presence: do you see RTP/SRTP in both directions?
- Consistency: does it work across at least two networks (home and corporate/LTE)?
- Regression check: does audio stay stable across several calls, not just the first lucky one?
One repeatable habit: always confirm media direction with a capture before you change the next setting. It saves hours.
Originally published on SoftPage.
