Hi there
I'm pretty new to Twilio in general. I've been trying to set up a basic phone menu system.
If the user holds the line, i.e doesn't press any digits, I want the menu system to call a different set of contacts. I've tried null and an empty string but it doesn't seem to work. How do I create a switch case for when no input is gathered?
exports.handler = function(context, event, callback) {
let twiml = new Twilio.twiml.VoiceResponse()
switch (event.Digits) {
case '1':
twiml.dial(context.sales_number)
twiml.dial().sip(context.sip_john)
break
case '2':
twiml.dial().sip(context.sip_support)
break
case null:
twiml.dial().sip(context.sip_ben)
twiml.dial().sip(context.sip_bob)
twiml.dial(context.office_number)
break
default:
twiml.gather({numDigits: 1, timeout:3})
.say('Press 1 for sales. Press 2 for support. Or hold the line to speak to one of our representatives')
}
callback(null, twiml)
}
Many thanks
Ben