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)
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:
- Single-Datagram Round Trip (Zero Handshake Overhead): A UDP
INVITEand302 Moved Temporarilyreply require exactly two packets—no TCP 3-way handshake, no TLS negotiation, and no HTTP connection pool exhaustion under sudden CPS spikes. - 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
OPTIONSpings and automatically fail over across redirect trunks in milliseconds. - Direct LCR Crankback Integration: Upon receiving a
302response with;rn=+16465550000;npdi=yes, a Class 4 switch automatically replaces the NPA-NXX lookup key with the returnedrnparameter 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:
┌──────────────────────────┐ ┌──────────────────────────────┐
│ 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:
| Code | Classification | Description |
|---|---|---|
| S | Standard / Switched Landline | Conventional PSTN wireline / POTS telephone service |
| C | Cellular / Wireless | Commercial mobile radio service (CMRS) / wireless carrier |
| V | VoIP | Interconnected or nomadic Voice over IP service provider |
| P | Paging / Pager | Narrowband 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 VA178.156.251.137, OH18.222.88.187, DE2.31.180.210, SG5.223.56.126), Port5060(UDP/TCP) - Heartbeat / Keepalive: Enable
SIP OPTIONSping (30-second interval). Our edge replies200 OKat zero charge. - NPDI / RN Parsing: Set LRN format to RFC 4694 (reads
rn=andnpdi=yesfrom the 302Contactheader).
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
| Feature | SIP 302 Redirect (:5060) | HTTPS REST API | MySQL DB Replication |
|---|---|---|---|
| Typical Latency | 1 – 3 ms (UDP) | 2 – 8 ms (Keep-Alive HTTPS) | < 1 ms (Local LAN) |
| Best For | Class 4 SBCs, Sansay, Ribbon, OpenSIPS, FreeSWITCH | Cloud apps, CRM enrichment, bulk list scrubbers | Ultra-high-CPS carriers (50M+ dips/mo) |
| Authentication | Source IP Whitelist, Tech Prefix, or X-LRN-Token | Authorization: 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) |