已检索Answered_By回复为空
问题描述:
我正在关注今年推出的API应答机检测测试版功能Twilio。我将MachineDetection字段设置为Enable
,并将MachineDetectionTimeout设置为5秒。当我提出使用request-promise
包中的Node.js要求,下面的输出被返回作为JSON体对象:已检索Answered_By回复为空
{"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
instead`的4个值中的一个的请求(Twilio-API documentation):
- MACHINE_START
- 人
- 传真
- UNK已知
我做错了什么?我的申请路线如下图所示:
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);
});
});
我甚至在我的bash上试过卷曲路线,想出了完全相同的结果。
答
Twilio开发人员在这里传播。
当你做出request to start a call,因为你是在这个例子做,API将成功应对,让你知道该呼叫已经启动。在这个阶段,通话甚至可能不响,所以你还不知道答案机检测的结果。
取而代之,当呼叫连接并且Twilio已经计算出是否是机器或其他方式,或者应答机检测超时时,您将得到AnsweredBy
的结果。您将获得Twilio通过您在请求中设置的URL发送给您的应用程序的AnsweredBy
result in the webhook。在这个阶段,您可以决定如何处理此次通话。
让我知道这是否有帮助。
因此,如果入站不回暖,将它仍然运行去路?或者,我是否已将MachineDetection值设置为DetectMessageEnd以便出站路由运行? – akiespenc
不确定你在这里入站和出站的含义。只有在应答机检测到人或机器或超时后才会调用您的webhook。 – philnash