OsmoNITB LCR » History » Revision 3
Revision 2 (Anonymous, 02/19/2016 10:47 PM) → Revision 3/23 (Anonymous, 02/19/2016 10:47 PM)
== 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 * svn co http://bs11-abis.gnumonks.org/svn/trunk/openbsc * We've got Revision 513 * LCR from git repository * git-clone git://git.misdn.org/git/lcr.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 https://brezn.muc.ccc.de/~codec/openbsc/ * Supports cards from Cologne Chips and Junghanns * libgsm + header files (libgsm / libgsm-dev on Debian) * A working Asterisk setup === 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/ $ sh ../lcr/autogen.sh $ ./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: {{{ gsm@bts-ctrl:~/cdc/openbsc$ cd ../lcr }}} Edit Makefile.am 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 autogen.sh $ ./configure --prefix=/opt/lcr --with-asterisk --with-gsm $ make $ sudo make install }}} === LCR configuration === '''1. 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. '''2. 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. '''3. 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. '''4. Routing''' We route all our calls to to asterisk at the moment, as we only have outgoing connectivity via IAX/SIP in our setup. {{{ [main] 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 => chan_lcr.so }}} We've created an exclusive context in extensions.conf for OpenBSC/LCR: {{{ [btsctrl] exten => _X.,1,Set,CALLERID(num)=5552342 exten => _X.,n,dial(SIP/${EXTEN}@btsctrl,120) }}}