Stream the current Green Bay weather as an Asterisk extension

Add the appropriate entry in the /etc/asterisk/extensions_custom.conf file.  If you run a GUI such as with Trixbox (phpconfig for Asterisk PBX), you'll need to have the configuration editor re-read the configs, after you edit and append to this file.


[custom-gbwx]
exten => s,1,Answer
exten => s,2,System(/usr/bin/lynx -source -dump http://odeo.com/show/110741/4/download/CurrentWeather-.mp3 > /tmp/gbwx.mp3)
exten => s,3,MP3Player(/tmp/gbwx.mp3)
exten => s,4,hangup

And/Or:

[from-internal-custom]
exten => 612,1,Answer
exten => 612,n,Playback(welcome)
exten => 612,n,Wait(1)
exten => 612,n,Playback(to-hear-weather-status&please-enter-your&zip-code)
exten => 612,n,Read(APCODE,beep,5)
exten => 612,n,Playback(auth-thankyou&one-moment-please)
exten => 612,n,StartMusicOnHold()
exten => 612,n,System(/usr/bin/curl -o /tmp/zip.mp3 -s http://audio.pirateweather.com/${APCODE}.mp3)
exten => 612,n,System(lame --decode /tmp/zip.mp3 /tmp/zip.wav)
exten => 612,n,System(sox -V /tmp/zip.wav -r 8000 -c 1 -w /tmp/zip.raw)
exten => 612,n,StopMusicOnHold()
exten => 612,n,Playback(/tmp/zip)
exten => 612,n,System(rm /tmp/zip.mp3 /tmp/zip.wav /tmp/zip.raw -f)
exten => 612,n,Playback(thank-you-for-calling)
exten => 612,n,Wait(1)
exten => 612,n,Playback(goodbye)
exten => 612,n,Hangup

And/Or:

[custom-gbwx]
exten => s,1,Answer
exten => s,2,MP3Player,http://audioplayer.wunderground.com/kimweather/Green_Bay.mp3
exten => s,3,hangup

 

Lastly is how to assign a numerical extension.  This is probably best added into the extensions_additional.conf file. Most people are probably using a web front end like FreePBX or the one in AsteriskNOW to manage extensions.   

The issue I've noticed is that changes really need to be made via the GUI.  This is because the GUI doesn't check or re-read the underlying asterisk conf files.  So what I'm saying is if you add code to the extensions_additional.conf or other files manually from the shell, you; 1) Won't see these under the GUI, and will have no GUI way to manage them.  2.) The changes you make from the shell won't be read until you force the system to do so, like is necessary above.

So I'll explain how to provision it through the GUI.  It's kind of crude, but I did it under FreePBX, by adding a ring group. In my case I had Ring group 181 ring extension 181 for a ring time of 1 second.  I set the Destination if no answer to the Custom App "custom-gbwx,s,1"