[Users] WeSIP b2bua problem

tele tele at plexia.com
Mon Mar 5 14:36:47 CET 2007


Hi Gines!

It's almost clear to me how to do, this what i have done and it works.

now i need last clarification how forward the 200 OK from BYE request, i
cannot get it working.
for forwarding the 200 ok from the BYE in the doBye request i save
downstreamLeg.setAttribute("byereq", req) and then in the doResponse i
get the bye request and create the response from it,
something like this but i'm wrong.

if (resp.getStatus() == 200 && resp.getMethod().equalsIgnoreCase("BYE"))
{
                        SipServletRequest upstreamRequest =
(SipServletRequest)upstreamLeg.getAttribute("byereq");
                        SipServletResponse upstreamResponse =
upstreamRequest.createResponse(resp.getStatus(),resp.getReasonPhrase());
                        //Copy the content from the downstream response
to the upstream response
                        if (resp.getContentType() != null) {

upstreamResponse.setContent(resp.getRawContent(),
resp.getContentType());
                        }
                        upstreamResponse.send();
}



this is what i have done for working ACK.


  protected void doAck(SipServletRequest req) throws ServletException,
IOException {
        //Retrieve the upstream request to respond it
        SipSession downstreamLeg =
(SipSession)req.getSession().getApplicationSession().getAttribute("downstreamLeg");
        SipServletResponse downstreamResponse = (SipServletResponse)
downstreamLeg.getAttribute("200ok");
        SipServletRequest ackRequest = downstreamResponse.createAck();
        //Copy the content from the downstream response to the upstream
response
        if (req.getContentType() != null) {
                ackRequest.setContent(req.getRawContent(),
req.getContentType());
        }
        ackRequest.send();
   }

   protected void doBye(SipServletRequest req) throws ServletException,
IOException {
        SipSession downstreamLeg =
(SipSession)req.getSession().getApplicationSession().getAttribute("downstreamLeg");
        SipServletRequest byeRequest =
downstreamLeg.createRequest("BYE");
        // Copy the content from the downstream response to the upstream
response
        if (req.getContentType() != null) {
                byeRequest.setContent(req.getRawContent(),
req.getContentType());
        }
        byeRequest.send();
   }

   protected void doResponse(SipServletResponse resp) throws
ServletException, IOException {

                if (resp.getStatus() == 200 &&
resp.getMethod().equalsIgnoreCase("INVITE")) {
                        SipSession downstreamLeg = (SipSession)
resp.getSession().getApplicationSession().getAttribute("downstreamLeg");
                        downstreamLeg.setAttribute("200ok",resp);
                }

                //Retrieve the upstream request to respond it
                SipSession upstreamLeg =
(SipSession)resp.getSession().getApplicationSession().getAttribute("upstreamLeg");

}

	


On Mon, 2007-03-05 at 00:29 +0100, Ginés Gómez wrote:
> The problem is that you didn't implement the doACK method. Implement  
> it following a similar technique as the one used in doResponse. Save  
> the 200OK response in the downstream session so you can retrieve it  
> when the ACK arrives from the upstream then generate ACK using  
> response.createACK() and copy the content using getContentType/ 
> setContentType geContent/setContent if required
> 
> 
> Hope it helps
> 
> Gines
> 
> > Attached there is a .zip with all the log, trace and configuration.
> >
> > thanks for the support,
> >
> > :tele
> > <wesip_test.zip>
> > _______________________________________________
> > Users mailing list
> > Users at openser.org
> > http://openser.org/cgi-bin/mailman/listinfo/users
> 





More information about the Users mailing list