CSeqHeader cseq = (CSeqHeader) response.getHeader(CSeqHeader.NAME);
logger.info("Response received : Status Code = " + response.getStatusCode() + " " + cseq);
logger.info("Response = " + response + " class=" + response.getClass());
Dialog dialog = responseReceivedEvent.getDialog();
TestHarness.assertNotNull(dialog);
if (tid != null)
logger.info("transaction state is " + tid.getState());
else
logger.info("transaction = " + tid);
logger.info("Dialog = " + dialog);
logger.info("Dialog state is " + dialog.getState());
try {
if (response.getStatusCode() == Response.OK) {
if (cseq.getMethod().equals(Request.INVITE)) {
TestHarness.assertEquals(DialogState.CONFIRMED, dialog.getState());
Request ackRequest = dialog.createAck(cseq.getSeqNumber());
TestHarness.assertNotNull(ackRequest.getHeader(MaxForwardsHeader.NAME));
if (dialog == this.ackedDialog) {
dialog.sendAck(ackRequest);
return;
}
this.forkedDialogs.add(dialog);
logger.info("Sending ACK");
dialog.sendAck(ackRequest);
TestHarness.assertTrue("Dialog state should be CONFIRMED",
dialog.getState() == DialogState.CONFIRMED);
this.ackedDialog = dialog;
} else {
logger.info("Response method = " + cseq.getMethod());
}