我很难用nodejs创建我的TWIML文件。我正在创建出站调用,它们使用的是静态XML文件或twiml bin,而不是我的端点。
你知道哪里出问题了吗?
app.post('/twiml-generator', function(req, res){
var name = "billy";
//Create TwiML response
var twiml = new twilio.TwimlResponse();
twiml.say("Hello from your pals at Twilio! Have fun. Love " + name);
res.writeHead(200, {'Content-Type': 'text/xml'});
res.end(twiml.toString());
});然后当我去发起呼叫时
client.calls.create({
url: 'http://myHOSTEDsite.com/twiml-generator',//ISSUE HERE but if i use a twiml bin or static xml, it works// so my endpoint must be the issue
to: targetNumber,
from: "+14444444444", // my trail number
timeout: 12
}, function(err, call) {
console.log("call made");
//console.log(call)
}); 发布于 2017-02-19 17:48:37
而不是
res.writeHead(200, {'Content-Type': 'text/xml'});
res.end(twiml.toString());试一试
res.set('Content-Type', 'text/xml');
res.send(twiml.toString());发布于 2021-06-11 22:03:02
这是Twilio医生说的
response.type('text/xml');
response.send(twiml.toString());https://stackoverflow.com/questions/42323073
复制相似问题