Skip to content

Instantly share code, notes, and snippets.

@shalzz
Last active June 4, 2022 06:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shalzz/3046edd4d2dca123875ac84853f1cbc1 to your computer and use it in GitHub Desktop.
Save shalzz/3046edd4d2dca123875ac84853f1cbc1 to your computer and use it in GitHub Desktop.
exports.handler = function(context, event, callback) {
const twiml = new Twilio.twiml.VoiceResponse();
if (event.DialCallStatus === 'completed' || event.DialCallStatus === 'answered') {
twiml.hangup();
} else {
twiml.redirect({
method: 'POST'
}, "https://twimlets.com/voicemail?Email=user%40example.com&Message=Please%20leave%20a%20message%20at%20the%20beep&Transcribe=false");
}
callback(null, twiml);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment