Project

General

Profile

OsmoNITB LCR » History » Version 16

wirelesss, 12/02/2016 10:06 AM

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