[SR-Users] fix_nated_contact() on REGISTER

Andrei Pelinescu-Onciul andrei at iptel.org
Wed Jun 2 15:00:32 CEST 2010


On Jun 02, 2010 at 10:58, Klaus Darilion <klaus.mailinglists at pernau.at> wrote:
> 
> 
> Am 02.06.2010 10:46, schrieb Klaus Darilion:
> >
> >
> >Am 01.06.2010 22:08, schrieb Daniel-Constantin Mierla:
> >>
> >>
> >>On 6/1/10 10:02 PM, Klaus Darilion wrote:
> >>>Daniel-Constantin Mierla wrote:
> >>>>
> >>>>
> >>>>On 6/1/10 9:07 PM, Alex Balashov wrote:
> >>>>>No, it'll store the fixed one, in the proper contact column, not the
> >>>>>received column. I do this all the time, even though it's not the
> >>>>>"proper" way.
> >>>>should be the original one with the last version, afaik. There were
> >>>>issues with phones accepting calls which had a different uri than the
> >>>>address they set in contact of register.
> >>>>
> >>>>So, the contact details were brocken in:
> >>>>- contact - the address from header
> >>>>- received - built from source ip and port
> >>>>- socket - local socket where the register was received
> >>>>
> >>>>Note that there are two functions, fix_nated_contact() and
> >>>>fix_nated_registrar().
> >>>
> >>>I know. I always use fix_nated_register. I just wonder why save()
> >>>saves the fixed contact in case of fix_nated_contact(), because
> >>>usually we have the problem that changes to the message are only
> >>>visible when the message is forwarded (lumps are applied)
> >>>
> >>but are you sure the fixed contact is saved? I quick look in the
> >>registrar code seems to take the contact from headers, which are
> >>pointing inside original message.
> >
> >I just tested with kamailio 3.0 and you are right. Yesterday I tested
> >with ser 0.9.? and fix_nated_contact() seemed to save the rewritten
> >contact header - strange.
> 
> I have to correct myself - I made an error during the test. Kamailio
> 3.0 with fix_nated_contact() saves the fixed contact URI (see
> below).

In all versions (older ser, ser, sip-router, kamailio), the changes done
by fix_nated_contact() will be visible when the contact is save()'d.
fix_nated_contact() directly modifies the parsed contact, which is then
used by save().

fix_nated_register() behaves differently. In older ser version and in
kamailio it sets and avp with the received information. This avp is then
checked by save() and used as received info.
In newer ser versions and sip-router modules_s/nathelper  it adds
a received=... parameter to each contact (it doesn't set any avp).
In this case save() will generate itself the received uri if the message
is flagged as coming from before a NAT. save() from modules_s/registrar
and newer sers, doesn't need fix_nated_register(), it only needs that the
message was properly flagged in the script. It will also not look at any
avp.
ser's fix_nated_register() is used for replicated REGISTERs or when the
outbound proxy is not also the registrar. It will add a "received="
parameter to each contact and the non-local registrar 
(or the replication peer) can use it to recover the original ip:port.


Andrei



More information about the sr-users mailing list