OsmoNITB LCR » History » Revision 20
Revision 19 (wirelesss, 12/08/2016 06:09 PM) → Revision 20/23 (wirelesss, 12/08/2016 06:11 PM)
h2. 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]]. h3. Prerequisites * [[OpenBSC:]] equipment (BTS, E1 Card) ** We're using a Siemens BS11 microBTS and a Cologne Chips E1 PCI card * get source codes of the following projects according to [[cellular-infrastructure:Build from source]] https://osmocom.org/projects/cellular-infrastructure/wiki/Build_from_source: ** libosmocore ** openbsc ** libosmo-abis * LCR from git repository *** git-clone git://git.misdn.org/lcr.git/ * 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 https://brezn.muc.ccc.de/~codec/openbsc/ *** Supports cards from Cologne Chips and Junghanns * libgsm and header files (libgsm / libgsm-dev on Debian) * A working Asterisk setup * Original howto from https://brezn.muc.ccc.de/~codec/openbsc/howto.txt Alternatively you can download a snapshot of the source codes, which have been tested: http://www.linux-call-router.de/download/ (go to the latest lcr-* subdirectory) h3. Installation Build and install the following projects ** libosmocore ** openbsc @./configure --prefix=/opt/openbsc@ We assume the following: * Layout of your working directory: *** libosmocore/ *** openbsc/ *** lcr/ - checkout from LCR repo * Installation directories: *** /opt/openbsc for [[OpenBSC:]] *** /opt/lcr for LCR After that we're going for LCR: <pre> $ cd ../../lcr </pre> First of all, we have to link the source directory of [[OpenBSC:]] and libosmocore in the lcr-Directory: <pre> $ ln -s ../libosmocore/ . $ ln -s ../openbsc/openbsc/ . </pre> Now we can go on with 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. <pre> $ sh autogen.sh $ git-apply --verbose lcrOpenBSC.patch $ ./configure --prefix=/opt/lcr --with-asterisk --with-gsm-bs $ make $ sudo make install </pre> and now we can copy the module into the modules' directory of Asterisk: <pre> $ sudo cp chan_lcr.so /usr/lib/asterisk/modules/ </pre> h3. 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. Because it is a good idea to start Asterisk without root's privileges, we want to add these lines, too: <pre> socketuser asterisk socketgroup asterisk </pre> *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 <pre> $ sudo modprobe mISDN_l1loop pri=1 nchannel=30 </pre> 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. *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. <pre> [main] interface=GSM : remote application=asterisk context=btsctrl </pre> Calls will go to the context btsctrl in Asterisk. h3. 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: <pre> load => chan_lcr.so </pre> We've created an exclusive context in extensions.conf for [[OpenBSC:]]/LCR: <pre> [btsctrl] 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) </pre> h3. Running [[OpenBSC:]]/LCR and Asterisk Now we're ready to start with our GSM network. Boot up the BS11 and start LCR with <pre> $ sudo /opt/lcr/sbin/lcr start </pre> 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 <pre> $ sudo /opt/lcr/bin/lcradmin state </pre> The UI should show <pre> Remote: asterisk </pre> in the upper left part. Connect your phone and make your call(s). h3. 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. h4. 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. h4. 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.