OsmoNITB LCR » History » Revision 8

« Previous | Revision 8/23 (diff) | Next »
zecke, 02/19/2016 10:47 PM
advertize autoreconf

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

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

=== Prerequisites === * OpenBSC equipment (BTS, E1 Card) * We're using a Siemens BS11 microBTS and a Cologne Chips E1 PCI card * The latest snapshot from the OpenBSC repository * git clone git:// * LCR from git repository * git-clone git:// * A working kernel for your linux system * Support for your E1 card * mISDN's l1loop module (mISDN_l1loop.ko) * You can obtain a working package for Debian at * Supports cards from Cologne Chips and Junghanns * libgsm + header files (libgsm / libgsm-dev on Debian) * A working Asterisk setup * Original howto from

=== Installation ===

First of all we assume the following: * Layout of your working directory: * openbsc/ - checkout from OpenBSC repo * lcr/ - checkout from LCR repo * Installation directories: * /opt/openbsc for OpenBSC * /opt/lcr for LCR

We need to compile and install OpenBSC first: {{{
$ cd openbsc/
$ autoreconf --install --force
$ ./configure --prefix=/opt/openbsc
$ make
$ sudo make install

After that we're going for LCR. But we had to patch 2 files to make it work: {{{
$ cd ../lcr

Edit and change {{{
GSM_LIB = /usr/local/lib/libgsm.a /usr/local/lib/libbsc.a /usr/local/lib/libvty.a -ldbi -lcrypt
to {{{
GSM_LIB = /usr/lib/libgsm.a /usr/local/lib/libbsc.a /usr/local/lib/libvty.a -ldbi -lcrypt

And patch gsm_audio.c on line 13 from {{{
#include "/usr/local/include/gsm.h"
to {{{
#include "/usr/include/gsm.h"

Now we can go on with compiling LCR: {{{
$ sh
$ ./configure --prefix=/opt/lcr --with-asterisk --with-gsm
$ make
$ sudo make install

=== LCR configuration ===
'''1. gsm in options.conf'''BR
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.

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

'''3. gsm.conf'''BR
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.

'''4. Routing'''BR
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 => _X.,1,Set,CALLERID=5552342
exten => _X.,n,dial(SIP/${EXTEN}@btsctrl,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).

=== Troubleshooting === ==== 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.

Updated by zecke almost 6 years ago · 8 revisions

Add picture from clipboard (Maximum size: 48.8 MB)