sksushilkumar / red5phone

Automatically exported from code.google.com/p/red5phone
0 stars 0 forks source link

SIP spec non-compliance - to-tag is missing on 1xx responses #99

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

Problem observed testing a call from X-Lite to Red5Phone using Sailfin as the 
SIP application 
server.
Both UAs register successfully and I am able to call Red5Phone from X-Lite.
However, the 180 Ringing response (and other 1xx responses) result in INVALID 
messages 
coming from Red5Phone.

The error listed in Sailfin is "A response without to-tag was received; except 
for 100 Trying, all 
responses MUST have a to-tag to be complying to RFC3261 8.2.6.2. The response 
is dropped"

As the message is invalid sailfin effectively drops the message meaning that 
the 1xx responses 
are ignored.

What is the expected output? What do you see instead?

I would expect the SIP To header to include a tag e.g.
SIP/2.0 180 Ringing.
Via: SIP/2.0/UDP 
172.16.76.1:5060;branch=z9hG4bKdaacb80a943c6f494e1f8c57459b09930dc5;received=10.
0.
0.25.
To: "bob"<sip:bob@127.0.0.1>;tag=bafab35f.

Instead it is returned without tag e.g.
SIP/2.0 180 Ringing.
Via: SIP/2.0/UDP 
172.16.76.1:5060;branch=z9hG4bKdaacb80a943c6f494e1f8c57459b09930dc5;received=10.
0.
0.25.
To: "bob"<sip:bob@127.0.0.1>.

What version of the product are you using? On what operating system?

Tested on version 0.8.0 on OSX.

Please provide any additional information below.

I've had a browse through the source and I believe the createResponse() message 
in 
BaseMessageFactory is the source of the problem.

Current implementation is as follows:
   /** Creates a SIP response message. For 2xx responses generates the local tag by means of 
the SipStack.pickTag(req) method.
     * @see #createResponse(Message,int,String,NameAddress,String,String body) */
   public static Message createResponse(Message req, int code, String reason, NameAddress 
contact)
   {  //String reason=SipResponses.reasonOf(code);
      String localtag=null;
      if (req.createsDialog() && !req.getToHeader().hasTag())
      {  if (SipStack.early_dialog || (code>=200 && code<300)) localtag=SipProvider.pickTag(req);
      }
      return createResponse(req,code,reason,localtag,contact,null,null);
   }

As you can see a tag is only created for 2xx responses. 1xx responses that 
aren't 100 should 
also have a tag as per http://tools.ietf.org/html/rfc3261#section-8.2.6.2

Original issue reported on code.google.com by ivan.mcs...@gmail.com on 1 Mar 2010 at 12:02