I guess you referred to the telephony session event notification. If so, please read this blog. Scroll to the "Call statuses and how to use them" section for explanation about multiple events with the same status.
Thanks you! I'm going to take a look on that!
Hey @PhongVu
This blog was very helpful.
Thank you!
@PhongVu
Any idea why I would be getting multiple web-hook events with status answered?
And how to differentiate between them to get the real answered call.
It looks like the first answered status comes in during the dialing stage, well prior to the agent answering the phone even prior to the proceeding status. And the second one comes when the phone is actually answered.
this logic seems to do the trick for determining the real answered call
const hasExtension = parties[0].extensionId ? true : false;
const callDirection = parties[0].from.extensionId ? "outbound" : "inbound";
if (callDirection === 'outbound' && !hasExtension || callDirection === 'inbound' && hasExtension) {
console.log('\nCall answered');
}
this logic seems to do the trick for determining the real answered call
const hasExtension = parties[0].extensionId ? true : false;
const callDirection = parties[0].from.extensionId ? "outbound" : "inbound";
if (callDirection === 'outbound' && !hasExtension || callDirection === 'inbound' && hasExtension) {
console.log('\nCall answered');
}
Remember that the system also fires events when a call is recorded or paused or resume. Those event also has the call status=”Answered”. You just need to detect if the event contains the recordings object or not.