Project

General

Profile

RepeaterPage » History » Revision 7

Revision 6 (matt, 10/26/2017 12:51 AM) → Revision 7/11 (matt, 10/26/2017 12:54 AM)

h1. SUMMARY 

  * Simultaneous multi-channel transmission/reception 
  * Uses USRP and/or conventional receiver/transmitter hardware 
  * Generic interface to Asterisk via app_rpt (full VOIP, radio control, and standard repeater functions) 
  * Features: P25, analog NBFM with CTCSS 
  * Expected to be fully "ROIP" [Radio Over IP] compatible 

 h2. Multi-channel reception using the USRP 

 Assume we want to receive simultaneously the four signals shown below; 
 one conventional (analog) FM voice channel plus three P25 
 signals.    The two P25 voice channels are to be IMBE-decoded whereas the 
 P25 data channel is to be sent to Wireshark after decoding.    For all three voice 
 channels, we want to forward the received PTT and audio info to Asterisk app_rpt. 
 The received PTT [Push To Talk, or "keyed"] signal is a bit that ideally tracks 
 the state of the PTT key at transmitter, indicating the presence or absence of the 
 received signal. 

 !spectrum.png! !sa.png! 

 Fig. 1 - Spectrum of repeater input band (sample; diagram not to scale) 

 For now, it's necessary to edit the source code file manually to specify 
 the list of channels/modes to be received (file usrp_rx.py): 

 <pre> 
 channels = [ 
	 {'freq':435.200e6, 'mode':'c4fm',    'port':32001}, 
	 {'freq':435.350e6, 'mode':'fm',      'port':32002, 'ctcss':97.4}, 
	 {'freq':435.600e6, 'mode':'cqpsk', 'port':23456, 'wireshark':1}, 
	 {'freq':435.775e6, 'mode':'cqpsk', 'port':32003} 
 ] 
 </pre> 

 Individual channels are defined one per line; note that all definition lines 
 except the last must end with a comma. 

 We choose a frequency somewhere close to the center of this band. 
 which will set the USRP's nominal receive frequency; this must also 
 be manually set in the source file: 

 <pre> 
 center_freq = 435.500e6 
 </pre> 

 Before running the receiver app, we 
  * measure the current calibration error value (I use kalibrate) 
  * determine the optimum USRP receiver gain value 
 The values used in this example are +1234 and 35, respectively. 

 We're now ready to start the receiver: 

 <pre> 
 usrp_rx.py -RA -c 1234 -H 127.0.0.1 -g 35 -d 25 
 </pre> 

 The receiver continuously monitors all four channels.    For each of the three 
 voice channels, the audio and the PTT info ("key up" and "key down" events) 
 are forwarded to asterisk app_rpt over separate UDP channels. 

  = P25 and/or analog NBFM Reception using a discriminator-tapped receiver = 

 One or more disc-tapped conventional receivers may be used at the same time, and can 
 coexist with one or more USRP's. 

 An audio cable is connected between the disc-tap point in the receiver and the PC soundcard. 

 Single-channel reception is possible using disctap_rx.py. 
 The app dynmically auto-detects the modulation type (P25 or analog NBFM). 

 Audio and PTT events are forwarded to asterisk app_rpt over two separate UDP 
 channels, depending on modulation type: 
  * received P25 audio is sent to asterisk on UDP port 32004 
  * when analog NBFM is received with the proper CTCSS tone (97.4 Hz), port 32005 is used 

 <pre> 
  disctap_rx.py -i -A 0.05 -c 97.4 -H 127.0.0.1 -p 32004 -g 35 -d 25 
 </pre> 

 The -g (gain) parameter is used to set the proper audio gain level.    See 
 the hardware page for further guidance - this value is important for achieving 
 correct operation. 

 h2. Asterisk and app_rpt 

 For all voice modes (IMBE and analog FM) the audio is transmitted 
 as frames over the UDP channel to and from Asterisk in the standard native audio format: 
  * 50 frames per second 
  * 160 audio samples per frame 
  * 8000 samples per second 
  * signed 
  * 16-bit 
  * linear 

 h3. Build asterisk with app_rpt 

 As a prereq make sure the Linux kernel headers are installed, as zaptel installs kernel modules. 

 First obtain and unpack the sources 

  - http://ohnosec.org/drupal/node/6     [use @svn checkout@ to grab the "Asterisk Sources"] 

 Locate the toplevel directory - this should have several subdirectories including @zaptel@ and @asterisk@ . 

 Then locate the subdirectory named @asterisk/channels@ , 
 and copy the files @chan_usrp.c@ and @chan_usrp.h@ (from @repeater/src/lib@ in the op25 sources) to this subdirectory. 

 Now, build and install asterisk and app_rpt 

 @cd@ to the toplevel directory 

 @cd zaptel && ./configure && make && sudo make install@ 

 and then (again from the toplevel directory) 

 @cd asterisk && ./configure && make && sudo make install@ 


 For a first time installation of asterisk there are also other steps such as config file installation. 
 Before setting up @rpt.conf@ you must first set up asterisk itself - see for example 

 http://www.voip-info.org/wiki/view/Asterisk+quickstart 

 h2. Configuration 

 We define five repeater nodes in @/etc/asterisk/rpt.conf@ 

 <pre> 
 [000] 
 rxchannel = usrp/127.0.0.1:34001:32001 
 duplex = 2 
 scheduler=scheduler 
 functions = functions-repeater 
 hangtime=0 
 authlevel = 0 

 [001] 
 rxchannel = usrp/127.0.0.1:34002:32002 
 duplex = 2 
 scheduler=scheduler 
 functions = functions-repeater 
 hangtime=0 
 authlevel = 0 

 [002] 
 rxchannel = usrp/127.0.0.1:34003:32003 
 duplex = 2 
 scheduler=scheduler 
 functions = functions-repeater 
 hangtime=0 
 authlevel = 0 

 [003] 
 rxchannel = usrp/127.0.0.1:34004:32004 
 duplex = 2 
 scheduler=scheduler 
 functions = functions-repeater 
 hangtime=0 
 authlevel = 0 

 [004] 
 rxchannel = usrp/127.0.0.1:34005:32005 
 duplex = 2 
 scheduler=scheduler 
 functions = functions-repeater 
 hangtime=0 
 authlevel = 0 
 </pre> 

 Continuing the example of five voice channels from above, we define five repeater nodes (channels).    Voice and PTT traffic that  
 is output by asterisk/app_rpt for RF transmission is forwarded to usrp_tx.py (see below) using UDP ports in the 3400x range. 
 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. 

 The driver invocation in @rpt.conf@ is 
 <pre> 
     usrp/HISIP:HISPORT[:MYPORT]        
     HISIP is the IP address (or FQDN) of the GR app 
     HISPORT is the UDP socket of the GR app 
     MYPORT (optional) is the UDP socket that Asterisk listens on 
              for this channel    
 </pre> 

 TIP: You can use the @usrp show@ command to display status information from within the Asterisk CLI. 

 TIP: Another handy command is @rpt playback@ to start transmission on a channel. 

 h2. Channel Bank Configuration 

 Typically the audio links are terminated on channel banks which provide a standard interface to user 
 equipment.    Commonly, this equipment places an "offhook" indication on the signalling circuit when it 
 wishes to initiate a radio transmission, and signals the end of the transmission by placing the circuit 
 in the "onhook" state.    Standard audio transmission levels are defined at the channel bank interface. 

 A standard FXS port on the channel bank is defined in @/etc/asterisk/zapata.conf@ with 
 <pre> 
 signalling=fxo_ls 
 immediate=yes 
 context = chan1 
 channel => 1 
 </pre> 

 An offhook (PTT) signal from user equipment on the FXS channel bank port  
 (due to the @immmediate=yes@) starts processing in @/etc/asterisk/extensions.conf@: 

 <pre> 
 [chan1] 
 exten => s,1,Dial(local/1@radio/n) 
 </pre> 
 This jumps to extension "1" in context @radio@ (also in @/etc/asterisk/extensions.conf@) 
 <pre> 
 [radio] 
 exten => 1,1,rpt(000|D) 
 exten => 2,1,rpt(001|D) 
 exten => 3,1,rpt(002|D) 
 exten => 4,1,rpt(003|D) 
 exten => 5,1,rpt(004|D) 
 </pre> 

 So the call resulting from the offhook (PTT) signal is routed to  
 extension "1" in context @[radio]@ where it's connected to the desired 
 repeater node (channel).    If the GR app is running it will initiate 
 radio transmission.    An onhook signal on the FXS channel bank port 
 causes the end of the transmission by ending the asterisk call in 
 progress*. The @hangtime=0@ setting in @rpt.conf@ was used to reduce the 
 tail delay in this setup. 

 *The end of the transmission may be modified however, for example when 
 app_rpt appends an "ID" or if a "timeout" occurs. 

 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) 

 h2. USRP Transmission 

 The multi-channel USRP transmitter app currently has some limitations: 
  * Transmit channel spacing is at arbitrary 25 KHz intervals 
  * Analog NBFM mode is not yet supported 
 Before running the app you must first determine (example values shown in square brackets - YMMV) 
  * the USRP TX daughterboard ID (A or B) [A] 
  * carrier frequency of the first ("center") TX channel [435.125 MHz] 
  * number of channels to be transmitted [five] 
  * the first UDP port number over which usrp_tx.py receives data from chan_usrp.c [port 34001] 
 Example: 

 @usrp_tx.py -TA -e -f 435.125e6 -n 5 -p 34001@ 

 Here we also request a FFT display. With port 34001 as the starting UDP port number and 
 five channels, @usrp_tx.py@ listens on ports 34001-34005 for TX traffic coming from chan_usrp.c, as 
 configured in @/etc/asterisk/rpt.conf@ (see above). 

 h2. Soundcard Transmission 

 The soundcard TX program outputs an analog waveform that is suitable for application to the 
 modulator stage of an FM transmitter.    It listens on the UDP port for audio frames sent to it 
 by asterisk/chan_usrp.    The analog audio thus received is encoded by the soundcard TX app to 
 IMBE voice code words, which are in turn assembled into P25 voice frames (LDU1/LDU2's).    The 
 resulting 4800 baud symbol stream is then RRC filtered and shaped according to the P25 spec. 
 This signal is output to the sound card (and optionally to an on-screen oscilloscope using 
 the @-e@ option). 

 This app may be run on the same server as asterisk or on a different machine. 

 Currently only a single channel is supported (per invocation of soundcard_tx).    If more than 
 one TX channel is to be used simultaneously, run a another copy of the app (either on a different 
 host or using a different UDP port). 

 Syntax: 

 @soundcard_tx.py -g 0.3 -p 32001@ 


 The gain value (@0.3@) would cause the output envelope (ranging from -3 to +3) to be scaled to 
 fit within the standard band from -1 to +1.    Values larger than 0.3 may cause clipping and distortion. 

 The final output amplitude to the radio can also be adjusted in discrete steps using the audio mixer 
 application (e.g., @alsamixer@)
Add picture from clipboard (Maximum size: 48.8 MB)