Saturday, December 13, 2014

Complete working software

Telephony network from scratch

dependency libraries
yum install opencore-amr
From LCR only, this package installs GSM adaptive multirate codecs and the EFR codec. The Full-Rate codec is included in LCR's repository.

wget http://sourceforge.net/projects/opencore-amr/files/opencore-amr/
tar xvzf opencore-amr-x.x.x.tar.gz
cd opencore-amr-x.x.x
./configure
make
make install
ldconfig
cd ..

This package installs the open source SIP stack of Nokia Research Center.

wget http://sourceforge.net/projects/sofia-sip/files/sofia-sip/
tar xvzf sofia-sip-x.xx.xx.tar.gz
cd sofia-sip-x.xx.xx
./configure
make
make install
ldconfig
cd ..


This package installs the open source RTP protocol required for libosmo-abis.

wget http://download.savannah.gnu.org/releases/linphone/ortp/sources/
tar xvzf ortp-x.xx.x.tar.gz
cd ortp-x.xx.x
./configure
make
make install
ldconfig
cd ..
 
yum install sqlite3 libdbi dbd-sqlite3 

This package installs the core utility library for various Osmocom projects.
git clone git://git.osmocom.org/libosmocore.git
cd libosmocore
autoreconf -i
./configure
make
make install
ldconfig
cd ..

This package installs the core utility library for various Osmocom projects.
git clone git://git.osmocom.org/libosmo-abis.git
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/ ./configure .....

cd libosmo-abis
# change branch:
git checkout -b jolly/multi-trx origin/jolly/multi-trx
autoreconf -i
./configure
(sometimes it is necessary to point to different .../lib/pkgconfig/ path: PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/ ./configure .....)
make
make install
ldconfig
cd ..

This package installs the [wiki:osmo-nitb Osmocom Network In The Box] software
git clone git://git.osmocom.org/openbsc.git
cd openbsc/openbsc/
# change branch:
git checkout -b jolly/testing origin/jolly/testing
autoreconf -i
./configure
(sometimes it is necessary to point to different .../lib/pkgconfig/ path: PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/ ./configure .....)
make
make install
cd ../..


This package installs the open source Base Transceiver Station.
git clone git://git.osmocom.org/osmo-bts.git
cd osmo-bts
#change branch:
git checkout -b jolly/trx origin/jolly/trx
autoreconf -i
./configure --enable-trx
(sometimes it is necessary to point to different .../lib/pkgconfig/ path: PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/ ./configure .....)
make
make install
cd ..

This package installs the open source PBX software to bridge ISDN (DSS1) / SIP / GSM (MNCC protocol)
git clone git://git.misdn.eu/lcr.git/
cd lcr
autoreconf -i
./configure --with-sip --with-gsm-bs --with-gsm-ms
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/ ./configure .....
make
make install
ldconfig
cd ..


Configuration examples

OsmoBTS
mkdir ~/.osmocom
vim ~/.osmocom/osmo-bts.cfg

bts 0
 band DCS1800
 ipa unit-id 1801 0
 oml remote-ip 127.0.0.1
 rtp bind-ip 127.0.0.1
 rtp jitter-buffer 0
 paging lifetime 0
 gsmtap-sapi bcch
 gsmtap-sapi ccch
 gsmtap-sapi rach
 gsmtap-sapi agch
 gsmtap-sapi pch
 gsmtap-sapi sdcch
 gsmtap-sapi pacch
 gsmtap-sapi pdtch
 gsmtap-sapi sacch
 fn-advance 20
 ms-power-loop -10
 timing-advance-loop
 trx 0
  rxgain 0
  power 0

OpenBSC
mkdir ~/.osmocom
vim ~/.osmocom/open-bsc.cfg

Change 'arfcn' to a frequency you have license for

e1_input
 e1_line 0 driver ipa
 e1_line 0 port 0
network
 network country code 262
 mobile network code 42
 short name OpenBSC
 long name OpenBSC
 auth policy accept-all
 location updating reject cause 13
 encryption a5 0
 neci 1
 paging any use tch 0
 rrlp mode ms-based
 mm info 1
 handover 0
 handover window rxlev averaging 10
 handover window rxqual averaging 1
 handover window rxlev neighbor averaging 10
 handover power budget interval 6
 handover power budget hysteresis 3
 handover maximum distance 9999
 timer t3101 10
 timer t3103 0
 timer t3105 0
 timer t3107 0
 timer t3109 0
 timer t3111 0
 timer t3113 60
 timer t3115 0
 timer t3117 0
 timer t3119 0
 timer t3122 10
 timer t3141 0
 dtx-used 0
 subscriber-keep-in-ram 0
 bts 0
  type sysmobts
  band DCS1800
  cell_identity 0
  location_area_code 1
  training_sequence_code 7
  base_station_id_code 63
  ms max power 0
  cell reselection hysteresis 4
  rxlev access min 0
  periodic location update 30
  channel allocator descending
  rach tx integer 9
  rach max transmission 7
  channel-descrption attach 1
  channel-descrption bs-pa-mfrms 5
  channel-descrption bs-ag-blks-res 1
  ip.access unit_id 1801 0
  oml ip.access stream_id 255 line 0
  neighbor-list mode automatic
  trx 0
   rf_locked 0
   arfcn 869
   nominal power 0
   max_power_red 0
   rsl e1 tei 0
    timeslot 0
     phys_chan_config CCCH+SDCCH4
     hopping enabled 0
    timeslot 1
     phys_chan_config TCH/F
     hopping enabled 0
    timeslot 2
     phys_chan_config TCH/F
     hopping enabled 0
    timeslot 3
     phys_chan_config TCH/F
     hopping enabled 0
    timeslot 4
     phys_chan_config TCH/F
     hopping enabled 0
    timeslot 5
     phys_chan_config TCH/F
     hopping enabled 0
    timeslot 6
     phys_chan_config TCH/F
     hopping enabled 0
    timeslot 7
     phys_chan_config TCH/F
     hopping enabled 0


Linux-Call-Router (LCR) (optional)
vim /usr/local/etc/lcr/options.conf
Add a line to show logging to the console:
debug 0x100000

The simplest configuration uses only the GSM interface. It allows LCR to forward calls from GSM to GSM or from GSM to a call test feature.

vim /usr/local/etc/lcr/interface.conf

You can remove or comment everything and just add this interface:
[gsm]
gsm-bs
tones yes
earlyb no
extern


routing.conf
vim /usr/local/etc/lcr/routing.conf

You can remove or comment everything and just add these rulesets:

[main]
interface=gsm                           : goto ruleset=gsm
                                        : disconnect cause=31

[gsm]
dialing=99                              : test
                                        : extern interfaces=gsm


Look at the gsm rule set. All calls that dial '99' prefix, will be test calls. All other calls will be forwarded back to 'gsm' interface.

Running 
Open a shell and start OpenBSC:
osmo-nitb -c ~/.osmocom/open-bsc.cfg -l ~/.osmocom/hlr.sqlite3 -P -C --debug=DRLL:DCC:DMM:DRR:DRSL:DNM

OpenBSC runs as a stand-alone network with given config file and data base. In order to use LCR, add '-m' option. In this case the LCR replaces the built-in call control.
osmo-nitb -c ~/.osmocom/open-bsc.cfg -l ~/.osmocom/hlr.sqlite3 -P -m -C --debug=DRLL:DCC:DMM:DRR:DRSL:DNM

Very important is the option '-C'. On certain machines, osmo-nitb will halt from time to time while writing counters to database. This Without this option, audio might interrupt several seconds from time to time.
The debugging is usefull for early tests, because you will quickly see what happens if a mobile requests something.

<0005> bsc_init.c:422 
WARNING: You are running an 'accept-all' network on a BTS that is not barred.
This configuration is likely to interfere with production GSM networks and
should only be used in a RF shielded environment such as a faraday cage!

<0019> input/ipaccess.c:925 enabling ipaccess BSC mode
DB: Database initialized.
DB: Database prepared.
<001d> sms_queue.c:220 Attempting to send 20 SMS


Open a shell and start OsmoBTS:
osmobts-trx -c ~/.osmocom/osmo-bts.cfg

Refer to the [wiki:OsmoTRX] page on how to run OsmoTRX.
 
The installation/setup/calibration of UmTRX is beyond the scope of this document. Please refer to:
https://github.com/fairwaves
http://files.ettus.com/uhd_docs/manual/html/build.html
http://wush.net/trac/rangepublic/wiki/BuildInstallRun

calypso-BTS
Building Osmocom-BB with arm-elf toolchain is also beyond the scope of this document. If you managed to compile and run Osmocom-BB you should be able to run the transceiver too.
git clone git://git.osmocom.org/libosmo-dsp.git
git clone git://git.osmocom.org/osmocom-bb.git
In order to compile Osmocom-BB with transceiver support, do the following:
cd libosmo-dsp
autoreconf -i
./configure
(sometimes it is necessary to point to different .../lib/pkgconfig/ path: PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/ ./configure .....)
make
make install
cd ..

cd osmocom-bb
# change branch:
git checkout -b jolly/testing origin/jolly/testing
cd src
make
# after it compiles, just enable transceiver support
cd host/layer23
./configure --enable-transceiver
make

'''NOTE: "ms-power-loop" at osmo-bts.cfg should be set to -65, in order to prevent saturating the input. Also if the phone is only one or few meters away, "ms max power" should be set to 0. In case of long distance test it can be set to 30 (DCS) or 33 (GSM 900).'''

Now you should start with a single phone for one timeslot only. If it works, you can try two phones to serve two timeslots. Since you have only one slot, you will only be able to transmit broadcast, do location updating and send/receive SMS. Here is the "osmo-bts.cfg" for a single timeslot:
bts 0
 band DCS1800
 ipa unit-id 1801 0
 oml remote-ip 127.0.0.1
 rtp jitter-buffer 0
 paging queue-size 200
 paging lifetime 0
 fn-advance 30
 ms-power-loop -60
 timing-advance-loop
 settsc
 setbsic
 trx 0
  rxgain 0
  power 0
  slotmask 1 0 0 0 0 0 0 0

Run osmocon and transceiver application in separate shells:
# Please refer to Osmocom-BB wiki for compiling and running own firmware on compal phones...
osmocon -p /dev/ttyUSB0 -m c123xor -c path_to/trx.highram.bin -r 99

transceiver -e 5 -r 99

When using two phones, two timeslots can be served. I suggest to configure second timeslot (TS 1) as TCH/H at openbsc.cnf. This way it is possible to allow two traffic channels on a single timeslot. If you do a call from one phone to another, you will need one channel for each phone. In order to use two phones, you need to change the alot map of osmo-bts.cnf:
  slotmask 1 1 0 0 0 0 0 0

Run two osmocon and transceiver application in separate shells:
osmocon -p /dev/ttyUSB0 -m c123xor -c path_to/trx.highram.bin -r 99

# This osmocon connects to the serial interface of the second phone.
# Note: "/tmp/osmocom_l2.2" is the second socket to which the transceiver will connect.
osmocon -p /dev/ttyUSB1 -s /tmp/osmocom_l2.2 -m c123xor -c path_to/trx.highram.bin -r 99

transceiver -e 5 -r 99 -2

Run Linux-Call-Router (LCR) (optional) with debugging output
lcr start


Test
Location Updating 
Switch on the phone.
If you have a SIM card for your network 262 42, you can use it and do automatic network search. If not, do a manual network and select this network. You should see debugging output on OpenBSC like this:
 <0002> gsm_04_08.c:424 -> LOCATION UPDATE ACCEPT

Call the music (LCR required)
Now enter phone number 995 to select the test function 5 of LCR. This test function just plays the hold music.
Echo and BFI test (LCR required) 

Enter phone number 993 to select the test function 3 of LCR. This test function echoes back everything that is received. Note that it will re-transcode the speech data, so the audio from your voice is compressed and decompressed twice until you can hear a fraction of a second later.

You may experience short beeps. These beeps represent all bad frames that could not be decoded or got lost over the air. (Without this test, the missing frames will be extrapolated from previous frame, so some loss rate will not be recognized by the remote end.)

Original post is here
http://openbsc.osmocom.org/trac/wiki/network_from_scratch

3 comments:

  1. The command : git checkout -b jolly/testing origin/jolly/testing with the osmo-bts don't run know, but i would like to have this version, if you have a zip program of this , it's very thankfull

    ReplyDelete
  2. My mail is radiarisainanasitraka@yahoo.fr

    ReplyDelete
  3. Hello Dast
    Thanks for for reading and trying my blog
    The branch you are trying may be merge to master.
    It is a bit old and I didn't update it

    ReplyDelete