Class: Adhearsion::CallController
- Inherits:
-
Object
- Object
- Adhearsion::CallController
- Extended by:
- ActiveSupport::Autoload
- Includes:
- Dial, Input, Output, Record, Utility
- Defined in:
- lib/adhearsion/call_controller.rb,
lib/adhearsion/call_controller/dial.rb,
lib/adhearsion/call_controller/input.rb,
lib/adhearsion/call_controller/output.rb,
lib/adhearsion/call_controller/record.rb,
lib/adhearsion/call_controller/utility.rb,
lib/adhearsion/call_controller/menu_dsl.rb,
lib/adhearsion/call_controller/output/player.rb,
lib/adhearsion/call_controller/menu_dsl/menu.rb,
lib/adhearsion/call_controller/output/formatter.rb,
lib/adhearsion/call_controller/output/async_player.rb,
lib/adhearsion/call_controller/menu_dsl/menu_builder.rb,
lib/adhearsion/call_controller/output/abstract_player.rb,
lib/adhearsion/call_controller/menu_dsl/match_calculator.rb,
lib/adhearsion/call_controller/menu_dsl/calculated_match.rb,
lib/adhearsion/call_controller/menu_dsl/array_match_calculator.rb,
lib/adhearsion/call_controller/menu_dsl/range_match_calculator.rb,
lib/adhearsion/call_controller/menu_dsl/string_match_calculator.rb,
lib/adhearsion/call_controller/menu_dsl/fixnum_match_calculator.rb,
lib/adhearsion/call_controller/menu_dsl/calculated_match_collection.rb
Direct Known Subclasses
Defined Under Namespace
Modules: Dial, Input, Output, Record, Utility
Constant Summary
Constant Summary
Constants included from Record
Constants included from Output
Instance Attribute Summary (collapse)
-
- (Object) call
readonly
Returns the value of attribute call.
-
- (Object) metadata
readonly
Returns the value of attribute metadata.
Class Method Summary (collapse)
-
+ (Object) exec(controller)
Execute a call controller, allowing passing control to another controller.
-
+ (Object) mixin(mod)
Include another module into all CallController classes.
Instance Method Summary (collapse)
-
- (Object) answer(*args)
Answer the call.
- - (Object) bg_exec(completion_callback = nil)
- - (Boolean) eql?(other) (also: #==)
-
- (Object) exec(controller = self)
Execute the controller, allowing passing control to another controller.
- - (Object) exec_with_callback(completion_callback = nil)
-
- (Object) hangup(headers = nil)
Hangup the call, and execute after_call callbacks.
-
- (CallController) initialize(call, metadata = nil, &block)
constructor
Create a new instance.
-
- (Object) invoke(controller_class, metadata = nil)
Invoke another controller class within this controller, returning to this context on completion.
-
- (Object) join(target, options = {})
Join the call to another call or a mixer, and block until the call is unjoined (by hangup or otherwise).
- - (Object) logger
-
- (Object) mute(*args)
Mute the call.
-
- (Object) pass(controller_class, metadata = nil)
Cease execution of this controller, and pass to another.
-
- (Object) reject(*args)
Reject the call.
-
- (Object) run
Invoke the block supplied when creating the controller.
-
- (Object) unmute(*args)
Unmute the call.
Methods included from Record
Methods included from Output
#interruptible_play, #output_formatter, #play, #play!, #play_audio, #play_audio!, #play_numeric, #play_numeric!, #play_time, #play_time!, #say, #say!
Methods included from Input
Methods included from Dial
Constructor Details
- (CallController) initialize(call, metadata = nil, &block)
Create a new instance
72 73 74 |
# File 'lib/adhearsion/call_controller.rb', line 72 def initialize(call, = nil, &block) @call, @metadata, @block = call, || {}, block end |
Instance Attribute Details
- (Object) call (readonly)
Returns the value of attribute call
57 58 59 |
# File 'lib/adhearsion/call_controller.rb', line 57 def call @call end |
- (Object) metadata (readonly)
Returns the value of attribute metadata
57 58 59 |
# File 'lib/adhearsion/call_controller.rb', line 57 def @metadata end |
Class Method Details
+ (Object) exec(controller)
Execute a call controller, allowing passing control to another controller
45 46 47 |
# File 'lib/adhearsion/call_controller.rb', line 45 def exec(controller) controller.exec end |
+ (Object) mixin(mod)
Include another module into all CallController classes
52 53 54 |
# File 'lib/adhearsion/call_controller.rb', line 52 def mixin(mod) include mod end |
Instance Method Details
- (Object) answer(*args)
Answer the call
193 194 195 196 |
# File 'lib/adhearsion/call_controller.rb', line 193 def answer(*args) block_until_resumed call.answer(*args) end |
- (Object) bg_exec(completion_callback = nil)
88 89 90 91 92 93 94 |
# File 'lib/adhearsion/call_controller.rb', line 88 def bg_exec(completion_callback = nil) Celluloid::ThreadHandle.new do catching_standard_errors do exec_with_callback completion_callback end end end |
- (Boolean) eql?(other) Also known as: ==
273 274 275 |
# File 'lib/adhearsion/call_controller.rb', line 273 def eql?(other) other.instance_of?(self.class) && call == other.call && == other. end |
- (Object) exec(controller = self)
Execute the controller, allowing passing control to another controller
79 80 81 82 83 84 85 86 |
# File 'lib/adhearsion/call_controller.rb', line 79 def exec(controller = self) new_controller = catch :pass_controller do controller.execute! nil end exec new_controller if new_controller end |
- (Object) exec_with_callback(completion_callback = nil)
96 97 98 99 100 |
# File 'lib/adhearsion/call_controller.rb', line 96 def exec_with_callback(completion_callback = nil) exec ensure completion_callback.call call if completion_callback end |
- (Object) hangup(headers = nil)
Hangup the call, and execute after_call callbacks
164 165 166 167 168 169 |
# File 'lib/adhearsion/call_controller.rb', line 164 def hangup(headers = nil) block_until_resumed call.hangup headers after_call raise Call::Hangup end |
- (Object) invoke(controller_class, metadata = nil)
Invoke another controller class within this controller, returning to this context on completion.
130 131 132 133 |
# File 'lib/adhearsion/call_controller.rb', line 130 def invoke(controller_class, = nil) controller = controller_class.new call, controller.run end |
- (Object) join(target, options = {})
Join the call to another call or a mixer, and block until the call is unjoined (by hangup or otherwise).
237 238 239 240 241 242 243 244 245 246 247 |
# File 'lib/adhearsion/call_controller.rb', line 237 def join(target, = {}) block_until_resumed async = (target.is_a?(Hash) ? target : ).delete :async join_command = call.join target, waiter = join_command.call_id || join_command.mixer_name if async call.wait_for_joined waiter else call.wait_for_unjoined waiter end end |
- (Object) logger
278 279 280 281 282 |
# File 'lib/adhearsion/call_controller.rb', line 278 def logger call.logger rescue Celluloid::DeadActorError super end |
- (Object) mute(*args)
Mute the call
213 214 215 216 |
# File 'lib/adhearsion/call_controller.rb', line 213 def mute(*args) block_until_resumed call.mute(*args) end |
- (Object) pass(controller_class, metadata = nil)
Cease execution of this controller, and pass to another.
141 142 143 |
# File 'lib/adhearsion/call_controller.rb', line 141 def pass(controller_class, = nil) throw :pass_controller, controller_class.new(call, ) end |
- (Object) reject(*args)
Reject the call
203 204 205 206 |
# File 'lib/adhearsion/call_controller.rb', line 203 def reject(*args) block_until_resumed call.reject(*args) end |
- (Object) run
Invoke the block supplied when creating the controller
119 120 121 |
# File 'lib/adhearsion/call_controller.rb', line 119 def run instance_exec(&block) if block end |
- (Object) unmute(*args)
Unmute the call
223 224 225 226 |
# File 'lib/adhearsion/call_controller.rb', line 223 def unmute(*args) block_until_resumed call.unmute(*args) end |