Hi ,

can you double check that you do actually save the BYE request ? I couldn´t see the code in the doBye method.

 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();
   }


Anyway.... when doing B2BUA you tipically don't need to wait for 200OK to generate BYE response. You can simply send a 200OK to any incoming BYE request (since there is no SDP involved in the BYE handshake) then finish the other leg. The idea would be doing something like this (not 100% real code, some pseudocode here)


protected void doBye(SipServletRequest req) throws ServletException,IOException{

   //Answer positively
   request.createResponse(200,"Have a nice day").send();

   //Mark my dialog as finished
   request.getSession().setAttribute("FINISHED","OK");

   //Get the other leg and finish it in case it is not finished

//Note how useful is to have in both SipSessions (that is, both legs) an attribute which refers the
   //other leg involved in the B2BUA transaction.
SipSession counterPartLeg= (SipSession) request.getSession.getAttribute("COUNTERPART_LEG");
   if (counterPartLeg.getAttribute("FINISHED")==null){
        counterPartLeg.createRequest("BYE").send();
   }
}

Regards

Gines

El 05/03/2007, a las 14:36, tele escribió:

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
[email protected]
http://openser.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[email protected]
http://openser.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[email protected]
http://openser.org/cgi-bin/mailman/listinfo/users

Reply via email to