class DvelpFlow::Channels::Voice
Public Instance Methods
communicate()
click to toggle source
# File lib/dvelp_flow/channels/voice.rb, line 6 def communicate response.final? ? reply_and_connect : reply_and_gather end
Private Instance Methods
enqueue_params()
click to toggle source
# File lib/dvelp_flow/channels/voice.rb, line 24 def enqueue_params { workflow_sid: params[:workflow_sid] } end
enqueue_task()
click to toggle source
# File lib/dvelp_flow/channels/voice.rb, line 18 def enqueue_task voice_response.enqueue(enqueue_params) do |e| e.task task_attributes end.to_s end
gather_attrs()
click to toggle source
# File lib/dvelp_flow/channels/voice.rb, line 45 def gather_attrs { action: params[:gathers_url], hints: ENV['ASR_HINTS'], input: 'speech', language: ENV['ASR_LANGUAGE'], method: 'POST', profanity_filter: true, speech_timeout: 'auto' } end
reply_and_connect()
click to toggle source
# File lib/dvelp_flow/channels/voice.rb, line 12 def reply_and_connect voice_response.say(content) if content.present? enqueue_task end
reply_and_gather()
click to toggle source
# File lib/dvelp_flow/channels/voice.rb, line 34 def reply_and_gather ::Twilio::TwiML::VoiceResponse.new do |r| r.gather(gather_attrs) do |g| g.say content g.pause length: ENV.fetch('TWILIO_GATHER_PAUSE', 0).to_i end r.redirect(params[:gathers_repeat_url], method: :post) end.to_s end
task_attributes()
click to toggle source
# File lib/dvelp_flow/channels/voice.rb, line 30 def task_attributes {} end
voice_response()
click to toggle source
# File lib/dvelp_flow/channels/voice.rb, line 57 def voice_response @voice_response ||= Twilio::TwiML::VoiceResponse.new end