Twilio Recording Fetch returns not found

I’m trying to fetch a recording resource in google apps script with UrlFetchApp to use as an attachment in an email but keep getting the following error The requested resource /2010-04-01/Accounts/ACxxxxxxxxx/Recordings/RExxxxxxxxx was not found.

Whats intresting is that when I hardcode the url into the function it works, but when the url is passed in as a parameter it gets this error. I logged the url to the spreadsheet before the error and the url comes through.

Any help is appreciated.

function doGet(e){

var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('vm');

try{
var p = e.parameter;
var from = p.from;
var received = p.received;
var u = p.recording;
var url = String(u);
var length = p.length;
var email = p.email;
var ext = p.ext;
var fromDashes = from.slice(-10,-7)+"-"+from.slice(-7,-4)+"-"+from.slice(-4);
var receivedDashes = received.slice(-10,-7)+"-"+received.slice(-7,-4)+"-"+received.slice(-4);

  //time script ran
const d = new Date();
const t = d.toLocaleString();
const split = t.split(',');
const time = split[1];

var curr_date = d.getDate();
var curr_month = d.getMonth() + 1; //Months are zero based
var curr_year = d.getFullYear();

var theDate = curr_month + "-" + curr_date + "-" + curr_year;

ss.appendRow([theDate,time,receivedDashes,fromDashes,length,ext,email,url]); // this logs the full url

var fileName = "VM_" + fromDashes + "_" + theDate

var blob = UrlFetchApp.fetch(url).getBlob().getBytes();

blob = Utilities.newBlob(blob, 'audio/x-wav', fileName);

var message = {
  to: email,
  subject: "[New] Voicemail for "+ext,
  htmlBody: "<h3>You received a new voicemail from: " + fromDashes + "</h3>For: "+ext+"<br><br>Recieved at: "+receivedDashes+"<br>Length: "+length+"<br><br><a href=" + url + ">Listen to Voicemail</a>", //<br><br><a href=" + callBackUrl + ">Call "+fromDashes+"</a>",
  attachments: [blob]
};

MailApp.sendEmail(message);

}
catch(e){
  ss.appendRow([e])
}
}