Status: New Owner: ---- Labels: Type-Defect Priority-Medium
New issue 584 by alex.sova: "Contact" header not added to request by container for challenge requests created by B2buaHelper.createRequest(session, request,...)
http://code.google.com/p/mobicents/issues/detail?id=584 My servlet acts as B2BUA and it fails on very basic scenario: * Receives INVITE (req1) as UAS * Send new INVITE (req2) created with B2buaHelper.createRequest(origRequest, ...) to some server as UAC * Receives 407 response from server * Tries to send challenge request (req3) to server created with B2buaHelper.createRequest(session, origRequest, ...) and fails with exception in SipServletRequest.send() call java.lang.IllegalStateException: Error sending request at org.mobicents.servlet.sip.message.SipServletRequestImpl.send(SipServletRequestImpl.java:989) at com.avistar.ghost.CallCentricService.authenticate(CallCentricService.java:81) at com.avistar.ghost.GhostSipServlet.doErrorResponse(GhostSipServlet.java:164) at javax.servlet.sip.SipServlet.doResponse(SipServlet.java:272) at javax.servlet.sip.SipServlet.service(SipServlet.java:327) at org.mobicents.servlet.sip.core.dispatchers.MessageDispatcher.callServlet(MessageDispatcher.java:229) at org.mobicents.servlet.sip.core.dispatchers.ResponseDispatcher$1.dispatch(ResponseDispatcher.java:207) at org.mobicents.servlet.sip.core.dispatchers.DispatchTask.run(DispatchTask.java:53) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675) at java.lang.Thread.run(Thread.java:595) Caused by: javax.sip.SipException: Missing a required header : Contact at gov.nist.javax.sip.stack.SIPClientTransaction.sendRequest(SIPClientTransaction.java:928) at org.mobicents.servlet.sip.message.SipServletRequestImpl.send(SipServletRequestImpl.java:978) Here is the code to create challenge request: SipServletRequest req2 = response.getRequest(); B2buaHelper helper = req2.getB2buaHelper(); SipServletRequest req1 = helper.getLinkedSipServletRequest(req2); SipServletRequest req3 = helper.createRequest(response.getSession(), req1, null); req3.addAuthHeader(response, authInfo); req3.send(); After some investigation I found that "Contact" header added only for when transaction is not yet created (see SipServeletRequestImpl.java, method send(), line 846). But it seems to be not the case for challenge requests. The transaction for these requests is set by Session object when request object is created. See SipSessionImpl.java, method createRequest(String), line 336: ClientTransaction retryTran = sipProvider .getNewClientTransaction(request); sipServletRequest = new SipServletRequestImpl( request, this.sipFactory, this, retryTran, retryTran.getDialog(), true); ... sipServletRequest.setTransaction(retryTran); I can avoid this problem simply by copying "Contact" header from req2 to req3, but it seems that the container should do it for me. -- You received this message because you are listed in the owner or CC fields of this issue, or because you starred this issue. You may adjust your issue notification preferences at: http://code.google.com/hosting/settings
