lib/adhearsion/initializer/configuration.rb in adhearsion-0.8.6 vs lib/adhearsion/initializer/configuration.rb in adhearsion-1.0.0

- old
+ new

@@ -33,15 +33,17 @@ end attr_accessor :automatically_answer_incoming_calls attr_accessor :end_call_on_hangup attr_accessor :end_call_on_error + attr_accessor :components_to_load def initialize @automatically_answer_incoming_calls = true @end_call_on_hangup = true @end_call_on_error = true + @components_to_load = [] yield self if block_given? end def ahnrc @ahnrc @@ -65,10 +67,14 @@ def logging(options) Adhearsion::Logging.logging_level = options[:level] end + def add_component(*list) + AHN_CONFIG.components_to_load |= list + end + ## # Adhearsion's .ahnrc file is used to define paths to certain parts of the framework. For example, the name dialplan.rb # is actually specified in .ahnrc. This file can actually be just a filename, a filename with a glob (.e.g "*.rb"), an # Array of filenames or even an Array of globs. # @@ -127,12 +133,12 @@ '0.0.0.0' end end def initialize(overrides = {}) - @listening_port = overrides.has_key?(:port) ? overrides.delete(:port) : self.class.default_listening_port @listening_host = overrides.has_key?(:host) ? overrides.delete(:host) : self.class.default_listening_host + @listening_port = overrides.has_key?(:port) ? overrides.delete(:port) : self.class.default_listening_port super end end class AsteriskConfiguration < TelephonyPlatformConfiguration @@ -156,11 +162,11 @@ @argument_delimiter = self.class.default_argument_delimiter super end class AMIConfiguration < AbstractConfiguration - attr_accessor :port, :username, :password, :events, :host + attr_accessor :port, :username, :password, :events, :host, :auto_reconnect class << self def default_port 5038 end @@ -170,15 +176,20 @@ end def default_host 'localhost' end + + def default_auto_reconnect + true + end end def initialize(overrides = {}) - self.host = self.class.default_host - self.port = self.class.default_port - self.events = self.class.default_events + self.host = self.class.default_host + self.port = self.class.default_port + self.events = self.class.default_events + self.auto_reconnect = self.class.default_auto_reconnect super end end add_configuration_for :AMI end