Skip to main content
The First Step
Sep 17, 2020 9:44 AM UTC
Question

Subscription receives multiple endpoint calls with setup code

Hi, I'm doing a nodejs app, that creates a subscription. Once the subscription is set, I make a call and I start receiving multiple calls with code: "Setup". ¿Is this correct? Do you know what these code status means (Setup code is that the client is calling?)


Thanks

6 replies

PhongVu
Community Manager
Community Manager
Sep 17, 2020 3:42 PM UTC

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.

The First Step
Sep 18, 2020 8:29 AM UTC

Thanks you! I'm going to take a look on that!

The First Step
Jul 16, 2025 11:29 PM UTC

Hey ​@PhongVu 
This blog was very helpful.

Thank you!

The First Step
Jul 17, 2025 2:58 AM UTC

​@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.

The First Step
Jul 17, 2025 2:10 PM UTC

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');

}

PhongVu
Community Manager
Community Manager
Jul 29, 2025 2:20 PM UTC

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.