Class: Adhearsion::VoIP::Asterisk::ConfigFileGenerators::Queues

Inherits:
AsteriskConfigGenerator show all
Defined in:
lib/adhearsion/voip/asterisk/config_generators/queues.conf.rb

Overview

This will generate a queues.conf file. If there is no documentation on what a method actually does, take a look at the documentation for its original key/value pair in an unedited queues.conf file. WARNING! Don’t get too embedded with these method names. I’m still not satisfied. These settings will be greatly abstracted eventually.

Defined Under Namespace

Classes: QueueDefinition

Constant Summary collapse

DEFAULT_GENERAL_SECTION =
{
  :autofill => "yes"
}

Constants inherited from AsteriskConfigGenerator

AsteriskConfigGenerator::SECTION_TITLE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from AsteriskConfigGenerator

create_sanitary_hash_from, #to_sanitary_hash, warning_message

Constructor Details

#initializeQueues

Returns a new instance of Queues.



19
20
21
22
23
24
# File 'lib/adhearsion/voip/asterisk/config_generators/queues.conf.rb', line 19

def initialize
  @general_section   = DEFAULT_GENERAL_SECTION.clone
  @properties        = {}
  @queue_definitions = []
  super
end

Instance Attribute Details

#general_sectionObject (readonly)

Returns the value of attribute general_section.



18
19
20
# File 'lib/adhearsion/voip/asterisk/config_generators/queues.conf.rb', line 18

def general_section
  @general_section
end

#propertiesObject (readonly)

Returns the value of attribute properties.



18
19
20
# File 'lib/adhearsion/voip/asterisk/config_generators/queues.conf.rb', line 18

def properties
  @properties
end

#queue_definitionsObject (readonly)

Returns the value of attribute queue_definitions.



18
19
20
# File 'lib/adhearsion/voip/asterisk/config_generators/queues.conf.rb', line 18

def queue_definitions
  @queue_definitions
end

Instance Method Details

#monitor_type(symbol) ⇒ Object



44
45
46
47
# File 'lib/adhearsion/voip/asterisk/config_generators/queues.conf.rb', line 44

def monitor_type(symbol)
  criteria = {:monitor => "Monitor", :mix_monitor => "MixMonitor"}
  one_of_and_translate criteria, 'monitor-type' => symbol, :with => general_section
end

#persistent_members(yes_no) ⇒ Object



40
41
42
# File 'lib/adhearsion/voip/asterisk/config_generators/queues.conf.rb', line 40

def persistent_members(yes_no)
  boolean :persistentmembers => yes_no, :with => general_section
end

#queue(name) {|new_queue| ... } ⇒ Object

Yields:

  • (new_queue)


26
27
28
29
30
31
# File 'lib/adhearsion/voip/asterisk/config_generators/queues.conf.rb', line 26

def queue(name)
  new_queue = QueueDefinition.new name
  yield new_queue if block_given?
  queue_definitions << new_queue
  new_queue
end

#to_sObject Also known as: conf



33
34
35
36
37
# File 'lib/adhearsion/voip/asterisk/config_generators/queues.conf.rb', line 33

def to_s
  AsteriskConfigGenerator.warning_message +
  general_section.inject("[general]") { |section,(key,value)| section + "\n#{key}=#{value}" } + "\n\n" +
  queue_definitions.map(&:to_s).join("\n\n")
end