private void startListener() {
   try {
     if (scn != null) scn.close();
     // <i><b>listen to requests on port 5060</b></i>
     scn = (SipConnectionNotifier) Connector.open("sip:5080");
     scn.setListener(this);
   } catch (IOException ex) {
     // <i><b>handle IOException</b></i>
   }
 }
 private void stopListener() {
   try {
     if (scn != null) scn.close();
     scn = null;
   } catch (IOException ex) {
     // <i><b>handle IOException</b></i>
   }
 }
 public void notifyRequest(SipConnectionNotifier sn) {
   try {
     ssc = scn.acceptAndOpen(); // <i><b>blocking</b></i>
     if (ssc.getMethod().equals("BYE")) {
       // <i><b>respond 200 OK to BYE</b></i>
       ssc.initResponse(200);
       ssc.send();
       str = new StringItem("Other side hang-up!", "");
       form.append(str);
     }
     form.append("Closing notifier...");
     form.removeCommand(byeCmd);
     form.addCommand(restartCmd);
     scn.close();
   } catch (IOException ex) {
     // <i><b>handle IOException</b></i>
   }
 }