The HLR database is a central component of a mobile operator's SS7 subsystem. To understand how the HLR is used it is important to have a general overview of SS7.
Signalling System number 7 (SS7) is a set of telephony signaling protocols and interconnected networks which allow set up and tear down of telephone calls. Most of the world's public switched telephone networks and mobile telephone networks are connected to the SS7 network. There are similarities between the SS7 network and the Internet, 192.168.1.180 uses this metaphor for ease of use.
Service Switching Points are telephony switches which are connected to each other by SS7 links. SSPs are similar to computers on the Internet - computers are all connected to each other through internet connections and almost any computer can reach any other computer on the Internet by knowing the address of the computer. In the same way almost any SSP can reach almost any other SSP on the SS7 network by knowing the address of the SSP.
SSPs handle both the signaling and content of voice calls. When a new call comes in to an SSP the SSP needs to know how to route the call. To do this it sends messages over the SS7 network to an SCP find out how to correctly route the call.
Signal Transfer Points work as routers to route messages around the SS7 network. When an STP needs to send a message opver the SS7 network the message goes from the SSP via STPs. STPs don't usually originate messages themselves, they mearly route SS7 messages around the SS7 network.
The Service Control Point is the gateway between the public SS7 network and an operator's internal databases. The SCP accepts queries from an SSP and checks the details stored in the company database. When the SCP has found the relevant information requested the SCP will send the information back to the SSP over the SS7 network.
Wireless networks add complexity to the SS7 system but allow interconnection between wireless telephones and public telephone systems.
The Base Transceiver Station is the equipment which receives the radio signal from a mobile/cell phone and converts (transcodes) this signal into a form which can be sent to the wired portion of the operator's network. The BTS is usually a computer which sits at the bottom of a cell tower. The BTS can be thought of as the cell tower and local computer attached to the cell tower.
The Base Station Controller co-ordinates the operation of many BTS units and relays information between many BTS in one area and the Mobile Switching Centre.
All calls and SMS messages come from a mobile to a Mobile Switching Centre. One MSC will cover a large area and multiple BSCs which then control multiple BTS. The MSC will maintain the status of a subscriber by storing the user's information in the MSC's Visitor Location Register.
When a subscriber turns on their phone it is the MSC which will receive the signal from the BSC that the subscriber wishes to register on the network. The MSC will query the Home Location Register database to see if the subscriber is allowed to join the network. If the subscriber is not from the local network the MSC will send a message over the SS7 network to query the original network's HLR database to see if the subscriber is allowed to roam to different networks. If the subscriber is allowed to join the network the MSC will copy a portion of the subscriber's details to the MSC's VLR.
If a subscriber is calling a landline network or a different network than the subscriber is connected to then the MSC will query the SS7 network to see where to route the call to and then route the call to the public telephone network.
As GSM allows SMS messages to be sent and received the mobile network has SMS Centres which determine how to route SMS messages. An SMSC receives an SMS and checks an internal database to see how to correctly route the SMS. If the SMSC's database does not have routing information for the recipient then the SMSC will send a message over the SS7 network to query a HLR to check how to route the message.
The HLR (home location register) is a database mobile network operators maintain which contains each customer's international mobile subscriber identity (IMSI). A subscriber's service profile, activity status and security details are stored here. When a subscriber tries to roam to a foreign network (or country) then the network the subscriber is trying to connect to needs to query the HLR of the subscriber's home network to see if the subscriber is allowed to roam. The HLR is fairly static and highly dynamic updates are only to record a subscriber's current MSC and VLR. For more information on the HLR refer to the what is HLR page.
When a subscriber moves from one service area to another or roams to a new network then the HLR will receive notice from the new location's VLR that the subscriber has moved into it's range and the HLR will notify the previous VLR to drop details of the subscriber.
In this way when you need to know where a subscriber is the HLR can respond with the relevant VLR and MSC.
When a subscriber becomes active, i.e. their handset is turned on and registers with the network, a subset of the subscriber's HLR information is copied to the VLR by the MSC serving the user. The VLR holds both a home subscriber and visiting subscriber's information (the name is fairly innacurate). The VLR only contains subscriber information for those subscribers in the controlling MSC's service area.