Project

General

Profile

OsmoNITB LCR » History » Version 12

Anonymous, 02/19/2016 10:47 PM
Correct GIT url (at least for me).

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