public SipURI createSipURI(String user, String host) { if (logger.isDebugEnabled()) { logger.debug("Creating SipURI from USER[" + user + "] HOST[" + host + "]"); } // Fix for http://code.google.com/p/sipservlets/issues/detail?id=145 if(user != null && user.trim().isEmpty()) { user = null; } try { return new SipURIImpl(SipFactoryImpl.addressFactory.createSipURI( user, host), ModifiableRule.Modifiable); } catch (ParseException e) { logger.error("couldn't parse the SipURI from USER[" + user + "] HOST[" + host + "]", e); throw new IllegalArgumentException("Could not create SIP URI user = " + user + " host = " + host); } }
/** * Create a Record Route URI based on the host, port and transport of this listening point * @param usePublicAddress if true, the host will be the global ip address found by STUN otherwise * it will be the local network interface ipaddress * @return the record route uri */ public javax.sip.address.SipURI createRecordRouteURI(boolean usePublicAddress) { try { String host = getIpAddress(usePublicAddress); SipURI sipUri = SipFactoryImpl.addressFactory.createSipURI(null, host); sipUri.setPort(port); sipUri.setTransportParam(transport); // Do we want to add an ID here? return sipUri; } catch (ParseException ex) { logger.error ("Unexpected error while creating a record route URI",ex); throw new IllegalArgumentException("Unexpected exception when creating a record route URI", ex); } }
public void setOutboundInterface(InetSocketAddress inetSocketAddress) { if(!isValid()) { throw new IllegalStateException("the session has been invalidated"); } if(inetSocketAddress == null) { throw new NullPointerException("parameter is null"); } String address = inetSocketAddress.getAddress().getHostAddress() + ":" + inetSocketAddress.getPort(); List<SipURI> list = sipFactory.getSipNetworkInterfaceManager().getOutboundInterfaces(); SipURI networkInterface = null; for(SipURI networkInterfaceURI : list) { if(networkInterfaceURI.toString().contains(address)) { networkInterface = networkInterfaceURI; break; } } if(networkInterface == null) throw new IllegalArgumentException("Network interface for " + address + " not found"); try { outboundInterface = new SipURIImpl(SipFactoryImpl.addressFactory.createSipURI(null, address), ModifiableRule.NotModifiable).toString(); } catch (ParseException e) { logger.error("couldn't parse the SipURI from USER[" + null + "] HOST[" + address + "]", e); throw new IllegalArgumentException("Could not create SIP URI user = " + null + " host = " + address); } }
public void setOutboundInterface(InetAddress inetAddress) { if(!isValid()) { throw new IllegalStateException("the session has been invalidated"); } if(inetAddress == null) { throw new NullPointerException("parameter is null"); } String address = inetAddress.getHostAddress(); List<SipURI> list = sipFactory.getSipNetworkInterfaceManager().getOutboundInterfaces(); SipURI networkInterface = null; for(SipURI networkInterfaceURI : list) { if(networkInterfaceURI.toString().contains(address)) { networkInterface = networkInterfaceURI; break; } } if(networkInterface == null) throw new IllegalArgumentException("Network interface for " + address + " not found"); try { outboundInterface = new SipURIImpl(SipFactoryImpl.addressFactory.createSipURI(null, address), ModifiableRule.NotModifiable).toString(); } catch (ParseException e) { logger.error("couldn't parse the SipURI from USER[" + null + "] HOST[" + address + "]", e); throw new IllegalArgumentException("Could not create SIP URI user = " + null + " host = " + address); } }
try { newlyComputedOutboundInterfacesIpAddresses.add(ipAddress); javax.sip.address.SipURI jainSipURI = SipFactoryImpl.addressFactory.createSipURI( null, ipAddress); jainSipURI.setPort(extendedListeningPoint.getPort());
sipUri = addressFactory.createSipURI(getToUser(), getToHost() + ":" + getToPort());
private void createContactHeader() throws ParseException { SipURI contactURI = addressFactory.createSipURI(getFromUser(), getFromHost()); contactURI.setTransportParam(getTransport()); contactURI.setPort(Integer.valueOf(getFromPort()).intValue()); Address contactAddress = addressFactory.createAddress(contactURI); // Add the contact address. contactAddress.setDisplayName(getFromUser()); contactHeader = headerFactory.createContactHeader(contactAddress); }
@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; }
private void createFromHeader() throws ParseException { SipURI fromAddress = getAddressFactory().createSipURI(getFromUser(), getFromHost()); fromAddress.setPort(Integer.valueOf(getFromPort()).intValue()); Address fromNameAddress = addressFactory.createAddress(fromAddress); fromNameAddress.setDisplayName(getFromUser()); setFromHeader(headerFactory.createFromHeader(fromNameAddress, getFromUser() + "_Header")); }
host = getIpAddress(usePublicAddress); javax.sip.address.SipURI sipURI = SipFactoryImpl.addressFactory.createSipURI(userName, host); sipURI.setHost(host); sipURI.setPort(port);
private ContactHeader getContactHeader() throws ParseException { if (contactHeader == null) { final ListeningPoint listeningPoint = sleeSipProvider .getListeningPoint("udp"); final javax.sip.address.SipURI sipURI = addressFactory .createSipURI(null, listeningPoint.getIPAddress()); sipURI.setPort(listeningPoint.getPort()); sipURI.setTransportParam(listeningPoint.getTransport()); contactHeader = headerFactory.createContactHeader(addressFactory .createAddress(sipURI)); } return contactHeader; }
this.loadBalancerHeartBeatingService = loadBalancerHeartBeatingService; try { javax.sip.address.SipURI sipUriUdp = addressFactory.createSipURI(null, address.getHostAddress()); sipUriUdp.setPort(sipPort); sipUriUdp.setLrParam();
port = proxy.getPort(); javax.sip.address.SipURI sipUri = SipFactoryImpl.addressFactory.createSipURI(null, host); sipUri.setPort(port); sipUri.setLrParam();
/** * * @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); } }
private void createToHeader() throws ParseException { SipURI toAddress = getAddressFactory().createSipURI(getToUser(), getToHost()); toAddress.setPort(getToPort()); Address toNameAddress = addressFactory.createAddress(toAddress); toNameAddress.setDisplayName(getToUser()); setToHeader(headerFactory.createToHeader(toNameAddress, getToUser() + "_Header")); }
sipFactoryImpl.getAddressFactory().createSipURI(null, hop.getHost()); routeURI.setPort(hop.getPort()); routeURI.setTransportParam(hop.getTransport());
port = proxy.getPort(); javax.sip.address.SipURI sipUri = SipFactoryImpl.addressFactory.createSipURI(null, host); sipUri.setPort(port); sipUri.setLrParam();
javax.sip.address.SipURI sipURI = addressFactory.createSipURI(fromName, loadBalancerToUse.getAddress().getHostAddress()); sipURI.setHost(loadBalancerToUse.getAddress().getHostAddress()); sipURI.setPort(loadBalancerToUse.getSipPort());
SipURI fromAddress = sipAddressFactory.createSipURI("missed-calls", System.getProperty("bind.address", "127.0.0.1"));
final javax.sip.address.SipURI flowURI = SipFactoryImpl.addressFactory.createSipURI(null, remoteHost); flowURI.setPort(remotePort); flowURI.setTransportParam(transport);