<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2148014827897781889</id><updated>2012-02-16T07:18:03.867-08:00</updated><category term='sipp'/><category term='exception'/><category term='tcp'/><category term='sip'/><category term='protocol'/><category term='java.lang.IllegalStateException'/><category term='transport'/><category term='request'/><category term='Message cannot be modified'/><category term='transport-tcp'/><category term='session'/><category term='problem'/><title type='text'>Basit  { theTechnoCreative(); }</title><subtitle type='html'>All about my learning and experiences in new technologies.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://thetechnocreative.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2148014827897781889/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://thetechnocreative.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Basit Azeem Sheikh</name><uri>http://www.blogger.com/profile/16500719069240785241</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://1.bp.blogspot.com/-yIefnX7IuZQ/ThK2cqCyXzI/AAAAAAAAAgs/2T7Bhuu-p3c/s220/basit2%2B%25282%2529.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>2</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2148014827897781889.post-9119665623983487722</id><published>2011-07-05T11:43:00.000-07:00</published><updated>2011-07-05T11:52:50.231-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tcp'/><category scheme='http://www.blogger.com/atom/ns#' term='sip'/><category scheme='http://www.blogger.com/atom/ns#' term='transport-tcp'/><category scheme='http://www.blogger.com/atom/ns#' term='problem'/><category scheme='http://www.blogger.com/atom/ns#' term='Message cannot be modified'/><category scheme='http://www.blogger.com/atom/ns#' term='exception'/><category scheme='http://www.blogger.com/atom/ns#' term='request'/><category scheme='http://www.blogger.com/atom/ns#' term='java.lang.IllegalStateException'/><title type='text'>Problems in sending SIP Requests with TCP mode enabled.</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span style="font-size: x-large;"&gt;&lt;b&gt;Here I am discussing some problems which I faced while sending SIP Requests with TCP mode enabled.&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;ol style="text-align: left;"&gt;&lt;li&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;SIP Request is not hitting the SIP Servlet.&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Some time it happens that when you write -t t1 (enable transport as TCP) in command your Request does not hit the servlet, but when you are not enable TCP i.e. not writing -t t1 in your command Request works fine. &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;It might be because of some Request headers are missing in your scenario file. When enabling TCP mode, Content-Type header becomes compulsory - check if it is there in your Request header (Courtesy - Sameer Saurabh). Similarly check for other headers as well. Also check for special characters in your scenario file, these should not be there (Courtesy - Sri Narayanan).&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;SIP Request is behaving abnormally in your SIP Servlet.&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Sometime it happens your Request is reaching to your SIP Servlet but behaving abnormally means not doing the JOB intended to be done.&amp;nbsp;&lt;/li&gt;&lt;li&gt;There might be many reasons for this, check the log carefully. The problem that I found was in the Contact header of my Request there is no "transport=tcp" written, which must be there in your Contact header if TCP mode is enabled.&lt;/li&gt;&lt;li&gt;For Example : Contact: &amp;lt;sip:127.0.0.1:5060;&lt;b&gt;transport=tcp&lt;/b&gt;;fid=server_1&amp;gt; (Just for fun - there is no place called 127.0.0.1)&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Success log is printing but Request is not sent by SIP Servlet.&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Suppose in your logs you will see that "Request successfully sent" or something like that as per your logging, but still Request is not received at other end.&lt;/li&gt;&lt;li&gt;Again there could be many reasons for this, the one that encountered by me is the one while adding the address of my client in Route Header.&amp;nbsp;&lt;/li&gt;&lt;li&gt;For your information, for sending the created request from you SIP Servlet to any client you have to give &lt;b&gt;real client address (IP:PORT)&lt;/b&gt; either in &lt;b&gt;Request-Uri Header &lt;/b&gt;by using &lt;b&gt;sipServletRequest.setRequestUri("IP:PORT")&lt;/b&gt; method or in &lt;b&gt;Route Header &lt;/b&gt;by using &lt;b&gt;sipServletRequest.pushRoute(Address/SipUri)&lt;/b&gt;. Actually pushRoute has two overloaded versions, one takes javax.servlet.sip.Address and the other takes javax.servlet.sip.SipURI.&lt;/li&gt;&lt;li&gt;Now if you are using second approach (Route Header) then take care of the real address in hand, if it is in the format sip:IP:Port then use pushRoute(javax.servlet.sip.Address) and if it is in the format IP:Port then use pushRoute(javax.servlet.sip.SipURI) overloaded method. Taking care of this would possibly help you.&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&amp;nbsp;&lt;span style="font-size: large;"&gt;&lt;b&gt;Runtime exception (java.lang.IllegalStateException: Message cannot be modified.) is coming.&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;While executing SIP Servlet you are encountered with Runtime Exception java.lang.IllegalStateException : Message cannot be modified. Then there could be two (probable more, but I am aware of only two) reasons for this :&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ol&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;It seems that when dispatching an ACK response on a 200OK which included  a contact without a transport parameter results in this  exception. For more info visit : &lt;a href="http://old.nabble.com/handling-a-contact-without-a-transport-param-td29462668.html"&gt;http://old.nabble.com/handling-a-contact-without-a-transport-param-td29462668.html&lt;/a&gt;. (Courtesy - Shantnu Jain)&lt;/li&gt;&lt;li&gt;Another one which is encountered by me is : Whenever you create a request whether in-session or out-of-session, whether Dialog Initiation Request or Dialog Inside Request, you have to set &lt;b&gt;real client address&lt;/b&gt; either in &lt;b&gt;Route header or in Request-Uri header&lt;/b&gt;. In &lt;b&gt;UDP mode&lt;/b&gt; if you are creating a request with &lt;b&gt;linked session&lt;/b&gt; or &lt;b&gt;in-dialog session&lt;/b&gt;, then setting &lt;b&gt;real address&lt;/b&gt; in Route header or Request-Uri header is &lt;b&gt;not mandatory&lt;/b&gt;, it will take it from the session by which you created the request, but in &lt;b&gt;TCP you have to set the real address explicitly.&lt;/b&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/ol&gt;&lt;/ol&gt;Hope this post helps you .... Please update if you find some more problems.&lt;br /&gt;&lt;br /&gt;Regards : Basit { theTechnoCreative(); }&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2148014827897781889-9119665623983487722?l=thetechnocreative.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thetechnocreative.blogspot.com/feeds/9119665623983487722/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thetechnocreative.blogspot.com/2011/07/problems-in-sending-sip-requests-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2148014827897781889/posts/default/9119665623983487722'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2148014827897781889/posts/default/9119665623983487722'/><link rel='alternate' type='text/html' href='http://thetechnocreative.blogspot.com/2011/07/problems-in-sending-sip-requests-with.html' title='Problems in sending SIP Requests with TCP mode enabled.'/><author><name>Basit Azeem Sheikh</name><uri>http://www.blogger.com/profile/16500719069240785241</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://1.bp.blogspot.com/-yIefnX7IuZQ/ThK2cqCyXzI/AAAAAAAAAgs/2T7Bhuu-p3c/s220/basit2%2B%25282%2529.jpg'/></author><thr:total>0</thr:total><georss:featurename>Noida, Delhi, India</georss:featurename><georss:point>28.58 77.32999999999993</georss:point><georss:box>-7.978392499999998 17.564374999999927 65.1383925 137.09562499999993</georss:box></entry><entry><id>tag:blogger.com,1999:blog-2148014827897781889.post-5431821162260900687</id><published>2011-07-05T02:37:00.000-07:00</published><updated>2011-07-05T11:50:27.736-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tcp'/><category scheme='http://www.blogger.com/atom/ns#' term='sip'/><category scheme='http://www.blogger.com/atom/ns#' term='protocol'/><category scheme='http://www.blogger.com/atom/ns#' term='sipp'/><category scheme='http://www.blogger.com/atom/ns#' term='request'/><category scheme='http://www.blogger.com/atom/ns#' term='session'/><category scheme='http://www.blogger.com/atom/ns#' term='transport'/><title type='text'>Sending SIP Requests with TCP mode enabled.</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span style="font-size: small;"&gt;First of all we need to know - why &lt;/span&gt;&lt;span style="font-size: small; font-weight: bold;"&gt;TCP &lt;/span&gt;&lt;span style="font-size: small;"&gt;is required over &lt;/span&gt;&lt;span style="font-size: small; font-weight: bold;"&gt;UDP &lt;/span&gt;&lt;span style="font-size: small;"&gt;?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="font-family: inherit; text-align: left;"&gt;&lt;span style="font-size: small;"&gt;The problem occurs when the application attempts to send out a request over UDP, and the request message exceeds the MTU (Message Transfer Unit) size. By default, the MTU boundary is &lt;/span&gt;&lt;span style="font-size: small; font-weight: bold;"&gt;1300 bytes&lt;/span&gt;&lt;span style="font-size: small;"&gt;. If the request is larger than the MTU size, the underlying stack is responsible to switch the &lt;/span&gt;&lt;span style="font-size: small; font-weight: bold;"&gt;transport connection from UDP to TCP&lt;/span&gt;&lt;span style="font-size: small;"&gt;.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;This process is explained in section &lt;b&gt;18.1.1 of RFC 3261&lt;/b&gt;. (Courtesy - &lt;b&gt;Swarnapriya&lt;/b&gt;)&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;For more info visit 18.1.1 (Page 141-142) of &lt;a href="http://tools.ietf.org/html/rfc3261"&gt;http://tools.ietf.org/html/rfc3261&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-size: large; font-style: italic; font-weight: bold;"&gt;Here are the steps to send SIP request using Glassfish/sail&lt;/span&gt;&lt;span style="font-size: large; font-style: italic; font-weight: bold;"&gt;fin with TCP&lt;/span&gt;&lt;span style="font-size: large;"&gt; :&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;1. Start the Server and login to admin console (http://localhost:4848) (&lt;span style="font-style: italic;"&gt;Note : Admin port is configurable so check your admin port in config settings&lt;/span&gt;).&lt;br /&gt;2. Now in Sidebar go to Configurations Link ---&amp;gt; Sip Service as shown below : &lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/-NkoOM_mDGlc/ThLDUXgMvRI/AAAAAAAAAhM/rXzOJds40Uo/s1600/sailfin1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="396" src="http://1.bp.blogspot.com/-NkoOM_mDGlc/ThLDUXgMvRI/AAAAAAAAAhM/rXzOJds40Uo/s640/sailfin1.png" width="640" /&gt;&lt;/a&gt;&lt;br /&gt;3. Now Click on SIP Protocol Tab on SIP Service Page and check the "Default Transport" Enabled check box as shown below :&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/-7-VIe0IFXmA/ThLEJAYMkMI/AAAAAAAAAhQ/yQ9QcHIRjFI/s1600/sailfin2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="204" src="http://4.bp.blogspot.com/-7-VIe0IFXmA/ThLEJAYMkMI/AAAAAAAAAhQ/yQ9QcHIRjFI/s640/sailfin2.png" width="640" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;4. Now your SIP Application Server is ready for SIP Transmission via TCP.&amp;nbsp; &lt;br /&gt;&lt;br /&gt;5. As far as I concerned &lt;a href="http://sipp.sourceforge.net/"&gt;Sipp &lt;/a&gt;is the tool most of the SIP Programmers use for testing SIP Servlets. Using Sipp you can write scenario files describing the flow of your requests in XML and then from command line you can run that scenario file which will hit your SIP Servlet and shows the result. For more information on how to use Sipp for testing and for sample sipp scenario files visit another post of this Blog.&lt;br /&gt;&lt;br /&gt;6. At this point I hope you read lot about Sipp, so I am directly jumping on the command option you have to write for enable transport=tcp. In the command you write for running the Scenario file you have to add &lt;b&gt;-t t1&lt;/b&gt; at the &lt;b&gt;end &lt;/b&gt;of command but &lt;b&gt;before the -timeout option &lt;/b&gt;if you are using one in your command.&lt;br /&gt;&lt;ol style="text-align: left;"&gt;&lt;/ol&gt;Depending on the value of &lt;b&gt;-t&lt;/b&gt; parameter, this will take the values "UDP", "TCP" etc.&lt;br /&gt;&lt;pre class="code"&gt;t1: TCP with one socket&lt;/pre&gt;&lt;pre class="code"&gt;u1: UDP with one socket (default)&lt;/pre&gt;&lt;pre class="code"&gt;l1: TLS with one socket. etc...&lt;/pre&gt;&lt;pre class="code" style="font-family: inherit;"&gt;&lt;/pre&gt;&lt;pre class="code" style="font-family: inherit;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/pre&gt;&lt;pre class="code" style="font-family: inherit;"&gt;&lt;b&gt;Example Commands :&amp;nbsp;&lt;/b&gt;&lt;/pre&gt;&lt;pre class="code" style="font-family: inherit;"&gt;&lt;b&gt;UAC :&lt;/b&gt; sipp -sf &amp;lt;scenario file&amp;gt; &amp;lt;server ip&amp;gt;:&amp;lt;server port&amp;gt; -i &amp;lt;client ip&amp;gt; -p &amp;lt;client port&amp;gt; -m 1&amp;nbsp;&lt;/pre&gt;&lt;pre class="code" style="font-family: inherit;"&gt;-mp 7000 -cp 8990 &lt;b&gt;-t t1&lt;/b&gt; -timeout 20s&lt;/pre&gt;&lt;pre class="code" style="font-family: inherit;"&gt;&lt;b&gt;UAS :&lt;/b&gt; sipp -sf &amp;lt;scenario file&amp;gt; &amp;lt;server ip&amp;gt;:&amp;lt;server port&amp;gt; -i &amp;lt;client ip&amp;gt; -p &amp;lt;client port&amp;gt; -m 1&amp;nbsp;&lt;/pre&gt;&lt;pre class="code" style="font-family: inherit;"&gt;&lt;b&gt;           -t t1&lt;/b&gt; -timeout 40s&lt;/pre&gt;&lt;pre class="code" style="font-family: inherit;"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="code" style="font-family: inherit;"&gt;&amp;nbsp;&lt;br /&gt;Regards : Basit { theTechnoCreative(); }&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2148014827897781889-5431821162260900687?l=thetechnocreative.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thetechnocreative.blogspot.com/feeds/5431821162260900687/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thetechnocreative.blogspot.com/2011/07/sip-well-emerged-protocol.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2148014827897781889/posts/default/5431821162260900687'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2148014827897781889/posts/default/5431821162260900687'/><link rel='alternate' type='text/html' href='http://thetechnocreative.blogspot.com/2011/07/sip-well-emerged-protocol.html' title='Sending SIP Requests with TCP mode enabled.'/><author><name>Basit Azeem Sheikh</name><uri>http://www.blogger.com/profile/16500719069240785241</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://1.bp.blogspot.com/-yIefnX7IuZQ/ThK2cqCyXzI/AAAAAAAAAgs/2T7Bhuu-p3c/s220/basit2%2B%25282%2529.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-NkoOM_mDGlc/ThLDUXgMvRI/AAAAAAAAAhM/rXzOJds40Uo/s72-c/sailfin1.png' height='72' width='72'/><thr:total>1</thr:total></entry></feed>
