< Previous by Date Date Index Next by Date >
< Previous in Thread Thread Index Next in Thread >

Re: [reSIProcate-users] tag accessor misbehaving


Some background info....

For a NameAddr header (ie. To/From/Contact, etc.).  It is possible to have parameters at different levels.  There are user parameters, uri parameters, and NameAddr/header parameters.  

Example:
<sip:user;phone-context=phonedomain.com@xxxxxxxxxx;user=phone>;q=1.0

In this example "phone-context" is a user parameter, "user=phone" is a uri parameter, and "q" is a NameAddr/header parameter.

Use of the angle brackets makes it explicit when differentiating between URI and NameAddr/header parameters.  When the angle brackets are not present resip will assume all known Uri parameters are Uri parameters (ie. ob, gr, lr, maddr, method, transport, etc. - see Uri.hxx), and any unknown parameters are treated as NameAddr/header parameters (see NameAddr::parse).   Note:  The treatment of parameters in the RFC3261 grammars are ambiguous when angle brackets are not used.

Given your example and my explanation above: From: sip:user@10.0.0.1:5060;tag=123  
tag is NOT a known URI parameter and thus should be accessible as you have described.  Is it possible the From header you are parsing was built by hand and not parsed off the wire: ie. fromHeader.uri().param(p_tag) = "123";  <- thus making the tag parameter a Uri parameter explicitly?

There is no reason the From and To header would parse differently.  

Perhaps you can post a simple test program that demonstrates this.  See stack/test/testSipMessage.cxx  line 1889 where there is a test case that demonstrates from tag parsing.

Scott

On Fri, Mar 16, 2012 at 2:10 AM, Joegen Baclor <jbaclor@xxxxxxxxx> wrote:
On 03/16/2012 08:25 AM, Joegen Baclor wrote:
If From or To is constructed without the angle brackets Example:  From: sip:user@10.0.0.1:5060;tag=123 the tag is not accessible via header(h_From).param(p_tag) accesor.  it returns empty.  Is this intentional?

joegen

Correction, I seem to only encounter this in From.  To header seems to treat tags correctly if there are no angle brackets enclosing the URI.

the code looks like this:

   ASSERT_COND(msg->exists(h_From));
   if (msg->exists(h_From))
   {
     fromUser = msg->const_header(h_From).uri().user().c_str();
     fromTag = msg->const_header(h_From).exists(p_tag) ? msg->const_header(h_From).param(p_tag).c_str() : std::string();
     ASSERT_STR_EQ(fromUser.c_str(), "homertest");
     ASSERT_STR_EQ(fromTag.c_str(), "fromtag12345");
   }

The from header looks like this:  From: sip:homertest@192.168.1.10:5060;tag=fromtag12345

Tag would be empty in this case.  If I put angle brackets, then tag is parsed correctly.

_______________________________________________
resiprocate-users mailing list
resiprocate-users@resiprocate.org
List Archive: http://list.resiprocate.org/archive/resiprocate-users/