The RRLP server code is located in (openbts root)/RRLP/trunk. It's written in Erlang, so you'll need to install Erlang to make any progress.
sudo apt-get install erlang
It also requires a webserver capable of hanging CGI scripts to route RRLP requests. Apache works:
sudo apt-get install apache2
Boa also works, if you think Apache is to heavy for your system, although the official release of Bao does not support SSL should you even want to secure this service.
First, build the RRLP server. This is done with the Makefile
cd (openbts root)/RRLP/trunk make
Ok, this is where it gets tricky. Firstly, you'll need to note where your webserver stores it's CGI scripts. For the default version of Apache in the Ubuntu repositories, this is /usr/lib/cgi-bin. You then need to modify setUpfiles.sh to target this new directory.
So in the default case, the line
must be changed to
With this change in place, you then run
sudo sh setUpFiles.sh
There are three distinct tests to run.
First, verify the webserver is operating correctly by visiting it. For most users, this will be http://localhost/cgi-bin/rrlpserver.cgi. If it is correctly installed, you should see the string
Secondly, we can test if the RRLP server is operating correctly. This is done with the "rrfake" script. It is used as following:
./rrfake loc ./rrfake assist ./rrfake testpos
If any of those fail, you likely have not installed erlang correctly, or you have no access to the directory where the temporary location files are stored. Reading the error messages will help.
Web + RRLP
Lastly, we can test the entire pipeline with the "rrtest" script. First, you'll need to modify it to target your webserver. Change
wget -qO- 'http://localhost/~doug/rrlpserver.cgi?... and wget -qO- 'http://localhost/rrlpserver.cgi?...
to your web address. In the default install, this would be:
wget -qO- 'http://localhost/cgi-bin/rrlpserver.cgi?... and wget -qO- 'http://localhost/cgi-bin/rrlpserver.cgi?...
You can then run the scripts:
./rrtest loc ./rrtest assist ./rrtest testpos
If these work, congrats! If not, the most common issues are permissions-based. Basically, the RRLP server stores temporary files in a location (/var/run/ by default) which the webserver may not have access to.
Ok, we're almost there. Now you have to configure OpenBTS to communicate with your webserver. This is done through changing two fields. The Control.LUR.QueryRRLP tells openBTS to send an RRLP query on every Location Update Request. The GSM.RRLP.SERVER.URL config variable tells OpenBTS where to look for the application.
(from the OpenBTS CLI) config Control.LUR.QueryRRLP true config GSM.RRLP.SERVER.URL http://localhost/cgi-bin/rrlpserver.cgi
As of now, the only way to cause RRLP queries is through a Location Update Request (LUR). These are done when a handset first camps, as well as periodically by the system, as defined by the GSM.Timer.T3212 variable in OpenBTS's configuration. On such an event, the RRLP query is generated and the handset returns its location, if available. This is then stored in the subscriber registry by OpenBTS. The following command will gather all of the data from the RRLP table:
sqlite3 /var/lib/asterisk/sqlite3dir/sqlite3.db "SELECT * FROM RRLP"
No Location for a Handset
Not all handsets support RRLP. To check for this, grep your OpenBTS log (generally in /var/log/OpenBTS.log if you have it configured) for any MobilityManagement? logs.
grep "MobilityManagement" /var/log/OpenBTS.log
If you see a line like the following:
Dec 1 16:43:26 UCBTelco openbts: INFO 3066018672 MobilityManagement.cpp:354:transact: MS says: message not implemented
That means the handset does not support RRLP.