<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    <div class="moz-cite-prefix">On 03/11/14 10:43, Marko Seidenglanz
      wrote:<br>
    </div>
    <blockquote
cite="mid:CANkb97DPAkK_xn3cRZ=futGMmVyJfcmN5w9Eo1rZa-N216ozaA@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hello,
        <div><br>
        </div>
        <div>We are using Kamailio 4.2 and RTPEngine 3.3  hosted on a VM
          behind NAT in Google Cloud Engine.</div>
        <div><br>
        </div>
        <div>Asterisk 11 + Kamailio + RTPEngine are on the same machine
          and Kamailio is used as WebRTC Gateway.<br>
        </div>
        <div><br>
        </div>
        <div>INVITES, that are rewritten by Kamailio look like the
          following:</div>
        <div><br>
        </div>
        <div>
          <div>INVITE <a moz-do-not-send="true"
              href="mailto:sip%3AeTden7KoNSdMVCUNYIwmz@wh2.24dial.com">sip:eTden7KoNSdMVCUNYIwmz@wh2.24dial.com</a>
            SIP/2.0</div>
          <div>Record-Route: <a class="moz-txt-link-rfc2396E" href="sip:0.0.0.0:5064;lr=on;nat=yes"><sip:0.0.0.0:5064;lr=on;nat=yes></a></div>
          <div>Via: SIP/2.0/UDP
            0.0.0.0:5064;branch=z9hG4bK86f5.88fb7f8810c91758b5f3962420d3a4ef.0</div>
          <div>Via: SIP/2.0/UDP
            10.240.1.95:5060;received=127.0.0.1;branch=z9hG4bK05952ee6;rport=5060</div>
          <div>Max-Forwards: 69</div>
          <div>From: "Anonymous"
            <a class="moz-txt-link-rfc2396E" href="sip:anonymous@anonymous.invalid"><sip:anonymous@anonymous.invalid></a>;tag=as7900b63f</div>
          <div>To: <<a moz-do-not-send="true"
              href="mailto:sip%3AeTden7KoNSdMVCUNYIwmz@wh2.24dial.com">sip:eTden7KoNSdMVCUNYIwmz@wh2.24dial.com</a>></div>
          <div>Contact:
            <a class="moz-txt-link-rfc2396E" href="sip:anonymous@10.240.1.95:5060;alias=127.0.0.1~5060~1"><sip:anonymous@10.240.1.95:5060;alias=127.0.0.1~5060~1></a></div>
          <div>Call-ID: <a moz-do-not-send="true"
              href="http://0662d336694c60ed60ed5310571a1aee@10.240.1.95:5060">0662d336694c60ed60ed5310571a1aee@10.240.1.95:5060</a></div>
          <div>CSeq: 102 INVITE</div>
          <div>User-Agent: Asterisk PBX 11.13.1</div>
          <div>Date: Mon, 03 Nov 2014 09:01:39 GMT</div>
          <div>Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER,
            SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE</div>
          <div>Supported: replaces, timer</div>
          <div>Content-Type: application/sdp</div>
          <div>Content-Length: 676</div>
          <div>P-hint: outbound</div>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>As you can see, Kamailio uses 0.0.0.0 for Record-Route as
          well as for VIA Header.</div>
        <div>It uses the address configured in kamilio.cfg (listen=udp:<a
            moz-do-not-send="true" href="http://0.0.0.0:5064">0.0.0.0:5064</a>)</div>
        <div><br>
        </div>
        <div>I know, that we could use the advertise parameter to tell
          kamailio the external IP. The problem is, that IPs in GCE are
          dynamically assigned to the VMs. Thus static configuration of
          external IP is not sufficient for our setup.</div>
        <div><br>
        </div>
        <div>Is there a way, to let Kamailio gather it's external IP
          dynamically. (E.g. using a STUN server or something like
          that?)</div>
        <div><br>
        </div>
        <div>Another possibility would be to tell Kamailio it's external
          IP via a start parameter. Is that possible?</div>
      </div>
    </blockquote>
    <br>
    you can give the advertised address as part of the listen parameter:<br>
    <br>
    listen=<a class="moz-txt-link-freetext" href="udp:localip:port">udp:localip:port</a> advertise publicip:port<br>
    <br>
    You can define tokens in kamailio configuration file via command
    line parameter -A (see kamailio -h).<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a>
Kamailio Advanced Training, Nov 24-27, Berlin - <a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a></pre>
  </body>
</html>