RepeaterPage » History » Version 5
matt, 10/24/2017 11:43 PM
1 | 2 | matt | h1. SUMMARY |
---|---|---|---|
2 | 1 | zecke | |
3 | * Simultaneous multi-channel transmission/reception |
||
4 | * Uses USRP and/or conventional receiver/transmitter hardware |
||
5 | * Generic interface to Asterisk via app_rpt (full VOIP, radio control, and standard repeater functions) |
||
6 | * Features: P25, analog NBFM with CTCSS |
||
7 | * Expected to be fully "ROIP" [Radio Over IP] compatible |
||
8 | |||
9 | 2 | matt | h2. Multi-channel reception using the USRP |
10 | 1 | zecke | |
11 | Assume we want to receive simultaneously the four signals shown below; |
||
12 | one conventional (analog) FM voice channel plus three P25 |
||
13 | signals. The two P25 voice channels are to be IMBE-decoded whereas the |
||
14 | P25 data channel is to be sent to Wireshark after decoding. For all three voice |
||
15 | channels, we want to forward the received PTT and audio info to Asterisk app_rpt. |
||
16 | The received PTT [Push To Talk, or "keyed"] signal is a bit that ideally tracks |
||
17 | the state of the PTT key at transmitter, indicating the presence or absence of the |
||
18 | received signal. |
||
19 | |||
20 | [[Image(sa.png)]] |
||
21 | |||
22 | Fig. 1 - Spectrum of repeater input band (sample; diagram not to scale) |
||
23 | |||
24 | For now, it's necessary to edit the source code file manually to specify |
||
25 | the list of channels/modes to be received (file usrp_rx.py): |
||
26 | |||
27 | 3 | matt | <pre> |
28 | 1 | zecke | channels = [ |
29 | {'freq':435.200e6, 'mode':'c4fm', 'port':32001}, |
||
30 | {'freq':435.350e6, 'mode':'fm', 'port':32002, 'ctcss':97.4}, |
||
31 | {'freq':435.600e6, 'mode':'cqpsk', 'port':23456, 'wireshark':1}, |
||
32 | {'freq':435.775e6, 'mode':'cqpsk', 'port':32003} |
||
33 | ] |
||
34 | 3 | matt | </pre> |
35 | 1 | zecke | |
36 | Individual channels are defined one per line; note that all definition lines |
||
37 | except the last must end with a comma. |
||
38 | |||
39 | We choose a frequency somewhere close to the center of this band. |
||
40 | which will set the USRP's nominal receive frequency; this must also |
||
41 | be manually set in the source file: |
||
42 | |||
43 | 3 | matt | <pre> |
44 | 1 | zecke | center_freq = 435.500e6 |
45 | 3 | matt | </pre> |
46 | 1 | zecke | |
47 | Before running the receiver app, we |
||
48 | * measure the current calibration error value (I use kalibrate) |
||
49 | * determine the optimum USRP receiver gain value |
||
50 | The values used in this example are +1234 and 35, respectively. |
||
51 | |||
52 | We're now ready to start the receiver: |
||
53 | |||
54 | 3 | matt | <pre> |
55 | 1 | zecke | usrp_rx.py -RA -c 1234 -H 127.0.0.1 -g 35 -d 25 |
56 | 3 | matt | </pre> |
57 | 1 | zecke | |
58 | The receiver continuously monitors all four channels. For each of the three |
||
59 | voice channels, the audio and the PTT info ("key up" and "key down" events) |
||
60 | are forwarded to asterisk app_rpt over separate UDP channels. |
||
61 | |||
62 | = P25 and/or analog NBFM Reception using a discriminator-tapped receiver = |
||
63 | |||
64 | One or more disc-tapped conventional receivers may be used at the same time, and can |
||
65 | coexist with one or more USRP's. |
||
66 | |||
67 | An audio cable is connected between the disc-tap point in the receiver and the PC soundcard. |
||
68 | |||
69 | Single-channel reception is possible using disctap_rx.py. |
||
70 | The app dynmically auto-detects the modulation type (P25 or analog NBFM). |
||
71 | |||
72 | Audio and PTT events are forwarded to asterisk app_rpt over two separate UDP |
||
73 | channels, depending on modulation type: |
||
74 | * received P25 audio is sent to asterisk on UDP port 32004 |
||
75 | * when analog NBFM is received with the proper CTCSS tone (97.4 Hz), port 32005 is used |
||
76 | |||
77 | 3 | matt | <pre> |
78 | 1 | zecke | disctap_rx.py -i -A 0.05 -c 97.4 -H 127.0.0.1 -p 32004 -g 35 -d 25 |
79 | 3 | matt | </pre> |
80 | 1 | zecke | |
81 | The -g (gain) parameter is used to set the proper audio gain level. See |
||
82 | the hardware page for further guidance - this value is important for achieving |
||
83 | correct operation. |
||
84 | |||
85 | 3 | matt | h2. Asterisk and app_rpt |
86 | 1 | zecke | |
87 | For all voice modes (IMBE and analog FM) the audio is transmitted |
||
88 | as frames over the UDP channel to and from Asterisk in the standard native audio format: |
||
89 | * 50 frames per second |
||
90 | * 160 audio samples per frame |
||
91 | * 8000 samples per second |
||
92 | * signed |
||
93 | * 16-bit |
||
94 | * linear |
||
95 | |||
96 | 3 | matt | h3. Build asterisk with app_rpt |
97 | 1 | zecke | |
98 | As a prereq make sure the Linux kernel headers are installed, as zaptel installs kernel modules. |
||
99 | |||
100 | First obtain and unpack the sources |
||
101 | |||
102 | 3 | matt | - http://ohnosec.org/drupal/node/6 [use @svn checkout@ to grab the "Asterisk Sources"] |
103 | 1 | zecke | |
104 | 3 | matt | Locate the toplevel directory - this should have several subdirectories including @zaptel@ and @asterisk@ . |
105 | 1 | zecke | |
106 | 3 | matt | Then locate the subdirectory named @asterisk/channels@ , |
107 | and copy the files @chan_usrp.c@ and @chan_usrp.h@ (from @repeater/src/lib@ in the op25 sources) to this subdirectory. |
||
108 | 1 | zecke | |
109 | Now, build and install asterisk and app_rpt |
||
110 | |||
111 | 3 | matt | @cd@ to the toplevel directory |
112 | |||
113 | @cd zaptel && ./configure && make && sudo make install@ |
||
114 | |||
115 | 1 | zecke | and then (again from the toplevel directory) |
116 | |||
117 | 3 | matt | @cd asterisk && ./configure && make && sudo make install@ |
118 | |||
119 | |||
120 | 1 | zecke | For a first time installation of asterisk there are also other steps such as config file installation. |
121 | 3 | matt | Before setting up @rpt.conf@ you must first set up asterisk itself - see for example |
122 | 1 | zecke | |
123 | http://www.voip-info.org/wiki/view/Asterisk+quickstart |
||
124 | |||
125 | 3 | matt | h2. Configuration |
126 | 1 | zecke | |
127 | 3 | matt | We define five repeater nodes in @/etc/asterisk/rpt.conf@ |
128 | 1 | zecke | |
129 | 3 | matt | <pre> |
130 | 1 | zecke | [000] |
131 | rxchannel = usrp/127.0.0.1:34001:32001 |
||
132 | duplex = 2 |
||
133 | scheduler=scheduler |
||
134 | functions = functions-repeater |
||
135 | hangtime=0 |
||
136 | authlevel = 0 |
||
137 | |||
138 | [001] |
||
139 | rxchannel = usrp/127.0.0.1:34002:32002 |
||
140 | duplex = 2 |
||
141 | scheduler=scheduler |
||
142 | functions = functions-repeater |
||
143 | hangtime=0 |
||
144 | authlevel = 0 |
||
145 | |||
146 | [002] |
||
147 | rxchannel = usrp/127.0.0.1:34003:32003 |
||
148 | duplex = 2 |
||
149 | scheduler=scheduler |
||
150 | functions = functions-repeater |
||
151 | hangtime=0 |
||
152 | authlevel = 0 |
||
153 | |||
154 | [003] |
||
155 | rxchannel = usrp/127.0.0.1:34004:32004 |
||
156 | duplex = 2 |
||
157 | scheduler=scheduler |
||
158 | functions = functions-repeater |
||
159 | hangtime=0 |
||
160 | authlevel = 0 |
||
161 | |||
162 | [004] |
||
163 | rxchannel = usrp/127.0.0.1:34005:32005 |
||
164 | duplex = 2 |
||
165 | scheduler=scheduler |
||
166 | functions = functions-repeater |
||
167 | hangtime=0 |
||
168 | authlevel = 0 |
||
169 | 3 | matt | </pre> |
170 | 1 | zecke | |
171 | Continuing the example of five voice channels from above, we define five repeater nodes (channels). Voice and PTT traffic that |
||
172 | is output by asterisk/app_rpt for RF transmission is forwarded to usrp_tx.py (see below) using UDP ports in the 3400x range. |
||
173 | Voice data received in usrp_rx.py and/or disctap_rx.py is forwarded to asterisk/app_rpt (chan_usrp.c) via ports in the 3200x range. |
||
174 | |||
175 | 3 | matt | The driver invocation in @rpt.conf@ is |
176 | <pre> |
||
177 | 1 | zecke | usrp/HISIP:HISPORT[:MYPORT] |
178 | HISIP is the IP address (or FQDN) of the GR app |
||
179 | HISPORT is the UDP socket of the GR app |
||
180 | MYPORT (optional) is the UDP socket that Asterisk listens on |
||
181 | for this channel |
||
182 | 3 | matt | </pre> |
183 | 1 | zecke | |
184 | 4 | matt | TIP: You can use the @usrp show@ command to display status information from within the Asterisk CLI. |
185 | 1 | zecke | |
186 | 3 | matt | TIP: Another handy command is @rpt playback@ to start transmission on a channel. |
187 | 1 | zecke | |
188 | 3 | matt | h2. Channel Bank Configuration |
189 | 1 | zecke | |
190 | Typically the audio links are terminated on channel banks which provide a standard interface to user |
||
191 | equipment. Commonly, this equipment places an "offhook" indication on the signalling circuit when it |
||
192 | wishes to initiate a radio transmission, and signals the end of the transmission by placing the circuit |
||
193 | in the "onhook" state. Standard audio transmission levels are defined at the channel bank interface. |
||
194 | |||
195 | 3 | matt | A standard FXS port on the channel bank is defined in @/etc/asterisk/zapata.conf@ with |
196 | <pre> |
||
197 | 1 | zecke | signalling=fxo_ls |
198 | immediate=yes |
||
199 | context = chan1 |
||
200 | channel => 1 |
||
201 | 3 | matt | </pre> |
202 | 1 | zecke | |
203 | An offhook (PTT) signal from user equipment on the FXS channel bank port |
||
204 | 3 | matt | (due to the @immmediate=yes@) starts processing in @/etc/asterisk/extensions.conf@: |
205 | 1 | zecke | |
206 | 3 | matt | <pre> |
207 | 1 | zecke | [chan1] |
208 | exten => s,1,Dial(local/1@radio/n) |
||
209 | 3 | matt | </pre> |
210 | This jumps to extension "1" in context @radio@ (also in @/etc/asterisk/extensions.conf@) |
||
211 | <pre> |
||
212 | 1 | zecke | [radio] |
213 | exten => 1,1,rpt(000|D) |
||
214 | exten => 2,1,rpt(001|D) |
||
215 | exten => 3,1,rpt(002|D) |
||
216 | exten => 4,1,rpt(003|D) |
||
217 | exten => 5,1,rpt(004|D) |
||
218 | 3 | matt | </pre> |
219 | 1 | zecke | |
220 | So the call resulting from the offhook (PTT) signal is routed to |
||
221 | 3 | matt | extension "1" in context @[radio]@ where it's connected to the desired |
222 | 1 | zecke | repeater node (channel). If the GR app is running it will initiate |
223 | radio transmission. An onhook signal on the FXS channel bank port |
||
224 | causes the end of the transmission by ending the asterisk call in |
||
225 | 3 | matt | progress*. The @hangtime=0@ setting in @rpt.conf@ was used to reduce the |
226 | 1 | zecke | tail delay in this setup. |
227 | |||
228 | *The end of the transmission may be modified however, for example when |
||
229 | app_rpt appends an "ID" or if a "timeout" occurs. |
||
230 | |||
231 | Note: "Dumb" mode is used in these examples (theory: if it can't be made to work in its dumb mode, there's no prayer of getting smart mode to work) |
||
232 | |||
233 | 3 | matt | h2. USRP Transmission |
234 | 1 | zecke | |
235 | The multi-channel USRP transmitter app currently has some limitations: |
||
236 | * Transmit channel spacing is at arbitrary 25 KHz intervals |
||
237 | * Analog NBFM mode is not yet supported |
||
238 | Before running the app you must first determine (example values shown in square brackets - YMMV) |
||
239 | * the USRP TX daughterboard ID (A or B) [A] |
||
240 | * carrier frequency of the first ("center") TX channel [435.125 MHz] |
||
241 | * number of channels to be transmitted [five] |
||
242 | * the first UDP port number over which usrp_tx.py receives data from chan_usrp.c [port 34001] |
||
243 | Example: |
||
244 | 3 | matt | |
245 | @usrp_tx.py -TA -e -f 435.125e6 -n 5 -p 34001@ |
||
246 | |||
247 | 1 | zecke | Here we also request a FFT display. With port 34001 as the starting UDP port number and |
248 | 3 | matt | five channels, @usrp_tx.py@ listens on ports 34001-34005 for TX traffic coming from chan_usrp.c, as |
249 | configured in @/etc/asterisk/rpt.conf@ (see above). |
||
250 | 1 | zecke | |
251 | 3 | matt | h2. Soundcard Transmission |
252 | 1 | zecke | |
253 | The soundcard TX program outputs an analog waveform that is suitable for application to the |
||
254 | modulator stage of an FM transmitter. It listens on the UDP port for audio frames sent to it |
||
255 | by asterisk/chan_usrp. The analog audio thus received is encoded by the soundcard TX app to |
||
256 | IMBE voice code words, which are in turn assembled into P25 voice frames (LDU1/LDU2's). The |
||
257 | resulting 4800 baud symbol stream is then RRC filtered and shaped according to the P25 spec. |
||
258 | This signal is output to the sound card (and optionally to an on-screen oscilloscope using |
||
259 | 3 | matt | the @-e@ option). |
260 | 1 | zecke | |
261 | This app may be run on the same server as asterisk or on a different machine. |
||
262 | |||
263 | Currently only a single channel is supported (per invocation of soundcard_tx). If more than |
||
264 | one TX channel is to be used simultaneously, run a another copy of the app (either on a different |
||
265 | host or using a different UDP port). |
||
266 | |||
267 | Syntax: |
||
268 | |||
269 | 5 | matt | @soundcard_tx.py -g 0.3 -p 32001@ |
270 | 3 | matt | |
271 | |||
272 | The gain value (@0.3@) would cause the output envelope (ranging from -3 to +3) to be scaled to |
||
273 | 1 | zecke | fit within the standard band from -1 to +1. Values larger than 0.3 may cause clipping and distortion. |
274 | |||
275 | The final output amplitude to the radio can also be adjusted in discrete steps using the audio mixer |
||
276 | 3 | matt | application (e.g., @alsamixer@) |