login | register
Sat 05 of Jul, 2008 [02:55 UTC]

voip-info.org

Search with Google
Search this site with Google. Results may not include recent changes.
 
Google Ads
Shoutbox
  • Samuel, Thu 03 of Jul, 2008 [13:41 UTC]: ok thank you
  • Mats Karlsson, Thu 03 of Jul, 2008 [13:37 UTC]: Nice Samuel, will look forward to rad it.
  • bwl_fernstudent, Thu 03 of Jul, 2008 [09:08 UTC]: Your blog shows some usefull code
  • Samuel, Thu 03 of Jul, 2008 [08:04 UTC]: I'll translate it, for sure
  • Mats Karlsson, Wed 02 of Jul, 2008 [20:46 UTC]: LOL, in french! Translate it to English and I will read it.
  • Samuel, Wed 02 of Jul, 2008 [08:07 UTC]: Hello, i wrote a blog about Asterisk, speaking about installation,programming and more http://sambranche.blogspot.com/
  • Nick Barnes, Tue 01 of Jul, 2008 [17:46 UTC]: Steve - Asterisk doesn't 'fit into linux' - it's an application which runs on top of Linux.
  • Steve, Mon 30 of Jun, 2008 [18:07 UTC]: anyone know where I can find a block diagram of how asterisk fits into linux. my f'ing bosses want me to draw something up.. ugh.
  • akbar, Fri 27 of Jun, 2008 [10:37 UTC]: marley_boyz@yahoo.com how to configure call forward, call back, call pick up using TDM and asterisk 1.2.13... please help me.. thx...
  • Matthew Williams, Tue 24 of Jun, 2008 [22:37 UTC]: We are looking for Tier II VoIP Support Technicians in St Louis. Send resumes to mwilliams AT voxitas DOT com.
Server Stats
  • Execution time: 0.42s
  • Memory usage: 2.59MB
  • Database queries: 29
  • GZIP: Disabled
  • Server load: 0.78

Asterisk tips Weather PHP

Speak your local Weather using TTS engine (Cepstral)

Updated 2007-Nov-15 Andy Wysocki awysocki (a) absoftware dot_here com

Dial an extenstion and have asterisk pull a file for the weather service and use Cepstrals TTS Engine to convert it to a WAV file and then
have Asterisk play that file.

  • This php applicaiton does NOT need app_cepstral installed
  • Modify the script for your local weather
  • weather.php is the module name

I made a tar file http://qod.com/weather.1.00.tar



Go Back to: Asterisk tips and tricks - Asterisk AGI


Here is the README from the TAR file:

WEATHER 1.00 Nov 15, 2007
awysocki @ absoftware.com


weather.php was created from the festival weather PERL example on voip-info.org
It will pull a text file from noaa.gov weather forcasts and speak it out using
Cepstral TTS engine. This PHP module does NOT need the app_cepstral module installed
or loaded, but it does need Cepstral's swift module installed and working along with
an 8khz voice installed. See http://cepstral.com web site for installing 'swift'.

One known problem with this is if the user hangs up and Asterisk kills the PHP module
then the /tmp/*.txt and tts/*.wav files could be left around

SITES USED FOR SUPPORT AND DEVELOPMENT:
ftp://tgftp.nws.noaa.gov/data/forecasts/city/
http://voip-info.org
http://cepstral.com


CHANGES:
1.00 - Inital release 11/15/2007


INSTALLATION

Copy the weather.php file to the /var/lib/astersik/agi-bin directory. Make sure
the module can be executed by Asterisk. 'chmod a+x weather.php'

Edit the PHP file and modify the $parm_weather_url to point to your local weather file
you can browse the ftp://tgftp.nws.noaa.gov/data/forecasts/city/ ftp server to find
your state and town. Or use the San Franciso example to test with.

Create the /var/lib/asterisk/sounds/tts directory so the swift application can
create the WAV files where asterisk can read them.


Modify you extensions.conf file to create a new extension to call for weather

exten => 65,1,Answer
exten => 65,n,AGI(weather.php)
exten => 65,n,hangup


Reload your dial plan within asterisk, use the command

Asterisk> dialplan reload



HELP:

Things that can go wrong, Cepstral is not installed. You can test this alone with
the command

swift -o test.wav "This is a test"

If that works then try with your 8kHz voice file, change the william to the voice
name you downloaded and installed.

swift -o test.wav -n william-8kHz "This is a test"

If this works, make sure you have PHP installed on your system.

php -v


Other options is to turn on debugging in the PHP module
set the variable in the PARM section

        $parm_debug_on=1;

If you hear the SOMETHING HAS GONE TERRIBLY WRONG then check that you created
the TTS directory under the sounds directory of Asterisk

Good luck



~~
FAQ
~~

"Q1 - I call in and don't hear anything"

A1 - There can be lots of issues here, Check that the PHP script in the cgi-bin directory has the execute bit on. check that the php file is formatted for unix. (use dos2unix command) and last, turn on the parm_debug_on option and look at the log file created by the PHP file. It should help you out, if its not created then check with Asterisk as to why it may not be calling the script

Any other problems e-mail me and as time permits I will help you out


See Also my other scripts:
Asterisk tips Wake-Up Call PHP - Asterisk tips Airport Weather PHP
Created by awysocki, Last modification by awysocki on Fri 16 of Nov, 2007 [04:38 UTC]

Comments Filter

by Ward Mundy on Thursday 10 of January, 2008 [17:15:28 UTC]
Re: Using Festival or Flite

No need to reinvent the wheel. Download existing Weather apps by area code or zip code from http://bestof.nerdvittles.com/applications/.
If you're using Asterisk 1.4, go here: http://bestof.nerdvittles.com/scripts/.


by Paul M on Wednesday 09 of January, 2008 [17:10:20 UTC]
One issue:

  1. 35 - $parm_swift_voice = 'William-8Khz';

If you ain't got William on there, you won't hear anything, but Asterisk and Cepstral will report everything working a-okay. Solution is to either get William, or change this to whichever voice you have a license for.

I'm going to try and make this work with Festival, although the quality will be nowhere near as good - it's free though.

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