Session does not trigger ended or failed event when receiving BYE message
Jssip version: 3.10.0
When the server sends a BYE message after a race condition between INVITE, CANCEL, and 200 OK, the JsSIP session does not fire the ended or failed event. As a result, my application UI stays in an incorrect state (it still thinks the call is ongoing).
Flow: Server sends INVITE to JsSIP client.
JsSIP responds with 200 OK.
At almost the same time, the server sends a CANCEL.
JsSIP responds with 200 OK for the CANCEL request.
Server sends ACK.
Server then sends a BYE.
JsSIP responds with: SIP/2.0 481 Call/Transaction Does Not Exist
After sending 481 Call/Transaction Does Not Exist, the JsSIP session does not fire ended or failed events.
Is there any event or callback that can be used to detect when: The server sends a BYE message, or JsSIP sends a 481 Call/Transaction Does Not Exist response? If not, what would be the best way to handle this edge case gracefully?