[sr-dev] topoh, angle brackets and Contact URI params interpretation

Andrew Pogrebennyk andrew.pogrebennyk at portaone.com
Thu Feb 3 09:26:47 CET 2011

I'm having an issue with topoh module in Kamailio 3.1.0. When Contact 
header is formed like this:
        Contact: 0991
The other party responds properly. But when there is no angle brackets 
in Contact:

Really, many parsers implement "prefer shift to reduce" principle, which 
means if something can be interpreted in more enclosed expression, it 
will be interpreted this way and no as part of less enclosed expression 
so ;line is interpreted as header parameter but not URI parameter.

RFC 3261 section 20 suggests that any URI parameters be contained within 
angle brackets:
    The Contact, From, and To header fields contain a URI.  If the URI
    contains a comma, question mark or semicolon, the URI MUST be
    enclosed in angle brackets (< and >).  Any URI parameters are
    contained within these brackets.  If the URI is not enclosed in angle
    brackets, any semicolon-delimited parameters are header-parameters,
    not URI parameters.
I think the topoh module should force the angle brackets.
BTW it seems that parameter needs to be urlencoded, see rule 
'other-param' in RFC 3261 section 25.1:

other-param       =  pname [ "=" pvalue ]
pname             =  1*paramchar
pvalue            =  1*paramchar
paramchar         =  param-unreserved / unreserved / escaped
param-unreserved  =  "[" / "]" / "/" / ":" / "&" / "+" / "$"

No .-* characters are allowed in the paramchar. But at least that's not 
causing me any problems.

Andrew Pogrebennyk

More information about the sr-dev mailing list