} finally { if (LogWriter.needsLogging)  { LogWriter.logStackTrace(); LogWriter.logMessage ("added a route = " + routeList.encode() + "contactRoute = " + contactRoute);  } }
    public synchronized void addRoute(SIPMessage sipMessage) {        // cannot add route list after the dialog is initialized.	try {	if (LogWriter.needsLogging) {		LogWriter.logMessage		("addRoute: dialogState: " + this + "state = " +		 this.getState() );	}        if ( this.dialogState == CONFIRMED_STATE ||	this.dialogState == COMPLETED_STATE ||        this.dialogState == TERMINATED_STATE) return;	        if (!isServer()) {            // I am CLIENT dialog.            if (sipMessage instanceof SIPResponse) {	        SIPResponse sipResponse = (SIPResponse) sipMessage;		if (sipResponse.getStatusCode() == 100)  {			// Do nothing for trying messages.			return;		}                RecordRouteList rrlist = sipMessage.getRecordRouteHeaders();                // Add the route set from the incoming response in reverse                // order                if (rrlist != null ) {                    this.addRoute(rrlist);                } else {                    // Set the rotue list to the last seen route list.                    this.routeList = new RouteList();                }                ContactList contactList = sipMessage.getContactHeaders();                if (contactList != null) {                    this.addRoute(contactList);                }            }        }  else  {            if (sipMessage instanceof SIPRequest) {                // Incoming Request has the route list                RecordRouteList rrlist = sipMessage.getRecordRouteHeaders();                // Add the route set from the incoming response in reverse                // order                if (rrlist != null ) {                                        this.addRoute(rrlist);                } else {                    // Set the rotue list to the last seen route list.                    this.routeList = new RouteList();                }                // put the contact header from the incoming request into                // the route set.                ContactList contactList = sipMessage.getContactHeaders();                if (contactList != null) {                    this.addRoute(contactList);                }            }        }	} finally {          if (LogWriter.needsLogging)  {	      LogWriter.logStackTrace();              LogWriter.logMessage              ("added a route = " + routeList.encode() + 		"contactRoute = " + contactRoute);	              }	}    }