sipsorcery
sipsorcery copied to clipboard
There seems to be no way of handling a received SIPNonInviteTransaction asynchronously
I receive a SIP (non-INVITE) request via SIPTransport.SIPTransportRequestReceived
and would like to use SIPNonInviteTransaction
but handle the transaction asynchronously. This leads into the problem that duplicates are not detected reliably since SIPNonInviteTransaction
will not be put into the transaction list of the transaction engine until SIPNonInviteTransaction.SendResponse()
is called.
Inside the constructor of SIPNonInviteTransaction
the following code lines could be found:
// This transaction type can be used to represent two different things:
// - a tx that the application wants to use to send a request reliably,
// - a tx for a request that has been received from a remote end point and that duplicates need
// to be detected for.
// This block is for the second case. The tx request has been received and the tx engine
// needs to be signalled that it is now at the request processing stage.
base.UpdateTransactionState(SIPTransactionStatesEnum.Proceeding);
But just setting the transaction state is not sufficient here to offer what the code comment promises, "a tx for a request that has been received from a remote end point and that duplicates need to be detected for".
Proposed solutions:
- Add
_sipTransport.AddTransaction(this);
inside the constructor ofSIPNonInviteTransaction
, right after the code line above. - or offer
void SetPending() -> _sipTransport.AddTransaction(this);
- or split
SIPNonInviteTransaction
intoUASNonInviteTransaction
andUACNonInviteTransaction
, andUASNonInviteTransaction
will have_sipTransport.AddTransaction(this);
inside the constructor.