It seems that I need to built a B2BUA. but a Simple proxy server.
There are some methods needed to be Override first of all.
1.doInvite(). This method can process invite request.And if invited user has already been in call session,send 182(queued) response, and transmit the Invite request to destination;else,send 200(OK),and transmit the Invite request to destination.
2.doRegister().This method should be able to do User Authentication.As http://tech-invite.com/Ti-sip-identity.html#fig2
...
there might be other methods needed.