Package gov.nist.javax.sip.stack

Examples of gov.nist.javax.sip.stack.SIPClientTransaction$ExpiresTimerTask


     */
    if (sipRequest.getMethod().equals(Request.NOTIFY)
        && sipRequest.getFromTag() != null
        && sipRequest.getToTag() == null) {

      SIPClientTransaction ct = sipStack.findSubscribeTransaction(
          sipRequest, (ListeningPointImpl) this.getListeningPoint());
      /* Issue 104 */
      if (ct == null && ! sipStack.deliverUnsolicitedNotify) {
        throw new TransactionUnavailableException(
            "Cannot find matching Subscription (and gov.nist.javax.sip.DELIVER_UNSOLICITED_NOTIFY not set)");
View Full Code Here


      if (sipStack.isDialogCreated(sipRequest.getMethod())) {
        sipStack.putInMergeTable(st, sipRequest);
      }
    } else {

      SIPClientTransaction sipClientTx = (SIPClientTransaction) transaction;

      SIPResponse response = sipClientTx.getLastResponse();

      if (response == null) {
        // A response has not yet been received, then set this up as the
        // default dialog.
        SIPRequest request = (SIPRequest) sipClientTx.getRequest();

        String dialogId = request.getDialogId(false);
        dialog = sipStack.getDialog(dialogId);
        if (dialog != null) {
          throw new SipException("Dialog already exists!");
        } else {
          dialog = sipStack.createDialog(sipTransaction);
        }
        sipClientTx.setDialog(dialog, null);

      } else {
        throw new SipException(
            "Cannot call this method after response is received!");
      }
View Full Code Here

      if (errorObject instanceof SIPServerTransaction) {
        ev = new TimeoutEvent(this, (ServerTransaction) errorObject,
            timeout);
      } else {
          SIPClientTransaction clientTx = (SIPClientTransaction) errorObject;
          Hop hop = clientTx.getNextHop();
          if ( sipStack.getRouter() instanceof RouterExt ) {
              ((RouterExt) sipStack.getRouter()).transactionTimeout(hop);
          }
        ev = new TimeoutEvent(this, (ClientTransaction) errorObject,
            timeout);
      }
      // Handling transport error like timeout
      this.handleEvent(ev, (SIPTransaction) errorObject);
    } else if (transactionErrorEvent.getErrorID() == SIPTransactionErrorEvent.TIMEOUT_ERROR) {
      // This is a timeout event.
      Object errorObject = transactionErrorEvent.getSource();
      Timeout timeout = Timeout.TRANSACTION;
      TimeoutEvent ev = null;

      if (errorObject instanceof SIPServerTransaction) {
        ev = new TimeoutEvent(this, (ServerTransaction) errorObject,
            timeout);
      } else {
          SIPClientTransaction clientTx = (SIPClientTransaction) errorObject;
                Hop hop = clientTx.getNextHop();
                if ( sipStack.getRouter() instanceof RouterExt ) {
                    ((RouterExt) sipStack.getRouter()).transactionTimeout(hop);
                }
           
        ev = new TimeoutEvent(this, (ClientTransaction) errorObject,
View Full Code Here

   
   

    if (request.getMethod().equalsIgnoreCase(Request.CANCEL)) {
      SIPClientTransaction ct = (SIPClientTransaction) sipStack
          .findCancelTransaction((SIPRequest) request, false);
      if (ct != null) {
        ClientTransaction retval = sipStack.createClientTransaction(
            (SIPRequest) request, ct.getMessageChannel());

        ((SIPTransaction) retval).addEventListener(this);
        sipStack.addTransaction((SIPClientTransaction) retval);
        if (ct.getDialog() != null) {
          ((SIPClientTransaction) retval).setDialog((SIPDialog) ct
              .getDialog(), sipRequest.getDialogId(false));

        }
        return retval;
      }

    }
    if (sipStack.isLoggingEnabled())
      sipStack.getLogWriter().logDebug(
          "could not find existing transaction for "
              + ((SIPRequest) request).getFirstLine()
              + " creating a new one ");

    // Could not find a dialog or the route is not set in dialog.

    Hop hop = null;
    try {
      hop = sipStack.getNextHop((SIPRequest) request);
      if (hop == null)
        throw new TransactionUnavailableException(
            "Cannot resolve next hop -- transaction unavailable");
    } catch (SipException ex) {
      throw new TransactionUnavailableException(
          "Cannot resolve next hop -- transaction unavailable", ex);
    }
    String transport = hop.getTransport();
        ListeningPointImpl listeningPoint = (ListeningPointImpl) this
                .getListeningPoint(transport);
       
    String dialogId = sipRequest.getDialogId(false);
    SIPDialog dialog = sipStack.getDialog(dialogId);
    if (dialog != null && dialog.getState() == DialogState.TERMINATED) {

      // throw new TransactionUnavailableException
      // ("Found a terminated dialog -- possible re-use of old tag
      // parameters");
      sipStack.removeDialog(dialog);

    }

    // An out of dialog route was found. Assign this to the
    // client transaction.

    try {
      // Set the brannch id before you ask for a tx.
      // If the user has set his own branch Id and the
      // branch id starts with a valid prefix, then take it.
      // otherwise, generate one.
      String branchId = null;
      if (sipRequest.getTopmostVia().getBranch() == null
          || !sipRequest.getTopmostVia().getBranch().startsWith(
              SIPConstants.BRANCH_MAGIC_COOKIE)) {
        branchId = Utils.getInstance().generateBranchId();

        sipRequest.getTopmostVia().setBranch(branchId);
      }
      Via topmostVia = sipRequest.getTopmostVia();
          topmostVia.setTransport(transport);
          topmostVia.setPort(listeningPoint.getPort());
      branchId = sipRequest.getTopmostVia().getBranch();
     
      SIPClientTransaction ct = (SIPClientTransaction) sipStack
          .createMessageChannel(sipRequest, listeningPoint
              .getMessageProcessor(), hop);
      if (ct == null)
        throw new TransactionUnavailableException("Cound not create tx");
      ct.setNextHop(hop);
      ct.setOriginalRequest(sipRequest);
      ct.setBranch(branchId);
      // if the stack supports dialogs then
      if (sipStack.isDialogCreated(request.getMethod())) {
        // create a new dialog to contain this transaction
        // provided this is necessary.
        // This could be a re-invite
        // in which case the dialog is re-used.
        // (but noticed by Brad Templeton)
        if (dialog != null)
          ct.setDialog(dialog, sipRequest.getDialogId(false));
        else if (this.isAutomaticDialogSupportEnabled()) {
          SIPDialog sipDialog = sipStack.createDialog(ct);
          ct.setDialog(sipDialog, sipRequest.getDialogId(false));
        }
      } else {
        if (dialog != null) {
          ct.setDialog(dialog, sipRequest.getDialogId(false));
        }

      }

      // The provider is the event listener for all transactions.
      ct.addEventListener(this);
      return (ClientTransaction) ct;
    } catch (IOException ex) {

      throw new TransactionUnavailableException(
          "Could not resolve next hop or listening point unavailable! ",
View Full Code Here

     
     
     
     
      if (sipRequest.getMethod().equalsIgnoreCase(Request.CANCEL)) {
        SIPClientTransaction ct = (SIPClientTransaction) sipStack
          .findCancelTransaction((SIPRequest) sipRequest, false);
        if (ct != null) {
          SIPClientTransaction retval = sipStack.createClientTransaction(sipRequest, ct.getMessageChannel());
         
          ((SIPTransaction) retval).addEventListener(this);
          sipStack.addTransaction( retval);
          if (ct.getDialog() != null) {
              retval.setDialog((SIPDialog) ct.getDialog(), sipRequest.getDialogId(false));
           
          }
          return retval;
        }
       
      }
      if (logger.isLoggingEnabled(LogLevels.TRACE_DEBUG))
        logger.logDebug(
                        "could not find existing transaction for "
                          + sipRequest.getFirstLine()
                          + " creating a new one ");
     
      // Could not find a dialog or the route is not set in dialog.
     
      String transport = hop.getTransport();
      ListeningPointImpl listeningPoint = (ListeningPointImpl) this
        .getListeningPoint(transport);
     
      String dialogId = sipRequest.getDialogId(false);
      SIPDialog dialog = sipStack.getDialog(dialogId);
      if (dialog != null && dialog.getState() == DialogState.TERMINATED) {
       
        // throw new TransactionUnavailableException
        // ("Found a terminated dialog -- possible re-use of old tag
        // parameters");
        sipStack.removeDialog(dialog);
       
      }
     
      // An out of dialog route was found. Assign this to the
      // client transaction.
     
      try {
        // Set the brannch id before you ask for a tx.
        // If the user has set his own branch Id and the
        // branch id starts with a valid prefix, then take it.
        // otherwise, generate one. If branch ID checking has
        // been requested, set the branch ID.
        String branchId = null;
        if (sipRequest.getTopmostVia().getBranch() == null
          || !sipRequest.getTopmostVia().getBranch().startsWith(
                                                                SIPConstants.BRANCH_MAGIC_COOKIE)
                                                                || sipStack.checkBranchId() ) {
          branchId = Utils.getInstance().generateBranchId();
         
          sipRequest.getTopmostVia().setBranch(branchId);
        }
        Via topmostVia = sipRequest.getTopmostVia();
       
        //set port and transport if user hasn't already done this.
        if(topmostVia.getTransport() == null)
          topmostVia.setTransport(transport);
       
        if(topmostVia.getPort() == -1)
          topmostVia.setPort(listeningPoint.getPort());
        branchId = sipRequest.getTopmostVia().getBranch();
       
         MessageChannel messageChannel = sipStack
            .createMessageChannel(sipRequest, listeningPoint
                                .getMessageProcessor(), hop);
         SIPClientTransaction ct = sipStack.createClientTransaction(sipRequest, messageChannel);
        if (ct == null)
          throw new TransactionUnavailableException("Cound not create tx");
        ct.setNextHop(hop);
        ct.setOriginalRequest(sipRequest);
        ct.setBranch(branchId);
        // if the stack supports dialogs then
        if (SIPTransactionStack.isDialogCreated(sipRequest.getMethod())) {
          // create a new dialog to contain this transaction
          // provided this is necessary.
          // This could be a re-invite
          // in which case the dialog is re-used.
          // (but noticed by Brad Templeton)
          if (dialog != null)
            ct.setDialog(dialog, sipRequest.getDialogId(false));
          else if (this.isAutomaticDialogSupportEnabled()) {
            SIPDialog sipDialog = sipStack.createDialog(ct);
            ct.setDialog(sipDialog, sipRequest.getDialogId(false));
          }
        } else {
          if (dialog != null) {
            ct.setDialog(dialog, sipRequest.getDialogId(false));
          }
         
        }
       
        // The provider is the event listener for all transactions.
        ct.addEventListener(this);
        return ct;
      } catch (IOException ex) {
       
        throw new TransactionUnavailableException(
                                                  "Could not resolve next hop or listening point unavailable! ",
View Full Code Here

                      "Cannot resolve next hop -- transaction unavailable");
      } catch (SipException ex) {
          throw new TransactionUnavailableException(
                  "Cannot resolve next hop -- transaction unavailable", ex);
      }
      SIPClientTransaction newClientTransaction = createClientTransaction(request, hop);
      sipStack.addTransaction(newClientTransaction);
      return newClientTransaction;
    }
View Full Code Here

         */
        if (sipRequest.getMethod().equals(Request.NOTIFY)
                && sipRequest.getFromTag() != null
                && sipRequest.getToTag() == null) {

            SIPClientTransaction ct = sipStack.findSubscribeTransaction(
                    sipRequest, (ListeningPointImpl) this.getListeningPoint());
            /* Issue 104 */
            if (ct == null && ! sipStack.isDeliverUnsolicitedNotify()) {
                throw new TransactionUnavailableException(
                        "Cannot find matching Subscription (and gov.nist.javax.sip.DELIVER_UNSOLICITED_NOTIFY not set)");
View Full Code Here

            if (sipRequest.getMethod().equals(Request.INVITE) && this.isDialogErrorsAutomaticallyHandled()) {
                sipStack.putInMergeTable(st, sipRequest);
            }
        } else {

            SIPClientTransaction sipClientTx = (SIPClientTransaction) transaction;

            SIPResponse response = sipClientTx.getLastResponse();

            if (response == null) {
                // A response has not yet been received, then set this up as the
                // default dialog.
                SIPRequest request = (SIPRequest) sipClientTx.getRequest();

                String dialogId = request.getDialogId(false);
                dialog = sipStack.getDialog(dialogId);
                if (dialog != null) {
                    throw new SipException("Dialog already exists!");
                } else {
                    dialog = sipStack.createDialog(sipTransaction);
                }
                sipClientTx.setDialog(dialog, null);

            } else {
                throw new SipException(
                        "Cannot call this method after response is received!");
            }
View Full Code Here

            if (errorObject instanceof SIPServerTransaction) {
                ev = new TimeoutEvent(this, (ServerTransaction) errorObject,
                        timeout);
            } else {
                SIPClientTransaction clientTx = (SIPClientTransaction) errorObject;
                Hop hop = clientTx.getNextHop();
                if ( sipStack.getRouter() instanceof RouterExt ) {
                    ((RouterExt) sipStack.getRouter()).transactionTimeout(hop);
                }
                ev = new TimeoutEvent(this, (ClientTransaction) errorObject,
                        timeout);
            }
            // Handling transport error like timeout
            this.handleEvent(ev, (SIPTransaction) errorObject);
        } else if (transactionErrorEvent.getErrorID() == SIPTransactionErrorEvent.TIMEOUT_ERROR) {
            // This is a timeout event.
            Object errorObject = transactionErrorEvent.getSource();
            Timeout timeout = Timeout.TRANSACTION;
            TimeoutEvent ev = null;

            if (errorObject instanceof SIPServerTransaction) {
                ev = new TimeoutEvent(this, (ServerTransaction) errorObject,
                        timeout);
            } else {
                SIPClientTransaction clientTx = (SIPClientTransaction) errorObject;
                Hop hop = clientTx.getNextHop();
                if ( sipStack.getRouter() instanceof RouterExt ) {
                    ((RouterExt) sipStack.getRouter()).transactionTimeout(hop);
                }

                ev = new TimeoutEvent(this, (ClientTransaction) errorObject,
View Full Code Here




        if (request.getMethod().equalsIgnoreCase(Request.CANCEL)) {
            SIPClientTransaction ct = (SIPClientTransaction) sipStack
                    .findCancelTransaction((SIPRequest) request, false);
            if (ct != null) {
                ClientTransaction retval = sipStack.createClientTransaction(
                        (SIPRequest) request, ct.getMessageChannel());

                ((SIPTransaction) retval).addEventListener(this);
                sipStack.addTransaction((SIPClientTransaction) retval);
                if (ct.getDialog() != null) {
                    ((SIPClientTransaction) retval).setDialog((SIPDialog) ct
                            .getDialog(), sipRequest.getDialogId(false));

                }
                return retval;
            }

        }
        if (sipStack.isLoggingEnabled())
            sipStack.getStackLogger().logDebug(
                    "could not find existing transaction for "
                            + ((SIPRequest) request).getFirstLine()
                            + " creating a new one ");

        // Could not find a dialog or the route is not set in dialog.

        Hop hop = null;
        try {
            hop = sipStack.getNextHop((SIPRequest) request);
            if (hop == null)
                throw new TransactionUnavailableException(
                        "Cannot resolve next hop -- transaction unavailable");
        } catch (SipException ex) {
            throw new TransactionUnavailableException(
                    "Cannot resolve next hop -- transaction unavailable", ex);
        }
        String transport = hop.getTransport();
        ListeningPointImpl listeningPoint = (ListeningPointImpl) this
                .getListeningPoint(transport);

        String dialogId = sipRequest.getDialogId(false);
        SIPDialog dialog = sipStack.getDialog(dialogId);
        if (dialog != null && dialog.getState() == DialogState.TERMINATED) {

            // throw new TransactionUnavailableException
            // ("Found a terminated dialog -- possible re-use of old tag
            // parameters");
            sipStack.removeDialog(dialog);

        }

        // An out of dialog route was found. Assign this to the
        // client transaction.

        try {
            // Set the brannch id before you ask for a tx.
            // If the user has set his own branch Id and the
            // branch id starts with a valid prefix, then take it.
            // otherwise, generate one. If branch ID checking has
            // been requested, set the branch ID.
            String branchId = null;
            if (sipRequest.getTopmostVia().getBranch() == null
                    || !sipRequest.getTopmostVia().getBranch().startsWith(
                            SIPConstants.BRANCH_MAGIC_COOKIE)
                            || sipStack.checkBranchId() ) {
                branchId = Utils.getInstance().generateBranchId();

                sipRequest.getTopmostVia().setBranch(branchId);
            }
            Via topmostVia = sipRequest.getTopmostVia();

            //set port and transport if user hasn't already done this.
            if(topmostVia.getTransport() == null)
                topmostVia.setTransport(transport);

            if(topmostVia.getPort() == -1)
                topmostVia.setPort(listeningPoint.getPort());
            branchId = sipRequest.getTopmostVia().getBranch();

            SIPClientTransaction ct = (SIPClientTransaction) sipStack
                    .createMessageChannel(sipRequest, listeningPoint
                            .getMessageProcessor(), hop);
            if (ct == null)
                throw new TransactionUnavailableException("Cound not create tx");
            ct.setNextHop(hop);
            ct.setOriginalRequest(sipRequest);
            ct.setBranch(branchId);
            // if the stack supports dialogs then
            if (sipStack.isDialogCreated(request.getMethod())) {
                // create a new dialog to contain this transaction
                // provided this is necessary.
                // This could be a re-invite
                // in which case the dialog is re-used.
                // (but noticed by Brad Templeton)
                if (dialog != null)
                    ct.setDialog(dialog, sipRequest.getDialogId(false));
                else if (this.isAutomaticDialogSupportEnabled()) {
                    SIPDialog sipDialog = sipStack.createDialog(ct);
                    ct.setDialog(sipDialog, sipRequest.getDialogId(false));
                }
            } else {
                if (dialog != null) {
                    ct.setDialog(dialog, sipRequest.getDialogId(false));
                }

            }

            // The provider is the event listener for all transactions.
            ct.addEventListener(this);
            return (ClientTransaction) ct;
        } catch (IOException ex) {

            throw new TransactionUnavailableException(
                    "Could not resolve next hop or listening point unavailable! ",
View Full Code Here

TOP

Related Classes of gov.nist.javax.sip.stack.SIPClientTransaction$ExpiresTimerTask

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.