Project

General

Profile

OsmoNITB LCR » History » Version 15

laforge, 02/20/2016 07:53 PM

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