【发布时间】:2018-12-23 10:06:10
【问题描述】:
我是使用 twilio 的新手。我正在使用 twilio 从浏览器拨打电话。在浏览器端,我使用 twiml Device 连接到呼叫。
Twilio.Device.connect({ phoneNumber: phoneNumber, userId: id });
在 nodejs 服务器端,我正在使用此代码。
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());
如果另一端的用户没有接听电话,我需要按一个按钮将录音作为语音邮件发送给该用户。
<button>Send Voicemail</button>
我怎样才能做到这一点?
【问题讨论】:
标签: javascript node.js twilio twilio-twiml