El Thursday 09 August 2007 17:39:12 Andreas Sikkema escribió:
Hi,
I'm trying to do add accounting to our OpenSER server. Getting accounting to work is easy but I'm having trouble saving client IP addresses with every CDR.
Most of our SIP UAs are behind some form of NAT and to "prove" that calls have originated at the client I want to save the public IP address and as extra service also the private IP address of the UA.
Saving the private IP address is easy, $Ri contains this value. I'm having trouble finding out what to do to save the public IP address. I thought that since I'm using fix_contact() I could save the contact header body, but $ct still contained the private IP address.
Yes, you are right, it seems that "fix_nated_contact()" is applied after the message ahs been proccesed by OpenSer, so you can't see the modified header during the internal process.
You could use variable $si: $si - reference to IP source address of the message
so that is the public IP from which your OpenSer has received the message. Anyway note that if there is another proxy X between the NAT router and your OpenSer the $si will contain the public IP of that proxy X.