Module: Punchblock::Translator::Asterisk::Component::StopByRedirect
- Included in:
- ComposedPrompt, MRCPNativePrompt, MRCPPrompt, Output
- Defined in:
- lib/punchblock/translator/asterisk/component/stop_by_redirect.rb
Instance Method Summary collapse
Instance Method Details
#execute_command(command) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/punchblock/translator/asterisk/component/stop_by_redirect.rb', line 10 def execute_command(command) return super unless command.is_a?(Punchblock::Component::Stop) if @complete command.response = ProtocolError.new.setup 'component-already-stopped', "Component #{id} is already stopped", call_id, id else command.response = stop_by_redirect Punchblock::Event::Complete::Stop.new end end |
#stop_by_redirect(complete_reason) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/punchblock/translator/asterisk/component/stop_by_redirect.rb', line 19 def stop_by_redirect(complete_reason) call.register_handler :ami, [{name: 'AsyncAGI', [:[], 'SubEvent'] => 'Start'}, {name: 'AsyncAGIStart'}] do |event| send_complete_event complete_reason end call.redirect_back true rescue ChannelGoneError ProtocolError.new.setup :item_not_found, "Could not find a call with ID #{call_id}", call_id end |