Rafael Micro R820T tuner as USB SDR source for hold music in asterisk PBX

So you want to play a local radio station, HAM repeater or other radio source 24MHz-1700MHz as hold music in asterisk. $8-$18 buys you the USB radio, antenna and all depending on source. Here is how you do it.

# Install git and libusb
$ sudo apt-get install git-core libusb-1.0-0-dev

# Change to your build directory
$ cd /usr/src/

# Download the source
$ git clone git://git.osmocom.org/rtl-sdr.git

# Build with autotools
$ cd rtl-sdr/
$ autoreconf -i
$ ./configure
$ make
$ sudo make install
$ sudo ldconfig

# In order to be able to use the dongle as a non-root user, you may install the appropriate udev rules file by calling
$ sudo make install-udev-rules

# Plug in the USB radio, and check if it is detected
$ lsusb
Bus 001 Device 008: ID 0bda:2838 Realtek Semiconductor Corp.

#Test by playing FM 91.1MHz to local speaker
$ rtl_fm -f 91.1M -W -r 32k - | aplay -r 32k -f S16_LE

# Update your Asterisk Music On Hold config
$ vi /etc/asterisk/musiconhold.conf

[default]
mode=custom
application=/usr/local/bin/rtl_fm -f 91.1M -W -r 8k -

# Restart
/etc/init.d/asterisk restart


http://sdr.osmocom.org/trac/wiki/rtl-sdr
http://kmkeen.com/rtl-demod-guide/
http://www.nooelec.com/store/software-defined-radio/sdr-receivers/nooelec-nesdr-nano-sdr-dvb-t-usb-stick-r820t-w-antenna-and-remote-control.html

2 comments:

Unknown said...

I keep getting;

WARNING[27441]: res_musiconhold.c:719 monmp3thread: poll() failed: Interrupted system call

Gavin Hollinger said...

Stephen, SDR needs some horsepower behind it. My guess is res_musiconhold.c is running out of data. Might need some buffering in your case. However, you will need to search elsewhere about that error. I have no experience with it.