/**
   * 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;
  }
 /**
  * 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 processDialogTerminated(DialogTerminatedEvent event) {
   try {
     ProtocolProviderServiceSipImpl recipient =
         (ProtocolProviderServiceSipImpl)
             SipApplicationData.getApplicationData(
                 event.getDialog(), SipApplicationData.KEY_SERVICE);
     if (recipient == null) {
       logger.error(
           "Dialog wasn't marked, please report this to " + "*****@*****.**");
     } else {
       if (logger.isTraceEnabled()) logger.trace("service was found with dialog data");
       recipient.processDialogTerminated(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);
   }
 }