Skip to main content

Your Softphone Says "Registered". So Why Does Nobody's Call Ever Ring?

A 200 OK to REGISTER proves only one direction. The registrar may have stored your LAN Contact, or the NAT dropped the UDP mapping long before the next re-REGISTER. RFC 3261, 3581, 4787 and 5626, the Kamailio and Asterisk knobs, and a small TypeScript tool that reads the trace

Updated 8 min readMarkdown
Your Softphone Says "Registered". So Why Does Nobody's Call Ever Ring?

The softphone shows a green dot: Registered. The PBX's location table lists the extension with an hour left on its binding. A customer dials in, the PBX sends the INVITE, and nothing happens. No ring, no 100 Trying, straight to voicemail.

A 200 OK to REGISTER only proves one direction: the UA could reach the registrar. An inbound call needs the other one, usually through a NAT. Two things decide whether that works, and the green dot shows neither: which Contact the registrar stored, and whether the NAT still has the UDP mapping when the INVITE arrives.

To check both quickly, I wrote a small tool, sip-register-nat-doctor. Give it a text SIP trace and it tells you what the registrar stored, how long the UA was silent, where the INVITE went, and which config knob fixes it.

Failure 1: the registrar stored your LAN address

RFC 3261 section 10.3 is literal about it. The registrar binds the address in the REGISTER's Contact header, and the 200 OK "MUST contain Contact header field values enumerating all current bindings", each with an expires parameter. A softphone on 192.168.1.20 that writes Contact: <sip:1001@192.168.1.20:5060> gets exactly that stored. When a call arrives, the proxy looks up sip:1001@example.com and sends the INVITE to 192.168.1.20:5060, an address that means nothing outside that LAN.

The REGISTER itself still works, because responses follow the Via path. RFC 3581 adds the rport flag: the client puts an empty ;rport in its top Via, and the server "MUST set the value of the parameter to the source port of the request", next to a received parameter with the source IP. So the registrar knows the real address. In this synthetic trace, the 200 OK's Via says so in plain text:

Via: SIP/2.0/UDP 192.168.1.20:5060;rport=40123;received=203.0.113.7;branch=z9hG4bK-02-2
Contact: <sip:1001@192.168.1.20:5060>;expires=3600

The registrar knows the NAT's public address is 203.0.113.7:40123, and it stores 192.168.1.20 anyway. Nothing in RFC 3261 tells it to swap them. That's a registrar setting:

  • Kamailio: fix_nated_register() from the nathelper module, with received_avp set to the same AVP in both nathelper and registrar. The registrar then appends ;received="sip:203.0.113.7:40123" to the Contact in the 200 OK and routes INVITEs there. Or use add_contact_alias() with handle_ruri_alias(), which the nathelper docs describe as the standards-conforming alternative.
  • Asterisk PJSIP: rewrite_contact=yes on the endpoint, with force_rport=yes. On the AoR, set max_contacts=1 and remove_existing=yes so a refresh from a new source port replaces the old contact instead of piling up.

The tool works out where the stored Contact really points before it judges it:

export function effectiveTarget(contact: string): { addr: string; how: 'received' | 'alias' | 'uri' } | undefined {
  // Kamailio appends received to the Contact in the 200 OK; accept it outside or inside the <...>.
  const rcv = /;\s*received\s*=\s*"?([^";>]+)"?/i.exec(contact);
  if (rcv) { const u = parseUri(rcv[1]); if (u) return { addr: hostPort(u), how: 'received' }; }
  const u = parseUri(contact);
  if (!u) return undefined;
  const alias = typeof u.params.alias === 'string' ? /^([^~]+)~(\d+)/.exec(u.params.alias) : null;
  if (alias) return { addr: `${alias[1]}:${alias[2]}`, how: 'alias' };
  return { addr: hostPort(u), how: 'uri' };
}

If that target is RFC 1918, RFC 6598 CGNAT (100.64.0.0/10), loopback or link-local, and the REGISTER came from a public address, you get CONTACT_STORED_PRIVATE. If the trace also has the INVITE going there, you get INVITE_TO_UNROUTABLE:

sip-register-nat-doctor output for the stored-private-Contact trace

One exception: RFC 5626 SIP Outbound. If the Contact carries ;reg-id and +sip.instance and the 200 OK has Require: outbound, a private Contact is expected. The edge proxy sends INVITEs back over the flow the REGISTER came in on. If the UA asks for Outbound and the 200 OK has no Require: outbound, RFC 5626 section 4.2.1 says "the UA has potentially registered an un-routable contact". The tool reports that as OUTBOUND_NOT_SUPPORTED.

Failure 2: the Contact is right, and the NAT forgot you

This one is worse, because the registrar looks correct. The stored Contact is 203.0.113.7:40123, the real public address, with 3600 seconds left. The INVITE goes to the right place, and still nothing comes back.

Registrar view vs NAT mapping: the binding says valid for an hour, the mapping is gone after its timeout

A NAT keeps a UDP mapping only while packets keep using it. RFC 4787 REQ-5 sets the floor: a NAT UDP mapping timer "MUST NOT expire in less than two minutes", and "a default value of five minutes or more ... is RECOMMENDED." That's what the RFC asks for, not a promise about your router. RFC 5626 section 4.4.2 picked its keepalive interval because "many NATs have UDP timeouts as low as 30 seconds." REQ-6 adds that the mapping MUST be refreshed by outbound packets. Inbound refresh is only a MAY. A ping from the server that gets no answer may not keep the mapping open at all.

So a registrar that grants 3600 s, with nothing sent in between, is betting the NAT keeps the mapping open for up to an hour of silence. If the INVITE arrives after the mapping is gone, the NAT has nowhere to deliver it.

The tool measures that silence directly. It collects every packet from the UA's public address after the first 200 OK (re-REGISTERs, OPTIONS, replies to the server's OPTIONS, double-CRLF pings, STUN) and finds the longest gap up to the INVITE:

const out = [...all.filter(fromClient), ...kaOut].map((p) => sec(p)).filter((t): t is number => t !== undefined && t >= firstOk && t <= windowEnd).sort((a, b) => a - b);
const pts = [firstOk, ...out.filter((t) => t > firstOk), windowEnd];
const gaps: Array<{ from: number; to: number; seconds: number; until: string }> = [];
for (let i = 1; i < pts.length; i++) gaps.push({ from: pts[i - 1], to: pts[i], seconds: pts[i] - pts[i - 1], until: i === pts.length - 1 ? untilLabel : 'next packet from the UA' });

If a gap is longer than --nat-timeout, it reports BINDING_LIKELY_EXPIRED, with the time the mapping would have gone. The default is 120 s, the RFC 4787 floor. It's an assumption, and the output says so on every run. If you've measured your NAT, pass the real value. In trace 08 the UA sends OPTIONS every 180 s, and the INVITE comes 170 s after the last one. At --nat-timeout 120 that's an expired binding. At --nat-timeout 300 the binding is not blamed, and the tool tells you to look further down the path.

sip-register-nat-doctor output for the expired-binding trace

There are three ways to fix it, and they can be combined:

  1. Keepalives from the client. RFC 5626 section 4.4 defines STUN keepalives for UDP and a double-CRLF ping / single-CRLF pong for TCP and TLS. If the 200 OK has a Flow-Timer, the UA "MUST send keep-alives at least as often as this number of seconds."
  2. Pings from the server that the UA answers. Kamailio nathelper's natping_interval (SIP pings via sipping_from), or nat_keepalive() in the nat_traversal module; Asterisk's qualify_frequency on the AoR. The UA's 200 OK to each OPTIONS is the outbound packet that refreshes the mapping. The nathelper docs say the same about their 4-byte UDP ping: it's inbound only, so "the bind may expire".
  3. A shorter Expires, so the re-REGISTER itself keeps the mapping open.

Eight synthetic traces

The repo ships eight traces generated by a script. None is a capture from a real network. They use RFC 5737 documentation addresses for the public side (registrar 198.51.100.10, NAT 203.0.113.7) and RFC 1918 / RFC 6598 addresses inside. Each is "captured at the registrar".

Trace Likely cause reported
01 ;received= fix, 60 s granted, re-REGISTER every 55 s none, rings
02 200 OK echoes 192.168.1.20 unchanged INVITE_TO_UNROUTABLE
03 Contact rewritten to source, 3600 s, silent for 600 s BINDING_LIKELY_EXPIRED
04 same as 03 plus server OPTIONS every 60 s, answered none, rings
05 CGNAT 100.64.12.7 Contact, Via without ;rport INVITE_TO_UNROUTABLE
06 RFC 5626 over TCP, Flow-Timer: 120, CRLF pings none, rings
07 Outbound requested, no Require: outbound INVITE_TO_UNROUTABLE
08 OPTIONS from the UA every 180 s BINDING_LIKELY_EXPIRED at 120 s

It's 593 lines of TypeScript with zero runtime dependencies. Node 22.18+ runs the .ts files directly. The 20 node:test tests pass locally and in GitHub Actions CI on Node 22 and 24. The CLI exits with code 2 when it finds an error, so you can run it on recorded traces in CI.

What it can't see

It can't see the NAT. "Binding likely expired" means "silent for longer than the timeout you gave me." It doesn't decode STUN or TLS. Use it to decide which knob to turn, then capture on both sides of the NAT.

The takeaway

"Registered" means the UA can reach the registrar. Inbound calls need the reverse, so ask the reverse questions. Open the 200 OK to the REGISTER: does the stored Contact (or its received/alias) point at the address the REGISTER came from? Then look at the trace between refreshes: does anything leave the UA more often than its NAT forgets? If the answer to either is no, the phone shows a green dot and never rings.


Code: github.com/AhmedElbashier/sip-register-nat-doctor has the CLI, eight synthetic traces, 20 tests and the raw run output. Run npm test, then node src/cli.ts traces/*.sip.

I'm Ahmed, a full-stack and integrations engineer (.NET, Next.js, VoIP/WebRTC/SIP). More of my work is on GitHub and my portfolio.

No comments yet. Be the first to comment.