@Override
	protected void doBye(SipServletRequest request) throws ServletException,IOException {
		
		
		if (logger.isInfoEnabled()) {
			logger.info("Got BYE: " + request.toString());
		}
		
		// We forward the BYE
		B2buaHelper byeHelper = request.getB2buaHelper();
		SipSession linkedSipSession = byeHelper.getLinkedSession(request.getSession());
		String linkedSipSessionInviteAttribute = (String) linkedSipSession.getAttribute("INVITE");
		String sipSessionInviteAttribute = (String) request.getSession().getAttribute("INVITE");
		String sipApplicationSessionInviteAttribute = (String) request.getApplicationSession().getAttribute("INVITE");
		
		
		if (logger.isInfoEnabled()) {
			logger.info("Opencall Servlet: attributes previously set in linked sip session INVITE : "
					+ linkedSipSessionInviteAttribute);
			logger.info("Opencall Servlet: attributes previously set in sip session INVITE : "
					+ sipSessionInviteAttribute);
			logger.info("Opencall Servlet: attributes previously set in sip application session INVITE : "
					+ sipApplicationSessionInviteAttribute);
		}

		// we send the OK directly to the first call leg if the attributes have
		// been correctly replicated
		if (sipSessionInviteAttribute == null
				|| sipApplicationSessionInviteAttribute == null
				|| linkedSipSessionInviteAttribute == null
				|| !RECEIVED.equalsIgnoreCase(sipSessionInviteAttribute)
				|| !RECEIVED.equalsIgnoreCase(linkedSipSessionInviteAttribute)
				|| !RECEIVED.equalsIgnoreCase(sipApplicationSessionInviteAttribute)) {
			
			SipServletResponse sipServletResponse = request.createResponse(SipServletResponse.SC_SERVER_INTERNAL_ERROR);
			sipServletResponse.send();
			return;
		}
		
		SipServletResponse sipServletResponse = request.createResponse(SipServletResponse.SC_OK);
		sipServletResponse.send();

		SipSession session = request.getSession();
		SipSession linkedSession = byeHelper.getLinkedSession(session);
		SipServletRequest byeRequest = linkedSession.createRequest("BYE");
		
		if (logger.isInfoEnabled()) {
			logger.info("forkedRequest = " + byeRequest);
		}
		byeRequest.send();
		helper = byeHelper;
	}