[Serusers] Rewriting URI in the Contact field
Nils Ohlmeier
nils at ohlmeier.de
Mon Jan 13 00:20:29 CET 2003
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Sunday 12 January 2003 23:44, Jan Janak wrote:
> On 12-01 23:25, Maxim Sobolev wrote:
> > Everything works just fine when I'm calling from UA1 to UA2, i.e.
> > from behind the NAT to the "outside world", however there are
> > some problems when I'm doing it in reverse direction. The problem
> > is that OK INVITE that the UA1 sends in reply to UA2's INVITE when
> > the user picks up the phone is not passed to my helper functions
> > and hence UA2 makes a wrong conclusion about where to send ACK and
> > BYE to.
> >
> > Do you have any ideas on how to overcome this problem?
>
> If I get you right, you need to rewrite Contact in 200 OK response to
> INVITE comming from the NATed user agent.
>
> You can do this using TM and it's callbacks. TM is transaction module and
> you can register callbacks with the module. Among others, there is a
> callback that will be called upon reception of the final response (200 OK
> in your case). In the callback, you can modify the response and rewrite the
> contact.
An alternative without additional programing could be to replace your search
for the User-Agent (which is not realistic in any case) with a search for
Contact from private adresses.
if ((search("^(Contact|m): .*@(192\.168\.|10\.|172\.16)"))
&& ( src_ip==192.168.0.0/16 || src_ip==10.0.0.0/8 || src_ip==172.16.0.0/12
))) {
fix_nated_contact();
}
If you place this where it also catches 200 you should also be able to fix
Contacts in the OK.
Greetings
Nils
- --
gpg-key: http://www.ohlmeier.org/public_key.asc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE+Ifg9x8PydbrWykARAnr/AKCSmzGkGXHxanlSIJHTm6+pLlJ/iwCeNz4C
/HVUgrom6dz1tgPVIO2+Xpc=
=7G7v
-----END PGP SIGNATURE-----
More information about the sr-users
mailing list