[Kamailio-Users] A function to add uri/header parameters

Iñaki Baz Castillo ibc at aliax.net
Sun Aug 10 18:57:35 CEST 2008


Hi, for now, the "normal" way to detect if an in-dialog request/response 
beyonds to a natted dialog is by adding a uri parameter ("nat=yes") in 
the "Contact" header of the first request and response and macthing that 
parameter in the RURI of subsequent in-dialog requests.

Typically this is done in this way:

  search_append('Contact:.*sip:[^>[:cntrl:]]*', ';nat=yes');

Well, this mechanims (that is part of official OpenSer courses) is very 
RCF3261 non compliant:

1) In SIP a header field name is case insensitive but the above function 
wouldn't match a "CONTACT" of "contact" header names (even if they are 100% 
valid).

2) "Contact" header can appear abbreviated as "m" (or "M") but the above 
doesn't match it.

3) 1.1.1. Known Limitations
  search ignores folded lines. For example, search("(From|f):.*@foo.bar")
  doesn't match the following From header field: 
    From: medabeda 
      <sip:medameda at foo.bar>;tag=1234



A solution for points 1 and 2 could be using "subst" with insensitive flag 
enabled, but it could be very anti-friendly.

So I wonder: wouldn't be useful a good funtion to add/read/remove header and 
uri parameters (in any header or uri) being RFC 3261 compliant (this is: case 
insensitive and allowing header name abbreviations)?



-- 
Iñaki Baz Castillo




More information about the Users mailing list