I am trying to use Jain Sip to create a sip user agent, which can receive INVITE/ ACK/ BYE, and send back the response with SDP if necessary.
It can receive INVITE, send OK response, receive ACK and then do RTP packet transport. But when it receives BYE from the other side, a 481 will be thrown by Jain Sip itself.
I was sending response statelessly by using SipProvider.sendResponse(response). And it turns out if I switch to stateful (getNewServerTransaction from incoming request, then use SipServerTransaction.sendResponse), everything works. So I am wondering what is the difference between them? Is there anyway I can do this statelessly?
Basically when stateful the JAIN-SIP stack allocates its own resources to run the SIP state machines for transactions and dialogs. As you can imagine if you do it only partially for a call it will get out of hand. My guess is you have automatic dialog support turned on and you are mixing stateful and stateless mode in some way. If you want to go stateless make sure there is no auto dialog. Best way to debug is to see DEBUG logs and code.