Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/adhearsion/adhearsion
Browse files Browse the repository at this point in the history
  • Loading branch information
Jay Phillips committed Oct 9, 2011
2 parents 4256172 + 71d02bb commit 8a58853
Show file tree
Hide file tree
Showing 176 changed files with 10,734 additions and 8,965 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Expand Up @@ -3,3 +3,11 @@ pkg
*~
.*.sw?
.yardoc
nbproject
vendor
Gemfile.lock
.bundle
.rvmrc
coverage
spec/reports
doc
3 changes: 3 additions & 0 deletions .rspec
@@ -0,0 +1,3 @@
--format documentation
--colour
--tty
129 changes: 127 additions & 2 deletions CHANGELOG
@@ -1,3 +1,128 @@
1.2.1
- Removed the restful_rpc component since it is now in a gem.
- Allow overriding the path to a component in the testing framework so as to support new style components (lib/)
- Added a GUID to the default recording filename to ensure uniqueness
- ECONNRESET exceptions are now handled as a call hangup
- Fixed escaping of TTS strings containing commas when used with Cepstral via #speak
- Made logging exceptions the responsibility of the framework rather than the app, so that this may not be disabled

1.2.0
- New method: #play_or_speak allows playback of an audio file with TTS fallback
- #input now takes :speak as a hash for TTS prompt or fallback
- New method: #speak provides abstracted TTS rendering for UniMRCP and Cepstral
- Allow leading "+" in Caller ID (E.164 format)
- Allow using --pid-file without "daemon" for JRuby
- Allow passing a block to #input to enable caller to detect when enough digits are collected.
- Fix some issues with starting apps outside of their directory, generally related to Bundler/gem environments
- Allow configuration of logging outputters/formatters
- Using ahn_log in a dialplan context or on a call object logs to the call's context, named after its unique identifier
- New method: #record_to_file with more useful return values

1.1.1
- Command#play now returns false if audio failed to play
- Added new commands (#play!, #interruptible_play!, #input!) which raise PlaybackError if audio fails to play

1.1.0
- Added interactive call control console: ahn start console <path>
- Added centralized exception handler through eventing system
- Support for using ahn_hoptoad to send Adhearsion exceptions to Hoptoad
- Adhearsion.active_calls can now use hash syntax to find calls by ID
- Added Adhearsion::Calls#to_h
- Add a Monitor to synchronize access to an AGI connection

1.0.3
- Fix the play() command regression when passing an array of strings. This was breaking the SimonGame
- Deprecate ManagerInterface#send_action_asynchronously

1.0.2
- Fix rcov Rake task
- Add Ben Langfeld as an author (Thanks, Ben!)
- Add "rake" as a runtime dependency
- Remove usage of BEGIN blocks (for Rubinius; CS)

1.0.1
NOTE for Ruby 1.9 users: The behavior of Ruby 1.9 and case statements has changed
in a way that renders NumericalString objects incompatible with
case statements. The suggested workaround is to cast the NumericalString
to a string and then compare. Example:

obj = NumericalString.new("0987")
case obj.to_s
when "0987" then true
else false
end

Or, if you need to ignore the leading zero:
case obj.to_i
when 987 then true
else false
end

See https://adhearsion.lighthouseapp.com/projects/5871/tickets/127-ruby-19-and-numericalstring-comparisons-in-case-statements
- Add say_chars command.
- Add say_phonetic command.
- Update play_time to accept format and timezone paramenters. This allows you to read back any particular section of the Time object. (i.e. Using format => 'IMp' would result in "eleven twenty-three" being said.)
- Update play_time to allow using Date objects.
- QueueAgentsListProxy#new now returns an AgentProxy instance if the agent was added successfully.
- Add state_interface parameter to QueueAgentsListProxy#new. This allows you to specify a separate interface to watch for state changes on. (i.e. Your agents log in with Local channel extensions, but you want to check their direct SIP exten for state.)
- Fixed issue with Queue#join! that would raise a QueueDoesNotExist error if the call was completed successfully.
- Add support for AGI script parameter to Queue#join!
- Migrate unit tests to RSpec 2
- New components now include RubyGems skeleton files
- Fix support for setting Caller ID name on AGI dial() command
- Generate new apps with Bundler support, including auto-requiring of all gems
- Update component testing framework to RSpec 2.x and mock with rspec

1.0.0
- Fall back to using Asterisk's context if the AGI URI context is not found
- Enable configuration of :auto_reconnect parameter for AMI
- Replace all uses of Object#returning with Object#tap
- Add support for loading Adhearsion components from RubyGems
- Fix long-running AMI session parser failure bug (#72)
- Support for Rails 3 (and ActiveSupport 3.0)

0.8.6
- Fix packaging problem so all files are publicly readable
- Improve AMI reconnecting logic; add "connection refused" retry timer
- AGI protocol improvements: parse the status code and response text

0.8.5
NOTE: If you are upgrading an Adhearsion application to 0.8.5, note the change
to how request URIs are handled. With 0.8.4, the context name in Asterisk was
required to match the Adhearsion context in dialplan.rb. Starting in 0.8.5 if
an application path is passed in on the AGI URI, it will be preferred over the
context name. For example:

[stuff]
exten => _X.,1,AGI(agi://localhost/myapp)

AHN 0.8.4- will execute the "stuff" context in dialplan.rb
AHN 0.8.5+ will execute the "myapp" context in dialplan.rb

If you followed the documentation and did not specify an application path in
the URI (eg. agi://localhost) you will not be impacted by this change.

Other changes:
- Added XMPP module and sample component. This allows you to easily write components which utilise a persistent XMPP connection maintained by Adhearsion
- Prefer finding the dialplan.rb entry point by the AGI request URI instead of the calling context
- Added :use_static_conf option for "meetme" to allow the use of disk-file-managed conferences
- Logging object now shared with ActiveRecord and Blather
- Fixed a longstanding bug where newlines were not sent after each AGI command
- Fixed parsing of DBGet AMI command/response
- Better shutdown handling/cleanup
- Attempt to allow the AMI socket to reconnect if connection is lost
- Improved support for Ruby 1.9
- Numerous smaller bugs fixed. See: https://adhearsion.lighthouseapp.com/projects/5871-adhearsion/milestones/76510-085

0.8.4
- Add configurable argument delimiter for talking to Asterisk. This enables Adhearsion to support Asterisk versions 1.4 (and prior) as well as 1.6 (and later).
- Fixed using ActiveRecord in Adhearsion components
- Daemonizing no longer truncates the Adhearsion log file
- Add support for using ActiveLdap
- Misc improvements to support Asterisk 1.6 changes
- Escape commands sent to Asterisk via AGI
- Manager Events now work when daemonized

0.8.3
- The "uniqueid" call channel variable available in dialplan.rb is now *always* a String
- Renamed interruptable_play to interruptible_play and made interruptible_play() public instead of protected.
Expand All @@ -10,7 +135,7 @@
- Fixes an inconsequential bug when CTL-C'ing Adhearsion.

0.8.1
- The sandbox component now comes
- The sandbox component now comes
- Minor bug fixes

0.8.0 rev 2
Expand All @@ -21,4 +146,4 @@ Notes from before 0.8.0:
- Adding a deprecation warning about Fixnum#digit and Fixnum#digits
- Removed the AMI class and replaced it with the ManagerInterface class.
- The old AMI high-level instance methods are available in the new ManagerInterface class, but a deprecation warning will be logged each time they're used. When the SuperManager class is implemented, they'll be removed entirely.
- Moved Theatre into Adhearsion's lib folder.
- Moved Theatre into Adhearsion's lib folder.
2 changes: 1 addition & 1 deletion EVENTS
@@ -1,5 +1,5 @@
# Below are a list of framework events:

- after_initialized
- shutdown
- asterisk:
Expand Down
3 changes: 3 additions & 0 deletions Gemfile
@@ -0,0 +1,3 @@
source "http://rubygems.org"

gemspec
19 changes: 6 additions & 13 deletions README.markdown
Expand Up @@ -8,29 +8,22 @@ Adhearsion

Adhearsion is an open-source voice application development framework. Adhearsion users write applications atop the framework with Ruby and **call into their code**.

Adhearsion rests above a lower-level telephony platform, namely [Asterisk](http://asterisk.org), though there are experimental bindings for both [FreeSWITCH](http://freeswitch.org) and [Yate](http://yate.null.ro/pmwiki).
Adhearsion rests above a lower-level telephony platform, namely [Asterisk](http://asterisk.org), and provides a framework for integrating with various resources, such as SQL, LDAP and XMPP (Jabber).

Adhearsion has...

* An elegant dialplan system for writing the code which controls a live phone call
* A sophisticated Asterisk Manager Interface library with a lexer written in [Ragel](http://www.complang.org/ragel).
* An events subsystem which maintains a Thread-pool for executing your namespaced callbacks. (supports AMI events too!)
* A very useful component architecture with which you may write Adhearsion plugins and share them with the world.
* A very useful component architecture with which you may write Adhearsion plugins and share them with the world via RubyGems.
* JRuby compatibility for running atop the Java Virtual Machine and using virtually any Java library.
* Ability to re-use existing Ruby on Rails database models with ActiveRecord/ActiveLDAP
* Easy interactive communication via XMPP instant messages using the Blather library
* Good regression test coverage

Use the public Adhearsion sandbox!
==================================

Don't want to screw with setting up a telephony system? You can test your Adhearsion applications using our public sandbox!

Visit [http://adhearsion.com/getting_started](http://adhearsion.com/getting_started) for more information!

Yes, in minutes you can be controlling your cell phone for free! :)

Documentation
=============

Visit [Adhearsion's website](http://adhearsion.com) for more information about the framework or visit the [wiki](http://docs.adhearsion.com) for documentation on how to use it.
Visit [Adhearsion's website](http://adhearsion.com) for code examples and more information about the project. Also checkout the [Adhearsion wiki on Github](http://github.com/adhearsion/adhearsion/wiki) for community documentation.

If you're having trouble, you may want to try asking your question on the IRC channel, [mailing list](http://groups.google.com/group/adhearsion) or, if you've found a bug, report it on the [bug tracker](http://adhearsion.lighthouseapp.com/projects/5871-adhearsion/overview).
If you're having trouble, you may want to try asking your question on the IRC channel (#adhearsion on irc.freenode.net), [mailing list](http://groups.google.com/group/adhearsion) or, if you've found a bug, report it on the [bug tracker](https://github.com/adhearsion/adhearsion/issues).
105 changes: 25 additions & 80 deletions Rakefile
@@ -1,14 +1,20 @@
# -*- ruby -*-
ENV['RUBY_FLAGS'] = "-I#{%w(lib ext bin test).join(File::PATH_SEPARATOR)}"
ENV['RUBY_FLAGS'] = "-I#{%w(lib ext bin spec).join(File::PATH_SEPARATOR)}"

require 'rubygems'
require 'rake/gempackagetask'
require 'bundler/gem_tasks'
require 'bundler/setup'
require 'date'
require 'adhearsion/version'

begin
require 'spec/rake/spectask'
rescue LoadError
abort "You must install RSpec: sudo gem install rspec"
end
task :default => :spec
task :gem => :build

require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new

require 'ci/reporter/rake/rspec'
task :ci => ['ci:setup:rspec', :spec]

begin
require 'yard'
Expand All @@ -19,53 +25,28 @@ rescue LoadError
STDERR.puts "\nCould not require() YARD! Install with 'gem install yard' to get the 'yardoc' task\n\n"
end

require 'lib/adhearsion/version'

AHN_TESTS = ['spec/**/test_*.rb']
GEMSPEC = eval File.read("adhearsion.gemspec")
RAGEL_FILES = %w[lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb]
THEATRE_TESTS = 'theatre-spec/**/*_spec.rb'

begin
require 'rcov/rcovtask'
Rcov::RcovTask.new do |t|
t.test_files = Dir[*AHN_TESTS]
t.output_dir = 'coverage'
t.verbose = true
t.rcov_opts.concat %w[--sort coverage --sort-reverse -x gems -x /var --no-validator-links]
end
rescue LoadError
STDERR.puts "Could not load rcov tasks -- rcov does not appear to be installed. Continuing anyway."
end

Rake::GemPackageTask.new(GEMSPEC).define

# YARD::Rake::YardocTask.new do |t|
# t.files = ['lib/**/*.rb'] # optional
# # t.options = ['--any', '--extra', '--opts'] # optional
# end

desc "Run the unit tests for Adhearsion"
task :spec do
Dir[*AHN_TESTS].each do |file|
load file
end
end

desc "Check Ragel version"
task :check_ragel_version do
ragel_version_match = `ragel --version`.match(/(\d)\.(\d)+/)
ragel_version_match = `ragel --version`.match /(\d)\.(\d)+/
abort "Could not get Ragel version! Is it installed? You must have at least version 6.3" unless ragel_version_match
big, small = ragel_version_match.captures.map { |n| n.to_i }
big, small = ragel_version_match.captures.map &:to_i
if big < 6 || (big == 6 && small < 3)
abort "Please upgrade Ragel! You're on version #{ragel_version_match[0]} and must be on 6.3 or later"
end
if (big == 6 && small < 7)
puts "WARNING: A change to Ruby since 1.9 affects the Ragel generated code."
puts "WARNING: You MUST be using Ragel version 6.7 or have patched it using"
puts "WARNING: the patch found at:"
puts "WARNING: http://www.mail-archive.com/ragel-users@complang.org/msg00440.html"
end
end

RAGEL_FILES = %w[lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb]

desc "Used to regenerate the AMI source code files. Note: requires Ragel 6.3 or later be installed on your system"
task :ragel => :check_ragel_version do
RAGEL_FILES.each do |ragel_file|
ruby_file = ragel_file.sub(".rl.rb", ".rb")
ruby_file = ragel_file.sub ".rl.rb", ".rb"
puts `ragel -n -R #{ragel_file} -o #{ruby_file} 2>&1`
raise "Failed generating code from Ragel file #{ragel_file}" if $?.to_i.nonzero?
end
Expand All @@ -81,47 +62,11 @@ task :visualize_ragel => :check_ragel_version do
end
end

desc "Run all RSpecs for Theatre"
Spec::Rake::SpecTask.new("theatre_specs") do |t|
t.spec_files = FileList[THEATRE_TESTS]
end

desc "Compares Adhearsion's files with those listed in adhearsion.gemspec"
task :check_gemspec_files do

files_from_gemspec = ADHEARSION_FILES
files_from_filesystem = Dir.glob(File.dirname(__FILE__) + "/**/*").map do |filename|
filename[0...Dir.pwd.length] == Dir.pwd ? filename[(Dir.pwd.length+1)..-1] : filename
end
files_from_filesystem.reject! { |f| File.directory? f }

puts
puts 'Pipe this command to "grep -v \'spec/\' | grep -v test" to ignore test files'
puts
puts '##########################################'
puts '## Files on filesystem not in the gemspec:'
puts '##########################################'
puts((files_from_filesystem - files_from_gemspec).map { |f| " " + f })


puts '##########################################'
puts '## Files in gemspec not in the filesystem:'
puts '##########################################'
puts((files_from_gemspec - files_from_filesystem).map { |f| " " + f })
end

desc "Test that the .gemspec file executes"
task :debug_gem do
require 'rubygems/specification'
gemspec = File.read('adhearsion.gemspec')
gemspec = File.read 'adhearsion.gemspec'
spec = nil
Thread.new { spec = eval("$SAFE = 3\n#{gemspec}") }.join
puts "SUCCESS: Gemspec runs at the $SAFE level 3."
end

desc 'Install the package as a gem.'
task :install_gem => [:clobber_package, :package] do
windows = /djgpp|(cyg|ms|bcc)win|mingw/ =~ RUBY_PLATFORM
gem = Dir['pkg/*.gem'].first
sh "#{'sudo ' unless windows}gem install --local #{gem}"
end

0 comments on commit 8a58853

Please sign in to comment.