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