我遵循回答机检测Beta特性Twilio最近推出的API今年。我将MachineDetection字段设置为Enable
,并将MachineDetectionTimeout设置为5秒。当我使用request-promise
包在Node.JS中发出请求时,以下输出将作为JSON对象返回:
{"sid": "MYSID",
"to": "+1845555555",
"to_formatted": "(845) 555-5555",
"from": "+18569972628", "from_formatted": "(856) 997-2628",
"phone_number_sid": null,
"status": "queued"
"start_time": null,
"end_time": null,
"duration": null,
"price": null,
"price_unit": "USD",
"direction": "outbound-api",
"answered_by": null,
"api_version": "2010-04-01",
"annotation": null,
"forwarded_from": null,
"group_sid": null, "caller_name": null,
"uri": "/2010-04-01/Accounts/mySIDaccount/Calls/C
A303d158baf885d4480284d4529ce49a8.json",
"subresource_uris":
{"notifications": "/2010-04\
01/Accounts/myaccount/Calls/\
CA303d158baf885d448028\
4d4529ce49a8/Notifications.json",
"recordings": "/2010-04 \
01/Accounts/myaccount/Calls/\
CA303d158baf885d4480284d4529ce49a8/Recordings.json"}
}
answered_by
值是null
,而不是指定从请求(Twilio文档)返回的4个值中的一个
我做错了什么吗?我的申请路线如下所示:
var request = require('request-promise');
request.post({url: 'https://api.twilio.com/2010-04-01/Accounts/'+
config.accountSid+"/Calls.json",
form: {To: phoneNumber,
From: config.twilioNumber,
MachineDetection: 'Enable',
MachineDetectionTimout: 5,
Url: url},
auth: {user: config.accountSid,
pass: config.authToken
},
timeout: 10000
}).then(function(parsedBody){
console.log('\n\n\n\n'+parsedBody+'\n\n\n\n');
response.send({message: 'Transferring...'});
}).catch(function(parsedBody){
console.log(parsedBody);
response.status(500).send(parsedBody);
});
});
我甚至在我的狂欢中尝试了卷曲路线,并得到了完全相同的结果。
发布于 2017-08-18 08:27:43
https://stackoverflow.com/questions/45740616
复制相似问题