InternalErrorHandler.handleException(ex);
}
Hop hop = ((SIPClientTransaction) clientTransactionId).getNextHop();
if (sipStack.isLoggingEnabled()) {
sipStack.getStackLogger().logDebug(
"Using hop = " + hop.getHost() + " : " + hop.getPort());
}
try {
MessageChannel messageChannel = sipStack.createRawMessageChannel(this
.getSipProvider().getListeningPoint(hop.getTransport()).getIPAddress(),
this.firstTransaction.getPort(), hop);
MessageChannel oldChannel = ((SIPClientTransaction)
clientTransactionId).getMessageChannel();
// Remove this from the connection cache if it is in the
// connection
// cache and is not yet active.
oldChannel.uncache();
// Not configured to cache client connections.
if (!sipStack.cacheClientConnections) {
oldChannel.useCount--;
if (sipStack.isLoggingEnabled())
sipStack.getStackLogger().logDebug(
"oldChannel: useCount " + oldChannel.useCount);
}
if (messageChannel == null) {
/*
* At this point the procedures of 8.1.2 and 12.2.1.1 of RFC3261 have been tried
* but the resulting next hop cannot be resolved (recall that the exception thrown
* is caught and ignored in SIPStack.createMessageChannel() so we end up here with
* a null messageChannel instead of the exception handler below). All else
* failing, try the outbound proxy in accordance with 8.1.2, in particular: This
* ensures that outbound proxies that do not add Record-Route header field values
* will drop out of the path of subsequent requests. It allows endpoints that
* cannot resolve the first Route URI to delegate that task to an outbound proxy.
*
* if one considers the 'first Route URI' of a request constructed according to
* 12.2.1.1 to be the request URI when the route set is empty.
*/
if (sipStack.isLoggingEnabled())
sipStack.getStackLogger().logDebug(
"Null message channel using outbound proxy !");
Hop outboundProxy = sipStack.getRouter(dialogRequest).getOutboundProxy();
if (outboundProxy == null)
throw new SipException("No route found! hop=" + hop);
messageChannel = sipStack.createRawMessageChannel(this.getSipProvider()
.getListeningPoint(outboundProxy.getTransport()).getIPAddress(),
this.firstTransaction.getPort(), outboundProxy);
if (messageChannel != null)
((SIPClientTransaction) clientTransactionId)
.setEncapsulatedChannel(messageChannel);
} else {