Skip to content
22.05.2015 / Fliker09

How to become independent mobile operator (USRP B200 + OpenBTS)


Today me and my colleague made an experiment — we tried getting up our own mobile base station. We succeeded! In order to save this success I decided write it down for future reference. Lets start!

First thing to mention is PC configuration. As far as we know it should run on Beagle Bone Black with Debian 7 Wheezy (with some small tweaks) and, in our case, PC x86_64 with Ubuntu 12.04. We will try later to run on Banana Pi with Lubuntu 14.12 and PC x86_64 with Ubuntu 15.04; I will update this article correspondingly. Bear in mind that we succeeded only with voice calls — SMS, GPRS and VoIP are waiting for our configuration and testing, but AFAIK it should work. OK, now let’s get to the dirty work!

The usual thing — update the packages DB:

sudo apt-get update

Install required packages:

sudo apt-get install nano bash-completion libboost-date-time-dev libboost-filesystem-dev libboost-program-options-dev libboost-regex-dev libboost-system-dev libboost-thread-dev libboost-test-dev subversion git build-essential cmake python-dev autoconf libtool libosip2-dev libusb-dev sqlite3 libsqlite3-dev libreadline6-dev libncurses5-dev python-cheetah php5 php5-cgi libapache2-mod-php5 libusb-1.0.0-dev libortp-dev asterisk

Pretty crazy mix, but I didn’t look thoroughly — just used the one I found. Now let’s create a working directory and switch to it:

mkdir ~/src
cd ~/src

In order to use SDR devices, in our case USRP B200, we need UHD. In case of Ubuntu 12.04 running on PC x86_64 we can skip compilation — DEB packet exists:

wget http://files.ettus.com/binaries/uhd_stable/latest_stable/uhd_003.008.004-release_Ubuntu-12.04-x86_64.deb
sudo dpkg -i uhd_003.008.004-release_Ubuntu-12.04-x86_64.deb
sudo apt-get -f install
sudo uhd_images_downloader.py

For BBB you need to compile… Sad but fact:

git clone git://github.com/EttusResearch/uhd.git
cd uhd/host
mkdir build
cd build
cmake ../ -DENABLE_MANUAL=OFF -DENABLE_DOXYGEN=OFF -DENABLE_MAN_PAGES=OFF -DENABLE_B200=ON -DENABLE_USB=ON
make
sudo make install
cd ../../..
sudo /usr/local/lib/uhd/utils/uhd_images_downloader.py

The stock transceiver application coming with OpenBTS didn’t work well for us (and won’t work at all on BBB), so we will use osmo-trx:

git clone git://git.osmocom.org/osmo-trx
cd osmo-trx
autoreconf -i
./configure #for BBB: ./configure --with-neon
make
sudo make install
cd ..

It’s time to get the OpenBTS itself!

svn co http://wush.net/svn/range/software/public openbts

We need a53 library first:

cd openbts/a53/trunk
sudo make install
cd ../../..

Compile OpenBTS:

#For BBB we need to tweak a file:
sed -i s/AM_CFLAGS\ \=\ \$\(STD_DEFINES_AND_INCLUDES\)\ \-std\=gnu99\ \-march\=native/AM_CFLAGS\ \=\ \$\(STD_DEFINES_AND_INCLUDES\)\ \-std\=gnu99\ \-march\=armv7\-a/ openbts/openbts/trunk/Transceiver52M/Makefile.in
#Now to the dirty part:
cd openbts/openbts/trunk
autoreconf -i
./configure --with-uhd
make

OpenBTS needs to be configured, through DB:

sudo mkdir /etc/OpenBTS
sudo sqlite3 -init apps/OpenBTS.example.sql /etc/OpenBTS/OpenBTS.db ".quit"
cd ../..

For subscriber registration we need sipauthserve:

sudo mkdir -p /var/lib/asterisk/sqlite3dir
cd subscriberRegistry/trunk
make
sudo sqlite3 -init subscriberRegistry.example.sql /etc/OpenBTS/sipauthserve.db ".quit"
cd ../..

Message manager is needed! Compile smqueue:

cd smqueue/trunk
autoreconf -i
./configure
make
sudo sqlite3 -init smqueue/smqueue.example.sql /etc/OpenBTS/smqueue.db ".quit"
cd ~

Final assembling step:

mkdir bin
cd bin
cp ../src/openbts/smqueue/trunk/smqueue/smqueue .
cp ../src/openbts/subscriberRegistry/trunk/sipauthserve .
cp ../src/openbts/openbts/trunk/apps/{OpenBTS,OpenBTSCLI} .

First thing to do after all this pain — run the connection with our SDR device:

sudo osmo-trx -f

We can now run OpenBTS bundle:

sudo su
./smqueue &
./sipauthserve &
./OpenBTS

If OpenBTS doesn’t exit and you see something like this:

system ready
use the OpenBTSCLI utility to access CLI

it means the system is up and needs just final touches. Let’s do it!

sudo ./OpenBTSCLI
config Control.LUR.OpenRegistration .* # everybody will be able to connect to your network!
config GSM.Identity.MNC 07 #7, or something bigger, because you don't want to have the same code as one of the already existing GSM operators in your region
config GSM.Identity.MCC 262 #set it accordingly to your country!
config GSM.Radio.C0 85 #channel 85. Why? Good question!
quit
sudo killall OpenBTS
sudo ./OpenBTS

Now take your phone and connect to your newly created mobile base station! You will receive shortly a SMS with your IMSI — you will need it for further configuration. Last step — we need Asterisk to server our voice calls:

sudo mv /etc/asterisk/extensions.conf /etc/asterisk/extensions.conf.backup
sudo mv /etc/asterisk/sip.conf /etc/asterisk/sip.conf.backup
sudo nano /etc/asterisk/extensions.conf #copy the content from here: http://pastebin.com/PRrV9NnS
sudo nano /etc/asterisk/sip.conf #copy the content from here: http://pastebin.com/NGYE3W6K

Modify IMSI codes to the corresponding ones and change callerid to the desired ones. Final command:

sudo service asterisk restart

Make your first call and cry like a child! To be completed…

Реклама

Добавить комментарий

Заполните поля или щелкните по значку, чтобы оставить свой комментарий:

Логотип WordPress.com

Для комментария используется ваша учётная запись WordPress.com. Выход / Изменить )

Фотография Twitter

Для комментария используется ваша учётная запись Twitter. Выход / Изменить )

Фотография Facebook

Для комментария используется ваша учётная запись Facebook. Выход / Изменить )

Google+ photo

Для комментария используется ваша учётная запись Google+. Выход / Изменить )

Connecting to %s

%d такие блоггеры, как: