10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'app/operations/twilio/rails/phone/twiml/after_operation.rb', line 10
def execute
unless after.hangup?
next_response = phone_call.responses.build(prompt_handle: after.prompt)
next_response.save!
end
twiml_response = Twilio::TwiML::VoiceResponse.new do |twiml|
add_messages(twiml, message_set: after.messages, response: next_response)
if after.hangup?
twiml.hangup
else
twiml.redirect(::Twilio::Rails::Engine.routes.url_helpers.phone_prompt_path(
format: :xml,
tree_name: tree.name,
response_id: next_response.id
))
end
end
Twilio::Rails.config.logger.info("after_twiml: #{twiml_response.to_s}")
twiml_response.to_s
end
|