I am attempting to trigger a registration request when receiving an invite like so:
SipURI fromToURI = sipFactory.createSipURI(userName, domainName);
//using the invite request to make a register request
SipServletRequest sipServletRequest = sipFactory.createRequest(request.getApplicationSession(), "REGISTER", fromToURI, fromToURI);
sipServletRequest.setHeader("Expires", "3600");
sipServletRequest.setHeader("User-Agent", "mobicentsWSSclient");
SipURI requestURI = sipFactory.createSipURI("myroutablewssproxy.com", domainName);
//.setPort();
requestURI.setTransportParam("wss");
requestURI.setPort(8443);
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);
}
but I am getting a null pointer exception when attempting to access the contact header. If I do not attempt to the access the contact header the registration request is lacking of a contact header entirely and so the registration attempt fails. Is there a way to access the servlet context and utilize it's contact information in this registration request?