Twilio发送所有呼叫的呼叫完成状态

问题描述 投票:0回答:1

我正在为nodeJS中的呼叫设置状态回调。我已经在电话号码配置中设置了“呼叫状态更改”以对我的节点发出POST请求。但是,无论应答是“忙”,“未应答”还是“已完成”,twilio似乎都为所有呼叫发送了已完成的呼叫状态。

这是我的节点代码,用于显示Twilio发送的呼叫状态:

app.post("/status", (req, res) => {
  res.sendStatus(200);
  console.log(req.body);
});

繁忙呼叫的输出:

{
   ApiVersion: '2010-04-01',
   Called: '',
   CallStatus: 'completed',
   Duration: '15',
   From: 'client:AbrasiveHannahLiberty',
   CallDuration: '15',
   Direction: 'inbound',
   Timestamp: 'Fri, 20 Mar 2020 05:43:09 +0000',
   AccountSid: 'ACxxxxxxxx',
   CallbackSource: 'call-progress-events',
   ApplicationSid: 'APxxxxxxxx',
   Caller: 'client:AbrasiveHannahLiberty',
   SequenceNumber: '0',
   To: '',
   CallSid: 'CAxxxxxxxx'
 }

node.js twilio twilio-api twilio-twiml twilio-programmable-voice
1个回答
1
投票

Twilio客户呼叫有两个呼叫分支。当Twilio客户端发出出站呼叫时,即为父分支。 Twilio自动应答该呼叫线路,因此可以访问与您的语音请求URL关联的TwiML,所有呼叫将导致呼叫完成。

一旦发出客户端呼叫,您定义的TwiML应用程序(并通过访问令牌传递给Twilio客户端)就会具有一个请求URL,该URL用于获取TwiML,因此Twilio知道如何处理该呼叫,例如,向公用交换电话网(PSTN)的子分支发出出站呼叫。

这是该请求URL中的TwiML,应使用带有数字名词的Dial动词和statusCallback URL来获取您要查找的状态。

TwiML™ Voice: Number

© www.soinside.com 2019 - 2024. All rights reserved.