/**
  * Get a dialog identifier. Generates a string that can be used as a dialog identifier.
  *
  * @param isServer is set to true if this is the UAS and set to false if this is the UAC
  */
 public String getDialogId(boolean isServer) {
   CallID cid = (CallID) this.getCallId();
   StringBuffer retval = new StringBuffer(cid.getCallId());
   From from = (From) this.getFrom();
   To to = (To) this.getTo();
   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 (to.getTag() != null) {
       retval.append(COLON);
       retval.append(to.getTag());
     }
   } else {
     // retval.append(COLON).append(to.getUserAtHostPort());
     if (to.getTag() != null) {
       retval.append(COLON);
       retval.append(to.getTag());
     }
     // retval.append(COLON).append(from.getUserAtHostPort());
     if (from.getTag() != null) {
       retval.append(COLON);
       retval.append(from.getTag());
     }
   }
   return retval.toString().toLowerCase();
 }
Esempio n. 2
0
 /** 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();
 }