Skip to content

Twilio Live Call Routing - Add the voicemail download - #155

Merged
armiiller merged 4 commits into
mainfrom
feat/twilio-voicemail-active-storage
Sep 15, 2026
Merged

armiiller merged 4 commits into
mainfrom
feat/twilio-voicemail-active-storage

Conversation

@armiiller

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

It introduces a server-side fetch of a request-provided URL (SSRF/credential leak risk) and blob URL generation that is likely to fail without an explicit host, plus missing test coverage for the dropped/voicemail flow.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds voicemail recording download support to the Twilio Live Call Routing integration so voicemail links/emails can reference a stored (ActiveStorage) recording instead of the raw Twilio recording URL.

Changes:

  • Download the Twilio voicemail recording server-side and attach it to the alert as an ActiveStorage blob.
  • Store the blob URL in alert additional data (Voicemail link) and use it when emailing voicemail recordings.
  • Add private helper methods to fetch and upload recordings with fallback to the raw Twilio URL on failure.
File summaries
File Description
app/models/pager_tree/integrations/live_call_routing/twilio/v3.rb Downloads/uploads voicemail recordings to ActiveStorage and updates alert metadata + outbound email recording URL to use the stored blob.
Review details
  • Files reviewed: 4/5 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +497 to +502
def _fetch_voicemail_recording(recording_url)
response = HTTParty.get(recording_url, basic_auth: {username: option_api_key, password: option_api_secret}, timeout: 10)
raise "HTTP #{response.code}" unless response.success?

response
end
adapter_alert.attachments.attach(blob)
adapter_alert.logs.create!(message: "Voicemail recording downloaded and attached.")

Rails.application.routes.url_helpers.rails_blob_url(blob)
Comment on lines +388 to +392
blob_url = _download_voicemail_recording(recording_url)

adapter_alert.additional_data.push(AdditionalDatum.new(format: "link", label: "Voicemail", value: blob_url).to_h)
adapter_alert.save!

@armiiller
armiiller merged commit 4e737ce into main Sep 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants