From f70db57f02e7209988751c2101e2c441ba393d27 Mon Sep 17 00:00:00 2001 From: Kim Gustafson Date: Mon, 17 Apr 2023 11:37:49 -0700 Subject: [PATCH 01/15] File.exists is deprecated in Ruby 3 --- lib/adhearsion/generators/generator.rb | 2 +- lib/adhearsion/http_server.rb | 2 +- lib/adhearsion/initializer.rb | 6 +++--- lib/adhearsion/script_ahn_loader.rb | 4 ++-- lib/adhearsion/translator/asterisk.rb | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/adhearsion/generators/generator.rb b/lib/adhearsion/generators/generator.rb index b1062e7f0..4eb563453 100644 --- a/lib/adhearsion/generators/generator.rb +++ b/lib/adhearsion/generators/generator.rb @@ -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 diff --git a/lib/adhearsion/http_server.rb b/lib/adhearsion/http_server.rb index 5933ab3b0..3cca26fe3 100644 --- a/lib/adhearsion/http_server.rb +++ b/lib/adhearsion/http_server.rb @@ -12,7 +12,7 @@ def self.start return unless config.enable rackup = File.join(Adhearsion.root, config.rackup) - unless File.exists?(rackup) + unless File.exist?(rackup) logger.error "Cannot start HTTP server because the Rack configuration does not exist at #{rackup}" return end diff --git a/lib/adhearsion/initializer.rb b/lib/adhearsion/initializer.rb index 09a46dc31..d27cf4daf 100644 --- a/lib/adhearsion/initializer.rb +++ b/lib/adhearsion/initializer.rb @@ -145,7 +145,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 @@ -155,12 +155,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 diff --git a/lib/adhearsion/script_ahn_loader.rb b/lib/adhearsion/script_ahn_loader.rb index 4aadc424f..a98598ba4 100644 --- a/lib/adhearsion/script_ahn_loader.rb +++ b/lib/adhearsion/script_ahn_loader.rb @@ -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 diff --git a/lib/adhearsion/translator/asterisk.rb b/lib/adhearsion/translator/asterisk.rb index 5d1ec1684..044dcdd18 100644 --- a/lib/adhearsion/translator/asterisk.rb +++ b/lib/adhearsion/translator/asterisk.rb @@ -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) From d3e05727d8b147289eb035bfa9798246197ca2f0 Mon Sep 17 00:00:00 2001 From: Kim Gustafson Date: Mon, 17 Apr 2023 11:57:41 -0700 Subject: [PATCH 02/15] Use keyword args with i18n for Ruby 3 https://github.com/ruby-i18n/i18n/blob/cb4a4be9a13ae03b7b6d0678a3ad00dd790ee240/lib/i18n.rb#L183-L194 --- lib/adhearsion/i18n.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/adhearsion/i18n.rb b/lib/adhearsion/i18n.rb index 6bda6f12e..01c960b65 100644 --- a/lib/adhearsion/i18n.rb +++ b/lib/adhearsion/i18n.rb @@ -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? From 85e058be54b5b74d19d7d6ea1d7fc597bd9faaa5 Mon Sep 17 00:00:00 2001 From: Kim Gustafson Date: Mon, 17 Apr 2023 13:50:53 -0700 Subject: [PATCH 03/15] Remove nokogiri constraint so we don't regress upstream --- adhearsion.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adhearsion.gemspec b/adhearsion.gemspec index 474a32509..640ce0f9a 100644 --- a/adhearsion.gemspec +++ b/adhearsion.gemspec @@ -32,7 +32,7 @@ Gem::Specification.new do |s| 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"] From 0d52e0433c9f8b88de0e6ff2856916201b77f662 Mon Sep 17 00:00:00 2001 From: Lulu Du Date: Tue, 3 Dec 2024 14:55:24 -0600 Subject: [PATCH 04/15] remove reel --- adhearsion.gemspec | 3 --- 1 file changed, 3 deletions(-) diff --git a/adhearsion.gemspec b/adhearsion.gemspec index 640ce0f9a..154368676 100644 --- a/adhearsion.gemspec +++ b/adhearsion.gemspec @@ -35,9 +35,6 @@ Gem::Specification.new do |s| 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"] From b3bc33f5642590c61ab5b795f9ee6ff073ed3845 Mon Sep 17 00:00:00 2001 From: Lulu Du Date: Tue, 3 Dec 2024 15:28:08 -0600 Subject: [PATCH 05/15] remove celluloid version --- adhearsion.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adhearsion.gemspec b/adhearsion.gemspec index 154368676..b33db29ff 100644 --- a/adhearsion.gemspec +++ b/adhearsion.gemspec @@ -24,7 +24,7 @@ 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' s.add_runtime_dependency 'countdownlatch' s.add_runtime_dependency 'deep_merge' s.add_runtime_dependency 'ffi', ["~> 1.0"] From 6f4f48d2b432441e35d3c11e994fff7a5eaf3965 Mon Sep 17 00:00:00 2001 From: Lulu Du Date: Wed, 4 Dec 2024 08:43:43 -0600 Subject: [PATCH 06/15] update ruby_ami version --- adhearsion.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adhearsion.gemspec b/adhearsion.gemspec index b33db29ff..047ceffa0 100644 --- a/adhearsion.gemspec +++ b/adhearsion.gemspec @@ -35,7 +35,7 @@ Gem::Specification.new do |s| 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 'ruby_ami', ["~> 2.2"] + s.add_runtime_dependency 'ruby_ami', ["~> 3.0"] s.add_runtime_dependency 'ruby_jid', ["~> 1.0"] s.add_runtime_dependency 'ruby_speech', ["~> 3.0"] s.add_runtime_dependency 'state_machine', ["~> 1.0"] From 891e1c49858c5c3ffe662bc92c08913147211ea6 Mon Sep 17 00:00:00 2001 From: Lulu Du Date: Wed, 4 Dec 2024 10:19:36 -0600 Subject: [PATCH 07/15] update CellProxy class name --- lib/adhearsion/call.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/adhearsion/call.rb b/lib/adhearsion/call.rb index 0bdb548bd..5e6e1a3fe 100644 --- a/lib/adhearsion/call.rb +++ b/lib/adhearsion/call.rb @@ -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 From 4e8aaf2c207adc98a9275e0fef001f8bbf354976 Mon Sep 17 00:00:00 2001 From: Lulu Du Date: Wed, 4 Dec 2024 10:22:04 -0600 Subject: [PATCH 08/15] reset ruby ami version --- adhearsion.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adhearsion.gemspec b/adhearsion.gemspec index 047ceffa0..b33db29ff 100644 --- a/adhearsion.gemspec +++ b/adhearsion.gemspec @@ -35,7 +35,7 @@ Gem::Specification.new do |s| 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 'ruby_ami', ["~> 3.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"] s.add_runtime_dependency 'state_machine', ["~> 1.0"] From 522a2f3d1b910517274565d0360444bd606aa7c0 Mon Sep 17 00:00:00 2001 From: Lulu Du Date: Wed, 4 Dec 2024 10:25:29 -0600 Subject: [PATCH 09/15] put reel back --- adhearsion.gemspec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/adhearsion.gemspec b/adhearsion.gemspec index b33db29ff..13ac465c5 100644 --- a/adhearsion.gemspec +++ b/adhearsion.gemspec @@ -35,6 +35,9 @@ Gem::Specification.new do |s| 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"] From f58f096fcc1668ca998db68addbb01725585a7a6 Mon Sep 17 00:00:00 2001 From: Lulu Du Date: Wed, 4 Dec 2024 11:20:24 -0600 Subject: [PATCH 10/15] remove rack-based HTTP server from Virginia. --- CHANGELOG.md | 1 - Gemfile | 2 - adhearsion.gemspec | 3 -- features/cli_create.feature | 6 --- lib/adhearsion/configuration.rb | 7 ---- .../generators/app/app_generator.rb | 1 - .../generators/app/templates/Gemfile.erb | 2 - .../generators/app/templates/config.ru | 9 ----- lib/adhearsion/http_server.rb | 37 ------------------- lib/adhearsion/initializer.rb | 2 - 10 files changed, 70 deletions(-) delete mode 100644 lib/adhearsion/generators/app/templates/config.ru delete mode 100644 lib/adhearsion/http_server.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index a343ec8ca..150d7491e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/Gemfile b/Gemfile index 7411fcb3d..729917bd1 100644 --- a/Gemfile +++ b/Gemfile @@ -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 diff --git a/adhearsion.gemspec b/adhearsion.gemspec index 13ac465c5..b33db29ff 100644 --- a/adhearsion.gemspec +++ b/adhearsion.gemspec @@ -35,9 +35,6 @@ Gem::Specification.new do |s| 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"] diff --git a/features/cli_create.feature b/features/cli_create.feature index 58949f3dd..f5da646f1 100644 --- a/features/cli_create.feature +++ b/features/cli_create.feature @@ -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 | @@ -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 @@ -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 | diff --git a/lib/adhearsion/configuration.rb b/lib/adhearsion/configuration.rb index efa097cff..df055f17c 100644 --- a/lib/adhearsion/configuration.rb +++ b/lib/adhearsion/configuration.rb @@ -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? diff --git a/lib/adhearsion/generators/app/app_generator.rb b/lib/adhearsion/generators/app/app_generator.rb index e63257bca..f25bd7919 100644 --- a/lib/adhearsion/generators/app/app_generator.rb +++ b/lib/adhearsion/generators/app/app_generator.rb @@ -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" diff --git a/lib/adhearsion/generators/app/templates/Gemfile.erb b/lib/adhearsion/generators/app/templates/Gemfile.erb index 0fbef73cd..1450fa397 100644 --- a/lib/adhearsion/generators/app/templates/Gemfile.erb +++ b/lib/adhearsion/generators/app/templates/Gemfile.erb @@ -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 diff --git a/lib/adhearsion/generators/app/templates/config.ru b/lib/adhearsion/generators/app/templates/config.ru deleted file mode 100644 index 37ee3b6aa..000000000 --- a/lib/adhearsion/generators/app/templates/config.ru +++ /dev/null @@ -1,9 +0,0 @@ -require 'sinatra' - -set :root, Adhearsion.root - -get '/' do - 'Hello world!' -end - -run Sinatra::Application diff --git a/lib/adhearsion/http_server.rb b/lib/adhearsion/http_server.rb deleted file mode 100644 index 3cca26fe3..000000000 --- a/lib/adhearsion/http_server.rb +++ /dev/null @@ -1,37 +0,0 @@ -# encoding: utf-8 - -require 'reel' -require 'reel/rack' - -module Adhearsion - # @private - class HTTPServer - def self.start - config = Adhearsion.config.core.http - - return unless config.enable - - rackup = File.join(Adhearsion.root, config.rackup) - unless File.exist?(rackup) - logger.error "Cannot start HTTP server because the Rack configuration does not exist at #{rackup}" - return - end - - app, options = ::Rack::Builder.parse_file rackup - options = { - Host: config.host, - Port: config.port, - }.merge(options) - - app = Rack::CommonLogger.new(app, logger) - - logger.info "Starting HTTP server listening on #{config.host}:#{config.port}" - - supervisor = ::Reel::Rack::Server.supervise_as(:ahn_http_server, app, options) - - Adhearsion::Events.register_callback :shutdown do - supervisor.terminate - end - end - end -end diff --git a/lib/adhearsion/initializer.rb b/lib/adhearsion/initializer.rb index d27cf4daf..384dab1d6 100644 --- a/lib/adhearsion/initializer.rb +++ b/lib/adhearsion/initializer.rb @@ -3,7 +3,6 @@ require 'adhearsion/application' require 'adhearsion/linux_proc_name' require 'adhearsion/rayo/initializer' -require 'adhearsion/http_server' require 'rbconfig' module Adhearsion @@ -43,7 +42,6 @@ def start initialize_exception_logger setup_i18n_load_path Rayo::Initializer.init - HTTPServer.start init_plugins Rayo::Initializer.run From 5093ae16d6069abb43cbad937bc03a5bbdd9c864 Mon Sep 17 00:00:00 2001 From: Lulu Du Date: Wed, 4 Dec 2024 14:12:19 -0600 Subject: [PATCH 11/15] test with ruby2_keywords --- lib/adhearsion.rb | 1 + lib/adhearsion/call_controller.rb | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/adhearsion.rb b/lib/adhearsion.rb index 343d12429..47f481c3c 100644 --- a/lib/adhearsion.rb +++ b/lib/adhearsion.rb @@ -5,6 +5,7 @@ %w( adhearsion/rayo celluloid + celluloid/autostart active_support/inflector ).each { |r| require r } diff --git a/lib/adhearsion/call_controller.rb b/lib/adhearsion/call_controller.rb index bfdabb139..04ff22c14 100644 --- a/lib/adhearsion/call_controller.rb +++ b/lib/adhearsion/call_controller.rb @@ -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 From ef3a73a94e64c65b029f5c93035c69285928a9a1 Mon Sep 17 00:00:00 2001 From: Lulu Du Date: Mon, 6 Jan 2025 09:42:31 -0600 Subject: [PATCH 12/15] fixed some warnings --- adhearsion.gemspec | 2 +- lib/adhearsion/process.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/adhearsion.gemspec b/adhearsion.gemspec index b33db29ff..cc68c6522 100644 --- a/adhearsion.gemspec +++ b/adhearsion.gemspec @@ -24,7 +24,7 @@ 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' + 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"] diff --git a/lib/adhearsion/process.rb b/lib/adhearsion/process.rb index f562155a8..33e04d11e 100644 --- a/lib/adhearsion/process.rb +++ b/lib/adhearsion/process.rb @@ -107,7 +107,7 @@ def die_now! end def fqdn - Socket.gethostbyname(Socket.gethostname).first + Addrinfo.getaddrinfo(Socket.gethostname).first end def self.method_missing(method_name, *args, &block) From 4e59412ab47862deb3efa17535c8ce3d222992ba Mon Sep 17 00:00:00 2001 From: Lulu Du Date: Mon, 6 Jan 2025 10:09:41 -0600 Subject: [PATCH 13/15] fixing Addrinfo.getaddrinfo --- lib/adhearsion/process.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/adhearsion/process.rb b/lib/adhearsion/process.rb index 33e04d11e..f857aa6af 100644 --- a/lib/adhearsion/process.rb +++ b/lib/adhearsion/process.rb @@ -107,7 +107,7 @@ def die_now! end def fqdn - Addrinfo.getaddrinfo(Socket.gethostname).first + Addrinfo.getaddrinfo(Socket.gethostname, nil).first.getnameinfo.first end def self.method_missing(method_name, *args, &block) From c221cf26574e902fd5cd0561e512868de81efdf6 Mon Sep 17 00:00:00 2001 From: bohyuanchao Date: Thu, 20 Mar 2025 09:50:15 -0500 Subject: [PATCH 14/15] merge PII changes --- lib/adhearsion/call.rb | 2 +- lib/adhearsion/call_controller.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/adhearsion/call.rb b/lib/adhearsion/call.rb index 5e6e1a3fe..e03c499e1 100644 --- a/lib/adhearsion/call.rb +++ b/lib/adhearsion/call.rb @@ -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 diff --git a/lib/adhearsion/call_controller.rb b/lib/adhearsion/call_controller.rb index 04ff22c14..dfc04fbc6 100644 --- a/lib/adhearsion/call_controller.rb +++ b/lib/adhearsion/call_controller.rb @@ -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) From 80c3aa7a30db5ae5f4648d40740b418e53177e17 Mon Sep 17 00:00:00 2001 From: Lulu Du Date: Mon, 4 Aug 2025 13:29:48 -0500 Subject: [PATCH 15/15] fix NoMethodError when command timeout --- lib/adhearsion/outbound_call.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/adhearsion/outbound_call.rb b/lib/adhearsion/outbound_call.rb index bce32cb1c..85750d465 100644 --- a/lib/adhearsion/outbound_call.rb +++ b/lib/adhearsion/outbound_call.rb @@ -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