Class: SignalWire::Relay::StandaloneCollectAction
- Defined in:
- lib/signalwire/relay/action.rb
Overview
Handle for standalone calling.collect (without play).
Instance Attribute Summary
Attributes inherited from Action
#call, #completed, #control_id, #result
Instance Method Summary collapse
- #_check_event(event) ⇒ Object
-
#initialize(call, control_id) ⇒ StandaloneCollectAction
constructor
A new instance of StandaloneCollectAction.
- #start_input_timers ⇒ Object
- #stop ⇒ Object
Methods inherited from Action
#_resolve, #_set_on_completed, #done?, #on_completed, #wait
Constructor Details
#initialize(call, control_id) ⇒ StandaloneCollectAction
Returns a new instance of StandaloneCollectAction.
200 201 202 203 |
# File 'lib/signalwire/relay/action.rb', line 200 def initialize(call, control_id) super(call, control_id, EVENT_CALL_COLLECT, %w[finished error no_input no_match]) end |
Instance Method Details
#_check_event(event) ⇒ Object
205 206 207 208 209 210 211 212 213 |
# File 'lib/signalwire/relay/action.rb', line 205 def _check_event(event) return unless event.event_type == EVENT_CALL_COLLECT result_data = event.params['result'] || {} state = event.params['state'] || '' if (!result_data.empty? || @terminal_states.include?(state)) && !@completed _resolve(event) end end |
#start_input_timers ⇒ Object
219 220 221 |
# File 'lib/signalwire/relay/action.rb', line 219 def start_input_timers @call._execute('collect.start_input_timers', { 'control_id' => @control_id }) end |
#stop ⇒ Object
215 216 217 |
# File 'lib/signalwire/relay/action.rb', line 215 def stop @call._execute('collect.stop', { 'control_id' => @control_id }) end |