Hello,

We are using Kamailio 4.2 and RTPEngine 3.3  hosted on a VM behind NAT in Google Cloud Engine.

Asterisk 11 + Kamailio + RTPEngine are on the same machine and Kamailio is used as WebRTC Gateway.

INVITES, that are rewritten by Kamailio look like the following:

INVITE sip:eTden7KoNSdMVCUNYIwmz@wh2.24dial.com SIP/2.0
Record-Route: <sip:0.0.0.0:5064;lr=on;nat=yes>
Via: SIP/2.0/UDP 0.0.0.0:5064;branch=z9hG4bK86f5.88fb7f8810c91758b5f3962420d3a4ef.0
Via: SIP/2.0/UDP 10.240.1.95:5060;received=127.0.0.1;branch=z9hG4bK05952ee6;rport=5060
Max-Forwards: 69
From: "Anonymous" <sip:anonymous@anonymous.invalid>;tag=as7900b63f
To: <sip:eTden7KoNSdMVCUNYIwmz@wh2.24dial.com>
Contact: <sip:anonymous@10.240.1.95:5060;alias=127.0.0.1~5060~1>
Call-ID: 0662d336694c60ed60ed5310571a1aee@10.240.1.95:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 11.13.1
Date: Mon, 03 Nov 2014 09:01:39 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 676
P-hint: outbound


As you can see, Kamailio uses 0.0.0.0 for Record-Route as well as for VIA Header.
It uses the address configured in kamilio.cfg (listen=udp:0.0.0.0:5064)

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.

Is there a way, to let Kamailio gather it's external IP dynamically. (E.g. using a STUN server or something like that?)

Another possibility would be to tell Kamailio it's external IP via a start parameter. Is that possible?

Any help would be grateful.

Kind regards,
Marko Seidenglanz