/** Done with treatments for call end, now terminate the call */ public void terminateCall() { if (receivedBye == false) { if (gotOk == false || (getState() == CallState.INVITED && callAnswered == false)) { try { Logger.writeFile("Call " + cp + ": sendCancel"); sipUtil.sendCancel(clientTransaction); } catch (Exception e) { Logger.println("sendCancel " + e.getMessage()); } } else { /* * Try sending a BYE as well. * Seems that when we treat SESSION_PROGRESS * as OK, sometimes we need to send a CANCEL * and other times a BYE. We'll send both. */ try { Logger.writeFile("Call " + cp + ": sendBye"); sipUtil.sendBye(clientTransaction); } catch (Exception e) { Logger.println("Call " + cp + ": sendBye" + e.getMessage()); } } } }