Package gov.nist.javax.sip.header

Examples of gov.nist.javax.sip.header.ContactList


            this.routeList = new RouteList();
        }

        // put the contact header from the incoming request into
        // the route set. JvB: some duplication here, ref. doTargetRefresh
        ContactList contactList = sipRequest.getContactHeaders();
        if (contactList != null) {
            this.setRemoteTarget((ContactHeader) contactList.getFirst());
        }
    }
View Full Code Here


     * 14). Other extensions may define different target refresh requests for
     * dialogs established in other ways.
     */
    private void doTargetRefresh(SIPMessage sipMessage) {

        ContactList contactList = sipMessage.getContactHeaders();

        /*
         * INVITE is the target refresh for INVITE dialogs. SUBSCRIBE is the
         * target refresh for subscribe dialogs from the client side. This
         * modifies the remote target URI potentially
         */
        if (contactList != null) {

            Contact contact = (Contact) contactList.getFirst();
            this.setRemoteTarget(contact);

        }

    }
View Full Code Here

   * Get the contact header ( the first contact header) which is all we need
   * for the most part.
   *
   */
  public Contact getContactHeader() {
    ContactList clist = this.getContactHeaders();
    if (clist != null) {
      return (Contact) clist.getFirst();

    } else {
      return null;
    }
  }
View Full Code Here

  }

  public SIPHeader parse() throws ParseException {
    // past the header name and the colon.
    headerName(TokenTypes.CONTACT);
    ContactList retval = new ContactList();
    while (true) {
      Contact contact = new Contact();
      if (lexer.lookAhead(0) == '*') {
        final char next = lexer.lookAhead(1);
        if (next == ' ' || next == '\t' || next == '\r' || next == '\n') {
          this.lexer.match('*');
          contact.setWildCardFlag(true);
        } else {
          super.parse(contact);
        }
      } else {
        super.parse(contact);
      }
      AddressImpl address = (AddressImpl) contact.getAddress();
      URI uri = contact.getAddress().getURI();
      /*
       * When the header field value contains a display name, the URI
       * including all URI parameters is enclosed in "<" and ">". If no "<"
       * and ">" are present, all parameters after the URI are header
       * parameters, not URI parameters.
       */
      if (address.getAddressType() == AddressImpl.ADDRESS_SPEC
          && uri instanceof SipUri) {
        SipUri   sipUri = (SipUri) uri;
        HashSet parameterNames = new HashSet();
        for (Iterator it = sipUri.getParameterNames(); it.hasNext(); ) {
          parameterNames.add(it.next());
        }
        // This avoids the concurrent modification exception.
        for (Iterator it = parameterNames.iterator(); it.hasNext();) {
          String name = (String) it.next();
          String val = sipUri.getParameter(name);
          sipUri.removeParameter(name);
          contact.setParameter(name,val);
        }
      }
      retval.add(contact);
      this.lexer.SPorHT();
      char la = lexer.lookAhead(0);
      if (la == ',') {
        this.lexer.match(',');
        this.lexer.SPorHT();
View Full Code Here

    /**
     * Get the contact header ( the first contact header) which is all we need for the most part.
     *
     */
    public Contact getContactHeader() {
        ContactList clist = this.getContactHeaders();
        if (clist != null) {
            return (Contact) clist.getFirst();

        } else {
            return null;
        }
    }
View Full Code Here

            } else if (this.dialogState == CONFIRMED_STATE) {
                // cannot add route list after the dialog is initialized.
                // Remote target is updated on RE-INVITE but not
                // the route list.
                if (sipResponse.getStatusCode() / 100 == 2 && !this.isServer()) {
                    ContactList contactList = sipResponse.getContactHeaders();
                    if (contactList != null
                            && SIPRequest.isTargetRefresh(sipResponse.getCSeq()
                                    .getMethod())) {
                        this.setRemoteTarget((ContactHeader) contactList
                                .getFirst());
                    }
                }
                if (!this.pendingRouteUpdateOn202Response)
                    return;
            }

            // Update route list on response if I am a client dialog.
            if (!isServer() || this.pendingRouteUpdateOn202Response) {

                // only update the route set if the dialog is not in the
                // confirmed state.
                if ((this.getState() != DialogState.CONFIRMED && this
                        .getState() != DialogState.TERMINATED)
                        || this.pendingRouteUpdateOn202Response) {
                    RecordRouteList rrlist = sipResponse
                            .getRecordRouteHeaders();
                    // Add the route set from the incoming response in reverse
                    // order for record route headers.
                    if (rrlist != null) {
                        this.addRoute(rrlist);
                    } else {
                        // Set the rotue list to the last seen route list.
                        this.routeList = new RouteList();
                    }
                }

                ContactList contactList = sipResponse.getContactHeaders();
                if (contactList != null) {
                    this
                            .setRemoteTarget((ContactHeader) contactList
                                    .getFirst());
                }
            }

        } finally {
View Full Code Here

            this.routeList = new RouteList();
        }

        // put the contact header from the incoming request into
        // the route set. JvB: some duplication here, ref. doTargetRefresh
        ContactList contactList = sipRequest.getContactHeaders();
        if (contactList != null) {
            this.setRemoteTarget((ContactHeader) contactList.getFirst());
        }
    }
View Full Code Here

     * 14). Other extensions may define different target refresh requests for
     * dialogs established in other ways.
     */
    private void doTargetRefresh(SIPMessage sipMessage) {

        ContactList contactList = sipMessage.getContactHeaders();

        /*
         * INVITE is the target refresh for INVITE dialogs. SUBSCRIBE is the
         * target refresh for subscribe dialogs from the client side. This
         * modifies the remote target URI potentially
         */
        if (contactList != null) {

            Contact contact = (Contact) contactList.getFirst();
            this.setRemoteTarget(contact);

        }

    }
View Full Code Here

            } else if (this.dialogState == CONFIRMED_STATE) {
                // cannot add route list after the dialog is initialized.
                // Remote target is updated on RE-INVITE but not
                // the route list.
                if (sipResponse.getStatusCode() / 100 == 2 && !this.isServer()) {
                    ContactList contactList = sipResponse.getContactHeaders();
                    if (contactList != null
                            && SIPRequest.isTargetRefresh(sipResponse.getCSeq().getMethod())) {
                        this.setRemoteTarget((ContactHeader) contactList.getFirst());
                    }
                }
                if (! this.pendingRouteUpdateOn202Response ) return;
            }

            // Update route list on response if I am a client dialog.
            if (!isServer() || this.pendingRouteUpdateOn202Response) {

                // only update the route set if the dialog is not in the confirmed state.
                if ((this.getState() != DialogState.CONFIRMED
                        && this.getState() != DialogState.TERMINATED) ||
                        this.pendingRouteUpdateOn202Response ) {
                    RecordRouteList rrlist = sipResponse.getRecordRouteHeaders();
                    // Add the route set from the incoming response in reverse
                    // order for record route headers.
                    if (rrlist != null) {
                        this.addRoute(rrlist);
                    } else {
                        // Set the rotue list to the last seen route list.
                        this.routeList = new RouteList();
                    }
                }

                ContactList contactList = sipResponse.getContactHeaders();
                if (contactList != null) {
                    this.setRemoteTarget((ContactHeader) contactList.getFirst());
                }
            }

        } finally {
            if (sipStack.isLoggingEnabled()) {
View Full Code Here

            this.routeList = new RouteList();
        }

        // put the contact header from the incoming request into
        // the route set. JvB: some duplication here, ref. doTargetRefresh
        ContactList contactList = sipRequest.getContactHeaders();
        if (contactList != null) {
            this.setRemoteTarget((ContactHeader) contactList.getFirst());
        }
    }
View Full Code Here

TOP

Related Classes of gov.nist.javax.sip.header.ContactList

Copyright © 2018 www.massapicom. 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.