public void setPort(int port) { if(isModifiable == ModifiableRule.NotModifiable) { throw new IllegalArgumentException("port of the URI is not modifiable"); } getSipURI().setPort(port); }
/** * 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 rewriteUri(SipURI uri) { try { String uriHost = uri.getHost(); if(uriHost.endsWith(".invalid")) { uri.setHost(getPeerAddress()); } } catch (ParseException e) { logger.logError("Cant parse address", e); } uri.setPort(getPeerPort()); } }
javax.sip.address.SipURI jainSipURI = SipFactoryImpl.addressFactory.createSipURI( null, ipAddress); jainSipURI.setPort(extendedListeningPoint.getPort()); jainSipURI.setTransportParam(extendedListeningPoint.getTransport()); SipURI sipURI = new SipURIImpl(jainSipURI, ModifiableRule.NotModifiable);
@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 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); }
private ContactHeader getContactHeader() throws ParseException { if (contactHeader == null) { ListeningPoint listeningPoint = sipFactoryProvider .getListeningPoint("udp"); Address address = addressFactory.createAddress( "Mobicents SIP AS <sip:"+listeningPoint.getIPAddress()+">"); ((SipURI) address.getURI()).setPort(listeningPoint.getPort()); contactHeader = headerFactory.createContactHeader(address); } return contactHeader; }
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")); }
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; }
try { javax.sip.address.SipURI sipUriUdp = addressFactory.createSipURI(null, address.getHostAddress()); sipUriUdp.setPort(sipPort); sipUriUdp.setLrParam(); javax.sip.address.SipURI sipAddressUri = (SipURI) sipUriUdp.clone();
sipUri.setPort(lp.getPort()); sipUri.setTransportParam(lp.getTransport());
sipUri.setPort(port); sipUri.setLrParam(); sipUri.setTransportParam(transport);
/** * * @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")); }
public ContactHeader createContactHeader() { try { String ipAddress = this.getIPAddress(); int port = this.getPort(); SipURI sipURI = new SipUri(); sipURI.setHost(ipAddress); sipURI.setPort(port); sipURI.setTransportParam(this.transport); Contact contact = new Contact(); AddressImpl address = new AddressImpl(); address.setURI(sipURI); contact.setAddress(address); return contact; } catch (Exception ex) { InternalErrorHandler.handleException("Unexpected exception",logger); return null; } }
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();
sipUri.setPort(port); sipUri.setLrParam(); String transport = JainSipUtils.findTransport(request);
flowURI.setPort(remotePort); flowURI.setTransportParam(transport);