All checks were successful
Build and push Doorman UI / API / docker (push) Successful in 1m27s
18 lines
658 B
JavaScript
18 lines
658 B
JavaScript
/**
|
|
* Automatically open the door
|
|
*/
|
|
exports.handler = function(context, event, callback) {
|
|
let twiml = new Twilio.twiml.VoiceResponse();
|
|
|
|
let config = JSON.parse(event.config);
|
|
let configQuery = `config=${encodeURIComponent(JSON.stringify(config))}`;
|
|
|
|
let passAlong = `fingerprint=${encodeURIComponent(event.fingerprint)}&${configQuery}`;
|
|
|
|
twiml.play('https://buzzer-2439-prod.twil.io/buzzing_up_boosted.mp3');
|
|
twiml.play({ digits: config.pressKey }); // configured in doorman what button to click and passed into this function
|
|
twiml.pause({ length: 1 });
|
|
twiml.redirect(`/text-me?Method=doorman&${passAlong}`);
|
|
|
|
callback(null, twiml);
|
|
}; |