Troubleshooting
SIP Registration Failed? A Step-by-Step Troubleshooting Checklist
On this page
A failed SIP registration nearly always comes down to one of four things: the REGISTER never reaches the registrar, the reply never gets back, the credentials are wrong, or NAT, a firewall or a SIP ALG is changing the traffic. Capture the exchange, read the response code and work through the checks below in order.
How a successful registration looks
A REGISTER carries your address of record in the To header, a Contact header with the IP and port for incoming requests, and an Expires value in seconds. With digest authentication, a normal exchange has four messages:
REGISTER sip:provider.example SIP/2.0 (no credentials, CSeq 1) SIP/2.0 401 Unauthorized (WWW-Authenticate: realm, nonce) REGISTER sip:provider.example SIP/2.0 (Authorization: digest response, CSeq 2) SIP/2.0 200 OK (Contact ...;expires=3600)
The first 401 Unauthorized is not an error. It is the challenge: the registrar sends a realm and a one-time nonce, and the client replies with a hash (MD5 in most deployments) of the username, realm, password, nonce, method and URI. The password itself is never sent. A proxy challenges with 407 Proxy Authentication Required instead; the logic is the same. The 200 OK confirms the stored contact and the granted expiry, which may be shorter than requested.
Start with the response code
Turn on SIP logging or run a capture (see capturing SIP traces with sngrep and Wireshark), trigger a registration and note the final response.
| What you see | Usual meaning | Check first |
|---|---|---|
| 401 again after credentials are sent | Digest rejected | Auth username, password, realm |
| 403 Forbidden | Registrar refuses you | Account status, IP allowlist, contact limits |
| 404 Not Found | User or domain unknown | Username and domain in To and From |
| 408 Request Timeout | No answer within 32 seconds | Reachability, firewall, DNS, transport |
| 423 Interval Too Brief | Expires below the registrar's minimum | Min-Expires header in the response |
| 503 Service Unavailable | Registrar overloaded or down, or a local transport failure | Retry-After header; whether the 503 is on the wire |
| Nothing at all | Request lost, blocked or misdirected | tcpdump on the sender; bans on the far side |
401 loops
If the client answers the challenge and gets another 401, the registrar rejected the digest. Check:
- Authentication username. Many providers issue an auth ID that differs from the number in the From and To headers. Phones usually have separate user ID and authentication ID fields.
- Password. Retype it rather than pasting; trailing spaces and look-alike characters are common culprits.
- Realm. The realm is part of the hash, so a realm configured on the client must match the challenge exactly. On Asterisk, leaving
realmblank on an outbound auth object lets it answer whichever realm the provider sends. - Stale nonce. A 401 with
stale=trueonly means the nonce expired; the client should simply retry with the new one.
On Asterisk PJSIP outbound registrations, auth_rejection_permanent defaults to yes, so after a failed challenge the registration stops retrying and shows as Rejected. Fix the credentials, then reload or run pjsip send register <name>.
403 Forbidden and 404 Not Found
A 403 Forbidden means the registrar understood and refuses. Depending on the platform, that can mean wrong credentials, a suspended account, a source IP not on the account's allowlist, or too many registered devices. Only the provider can tell you which, so escalate with a trace. Asterisk does not retry an outbound registration after a 403 unless forbidden_retry_interval is set.
404 Not Found means the registrar does not know that user in that domain. Compare the user and domain in the To header with what the provider issued; using an IP address where the provider expects its domain name can fail this way.
408 and no response
Over UDP, a client resends an unanswered REGISTER at intervals of 0.5, 1, 2 and then 4 seconds, and after 64 × T1 (32 seconds by default) reports 408 Request Timeout. That 408 is normally generated by your own client. A 408 that arrives on the wire came from a proxy that could not reach the registrar behind it, which is a provider-side problem. Similarly, some stacks, PJSIP included, report a local DNS or TCP connection failure as a 503 that never appeared on the wire.
For no response, work outward from your side:
- Confirm the REGISTER leaves the host:
tcpdump -n -i any port 5060. - Confirm the destination IP, transport and port match what the provider documents (see DNS and transport below).
- Test from another network, such as a mobile hotspot. If it works there, look at your firewall, router or a ban on your public IP.
DNS, SRV records and outbound proxies
When you configure a domain name without a port, clients that follow RFC 3263 look for SRV records first and fall back to A or AAAA records only if there are none:
dig +short SRV _sip._udp.provider.example dig +short SRV _sip._tcp.provider.example dig +short SRV _sips._tcp.provider.example dig +short A provider.example
An SRV answer such as 10 50 5060 sbc1.provider.example. gives priority, weight, port and target. If you add a port to the server address (provider.example:5060), the client skips SRV and resolves the A record, which may be the provider's web server rather than its SBC. Use the exact form the provider documents.
If the provider requires an outbound proxy, set it on the Asterisk PJSIP registration (and on the endpoint, for calls), escaping the semicolon because Asterisk treats ; as a comment:
outbound_proxy=sip:proxy.provider.example\;lr
Transport and ports
| Transport | Usual port | Watch for |
|---|---|---|
| UDP | 5060 | Fragmented large messages; NAT mappings timing out |
| TCP | 5060 | The connection must stay open for incoming requests |
| TLS | 5061 | Certificate validity, trust chain and the device clock |
Client and server must agree on protocol, address and port; UDP sent to a TCP-only server, or to 5060 when the provider uses 5080, just gets silence. Test a TCP or TLS port with nc -vz sip.provider.example 5061 and inspect the certificate with openssl s_client -connect sip.provider.example:5061. UDP cannot be tested this way, so use a capture.
Digest authentication does not depend on the device clock, but TLS does: a phone with the wrong date may reject the provider's certificate as expired or not yet valid. Make sure devices use NTP before moving a site to TLS. On UDP, watch message size: RFC 3261 requires a congestion-controlled transport such as TCP for requests within 200 bytes of the path MTU, or over 1,300 bytes when the MTU is unknown, because fragments are often dropped.
NAT keep-alives and registration expiry
A device behind NAT registers through a UDP mapping in the router. If the mapping times out before the next re-registration, the router drops requests sent to the stored contact, so the phone shows as registered and can call out but does not ring. RFC 4787 says UDP mappings should not expire in under two minutes, but some routers use shorter timers.
- Keep-alives on the device. Most phones can send a NAT keep-alive every 15 to 30 seconds.
- Qualify from the server. On Asterisk PJSIP,
qualify_frequency=30on the AOR sends OPTIONS every 30 seconds, which holds the mapping open and shows reachability inpjsip show contacts. The globalkeep_alive_intervaloption only covers TCP and TLS. - Shorter expiry. Without keep-alives, register every 120 to 300 seconds. Going below the registrar's minimum returns 423 Interval Too Brief, with a Min-Expires header naming the lowest value accepted.
- No SIP ALG. Router ALGs often rewrite Contact and Via headers incorrectly. See why to disable SIP ALG.
Firewall and fail2ban blocks
Registrars ban IP addresses that fail authentication repeatedly, so one phone with a wrong password can get your office's public IP banned for every device behind it. If a whole site stops registering at once, suspect a ban first.
- On your own server, list jails with
fail2ban-client statusand lift a ban withfail2ban-client set <jail> unbanip 203.0.113.25. Jail names vary by distribution. - On FreePBX, check the Firewall module (Connectivity → Firewall) and its intrusion detection settings. Trust a known address with
fwconsole firewall trust 203.0.113.25. - At a provider, ask whether your IP is blocked, but fix the device with the bad password first or you will be banned again.
Asterisk PJSIP and FreePBX checks
Connect with asterisk -rvvv, then use:
| Command | What it shows |
|---|---|
pjsip set logger on | Every SIP message sent and received (turn off with pjsip set logger off) |
pjsip set logger host 203.0.113.25 | Only messages to and from one host |
pjsip show registrations | Outbound registrations to providers: Registered, Unregistered or Rejected |
pjsip show contacts | Devices registered to this PBX, with status and round-trip time |
pjsip show transports | Which addresses, ports and protocols are listening |
pjsip send register mytrunk | Retries an outbound registration immediately |
In the outbound registration below, note max_retries: the default of 10 means a long outage can leave the trunk unregistered after the provider recovers, until you reload.
[mytrunk] type=registration outbound_auth=mytrunk-auth server_uri=sip:provider.example client_uri=sip:1000123@provider.example contact_user=1000123 retry_interval=60 forbidden_retry_interval=300 max_retries=1000 [mytrunk-auth] type=auth auth_type=userpass username=1000123 password=your-long-random-secret
For phones registering to Asterisk:
- A log line ending in
Failed to authenticatemeans a wrong password.No matching endpoint foundmeans the username matches no endpoint; from an unfamiliar IP, it is probably a scanner. - An AOR needs
max_contactsof at least 1; with the default of 0, Asterisk rejects the registration and logs that the AOR has no configured max_contacts. For single-device extensions behind NAT, addremove_existing=yesso a re-registration from a new NAT port replaces the stale contact. - On FreePBX, logs are in
/var/log/asterisk/full, trunk registration settings are on the trunk's pjsip Settings tab, and ports and NAT settings are under Settings → Asterisk SIP Settings. Transport changes need a restart (fwconsole restart), not just a reload.
What to send your provider
- Account or trunk ID and authentication username, never the password.
- Your public IP and the server, port and transport you register to.
- Date, time and time zone of a failed attempt.
- The full REGISTER exchange as text or pcap, with the Call-ID.
- Device or PBX model and firmware or Asterisk version (the User-Agent header).
- What changed recently and what you already tested.
A Call-ID lets the provider find the transaction in their logs quickly. Look up any unfamiliar code in the SIP response code reference.
Try the SIP Response Codes
Every SIP status code from 100 to 608, with plain-English meanings, causes, fixes and example traces.
Keep reading
How to Fix One-Way Audio on VoIP Calls
One side can't hear the other? A step-by-step guide to fixing one-way and no-audio VoIP calls caused by NAT, SIP ALG, firewalls and wrong SDP addresses.
SIP ALG: What It Is and Why to Disable It
What SIP ALG does, why it breaks VoIP calls and registrations, how to tell if it's causing problems, and how to turn it off on common routers and firewalls.
Calls Dropping After 30 Seconds
Why VoIP calls drop after about 32 seconds: lost ACKs, NAT, wrong Contact headers and SIP ALG, how to prove it in a trace, and fixes for Asterisk and routers.
Capture SIP Traces With sngrep and Wireshark
Capture SIP and RTP with sngrep and tcpdump, then analyse calls in Wireshark: call flows, RTP stream analysis, jitter, loss, audio playback and safe sharing.