Project

General

Profile

OsmoNITB » History » Version 17

laforge, 03/06/2016 05:08 AM

1 1 zecke
h1. osmo-nitb
2 15 laforge
3 17 laforge
{{>toc}}
4 1 zecke
5 17 laforge
[[OsmoNITB:]] (formerly called _bsc_hack_) is the name of [[OpenBSC:]] in NITB (network in the box) mode.
6 1 zecke
7
See [[OpenBSC:#ConfigurationsModes|Configurations and Modes]] to understand the difference between [[OsmoNITB:]] and [[OsmoBSC:]] mode.
8
9 17 laforge
h2. Manuals
10 1 zecke
11 17 laforge
* User Manual: http://ftp.osmocom.org/docs/latest/osmonitb-usermanual.pdf
12
* VTY Reference: http://ftp.osmocom.org/docs/latest/osmonitb-vty-reference.pdf
13
14 1 zecke
h2. Configuration
15
16
17 17 laforge
[[OsmoNITB:]] has a configuration file.  The default config file name is @openbsc.cfg@ in the current working directory of the osmo-nitb process.
18 15 laforge
19
You can specify an alternate config file location by using the @--config-file@ command line argument.
20 1 zecke
21 17 laforge
For more information, please see the User manual linked above.
22 15 laforge
23
24 1 zecke
h2. Dealing with the HLR
25 4 laforge
26 17 laforge
We currently use a quite simple sqlite3 database for the HLR.  In fact, it is more than just a HLR, since it actually stores entries even about any subscriber or phone that tries to log into your network.
27 1 zecke
28 17 laforge
We obtain the IMSI and IMEI of every LOCATION UPDATING REQUEST, and then if neccessary create a new entry for the equipment as well as the subscribers in the respective tables.
29 1 zecke
30 4 laforge
The schama looks like:
31 15 laforge
<pre>
32 1 zecke
CREATE TABLE Equipment (id INTEGER PRIMARY KEY AUTOINCREMENT, created TIMESTAMP NOT NULL, updated TIMESTAMP NOT NULL, imei NUMERIC UNIQUE NOT NULL, name TEXT);
33 15 laforge
CREATE TABLE [[EquipmentWatch]] (id INTEGER PRIMARY KEY AUTOINCREMENT, created TIMESTAMP NOT NULL, updated TIMESTAMP NOT NULL, subscriber_id NUMERIC NOT NULL, equipment_id NUMERIC NOT NULL, UNIQUE (subscriber_id, equipment_id) );
34 1 zecke
CREATE TABLE Meta (id INTEGER PRIMARY KEY AUTOINCREMENT, key TEXT UNIQUE NOT NULL, value TEXT NOT NULL);
35
CREATE TABLE Subscriber (id INTEGER PRIMARY KEY AUTOINCREMENT, created TIMESTAMP NOT NULL, updated TIMESTAMP NOT NULL, imsi NUMERIC UNIQUE NOT NULL, name TEXT, extension TEXT UNIQUE, authorized INTEGER NOT NULL DEFAULT 0, tmsi TEXT UNIQUE, lac INTEGER NOT NULL DEFAULT 0);
36 15 laforge
</pre>
37 1 zecke
38 12 laforge
If the subscrber.authorized field is set to '1', then we allocate a TMSI and answer with LOCATION UPDATING ACCEPT.  Otherwise, we send
39 15 laforge
a regular LOCATION UPDATING REJECT to refuse the mobile to roam to our network.  You can change the reject cause using _--reject-cause_.
40 12 laforge
41 1 zecke
You can allow everyone to join your network by using the _auth policy accept_ config file option.
42 15 laforge
43
44
h3. HLR modification using the telnet interface
45 1 zecke
46
47 15 laforge
You can telnet to port 4242 of the machine that runs osmo-nitb and try some of the commands, e.g. for dealing with subscribers.
48 12 laforge
49 1 zecke
Then you can type statements like
50
51 15 laforge
<pre>
52 1 zecke
subscriber imsi 012340123456789 authorized 1
53 15 laforge
</pre>
54 1 zecke
 which will enable this subscriber to enter the network
55
56 15 laforge
<pre>
57 12 laforge
subscriber imsi 012340123456789 extension 5555
58 15 laforge
</pre>
59 1 zecke
 which will assign the telephone number 5555 to the subscriber with the specified IMSI
60
61 15 laforge
<pre>
62 1 zecke
subscriber imsi 012340123456789 name Peter
63 15 laforge
</pre>
64
 which will associate the name _Peter_ with the subscriber record
65 1 zecke
66 15 laforge
<pre>
67 1 zecke
show subscriber imsi 012340123456789
68 15 laforge
</pre>
69 1 zecke
 which will show you all information about the respective subscriber
70
71 15 laforge
<pre>
72 1 zecke
 subscriber imsi 012340123456789 sms send test123
73 15 laforge
</pre>
74
 which will send a SMS with the content _test123_ to the respective subscriber
75 1 zecke
76 12 laforge
77 15 laforge
h3. Raw SQL access
78
79
80 1 zecke
Instead of the manual commands on the VTY, you can also directly access the underlying HLR SQL database table.
81 12 laforge
82
83 15 laforge
h4. Authorizing a particular IMSI
84
85
86 12 laforge
To authorize your mobile station you will need to execute the following comand:
87
88 15 laforge
<pre>
89 12 laforge
$ sqlite3 hlr.sqlite
90
update Subscriber set authorized=1 where imsi=YOUR_IMSI;
91 15 laforge
</pre>
92 12 laforge
93
94 15 laforge
h4. Assigning an extension number IMSI
95
96
97 5 laforge
In order to call a phone, you need to assign an extension number (phone number) for the IMSI.
98
99 15 laforge
In the following example, we assign the extension number _4444_:
100 7 laforge
101 15 laforge
<pre>
102 7 laforge
$ sqlite3 hlr.sqlite
103 12 laforge
update Subscriber set extension=4444 where imsi=YOUR_IMSI;
104 15 laforge
</pre>
105 7 laforge
106
107 15 laforge
h4. finding IMEIs for a given IMSI
108
109
110
<pre>
111 1 zecke
$ sqlite3 hlr.sqlite
112
select equipment.imei from equipment,equipmentwatch,subscriber where equipmentwatch.equipment_id=equipment.id and subscriber.id=equipmentwatch.subscriber_id and subscriber.imsi=YOUR_IMSI;
113 15 laforge
</pre>
114 13 ipse
115
116
h4. List IMSI to extensions mapping
117 15 laforge
118 13 ipse
119 1 zecke
<pre>
120 15 laforge
sqlite3 -line hlr.sqlite3 'select imsi,extension from subscriber;'
121
</pre>
122 1 zecke
123 15 laforge
124
h2. Common Problems
125
126
127
128
h3. Failed to init database
129
130
131
<pre>
132 8 laforge
$ ./osmo-nitb
133
DB: Failed to create connection.
134
DB: Failed to init database. Please check the option settings.
135 15 laforge
</pre>
136 8 laforge
137 9 laforge
This is most likely caused by one of the following problems
138 15 laforge
* the sqlite3 backend for DBD (dbd-sqlite3) has not been installed
139
* osmo-nitb does not have write permissions to the local directory
Add picture from clipboard (Maximum size: 48.8 MB)