I was setting up Status Callbacks for calls in nodeJS. I've set the 'CALL STATUS CHANGES' in phone number configuration to do a POST request to my node. But twilio seems to be sending call status completed for all calls no matter is the answer was 'busy', 'unanswered' or 'completed'.
Here's my node code for displaying call status sent by Twilio:
app.post("/status", (req, res) => {
res.sendStatus(200);
console.log(req.body);
});
Output for a busy call:
{
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'
}