Folks,
In my cfg file I've this block. I call this block when I receive a request
from a private IP (ex. 192.168.x.x)
/* route block for mangling */
route[1] {
log(1, "route-block 1 (mangling)\n");
# we mangle the contact address and ports in SDP part of the message
if (method == "INVITE") {
setflag(1);
log(1, "mangle block: INVITE received and we will mangle
ip \n");
sdp_mangle_ip("192.168.0.0/255.0.0.0",
"192.168.0.99");
};
# rewrite Contact: header
if (search("Contact: .*(a)192\.168\.")) {
/* we seem to have a private address on a Contact which is
not valid */
encode_contact("enc_prefix","192.168.0.99");
xlog("L_NOTICE", "mangle block: encoded Contact header:
<%ct> \n");
};
}
When I send an INVITE I can see in SDP:
Content-Type: application/sdp..
Content-Length: 204..204Contact: Andrea Girardi
<sip:enc_prefix*andrea**192.168.0.98*5060*@192.168.0.99>..
User-Agent: SCS/v3.1.12.33..
..
v=0..
o=AndreaGirardi13698577 0 IN IP4 192.168.0.98..
s=ScS Client..
c=IN IP4 217.57.90.117..
t=0 0..
m=audio 1154 RTP/AVP 0 8 4..
a=rtpmap:0 PCM U/8000..
a=rtpmap:8 PCMA/8000..
a=rtpmap:4 G723/8000..
a=ptime: 30..
This work correctly when USERA send an Invite to USERB, but when USERB send
200 ok this is the SDP:
Content-Type: application/sdp..
Content-Length: 189....
v=0..
o=braies 0 0 IN IP4 192.168.0.98..
s=ScS Client..
c=IN IP4 192.168.0.98..
b=CT:1000..
t=0 0..
m=audio 57820 RTP/AVP 0 8 4..
a=rtpmap:0 PCMU/8000..
a=rtpmap:8 PCMA/8000..
a=rtpmap:4 G723/8000..
It's correct or User B has to change c field in SDP? How?
Can I see a encoded contact
(sip:enc_pref*username*ip*port*protocol@public_ip *) with xlog or simply in
stderr?
i've tried to use %ct but it return <sip:userA@192.168.0.97:5060>
is it better to use nathelper or mangler?
Thanks, Andrea
-------------------------------------------------------
Andrea Girardi
mobile +39 347 9624051
sip address: giandrea(a)sip.quellidelpirana.it
http://www.giandrea.com