protected void doBye(SipServletRequest request) throws ServletException,
			IOException {
		if(logger.isInfoEnabled()) {
			logger.info("Distributable Simple Servlet: Got BYE request:\n" + request);
		}
		String sipSessionInviteAttribute  = (String) request.getSession().getAttribute("INVITE");
		String sipApplicationSessionInviteAttribute  = (String) request.getApplicationSession().getAttribute("INVITE");
		String sipSessionReInviteAttribute  = (String) request.getSession().getAttribute("REINVITE");
		String sipApplicationSessionReInviteAttribute  = (String) request.getApplicationSession().getAttribute("REINVITE");
		Object sipSessionActivationListener = request.getSession().getAttribute(SIP_SESSION_ACTIVATION_LISTENER);
		Object sipApplicationSessionActivationListener = request.getApplicationSession().getAttribute(SIP_APP_SESSION_ACTIVATION_LISTENER);
		Object sipSessionActivated = request.getSession().getAttribute(SipSessionActivationListenerAttribute.SIP_SESSION_ACTIVATED);
		Object sipApplicationSessionActivated = request.getApplicationSession().getAttribute(SipApplicationSessionActivationListenerAttribute.SIP_APPLICATION_SESSION_ACTIVATED);
		if(logger.isInfoEnabled()) {			
			logger.info("Distributable Simple Servlet: attributes previously set in sip session INVITE : "+ sipSessionInviteAttribute);
			logger.info("Distributable Simple Servlet: attributes previously set in sip application session INVITE : "+ sipApplicationSessionInviteAttribute);
			logger.info("Distributable Simple Servlet: attributes previously set in sip session REINVITE : "+ sipSessionReInviteAttribute);
			logger.info("Distributable Simple Servlet: attributes previously set in sip application session REINVITE : "+ sipApplicationSessionReInviteAttribute);
			logger.info("Distributable Simple Servlet: attributes previously set in sip session sipSessionActivationListener : "+ sipSessionActivationListener);
			logger.info("Distributable Simple Servlet: attributes previously set in sip application session sipApplciationSessionActivationListener : "+ sipApplicationSessionActivationListener);
			logger.info("Distributable Simple Servlet: attributes previously set in sip session sipSessionActivated : "+ sipSessionActivated);
			logger.info("Distributable Simple Servlet: attributes previously set in sip application session sipApplicationSessionActivated : "+ sipApplicationSessionActivated);
		}
		if(!(((SipURI)request.getFrom().getURI()).getUser()).contains(NO_ATTRIBUTES)) {
			if(sipSessionInviteAttribute != null  && sipApplicationSessionInviteAttribute != null 				
					&& RECEIVED.equalsIgnoreCase(sipSessionInviteAttribute) 
					&& RECEIVED.equalsIgnoreCase(sipApplicationSessionInviteAttribute)) {	
				
				if((((SipURI)request.getTo().getURI()).getUser()).contains(REMOVE_ATTRIBUTES)) {
					if(logger.isInfoEnabled()) {			
						logger.info("Distributable Simple Servlet: checking if isReINVITE present in removeattributes case");
					}
					if(request.getSession().getAttribute("ISREINVITE") !=null) {
						SipServletResponse sipServletResponse = request.createResponse(500, "isReinvite attribute should have been removed");
						sipServletResponse.send();
						return;
					}
				}
				if((((SipURI)request.getFrom().getURI()).getUser()).contains("test-activation")) {
					if(sipApplicationSessionActivationListener != null && sipApplicationSessionActivated == null) {
						SipServletResponse sipServletResponse = request.createResponse(500, "sipApplicationSessionActivationListener not called");
						sipServletResponse.send();
						return;
					}
					if(sipSessionActivationListener != null && sipSessionActivated == null) {
						SipServletResponse sipServletResponse = request.createResponse(500, "sipSessionActivationListener not called");
						sipServletResponse.send();
						return;
					}				
				}
				if(request.getSession().getAttribute("ISREINVITE") !=null && sipSessionReInviteAttribute != null  && sipApplicationSessionReInviteAttribute != null 				
						&& RECEIVED.equalsIgnoreCase(sipSessionReInviteAttribute) 
						&& RECEIVED.equalsIgnoreCase(sipApplicationSessionReInviteAttribute)) {
	//				request.getSession().setAttribute("BYE", RECEIVED);
	//				request.getApplicationSession().setAttribute(" BYE", RECEIVED);
					SipServletResponse sipServletResponse = request.createResponse(200);
					sipServletResponse.send();
					return;
				}
	//			request.getSession().setAttribute("BYE", RECEIVED);
	//			request.getApplicationSession().setAttribute(" BYE", RECEIVED);
				SipServletResponse sipServletResponse = request.createResponse(200);
				sipServletResponse.send();
				return;
			}
			SipServletResponse sipServletResponse = request.createResponse(500);
			sipServletResponse.send();
		} else {
			SipServletResponse sipServletResponse = request.createResponse(200);
			sipServletResponse.send();
		}
	}
protected void doBye ( SipServletRequest request ) throws ServletException , IOException { if ( logger . isInfoEnabled ( ) ) { logger . info ( "Distributable Simple Servlet: Got BYE request:\n" + request ) ; } String sipSessionInviteAttribute = ( String ) request . getSession ( ) . getAttribute ( "INVITE" ) ; String sipApplicationSessionInviteAttribute = ( String ) request . getApplicationSession ( ) . getAttribute ( "INVITE" ) ; String sipSessionReInviteAttribute = ( String ) request . getSession ( ) . getAttribute ( "REINVITE" ) ; String sipApplicationSessionReInviteAttribute = ( String ) request . getApplicationSession ( ) . getAttribute ( "REINVITE" ) ; Object sipSessionActivationListener = request . getSession ( ) . getAttribute ( SIP_SESSION_ACTIVATION_LISTENER ) ; Object sipApplicationSessionActivationListener = request . getApplicationSession ( ) . getAttribute ( SIP_APP_SESSION_ACTIVATION_LISTENER ) ; Object sipSessionActivated = request . getSession ( ) . getAttribute ( SipSessionActivationListenerAttribute . SIP_SESSION_ACTIVATED ) ; Object sipApplicationSessionActivated = request . getApplicationSession ( ) . getAttribute ( SipApplicationSessionActivationListenerAttribute . SIP_APPLICATION_SESSION_ACTIVATED ) ; if ( logger . isInfoEnabled ( ) ) { logger . info ( "Distributable Simple Servlet: attributes previously set in sip session INVITE : " + sipSessionInviteAttribute ) ; logger . info ( "Distributable Simple Servlet: attributes previously set in sip application session INVITE : " + sipApplicationSessionInviteAttribute ) ; logger . info ( "Distributable Simple Servlet: attributes previously set in sip session REINVITE : " + sipSessionReInviteAttribute ) ; logger . info ( "Distributable Simple Servlet: attributes previously set in sip application session REINVITE : " + sipApplicationSessionReInviteAttribute ) ; logger . info ( "Distributable Simple Servlet: attributes previously set in sip session sipSessionActivationListener : " + sipSessionActivationListener ) ; logger . info ( "Distributable Simple Servlet: attributes previously set in sip application session sipApplciationSessionActivationListener : " + sipApplicationSessionActivationListener ) ; logger . info ( "Distributable Simple Servlet: attributes previously set in sip session sipSessionActivated : " + sipSessionActivated ) ; logger . info ( "Distributable Simple Servlet: attributes previously set in sip application session sipApplicationSessionActivated : " + sipApplicationSessionActivated ) ; } if ( ! ( ( ( SipURI ) request . getFrom ( ) . getURI ( ) ) . getUser ( ) ) . contains ( NO_ATTRIBUTES ) ) { if ( sipSessionInviteAttribute != null && sipApplicationSessionInviteAttribute != null && RECEIVED . equalsIgnoreCase ( sipSessionInviteAttribute ) && RECEIVED . equalsIgnoreCase ( sipApplicationSessionInviteAttribute ) ) { if ( ( ( ( SipURI ) request . getTo ( ) . getURI ( ) ) . getUser ( ) ) . contains ( REMOVE_ATTRIBUTES ) ) { if ( logger . isInfoEnabled ( ) ) { logger . info ( "Distributable Simple Servlet: checking if isReINVITE present in removeattributes case" ) ; } if ( request . getSession ( ) . getAttribute ( "ISREINVITE" ) != null ) { SipServletResponse sipServletResponse = request . createResponse ( 500 , "isReinvite attribute should have been removed" ) ; sipServletResponse . send ( ) ; return ; } } if ( ( ( ( SipURI ) request . getFrom ( ) . getURI ( ) ) . getUser ( ) ) . contains ( "test-activation" ) ) { if ( sipApplicationSessionActivationListener != null && sipApplicationSessionActivated == null ) { SipServletResponse sipServletResponse = request . createResponse ( 500 , "sipApplicationSessionActivationListener not called" ) ; sipServletResponse . send ( ) ; return ; } if ( sipSessionActivationListener != null && sipSessionActivated == null ) { SipServletResponse sipServletResponse = request . createResponse ( 500 , "sipSessionActivationListener not called" ) ; sipServletResponse . send ( ) ; return ; } } if ( request . getSession ( ) . getAttribute ( "ISREINVITE" ) != null && sipSessionReInviteAttribute != null && sipApplicationSessionReInviteAttribute != null && RECEIVED . equalsIgnoreCase ( sipSessionReInviteAttribute ) && RECEIVED . equalsIgnoreCase ( sipApplicationSessionReInviteAttribute ) ) { SipServletResponse sipServletResponse = request . createResponse ( 200 ) ; sipServletResponse . send ( ) ; return ; } SipServletResponse sipServletResponse = request . createResponse ( 200 ) ; sipServletResponse . send ( ) ; return ; } SipServletResponse sipServletResponse = request . createResponse ( 500 ) ; sipServletResponse . send ( ) ; } else { SipServletResponse sipServletResponse = request . createResponse ( 200 ) ; sipServletResponse . send ( ) ; } }
{@inheritDoc}