myParser = null;
} catch (ParseException ex) {
myParser = null; // let go of the parser reference.
if (sipStack.isLoggingEnabled()) {
this.sipStack.logWriter.logDebug("Rejecting message ! "
+ new String(msgBytes));
this.sipStack.logWriter.logDebug("error message "
+ ex.getMessage());
this.sipStack.logWriter.logException(ex);
}
// JvB: send a 400 response for requests (except ACK)
// Currently only UDP, @todo also other transports
String msgString = new String(msgBytes, 0, packetLength);
if (!msgString.startsWith("SIP/") && !msgString.startsWith("ACK ")) {
String badReqRes = createBadReqRes(msgString, ex);
if (badReqRes != null) {
if (sipStack.isLoggingEnabled()) {
sipStack.getLogWriter().logDebug(
"Sending automatic 400 Bad Request:");
sipStack.getLogWriter().logDebug(badReqRes);
}
try {
this.sendMessage(badReqRes.getBytes(), peerAddress,
packet.getPort(), "UDP", false);
} catch (IOException e) {
this.sipStack.logWriter.logException(e);
}
} else {
if (sipStack.isLoggingEnabled()) {
sipStack
.getLogWriter()
.logDebug(
"Could not formulate automatic 400 Bad Request");
}
}
}
return;
}
// No parse exception but null message - reject it and
// march on (or return).
// exit this message processor if the message did not parse.
if (sipMessage == null) {
if (sipStack.isLoggingEnabled()) {
this.sipStack.logWriter.logDebug("Rejecting message ! + Null message parsed.");
}
return;
}
ViaList viaList = sipMessage.getViaHeaders();
// Check for the required headers.
if (sipMessage.getFrom() == null || sipMessage.getTo() == null
|| sipMessage.getCallId() == null
|| sipMessage.getCSeq() == null
|| sipMessage.getViaHeaders() == null) {
String badmsg = new String(msgBytes);
if (sipStack.isLoggingEnabled()) {
this.sipStack.logWriter.logError("bad message " + badmsg);
this.sipStack.logWriter.logError(">>> Dropped Bad Msg "
+ "From = " + sipMessage.getFrom() + "To = "
+ sipMessage.getTo() + "CallId = "