mod_rss
About
mod_rss will parse and read an XML based RSS feed, then read the entries aloud via a TTS engine such as mod_cepstral. While its reading you can fast forward through articles, rewind, etc.
Make sure you are using the most recent Git as 1.0.0 had a bug which would only play the first feed on the list regardless of key press. Also, don't forget to enable the mod_rss module in conf/autoload_configs/modules.conf.xml.
Setup & Configuration
Configure rss.conf.xml (in conf/autoload_configs):
<configuration name="rss.conf" description="RSS Parser">
<feeds>
<!-- Just download the files to wherever and refer to them here -->
<feed name="Local Weather">rss/weather.rss</feed>
<feed name="Yahoo Top Stories">rss/yahootop.rss</feed>
<feed name="Yahoo Science">rss/yahoosci.rss</feed>
<feed name="Yahoo Business">rss/yahoobus.rss</feed>
<feed name="Yahoo Entertainment">rss/yahooent.rss</feed>
<feed name="Slash Dot">rss/slashdot.rss</feed>
<feed name="Free Switch">rss/freeswitch.rss</feed>
</feeds>
</configuration>
The RSS subdirectory paths are relative to the FreeSWITCH base directory (e.g. /opt/freeswitch).
Below is a sample JavaScript that'll populate the RSS files above. Make sure you create this directory and assign proper rights to the FreeSWITCH user account.
mkdir /opt/freeswitch/rss
chown freeswitch.freeswitch /opt/freeswitch/rss
chmod 755 /opt/freeswitch/rss
Setup script to fetch RSS
Sample news.js (should be placed in scripts folder - i.e. /opt/freeswitch/scripts)
if (session.ready()) {
session.answer();
session.speak("cepstral","David","Please wait while we refresh the RSS feeds.")
fetchURLFile("http://weather.yahooapis.com/forecastrss?p=60610","rss/weather.rss");
fetchURLFile("http://rss.news.yahoo.com/rss/topstories","rss/yahootop.rss");
fetchURLFile("http://rss.news.yahoo.com/rss/science","rss/yahoosci.rss");
fetchURLFile("http://rss.news.yahoo.com/rss/business","rss/yahoobus.rss");
fetchURLFile("http://rss.news.yahoo.com/rss/entertainment","rss/yahooent.rss");
fetchURLFile("http://rss.slashdot.org/Slashdot/slashdot","rss/slashdot.rss");
fetchURLFile("http://www.freeswitch.org/xml.php","rss/freeswitch.rss");
}
Usage in dialplan (call to news.js)
Add the following to your default dialplan and dial 9333. The first application line calls the javascript above to populate the rss files in the rss folder. The second line will call out mod_rss.
<extension name="rss">
<condition field="destination_number" expression="^9333$">
<action application="javascript" data="news.js"/>
<action application="rss"/>
</condition>
</extension>
FAQ
I receive the following error mod_spidermonkey.c:2495 js_fetchurl_file() Error!
Check whether your directory /usr/local/freeswitch/rss (or /opt/freeswitch/rss) exists and is accessible by the user who runs FreeSWITCH. If this doesn't work, try to use the full path above:
e.g.
<feed name="Yahoo Business">/usr/local/freeswitch/rss/yahoobus.rss</feed>
fetchURLFile("http://rss.news.yahoo.com/rss/business","/usr/local/freeswitch/rss/yahoobus.rss");
I have a German Cepstral speech engine, but the menus are in English
Solution:
- Change /usr/src/freeswitch/src/mod/applications/mod_rss/mod_rss.c . Replace the English announcement strings with your localized string.
- In the directory /usr/src/freeswitch/src/mod/applications/mod_rss/ do a "make" and "make install" then.