[Serusers] nathelper question - nat_flag

Jan Janak jan at iptel.org
Wed Dec 10 23:50:27 CET 2003


Basically usrloc has been extended to save the status of a flag. Which
flag it should save can be configured using the "nat_flag" parameter of
the registrar module.

Let's say you configure modparam("registrar", "nat_flag", 6)

Then flag 6 will be saved into the user location database each time you
call save("location") and retrieved each time you call
lookup("location").

If flag 6 is set before save() then it will be also set after lookup() for
the same contact.

Because the user location database stores already rewritten contact (in
case the user agent was behind a NAT), you don't know if the contact
returned by lookup() is behind NAT

That's what the flag is for. If the configured flag is set after
lookup("location") then you know that the contact is behind NAT.

Typically you would do something like this (very rough example):

# For REGISTER
If (contact_is_behind_nat) {
	rewrite_contact
	setflag(6)
	save("location")
}

# For INVITE
if (lookup("location")) {
	if (isset(6)) {
		# Contact is behind NAT
		force_rtp_proxy
	}
}

 Jan.

On 10-12 23:40, Klaus Darilion wrote:
> Hi!
> 
> I'm lost in the NAT problem!
> 
> I read about the 'new' flags which will be stored in the location table to
> detect the presence of NATed clients.
> http://lists.iptel.org/pipermail/serdev/2003-October/000690.html
> 
> But I can't find any documentation about them. How do I use them? Do I have
> to use setflag(?) before save("location")? Which flag do I have to set? Do I
> have to retrive the flags during lookup("location") to force_rtp_proxy in
> case of an registered client whic is nated?
> 
> regards,
> Klaus
> 
> 
> _______________________________________________
> Serusers mailing list
> serusers at lists.iptel.org
> http://lists.iptel.org/mailman/listinfo/serusers




More information about the sr-users mailing list