Skip to content

LRN dipping and number portability

Number portability lets a subscriber keep a phone number when moving to another carrier, so the prefix of a number no longer tells you which network serves it. An LRN dip asks a number-portability server for the Local Routing Number (LRN) of the network that serves the number now. FlySIP then rates and routes the call by that LRN instead of by the dialled number, while the vendor still receives the dialled number. Without it, calls to ported numbers are priced and routed as if they still belonged to the original carrier.

Screenshot "concepts/lrn-system-parameters" has not been generated yet — see scripts/screenshots/screens.yml.
  1. The call is authenticated and the CLD translation rules of the authentication rule and the account are applied. The result is the CLD.
  2. The switch checks whether to dip. It dips only when the account’s routing group has Enable LRN checked and at least one LRN server is configured. On-net calls are never dipped.
  3. It asks the cache, then the servers. With Enabled LRN Cache the switch first looks for a stored answer. Otherwise it sends a SIP INVITE with the CLD in the request URI to the first server in LRN Server Addresses. If no final answer arrives within LRN Server Timeout, it tries the next server. LRN Total Timeout caps the whole lookup; when it expires, the call continues with the original CLD.
  4. It reads the answer. The server answers 302 Moved Temporarily with the routing number in the Contact header. The switch applies the routing group’s LRN Translation Rule to the routing number. The result is the LRN CLD.
  5. It rates by the LRN CLD. The tariffs of the account and of every customer above it are searched for the LRN CLD. If a tariff has no rate for it, the call is rejected with No Rate Found.
  6. It routes by the LRN CLD. For each routing group entry the termination route is searched for the LRN CLD. An entry whose connection has Ignore LRN checked is searched with the original CLD instead. Entries without a matching prefix are skipped.
  7. It sends the original number. The call goes to the vendor with the original CLD, rewritten by the connection’s CLD Translation Rule. With Add LRN to RURI the switch also adds npdi to the request URI, and rn=<LRN CLD> for a ported number, so the vendor can route by the LRN itself.

If the tariff or the routing group has local calling rates and the caller’s number is known, the switch dips the CLI as well. The LRN CLI decides whether the call is intrastate or interstate. See Local calling.

Only the rn parameter of the Contact URI is used, and only together with npdi:

SIP/2.0 302 Moved Temporarily
Contact: <sip:2125550123;npdi;rn=2135550100@192.0.2.10>

Here 2125550123 is the dialled number and 2135550100 the LRN. Both parameters belong to the user part of the URI, so they must come before @ and a host must follow it. Any other answer leaves the original CLD in place, for example:

Contact Why it is ignored
<sip:2125550123@192.0.2.10> No npdi: the number is not ported
<sip:2125550123;rn=2135550100@192.0.2.10> rn without npdi
<sip:2125550123;npdi@192.0.2.10> npdi without a routing number
<sip:2125550123;npdi;rn=2135550100> No @ and host, so the parameters are not part of the user

An answer other than 302, or no answer, counts as a failure, and the call is routed by the original CLD.

Where Field Meaning
System Management → SIP Features → SIP, tab LRN LRN Server Addresses Ordered list of servers as host or host:port; port 5060 by default. A server that returns a valid answer moves to the front
LRN Server Timeout Seconds to wait for one server before the next is tried, 1 to 32, default 5
LRN Total Timeout Seconds for the whole lookup, 1 to 32, default 10
Add LRN to RURI Send npdi and rn to vendors in the request URI
Enabled LRN Cache, LRN Cache Expires in Keep answers from 1 hour to 3 months (default) so that repeated numbers do not cost a query
Vendors → Routing Groups, Advanced Parameters Enable LRN Dip calls routed through this group
LRN Translation Rule Rewrite of the routing number, such as s/^/1/ to add the country code your tariffs use
Connection form Ignore LRN Route this connection by the original CLD

The LRN server is not a vendor. Do not add it as a vendor or a connection; its address goes into system parameters only.

The call details show the LRN CLD used for rating and routing, the Incoming LRN CLD as the server returned it, and the Incoming LRN CLD Result: Success, Success From Cache, Failure, Failure From Cache, Cache Communication Error or Not Needed. The same three fields exist for the CLI. The CLD column keeps the dialled number. Test Dialplan shows the LRN CLD and LRN CLI of a test call.

  • Prefix — the leading digits of a dialled number that select a rate or a route, e.g. 4420.
  • Routing Group — a named set of routing rules assigned to a customer or account.
  • Translation Rule — a regular-expression rule that rewrites the called or calling number before rating or routing.
  • Termination route — a vendor’s price list of prefixes used to route calls to that vendor; stored as a destination set.
  • CDR — call detail record: one row per call with time, duration, destination, cost and disconnect cause.

Calls to ported numbers fail with No Rate Found

Section titled “Calls to ported numbers fail with No Rate Found”

The LRN server returns ten-digit routing numbers while your tariff uses prefixes with the country code. Set LRN Translation Rule to s/^/1/ in the routing group so that the LRN CLD matches the tariff, and check the result in Test Dialplan.

A vendor rejects calls after LRN was enabled

Section titled “A vendor rejects calls after LRN was enabled”

The vendor does not accept npdi and rn in the request URI. Clear Add LRN to RURI; it applies to every connection of the environment.

One vendor routes by the dialled number only

Section titled “One vendor routes by the dialled number only”

Check Ignore LRN on that vendor’s connection. Its termination route is then searched with the original CLD, while the customer is still charged by the LRN CLD.