[SR-Users] SIP UA's behind same NAT
Daniel-Constantin Mierla
miconda at gmail.com
Mon Dec 20 13:41:48 CET 2010
Hello,
On 12/20/10 11:25 AM, Deon Vermeulen wrote:
> Hi List
>
> Can someone please help me?
>
> I need to implement PBX Services for a customer that has 10 IP Phones at his Main site and then 20 IP Phones located over 5 Branches.
>
> My goal is to have RTP go end to end and not proxied.
>
> I had a look at the below link and tried it, but with no luck.
>
> http://kamailio.org/dokuwiki/doku.php/examples:caller-callee-behind-same-nat
>
> Here is a partial output of my kamailio.cfg file if someone would be so kind to help me.
>
>
> #!ifdef WITH_NAT
> # ----- rtpproxy params -----
> modparam("rtpproxy", "rtpproxy_sock", "udp:localhost:7722")
>
> # ----- nathelper params -----
> modparam("nathelper", "natping_interval", 30)
> modparam("nathelper", "ping_nated_only", 1)
> modparam("nathelper", "sipping_bflag", FLB_NATSIPPING)
> modparam("nathelper", "sipping_from", "sip:pinger at x.x.x.x")
>
> # params needed for NAT traversal in other modules
> modparam("nathelper|registrar", "received_avp", "$avp(RECEIVED)")
> modparam("usrloc", "nat_bflag", FLB_NATB)
> #!endif
>
>
>
> ####### Routing Logic ########
>
>
> # Main SIP request routing logic
> # - processing of any incoming SIP request starts with this route
> route {
>
> # per request initial checks
> route(REQINIT);
>
> # NAT detection
> route(NAT);
>
>
>
>
> # Caller NAT detection route
> route[NAT] {
> #!ifdef WITH_NAT
> force_rport();
> if (nat_uac_test("19")) {
> if (method=="REGISTER") {
> fix_nated_register();
> } else {
> fix_nated_contact();
> }
> setflag(FLT_NATS);
> }
> #!endif
> return;
> }
>
> # RTPProxy control
> route[RTPPROXY] {
> #!ifdef WITH_NAT
> if (is_method("BYE")) {
> unforce_rtp_proxy();
> } else if (is_method("INVITE")){
> force_rtp_proxy();
> }
> if (!has_totag()) add_rr_param(";nat=yes");
> #!endif
> return;
> }
>
>
what you have to do is to check if the source is natted and $si==$dd,
then callee and caller are behind same nat (if there is one level of
nat), so you don't force rtpproxy usage.
Cheers,
Daniel
--
Daniel-Constantin Mierla
Kamailio (OpenSER) Advanced Training
Jan 24-26, 2011, Irvine, CA, USA
http://www.asipto.com
More information about the sr-users
mailing list