Пример #1
0
  /**
   * Dispatches the event received from a JAIN-SIP <tt>SipProvider</tt> to one of our "candidate
   * recipient" listeners.
   *
   * @param event the event received for a <tt>SipProvider</tt>.
   */
  public void processTimeout(TimeoutEvent event) {
    try {
      Transaction transaction;
      if (event.isServerTransaction()) {
        transaction = event.getServerTransaction();
      } else {
        transaction = event.getClientTransaction();
      }

      ProtocolProviderServiceSipImpl recipient = getServiceData(transaction);
      if (recipient == null) {
        logger.error(
            "We received a timeout which wasn't "
                + "marked, please report this to "
                + "*****@*****.**");
      } else {
        recipient.processTimeout(event);
      }
    } catch (Throwable exc) {
      // any exception thrown within our code should be caught here
      // so that we could log it rather than interrupt stack activity with
      // it.
      this.logApplicationException(DialogTerminatedEvent.class, exc);
    }
  }
 public void processTimeout(javax.sip.TimeoutEvent timeoutEvent) {
   Transaction transaction;
   if (timeoutEvent.isServerTransaction()) {
     transaction = timeoutEvent.getServerTransaction();
   } else {
     transaction = timeoutEvent.getClientTransaction();
   }
   System.out.println("state = " + transaction.getState());
   System.out.println("dialog = " + transaction.getDialog());
   System.out.println("dialogState = " + transaction.getDialog().getState());
   System.out.println("Transaction Time out");
 }
Пример #3
0
 /** JAIN Listener method. */
 public void processTimeout(TimeoutEvent timeOutEvent) {
   ProxyDebug.println("TimeoutEvent received");
   SipProvider sipProvider = (SipProvider) timeOutEvent.getSource();
   TransactionsMapping transactionsMapping = null;
   if (timeOutEvent.isServerTransaction()) {
     ServerTransaction serverTransaction = timeOutEvent.getServerTransaction();
     Dialog dialog = serverTransaction.getDialog();
     if (dialog != null) {
       transactionsMapping = (TransactionsMapping) dialog.getApplicationData();
       transactionsMapping.removeMapping(serverTransaction);
     }
   } else {
     ClientTransaction clientTransaction = timeOutEvent.getClientTransaction();
     Dialog dialog = clientTransaction.getDialog();
     ServerTransaction st = null;
     if (dialog != null) {
       transactionsMapping = (TransactionsMapping) dialog.getApplicationData();
       if (transactionsMapping != null) {
         st = transactionsMapping.getServerTransaction(clientTransaction);
       }
       if (st == null) {
         ProxyDebug.println(
             "ERROR, Unable to retrieve the server transaction," + " cannot process timeout!");
         return;
       }
     } else {
       ProxyDebug.println(
           "ERROR, Unable to retrieve the transaction Mapping," + " cannot process timeout!");
       return;
     }
     Request request = st.getRequest();
     // This removes the given mapping from the table but not
     // necessarily the whole thing.
     transactionsMapping.removeMapping(clientTransaction);
     if (!transactionsMapping.hasMapping(st)) {
       // No more mappings left in the transaction table.
       try {
         Response response = messageFactory.createResponse(Response.REQUEST_TIMEOUT, request);
         st.sendResponse(response);
       } catch (ParseException ex) {
         ex.printStackTrace();
       } catch (SipException ex1) {
         ex1.printStackTrace();
       }
     }
   }
 }
    public void processTimeout(javax.sip.TimeoutEvent timeoutEvent) {

      System.out.println("Got a timeout " + timeoutEvent.getClientTransaction());

      this.timeoutRecieved = true;
    }
 public void processTimeout(TimeoutEvent timeoutEvent) {
   System.out.println(myName + " :  " + timeoutEvent.getTimeout());
   // System.out.println(">>Timeout:" + timeoutEvent.getClientTransaction().getRequest());
   // System.out.println(">>Timeout:" + timeoutEvent.getServerTransaction().getRequest());
 }
    @Override
    public boolean processTimeout(TimeoutEvent timeoutEvent) {
      synchronized (messageProcessors) {
        for (SipMessageProcessor listener : messageProcessors)
          if (!listener.processTimeout(timeoutEvent, sentMsg)) return true;
      }

      // this is normaly handled by the SIP stack
      logger.error("Timeout event thrown : " + timeoutEvent.toString());

      if (timeoutEvent.isServerTransaction()) {
        logger.warn("The sender has probably not received our OK");
        return false;
      }

      Request req = timeoutEvent.getClientTransaction().getRequest();

      // get the content
      String content = null;
      try {
        content = new String(req.getRawContent(), getCharset(req));
      } catch (UnsupportedEncodingException ex) {
        logger.warn("failed to convert the message charset", ex);
        content = new String(req.getRawContent());
      }

      // to who this request has been sent ?
      ToHeader toHeader = (ToHeader) req.getHeader(ToHeader.NAME);

      if (toHeader == null) {
        logger.error("received a request without a to header");
        return false;
      }

      Contact to = opSetPersPresence.resolveContactID(toHeader.getAddress().getURI().toString());

      Message failedMessage = null;

      if (to == null) {
        logger.error(
            "timeout on a message sent to an unknown contact : "
                + toHeader.getAddress().getURI().toString());

        // we don't know what message it concerns, so create a new
        // one
        failedMessage = createMessage(content);
      } else {
        // try to retrieve the original message
        String key = ((CallIdHeader) req.getHeader(CallIdHeader.NAME)).getCallId();
        failedMessage = sentMsg.get(key);

        if (failedMessage == null) {
          // should never happen
          logger.error("Couldn't find the sent message.");

          // we don't know what the message is so create a new one
          // based on the content of the failed request.
          failedMessage = createMessage(content);
        }
      }

      // error for delivering the message
      fireMessageDeliveryFailed(
          // we don't know what message it concerns
          failedMessage, to, MessageDeliveryFailedEvent.INTERNAL_ERROR);
      return true;
    }