taking a podcast and making audio available to asterisk

(see also: Phone2Podcast)

We use the [http://www.blagblagblag.org/BLASTERISK/ Blasterisk] Indymedia service for taking calls from PSTN...

the below script is called by crontab on the blasterisk server. the podcast feed address is on indypgh.org (Pittsburgh Indymedia)

we have a weekly radio show and a podcast feed for that show. this script checks the podcast feed, and if it finds a new show, it downloads the show, converts/resamples the file, and then puts it in a specific location.

# mtoups 2006/07/30

# get the xml file, find newest show
audiofileurl=`curl -A "blasterisk podcast parser booyeah" -s -L http://indypgh.org/syn/rustbelt-podcast.xml | tr '\r' '\n' | tr \' \" | sed 's/>/>\n/g' | sed -n 's/.*url="\([^"]*\)".*/\1/p' | sed 's/&/&/g' | head -1`

filename=`echo "$audiofileurl" | awk -F / '{print $NF}' | sed -e "s/%20/ /g" -e "s/%27/'/g" -e "s/%23/#/g" | awk '-F?' '{print $1}'`

#if we already downloaded this show, we're done, exit
test -f /tmp/$filename && exit 0

#otherwise, download
curl -A "blasterisk podcast parser" -o /tmp/$filename -L $audiofileurl

#convert to gsm
sox /tmp/$filename -r 8000 -c 1 /var/lib/asterisk/sounds/blast/rustbelt-latest.gsm resample -ql
#could also be a pcm wav, but needs to be 8khz resampled either way

then, the following lines are in the context menu for the Pittsburgh IMC phone number. the menu also

#to listen to this week's rustbelt radio, press 4
exten => didx-pitts,n,Background(blast/to-listen-to-rustbelt)
exten => didx-pitts,n,Background(blast/press-4)
exten => didx-pitts,n,Background(silence/1)

#play the latest show
exten => 4,1,Background(blast/rustbelt-latest)

other ideas include, sending the podcast to people's voicemail, calling somewhere and playing it, etc. please share if you're doing this!