/**
   * New SIP instant message received
   *
   * @param intent Resolved intent
   */
  public void handleSipInstantMessageReceived(Intent intent) {
    if (logger.isActivated()) {
      logger.debug("Handle event receive SIP instant message");
    }

    // Broadcast the message
    sipApi.receiveSipInstantMessage(intent);
  }
  /**
   * New SIP session invitation
   *
   * @param intent Resolved intent
   * @param session SIP session
   */
  public void handleSipSessionInvitation(Intent intent, GenericSipSession session) {
    if (logger.isActivated()) {
      logger.debug("Handle event receive SIP session invitation");
    }

    // Broadcast the invitation
    sipApi.receiveSipSessionInvitation(intent, session);
  }
  @Override
  public void onDestroy() {
    // Unregister account changed broadcast receiver
    if (accountChangedReceiver != null) {
      try {
        unregisterReceiver(accountChangedReceiver);
      } catch (IllegalArgumentException e) {
        // Nothing to do
      }
    }

    // Unregister SMS receiver for network initiated configuration
    if (reconfSMSReceiver != null) {
      try {
        reconfSMSReceiver.unregisterSmsProvisioningReceiver();
      } catch (IllegalArgumentException e) {
        // Nothing to do
      }
    }

    // Close APIs
    imsApi.close();
    termsApi.close();
    presenceApi.close();
    capabilityApi.close();
    richcallApi.close();
    ipcallApi.close();
    messagingApi.close();
    sipApi.close();

    // Stop the core
    Thread t =
        new Thread() {
          /** Processing */
          public void run() {
            stopCore();
          }
        };
    t.start();
  }