Advertisement
Guest User

Untitled

a guest
Apr 4th, 2020
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const voice = async (req, res) => {
  2.   const user = await Requester.findOne({
  3.     where: {
  4.       phone_number: req.body.From
  5.     }
  6.   })
  7.  
  8.   const twiml = new VoiceResponse();
  9.  
  10.   if (user !== null) {
  11.     twiml.say({voice: 'Polly.Joanna'}, 'Twoja prosba zostala przyjeta, wolontariusz za chwile do ciebie oddzwoni!');
  12.   } else {
  13.     twiml.say({voice: 'Polly.Joanna'}, 'Podaj swoj adres');
  14.     twiml.record({
  15.       timeout: 10,
  16.       maxLength: 30,
  17.       transcribe: true,
  18.       transcribe_callback: '/twilio/transcribe',
  19.     })
  20.     twiml.hangup()
  21.   }
  22.  
  23.   res.type('text/xml');
  24.   res.send(twiml.toString());
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement