public void servletInitialized(SipServletContextEvent ce) {
		ServletContext servletContext = ce.getServletContext();
		SipFactory sipFactory = (SipFactory) servletContext.getAttribute(SIP_FACTORY);
		String userName = servletContext.getInitParameter("user.name");
		String domainName = servletContext.getInitParameter("domain.name");		
		
		SipApplicationSession sipApplicationSession = sipFactory.createApplicationSession();
		// for REGISTER the from and the to headers are one and the same
		SipURI fromToURI = sipFactory.createSipURI(userName, domainName);				
		SipServletRequest sipServletRequest = 
			sipFactory.createRequest(sipApplicationSession, "REGISTER", fromToURI, fromToURI);
		sipServletRequest.setHeader("Expires", "3600");		
		sipServletRequest.setHeader("User-Agent", "MobicentsSipServlets");
		SipURI requestURI = sipFactory.createSipURI(null, domainName);
		try {
			Parameterable parameterable = sipServletRequest.getParameterableHeader("Contact");
			parameterable.setParameter("expires", "0");
		} catch (ServletParseException e1) {
			logger.error("Impossible to set the expires on the contact header",e1);
		}
		try {			
			sipServletRequest.setRequestURI(requestURI);				
			sipServletRequest.send();
		} catch (IOException e) {
			logger.error("An unexpected exception occured while sending the REGISTER request",e);
		}
	}
public void servletInitialized ( SipServletContextEvent ce ) { ServletContext servletContext = ce . getServletContext ( ) ; SipFactory sipFactory = ( SipFactory ) servletContext . getAttribute ( SIP_FACTORY ) ; String userName = servletContext . getInitParameter ( "user.name" ) ; String domainName = servletContext . getInitParameter ( "domain.name" ) ; SipApplicationSession sipApplicationSession = sipFactory . createApplicationSession ( ) ; SipURI fromToURI = sipFactory . createSipURI ( userName , domainName ) ; SipServletRequest sipServletRequest = sipFactory . createRequest ( sipApplicationSession , "REGISTER" , fromToURI , fromToURI ) ; sipServletRequest . setHeader ( "Expires" , "3600" ) ; sipServletRequest . setHeader ( "User-Agent" , "MobicentsSipServlets" ) ; SipURI requestURI = sipFactory . createSipURI ( null , domainName ) ; try { Parameterable parameterable = sipServletRequest . getParameterableHeader ( "Contact" ) ; parameterable . setParameter ( "expires" , "0" ) ; } catch ( ServletParseException e1 ) { logger . error ( "Impossible to set the expires on the contact header" , e1 ) ; } try { sipServletRequest . setRequestURI ( requestURI ) ; sipServletRequest . send ( ) ; } catch ( IOException e ) { logger . error ( "An unexpected exception occured while sending the REGISTER request" , e ) ; } }
/*
(non-Javadoc)
@see javax.servlet.sip.SipServletListener#servletInitialized(javax.servlet.sip.SipServletContextEvent)