@Override protected void doErrorResponse(SipServletResponse resp) throws ServletException, IOException { // If someone rejects it remove the call from the table CallStatusContainer calls = (CallStatusContainer) getServletContext().getAttribute("activeCalls"); calls.removeCall(resp.getFrom().getURI().toString(), resp.getTo().getURI().toString()); calls.removeCall(resp.getTo().getURI().toString(), resp.getFrom().getURI().toString()); }
@Override protected void doBye(SipServletRequest request) throws ServletException, IOException { logger.info("Got bye"); SipSession session = request.getSession(); SipSession linkedSession = (SipSession) session.getAttribute("LinkedSession"); if (linkedSession != null) { SipServletRequest bye = linkedSession.createRequest("BYE"); logger.info("Sending bye to " + linkedSession.getRemoteParty()); bye.send(); } CallStatusContainer calls = (CallStatusContainer) getServletContext().getAttribute("activeCalls"); calls.removeCall(request.getFrom().getURI().toString(), request.getTo().getURI().toString()); calls.removeCall(request.getTo().getURI().toString(), request.getFrom().getURI().toString()); SipServletResponse ok = request.createResponse(SipServletResponse.SC_OK); ok.send(); }