Ram
Ram

Reputation: 327

Automated Recorded response to inbound call

I want to respond to an inbound voice call with a prerecorded message. Can this be done without using the Twilio API - ie similar to https://www.twilio.com/code-exchange/basic-voice-auto-response but my recording rather than a "robot" voice?

Upvotes: 0

Views: 44

Answers (1)

tcbeaton
tcbeaton

Reputation: 85

Here's the script to be placed in the "Functions and Assets" section of your console:

exports.handler = function (context, event, callback) {
  const twiml = new Twilio.twiml.VoiceResponse();
  twiml.play('https://filesamples.com/samples/audio/mp3/sample3.mp3');
  callback(null, twiml);
};

Three options to host the file:

  1. You can host it on a web server and replace the URL with the one to your file.

You could store the audio file on Twilio's servers.

  1. Upload your file in "Functions and Assets" (click [Add+] > Upload File). Once uploaded, you will get the URL to put in the script by clicking "Copy URL."
  2. Use "Assets (Classic)" to upload the file.

Upvotes: 2

Related Questions