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/menu_dsl/menu.rb,
lib/adhearsion/call_controller/menu_dsl/menu_builder.rb,
lib/adhearsion/call_controller/menu_dsl/calculated_match.rb,
lib/adhearsion/call_controller/menu_dsl/match_calculator.rb,
lib/adhearsion/call_controller/menu_dsl/range_match_calculator.rb,
lib/adhearsion/call_controller/menu_dsl/fixnum_match_calculator.rb,
lib/adhearsion/call_controller/menu_dsl/string_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) 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) 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, #play, #play_audio, #play_numeric, #play_time, #say, #stream_file
Methods included from Input
Methods included from Dial
Constructor Details
- (CallController) initialize(call, metadata = nil, &block)
Create a new instance
75 76 77 |
# File 'lib/adhearsion/call_controller.rb', line 75 def initialize(call, = nil, &block) @call, @metadata, @block = call, || {}, block end |
Instance Attribute Details
- (Object) call (readonly)
Returns the value of attribute call
60 61 62 |
# File 'lib/adhearsion/call_controller.rb', line 60 def call @call end |
- (Object) metadata (readonly)
Returns the value of attribute metadata
60 61 62 |
# File 'lib/adhearsion/call_controller.rb', line 60 def @metadata end |
Class Method Details
+ (Object) exec(controller)
Execute a call controller, allowing passing control to another controller
43 44 45 46 47 48 49 50 |
# File 'lib/adhearsion/call_controller.rb', line 43 def exec(controller) new_controller = catch :pass_controller do controller.execute! nil end exec new_controller if new_controller end |
+ (Object) mixin(mod)
Include another module into all CallController classes
55 56 57 |
# File 'lib/adhearsion/call_controller.rb', line 55 def mixin(mod) include mod end |
Instance Method Details
- (Object) answer(*args)
Answer the call
168 169 170 171 |
# File 'lib/adhearsion/call_controller.rb', line 168 def answer(*args) block_until_resumed call.answer(*args) end |
- (Object) hangup(headers = nil)
Hangup the call, and execute after_call callbacks
140 141 142 143 144 |
# File 'lib/adhearsion/call_controller.rb', line 140 def hangup(headers = nil) block_until_resumed hangup_response = call.hangup headers after_call unless hangup_response == false end |
- (Object) invoke(controller_class, metadata = nil)
Invoke another controller class within this controller, returning to this context on completion.
106 107 108 109 |
# File 'lib/adhearsion/call_controller.rb', line 106 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).
212 213 214 215 216 217 218 219 220 221 222 |
# File 'lib/adhearsion/call_controller.rb', line 212 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) mute(*args)
Mute the call
188 189 190 191 |
# File 'lib/adhearsion/call_controller.rb', line 188 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.
117 118 119 |
# File 'lib/adhearsion/call_controller.rb', line 117 def pass(controller_class, = nil) throw :pass_controller, controller_class.new(call, ) end |
- (Object) reject(*args)
Reject the call
178 179 180 181 |
# File 'lib/adhearsion/call_controller.rb', line 178 def reject(*args) block_until_resumed call.reject(*args) end |
- (Object) run
Invoke the block supplied when creating the controller
96 97 98 |
# File 'lib/adhearsion/call_controller.rb', line 96 def run instance_exec(&block) if block end |
- (Object) unmute(*args)
Unmute the call
198 199 200 201 |
# File 'lib/adhearsion/call_controller.rb', line 198 def unmute(*args) block_until_resumed call.unmute(*args) end |