Tuesday, July 5, 2011

Problems in sending SIP Requests with TCP mode enabled.

Here I am discussing some problems which I faced while sending SIP Requests with TCP mode enabled.

  1. SIP Request is not hitting the SIP Servlet.
    • 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.
    • 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).
  2. SIP Request is behaving abnormally in your SIP Servlet.
    • Sometime it happens your Request is reaching to your SIP Servlet but behaving abnormally means not doing the JOB intended to be done. 
    • 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.
    • For Example : Contact: <sip:127.0.0.1:5060;transport=tcp;fid=server_1> (Just for fun - there is no place called 127.0.0.1)
  3. Success log is printing but Request is not sent by SIP Servlet.
    • 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.
    • 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. 
    • For your information, for sending the created request from you SIP Servlet to any client you have to give real client address (IP:PORT) either in Request-Uri Header by using sipServletRequest.setRequestUri("IP:PORT") method or in Route Header by using sipServletRequest.pushRoute(Address/SipUri). Actually pushRoute has two overloaded versions, one takes javax.servlet.sip.Address and the other takes javax.servlet.sip.SipURI.
    • 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.
  4.  Runtime exception (java.lang.IllegalStateException: Message cannot be modified.) is coming.
    • 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 : 
      •  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 : http://old.nabble.com/handling-a-contact-without-a-transport-param-td29462668.html. (Courtesy - Shantnu Jain)
      • 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 real client address either in Route header or in Request-Uri header. In UDP mode if you are creating a request with linked session or in-dialog session, then setting real address in Route header or Request-Uri header is not mandatory, it will take it from the session by which you created the request, but in TCP you have to set the real address explicitly.
Hope this post helps you .... Please update if you find some more problems.

Regards : Basit { theTechnoCreative(); }

No comments:

Post a Comment