/** end session with BYE */
 private void sendBYE() {
   if (dialog != null) {
     try {
       SipClientConnection sc = dialog.getNewClientConnection("BYE");
       sc.send();
       str = new StringItem("user hang-up: ", "BYE sent...");
       form.append(str);
       boolean gotit = sc.receive(10000);
       if (gotit) {
         if (sc.getStatusCode() == 200) {
           form.append("Session closed successfully...");
           form.append("Dialog state: " + dialog.getState());
         } else form.append("Error: " + sc.getReasonPhrase());
       }
       sc.close();
     } catch (IOException iox) {
       form.append("Exception: " + iox.getMessage());
     }
   } else {
     form.append("No dialog information!");
   }
 }