Martin Dimitrov 4f7ecfa5a3
Some checks failed
Build and push image for doorman-homeassistant / docker (push) Failing after 59s
Build and push image for doorman-homeassistant / deploy-gitainer (push) Has been skipped
Build and push Doorman UI / API / docker (push) Successful in 1m34s
change order of digit press
2025-05-26 16:28:19 -07:00

40 lines
982 B
TypeScript

import VoiceResponse from 'twilio/lib/twiml/VoiceResponse';
import { InfoResponseClient } from '../../../doorman-api/src/functions/api/door/info';
export function doorOpenTwiml(config: InfoResponseClient): VoiceResponse {
const twiml = new Twilio.twiml.VoiceResponse();
// pause for some time
twiml.pause({ length: 1 });
// press digit
twiml.play({ digits: config.pressKey }); // configured in doorman what button to click and passed into this function
// play audio
twiml.play('https://buzzer-2439-prod.twil.io/buzzing_up_boosted.mp3');
// pause again
twiml.pause({ length: 1 });
// exit
twiml.hangup();
// @ts-ignore
return twiml;
}
export function dialFallbackTwiml(config: InfoResponseClient): VoiceResponse {
const twiml = new Twilio.twiml.VoiceResponse();
let dial = twiml.dial({
timeLimit: 20,
timeout: 20
});
config.fallbackNumbers.forEach(number => {
dial.number(number);
});
// @ts-ignore
return twiml;
}