/** Get a dialog id given the remote tag. */ public String getDialogId(boolean isServer, String toTag) { From from = (From) this.getFrom(); CallID cid = (CallID) this.getCallId(); StringBuffer retval = new StringBuffer(cid.getCallId()); if (!isServer) { // retval.append(COLON).append(from.getUserAtHostPort()); if (from.getTag() != null) { retval.append(COLON); retval.append(from.getTag()); } // retval.append(COLON).append(to.getUserAtHostPort()); if (toTag != null) { retval.append(COLON); retval.append(toTag); } } else { // retval.append(COLON).append(to.getUserAtHostPort()); if (toTag != null) { retval.append(COLON); retval.append(toTag); } // retval.append(COLON).append(from.getUserAtHostPort()); if (from.getTag() != null) { retval.append(COLON); retval.append(from.getTag()); } } return retval.toString().toLowerCase(); }
/** Encode the body of this header (the stuff that follows headerName). A.K.A headerValue. */ protected String encodeBody() { StringBuffer encoding = new StringBuffer(); encoding.append(sentProtocol.encode()).append(SP).append(sentBy.encode()); if (!parameters.isEmpty()) { encoding.append(SEMICOLON).append(parameters.encode()); } if (comment != null) { encoding.append(SP).append(LPAREN).append(comment).append(RPAREN); } return encoding.toString(); }