Skip to content

A Ruby on Rails application with RAGI interface to Asterisk, which can generate speech from arbitrary text strings and play it over the asterisk-phone interface.

License

Notifications You must be signed in to change notification settings

mitmedialab/ruby-asterisk-speaker

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

==RUBY-ASTERISK-SPEAKER==

This is a ruby on rails application to connect to an Asterisk instance and create voice menus in rails. An added feature is that if you're running it on a mac os X server you can autogenerate speech from any arbitrary text using the applescript gem and the built in speech abilities of Mac OS X. 

There are a few open source speech generators, but I haven't tried any; this is kind of a proof of concept since not many people run osx server. (Suggestion: Festival via http://github.com/gisikw/acts_as_sayable/)

Generally this builds on RAGI (the ragi gem) but with the added ability to pass an Asteriskspeak.speak_text('hello world') or similar call to the play_sound() method provided by ragi.

This being a kind of example app, it also uses bits of the Google News library for Rails, which I published a while ago:

http://unterbahn.com/2009/08/google-news-library-for-ruby/

So therefore it also requires geokit and httparty. But really you should have httparty installed already, 'cause it's great.

Requires the applescript, ragi, httparty, and geokit gems.

==TO INSTALL==

First, point your Asterisk system at the server in question. This assumes your Asterisk server is on a different machine. Add the following lines to the default dialplan of your extensions.conf file:

exten = s,n,Set(RAGI_SERVER="your.server.url:4573")
exten = s,n,agi(agi://${RAGI_SERVER}/ragi/index)

(For more on Asterisk dialplans and Asterisk in general, look at the Asterisk O'Reilly book, free downloadable pdf here: http://downloads.oreilly.com/books/9780596510480.pdf)

Run the following commands:

$ git clone git://github.com/jywarren/ruby-asterisk-speaker.git
$ cd ruby-asterisk-speaker
$ rake gems:install
$ script/server

Have fun!


Example:


    play_sound(Asteriskspeak.speak_text('Welcome to News Speak. You will now hear 5 articles from Google News.'))

    wait(1)

    index = 1
    Googlenews.short(5).each do |article|
    
      play_sound(Asteriskspeak.speak_text('Article '+index.to_s))
      wait(1)
      play_sound(Asteriskspeak.speak_text(article['title']))
      wait(1)
      index += 1
    
    end

    play_sound(Asteriskspeak.speak_text('Thank you. That is all.'))
    

About

A Ruby on Rails application with RAGI interface to Asterisk, which can generate speech from arbitrary text strings and play it over the asterisk-phone interface.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published