IMPORTANT NOTICE: This page contains information about a legacy version of the Osmocom software. This legacy version is no longer maintained. If you use it, don't be surprised if it doesn't work. It was your choice to ignore man-years worth of developments, improvements and fixes. Please migrate to the active/supported software (Osmocom CNI, consisting of OsmoBSC, OsmoMSC, OsmoHLR, OsmoSTP, OsmoMGW - a NITB style setup is described at Osmocom_Network_In_The_Box).

How to run OsmoNITB with Asterisk and LCR

This is a short walk-through to setup OsmoNITB and LCR with Asterisk.

In the end we'll have a working setup to route calls from our BTS to
the PTSN via VoIP.


  • OpenBSC equipment (BTS, E1 Card)
    • We're using a Siemens BS11 microBTS and a Cologne Chips E1 PCI card
  • Download, build and install following projects according to Build from source
    • libosmocore
    • libosmo-abis
    • openbsc ./configure --prefix=/opt/openbsc
We assume the following:
  • Layout of your working directory:
    • libosmocore/
    • libosmo-abis
    • openbsc/
    • lcr/ - checkout from LCR from git repository git-clone git://
  • Installation directories:
    • /opt/openbsc for OpenBSC
    • /opt/lcr for LCR
  • A working kernel for your Linux system
    • Support for your E1 card
    • mISDN's l1loop module (mISDN_l1loop.ko)
    • mISDN's DSP module (mISDN_dsp.ko)
    • You can obtain a working package for Debian at
    • Supports cards from Cologne Chips and Junghanns

Alternatively you can download a snapshot of the source codes, which have been tested: (go to the latest lcr-* subdirectory)

After that we're going for LCR:

$ cd ../../lcr

Linking the source directory of OpenBSC and libosmocore in the lcr-Directory:

$ ln -s ../libosmocore/ .
$ ln -s ../openbsc/openbsc/ .

  • Compiling LCR*
    Unfortunately, due to changes in OpenBSC, we have to install a patch
    for LCR, until the programmer of LCR will include this patch in the current version.
    The patch is attached to this document.
    $ sh
    $ git-apply --verbose lcrOpenBSC.patch
    $ ./configure --prefix=/opt/lcr --with-asterisk --with-gsm-bs
    $ make
    $ sudo make install

and now we can copy the module into the modules' directory of Asterisk:

$ sudo cp /usr/lib/asterisk/modules/

LCR configuration

  • gsm in options.conf

The gsm option in /usr/local/lcr/options.conf needs to be activated. This can be
simply done by adding 'gsm' as a single line to the file.

Because it is a good idea to start Asterisk without root's privileges, we want to add these lines, too:

socketuser asterisk
socketgroup asterisk

  • GSM interface in interface.conf

/usr/local/lcr/interface.conf holds an example for a GSM interface. Remove the comments
and use the example as is.

  • gsm.conf

Enable the debugging option in /usr/local/lcr/gsm.conf. We also need 2 mISDN loopback interfaces.
Create them with

  $ sudo modprobe mISDN_l1loop pri=1 nchannel=30

You can check for the interfaces names with the misdn_info tool. All the default settings
should work in a BS11 setup.
You have just to give a value for 'config' and 'hlr', with the full path of your OpenBSC configuration
file and HLR-!DataBase.

  • Routing

We route all our calls to to asterisk at the moment, as we only have outgoing connectivity via IAX/SIP in our setup.

interface=GSM                           : remote application=asterisk context=btsctrl

Calls will go to the context btsctrl in Asterisk.

Asterisk configuration

Our setup connects to an external Asterisk via SIP - as we don't have a second ISDN interface.

chan_lcr for Asterisk comes with LCR (compiled with --with-asterisk). You only need to load the
channel driver and maybe check the permissions of the LCR socket (/var/tmp/lcr.socket) - Asterisk
on Debian uses a Set UID wrapper.

To load chan_lcr automagically on startup add the following to your modules.conf:

load =>

We've created an exclusive context in extensions.conf for OpenBSC/LCR:

exten => _02X.,1,GotoIf($[${CALLERID(name)} != ""]?4)
exten => _02X.,2,Set(CALLIDORIG=${CALLERID(num)})
exten => _02X.,3,Set(CALLERID(num)=02${CALLIDORIG})
exten => _02X.,4,Dial(LCR/GSM/${EXTEN:2},120)

Running OpenBSC/LCR and Asterisk

Now we're ready to start with our GSM network.
Boot up the BS11 and start LCR with

$ sudo /opt/lcr/sbin/lcr start

You can also use 'fork' instead of 'start' to run LCR in daemon mode,
but I'd rather go with fork AFTER you made you first successful call. (;

Now start Asterisk. It should connect to LCR right after startup. You
can check this by running

$ sudo /opt/lcr/bin/lcradmin state

The UI should show

Remote: asterisk

in the upper left part.

Connect your phone and make your call(s).


Phones unable to connect
On the first run I had some problems with connecting my phones as
the registration just timed out. I fixed this by starting over with a fresh HLR.

The call routing fails (somewhere)

Most problems occured within Asterisk for me as neither IAX2 or SIP was working.
This was just some kind of problem within the configuration.

I can provide a working dialplan and SIP configuration if you need it.

Can't see the network

This was either related to the phone (a restart fixed it) or the BS11. After the
first start I sometimes had to hardreset (as in reboot) the BS11.

Files (1)
lcrOpenBSC.patch lcrOpenBSC.patch 618 Bytes Patch for LCR to work with OpenBSC , 07/16/2010 12:16 PM

Updated by laforge almost 6 years ago · 23 revisions

Add picture from clipboard (Maximum size: 48.8 MB)