Examples of SipURI


Examples of gov.nist.javax.sip.address.SipUri

         * assigned to the dialog. Forgive the sins of B2BUA's that like to record route ACK's
         */
        if (dialog != null && sipProvider != dialog.getSipProvider()) {
            Contact contact = dialog.getMyContactHeader();
            if (contact != null) {
                SipUri contactUri = (SipUri) (contact.getAddress().getURI());
                String ipAddress = contactUri.getHost();
                int contactPort = contactUri.getPort();
                String contactTransport = contactUri.getTransportParam();
                if (contactTransport == null)
                    contactTransport = "udp";
                if (contactPort == -1) {
                    if (contactTransport.equals("udp") || contactTransport.equals("tcp"))
                        contactPort = 5060;
                    else
                        contactPort = 5061;
                }
                // Check if the dialog contact is the same as the provider on
                // which we got the request. Otherwise, dont assign this
                // dialog to the request.
                if (ipAddress != null
                        && (!ipAddress.equals(listeningPoint.getIPAddress()) || contactPort != listeningPoint
                                .getPort())) {
                    if (sipStack.isLoggingEnabled()) {
                        sipStack.getStackLogger().logDebug(
                                "nulling dialog -- listening point mismatch!  " + contactPort
                                        + "  lp port = " + listeningPoint.getPort());

                    }
                    dialog = null;
                }

            }
        }

        /*
         * RFC 3261 8.2.2.2 Merged requests: If the request has no tag in the To header field, the
         * UAS core MUST check the request against ongoing transactions. If the From tag, Call-ID,
         * and CSeq exactly match those associated with an ongoing transaction, but the request
         * does not match that transaction (based on the matching rules in Section 17.2.3), the
         * UAS core SHOULD generate a 482 (Loop Detected) response and pass it to the server
         * transaction. This support is only enabled when the stack has been instructed to
         * function with Automatic Dialog Support.
         */
        if ( sipProvider.isDialogErrorsAutomaticallyHandled()
                && sipRequest.getToTag() == null) {
            if ( sipStack
                    .findMergedTransaction(sipRequest)) {
                this.sendLoopDetectedResponse(sipRequest, transaction);
                return;
            }
        }

        if (sipStack.isLoggingEnabled()) {
            sipStack.getStackLogger().logDebug("dialogId = " + dialogId);
            sipStack.getStackLogger().logDebug("dialog = " + dialog);
        }

        /*
         * RFC 3261 Section 16.4 If the first value in the Route header field indicates this
         * proxy,the proxy MUST remove that value from the request .
         */

        // If the message is being processed
        // by a Proxy, then the proxy will take care of stripping the
        // Route header. If the request is being processed by an
        // endpoint, then the stack strips off the route header.
        if (sipRequest.getHeader(Route.NAME) != null && transaction.getDialog() != null) {
            RouteList routes = sipRequest.getRouteHeaders();
            Route route = (Route) routes.getFirst();
            SipUri uri = (SipUri) route.getAddress().getURI();
            int port;
            if (uri.getHostPort().hasPort()) {
                port = uri.getHostPort().getPort();
            } else {
                if (listeningPoint.getTransport().equalsIgnoreCase("TLS"))
                    port = 5061;
                else
                    port = 5060;
            }
            String host = uri.getHost();
            if ((host.equals(listeningPoint.getIPAddress()) || host
                    .equalsIgnoreCase(listeningPoint.getSentBy()))
                    && port == listeningPoint.getPort()) {
                if (routes.size() == 1)
                    sipRequest.removeHeader(Route.NAME);
View Full Code Here

Examples of gov.nist.javax.sip.address.SipUri

                || (this.isServer() && this.getState().getValue() == EARLY_STATE && method
                        .equalsIgnoreCase(Request.BYE)))
            throw new SipException("Dialog  " + getDialogId()
                    + " not yet established or terminated " + this.getState());

        SipUri sipUri = null;
        if (this.getRemoteTarget() != null)
            sipUri = (SipUri) this.getRemoteTarget().getURI().clone();
        else {
            sipUri = (SipUri) this.getRemoteParty().getURI().clone();
            sipUri.clearUriParms();
        }

        CSeq cseq = new CSeq();
        try {
            cseq.setMethod(method);
View Full Code Here

Examples of gov.nist.javax.sip.address.SipUri

         * assigned to the dialog. Forgive the sins of B2BUA's that like to record route ACK's
         */
        if (dialog != null && sipProvider != dialog.getSipProvider()) {
            Contact contact = dialog.getMyContactHeader();
            if (contact != null) {
                SipUri contactUri = (SipUri) (contact.getAddress().getURI());
                String ipAddress = contactUri.getHost();
                int contactPort = contactUri.getPort();
                String contactTransport = contactUri.getTransportParam();
                if (contactTransport == null)
                    contactTransport = "udp";
                if (contactPort == -1) {
                    if (contactTransport.equals("udp") || contactTransport.equals("tcp"))
                        contactPort = 5060;
                    else
                        contactPort = 5061;
                }
                // Check if the dialog contact is the same as the provider on
                // which we got the request. Otherwise, dont assign this
                // dialog to the request.
                if (ipAddress != null
                        && (!ipAddress.equals(listeningPoint.getIPAddress()) || contactPort != listeningPoint
                                .getPort())) {
                    if (sipStack.isLoggingEnabled(LogWriter.TRACE_DEBUG)) {
                        sipStack.getStackLogger().logDebug(
                                "nulling dialog -- listening point mismatch!  " + contactPort
                                        + "  lp port = " + listeningPoint.getPort());

                    }
                    dialog = null;
                }

            }
        }

        /*
         * RFC 3261 8.2.2.2 Merged requests: If the request has no tag in the To header field, the
         * UAS core MUST check the request against ongoing transactions. If the From tag, Call-ID,
         * and CSeq exactly match those associated with an ongoing transaction, but the request
         * does not match that transaction (based on the matching rules in Section 17.2.3), the
         * UAS core SHOULD generate a 482 (Loop Detected) response and pass it to the server
         * transaction. This support is only enabled when the stack has been instructed to
         * function with Automatic Dialog Support.
         */
        if ( sipProvider.isDialogErrorsAutomaticallyHandled()
                && sipRequest.getToTag() == null) {
            if ( sipStack
                    .findMergedTransaction(sipRequest)) {
                this.sendLoopDetectedResponse(sipRequest, transaction);
                return;
            }
        }

        if (sipStack.isLoggingEnabled(LogWriter.TRACE_DEBUG)) {
            sipStack.getStackLogger().logDebug("dialogId = " + dialogId);
            sipStack.getStackLogger().logDebug("dialog = " + dialog);
        }

        /*
         * RFC 3261 Section 16.4 If the first value in the Route header field indicates this
         * proxy,the proxy MUST remove that value from the request .
         */

        // If the message is being processed
        // by a Proxy, then the proxy will take care of stripping the
        // Route header. If the request is being processed by an
        // endpoint, then the stack strips off the route header.
        if (sipRequest.getHeader(Route.NAME) != null && transaction.getDialog() != null) {
            RouteList routes = sipRequest.getRouteHeaders();
            Route route = (Route) routes.getFirst();
            SipUri uri = (SipUri) route.getAddress().getURI();
            int port;
            if (uri.getHostPort().hasPort()) {
                port = uri.getHostPort().getPort();
            } else {
                if (listeningPoint.getTransport().equalsIgnoreCase("TLS"))
                    port = 5061;
                else
                    port = 5060;
            }
            String host = uri.getHost();
            if ((host.equals(listeningPoint.getIPAddress()) || host
                    .equalsIgnoreCase(listeningPoint.getSentBy()))
                    && port == listeningPoint.getPort()) {
                if (routes.size() == 1)
                    sipRequest.removeHeader(Route.NAME);
View Full Code Here

Examples of gov.nist.javax.sip.address.SipUri

                || (this.isServer() && this.getState().getValue() == EARLY_STATE && method
                        .equalsIgnoreCase(Request.BYE)))
            throw new SipException("Dialog  " + getDialogId()
                    + " not yet established or terminated " + this.getState());

        SipUri sipUri = null;
        if (this.getRemoteTarget() != null)
            sipUri = (SipUri) this.getRemoteTarget().getURI().clone();
        else {
            sipUri = (SipUri) this.getRemoteParty().getURI().clone();
            sipUri.clearUriParms();
        }

        CSeq cseq = new CSeq();
        try {
            cseq.setMethod(method);
View Full Code Here

Examples of gov.nist.javax.sip.address.SipUri

                        && this.getState().getValue() == EARLY_STATE && method
                        .equalsIgnoreCase(Request.BYE)))
            throw new SipException("Dialog  " + getDialogId()
                    + " not yet established or terminated " + this.getState());

        SipUri sipUri = null;
        if (this.getRemoteTarget() != null)
            sipUri = (SipUri) this.getRemoteTarget().getURI().clone();
        else {
            sipUri = (SipUri) this.getRemoteParty().getURI().clone();
            sipUri.clearUriParms();
        }

        CSeq cseq = new CSeq();
        try {
            cseq.setMethod(method);
View Full Code Here

Examples of javax.servlet.sip.SipURI

        "1"));
  }

  protected void testRouterInfo(SipApplicationRouterInfo routerInfo) throws Exception
  {
    SipURI uri = new SipURIImpl(null, "localhost", 5060);
    RouterInfoUtil.encode(uri, routerInfo);
    //System.out.println(uri);
    assertEquals(routerInfo, RouterInfoUtil.decode(new SipURIImpl(uri.toString())));
  }
View Full Code Here

Examples of javax.servlet.sip.SipURI

 
  protected SipURI getOwnUri()
  {
    @SuppressWarnings("unchecked")
    List<SipURI> l = (List<SipURI>) getServletContext().getAttribute(OUTBOUND_INTERFACES);
    SipURI uri = l.get(0);
    uri = (SipURI) uri.clone();
    uri.setUser("cipango-servlet-test");
    uri.setLrParam(true);
    return uri;
  }
View Full Code Here

Examples of javax.servlet.sip.SipURI

  }

  @Test
  public void testSipUri() throws Exception
  {
    SipURI orig = new SipURIImpl("sip:foo@bar.com;transport=tcp?to=sip:bob%40biloxi.com");
    SipURI readOnly = new ReadOnlySipURI((SipURI) orig.clone());
   
    assertEquals(orig, readOnly);
    try { readOnly.setParameter("foo", "bar"); fail();} catch (IllegalStateException e) {}
    try { readOnly.removeParameter("transport"); fail();} catch (IllegalStateException e) {} 
    try { readOnly.setHeader("subject", "toto"); fail();} catch (IllegalStateException e) {}
    try { readOnly.removeHeader("to"); fail();} catch (IllegalStateException e) {}
    assertEquals(orig, readOnly);
    assertEquals(readOnly, orig);
    assertEquals(orig.toString(), readOnly.toString());
    URI clone = (URI) readOnly.clone();
    clone.setParameter("a", "b");
    testSerializable(readOnly);
  }
View Full Code Here

Examples of javax.servlet.sip.SipURI

    Address contact = request.getAddressHeader("Contact");
    assertEquals("<sip:127.0.0.1:5060;transport=TCP>", contact.toString());
    contact.setDisplayName("Bob");
    contact.setParameter("isfocus", "");
    assertEquals("Bob", contact.getDisplayName());
    SipURI uri = (SipURI) contact.getURI();
    uri.setUser("bob");
    assertEquals("bob", uri.getUser());
    try { uri.setHost("bad"); fail(); } catch (IllegalStateException e) {}
    try { uri.setLrParam(true); fail(); } catch (IllegalStateException e) {}
    try { uri.setMAddrParam("bad"); fail(); } catch (IllegalStateException e) {}
    try { uri.setMethodParam("Bad"); fail(); } catch (IllegalStateException e) {}
    try { uri.setTTLParam(2); fail(); } catch (IllegalStateException e) {}
    try { uri.setParameter("lr", ""); fail(); } catch (IllegalStateException e) {}
    try { uri.removeParameter("Maddr"); fail(); } catch (IllegalStateException e) {}
    uri.setParameter("transport", "UDP");
    assertEquals("UDP", uri.getParameter("transport"));
    assertEquals("Bob <sip:bob@127.0.0.1:5060;transport=UDP>;isfocus", contact.toString());
   
    // Full read-only on committed
    request.setCommitted(true);
    contact = request.getAddressHeader("Contact");
    uri = (SipURI) contact.getURI();
    try { contact.setDisplayName("bad"); fail(); } catch (IllegalStateException e) {}
    try { uri.setUser("bad"); fail(); } catch (IllegalStateException e) {}
   
    // Full writable on REGISTER
    request = (SipRequest) getMessage(REGISTER);
    contact = request.getAddressHeader("Contact");
    uri = (SipURI) contact.getURI();
    contact.setDisplayName("Bob");
    uri.setHost("nexcom.fr");
    uri.setPort(5062);
    uri.removeParameter("transport");
    uri.setUser("bob");
    assertEquals("Bob <sip:bob@nexcom.fr:5062>", contact.toString());   
  }
View Full Code Here

Examples of javax.servlet.sip.SipURI

{
    public static String toCanonical(URI uri)
    {
      if (uri.isSipURI())
      {
        SipURI sipUri = (SipURI) uri;
        return ("sip:" + sipUri.getUser() + "@" + sipUri.getHost()).toLowerCase();
      }
      else
      {
        return uri.toString();
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.