OsmoNITB LCR » History » Version 4
Anonymous, 02/19/2016 10:47 PM
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 | * The latest snapshot from the OpenBSC repository |
||
12 | * svn co http://bs11-abis.gnumonks.org/svn/trunk/openbsc |
||
13 | * We've got Revision 513 |
||
14 | * LCR from git repository |
||
15 | * git-clone git://git.misdn.org/git/lcr.git/ |
||
16 | * A working kernel for your linux system |
||
17 | * Support for your E1 card |
||
18 | * mISDN's l1loop module (mISDN_l1loop.ko) |
||
19 | * You can obtain a working package for Debian at https://brezn.muc.ccc.de/~codec/openbsc/ |
||
20 | * Supports cards from Cologne Chips and Junghanns |
||
21 | * libgsm + header files (libgsm / libgsm-dev on Debian) |
||
22 | * A working Asterisk setup |
||
23 | |||
24 | |||
25 | === Installation === |
||
26 | |||
27 | First of all we assume the following: |
||
28 | * Layout of your working directory: |
||
29 | * openbsc/ - checkout from OpenBSC repo |
||
30 | * lcr/ - checkout from LCR repo |
||
31 | * Installation directories: |
||
32 | * /opt/openbsc for OpenBSC |
||
33 | * /opt/lcr for LCR |
||
34 | |||
35 | We need to compile and install OpenBSC first: |
||
36 | {{{ |
||
37 | $ cd openbsc/ |
||
38 | $ sh ../lcr/autogen.sh |
||
39 | $ ./configure --prefix=/opt/openbsc |
||
40 | $ make |
||
41 | $ sudo make install |
||
42 | }}} |
||
43 | |||
44 | After that we're going for LCR. But we had to patch 2 files to make it work: |
||
45 | {{{ |
||
46 | gsm@bts-ctrl:~/cdc/openbsc$ cd ../lcr |
||
47 | }}} |
||
48 | |||
49 | Edit Makefile.am and change |
||
50 | {{{ |
||
51 | GSM_LIB = /usr/local/lib/libgsm.a /usr/local/lib/libbsc.a /usr/local/lib/libvty.a -ldbi -lcrypt |
||
52 | }}} |
||
53 | to |
||
54 | {{{ |
||
55 | GSM_LIB = /usr/lib/libgsm.a /usr/local/lib/libbsc.a /usr/local/lib/libvty.a -ldbi -lcrypt |
||
56 | }}} |
||
57 | |||
58 | And patch gsm_audio.c on line 13 from |
||
59 | {{{ |
||
60 | #include "/usr/local/include/gsm.h" |
||
61 | }}} |
||
62 | to |
||
63 | {{{ |
||
64 | #include "/usr/include/gsm.h" |
||
65 | }}} |
||
66 | |||
67 | Now we can go on with compiling LCR: |
||
68 | {{{ |
||
69 | $ sh autogen.sh |
||
70 | $ ./configure --prefix=/opt/lcr --with-asterisk --with-gsm |
||
71 | $ make |
||
72 | $ sudo make install |
||
73 | }}} |
||
74 | 2 | ||
75 | |||
76 | === LCR configuration === |
||
77 | '''1. gsm in options.conf''' |
||
78 | The gsm option in /usr/local/lcr/options.conf needs to be activated. This can be |
||
79 | simply done by adding 'gsm' as a single line to the file. |
||
80 | |||
81 | '''2. GSM interface in interface.conf''' |
||
82 | /usr/local/lcr/interface.conf holds an example for a GSM interface. Remove the comments |
||
83 | and use the example as is. |
||
84 | |||
85 | '''3. gsm.conf''' |
||
86 | Enable the debugging option in /usr/local/lcr/gsm.conf. We also need 2 mISDN loopback interfaces. |
||
87 | Create them with |
||
88 | {{{ |
||
89 | $ sudo modprobe mISDN_l1loop pri=1 nchannel=30 |
||
90 | }}} |
||
91 | You can check for the interfaces names with the misdn_info tool. All the default settings |
||
92 | should work in a BS11 setup. |
||
93 | |||
94 | '''4. Routing''' |
||
95 | We route all our calls to to asterisk at the moment, as we only have outgoing connectivity via IAX/SIP in our setup. |
||
96 | {{{ |
||
97 | [main] |
||
98 | interface=GSM : remote application=asterisk context=btsctrl |
||
99 | }}} |
||
100 | |||
101 | 1 | Calls will go to the context btsctrl in Asterisk. |
|
102 | 3 | ||
103 | |||
104 | === Asterisk configuration === |
||
105 | Our setup connects to an external Asterisk via SIP - as we don't have a second ISDN interface. |
||
106 | |||
107 | chan_lcr for Asterisk comes with LCR (compiled with --with-asterisk). You only need to load the |
||
108 | channel driver and maybe check the permissions of the LCR socket (/var/tmp/lcr.socket) - Asterisk |
||
109 | on Debian uses a Set UID wrapper. |
||
110 | |||
111 | To load chan_lcr automagically on startup add the following to your modules.conf: |
||
112 | {{{ |
||
113 | load => chan_lcr.so |
||
114 | }}} |
||
115 | |||
116 | We've created an exclusive context in extensions.conf for OpenBSC/LCR: |
||
117 | {{{ |
||
118 | [btsctrl] |
||
119 | exten => _X.,1,Set,CALLERID(num)=5552342 |
||
120 | exten => _X.,n,dial(SIP/${EXTEN}@btsctrl,120) |
||
121 | }}} |
||
122 | 4 | ||
123 | |||
124 | === Running OpenBSC/LCR and Asterisk === |
||
125 | Now we're ready to start with our GSM network. |
||
126 | Boot up the BS11 and start LCR with |
||
127 | {{{ |
||
128 | $ sudo /opt/lcr/sbin/lcr start |
||
129 | }}} |
||
130 | |||
131 | You can also use 'fork' instead of 'start' to run LCR in daemon mode, |
||
132 | but I'd rather go with fork AFTER you made you first successful call. (; |
||
133 | |||
134 | Now start Asterisk. It should connect to LCR right after startup. You |
||
135 | can check this by running |
||
136 | {{{ |
||
137 | $ sudo /opt/lcr/bin/lcradmin state |
||
138 | }}} |
||
139 | |||
140 | The UI should show |
||
141 | {{{ |
||
142 | Remote: asterisk |
||
143 | }}} |
||
144 | in the upper left part. |
||
145 | |||
146 | Connect your phone and make your call(s). |
||
147 | |||
148 | |||
149 | === Troubleshooting === |
||
150 | ==== Phones unable to connect ==== |
||
151 | On the first run I had some problems with connecting my phones as |
||
152 | the registration just timed out. I fixed this by starting over with a fresh HLR. |
||
153 | |||
154 | ==== The call routing fails (somewhere) ==== |
||
155 | Most problems occured within Asterisk for me as neither IAX2 or SIP was working. |
||
156 | This was just some kind of problem within the configuration. |
||
157 | |||
158 | I can provide a working dialplan and SIP configuration if you need it. |
||
159 | |||
160 | ==== Can't see the network ==== |
||
161 | This was either related to the phone (a restart fixed it) or the BS11. After the |
||
162 | first start I sometimes had to hardreset (as in reboot) the BS11. |