Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
* Change: Permit application environment to be set only by AHN_ENV. The config system depends on the environment, and the previous dependency was circular.
* Change: Define configuration per-environment for any environment name and without colliding with plugin names. See [#442](https://github.com/adhearsion/adhearsion/issues/442). Syntax is now `config.env(:development).foo = :bar` instead of `config.development.foo = :bar`.
* Feature: Add i18n support via `CallController#t`
* Feature: Integrate a Rack-based HTTP server from the Virginia plugin
* Feature: Permit timing out when calling `Call#wait_for_end`
* Upgrade to Celluloid 0.16
* Move events system to Celluloid and do away with GirlFriday
Expand Down
2 changes: 0 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ source 'https://rubygems.org'

gemspec

gem 'sinatra', require: nil

group :test do
# TODO: some expectations started failing in 3.8.3
# The be_a_kind_of matcher requires that the actual object responds to either
Expand Down
7 changes: 2 additions & 5 deletions adhearsion.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,17 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'activesupport', [">= 3.0.0"]
s.add_runtime_dependency 'adhearsion-loquacious', ["~> 1.9"]
s.add_runtime_dependency 'blather', ["~> 2.0"]
s.add_runtime_dependency 'celluloid', ["~> 0.16.0"]
s.add_runtime_dependency 'celluloid', ["~> 0.17.4"]
s.add_runtime_dependency 'countdownlatch'
s.add_runtime_dependency 'deep_merge'
s.add_runtime_dependency 'ffi', ["~> 1.0"]
s.add_runtime_dependency 'future-resource', ["~> 1.0"]
s.add_runtime_dependency 'has-guarded-handlers', ["~> 1.6", ">= 1.6.3"]
s.add_runtime_dependency 'i18n', [">= 0.6"]
s.add_runtime_dependency 'logging', ["~> 2.0", "< 2.3"] # See https://github.com/TwP/logging/issues/235
s.add_runtime_dependency 'nokogiri', ["~> 1.8", ">= 1.8.3", "< 1.11"] # Versions > 1.10 broken under JRuby
s.add_runtime_dependency 'nokogiri', ["~> 1.8", ">= 1.8.3"] # Versions > 1.10 broken under JRuby
s.add_runtime_dependency 'pry'
s.add_runtime_dependency 'rake'
s.add_runtime_dependency 'reel', ["~> 0.6.0"]
s.add_runtime_dependency 'http_parser.rb', ["~> 0.6.0"] # Dependency of Reel, verions > 0.6.0 broken under JRuby
s.add_runtime_dependency 'reel-rack', ["~> 0.2.0"]
s.add_runtime_dependency 'ruby_ami', ["~> 2.2"]
s.add_runtime_dependency 'ruby_jid', ["~> 1.0"]
s.add_runtime_dependency 'ruby_speech', ["~> 3.0"]
Expand Down
6 changes: 0 additions & 6 deletions features/cli_create.feature
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ Feature: Adhearsion Ahn CLI (Create)
| config/events.rb |
| config/routes.rb |
| config/locales/en.yml |
| config.ru |
| Gemfile |
| script/ahn |
| spec/spec_helper.rb |
Expand All @@ -56,10 +55,6 @@ Feature: Adhearsion Ahn CLI (Create)
"""
Adhearsion.router
"""
And the file "config.ru" should contain each of these content parts:
"""
run Sinatra::Application
"""
And the file "README.md" should contain each of these content parts:
"""
Start your new app with
Expand Down Expand Up @@ -97,7 +92,6 @@ Feature: Adhearsion Ahn CLI (Create)
| config/environment.rb |
| config/events.rb |
| config/routes.rb |
| config.ru |
| Gemfile |
| script/ahn |
| spec/spec_helper.rb |
Expand Down
1 change: 1 addition & 0 deletions lib/adhearsion.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
%w(
adhearsion/rayo
celluloid
celluloid/autostart
active_support/inflector
).each { |r| require r }

Expand Down
4 changes: 2 additions & 2 deletions lib/adhearsion/call.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Call
ExpiredError = Class.new Celluloid::DeadActorError

# @private
class ActorProxy < Celluloid::CellProxy
class ActorProxy < Celluloid::Proxy::Cell
def method_missing(meth, *args, &block)
super(meth, *args, &block)
rescue ::Celluloid::DeadActorError
Expand Down Expand Up @@ -254,7 +254,7 @@ def register_initial_handlers
end

on_end do |event|
logger.info "Call #{from} -> #{to} ended due to #{event.reason}#{" (code #{event.platform_code})" if event.platform_code}"
logger.info "Call ended due to #{event.reason}#{" (code #{event.platform_code})" if event.platform_code}"
@end_time = event.timestamp.to_time
@duration = @end_time.to_i - @start_time.to_i if @start_time
clear_from_active_calls
Expand Down
6 changes: 3 additions & 3 deletions lib/adhearsion/call_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ def mixin(mod)
include mod
end

def before_call(*args, &block)
ruby2_keywords def before_call(*args, &block)
Adhearsion.deprecated :before
before(*args, &block)
end

def after_call(*args, &block)
ruby2_keywords def after_call(*args, &block)
Adhearsion.deprecated :after
after(*args, &block)
end
Expand Down Expand Up @@ -333,7 +333,7 @@ def resume!

# @private
def inspect
"#<#{self.class} call=#{call.alive? ? call.id : ''}, metadata=#{metadata.inspect}>"
"#<#{self.class} call=#{call.alive? ? call.id : ''}>"
end

def eql?(other)
Expand Down
7 changes: 0 additions & 7 deletions lib/adhearsion/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,6 @@ def initialize(env = :development, &block)
__
}

desc "HTTP server"
http do
enable true, desc: "Enable or disable the HTTP server"
host "0.0.0.0", desc: "IP to bind the HTTP listener to"
port "8080", desc: "Port to bind the HTTP listener to"
rackup 'config.ru', desc: 'Path to Rack configuration file (relative to Adhearsion application root)'
end
end

Loquacious::Configuration.for :core, &block if block_given?
Expand Down
1 change: 0 additions & 1 deletion lib/adhearsion/generators/app/app_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ def setup_project
template "adhearsion.erb", "config/adhearsion.rb"
template "events.erb", "config/events.rb"
template "routes.erb", "config/routes.rb"
copy_file "config.ru", "config.ru"
copy_file "gitignore", ".gitignore"
copy_file "rspec", ".rspec"
copy_file "Procfile"
Expand Down
2 changes: 0 additions & 2 deletions lib/adhearsion/generators/app/templates/Gemfile.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ gem 'adhearsion', '~> <%= Adhearsion::VERSION.split('.')[0,2].join('.') %>'
# To use them, simply add them here and run `bundle install`.
#

gem 'sinatra'

group :development, :test do
gem 'rspec'
end
9 changes: 0 additions & 9 deletions lib/adhearsion/generators/app/templates/config.ru

This file was deleted.

2 changes: 1 addition & 1 deletion lib/adhearsion/generators/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def self.namespace(name = nil)
def self.default_source_root
return unless generator_name
path = File.expand_path File.join(generator_name, 'templates'), base_root
path if File.exists?(path)
path if File.exist?(path)
end

# Returns the base root for a common set of generators. This is used to dynamically
Expand Down
37 changes: 0 additions & 37 deletions lib/adhearsion/http_server.rb

This file was deleted.

6 changes: 3 additions & 3 deletions lib/adhearsion/i18n.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ module I18n
def self.t(key, options = {})
this_locale = options[:locale] || locale
options = {default: '', locale: locale}.merge(options)
prompt = ::I18n.t "#{key}.audio", options
text = ::I18n.t "#{key}.text", options
prompt = ::I18n.t "#{key}.audio", **options
text = ::I18n.t "#{key}.text", **options

if prompt.empty? && text.empty?
# Look for a translation key that doesn't follow the Adhearsion-I18n structure
text = ::I18n.t key, options
text = ::I18n.t key, **options
end

unless prompt.empty?
Expand Down
8 changes: 3 additions & 5 deletions lib/adhearsion/initializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
require 'adhearsion/application'
require 'adhearsion/linux_proc_name'
require 'adhearsion/rayo/initializer'
require 'adhearsion/http_server'
require 'rbconfig'

module Adhearsion
Expand Down Expand Up @@ -43,7 +42,6 @@ def start
initialize_exception_logger
setup_i18n_load_path
Rayo::Initializer.init
HTTPServer.start
init_plugins

Rayo::Initializer.run
Expand Down Expand Up @@ -145,7 +143,7 @@ def load_lib_folder

def load_app_file
path = "#{Adhearsion.config.root}/config/app.rb"
load path if File.exists?(path)
load path if File.exist?(path)
end

def load_config_file
Expand All @@ -155,12 +153,12 @@ def load_config_file
def load_events_file
Adhearsion::Events.init
path = "#{Adhearsion.config.root}/config/events.rb"
load path if File.exists?(path)
load path if File.exist?(path)
end

def load_routes_file
path = "#{Adhearsion.config.root}/config/routes.rb"
load path if File.exists?(path)
load path if File.exist?(path)
end

def configure_plugins
Expand Down
7 changes: 6 additions & 1 deletion lib/adhearsion/outbound_call.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,12 @@ def dial(to, options = {})
Adhearsion.active_calls << current_actor

write_and_await_response(@dial_command, wait_timeout, true).tap do |dial_command|
@start_time = dial_command.timestamp.to_time
if dial_command.respond_to?(:timestamp)
@start_time = dial_command.timestamp.to_time
else
logger.warn "dial_command #{dial_command.inspect} did not respond to timestamp. @dial_command #{@dial_command.inspect}"
end

if @dial_command.uri != self.uri
logger.warn "Requested call URI (#{uri}) was not respected. Tracking by new URI #{self.uri}. This might cause a race in event handling, please upgrade your Rayo server."
Adhearsion.active_calls << current_actor
Expand Down
2 changes: 1 addition & 1 deletion lib/adhearsion/process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def die_now!
end

def fqdn
Socket.gethostbyname(Socket.gethostname).first
Addrinfo.getaddrinfo(Socket.gethostname, nil).first.getnameinfo.first
end

def self.method_missing(method_name, *args, &block)
Expand Down
4 changes: 2 additions & 2 deletions lib/adhearsion/script_ahn_loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ def self.exec_script_ahn!(args = ARGV)
end

def self.in_ahn_application?(path = '.')
Dir.chdir(path) { File.exists? SCRIPT_AHN }
Dir.chdir(path) { File.exist? SCRIPT_AHN }
end

def self.in_ahn_application_subdirectory?(path = Pathname.new(Dir.pwd))
File.exists?(File.join(path, SCRIPT_AHN)) || !path.root? && in_ahn_application_subdirectory?(path.parent)
File.exist?(File.join(path, SCRIPT_AHN)) || !path.root? && in_ahn_application_subdirectory?(path.parent)
end
end
end
2 changes: 1 addition & 1 deletion lib/adhearsion/translator/asterisk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def run_at_fully_booted
end

def check_recording_directory
logger.warn "Recordings directory #{Component::Record::RECORDING_BASE_PATH} does not exist. Recording might not work. This warning can be ignored if Adhearsion is running on a separate machine than Asterisk. See http://adhearsion.com/docs/call-controllers#recording" unless File.exists?(Component::Record::RECORDING_BASE_PATH)
logger.warn "Recordings directory #{Component::Record::RECORDING_BASE_PATH} does not exist. Recording might not work. This warning can be ignored if Adhearsion is running on a separate machine than Asterisk. See http://adhearsion.com/docs/call-controllers#recording" unless File.exist?(Component::Record::RECORDING_BASE_PATH)
end

def actor_died(actor, reason)
Expand Down
Loading