Re: Jain Sip - duplicated messages

Jeroen van Bemmel <[email protected]> Wed, 07 May 2008 18:37:50 +0200
Newsgroups gmane.comp.voip.nist-sip
Message-ID <[email protected]>
--===============8954611484994838046==
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Cesar,<br>
<br>
Are you sure this is not some artifact of the tool you are using to
capture the traces? I've seen Ethereal/wireshark appearing to duplicate
messages, possibly related to what IP addresses are being used. In your
trace, the INVITE and 200 OK messages sent by 192.168.1.40 appear
duplicated, while the ACK and BYE are not. The difference is that ACK
and BYE are sent to the Contact address from the 200 OK<br>
<br>
Try capturing the trace at a different machine (which machine did you
use to trace, 192.168.1.40?)<br>
<br>
Regards,<br>
Jeroen<br>
<br>
brea C. wrote:
<blockquote
 cite="mid:[email protected]"
 type="cite">Hi! <br>
  <br>
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.<br>
  <br>
The problem is that mostly sip 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 complex 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>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Request request = requestEvent.getRequest();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ServerTransaction st = requestEvent.getServerTransaction();<br>
  <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (st == null) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; st = 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 = (Request) request.clone();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; SipURI requestURI =
(SipURI)newRequest.getRequestURI();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; requestURI =
ProtocolObjects.addressFactory.createSipURI("annc",cmsAddress);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; requestURI.setParameter("play",ad);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&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 sipURI =
ProtocolObjects.addressFactory.createSipURI("Proxy",host);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sipURI.setPort(port);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Address address =
ProtocolObjects.addressFactory.createAddress("Proxy",sipURI);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; RecordRouteHeader recordRoute =
ProtocolObjects.headerFactory.createRecordRouteHeader(address);<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 =
ProtocolObjects.headerFactory.createViaHeader(host, port, transport,
null);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; newRequest.addFirst(viaHeader);<br>
  <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ClientTransaction ct =
sipProvider.getNewClientTransaction(newRequest);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; log.info("&gt;&gt;&gt; Client Transaction Created state
"+ct.getState()+" ct: "+ ct);<br>
  <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ct.setApplicationData(st);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ct.sendRequest();<br>
  <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } catch (Exception ex) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ex.printStackTrace();<br>
&nbsp;&nbsp;&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;&nbsp;&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 = evt.getResponse();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ClientTransaction ct = evt.getClientTransaction();<br>
  <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ( response.getStatusCode() != 100 ) { <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ( ct != null ) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; try {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ServerTransaction st = (ServerTransaction)
ct.getApplicationData();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Response newResp = (Response) response.clone();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; newResp.removeFirst(ViaHeader.NAME);<br>
  <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; st.sendResponse(newResp);<br>
  <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } catch (Exception e){<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&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("Warning: responseInvite and ct == null,
nothing done");&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
  <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; }<br>
---------------------------------------------------------------------------------------------------------------------------------<br>
  <br>
&nbsp;I have no idea about a possible solution, so any help will be very
apreciated.<br>
  <br>
&nbsp;Regards<br>
  <br>
&nbsp;C&eacute;sar.<br>
  <pre wrap=""><pre wrap="">
<hr size="4" width="90%">
_______________________________________________
nist-sip mailing list
<a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a>
<a class="moz-txt-link-freetext" href="http://www-x.antd.nist.gov/mailman/listinfo/nist-sip">http://www-x.antd.nist.gov/mailman/listinfo/nist-sip</a>
</pre></pre>
</blockquote>
</body>
</html>

--===============8954611484994838046==
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

--===============8954611484994838046==--