Jain Sip - duplicated messages

"brea C." <[email protected]> Wed, 7 May 2008 12:23:23 +0200
Newsgroups gmane.comp.voip.nist-sip
Message-ID <[email protected]>
------=_Part_6710_28225651.1210155804198
Content-Type: multipart/alternative; 
	boundary="----=_Part_6711_6376101.1210155804199"

------=_Part_6711_6376101.1210155804199
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Hi!

I'm currently developing a sip proxy solution using Jain sip reference
implementation (more exactly v1.2) and im having some issues that I can't
identify where it comes.

The problem is that mostly sip messages who are proxied ( both requests and
responses ),  sent in statefull mode  with client or server Transaction,
appears duplicated on the lan.  Its not because a expired timer, duplicated
messages are sent simultaneously in just milliseconds.

Here is attached a graph about this.

And the code is no more complex than:

---------------------------------------------------------------------------=
----------------------------------------------------------
    public void processInvite(RequestEvent requestEvent)
    {
        try {
                    Request request =3D requestEvent.getRequest();
            ServerTransaction st =3D requestEvent.getServerTransaction();

            if (st =3D=3D null) {
                st =3D sipProvider.getNewServerTransaction(request);
            }


                    Request newRequest =3D (Request) request.clone();
                    SipURI requestURI =3D (SipURI)newRequest.getRequestURI(=
);
                    requestURI =3D
ProtocolObjects.addressFactory.createSipURI("annc",cmsAddress);
                    requestURI.setParameter("play",ad);
                       newRequest.setRequestURI(requestURI);


            // Record Route
            SipURI sipURI =3D
ProtocolObjects.addressFactory.createSipURI("Proxy",host);
            sipURI.setPort(port);
            Address address =3D
ProtocolObjects.addressFactory.createAddress("Proxy",sipURI);
            RecordRouteHeader recordRoute =3D
ProtocolObjects.headerFactory.createRecordRouteHeader(address);
            newRequest.addHeader(recordRoute);

            // Via Header
            ViaHeader viaHeader =3D
ProtocolObjects.headerFactory.createViaHeader(host, port, transport, null);
            newRequest.addFirst(viaHeader);

            ClientTransaction ct =3D
sipProvider.getNewClientTransaction(newRequest);
            log.info(">>> Client Transaction Created state "+ct.getState()+=
"
ct: "+ ct);

            ct.setApplicationData(st);
            ct.sendRequest();


                } catch (Exception ex) {
                        ex.printStackTrace();
                        System.exit(0);
                }
    }

    public void response(ResponseEvent evt) {
        Response response =3D evt.getResponse();
        ClientTransaction ct =3D evt.getClientTransaction();

        if ( response.getStatusCode() !=3D 100 ) {
        if ( ct !=3D null ) {
            try {
            ServerTransaction st =3D (ServerTransaction)
ct.getApplicationData();
            Response newResp =3D (Response) response.clone();
            newResp.removeFirst(ViaHeader.NAME);

            st.sendResponse(newResp);

            } catch (Exception e){
                 e.printStackTrace();
            }
        } else {
          System.out.println("Warning: responseInvite and ct =3D=3D null,
nothing done");
        }

        }
    }
---------------------------------------------------------------------------=
------------------------------------------------------

 I have no idea about a possible solution, so any help will be very
apreciated.

 Regards

 C=E9sar.

------=_Part_6711_6376101.1210155804199
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Hi! <br><br>I&#39;m currently developing a sip proxy solution using Jain si=
p reference implementation (more exactly v1.2) and im having some issues th=
at I can&#39;t identify where it comes.<br><br>The problem is that mostly s=
ip messages who are proxied ( both requests and responses ),&nbsp; sent in =
statefull mode&nbsp; with client or server Transaction, appears duplicated =
on the lan.&nbsp; Its not because a expired timer, duplicated messages are =
sent simultaneously in just milliseconds. <br>
<br>Here is attached a graph about this.<br><br>And the code is no more com=
plex than:<br><br>---------------------------------------------------------=
---------------------------------------------------------------------------=
-<br>
&nbsp;&nbsp;&nbsp; public void processInvite(RequestEvent requestEvent)<br>=
&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; try {<br>&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;=
&nbsp; &nbsp;&nbsp;&nbsp; Request request =3D requestEvent.getRequest();<br=
>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ServerTransaction=
 st =3D requestEvent.getServerTransaction();<br>
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (st =3D=3D =
null) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&=
nbsp;&nbsp; st =3D sipProvider.getNewServerTransaction(request);<br>&nbsp;&=
nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &=
nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
Request newRequest =3D (Request) request.clone();<br>&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;=
&nbsp;&nbsp; SipURI requestURI =3D (SipURI)newRequest.getRequestURI();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp; requestURI =3D ProtocolObjects.addressFactory=
.createSipURI(&quot;annc&quot;,cmsAddress);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;=
&nbsp; requestURI.setParameter(&quot;play&quot;,ad);<br>&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nb=
sp;&nbsp; &nbsp;&nbsp;&nbsp; newRequest.setRequestURI(requestURI);<br>
<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // Record =
Route<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; SipURI si=
pURI =3D ProtocolObjects.addressFactory.createSipURI(&quot;Proxy&quot;,host=
);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sipURI.setPo=
rt(port);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Addre=
ss address =3D ProtocolObjects.addressFactory.createAddress(&quot;Proxy&quo=
t;,sipURI);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; RecordRouteHeader =
recordRoute =3D ProtocolObjects.headerFactory.createRecordRouteHeader(addre=
ss);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; newRequest=
.addHeader(recordRoute);<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp=
;&nbsp;&nbsp; // Via Header<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;=
&nbsp;&nbsp; ViaHeader viaHeader =3D ProtocolObjects.headerFactory.createVi=
aHeader(host, port, transport, null);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; newRequest.addFirs=
t(viaHeader);<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbs=
p; ClientTransaction ct =3D sipProvider.getNewClientTransaction(newRequest)=
;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; log.info(&quo=
t;&gt;&gt;&gt; Client Transaction Created state &quot;+ct.getState()+&quot;=
 ct: &quot;+ ct);<br>
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ct.setApplicat=
ionData(st);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ct=
.sendRequest();<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&n=
bsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp; } catch (Exception ex) {<br>&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ex.printStackTrace();<br>&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.exit(0);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; public =
void response(ResponseEvent evt) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=
 Response response =3D evt.getResponse();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp=
;&nbsp; ClientTransaction ct =3D evt.getClientTransaction();<br><br>&nbsp;&=
nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ( response.getStatusCode() !=3D 100 ) { <=
br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ( ct !=3D null ) {<br>&nbsp;&nbsp;=
&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; try {<br>&nbsp;&nbsp;&nbsp; &n=
bsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ServerTransaction st =3D (ServerTransac=
tion) ct.getApplicationData();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nb=
sp;&nbsp;&nbsp; Response newResp =3D (Response) response.clone();<br>&nbsp;=
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; newResp.removeFirst(ViaH=
eader.NAME);<br>
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; st.sendRespons=
e(newResp);<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=
 } catch (Exception e){<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbs=
p;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; e.printStackTrace();<br>&nbsp;&nbsp;&nbsp=
; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp=
;&nbsp; } else {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; System.out=
.println(&quot;Warning: responseInvite and ct =3D=3D null, nothing done&quo=
t;);&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nb=
sp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br>------------------------------------=
---------------------------------------------------------------------------=
------------------<br><br>&nbsp;I have no idea about a possible solution, s=
o any help will be very apreciated.<br>
<br>&nbsp;Regards<br><br>&nbsp;C=E9sar.<br>

------=_Part_6711_6376101.1210155804199--

------=_Part_6710_28225651.1210155804198
Content-Type: text/plain; name=graph.txt
Content-Transfer-Encoding: base64
X-Attachment-Id: f_ffxre1ts0
Content-Disposition: attachment; filename=graph.txt

fFRpbWUgICAgIHwgMTkyLjE2OC4xLjQ0ICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAxOTIu
MTY4LjEuNDAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgMTkyLjE2OC4xLjE2Cnw4NSw3NTYg
ICB8ICAgICAgICAgSU5WSVRFIFNEUCAoIHRlbGVwaG9uZS1ldmVudCkgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICAgICAgICAgICAgICAgIAp8ICAgICAgICAg
fCg1MDYwKSAgIC0tLS0tLS0tLS0tLS0tLS0tLT4gICg1MDYwKSAgICB8ICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgICAgICAgICAgICAgICAgIAp8ODUsNzYzICAg
fCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICAgICAgSU5WSVRF
IFNEUCAoIHRlbGVwaG9uZS1ldmVudCkgICAgICAgICAgCnwgICAgICAgICB8ICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwoNTA2MCkgICAtLS0tLS0tLS0tLS0tLS0tLS0+
ICAoNTA2MCkgICB8Cnw4NSw3NjMgICB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgIHwgICAgICAgICBJTlZJVEUgU0RQICggdGVsZXBob25lLWV2ZW50KSAgICAgICAgICAK
fCAgICAgICAgIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCg1MDYw
KSAgIC0tLS0tLS0tLS0tLS0tLS0tLT4gICg1MDYwKSAgIHwKfDg1LDc2OCAgIHwgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgICAgIDEwMCBUcnlpbmd8ICAgICAg
ICAgICAgICAgICAgIHwKfCAgICAgICAgIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgfCg1MDYwKSAgIDwtLS0tLS0tLS0tLS0tLS0tLS0gICg1MDYwKSAgIHwKfDg1LDc2
OCAgIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgICAgIDIw
MCBPSyBTRFAgKCB0ZWxlcGhvbmUtZXZlbnQpICAgICAgICAgIAp8ICAgICAgICAgfCAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8KDUwNjApICAgPC0tLS0tLS0tLS0tLS0t
LS0tLSAgKDUwNjApICAgfAp8ODUsNzc4ICAgfCAgICAgICAgIDIwMCBPSyBTRFAgKCB0ZWxlcGhv
bmUtZXZlbnQpICB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfAp8ICAg
ICAgICAgfCg1MDYwKSAgIDwtLS0tLS0tLS0tLS0tLS0tLS0gICg1MDYwKSAgICB8ICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfAp8ODUsNzc4ICAgfCAgICAgICAgIDIwMCBP
SyBTRFAgKCB0ZWxlcGhvbmUtZXZlbnQpICB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgfAp8ICAgICAgICAgfCg1MDYwKSAgIDwtLS0tLS0tLS0tLS0tLS0tLS0gICg1MDYw
KSAgICB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfAp8ODUsNzkyICAg
fCAgICAgICAgIEFDSyAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAgICAgICAgICAgICAgIAp8ICAgICAgICAgfCg1
MDYwKSAgIC0tLS0tLS0tLS0tLS0tLS0tLT4gICg1MDYwKSAgICB8ICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgfAp8ODUsNzk4ICAgfCAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICB8ICAgICAgICAgQUNLICAgICAgICAgICAgICAgICAgICAgICAgICAg
fAp8ICAgICAgICAgfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8KDUw
NjApICAgLS0tLS0tLS0tLS0tLS0tLS0tPiAgKDUwNjApICAgfAp8ODUsODQ0ICAgfCAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICAgICAgQllFICAgICAgICAgICAg
ICAgICAgICAgICAgICAgfAp8ICAgICAgICAgfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICB8KDUwNjApICAgPC0tLS0tLS0tLS0tLS0tLS0tLSAgKDUwNjApICAgfAp8ODUs
ODQ3ICAgfCAgICAgICAgIEJZRSAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfAp8ICAgICAgICAgfCg1MDYwKSAgIDwtLS0t
LS0tLS0tLS0tLS0tLS0gICg1MDYwKSAgICB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgfAp8ODUsODUxICAgfCAgICAgICAgIDIwMCBPSyAgICAgICAgICAgICAgICAgICAg
ICAgICB8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfAp8ICAgICAgICAg
fCg1MDYwKSAgIC0tLS0tLS0tLS0tLS0tLS0tLT4gICg1MDYwKSAgICB8ICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgfAp8ODUsODUzICAgfCAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICB8ICAgICAgICAgMjAwIE9LICAgICAgICAgICAgICAgICAgICAg
ICAgfAp8ICAgICAgICAgfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8
KDUwNjApICAgLS0tLS0tLS0tLS0tLS0tLS0tPiAgKDUwNjApICAgfAo=
------=_Part_6710_28225651.1210155804198
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
nist-sip mailing list
[email protected]
http://www-x.antd.nist.gov/mailman/listinfo/nist-sip

------=_Part_6710_28225651.1210155804198--