[SR-Users] Kamailio RtpProxy MHomed

Moacir Ferreira moacirferreira at hotmail.com
Sat Jul 19 13:07:45 CEST 2014


I was using an Internet access from Vodafone that has a modem with a SIP ALG for their phone. Not sure why, this modem would prevent to connect properly. But Kamailio/rtpproxy was doing what it was supposed to do as it works on a modem with no ALG.
 
To fix the posted configuration problem, just flip the internal/external IP when starting rtpproxy. I think the information on how to start it is missleading.
 
Finally, I tested:
 
Internet <-> Internet. It works and rtpproxy is not used as supposed to be.
Internet <-> NATed device arriving at the external interface. It works and here rtpproxy is used as it is suppoed to be.
Internet <-> NATed device behind Kamailio (internal interface). It works and here rtpproxy is used as it is suppoed to be.
 
The only remaining test I want to do is between two devices, registered on internal network, calling eah other. Here rtpproxy should not be used as they are in the same subnet. However, I am afraid it will be used as the check for NATed devices will always be set as NATed if the call is comming from private address space (RFC1918). Am I wrong?
 
Cheers!
Moacir
 
Date: Fri, 18 Jul 2014 00:18:27 +0200
From: miconda at gmail.com
To: sr-users at lists.sip-router.org
Subject: Re: [SR-Users] Kamailio RtpProxy MHomed


  
    
  
  
    

    On 17/07/14 23:10, Moacir Ferreira
      wrote:

    
    
      
      I have created an environment with the same config
        and I find the same problem. While still does not work for
        video, I have changed (flip) the public/internal IP addresses on
        rtpproxy and I can get half call leg working properly,
        includding video.

         

        However, I am testing video calls. So I got another question on
        top of the original post: Can we use rtpproxy also for video or
        it only supports voice rtp proxy?

      
    
    

    Yes, it works for both audio and video at the same time. As an
    example, see my ipv4-ipv6 tutorial where I used it in bridge mode
    and tested with video using Jitsi:

    

    - http://kb.asipto.com/kamailio:kamailio-mixed-ipv4-ipv6

    

    Cheers,

    Daniel

    

    
       

        Cheers,

        Mo

         

        
          Date: Thu, 17 Jul 2014 13:56:53 +0200

          From: miconda at gmail.com

          To: sr-users at lists.sip-router.org

          Subject: Re: [SR-Users] Kamailio RtpProxy MHomed

          

          Hello,

          

          have you looked at sip trace and checked what are the IP
          addresses in the SDP? Maybe you need to swap the flags i and
          e.

          

          You can eventually provide here the incoming invite as well as
          outgoing invite, saying what you would expect to be in the
          outgoing one, so we can give further hints.

          

          Cheers,

          Daniel

          

          On 16/07/14 15:08, Pascal
            Fautré wrote:

          
          
            Hi,
            

            
            I tried to use Kamailio / RTPProxy in mhomed setup
              without any luck.
            I had no problem to configure it with only 1 interface,
              without mhomed, everything worked perfectly.
            

            
            The RTP streams where not established correctly even if
              I managed to have to proper IP in the SIP INVITE (C &
              O).
            

            
            Versions:
            
              version: kamailio
                4.1.4 (x86_64/linux) 
              flags: STATS:
                Off, USE_TCP, USE_TLS, TLS_HOOKS, USE_RAW_SOCKS,
                DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM,
                SHM_MMAP, PKG_MALLOC, DBG_QM_MALLOC, USE_FUTEX,
                FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE,
                USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST,
                HAVE_RESOLV_RES
              ADAPTIVE_WAIT_LOOPS=1024,

                MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE
                1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 4MB
              poll method
                support: poll, epoll_lt, epoll_et, sigio_rt, select.
              id: unknown 
              compiled on
                04:23:19 Jun 13 2014 with gcc 4.7.2
            
            

            
            RTPProxy -v:
            
              Basic version:
                20040107
              Extension
                20050322: Support for multiple RTP streams and MOH
              Extension
                20060704: Support for extra parameter in the V command
              Extension
                20071116: Support for RTP re-packetization
              Extension
                20071218: Support for forking (copying) RTP stream
              Extension
                20080403: Support for RTP statistics querying
              Extension
                20081102: Support for setting codecs in the
                update/lookup command
              Extension
                20081224: Support for session timeout notifications
            
            

            
            

            
            Here is my RTPProxy config (/etc/default/rtpproxy) :
            
              CONTROL_SOCK=udp:127.0.0.1:7722
            
            
              EXTRA_OPTS=“-l PU.BL.IC.IP/PRI.VA.TE.IP
                -m 11000 -M 12000 -d DBUG:LOG_LOCAL3
            
            

            
            

            
            Here are snippets of my kamailio.cfg:
            

            
            
              port=5060
              mhomed=1
              

              
              
                #
                  RTPProxy control
                route[NATMANAGE]

                  {
                #!ifdef

                  WITH_NAT
                     
                    if (is_request()) {
                     
                            if(has_totag()) {
                     
                                    if(check_route_param("nat=yes")) {
                     
                                            setbflag(FLB_NATB);
                     
                                    }
                     
                            }
                     
                    }
                     
                    if (!(isflagset(FLT_NATS) || isbflagset(FLB_NATB)))
                     
                            return;
                

                
                     
                    xlog("NATMANAGE M=$rm OU=$ou  RURI=$ru RD=$rd F=$fu
                  T=$tu NH=$nh(d) IP=$si ID=$ci\n");
                

                
                     
                    if(dst_ip == PUBLIC_IP) {
                     
                            if(is_ipv4($nh(d)) &&
                  is_in_subnet($nh(d), PRIVATE_NET)) {
                     
                                    xlog("NATMANAGE coei\n");
                     
                                    rtpproxy_manage("coei", PRIVATE_IP);
                     
                            } else {
                     
                                    xlog("NATMANAGE coee\n");
                     
                                    rtpproxy_manage("coee", PUBLIC_IP);
                     
                            }
                     
                    } else {
                     
                            if(is_ipv4($nh(d)) &&
                  is_in_subnet($nh(d), PRIVATE_NET)) {
                     
                                    xlog("NATMANAGE coii\n");
                     
                                    rtpproxy_manage("coii", PRIVATE_IP);
                     
                            } else {
                     
                                    xlog("NATMANAGE coie\n");
                     
                                    rtpproxy_manage("coie", PUBLIC_IP);
                     
                            }
                     
                    }
                

                
                     
                    if (is_request()) {
                     
                            if (!has_totag()) {
                     
                                    if(t_is_branch_route()) {
                     
                                            add_rr_param(";nat=yes");
                     
                                    }
                     
                            }
                     
                    }
                     
                    if (is_reply()) {
                     
                            if(isbflagset(FLB_NATB)) {
                     
                                    if(is_first_hop())
                     
                                            set_contact_alias();
                     
                            }
                     
                    }
                #!endif
                     
                    return;
                }
              
              

              
              

              
              Calls were correctly going to the desired
                rtpproxy_manage options. 
              Now I’m not quite sure I’m using the correct ones.
              I had to specify the PUBLIC_IP or PRIVATE_IP in the
                rtpproxy_manage calls in order to have the correct IP
                address in the C and O headers of the SIP INVITE.
                Without that, the public IP would be sent as C and O
                params to phones on the private subnet.
              In fact not a single call direction would give
                correct RTP streams.
              

              
              Any idea where I missed the turn?
              

              
              

              
              Cheers
              

            
            

            
            

            _______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users at lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

          
          

          -- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
          

          _______________________________________________
          SIP Express Router (SER) and Kamailio (OpenSER) - sr-users
          mailing list
          sr-users at lists.sip-router.org
          http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
      
      

      
      

      _______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users at lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

    
    

    -- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
  


_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users at lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20140719/064ef1d3/attachment.html>


More information about the sr-users mailing list