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: .*@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@sip.quellidelpirana.it http://www.giandrea.com
When I send an INVITE I can see in SDP: Content-Type: application/sdp.. Content-Length: 204..204Contact: Andrea Girardi
^^^^^^^^^
Which version are you using? A quick guess is you are using a version prior to CVS/stable. Otherwise, it is an error.
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?
Hard to say if I don't know what the purpose of your doing is. Generaly, mangler is used to help clients behind a NAT to use fixed NAT bindings. You need to rewrite both requests for outgoing INVITEs as well as 200s for incoming calls.
Can I see a encoded contact (sip:enc_pref*username*ip*port*protocol@public_ip *) with xlog or simply in stderr?
no, xlog like other SER actions operates over the original message.
is it better to use nathelper or mangler?
that depends on what you want to do. nathelper is primarily good for public Internet service, mangler is good for a local installation behind a preconfigured NAT. You can use it for any other purpose too inventively and post new ideas to the list.
-jiri
You have to use onreply_route section if you want to change 200 OK. See sip_router/etc/nathelper.cfg
Regarding xlog, it shows only the original (not rewritten) contact.
Nathelper is considered more stable then mangler because it has been much more tested.
Jan.
On 23-01 15:19, giAndrea wrote:
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: .*@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@sip.quellidelpirana.it http://www.giandrea.com
Serusers mailing list serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers