public Hop resolveAddress(Hop hop) { String hopHost = hop.getHost(); int hopPort = hop.getPort(); String hopTransport = hop.getTransport();
public Hop resolveAddress(Hop inputAddress) { if (inputAddress.getPort() != -1) return inputAddress; else { return new HopImpl(inputAddress.getHost(), MessageProcessor.getDefaultPort(inputAddress.getTransport()),inputAddress.getTransport()); } }
@Override public List<SipURI> locateURIs(SipURI uri) { List<SipURI> uris = new CopyOnWriteArrayList(); if (uri instanceof SipURIImpl && createAddressFactory != null) { SipURIImpl uriImpl = (SipURIImpl) uri; Queue<Hop> hops = dnsServerLocator.locateHops(uriImpl.getSipURI()); if(hops != null) { for (Hop hop : hops) { javax.sip.address.SipURI createSipURI; try { //use null as user so this uri may be used potentially //as Route Header createSipURI = createAddressFactory.createSipURI(null, hop.getHost()); createSipURI.setPort(hop.getPort()); createSipURI.setTransportParam(hop.getTransport()); SipURI sipURI = new SipURIImpl(createSipURI, ModifiableRule.NotModifiable); uris.add(sipURI); } catch (ParseException ex) { logger.debug("Error creating SipURI.", ex); } } } } return uris; }
/** * * @param hop * @param request */ private void addDnsRoute(Hop hop, final Request request) throws ParseException, SipException { if(hop != null && sipFactoryImpl.getSipApplicationDispatcher().isExternal(hop.getHost(), hop.getPort(), hop.getTransport())) { javax.sip.address.SipURI nextHopUri = SipFactoryImpl.addressFactory.createSipURI(null, hop.getHost()); nextHopUri.setLrParam(); nextHopUri.setPort(hop.getPort()); if(hop.getTransport() != null) { nextHopUri.setTransportParam(hop.getTransport()); } // Deal with http://code.google.com/p/mobicents/issues/detail?id=2346 nextHopUri.setParameter(DNSAwareRouter.DNS_ROUTE, Boolean.TRUE.toString()); final javax.sip.address.Address nextHopRouteAddress = SipFactoryImpl.addressFactory.createAddress(nextHopUri); final RouteHeader nextHopRouteHeader = SipFactoryImpl.headerFactory.createRouteHeader(nextHopRouteAddress); if(logger.isDebugEnabled()) { logger.debug("Adding next hop found by RFC 3263 lookups as route header" + nextHopRouteHeader); } request.addFirst(nextHopRouteHeader); } }
&& messageProcessor.getPort() == hop.getPort() && messageProcessor.getTransport().equalsIgnoreCase(hop.getTransport())) { MessageChannel messageChannel = messageProcessor.createMessageChannel( hopAddr, hop.getPort()); if (messageChannel instanceof RawMessageChannel) { final RawMessageChannel channel = (RawMessageChannel) messageChannel; this.sendMessage(msg, hopAddr, hop.getPort(), sipMessage instanceof SIPRequest); sipMessage.setRemotePort(hop.getPort()); sipMessage.setLocalPort(this.getPort()); sipMessage.setLocalAddress(this.getMessageProcessor().getIpAddress()); logMessage(sipMessage, hopAddr, hop.getPort(), time);
targetHostPort = new HostPort(); targetHostPort.setHost(targetHost); targetHostPort.setPort(nextHop.getPort());
/** * Creates a client transaction to handle a new request. Gets the real * message channel from the superclass, and then creates a new client * transaction wrapped around this channel. * * @param nextHop * Hop to create a channel to contact. */ public MessageChannel createMessageChannel(SIPRequest request, MessageProcessor mp, Hop nextHop) throws IOException { // Create a new client transaction around the // superclass' message channel // Create the host/port of the target hop Host targetHost = new Host(); targetHost.setHostname(nextHop.getHost()); HostPort targetHostPort = new HostPort(); targetHostPort.setHost(targetHost); targetHostPort.setPort(nextHop.getPort()); MessageChannel returnChannel = mp.createMessageChannel(targetHostPort); return returnChannel; }
@Override public void send(SIPRequest ackRequest) throws SipException, IOException { hop = sipStack.getNextHop(ackRequest); if (hop == null) throw new SipException("No route!"); if (logger.isLoggingEnabled(LogWriter.TRACE_DEBUG)) logger.logDebug("hop = " + hop); ListeningPointImpl lp = (ListeningPointImpl) sipProvider .getListeningPoint(hop.getTransport()); if (lp == null) throw new SipException( "No listening point for this provider registered at " + hop); InetAddress inetAddress = InetAddress.getByName(hop.getHost()); MessageChannel messageChannel = lp.getMessageProcessor() .createMessageChannel(inetAddress, hop.getPort()); messageChannel.sendMessage(ackRequest); }
} else if((hop != null && hop.getHost().equals(originalRequest.getInitialRemoteAddr()) && hop.getPort() == originalRequest.getInitialRemotePort()) || (hop == null && (contactHasObParam || poppedRouteHasObParam))) { if(logger.isDebugEnabled()) { logger.debug("RFC5626 Outgoing Case " + request); javax.sip.address.SipURI routeURI = (javax.sip.address.SipURI) sipFactoryImpl.getAddressFactory().createSipURI(null, hop.getHost()); routeURI.setPort(hop.getPort()); routeURI.setTransportParam(hop.getTransport()); routeURI.setLrParam();
Hop hop = sipStack.addressResolver.resolveAddress(topMostVia .getHop()); this.peerPort = hop.getPort(); this.peerProtocol = topMostVia.getTransport();
if (logger.isLoggingEnabled(LogWriter.TRACE_DEBUG)) { logger.logDebug( "SIPDialog::sendRequest:Using hop = " + hop.getHost() + " : " + hop.getPort());
hop = sipStack.getNextHop(ackRequest); this.raiseIOException(hop.getHost(), hop.getPort(), hop .getTransport()); } catch (SipException ex) {