Project

General

Profile

OsmoNITB LCR » History » Version 23

laforge, 03/23/2018 01:00 PM

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