* @throws SipException if implementation cannot send the ACK Request for any other reason
*
*/
private void sendAck(Request request, boolean throwIOExceptionAsSipException)
throws SipException {
SIPRequest ackRequest = (SIPRequest) request;
if (sipStack.isLoggingEnabled())
sipStack.getStackLogger().logDebug("sendAck" + this);
if (!ackRequest.getMethod().equals(Request.ACK))
throw new SipException("Bad request method -- should be ACK");
if (this.getState() == null || this.getState().getValue() == EARLY_STATE) {
if (sipStack.isLoggingEnabled()) {
sipStack.getStackLogger().logError(
"Bad Dialog State for " + this + " dialogID = " + this.getDialogId());
}
throw new SipException("Bad dialog state " + this.getState());
}
if (!this.getCallId().getCallId().equals(((SIPRequest) request).getCallId().getCallId())) {
if (sipStack.isLoggingEnabled()) {
sipStack.getStackLogger().logError("CallID " + this.getCallId());
sipStack.getStackLogger().logError(
"RequestCallID = " + ackRequest.getCallId().getCallId());
sipStack.getStackLogger().logError("dialog = " + this);
}
throw new SipException("Bad call ID in request");
}
try {
if (sipStack.isLoggingEnabled()) {
sipStack.getStackLogger().logDebug(
"setting from tag For outgoing ACK= " + this.getLocalTag());
sipStack.getStackLogger().logDebug(
"setting To tag for outgoing ACK = " + this.getRemoteTag());
sipStack.getStackLogger().logDebug("ack = " + ackRequest);
}
if (this.getLocalTag() != null)
ackRequest.getFrom().setTag(this.getLocalTag());
if (this.getRemoteTag() != null)
ackRequest.getTo().setTag(this.getRemoteTag());
} catch (ParseException ex) {
throw new SipException(ex.getMessage());
}
Hop hop = sipStack.getNextHop(ackRequest);