Class: Adhearsion::PunchblockPlugin

Inherits:
Plugin show all
Defined in:
lib/adhearsion/punchblock_plugin.rb,
lib/adhearsion/punchblock_plugin/initializer.rb

Defined Under Namespace

Classes: Initializer

Constant Summary

Constants inherited from Plugin

Adhearsion::Plugin::METHODS_OPTIONS

Class Method Summary collapse

Methods inherited from Plugin

add, config, configs, configure_plugins, count, delete, delete_all, generators, init, init_plugins, initializers, load_tasks, plugin_name, plugin_name=, reset_rake_tasks, run, run_plugins, runners, show_description, subclasses, tasks

Class Method Details

.default_port_for_platform(platform) ⇒ Object


46
47
48
49
50
51
52
53
# File 'lib/adhearsion/punchblock_plugin.rb', line 46

def default_port_for_platform(platform)
  case platform
    when :freeswitch then 8021
    when :asterisk then 5038
    when :xmpp then 5222
    else nil
  end
end

.execute_component(command, timeout = 60) ⇒ Object


55
56
57
58
59
60
# File 'lib/adhearsion/punchblock_plugin.rb', line 55

def execute_component(command, timeout = 60)
  client.execute_command command, :async => true
  response = command.response timeout
  raise response if response.is_a? Exception
  command
end

.validate_number(value) ⇒ Object


41
42
43
44
# File 'lib/adhearsion/punchblock_plugin.rb', line 41

def validate_number(value)
  return 1.0/0.0 if ["Infinity", 1.0/0.0].include? value
  value.to_i
end