NAT & Firewall TraversalCommunity-Reported-UnverifiedKamailio ยท Kamailio 5.x / Asterisk 20.x

Troubleshooting SIP Registration Failures Caused by Aggressive Symmetric NAT Timers

by Provider Adminlast verified 2026-07-29

Problem

SIP endpoints located behind routers with aggressive Symmetric NAT UDP aging timers successfully register initially but become unreachable for inbound INVITE and OPTIONS requests after 30 to 60 seconds of inactivity.

Illustration for Troubleshooting SIP Registration Failures Caused by Aggressive Symmetric NAT Timers

Symptoms

  • Inbound calls to remote endpoints fail with 408 Request Timeout shortly after registration.
  • Outbound calls from the remote endpoint succeed immediately and temporarily restore inbound call flow.
  • SIP OPTIONS keep-alive requests sent by the server receive no response after 30-60 seconds of client idle time.
  • Client re-registers successfully when its internal timer expires (e.g., 3600s), restoring reachability briefly.

Root cause

The customer edge router enforces an aggressive UDP NAT translation entry timeout (often 30 seconds). Because the SIP UA registration interval or keep-alive frequency exceeds this window, the router drops the port mapping, causing all server-initiated inbound UDP traffic to be silently discarded by the firewall.

Resolution steps

  1. step #1

    Capture SIP traffic on the server interface to monitor packet timing and confirm NAT binding expiration.

    sngrep -d eth0 host <CLIENT_PUBLIC_IP> -t
  2. step #2

    Configure Kamailio nathelper module to send frequent UDP NULL/CRLF or OPTIONS pings to maintain the NAT mapping table entry.

    loadmodule "nathelper.so"
    modparam("nathelper", "natping_interval", 15)
    modparam("nathelper", "ping_natted_only", 1)
    modparam("nathelper", "sipping_bflag", FLB_NATSIPPING)
    modparam("nathelper", "raw_ping_formula", "\r\n\r\n")
  3. step #3

    Configure Asterisk res_pjsip to enable qualify keep-alives and reduce keep-alive intervals globally and per-endpoint.

    ; pjsip.conf
    [global]
    keep_alive_interval=15
    
    [standard-endpoint](!)
    type=endpoint
    context=from-internal
    direct_media=no
    force_rport=yes
    rewrite_contact=yes
    qualify_frequency=15
    
    [1001](standard-endpoint)
    auth=auth1001
    aors=1001
  4. step #4

    Enforce a lower maximum SIP registration expiry on the server to force clients behind unconfigurable NAT to re-register more frequently.

    ; pjsip.conf - Restrict AOR max_expires
    [1001]
    type=aor
    max_expires=120
    default_expires=60
    minimum_expires=30
    max_contacts=1
  5. step #5

    Reload the SIP service configuration to apply the new NAT keep-alive parameters.

    asterisk -rx "module reload res_pjsip.so"
    # Or for Kamailio:
    kamcmd cfg.reload
  6. step #6

    Verify that NAT keep-alives are actively sending packets every 15 seconds to open NAT ports.

    tcpdump -n -i eth0 udp and port 5060 and host <CLIENT_PUBLIC_IP> -X

Verification evidence

SNGREP captures confirm that server-originated OPTIONS or INVITE packets sent to the IP and port recorded in the location table yield no SIP response or ICMP unreachable errors until the client initiates a new outbound UDP packet.