@Override
protected void doBye(SipServletRequest bye) throws ServletException,
IOException {
log("doBye");
bye.createResponse(SipServletResponse.SC_OK).send();
SipApplicationSession sipApplicationSession =
bye.getApplicationSession();
Player player = (Player)sipApplicationSession.getAttribute(
Player.class.getName());
player.stop();
ServletContext servletContext = getServletContext();
Map<Integer, Recorder> recorders = (Map<Integer, Recorder>)
servletContext.getAttribute(Recorder.class.getName());
Recorder recorder = recorders.get(player.getLocalPort());
recorder.stop();
recorders.remove(player.getLocalPort());
bye.getSession().invalidate();
sipApplicationSession.invalidate();
}