Module: Adhearsion::Asterisk

Extended by:
ActiveSupport::Autoload
Defined in:
lib/adhearsion/asterisk.rb,
lib/adhearsion/asterisk/plugin.rb,
lib/adhearsion/asterisk/version.rb,
lib/adhearsion/asterisk/queue_proxy.rb,
lib/adhearsion/asterisk/config_manager.rb,
lib/adhearsion/asterisk/has_agi_context.rb,
lib/adhearsion/asterisk/config_generator.rb,
lib/adhearsion/asterisk/call_controller_methods.rb,
lib/adhearsion/asterisk/config_generator/agents.rb,
lib/adhearsion/asterisk/config_generator/queues.rb,
lib/adhearsion/asterisk/queue_proxy/agent_proxy.rb,
lib/adhearsion/asterisk/config_generator/voicemail.rb,
lib/adhearsion/asterisk/queue_proxy/queue_agents_list_proxy.rb

Defined Under Namespace

Modules: CallControllerMethods, HasAgiContext Classes: ConfigGenerator, ConfigurationManager, Plugin, QueueProxy

Constant Summary collapse

VERSION =
"1.5.0"
PLAYBACK_SUCCESS =
'SUCCESS'

Class Method Summary collapse

Class Method Details

.execute_ami_action(name, options = {}) {|Punchblock::Event::Asterisk::AMI::Event| ... } ⇒ Punchblock::Event::Complete

Execute an AMI action synchronously

Examples:

Execute a CoreShowChannels action, handling each channel event:


Adhearsion::Asterisk.execute_ami_action('CoreShowChannels') { |channel| puts channel.inspect }

Parameters:

  • name (String)

    the name of the action to execute

  • options (Hash<String => Object>) (defaults to: {})

    options to pass to the action

Yields:

  • (Punchblock::Event::Asterisk::AMI::Event)

    block to handle each event resulting from the action

Returns:

  • (Punchblock::Event::Complete)

    action complete event



28
29
30
31
32
33
# File 'lib/adhearsion/asterisk.rb', line 28

def self.execute_ami_action(name, options = {}, &block)
  component = Punchblock::Component::Asterisk::AMI::Action.new :name => name, :params => options
  component.register_event_handler(Punchblock::Event::Asterisk::AMI::Event, &block) if block
  Adhearsion::PunchblockPlugin.execute_component component
  component.complete_event
end