9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'app/operations/twilio/rails/phone/update_response_operation.rb', line 9
def execute
response = phone_call.responses.find(response_id)
if params["Digits"].present?
response.digits = params["Digits"]
end
if params["TranscriptionText"].present? && params["TranscriptionStatus"] == "completed"
response.transcription = params["TranscriptionText"]
response.transcribed = true
end
if params["SpeechResult"].present?
response.transcription = params["SpeechResult"]
response.transcribed = true
end
response.save! if response.changed?
if params["RecordingSid"]
Twilio::Rails::Phone::ReceiveRecordingOperation.call(phone_call_id: phone_call.id, response_id: response.id, params: params)
response.reload end
response
end
|