Back to Insights
VoIP Engineering

SIP Registration and Authentication Explained: Digest, Nonces, and Expiry

Telephony Engineering Team
4 min read
SIP Registration and Authentication Explained: Digest, Nonces, and Expiry

SIP registration is how a device tells a registrar server where it can currently be reached, and digest authentication is how the server confirms the device is allowed to say so. A registration binds an address of record, such as sip:alice@example.com, to a contact address such as sip:alice@203.0.113.7:5060. Calls to Alice are then routed to that contact.

The Registration Handshake

  1. The device sends REGISTER with its address of record and a requested expiry.
  2. The server replies 401 Unauthorized (or 407 from a proxy) with a WWW-Authenticate header containing a realm and a one-time nonce.
  3. The device hashes its credentials with the nonce and sends the same REGISTER again with an Authorization header.
  4. If the response is valid, the server answers 200 OK and returns the granted expiry.

The 401 on the first attempt is normal. It is a challenge, not a failure. A problem exists only when the challenge repeats after the device has sent valid credentials.

How Digest Authentication Works

The password never crosses the wire. The device computes a hash of the username, realm, password, nonce, and request details, and the server performs the same calculation and compares. Modern deployments should use a strong hash algorithm and TLS so the exchange is also protected from observation (see SIP over TLS and SRTP setup).

Expiry and Re-registration

A registration is temporary. The server grants an expiry in seconds, and the device must refresh before it lapses. Typical engineering trade-offs:

  • Short expiry reacts quickly to a device moving networks but increases signaling load.
  • Long expiry reduces load but leaves stale contacts if a device vanishes.
  • NAT keep-alives are separate from expiry. Devices behind NAT need frequent traffic to keep the firewall mapping open, which is a common reason for calls failing to reach a registered phone.

Registration at Scale

With thousands of devices, the registrar becomes a core component. Practical points:

Troubleshooting Failed Registrations

SymptomLikely cause
Repeated 401 or 403Wrong username, password, or realm; account disabled; source IP not permitted
408 TimeoutFirewall, wrong port or transport, or SIP ALG interference
Registers, but inbound calls failNAT mapping closed; contact address not reachable; missing keep-alive
Registers, then dropsExpiry too long for the NAT timeout

For the meaning of each code, see SIP response codes explained.

Registration vs Trunk Authentication

Carrier SIP trunks often skip registration entirely and authenticate by source IP instead. Others register like a phone. Know which model your provider uses before debugging (see the SIP trunking buyer's guide).


Need a registrar that holds up under real load? Our Kamailio load balancing team builds scalable, secure SIP registration and routing layers.

Discussion

0

Join the conversation

Sign in with your preferred account to comment, reply, and keep the discussion useful for other engineers.

Takes a few seconds. No separate password required.

C

Controva LLC

Engineering Team

We build digital empires that scale. Specializing in high-performance web architecture, AI automation, and headless commerce.

Work with us

Share this article