Mobility Management

This is about OpenBTS' HLR replacement, which we will just call an "HLR" here for simplicity.
The HLR can be implemented using Asterisk's internal databases or with a database server.

HLR Abstraction

At a minimum, the HLR stores the following for each subscriber:

  • IMSI
  • a routable number address (E.164, local extension or ISDN address)
  • the IP address of the BTS where the subscriber most recently registered

At a minimum, the HLR will support these actions:

  • resolve a routable address to an IMSI
  • resolve an IMSI to a routable address
  • find the most recent BTS IP address associated with an IMSI
  • insert a new ISDN/address pair
  • update the recent BTS IP for a given ISMI

The HLR Implemented in Asterisk

Asterisk already stores the minimum data set required for the HLR.
This information can be accessed through the Asterisk command line interface using a C function like popen() using this syntax:
asterisk -rx "<command>" 
Here's an example of popen() use:
FILE* result = popen("dialplan show 2003@sip-local","r");
if (!result) {
// Handle error here.
}
// Now read and parse the result as if reading a file.
//...
// When done, close the stream.
pclose(result);

Resolving a numeric address to an IMSI

dburgess@pBook> sudo asterisk -rx "dialplan show 2003@sip-local" 
[ Context 'sip-local' created by 'pbx_config' ]
'2003' => 1. Dial(SIP/310410226242003) [pbx_config]

-= 1 extension (1 priority) in 1 context. =-

The extension was 2003, the IMSI is 310410226242003.

Resolving an IMSI to a numeric address

dburgess@pBook> sudo asterisk -rx "sip show user 310410226242003" 

** Name : 310410226242003
Secret : <Not set>
MD5Secret : <Not set>
Context : sip-external
Language :
AMA flags : Unknown
Transfer mode: open
MaxCallBR : 384 kbps
CallingPres : Presentation Allowed, Not Screened
Call limit : 0
Callgroup :
Pickupgroup :
Callerid : "" <2003>
ACL : No
Codec Order : (gsm:20)
Auto-Framing: No

Get the numeric address from the Callerid line.
Here, the IMSI is 310410226242003 and the numeric address is 2003.

Find the most recent BTS IP for an IMSI

dburgess@pBook> sudo asterisk -rx "database showkey SIP/Registry/310410226242003" 
/SIP/Registry/310410226242003 : 127.0.0.1:5062:3600:310410226242003:sip:310410226242003@127.0.0.1:5061;rinstance=6cc428b1f3f45ada

Here, IMSI 310410226242003 was most recently registered on port 5062 on localhost.

Insert a new ISDN/Address Pair

We will do this by modifying sip.conf and extensions.conf and then reloading them into Asterisk.
We should not do this more often than once every few minutes, though.

Update the recent BTS IP for a given IMSI

This is done by the BTS itself via the SIP interface during the registration process. That already works.

The HLR Implemented in MySQL

In the long run (after the Asterisk version works) the HLR will be implemented as a MySQL database table.
From this table, we construct the sip.conf and extensions.conf files for our Asterisk servers.

Asterisk Operations

Whenever a new subscriber is added or an E.164 field or IMSI is altered, the sip.conf and extensions.conf files need to be regenerated and reloaded for the serving Asterisk server. There must be a better way to do that.






注:Mobility Management(原文出处,翻译整理仅供参考!