Class: Adhearsion::OutboundCall
- Inherits:
-
Call
show all
- Defined in:
- lib/adhearsion/outbound_call.rb
Constant Summary
Constant Summary
Constants inherited
from Call
Call::CommandTimeout, Call::ExpiredError, Call::Hangup
Instance Attribute Summary (collapse)
Attributes inherited from Call
#variables
Class Method Summary
(collapse)
Instance Method Summary
(collapse)
Methods inherited from Call
#active?, #deliver_message, #execute_controller, #hangup, #initialize, #join, #mute, new, #on_end, #register_event_handler, #remove_tag, #tag, #tagged_with?, #tags, #unjoin, #unmute, #wait_for_joined, #wait_for_unjoined
Methods included from Celluloid
logger
Instance Attribute Details
- (Object) dial_command
Returns the value of attribute dial_command
5
6
7
|
# File 'lib/adhearsion/outbound_call.rb', line 5
def dial_command
@dial_command
end
|
Class Method Details
+ (Object) originate(to, opts = {})
10
11
12
13
14
15
|
# File 'lib/adhearsion/outbound_call.rb', line 10
def originate(to, opts = {})
new.tap do |call|
call.run_router_on_answer
call.dial to, opts
end
end
|
Instance Method Details
- (Object) accept(*args)
26
27
|
# File 'lib/adhearsion/outbound_call.rb', line 26
def accept(*args)
end
|
- (Object) answer(*args)
29
30
|
# File 'lib/adhearsion/outbound_call.rb', line 29
def answer(*args)
end
|
22
23
24
|
# File 'lib/adhearsion/outbound_call.rb', line 22
def client
PunchblockPlugin::Initializer.client
end
|
- (Object) dial(to, options = {})
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/adhearsion/outbound_call.rb', line 35
def dial(to, options = {})
options.merge! :to => to
if options[:timeout]
wait_timeout = options[:timeout]
options[:timeout] = options[:timeout] * 1000
else
wait_timeout = 60
end
write_and_await_response(Punchblock::Command::Dial.new(options), wait_timeout).tap do |dial_command|
@dial_command = dial_command
Adhearsion.active_calls << current_actor
end
end
|
18
19
20
|
# File 'lib/adhearsion/outbound_call.rb', line 18
def id
dial_command.target_call_id if dial_command
end
|
- (Object) on_answer(&block)
64
65
66
67
68
69
|
# File 'lib/adhearsion/outbound_call.rb', line 64
def on_answer(&block)
register_event_handler :class => Punchblock::Event::Answered do |event|
block.call event
throw :pass
end
end
|
- (Object) reject(*args)
32
33
|
# File 'lib/adhearsion/outbound_call.rb', line 32
def reject(*args)
end
|
- (Object) run_router
50
51
52
53
54
55
|
# File 'lib/adhearsion/outbound_call.rb', line 50
def run_router
catching_standard_errors do
dispatcher = Adhearsion.router.handle current_actor
dispatcher.call current_actor
end
end
|
- (Object) run_router_on_answer
57
58
59
60
61
62
|
# File 'lib/adhearsion/outbound_call.rb', line 57
def run_router_on_answer
register_event_handler :class => Punchblock::Event::Answered do |event|
run_router
throw :pass
end
end
|