ServerTransaction serverTransaction) {
SipProvider sipProvider = (SipProvider) requestEvent.getSource();
Request request = requestEvent.getRequest();
logger.info("Got an INVITE " + request);
try {
Response response = protocolObjects.messageFactory.createResponse(180, request);
ToHeader toHeader = (ToHeader) response.getHeader(ToHeader.NAME);
toHeader.setTag("4321");
Address address = protocolObjects.addressFactory.createAddress("Shootme <sip:"
+ myAddress + ":" + myPort + ">");
ContactHeader contactHeader = protocolObjects.headerFactory
.createContactHeader(address);
response.addHeader(contactHeader);
ServerTransaction st = requestEvent.getServerTransaction();
if (st == null) {
st = sipProvider.getNewServerTransaction(request);
logger.info("Server transaction created!" + request);
logger.info("Dialog = " + st.getDialog());
}
byte[] content = request.getRawContent();
if (content != null) {
logger.info(" content = " + new String(content));
ContentTypeHeader contentTypeHeader = protocolObjects.headerFactory
.createContentTypeHeader("application", "sdp");
logger.info("response = " + response);
response.setContent(content, contentTypeHeader);
}
dialog = st.getDialog();
if (dialog != null) {
logger.info("Dialog " + dialog);
logger.info("Dialog state " + dialog.getState());
}
st.sendResponse(response);
response = protocolObjects.messageFactory.createResponse(200, request);
toHeader = (ToHeader) response.getHeader(ToHeader.NAME);
toHeader.setTag("4321");
// Application is supposed to set.
response.addHeader(contactHeader);
st.sendResponse(response);
reSendSt = st;
reSendResponse = response;
logger.info("TxState after sendResponse = " + st.getState());
this.inviteTid = st;