Project

General

Profile

OsmoNITB LCR » History » Version 9

Anonymous, 02/19/2016 10:47 PM

1 1
== Howto OpenBSC with Asterisk and LCR ==
2
This is a short walk-through to setup OpenBSC and LCR with Asterisk.
3
4
In the end we'll have a working setup to route calls from our BTS to
5
the PTSN via VoIP.
6
7
8
=== Prerequisites ===
9
 * OpenBSC equipment (BTS, E1 Card)
10
  * We're using a Siemens BS11 microBTS and a Cologne Chips E1 PCI card
11 9
 * The latest snapshot from the !LibOmsocore repository
12
   * git clone git://git.osmocom.org/libosmocore.git
13 1
 * The latest snapshot from the OpenBSC repository
14 7 laforge
   * git clone git://bs11-abis.gnumonks.org/openbsc.git
15 1
 * LCR from git repository
16
   * git-clone git://git.misdn.org/git/lcr.git/
17
 * A working kernel for your linux system
18
   * Support for your E1 card
19
   * mISDN's l1loop module (mISDN_l1loop.ko)
20 9
   * mISDN's DSP module (mISDN_dsp.ko)
21 1
   * You can obtain a working package for Debian at https://brezn.muc.ccc.de/~codec/openbsc/
22
     * Supports cards from Cologne Chips and Junghanns
23
 * libgsm + header files (libgsm / libgsm-dev on Debian)
24
 * A working Asterisk setup
25 6
 * Original howto from https://brezn.muc.ccc.de/~codec/openbsc/howto.txt
26 1
27
28
=== Installation ===
29
30
First of all we assume the following:
31
 * Layout of your working directory:
32 9
   * libosmocore/ - checkout from !LibOmsocore rep
33 1
   * openbsc/  - checkout from OpenBSC repo
34
   * lcr/      - checkout from LCR repo
35
 * Installation directories:
36
   * /opt/openbsc for OpenBSC
37
   * /opt/lcr for LCR
38
39 9
We need to compile and install !LibOsmocore and OpenBSC first:
40 1
{{{
41 9
$ cd libosmocore/
42
$ autoreconf -i
43
$ ./configure
44
$ make
45
$ sudo make install
46
$ cd ../openbsc/openbsc/
47 5
$ autoreconf --install --force
48 1
$ ./configure --prefix=/opt/openbsc
49
$ make
50
$ sudo make install
51
}}}
52
53 9
After that we're going for LCR:
54 1
{{{
55 9
$ cd ../../lcr
56 1
}}}
57
58 9
First of all, we have to link the source directory of OpenBSC and !LibOsmocore in the lcr-Directory:
59 1
{{{
60 9
$ ln -s ../libosmocore/ .
61
$ ln -s ../openbsc/openbsc/ .
62 1
}}}
63
64 9
Now we can go on with compiling LCR. Unfortunately, due to changes in OpenBSC, we have to install a patch
65
for LCR, until the programmer of LCR will include this patch in the current version.
66
The patch is attached to this document.
67 1
{{{
68
$ sh autogen.sh
69 9
$ git-apply --verbose lcrOpenBSC.patch
70
$ ./configure --prefix=/opt/lcr --with-asterisk --with-gsm-bs
71 1
$ make
72
$ sudo make install
73
}}}
74
75 9
and now we can copy the module into the modules' directory of Asterisk:
76
{{{
77
$ sudo cp chan_lcr.so /usr/lib/asterisk/modules/
78
}}}
79 2
80 1
=== LCR configuration ===
81
'''1. gsm in options.conf'''[[BR]]
82 2
The gsm option in /usr/local/lcr/options.conf needs to be activated. This can be
83 9
simply done by adding 'gsm' as a single line to the file.[[BR]]
84
Because it is a good idea to start Asterisk without root's privileges, we want to add these lines, too:
85
{{{
86
socketuser asterisk
87
socketgroup asterisk
88
}}}
89 2
90
'''2. GSM interface in interface.conf'''[[BR]]
91 5
/usr/local/lcr/interface.conf holds an example for a GSM interface. Remove the comments
92 2
and use the example as is.
93
94
'''3. gsm.conf'''[[BR]]
95
Enable the debugging option in /usr/local/lcr/gsm.conf. We also need 2 mISDN loopback interfaces.
96
Create them with
97
{{{
98 5
  $ sudo modprobe mISDN_l1loop pri=1 nchannel=30
99 2
}}}
100
You can check for the interfaces names with the misdn_info tool. All the default settings
101
should work in a BS11 setup.
102 9
You have just to give a value for 'config' and 'hlr', with the full path of your OpenBSC configuration
103
file and HLR-!DataBase.
104 2
105 1
'''4. Routing'''[[BR]]
106
We route all our calls to to asterisk at the moment, as we only have outgoing connectivity via IAX/SIP in our setup.
107 3
{{{
108
[main]
109
interface=GSM                           : remote application=asterisk context=btsctrl
110
}}}
111
112
Calls will go to the context btsctrl in Asterisk.
113
114
115
=== Asterisk configuration ===
116
Our setup connects to an external Asterisk via SIP - as we don't have a second ISDN interface.
117
118
chan_lcr for Asterisk comes with LCR (compiled with --with-asterisk). You only need to load the
119
channel driver and maybe check the permissions of the LCR socket (/var/tmp/lcr.socket) - Asterisk
120
on Debian uses a Set UID wrapper.
121
122
To load chan_lcr automagically on startup add the following to your modules.conf:
123
{{{
124
load => chan_lcr.so
125
}}}
126
127 4
We've created an exclusive context in extensions.conf for OpenBSC/LCR:
128
{{{
129
[btsctrl]
130 9
exten => _X.,1,Dial(LCR/GSM/${EXTEN},120)
131 4
}}}
132
133
134
=== Running OpenBSC/LCR and Asterisk ===
135
Now we're ready to start with our GSM network.
136
Boot up the BS11 and start LCR with
137
{{{
138
$ sudo /opt/lcr/sbin/lcr start
139
}}}
140
141
You can also use 'fork' instead of 'start' to run LCR in daemon mode,
142
but I'd rather go with fork AFTER you made you first successful call. (;
143
144
Now start Asterisk. It should connect to LCR right after startup. You
145
can check this by running
146
{{{
147
$ sudo /opt/lcr/bin/lcradmin state
148
}}}
149
150
The UI should show
151
{{{
152
Remote: asterisk
153
}}}
154
in the upper left part.
155
156
Connect your phone and make your call(s).
157
158
159
=== Troubleshooting ===
160
==== Phones unable to connect ====
161
On the first run I had some problems with connecting my phones as
162
the registration just timed out. I fixed this by starting over with a fresh HLR.
163
164
==== The call routing fails (somewhere) ====
165
Most problems occured within Asterisk for me as neither IAX2 or SIP was working.
166
This was just some kind of problem within the configuration.
167
168 1
I can provide a working dialplan and SIP configuration if you need it.
169
170
==== Can't see the network ====
171
This was either related to the phone (a restart fixed it) or the BS11. After the
172
first start I sometimes had to hardreset (as in reboot) the BS11.
Add picture from clipboard (Maximum size: 48.8 MB)