public void run() { for (int i = 0; i < messages.length; i++) { CharsMsgParser smp = new CharsMsgParser(); try { SIPMessage sipMessage = smp.parseSIPMessage(messages[i].getBytes(), true, true, null); System.out.println( " i = " + i + " branchId = " + sipMessage.getTopmostVia().getBranch()); // System.out.println("encoded " + // sipMessage.toString()); } catch (ParseException ex) { ex.printStackTrace(); } // System.out.println("dialog id = " + // sipMessage.getDialogId(false)); } }
@Override protected void processHeader( char[] header, SIPMessage message, ParseExceptionListener parseExceptionListener, byte[] msgBuffer) throws ParseException { String headerName = Lexer.getHeaderName(header); if (headerName == null) throw new ParseException("The header name or value is null", 0); // logic to process headers only if they are present in the list of headers to parse from a // given stack property if (headersToParse.contains(headerName.toLowerCase())) { super.processHeader(header, message, parseExceptionListener, msgBuffer); } else { ((SelectiveMessage) message).addHeaderNotParsed(headerName, new String(header)); } }