login | register
Fri 16 of May, 2008 [14:58 UTC]

voip-info.org

Search with Google
Search this site with Google. Results may not include recent changes.
 
Google Ads
Shoutbox
  • Juan Ortega, Thu 15 of May, 2008 [10:33 UTC]: Hi everybody, I'm Juan, an ITCom student, and I need to know what basic elements I need to create a VoIP network. Can anybody helpme, please?,Thank you very much
  • gineta, Wed 14 of May, 2008 [03:58 UTC]: any here not fine the configuration of firewall juniper -screem for VOIP asterisk????
  • Anoop Prabhakaran, Tue 13 of May, 2008 [12:16 UTC]: I am developing Asterisk IVR, Whenever i make a internation call to the IVR system, the DTMF is not getting detected properly, this happens only for the first time, second call onwards system works fine. why this is happening
  • joe, Mon 12 of May, 2008 [04:27 UTC]: Is there an opensource browser based softphone, or a system like Busta where everything is not manages through their website?
  • Nick Barnes, Fri 09 of May, 2008 [11:36 UTC]: Christopher - yesterday I tried an Asterisk install on a CentOS 5.1 box with stock GUI and it all worked fine. Sorry I can't help.
  • aero, Fri 09 of May, 2008 [08:20 UTC]: can someone help me out on this, i tried to play some sound files on my asterisk box and this is the error message i got. WARNING[4429]: format_wav.c:169 check_header: Unexpected freqency 22050 May 8 11:17:39 WARNING[4433]: codec_gsm.c:194 gsmtolin_fra
  • Christopher Faust, Thu 08 of May, 2008 [14:15 UTC]: I beleive that I may have to change something in the xserver configuration. Please advise
  • Christopher Faust, Thu 08 of May, 2008 [14:14 UTC]: Everything was perfect. In the bios I have increased the memory allocated Still receive input not supported on my display.
  • Christopher Faust, Thu 08 of May, 2008 [14:13 UTC]: This would not be my main box. I am doing some testing to see if I can install zaptel and asterisk 1.4 on a full centos 5.1 box with development software Its bizzare, because before I went through the asterisk and zaptel installation everything was perfe
  • Nick Barnes, Thu 08 of May, 2008 [13:44 UTC]: Christopher - I can't see any way in which an Asterisk installation would muck your GUI, but remember that it is advised not to use a GUI on an Asterisk box anyway.
Server Stats
  • Execution time: 0.27s
  • Memory usage: 2.19MB
  • Database queries: 28
  • GZIP: Disabled
  • Server load: 1.47

Asterisk News Reports

I thought it would be nice for my Asterisk server to be able to read me the news, considering as such that it already
tells me the time and the weather. :D A good source of news updates is CNN's podcast, but it needs a little work to make it
Asterisk ready and for it to update automatically on demand. So here's what I did:

First,

Download a copy of Podget (I used version-0.4)
It's available from the following URL, or search for it on sourceforge:

http://sourceforge.net/project/showfiles.php?group_id=133382&package_id=146500

Untar the tarball:

tar -zxvf podget-0.4.tar.gz

and edit the file podget.sh

cd podget-0.4
vi podget.sh

Make sure you have everything it shows that it depends on with the exception of "btcursesdownload". Also make sure you have the program "sox" installed as well. Most modern distro's will have these programs standard, but it never hurts to check.

In this shell script, change the variables to the following values:

dir_library=/tmp
dir_log=/tmp

and comment out these two variables:

#playlist_namebase=New-
#date_format=+%m-%d-%Y

Next, is the server list:


: << TEXT_DEFAULT_SERVERLIST
# (some commented text)

http://www.cnn.com/services/podcasting/newscast/rss.xml cnn news

TEXT_DEFAULT_SERVERLIST


Inbetween the top tag and the bottom tag, is the list of servers you will be podcatching from. Initally, theres a couple
of other URL's already in there, you'll probably want to remove those first. In this example, I'm pulling from CNN's RSS
news feed. The two words at the end of the URL are the subdirectories that will be created to hold the new audio files.
You can change them to whatever you want, but make sure you keep them congruent in the rest of the scripts.

Next, change:

dir_config="/tmp/.podget"

Also, probably most importantly, change most_recent=0 to most_recent=1

Write your changes and exit your editor.

Next, make a shell script called "makenews":
(if you changed the directories above, make the changes here too)

#!/bin/bash
for i in /tmp/cnn/news/*.mp3; do nice -n15 sox $i -r 8000 -c 1 /tmp/news.gsm resample -ql; done
rm /tmp/cnn/news/*.mp3

<If you have more than one feed, just repeat this string and change the subfolders>

I've noticed SOX (the converter) is very CPU intensive, so the command 'nice -n15' is added to make it more system friendly.
If this is not a concern, you can lower the "15" closer to "0", or remove 'nice -n15' completely.

and write the file.

Now we have to put the files in place so Asterisk can use them....

Make sure your scripts are executable and owned by the user that asterisk runs as (yours may vary):
(I renamed podget.sh to just "podget" at this point to match all my other scripts in the directory)

mv podget.sh podget
chmod 755 podget
chmod 755 makenews
chown asterisk:asterisk podget
chown asterisk:asterisk makenews

and move the files to wherever you call your sripts from:
(for me this is /usr/share/asterisk)

mv podget makenews /usr/share/asterisk

Lastly, add this to your extensions.conf:

exten => *66,1,Answer
exten => *66,n,Playback(privacy-please-stay-on-line-to-be-connected)
exten => *66,n,System(/usr/share/asterisk/podget)
exten => *66,n,System(/usr/share/asterisk/makenews)
exten => *66,n,Playback(/tmp/news)
exten => *66,n,Hangup

Note: You may want to replace Playback with ControlPlayback so that you can move through the sound file

Note: If you have Asterisk 1.09 or older, replace the 'n's with sequential numbers.

Now reload Asterisk, and dial the extension you set for this to work on. The first time it runs, it will take a while to
download and convert the sound file, so be patient. After that, as long as there arent any updates available, it should
be pretty quick. If the first time delay is too long for your liking, and your system can encode the file faster that it can play it back — you can reduce
startup time significantly by making a small change to the dialplan above:

exten => *66,n,System(/usr/share/asterisk/makenews & )
exten => *66,n,Wait(4)
exten => *66,n,Playback(/tmp/news)

You may need to raise the Wait timer in order to give it enough of a head start so you dont run out of data while it's playing. Just make sure if you substitute Playback for ControlPlayback, that you dont fast forward past the end of the file.

Alternatively, you could cron job the 'podget' and 'makenews' scripts to run whenver you want them to, so they're instantly
available. But if no one will dial this extension for a couple days (depends on your traffic), it's pointless to use CPU
and bandwidth to get updates that wont get listened to.

If you want to change the list of feeds (to add or remove some) — make sure you delete the "/tmp/.podget" (rm -rf /tmp/.podget) so that next time the script runs, it will regenerate a new server list.

One last gotcha: The news updates are typically right at 2 minutes long. If you want to play something that's considerably longer, make
sure that your RTP timeout (if you have it set) is long enough to cover the span of your sound file, elsewise it will get
cut off.

Created by Shawn, Last modification by Shawn on Thu 26 of Jan, 2006 [14:32 UTC]

Comments Filter

by Matt Riddell on Friday 29 of September, 2006 [02:43:09 UTC]
If you're just trying to find the Asterisk News (as opposed to reading podcasts), you can go to:

http://www.sineapps.com/news.php

Please update this page with new information, just login and click on the "Edit" or "Add Comment" button above. Get a free login here: Register Thanks! - support@voip-info.org

Page Changes | Comments

Sponsored by:

Terms of Service Privacy Policy
© 2003-2008 VOIP-Info.org LLC

Powered by bitweaver