challenged = true;
ChallengeTest.assertNull(requestEvent.getServerTransaction());
Response challenge = protocolObjects.messageFactory
.createResponse(401, request);
ToHeader toHeader = (ToHeader) challenge
.getHeader(ToHeader.NAME);
toHeader.setTag("challenge");
sipProvider.sendResponse(challenge); // dont create ST
return;
}
logger.info("shootme: got an Invite sending OK");
// logger.info("shootme: " + request);
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());
if (st.getDialog().getApplicationData() == null) {
st.getDialog().setApplicationData(new ApplicationData());
}
} else {
// If Server transaction is not null, then
// this is a re-invite.
logger.info("This is a RE INVITE ");
ChallengeTest.assertSame("Dialog mismatch ", st.getDialog(),
this.dialog);
}
// Thread.sleep(5000);
logger.info("got a server tranasaction " + st);
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);
logger.info("TxState after sendResponse = " + st.getState());
} catch (Exception ex) {