9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'app/operations/twilio/rails/phone/receive_recording_operation.rb', line 9
def execute
response = phone_call.responses.find(response_id)
if phone_call.recordings.sid(params["RecordingSid"]).any?
Twilio::Rails.config.logger.tagged(self.class) { |l| l.warn("duplicate recording for response_id=#{ response.id } recording_sid=#{ params["RecordingSid"] }") }
else
recording = phone_call.recordings.build(
recording_sid: params["RecordingSid"],
url: params["RecordingUrl"],
duration: params["RecordingDuration"].presence,
)
recording.save!
response.recording = recording
response.save!
if Twilio::Rails.config.attach_recording?(recording)
Twilio::Rails::Phone::AttachRecordingJob.set(wait: 5.seconds).perform_later(recording_id: recording.id)
end
recording
end
end
|