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