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): .*(a)(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