RestComm / Restcomm-Connect

The Open Source Cloud Communications Platform
http://www.restcomm.com/
GNU Affero General Public License v3.0
245 stars 215 forks source link

JAIN SIP HA CORE support for UAS CANCEL transaction #3013

Open gidxl03 opened 3 years ago

gidxl03 commented 3 years ago

/kind bug

What happened: CANCEL request is received at a newly recovered stack and is not presented to the application because the corresponding INVITE transaction is not found. The UAC received a 481 response to the CANCEL request.

What you expected to happen: The transaction-to-be-cancelled is recovered, associated with the new CANCEL transaction and presented to the application.

How to reproduce it (as minimally and precisely as possible): UAC sends INVITE to HA-stack HA-stack sends provisional response. HA-stack is stopped. If no other stack exits in the cluster then it is restarted. UAC waits for first provisional response and sends CANCEL CANCEL is received at new stack

Anything else we need to know?: Simplest solution appears to be for ClusteredSipStackImpl to override findCancelTransaction(SIPRequest cancelRequest, boolean isServer), derive the ID of the server transaction to be cancelled (see SIPMessage.getTransactionId() Line 922 ), trigger HA recovery by invoking ClusteredSipStackImpl .findTransaction(txnId, isServer)

Environment: Reproducible in a Unit Test that I can provide in a PR used to reproduce the issue