http://www.srh.noaa.gov/fwd/productviewnation.php?pil=OKXZFPOKX&version0 can anyone suggest how I could set up asterisk@home to read out allowed the following text when I dial extension 850? 815 PM EST WED FEB 16 2005 .OVERNIGHT...MOSTLY CLEAR. LOWS 30 TO 35. NORTHWEST WINDS 15 TO 20 MPH WITH GUSTS UP TO 30 MPH...DIMINISHING TO 10 TO 15 MPH LATE. .THURSDAY...PARTLY CLOUDY. COOLER WITH HIGHS AROUND 40. NORTHWEST WINDS AROUND 15 MPH. .THURSDAY NIGHT...PARTLY CLOUDY. LOWS IN THE MID 20S. WEST WINDS AROUND 15 MPH. .FRIDAY...PARTLY CLOUDY AND BRISK. HIGHS IN THE MID 30S. NORTHWEST WINDS 15 TO 25 MPH. .FRIDAY NIGHT...PARTLY CLOUDY AND BRISK. LOWS AROUND 17. NORTHWEST WINDS 15 TO 25 MPH. There's $20 via paypal to the first person to help me complete this (I'll then post it on the the wiki so anyone can replicate it) (anyone wanting to add to that bounty email me) Also if it is not too difficult I'd like it to skip to the next block each time you press '1' (eg go from overnight to Thursday) Also it doesn't need to be this particular web page that it connects to but something with current weather etc. Cheers, Dean -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20050216/94fb471a/attachment.htm
On Thu, 2005-02-17 at 15:24, dean collins wrote:> http://www.srh.noaa.gov/fwd/productviewnation.php?pil=OKXZFPOKX&version=0 > > > > can anyone suggest how I could set up asterisk@home to read out > allowed the following text when I dial extension 850? > > > > 815 PM EST WED FEB 16 2005 > > .OVERNIGHT...MOSTLY CLEAR. LOWS 30 TO 35. NORTHWEST WINDS 15 TO 20 > MPH WITH GUSTS UP TO 30 MPH...DIMINISHING TO 10 TO 15 MPH LATE. > .THURSDAY...PARTLY CLOUDY. COOLER WITH HIGHS AROUND 40. NORTHWEST > WINDS AROUND 15 MPH. > .THURSDAY NIGHT...PARTLY CLOUDY. LOWS IN THE MID 20S. WEST WINDS > AROUND 15 MPH. > .FRIDAY...PARTLY CLOUDY AND BRISK. HIGHS IN THE MID 30S. NORTHWEST > WINDS 15 TO 25 MPH. > .FRIDAY NIGHT...PARTLY CLOUDY AND BRISK. LOWS AROUND 17. NORTHWEST > WINDS 15 TO 25 MPH. >Basically you are going to have to parse this text with something (Perl springs to mind) so that you can break it into separate files in order to move back & firth in it. Then you are going to need to adjust it so that "MPH" reads "miles per hour" etc. Goodluck. :)> > > > > > > > > There?s $20 via paypal to the first person to help me complete this > (I?ll then post it on the the wiki so anyone can replicate it) > > (anyone wanting to add to that bounty email me) > > > > Also if it is not too difficult I?d like it to skip to the next block > each time you press ?1? (eg go from overnight to Thursday) > > > > Also it doesn?t need to be this particular web page that it connects > to but something with current weather etc. > > > > > > > > Cheers, > > Dean > > > > > > ______________________________________________________________________ > _______________________________________________ > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com > http://lists.digium.com/mailman/listinfo/asterisk-users > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users-- Howard. LANNet Computing Associates; Your Linux people <http://www.lannetlinux.com> ------------------------------------------ "When you just want a system that works, you choose Linux; when you want a system that just works, you choose Microsoft." ------------------------------------------ "Flatter government, not fatter government; Get rid of the Australian states."
Dean, Here is a rough starting point for you. Put this into your /var/lib/asterisk/agi-bin/ directory. I used the name getforecast. (Change the ZIP code info, line 29) and make it executable. <<< - FILE BEGIN ->>> #!/bin/bash # I grab the data from asterisk even though I don't use it while read -e ARG && [ "$ARG" ] ; do array=(` echo $ARG | sed -e 's/://'`) export ${array[0]}=${array[1]} done checkresults() { while read line do case ${line:0:4} in "200 " ) echo $line >&2 return;; "510 " ) echo $line >&2 return;; "520 " ) echo $line >&2 return;; * ) echo $line >&2;; esac done } # answer the line and give some preliminary feedback echo "ANSWER " checkresults echo "STREAM FILE national-weather-service \"\" " checkresults # Grab the forecast info page -- 80003 is MY zipcode, CHANGE TO YOUR ZIPCODE! tempstr=` curl -s "http://weather.toolbot.com/?where=80003&RSS" ` # Cleanup the results, get rid of html tags etc. (Could probably be condensed) tempstr=` echo $tempstr | sed 's:<?.*<h3>::g' | sed 's:=<.*$::' | sed 's:<br />:~:g'|\ sed 's:<[br /h3]*>::g' | sed 's:nbsp;: :g' | sed 's:&::g' | sed 's:mph:miles per hour:g' ` # Create 'EOF' Mark in tempstr tempstr=`echo $tempstr "~XOX" ` # Loop through string, echoing to file, convert to wave, speak them, etc. until [ "$tempstr" == "XOX" ] do lineout=`echo $tempstr | cut -f1 -d"~" ` echo $lineout > /tmp/linetospeak.txt text2wave -f 8000 -o /tmp/forecastline.wav /tmp/linetospeak.txt echo "STREAM FILE /tmp/forecastline \"1\"" checkresults tempstr=` echo $tempstr | cut -f2- -d"~" ` done echo "STREAM FILE goodbye \"\"" checkresults rm /tmp/linetospeak.txt rm /tmp/forecastline.wav echo "HANGUP " checkresults <<<- FILE END ->>> I have the following in my extensions.conf: exten => 2996,1,Answer exten => 2996,2,wait(1) exten => 2996,3,agi,getforecast exten => 2996,4,Hangup I'm not sure how you enter the extension.conf in asterisk@home. NOTE: I am still LEARNING shell scripting & AGI, so the above may be kind of hack-ish. Helpful suggestions/advice very welcome! Ernie Ankele On Feb 16, 2005, at 9:24 PM, dean collins wrote:> http://www.srh.noaa.gov/fwd/productviewnation.php? > pil=OKXZFPOKX&version=0 > > ? > > can anyone suggest how I could set up asterisk@home to read out > allowed the following text when I dial extension 850? > > ? > 815 PM EST WED FEB 16 2005 > ? > .OVERNIGHT...MOSTLY CLEAR. LOWS 30 TO 35. NORTHWEST WINDS 15 TO 20 > MPH WITH GUSTS UP TO 30 MPH...DIMINISHING TO 10 TO 15 MPH LATE. > .THURSDAY...PARTLY CLOUDY. COOLER WITH HIGHS AROUND 40. NORTHWEST > WINDS AROUND 15 MPH. > .THURSDAY NIGHT...PARTLY CLOUDY. LOWS IN THE MID 20S. WEST WINDS > AROUND 15 MPH. > .FRIDAY...PARTLY CLOUDY AND BRISK. HIGHS IN THE MID 30S. NORTHWEST > WINDS 15 TO 25 MPH. > .FRIDAY NIGHT...PARTLY CLOUDY AND BRISK. LOWS AROUND 17. NORTHWEST > WINDS 15 TO 25 MPH. > > ? > > ? > > ? > > ? > > There?s $20 via paypal to the first person to help me complete this > (I?ll then post it on the the wiki so anyone can replicate it) > > (anyone wanting to add to that bounty email me) > > ? > > Also if it is not too difficult I?d like it to skip to the next block > each time you press ?1? (eg go from overnight to Thursday) > > ? > > Also it doesn?t need to be this particular web page that it connects > to but something with current weather etc. > > ? > > ? > > ? > > Cheers, > > Dean > > ? > _______________________________________________ > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com > http://lists.digium.com/mailman/listinfo/asterisk-users > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users
Hi Ernie, Man I hope you didn't write all of that for me, I feel really bad now, someone posted to the list about 15 mins after I posted with the solution lol- I've already been playing with it for hours working out what other sites I can get it to read from as well. Thanks anyway - good practive I guess. I'm modifying the festival wikki page once I work out how. Cheers, Dean -----Original Message----- From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Ernie Ankele Sent: Thursday, February 17, 2005 5:39 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [Asterisk-Users] festival text for weather report Dean, Here is a rough starting point for you. Put this into your /var/lib/asterisk/agi-bin/ directory. I used the name getforecast. (Change the ZIP code info, line 29) and make it executable. <<< - FILE BEGIN ->>> #!/bin/bash # I grab the data from asterisk even though I don't use it while read -e ARG && [ "$ARG" ] ; do array=(` echo $ARG | sed -e 's/://'`) export ${array[0]}=${array[1]} done checkresults() { while read line do case ${line:0:4} in "200 " ) echo $line >&2 return;; "510 " ) echo $line >&2 return;; "520 " ) echo $line >&2 return;; * ) echo $line >&2;; esac done } # answer the line and give some preliminary feedback echo "ANSWER " checkresults echo "STREAM FILE national-weather-service \"\" " checkresults # Grab the forecast info page -- 80003 is MY zipcode, CHANGE TO YOUR ZIPCODE! tempstr=` curl -s "http://weather.toolbot.com/?where=80003&RSS" ` # Cleanup the results, get rid of html tags etc. (Could probably be condensed) tempstr=` echo $tempstr | sed 's:<?.*<h3>::g' | sed 's:=<.*$::' | sed 's:<br />:~:g'|\ sed 's:<[br /h3]*>::g' | sed 's:nbsp;: :g' | sed 's:&::g' | sed 's:mph:miles per hour:g' ` # Create 'EOF' Mark in tempstr tempstr=`echo $tempstr "~XOX" ` # Loop through string, echoing to file, convert to wave, speak them, etc. until [ "$tempstr" == "XOX" ] do lineout=`echo $tempstr | cut -f1 -d"~" ` echo $lineout > /tmp/linetospeak.txt text2wave -f 8000 -o /tmp/forecastline.wav /tmp/linetospeak.txt echo "STREAM FILE /tmp/forecastline \"1\"" checkresults tempstr=` echo $tempstr | cut -f2- -d"~" ` done echo "STREAM FILE goodbye \"\"" checkresults rm /tmp/linetospeak.txt rm /tmp/forecastline.wav echo "HANGUP " checkresults <<<- FILE END ->>> I have the following in my extensions.conf: exten => 2996,1,Answer exten => 2996,2,wait(1) exten => 2996,3,agi,getforecast exten => 2996,4,Hangup I'm not sure how you enter the extension.conf in asterisk@home. NOTE: I am still LEARNING shell scripting & AGI, so the above may be kind of hack-ish. Helpful suggestions/advice very welcome! Ernie Ankele On Feb 16, 2005, at 9:24 PM, dean collins wrote:> http://www.srh.noaa.gov/fwd/productviewnation.php? > pil=OKXZFPOKX&version=0 > > ? > > can anyone suggest how I could set up asterisk@home to read out > allowed the following text when I dial extension 850? > > ? > 815 PM EST WED FEB 16 2005 > ? > .OVERNIGHT...MOSTLY CLEAR. LOWS 30 TO 35. NORTHWEST WINDS 15 TO 20 > MPH WITH GUSTS UP TO 30 MPH...DIMINISHING TO 10 TO 15 MPH LATE. > .THURSDAY...PARTLY CLOUDY. COOLER WITH HIGHS AROUND 40. NORTHWEST > WINDS AROUND 15 MPH. > .THURSDAY NIGHT...PARTLY CLOUDY. LOWS IN THE MID 20S. WEST WINDS > AROUND 15 MPH. > .FRIDAY...PARTLY CLOUDY AND BRISK. HIGHS IN THE MID 30S. NORTHWEST > WINDS 15 TO 25 MPH. > .FRIDAY NIGHT...PARTLY CLOUDY AND BRISK. LOWS AROUND 17. NORTHWEST > WINDS 15 TO 25 MPH. > > ? > > ? > > ? > > ? > > There's $20 via paypal to the first person to help me complete this > (I'll then post it on the the wiki so anyone can replicate it) > > (anyone wanting to add to that bounty email me) > > ? > > Also if it is not too difficult I'd like it to skip to the next block > each time you press '1' (eg go from overnight to Thursday) > > ? > > Also it doesn't need to be this particular web page that it connects > to but something with current weather etc. > > ? > > ? > > ? > > Cheers, > > Dean > > ? > _______________________________________________ > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com > http://lists.digium.com/mailman/listinfo/asterisk-users > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users_______________________________________________ Asterisk-Users mailing list Asterisk-Users@lists.digium.com http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Hi Steve, Already in and working I'll forward the email to you that solved it for me but I'll update the wiki later this evening -----Original Message----- From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Steve Prior Sent: Thursday, February 17, 2005 6:10 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [Asterisk-Users] festival text for weather report dean collins wrote:> Hi Ernie, > Man I hope you didn't write all of that for me, I feel really bad now,someone posted to the list about 15 mins after I posted with the solution lol- I've already been playing with it for hours working out what other sites I can get it to read from as well.> > Thanks anyway - good practive I guess. > > I'm modifying the festival wikki page once I work out how.Please add what you ended up with sooner rather than later. I'm interested in the same weather forecast as you (in fact I'm in the same forecast region as you), but I've also been wondering what's around in terms of traffic information. http://www.hudsonvalleytraveler.com/perl/IncidentCongestionRpt.pl Might be of interest to you as well, but unfortunatly they only provide the data in HTML format - I've already emailed them about how easy and useful it would be to provide XML as well... My future hope is that I'd set up a DID that I could call from my cell phone headset using the voice dialing built into the phone, and then get a traffic report read to me without pressing any phone buttons. That either means using a dedicated phone number or getting even a very primitive speech recognition going to chose between a very limited number of options. The speech recognition part seems like it's going to be a while (I'd love it if someone else figures this part out before I get there...) Steve _______________________________________________ Asterisk-Users mailing list Asterisk-Users@lists.digium.com http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users