<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>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.<BR> <BR>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.<BR> <BR>Finally, I tested:<BR> <BR>Internet <-> Internet. It works and rtpproxy is not used as supposed to be.<BR>Internet <-> NATed device arriving at the external interface. It works and here rtpproxy is used as it is suppoed to be.<BR>Internet <-> NATed device behind Kamailio (internal interface). It works and here rtpproxy is used as it is suppoed to be.<BR> <BR>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?<BR> <BR>Cheers!<BR>Moacir<br> <BR><div><hr id="stopSpelling">Date: Fri, 18 Jul 2014 00:18:27 +0200<br>From: miconda@gmail.com<br>To: sr-users@lists.sip-router.org<br>Subject: Re: [SR-Users] Kamailio RtpProxy MHomed<br><br>
  
    
  
  
    <br>
    <div class="ecxmoz-cite-prefix">On 17/07/14 23:10, Moacir Ferreira
      wrote:<br>
    </div>
    <blockquote cite="mid:COL131-W6815E37ADAA212C96BBA7EC8F40@phx.gbl">
      <style><!--
.ExternalClass .ecxhmmessage P {
padding:0px;
}

.ExternalClass body.ecxhmmessage {
font-size:12pt;
font-family:Calibri;
}

--></style>
      <div dir="ltr">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.<br>
         <br>
        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?<br>
      </div>
    </blockquote>
    <br>
    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:<br>
    <br>
    - <a class="ecxmoz-txt-link-freetext" href="http://kb.asipto.com/kamailio:kamailio-mixed-ipv4-ipv6" target="_blank">http://kb.asipto.com/kamailio:kamailio-mixed-ipv4-ipv6</a><br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    <blockquote cite="mid:COL131-W6815E37ADAA212C96BBA7EC8F40@phx.gbl">
      <div dir="ltr"> <br>
        Cheers,<br>
        Mo<br>
         <br>
        <div>
          <hr id="ecxstopSpelling">Date: Thu, 17 Jul 2014 13:56:53 +0200<br>
          From: <a class="ecxmoz-txt-link-abbreviated" href="mailto:miconda@gmail.com">miconda@gmail.com</a><br>
          To: <a class="ecxmoz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
          Subject: Re: [SR-Users] Kamailio RtpProxy MHomed<br>
          <br>
          Hello,<br>
          <br>
          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.<br>
          <br>
          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.<br>
          <br>
          Cheers,<br>
          Daniel<br>
          <br>
          <div class="ecxmoz-cite-prefix">On 16/07/14 15:08, Pascal
            Fautré wrote:<br>
          </div>
          <blockquote cite="mid:2F739845-16B6-4350-89D3-D244DB7C262A@alt-tab.be">
            Hi,
            <div><br>
            </div>
            <div>I tried to use Kamailio / RTPProxy in mhomed setup
              without any luck.</div>
            <div>I had no problem to configure it with only 1 interface,
              without mhomed, everything worked perfectly.</div>
            <div><br>
            </div>
            <div>The RTP streams where not established correctly even if
              I managed to have to proper IP in the SIP INVITE (C &
              O).</div>
            <div><br>
            </div>
            <div>Versions:</div>
            <div>
              <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">version: kamailio
                4.1.4 (x86_64/linux) </div>
              <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">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</div>
              <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">ADAPTIVE_WAIT_LOOPS=1024,

                MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE
                1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 4MB</div>
              <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">poll method
                support: poll, epoll_lt, epoll_et, sigio_rt, select.</div>
              <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">id: unknown </div>
              <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">compiled on
                04:23:19 Jun 13 2014 with gcc 4.7.2</div>
            </div>
            <div><br>
            </div>
            <div>RTPProxy -v:</div>
            <div>
              <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">Basic version:
                20040107</div>
              <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">Extension
                20050322: Support for multiple RTP streams and MOH</div>
              <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">Extension
                20060704: Support for extra parameter in the V command</div>
              <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">Extension
                20071116: Support for RTP re-packetization</div>
              <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">Extension
                20071218: Support for forking (copying) RTP stream</div>
              <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">Extension
                20080403: Support for RTP statistics querying</div>
              <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">Extension
                20081102: Support for setting codecs in the
                update/lookup command</div>
              <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">Extension
                20081224: Support for session timeout notifications</div>
            </div>
            <div><br>
            </div>
            <div><br>
            </div>
            <div>Here is my RTPProxy config (/etc/default/rtpproxy) :</div>
            <div>
              <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">CONTROL_SOCK=<a class="ecxmoz-txt-link-freetext" target="_blank">udp:127.0.0.1:7722</a></div>
            </div>
            <div>
              <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">EXTRA_OPTS=“-l <i>PU.BL.IC.IP</i>/<i>PRI.VA.TE.IP</i>
                -m 11000 -M 12000 -d DBUG:LOG_LOCAL3</div>
            </div>
            <div><br>
            </div>
            <div><br>
            </div>
            <div>Here are snippets of my kamailio.cfg:</div>
            <div><br>
            </div>
            <div>
              <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">port=5060</div>
              <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">mhomed=1</div>
              <div><br>
              </div>
              <div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">#
                  RTPProxy control</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">route[NATMANAGE]

                  {</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">#!ifdef

                  WITH_NAT</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                    if (is_request()) {</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                            if(has_totag()) {</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                                    if(check_route_param("nat=yes")) {</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                                            setbflag(FLB_NATB);</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                                    }</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                            }</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                    }</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                    if (!(isflagset(FLT_NATS) || isbflagset(FLB_NATB)))</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                            return;</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; min-height: 14px; background-color: rgb(223, 219, 196);"><br>
                </div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                    xlog("NATMANAGE M=$rm OU=$ou  RURI=$ru RD=$rd F=$fu
                  T=$tu NH=$nh(d) IP=$si ID=$ci\n");</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; min-height: 14px; background-color: rgb(223, 219, 196);"><br>
                </div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                    if(dst_ip == PUBLIC_IP) {</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                            if(is_ipv4($nh(d)) &&
                  is_in_subnet($nh(d), PRIVATE_NET)) {</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                                    xlog("NATMANAGE coei\n");</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                                    rtpproxy_<span style="color: rgb(223, 219, 196); background-color: rgb(76, 47, 45);">manage</span>("coei", PRIVATE_IP);</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                            } else {</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                                    xlog("NATMANAGE coee\n");</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                                    rtpproxy_<span style="color: rgb(223, 219, 196); background-color: rgb(76, 47, 45);">manage</span>("coee", PUBLIC_IP);</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                            }</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                    } else {</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                            if(is_ipv4($nh(d)) &&
                  is_in_subnet($nh(d), PRIVATE_NET)) {</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                                    xlog("NATMANAGE coii\n");</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                                    rtpproxy_<span style="color: rgb(223, 219, 196); background-color: rgb(76, 47, 45);">manage</span>("coii", PRIVATE_IP);</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                            } else {</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                                    xlog("NATMANAGE coie\n");</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                                    rtpproxy_<span style="color: rgb(223, 219, 196); background-color: rgb(76, 47, 45);">manage</span>("coie", PUBLIC_IP);</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                            }</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                    }</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);"><br>
                </div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                    if (is_request()) {</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                            if (!has_totag()) {</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                                    if(t_is_branch_route()) {</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                                            add_rr_param(";nat=yes");</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                                    }</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                            }</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                    }</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                    if (is_reply()) {</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                            if(isbflagset(FLB_NATB)) {</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                                    if(is_first_hop())</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                                            set_contact_alias();</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                            }</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                    }</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">#!endif</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">     
                    return;</div>
                <div style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);">}</div>
              </div>
              <div><br>
              </div>
              <div><br>
              </div>
              <div>Calls were correctly going to the desired
                rtpproxy_manage options. </div>
              <div>Now I’m not quite sure I’m using the correct ones.</div>
              <div>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.</div>
              <div>In fact not a single call direction would give
                correct RTP streams.</div>
              <div><br>
              </div>
              <div>Any idea where I missed the turn?</div>
              <div><br>
              </div>
              <div><br>
              </div>
              <div>Cheers</div>
              <br>
            </div>
            <br>
            <fieldset class="ecxmimeAttachmentHeader"></fieldset>
            <br>
            <pre>_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="ecxmoz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="ecxmoz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
          </blockquote>
          <br>
          <pre class="ecxmoz-signature">-- 
Daniel-Constantin Mierla - <a class="ecxmoz-txt-link-freetext" href="http://www.asipto.com" target="_blank">http://www.asipto.com</a>
<a class="ecxmoz-txt-link-freetext" href="http://twitter.com/#%21/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a class="ecxmoz-txt-link-freetext" href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a></pre>
          <br>
          _______________________________________________
          SIP Express Router (SER) and Kamailio (OpenSER) - sr-users
          mailing list
          <a class="ecxmoz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
          <a class="ecxmoz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a></div>
      </div>
      <br>
      <fieldset class="ecxmimeAttachmentHeader"></fieldset>
      <br>
      <pre>_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="ecxmoz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="ecxmoz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <br>
    <pre class="ecxmoz-signature">-- 
Daniel-Constantin Mierla - <a class="ecxmoz-txt-link-freetext" href="http://www.asipto.com" target="_blank">http://www.asipto.com</a>
<a class="ecxmoz-txt-link-freetext" href="http://twitter.com/#%21/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a class="ecxmoz-txt-link-freetext" href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a></pre>
  

<br>_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</div>                                         </div></body>
</html>