这里的Twilio新人。我通过calls.create:
呼叫用户client.calls.create(options)
.then((call) => {
console.log('Call ID='+call.sid);
response.send('Dialing User at '+userPhone);
})
然后拨打第二个人并通过dial.number连接呼叫:
app.post('/outbound/:calleeNumber', function(request, response) {
const calleeNumber = request.params.calleeNumber;
const twimlResponse = new VoiceResponse();
twimlResponse.say('Thank you for calling. Please hold while we connect you.',
{ voice: 'woman' });
const dial = twimlResponse.dial({action:'http://' + request.headers.host + '/calleeendscall'});
dial.number({url:'http://' + request.headers.host + '/screencall'}, calleeNumber);
response.send(twimlResponse.toString());
});
如果第二个被叫方先挂断,我可以在" action"指定的网址内向第一个被叫方播放消息。 .dial的参数。但是,如果FIRST被叫方先挂断,则呼叫立即结束。有没有什么方法可以在呼叫断开之前赶上第二个被叫方并播放一个"它们挂断了,谢谢你拨打电话"消息?