This ‘How do HLR lookups work?’ post is part of our technical blog series. Grab a copy of our telecoms acronym glossary, and a good cup of tea to help you through it. I won’t get too in-depth, I promise!
How do HLR lookups work?
What is HLR?
A HLR is a Home Location Register, which is a database inside a mobile telephone network. This database contains details that the Mobile Network Operator (MNO) uses when a subscriber wants to connect to the mobile phone network to know if the user is allowed to use the network and to keep a high-level track of how to send calls and text messages to the handset.
What do HLR lookups do?
A HLR lookup is performed against the HLR database so that a telephone network can know if a telephone number is available to receive a communication (typically SMS or phone call) and where to send that communication using the SS7 network. A HLR lookup provides information about the telephone number including if the telephone number exists, which telephone network the telephone number belongs to and if the telephone number is currently active on the telephone network. A HLR lookup provides information about a telephone number, NOT a telephone user and can not provide any identifiable information about a human user.
How do HLR lookups know which telephone network to query?
When a user submits a HLR lookup query, the system analyses the telephone number and runs through a series of steps to identify if the telephone number has:
- A valid country code prefix
- A total digit length that is valid for that country
- An area code prefix that exists for the country
- A network operator assigned to allocate the area code
If the telephone number is deemed to be a “valid” telephone number, that is if the telephone number exists because the formatting, number length, country code and area code are all possible real combinations, then we calculate the type of telephone number.
Some countries have predefined codes which specify if the telephone number can be used for mobile communications – cellphones, landlines, pagers, etc. Some countries even have special ranges dedicated for “stage and screen” (e.g. the 555-XXXX numbers you see in American films – although technically
Once HLR lookups have determined the telephone number type, and if it could be a mobile number, we check to see if the MNO who was originally assigned the telephone prefix is “in routing”. “In routing” means that the HLR lookup can send a message to the MNO and that we expect the MNO to respond to us with information.
How do HLR lookups reach the telephone network that assigned the telephone number?
If the MNO is “in routing”, then we send the HLR lookup request via the SS7 network. Some MNOs provide a direct API to us which allows us to query basic numbering information, but the vast majority of MNOs do not and we send the message as an SRIforSM signalling request across the SS7 network.
To make the SRIforSM request, we submit the telephone number to the SS7 network via a signalling partner. The signalling partner uses a process called Global Title Translation to lookup which next hop to pass the message to, based on the submitted telephone number. The message is transmitted between hops until it reaches the MNO who was assigned the telephone number.
When the request is received by the MNO, they will check if the telephone number has been ported away to a different network. If the number has been ported away then the original MNO will have a routing exception where it knows which MNO the telephone number was ported to.
In the case of a ported number, the original MNO will re-forward the request to the new MNO where the telephone number was ported to. To do this, they prepend the telephone number with a known prefix of the ported-to network and pass the message back to the SS7 system where global title translation detects the telephone prefix as being one from the ported-to network so the SS7 router forwards the message to the new MNO.
What information is provided to HLR lookup from the mobile network operator?
Once the request arrives at the correct MNO for the telephone number, the MNO will check in the HLR database to see if the telephone number is currently assigned to a subscriber. The MNO will know if the telephone number is:
- Active – is currently operating on the network OR
- Absent – assigned to a subscriber but the handset is not currently on the network OR
- Restrictions on the subscriber (eg. it’s a data SIM and therefore no teleservices are assigned to the subscriber)
- Dead – this number is a valid number but is not currently assigned to a subscriber of the MNO
MNOs previously included the full IMSI of the SIM card that the telephone number is currently assigned to, however, this is a security risk and most networks now scramble the IMSI and we do not provide the IMSI to any customer.
What information do HLR lookups provide?
When we receive the result back from the MNO, we parse the response to determine if the MNO provided the information we requested and what the information was.
We append the MNO response to the information we already hold about the telephone number standardising the results from all MNOs across the world and providing a common result format for you to consume using either our web portal or our API.
If you’re using our HLR lookup APIv2, depending on which mobile network operator the telephone number belongs to, we can provide:
- Correctly formatted telephone number (in E.164 format)
- Telephone number validity
- Telephone number type (mobile, landline, pager, premium rate, stage and screen, VoIP, toll-free etc)
- The status of the number – for example, if the telephone number is live, inactive or has restrictions such as no teleservice
- The details of the telephone network where the telephone number was originally allocated
- The details of the telephone network where the number has been ported to (if ported)
- The date the telephone number was last ported which is especially useful if you want to check if a telephone number is “new” for a high-value transaction
What happens if a mobile network operator stops responding to HLR lookups?
The response from HLR lookups includes the details we hold about the telephone number and the “live status” from the telephone network. The live status is retrieved in real-time from a mobile network operator’s internal Home Location Register (HLR) database. We constantly monitor our requests to check if an MNO stops responding to us, which they do from time to time depending on various factors including commercial, geopolitical or technical problems.
We have agreements in place with multiple partners to re-route our HLR requests to the end MNO. If an MNO stops responding to all HLR requests from all of our routing options then we remove that MNO from our routing system and we will respond to our customer’s requests with details we hold about the telephone number but not the live status from the telephone network operator.