Skip to main content
Question

Subscription receives multiple endpoint calls with setup code

  • September 17, 2020
  • 6 replies
  • 520 views

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
Forum|alt.badge.img
  • Community Manager
  • September 17, 2020

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!


  • Participating Frequently
  • July 16, 2025

Hey ​@PhongVu 
This blog was very helpful.

Thank you!


  • Participating Frequently
  • July 17, 2025

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


  • Participating Frequently
  • July 17, 2025

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
Forum|alt.badge.img
  • Community Manager
  • July 29, 2025

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.