Twilio Live Call Routing - Add the voicemail download - #155
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 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! | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.