We are running some CI tests, and those tests are being done one by one very quickly without making some delays between all of them.
So what happened is that we are answering a call and quickly hanging it up (only after SessionState becomes ESTABLISHED). This is part of the test being done on CI.
But then on FreeSWITCH side, the hang up is received so fast, that it still didn't bridge between both call legs and didn't consider the call as "answered" yet.
Combining the above with using a call center on module, instead of hanging the call, FreeSWITCH detects that the call got disconnected before a complete bridge, so FreeSWITCH is returning the caller to the queue instead of disconnecting the call.
And it is all matter of ~40 msec between the ACK and the BYE.
So if I could detect when ACK is being returned, and only then send the hang up command it would solve this race condition.
I would suggest it as an enhancement to be able to listen on the ACK messages (onAck) using SIP.js API, as I think it is a better way to really know if the call got really answered.