Package gov.nist.javax.sip.header

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


        // Enable the retransmission filter for the transaction

        ((SIPClientTransaction) clientTransactionId).isMapped = true;

        From from = (From) dialogRequest.getFrom();
        To to = (To) dialogRequest.getTo();

        // Caller already did the tag assignment -- check to see if the
        // tag assignment is OK.
        if (this.getLocalTag() != null && from.getTag() != null
                && !from.getTag().equals(this.getLocalTag()))
            throw new SipException("From tag mismatch expecting  "
                    + this.getLocalTag());

        if (this.getRemoteTag() != null && to.getTag() != null
                && !to.getTag().equals(this.getRemoteTag())) {
            if (sipStack.isLoggingEnabled())
                this.sipStack.getStackLogger().logWarning(
                        "To header tag mismatch expecting "
                                + this.getRemoteTag());
        }
        /*
         * The application is sending a NOTIFY before sending the response of
         * the dialog.
         */
        if (this.getLocalTag() == null
                && dialogRequest.getMethod().equals(Request.NOTIFY)) {
            if (!this.getMethod().equals(Request.SUBSCRIBE))
                throw new SipException(
                        "Trying to send NOTIFY without SUBSCRIBE Dialog!");
            this.setLocalTag(from.getTag());

        }

        try {
            if (this.getLocalTag() != null)
                from.setTag(this.getLocalTag());
            if (this.getRemoteTag() != null)
                to.setTag(this.getRemoteTag());

        } catch (ParseException ex) {

            InternalErrorHandler.handleException(ex);

View Full Code Here


            sipRequest.setVia(vias);
            From from = new From();
            from.setAddress(this.getLocalParty());
            from.setTag(this.myTag);
            sipRequest.setFrom(from);
            To to = new To();
            to.setAddress(this.getRemoteParty());
            if (hisTag != null)
                to.setTag(this.hisTag);
            sipRequest.setTo(to);
            sipRequest.setMaxForwards(new MaxForwards(70));

            if (this.originalRequest != null) {
                Authorization authorization = this.originalRequest
View Full Code Here

    } else {
      // Old style client so construct the transaction identifier
      // from various fields of the request.
      StringBuffer retval = new StringBuffer();
      From from = (From) this.getFrom();
      To to = (To) this.getTo();
      // String hpFrom = from.getUserAtHostPort();
      // retval.append(hpFrom).append(":");
      if (from.hasTag())
        retval.append(from.getTag()).append("-");
      // String hpTo = to.getUserAtHostPort();
View Full Code Here

   * and set to false if this is the UAC
   */
  public String getDialogId(boolean isServer) {
    CallID cid = (CallID) this.getCallId();
    From from = (From) this.getFrom();
    To to = (To) this.getTo();
    StringBuffer retval = new StringBuffer(cid.getCallId());
    if (!isServer) {
      //retval.append(COLON).append(from.getUserAtHostPort());
      if (from.getTag() != null) {
        retval.append(COLON);
        retval.append(from.getTag());
      }
      //retval.append(COLON).append(to.getUserAtHostPort());
      if (to.getTag() != null) {
        retval.append(COLON);
        retval.append(to.getTag());
      }
    } else {
      //retval.append(COLON).append(to.getUserAtHostPort());
      if (to.getTag() != null) {
        retval.append(COLON);
        retval.append(to.getTag());
      }
      //retval.append(COLON).append(from.getUserAtHostPort());
      if (from.getTag() != null) {
        retval.append(COLON);
        retval.append(from.getTag());
View Full Code Here

     * identify dialogs.
     *
     * @param isServerTransaction is a flag that indicates whether this is a server transaction.
     */
    public final String getDialogId(boolean isServer) {
        To to = (To) this.getTo();
        return this.getDialogId( isServer, to.getTag() );
    }
View Full Code Here

        } else {
            // Old style client so construct the transaction identifier
            // from various fields of the request.
            StringBuilder retval = new StringBuilder();
            From from = (From) this.getFrom();
            To to = (To) this.getTo();
            // String hpFrom = from.getUserAtHostPort();
            // retval.append(hpFrom).append(":");
            if (from.hasTag())
                retval.append(from.getTag()).append("-");
            // String hpTo = to.getUserAtHostPort();
View Full Code Here

        }
        Via via = lp.getViaHeader();

        From from = new From();
        from.setAddress(this.getLocalParty());
        To to = new To();
        to.setAddress(this.getRemoteParty());
        SIPRequest sipRequest = createRequest(sipUri, via, cseq, from, to);

        /*
         * The default contact header is obtained from the provider. The
         * application can override this.
         *
         * JvB: Should only do this for target refresh requests, ie not for BYE,
         * PRACK, etc
         */

        if (SIPRequest.isTargetRefresh(method)) {
            ContactHeader contactHeader = ((ListeningPointImpl) this.sipProvider
                    .getListeningPoint(lp.getTransport()))
                    .createContactHeader();

            ((SipURI) contactHeader.getAddress().getURI()).setSecure(this
                    .isSecure());
            sipRequest.setHeader(contactHeader);
        }

        try {
            /*
             * Guess of local sequence number - this is being re-set when the
             * request is actually dispatched
             */
            cseq = (CSeq) sipRequest.getCSeq();
            cseq.setSeqNumber(this.localSequenceNumber + 1);

        } catch (InvalidArgumentException ex) {
            InternalErrorHandler.handleException(ex);
        }

        if (method.equals(Request.SUBSCRIBE)) {

            if (eventHeader != null)
                sipRequest.addHeader(eventHeader);

        }

        /*
         * RFC3261, section 12.2.1.1:
         *
         * The URI in the To field of the request MUST be set to the remote URI
         * from the dialog state. The tag in the To header field of the request
         * MUST be set to the remote tag of the dialog ID. The From URI of the
         * request MUST be set to the local URI from the dialog state. The tag
         * in the From header field of the request MUST be set to the local tag
         * of the dialog ID. If the value of the remote or local tags is null,
         * the tag parameter MUST be omitted from the To or From header fields,
         * respectively.
         */

        try {
            if (this.getLocalTag() != null) {
                from.setTag(this.getLocalTag());
            } else {
                from.removeTag();
            }
            if (this.getRemoteTag() != null) {
                to.setTag(this.getRemoteTag());
            } else {
                to.removeTag();
            }
        } catch (ParseException ex) {
            InternalErrorHandler.handleException(ex);
        }

View Full Code Here

        // Enable the retransmission filter for the transaction

        ((SIPClientTransaction) clientTransactionId).isMapped = true;

        From from = (From) dialogRequest.getFrom();
        To to = (To) dialogRequest.getTo();

        // Caller already did the tag assignment -- check to see if the
        // tag assignment is OK.
        if (this.getLocalTag() != null && from.getTag() != null
                && !from.getTag().equals(this.getLocalTag()))
            throw new SipException("From tag mismatch expecting  "
                    + this.getLocalTag());

        if (this.getRemoteTag() != null && to.getTag() != null
                && !to.getTag().equals(this.getRemoteTag())) {
            if (logger.isLoggingEnabled())
                this.logger.logWarning(
                        "To header tag mismatch expecting "
                                + this.getRemoteTag());
        }
        /*
         * The application is sending a NOTIFY before sending the response of
         * the dialog.
         */
        if (this.getLocalTag() == null
                && dialogRequest.getMethod().equals(Request.NOTIFY)) {
            if (!this.getMethod().equals(Request.SUBSCRIBE))
                throw new SipException(
                        "Trying to send NOTIFY without SUBSCRIBE Dialog!");
            this.setLocalTag(from.getTag());

        }

        try {
            if (this.getLocalTag() != null)
                from.setTag(this.getLocalTag());
            if (this.getRemoteTag() != null)
                to.setTag(this.getRemoteTag());

        } catch (ParseException ex) {

            InternalErrorHandler.handleException(ex);

View Full Code Here

            sipRequest.setVia(vias);
            From from = new From();
            from.setAddress(this.getLocalParty());
            from.setTag(this.myTag);
            sipRequest.setFrom(from);
            To to = new To();
            to.setAddress(this.getRemoteParty());
            if (hisTag != null)
                to.setTag(this.hisTag);
            sipRequest.setTo(to);
            sipRequest.setMaxForwards(new MaxForwards(70));

            if (this.originalRequest != null) {
                Authorization authorization = this.originalRequest
View Full Code Here

        }
        Via via = lp.getViaHeader();

        From from = new From();
        from.setAddress(this.localParty);
        To to = new To();
        to.setAddress(this.remoteParty);
        SIPRequest sipRequest = sipResponse.createRequest(sipUri, via, cseq, from, to);

        /*
         * The default contact header is obtained from the provider. The application can override
         * this.
         *
         * JvB: Should only do this for target refresh requests, ie not for BYE, PRACK, etc
         */

        if (SIPRequest.isTargetRefresh(method)) {
            ContactHeader contactHeader = ((ListeningPointImpl) this.sipProvider
                    .getListeningPoint(lp.getTransport())).createContactHeader();

            ((SipURI) contactHeader.getAddress().getURI()).setSecure(this.isSecure());
            sipRequest.setHeader(contactHeader);
        }

        try {
            /*
             * Guess of local sequence number - this is being re-set when the request is actually
             * dispatched
             */
            cseq = (CSeq) sipRequest.getCSeq();
            cseq.setSeqNumber(this.localSequenceNumber + 1);

        } catch (InvalidArgumentException ex) {
            InternalErrorHandler.handleException(ex);
        }

        if (method.equals(Request.SUBSCRIBE)) {

            if (eventHeader != null)
                sipRequest.addHeader(eventHeader);

        }

        /*
         * RFC3261, section 12.2.1.1:
         *
         * The URI in the To field of the request MUST be set to the remote URI from the dialog
         * state. The tag in the To header field of the request MUST be set to the remote tag of
         * the dialog ID. The From URI of the request MUST be set to the local URI from the dialog
         * state. The tag in the From header field of the request MUST be set to the local tag of
         * the dialog ID. If the value of the remote or local tags is null, the tag parameter MUST
         * be omitted from the To or From header fields, respectively.
         */

        try {
            if (this.getLocalTag() != null) {
                from.setTag(this.getLocalTag());
            } else {
                from.removeTag();
            }
            if (this.getRemoteTag() != null) {
                to.setTag(this.getRemoteTag());
            } else {
                to.removeTag();
            }
        } catch (ParseException ex) {
            InternalErrorHandler.handleException(ex);
        }

View Full Code Here

TOP

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

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.