Sha256: 9aa0dc9da9990bdb61fab29dc077ae0a9bedad65b832c13906dff36cb46ffe21
Contents?: true
Size: 1.23 KB
Versions: 1
Compression:
Stored size: 1.23 KB
Contents
module Adhearsion class OutboundCall < Call attr_reader :dial_command class << self def originate(to, opts = {}) new.tap do |call| call.run_router_on_answer call.dial to, opts end end end def id dial_command.call_id if dial_command end def variables {} end def client PunchblockPlugin::Initializer.client end def accept(*args) end def answer(*args) end def reject(*args) end def dial(to, options = {}) options.merge! :to => to write_and_await_response(Punchblock::Command::Dial.new(options)).tap do |dial_command| @dial_command = dial_command Adhearsion.active_calls << self end end def run_router catching_standard_errors do dispatcher = Adhearsion.router.handle self dispatcher.call self end end def run_router_on_answer register_event_handler :class => Punchblock::Event::Answered do |event| run_router throw :pass end end def on_answer(&block) register_event_handler :class => Punchblock::Event::Answered do |event| block.call event throw :pass end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
adhearsion-2.0.0.alpha1 | lib/adhearsion/outbound_call.rb |