I am new to using twilio. I am using twilio to make calls from browser to phone. In the browser side I am using twiml Device to connect to the call.
Twilio.Device.connect({ phoneNumber: phoneNumber, userId: id });
In the nodejs server side I am using this code.
import twilio from 'twilio';
const VoiceResponse = twilio.twiml.VoiceResponse;
let phoneNumber = req.body.phoneNumber;
let callerId = user.phoneNumber;
let twiml = new VoiceResponse();
let dial = twiml.dial({ callerId: callerId });
dial.number(phoneNumber);
res.send(twiml.toString());
If the user in the other end hasn't answered the call, I need to send a recording by pressing a button as a voicemail to that user.
<button>Send Voicemail</button>
How can I achieve this?