/**
   * Fired when softphone is unregistering
   *
   * @param evt RegistrationEvent
   */
  public void unregistering(RegistrationEvent evt) {
    status = SipRegisterStatus.Unregistered;

    registerStatusChanged(
        new RegisterEvent(this, SipRegisterStatus.Unregistering, evt.getReason()));

    int waitUnreg = SIPConfig.getWaitUnregistration();
    if (waitUnreg != -1) {
      try {
        int delay = waitUnreg;
        // we get here through a _synchronous_ call from shutdown so
        // let's try
        // and wait for unregistrations confirmation in case the
        // registrar has requested authorization
        // before conriming unregistration
        if (delay > 0)
          synchronized (unregistrationLock) {
            unregistrationLock.wait(delay);
          }
      } catch (InterruptedException ex) {
        Log.error("unregistering", ex);
      } catch (NumberFormatException ex) {
        Log.error("unregistering", ex);
      }
    }
  }
  /**
   * Fired when softphone is register sucessfully
   *
   * @param evt RegistrationEvent
   */
  public void registered(RegistrationEvent evt) {
    status = SipRegisterStatus.Registered;

    preferences.setPreferredAddress(NetworkAddressManager.getLocalHost().getHostAddress());
    // preference.commit();

    registerStatusChanged(new RegisterEvent(this, SipRegisterStatus.Registered, evt.getReason()));

    if (callTo.length() > 2) {
      handleDialRequest(callTo);
    }
    registerMenu.setSelected(true);
  }
  /**
   * Fired when softphone is unregistered sucessfully
   *
   * @param evt RegistrationEvent
   */
  public void unregistered(RegistrationEvent evt) {
    try {
      status = SipRegisterStatus.Unregistered;

      registerStatusChanged(
          new RegisterEvent(this, SipRegisterStatus.Unregistered, evt.getReason()));

      // we could now exit
      synchronized (unregistrationLock) {
        unregistrationLock.notifyAll();
      }

      destroySoftPhone();
      registerMenu.setSelected(false);
    } catch (Exception e) {
      Log.error("unregistered", e);
    }
  }
 /**
  * Fired when softphone is registering
  *
  * @param evt RegistrationEvent
  */
 public void registering(RegistrationEvent evt) {
   status = SipRegisterStatus.Registering;
   registerStatusChanged(new RegisterEvent(this, SipRegisterStatus.Registering, evt.getReason()));
 }
 public void registrationFailed(RegistrationEvent evt) {
   status = SipRegisterStatus.RegistrationFailed;
   registerStatusChanged(
       new RegisterEvent(this, SipRegisterStatus.RegistrationFailed, evt.getReason()));
   registerMenu.setSelected(false);
 }