Javascript Twilio Node.js API-使用';拨号';转接电话
我在使用Twilio Node.js库使“拨号”工作以转发呼叫时遇到一些问题。此库的文档很少,使用“拨号”的唯一示例是电话会议:Javascript Twilio Node.js API-使用';拨号';转接电话,javascript,node.js,twilio,twilio-api,Javascript,Node.js,Twilio,Twilio Api,我在使用Twilio Node.js库使“拨号”工作以转发呼叫时遇到一些问题。此库的文档很少,使用“拨号”的唯一示例是电话会议: .dial({ action:'http://example.com/something.php' }, function(node) { node.conference('waitingRoom', { beep:'false' }); }); 通过这种
.dial({
action:'http://example.com/something.php'
}, function(node) {
node.conference('waitingRoom', {
beep:'false'
});
});
通过这种方式,我能够通过以下方式生成与中类似的XML:
.dial('number', {
action: 'http://url'
hangupOnStar: true
}, (err, respData) => {
console.log(err);
console.log(respData);
})
这会导致呼叫立即转发到操作
url
我还尝试在他们的文档中使用第三个示例,示例3:从Twilio客户端拨打电话号码
,该示例生成以下XML:
<Response>
<Dial hangupOnStar="true" callerId="number">
<Number>number to call</Number>
</Dial>
</Response>
我测试的这些数字都是有效的数字,我也尝试过不同的格式。有什么办法让它工作吗?非常感谢您的帮助。要转接电话,流量可以是
您希望将调用转发到的
位置。这将桥接传入呼叫,即将其转发到您所需的号码app.get("/forwardToMyMobile",function(i_Req,o_Res)
{
var ivrTwilRes = new twilio.TwimlResponse();
var numberToForwardCallTo=i_Req.query.toNumber;
/*In case you want to pass this number as querystring ,
else if its a fixed number you can just hardcode it */
ivrTwilRes.dial({callerId:'+44xxxxxxxx'},
function()
{
this.number(numberToForwardCallTo);
}
)
.record();
o_Res.set('Content-Type','text/xml');
o_Res.send(ivrTwilRes.toString());
});
当您的Twilio号码现在收到呼叫时,它将通过网络钩住nodejs服务器应用程序上的“/forwardToMyMobile”,并指示Twilio转接呼叫 要转发呼叫,流可以是
您希望将调用转发到的
位置。这将桥接传入呼叫,即将其转发到您所需的号码app.get("/forwardToMyMobile",function(i_Req,o_Res)
{
var ivrTwilRes = new twilio.TwimlResponse();
var numberToForwardCallTo=i_Req.query.toNumber;
/*In case you want to pass this number as querystring ,
else if its a fixed number you can just hardcode it */
ivrTwilRes.dial({callerId:'+44xxxxxxxx'},
function()
{
this.number(numberToForwardCallTo);
}
)
.record();
o_Res.set('Content-Type','text/xml');
o_Res.send(ivrTwilRes.toString());
});
当您的Twilio号码现在收到呼叫时,它将通过网络钩住nodejs服务器应用程序上的“/forwardToMyMobile”,并指示Twilio转接呼叫