Esempio n. 1
0
  /**
   * Retrieves and returns that ProtocolProviderService that this transaction belongs to, or
   * <tt>null</tt> if we couldn't associate it with a provider based on neither the request nor the
   * transaction itself.
   *
   * @param transaction the transaction that we'd like to determine a provider for.
   * @return a reference to the <tt>ProtocolProviderServiceSipImpl</tt> that <tt>transaction</tt>
   *     was associated with or <tt>null</tt> if we couldn't determine which one it is.
   */
  private ProtocolProviderServiceSipImpl getServiceData(Transaction transaction) {
    ProtocolProviderServiceSipImpl service =
        (ProtocolProviderServiceSipImpl)
            SipApplicationData.getApplicationData(
                transaction.getRequest(), SipApplicationData.KEY_SERVICE);

    if (service != null) {
      if (logger.isTraceEnabled()) logger.trace("service was found in request data");
      return service;
    }

    service =
        (ProtocolProviderServiceSipImpl)
            SipApplicationData.getApplicationData(
                transaction.getDialog(), SipApplicationData.KEY_SERVICE);
    if (service != null) {
      if (logger.isTraceEnabled()) logger.trace("service was found in dialog data");
    }

    return service;
  }
Esempio n. 2
0
  public void processResponse(ResponseEvent responseReceivedEvent) {
    // System.out.println("Got a response");
    Response response = (Response) responseReceivedEvent.getResponse();
    Transaction tid = responseReceivedEvent.getClientTransaction();

    // System.out.println("Response received with client transaction id "
    // + tid + ":\n" + response);

    try {
      if (response.getStatusCode() == Response.OK
          && ((CSeqHeader) response.getHeader(CSeqHeader.NAME))
              .getMethod()
              .equals(Request.INVITE)) {

        Dialog dialog = tid.getDialog();
        Request request = tid.getRequest();
        dialog.sendAck(request);
      }

    } catch (Exception ex) {
      ex.printStackTrace();
      System.exit(0);
    }
  }