Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- exports.handler = function(context, event, callback) {
- // List all blocked phone numbers in quotes and E.164 formatting, separated by a comma
- let numberBlock = event.block || [ "+xxxxxxx", "+xxxxxxx" ];
- let twiml = new Twilio.twiml.VoiceResponse();
- let blocked = true;
- if (numberBlock.length > 0) {
- if (numberBlock.indexOf(event.From) === -1) {
- blocked = false;
- }
- }
- if (blocked) {
- twiml.reject();
- callback(null, twiml);
- }
- else {
- const response = new Twilio.Response();
- // Set the status code to 200
- response.setStatusCode(200);
- return callback(null, response);
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement