/** Handle a answer request */
  public boolean handleAnswerRequest(Interlocutor interlocutor) {

    // cancel call request if no Media Locator
    if (PhoneManager.isUseStaticLocator() && PhoneManager.isUsingMediaLocator()) {
      return false;
    }

    PhoneManager.setUsingMediaLocator(true);

    SessionDescription sdpData = null;
    try {
      sdpData = mediaManager.generateSdpDescription();
      interlocutor.getCall().setLocalSdpDescription(sdpData);
    } catch (MediaException ex) {
      try {
        sipManager.sendServerInternalError(interlocutor.getID());
      } catch (CommunicationsException ex1) {
        Log.error("handleAnswerRequest", ex1);
      }
      return false;
    }
    try {
      sipManager.answerCall(interlocutor.getID(), sdpData.toString());
    } catch (CommunicationsException exc) {
      Log.error("handleAnswerRequest", exc);
      return false;
    }
    return true;
  }
  /** Handle a dial request */
  public void handleDialRequest(String phoneNumber) {
    try {

      System.err.println(
          "Audio Static:"
              + PhoneManager.isUseStaticLocator()
              + " Using:"
              + PhoneManager.isUsingMediaLocator());

      // cancel call request if no Media Locator
      if (PhoneManager.isUseStaticLocator() && PhoneManager.isUsingMediaLocator()) {
        return;
      }

      PhoneManager.setUsingMediaLocator(true);

      SessionDescription sdpData = mediaManager.generateSdpDescription();

      Call call = sipManager.establishCall(phoneNumber, sdpData.toString());

      if (call == null) return;

      call.setLocalSdpDescription(sdpData);

      call.addStateChangeListener(this);
      Interlocutor interlocutor = new Interlocutor();
      interlocutor.setCall(call);

      guiManager.addInterlocutor(interlocutor);
    } catch (Exception e) {
      Log.error("handleDialRequest", e);
    }
  }
 /**
  * Fired when a call is received
  *
  * @param evt CallEvent
  */
 public void callReceived(CallEvent evt) {
   try {
     Call call = evt.getSourceCall();
     Interlocutor interlocutor = new Interlocutor();
     interlocutor.setCall(call);
     guiManager.addInterlocutor(interlocutor);
     call.addStateChangeListener(this);
     // handleAnswerRequest(interlocutor);
   } catch (Exception e) {
     Log.error("callReceived", e);
   }
 }
 /** Handle a hangup request */
 public boolean handleHangupRequest(Interlocutor interlocutor) {
   boolean hangupOk = true;
   try {
     sipManager.endCall(interlocutor.getID());
   } catch (CommunicationsException exc) {
     guiManager.remove(interlocutor);
     hangupOk = false;
     Log.error("handleHangupRequest", exc);
   }
   return hangupOk;
 }