Skip to content

Commit

Permalink
Respect the :auto_reconnect setting for AMI
Browse files Browse the repository at this point in the history
  • Loading branch information
bklang committed Oct 2, 2010
1 parent 111106c commit 1748f7f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/adhearsion/initializer/asterisk.rb
Expand Up @@ -50,7 +50,7 @@ def manager_interface
end

def ami_options
%w(host port username password events).inject({}) do |options, property|
%w(host port username password events auto_reconnect).inject({}) do |options, property|
options[property.to_sym] = config.ami.send property
options
end
Expand Down
15 changes: 10 additions & 5 deletions lib/adhearsion/initializer/configuration.rb
Expand Up @@ -129,8 +129,8 @@ def default_listening_host
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
Expand Down Expand Up @@ -158,7 +158,7 @@ def initialize(overrides = {})
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
Expand All @@ -172,12 +172,17 @@ def default_events
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
Expand Down
3 changes: 2 additions & 1 deletion lib/adhearsion/voip/asterisk/manager_interface.rb
Expand Up @@ -108,8 +108,9 @@ def causal_event_terminator_name_for(action_name)
# @param [Hash] options Available options are :host, :port, :username, :password, and :events
#
def initialize(options={})
puts options.inspect

This comment has been minimized.

Copy link
@eric

eric Oct 3, 2010

Contributor

It looks like you checked in a couple puts statements.

This comment has been minimized.

Copy link
@bklang

bklang Oct 3, 2010

Author Member

Whoops! Fixed, thanks.

options = parse_options options

puts options.inspect
@host = options[:host]
@username = options[:username]
@password = options[:password]
Expand Down

0 comments on commit 1748f7f

Please sign in to comment.