}
public void handleRequest(SipRequest request) throws IOException, SipException
{
if (request.getCSeq().getNumber() <= _remoteCSeq && !request.isAck() && !request.isCancel())
throw new SipException(SipServletResponse.SC_SERVER_INTERNAL_ERROR, "Out of order request");
_remoteCSeq = request.getCSeq().getNumber();
if (request.isInvite())
setRemoteTarget(request);
if (request.isAck())
{
ServerInvite invite = getServerInvite(_remoteCSeq, false);
if (invite == null)
{
if (Log.isDebugEnabled())
Log.debug("dropping ACK without INVITE context");
request.setHandled(true);
}
else
{
if (invite.getResponse() != null)
invite.ack();
else // retrans or late
request.setHandled(true);
}
}
else if (request.isPrack())
{
RAck rack = null;
try
{
rack = request.getRAck();
}
catch (Exception e)
{
throw new SipException(SipServletResponse.SC_BAD_REQUEST, e.getMessage());
}
ServerInvite invite = getServerInvite(rack.getCSeq(), false);
if (invite == null || !invite.prack(rack.getRSeq()))
throw new SipException(SipServletResponse.SC_CALL_LEG_DONE, "No matching 100 rel for RAck " + rack);
}
}