SIP 302 Redirect · UDP/TCP :5060lrn.sipsmart.io:5060

SIP 302 Redirect LRN Dipping & Carrier Switching Guide (RFC 4694)

Why wholesale VoIP carriers, Class 4 softswitches, and high-CPS SBCs use stateless SIP/2.0 302 Moved Temporarily signaling for real-time Local Routing Number (LRN) resolution—and how to connect your switch to lrn.sipsmart.io:5060 in minutes.

Production SIP 302 LRN Endpoint

lrn.sipsmart.io:5060 (Global Latency DNS: Americas · Europe · Asia)

Transport
UDP & TCP :5060
Median Dip Latency
1 – 3 ms
Keepalive Ping
SIP OPTIONS → 200 OK
Per-Dip Rate
$0.0001 – $0.00005

Key Engineering Takeaways

  • →Stateless UDP SIP 302 dipping eliminates TCP/TLS handshake overhead during call setup, resolving portability in a single 1–3ms UDP datagram exchange.
  • →RFC 4694 standardizes number portability in SIP via the rn= (Routing Number) and npdi=yes (Number Portability Database Indicator) parameters inside the 302 Contact header.
  • →Class 4 switches (Sansay VSXi, Ribbon/Sonus PSX, Metaswitch, Telcobridges) natively consume SIP 302 redirects to select the lowest-cost terminating carrier trunk (LCR) before forwarding the call.
  • →SIPSmart returns both standard RFC 4694 Contact parameters and enriched X-LRN, X-OCN, X-LATA, X-State, X-Line-Type (S/C/V/P), and X-Carrier headers in every 302 packet.

Why Carrier Switches Use SIP 302 Redirects Instead of HTTP APIs

In application servers and modern cloud dialers, querying an HTTPS REST endpoint for LRN data is straightforward. However, inside high-throughput Class 4 wholesale switches and Session Border Controllers (SBCs) processing hundreds or thousands of Calls Per Second (CPS), SIP 302 redirect dipping remains the gold standard for real-time number portability.

When an inbound call hits a wholesale switch, the routing engine has a strict post-dial delay (PDD) budget—typically under 15ms—to determine whether the dialed number has been ported, look up the terminating carrier's rate deck via the 10-digit LRN, and advance the call to the winning egress trunk. Using stateless SIP over UDP port 5060 provides three major architectural advantages:

  1. Single-Datagram Round Trip (Zero Handshake Overhead): A UDP INVITE and 302 Moved Temporarily reply require exactly two packets—no TCP 3-way handshake, no TLS negotiation, and no HTTP connection pool exhaustion under sudden CPS spikes.
  2. Native SBC Failover & Retransmission (RFC 3261 Timer T1): Hardware and carrier SBCs (such as Sansay, Ribbon/Sonus, AudioCodes, and Oracle Acme Packet) have built-in SIP state machines that monitor redirect servers with OPTIONS pings and automatically fail over across redirect trunks in milliseconds.
  3. Direct LCR Crankback Integration: Upon receiving a 302 response with ;rn=+16465550000;npdi=yes, a Class 4 switch automatically replaces the NPA-NXX lookup key with the returned rn parameter when querying its Least Cost Routing (LCR) table, preventing costly inter-carrier misroutes and wireless surcharge penalties.

How SIP 302 LRN Switching Works on the Wire

The SIP 302 LRN call flow is 100% signaling-only. No RTP media ports are allocated, no call state is held after the redirect, and the redirect server never touches audio traffic:

# Stateless SIP 302 LRN Dip Call Flow (UDP :5060)
┌──────────────────────────┐                              ┌──────────────────────────────┐
│  Customer SBC / Switch   │                              │     lrn.sipsmart.io:5060     │
│   (Whitelisted Source)   │                              │  (NPAC Redis + MySQL Engine) │
└────────────┬─────────────┘                              └──────────────┬───────────────┘
             │                                                           │
             │  1. UDP INVITE sip:+17187694592@lrn.sipsmart.io:5060      │
             │ ────────────────────────────────────────────────────────► │
             │                                                           │  • Verify Source IP (<0.2ms)
             │                                                           │  • 4-Pass LRN Lookup (1-2ms)
             │  2. SIP/2.0 302 Moved Temporarily                         │
             │     Contact: <sip:+17187694592;rn=+16465550000;npdi=yes>  │
             │     X-LRN: 6465550000 | X-OCN: 6529 | X-Line-Type: C      │
             │ ◄──────────────────────────────────────────────────────── │
             │                                                           │
             │  3. UDP ACK (completes non-2xx INVITE transaction)        │
             │ ────────────────────────────────────────────────────────► │
             │                                                           │
             ▼                                                           ▼
  [Switch routes call to Terminating Carrier using LRN 6465550000]

1. Outbound SIP INVITE (From Your Switch)

Your switch sends a standard INVITE to lrn.sipsmart.io:5060. We accept 10-digit (7187694592), 11-digit (17187694592), or E.164 (+17187694592) formatting in the Request-URI and automatically preserve your numbering prefix in the returned Contact header:

INVITE sip:+17187694592@lrn.sipsmart.io:5060 SIP/2.0
Via: SIP/2.0/UDP 45.76.14.191:5060;branch=z9hG4bK-7f8a9d;rport
From: <sip:12125550100@45.76.14.191>;tag=as4910c8
To: <sip:+17187694592@lrn.sipsmart.io:5060>
Call-ID: 894120abc-45.76.14.191
CSeq: 101 INVITE
Max-Forwards: 70
Content-Length: 0

2. SIP 302 Moved Temporarily Response (From SIPSmart)

Within 1–3ms, lrn.sipsmart.io:5060 replies with a 302 Moved Temporarily packet containing the RFC 4694 rn= and npdi=yes parameters in the Contact URI, plus extended X-* carrier headers for programmable switches:

SIP/2.0 302 Moved Temporarily
Via: SIP/2.0/UDP 45.76.14.191:5060;branch=z9hG4bK-7f8a9d;rport=5060;received=45.76.14.191
From: <sip:12125550100@45.76.14.191>;tag=as4910c8
To: <sip:+17187694592@lrn.sipsmart.io:5060>;tag=sipsmart302
Call-ID: 894120abc-45.76.14.191
CSeq: 101 INVITE
Contact: <sip:+17187694592;rn=+16465550000;npdi=yes@lrn.sipsmart.io:5060>
X-LRN: 6465550000
X-Ported: true
X-Cache: HIT
X-OCN: 6529
X-LATA: 132
X-State: NY
X-Line-Type: C
X-Carrier: T-MOBILE USA, INC.
Server: SIPSmart-LRN/1.0
Content-Length: 0

Line Type Codes Returned in X-Line-Type

In addition to portability routing, switches and dialers frequently use the X-Line-Type header to block non-mobile numbers on SMS/RVM trunks or enforce TCPA wireless rules:

CodeClassificationDescription
SStandard / Switched LandlineConventional PSTN wireline / POTS telephone service
CCellular / WirelessCommercial mobile radio service (CMRS) / wireless carrier
VVoIPInterconnected or nomadic Voice over IP service provider
PPaging / PagerNarrowband PCS / paging carrier block

Configuration Examples by Switch Platform

1. Sansay VSXi / Ribbon (Sonus) / Metaswitch SBCs

  • Redirect Server Address: lrn.sipsmart.io (Latency DNS across VA 178.156.251.137, OH 18.222.88.187, DE 2.31.180.210, SG 5.223.56.126), Port 5060 (UDP/TCP)
  • Heartbeat / Keepalive: Enable SIP OPTIONS ping (30-second interval). Our edge replies 200 OK at zero charge.
  • NPDI / RN Parsing: Set LRN format to RFC 4694 (reads rn= and npdi=yes from the 302 Contact header).

2. OpenSIPS / Kamailio Config Snippet

In OpenSIPS or Kamailio, send the dip to lrn.sipsmart.io:5060 and catch the 302 in a failure_route to extract either the RFC 4694 rn parameter or the X-LRN header:

# Kamailio / OpenSIPS failure_route for SIP 302 LRN Dip
route[LRN_DIP] {
    $du = "sip:lrn.sipsmart.io:5060;transport=udp";
    t_on_failure("LRN_302_REPLY");
    t_relay();
}

failure_route[LRN_302_REPLY] {
    if (t_check_status("302")) {
        $avp(lrn) = $(<reply>hdr(X-LRN));
        $avp(line_type) = $(<reply>hdr(X-Line-Type));
        $avp(ocn) = $(<reply>hdr(X-OCN));
        xlog("L_INFO", "LRN Resolved: tn=$rU lrn=$avp(lrn) type=$avp(line_type) ocn=$avp(ocn)\n");
        # Proceed to LCR routing table with $avp(lrn)
        route(LCR_ROUTE);
        exit;
    }
}

Comparing LRN Delivery Models: SIP 302 vs. REST API vs. DB Replication

FeatureSIP 302 Redirect (:5060)HTTPS REST APIMySQL DB Replication
Typical Latency1 – 3 ms (UDP)2 – 8 ms (Keep-Alive HTTPS)< 1 ms (Local LAN)
Best ForClass 4 SBCs, Sansay, Ribbon, OpenSIPS, FreeSWITCHCloud apps, CRM enrichment, bulk list scrubbersUltra-high-CPS carriers (50M+ dips/mo)
AuthenticationSource IP Whitelist, Tech Prefix, or X-LRN-TokenAuthorization: Bearer <token>IP Whitelist + MySQL Replica Credentials
Billing Model$0.0001 – $0.00005 / dip (or flat-rate)$0.0001 – $0.00005 / dip (or flat-rate)Flat monthly subscription (unlimited queries)

Simple, Predictable Pricing

No Surprises. Ever.

We charge less than legacy providers and publish our prices openly. No setup fees, no hidden costs, no annual lock-in required.

Starter
$0.0001
per lookup
  • ✓ Real-time LRN dip
  • ✓ Standard latency
  • ✓ HTTPS API
  • ✓ 1,000 free lookups
Best Value
Volume
$0.00005
per lookup (1M+/mo)
  • ✓ Real-time + batch
  • ✓ Global Edge (Americas, EU & Asia)
  • ✓ Dedicated endpoint
  • ✓ Priority SLA
Enterprise
Custom
flat-rate
  • ✓ DB replication
  • ✓ On-prem option
  • ✓ SLA guarantee
  • ✓ Dedicated support

🛡 Pricing Guarantee

We will match or beat any competitor's published price for equivalent LRN lookup volume. Contact us with a quote.

Get Started Free

FAQ

SIP 302 LRN Redirect FAQ

Have another question? Email us at support@sipsmart.io

  • A SIP 302 LRN dip is a stateless signaling query where a softswitch or Session Border Controller (SBC) sends a standard SIP INVITE containing the dialed telephone number to an LRN redirect server (lrn.sipsmart.io:5060). Instead of answering the call or establishing media, the server queries the NPAC-backed LRN database in under 2ms and replies with SIP/2.0 302 Moved Temporarily. The Contact header in the 302 response carries the 10-digit Local Routing Number in the RFC 4694rn= parameter alongside npdi=yes (Number Portability Database Indicator), instructing the switch which terminating carrier trunk to route the call to.
  • Point your SBC or softswitch to lrn.sipsmart.io:5060 (latency-routed across Virginia 178.156.251.137, Ohio 18.222.88.187, Nuremberg 2.31.180.210, and Singapore 5.223.56.126 — both UDP and TCP supported on port 5060). The listener responds to OPTIONS keepalive pings with 200 OK (unbilled) and to INVITE dips with 302 Moved Temporarily.
  • We support three carrier authentication methods on lrn.sipsmart.io:5060:
    • Source IP Whitelisting (Primary): Add your switch or SBC source IPs in the SIPSmart Dashboard under Trunk IPs (or send them to support). Whitelisted IPs are cached in Redis at the signaling edge for sub-millisecond verification.
    • Tech Prefix + IP: Prefix the dialed number in the Request-URI (e.g., sip:9901#17187694592@lrn.sipsmart.io:5060) to separate traffic across sub-accounts.
    • SIP Header Token: Programmable proxies (OpenSIPS, Kamailio, FreeSWITCH) can passX-LRN-Token: <your-api-token> directly in the INVITE without static IP whitelisting.
  • Every 302 Moved Temporarily response includes both the standard RFC 4694 Contact URI and extended carrier routing headers:
    • Contact: <sip:+17187694592;rn=+16465550000;npdi=yes@lrn.sipsmart.io:5060> (preserves 10-digit, 11-digit, or E.164 format)
    • X-LRN: 10-digit Local Routing Number
    • X-Ported: true or false
    • X-OCN: 4-character Operating Company Number
    • X-LATA: Local Access and Transport Area code
    • X-State: 2-letter US state abbreviation
    • X-Line-Type: S (Standard/Switched Landline), C (Cellular/Wireless), V (VoIP), or P (Paging)
    • X-Carrier: Serving carrier name
  • SIP 302 dips use the exact same transparent pricing as our REST API: starting at $0.0001 per dip ($0.10 per 1,000 dips) and scaling down automatically to $0.00005 per dip at 1M+ monthly lookups, with flat-rate unlimited plans available for high-CPS carriers. There are zero monthly minimums, zero setup fees, and no annual commitments—plus every new account includes 1,000 free lookups to test.

Ready to Test SIP 302 LRN Dips on Your Switch?

Create a free account, whitelist your switch IP in seconds, and point your SBC to lrn.sipsmart.io:5060 with 1,000 free lookups.

1,000 free lookups included • No credit card required • Instant provisioning