/*
* Add a via header for the outbound request based on the transport of the message
* processor.
*/
ListeningPointImpl lp = (ListeningPointImpl) this.sipProvider
.getListeningPoint(sipResponse.getTopmostVia().getTransport());
if (lp == null) {
if (sipStack.isLoggingEnabled())
sipStack.getStackLogger().logError(
"Cannot find listening point for transport "
+ sipResponse.getTopmostVia().getTransport());
throw new SipException("Cannot find listening point for transport "
+ sipResponse.getTopmostVia().getTransport());
}
Via via = lp.getViaHeader();
From from = new From();
from.setAddress(this.localParty);
To to = new To();
to.setAddress(this.remoteParty);
SIPRequest sipRequest = sipResponse.createRequest(sipUri, via, cseq, from, to);
/*
* The default contact header is obtained from the provider. The application can override
* this.
*
* JvB: Should only do this for target refresh requests, ie not for BYE, PRACK, etc
*/
if (SIPRequest.isTargetRefresh(method)) {
ContactHeader contactHeader = ((ListeningPointImpl) this.sipProvider
.getListeningPoint(lp.getTransport())).createContactHeader();
((SipURI) contactHeader.getAddress().getURI()).setSecure(this.isSecure());
sipRequest.setHeader(contactHeader);
}