Project

General

Profile

OsmoNITB » History » Revision 18

Revision 17 (laforge, 03/06/2016 05:08 AM) → Revision 18/22 (laforge, 03/06/2016 05:14 AM)

h1. osmo-nitb 

 {{>toc}} 

 [[OsmoNITB:]] (formerly called _bsc_hack_) is the name of [[OpenBSC:]] in NITB (network in the box) mode. 

 See [[OpenBSC:OpenBSC#Configurations-Modes|OpenBSC Configurations [[OpenBSC:#ConfigurationsModes|Configurations and Modes]] to understand the difference between [[OsmoNITB:]] and [[OsmoBSC:]] mode. 

 h2. Manuals 

 * User Manual: http://ftp.osmocom.org/docs/latest/osmonitb-usermanual.pdf 
 * VTY Reference: http://ftp.osmocom.org/docs/latest/osmonitb-vty-reference.pdf 

 h2. Configuration 


 [[OsmoNITB:]] has a configuration file.    The default config file name is @openbsc.cfg@ in the current working directory of the osmo-nitb process. 

 You can specify an alternate config file location by using the @--config-file@ command line argument. 

 For more information, please see the User manual linked above. 


 h2. Dealing with the HLR 

 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. 

 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. 

 The schama looks like: 
 <pre> 
 CREATE TABLE Equipment (id INTEGER PRIMARY KEY AUTOINCREMENT, created TIMESTAMP NOT NULL, updated TIMESTAMP NOT NULL, imei NUMERIC UNIQUE NOT NULL, name TEXT); 
 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) ); 
 CREATE TABLE Meta (id INTEGER PRIMARY KEY AUTOINCREMENT, key TEXT UNIQUE NOT NULL, value TEXT NOT NULL); 
 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); 
 </pre> 

 If the subscrber.authorized field is set to '1', then we allocate a TMSI and answer with LOCATION UPDATING ACCEPT.    Otherwise, we send 
 a regular LOCATION UPDATING REJECT to refuse the mobile to roam to our network.    You can change the reject cause using _--reject-cause_. 

 You can allow everyone to join your network by using the _auth policy accept_ config file option. 


 h3. HLR modification using the telnet interface 


 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. 

 Then you can type statements like 

 <pre> 
 subscriber imsi 012340123456789 authorized 1 
 </pre> 
  which will enable this subscriber to enter the network 

 <pre> 
 subscriber imsi 012340123456789 extension 5555 
 </pre> 
  which will assign the telephone number 5555 to the subscriber with the specified IMSI 

 <pre> 
 subscriber imsi 012340123456789 name Peter 
 </pre> 
  which will associate the name _Peter_ with the subscriber record 

 <pre> 
 show subscriber imsi 012340123456789 
 </pre> 
  which will show you all information about the respective subscriber 

 <pre> 
  subscriber imsi 012340123456789 sms send test123 
 </pre> 
  which will send a SMS with the content _test123_ to the respective subscriber 


 h3. Raw SQL access 


 Instead of the manual commands on the VTY, you can also directly access the underlying HLR SQL database table. 


 h4. Authorizing a particular IMSI 


 To authorize your mobile station you will need to execute the following comand: 

 <pre> 
 $ sqlite3 hlr.sqlite 
 update Subscriber set authorized=1 where imsi=YOUR_IMSI; 
 </pre> 


 h4. Assigning an extension number IMSI 


 In order to call a phone, you need to assign an extension number (phone number) for the IMSI. 

 In the following example, we assign the extension number _4444_: 

 <pre> 
 $ sqlite3 hlr.sqlite 
 update Subscriber set extension=4444 where imsi=YOUR_IMSI; 
 </pre> 


 h4. finding IMEIs for a given IMSI 


 <pre> 
 $ sqlite3 hlr.sqlite 
 select equipment.imei from equipment,equipmentwatch,subscriber where equipmentwatch.equipment_id=equipment.id and subscriber.id=equipmentwatch.subscriber_id and subscriber.imsi=YOUR_IMSI; 
 </pre> 


 h4. List IMSI to extensions mapping 


 <pre> 
 sqlite3 -line hlr.sqlite3 'select imsi,extension from subscriber;' 
 </pre> 


 h2. Common Problems 



 h3. Failed to init database 


 <pre> 
 $ ./osmo-nitb 
 DB: Failed to create connection. 
 DB: Failed to init database. Please check the option settings. 
 </pre> 

 This is most likely caused by one of the following problems 
 * the sqlite3 backend for DBD (dbd-sqlite3) has not been installed 
 * osmo-nitb does not have write permissions to the local directory
Add picture from clipboard (Maximum size: 48.8 MB)