diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c
index f8ed10ce010e3a368d1add474270b1ceec1713b5..b3eabe12ffe8446570226de01098432683d2b23c 100644
--- a/coreapi/linphonecore.c
+++ b/coreapi/linphonecore.c
@@ -41,7 +41,7 @@ static const char *liblinphone_version=LIBLINPHONE_VERSION;
 static void set_network_reachable(LinphoneCore* lc,bool_t isReachable, time_t curtime);
 
 #include "enum.h"
-
+const char *linphone_core_get_nat_address_resolved(LinphoneCore *lc);
 void linphone_core_get_local_ip(LinphoneCore *lc, const char *dest, char *result);
 static void toggle_video_preview(LinphoneCore *lc, bool_t val);
 
@@ -358,6 +358,7 @@ static void net_config_read (LinphoneCore *lc)
 	const char *tmpstr;
 	LpConfig *config=lc->config;
 
+	lc->net_conf.nat_address_ip = NULL;
 	tmp=lp_config_get_int(config,"net","download_bw",0);
 	linphone_core_set_download_bandwidth(lc,tmp);
 	tmp=lp_config_get_int(config,"net","upload_bw",0);
@@ -1080,9 +1081,10 @@ int linphone_core_set_primary_contact(LinphoneCore *lc, const char *contact)
 
 /*result must be an array of chars at least LINPHONE_IPADDR_SIZE */
 void linphone_core_get_local_ip(LinphoneCore *lc, const char *dest, char *result){
+	const char *ip;
 	if (linphone_core_get_firewall_policy(lc)==LinphonePolicyUseNatAddress
-	    && linphone_core_get_nat_address(lc)!=NULL){
-		strncpy(result,linphone_core_get_nat_address(lc),LINPHONE_IPADDR_SIZE);
+	    && (ip=linphone_core_get_nat_address_resolved(lc))!=NULL){
+		strncpy(result,ip,LINPHONE_IPADDR_SIZE);
 		return;
 	}
 	if (linphone_core_get_local_ip_for(lc->sip_conf.ipv6_enabled ? AF_INET6 : AF_INET,dest,result)==0)
@@ -1894,7 +1896,7 @@ static char *get_fixed_contact(LinphoneCore *lc, LinphoneCall *call , LinphonePr
 	if (linphone_core_get_firewall_policy(lc)==LinphonePolicyUseNatAddress){
 		ctt=linphone_core_get_primary_contact_parsed(lc);
 		return ms_strdup_printf("sip:%s@%s",linphone_address_get_username(ctt),
-		    	linphone_core_get_nat_address(lc));
+		    	linphone_core_get_nat_address_resolved(lc));
 	}
 
 	/* if already choosed, don't change it */
@@ -3092,11 +3094,34 @@ void linphone_core_set_nat_address(LinphoneCore *lc, const char *addr)
 	if (lc->sip_conf.contact) update_primary_contact(lc);
 }
 
-const char *linphone_core_get_nat_address(const LinphoneCore *lc)
-{
+const char *linphone_core_get_nat_address(const LinphoneCore *lc) {
 	return lc->net_conf.nat_address;
 }
 
+const char *linphone_core_get_nat_address_resolved(LinphoneCore *lc)
+{
+	struct sockaddr_storage ss;
+	socklen_t ss_len;
+	int error;
+	char ipstring [INET6_ADDRSTRLEN];
+
+	if (parse_hostname_to_addr (lc->net_conf.nat_address, &ss, &ss_len)<0) {
+		return lc->net_conf.nat_address;
+	}
+
+	error = getnameinfo((struct sockaddr *)&ss, ss_len,
+		ipstring, sizeof(ipstring), NULL, 0, NI_NUMERICHOST);
+	if (error) {
+		return lc->net_conf.nat_address;
+	} 
+	
+	if (lc->net_conf.nat_address_ip!=NULL){
+		ms_free(lc->net_conf.nat_address_ip);
+	}
+	lc->net_conf.nat_address_ip = ms_strdup (ipstring);
+	return lc->net_conf.nat_address_ip;
+}
+
 void linphone_core_set_firewall_policy(LinphoneCore *lc, LinphoneFirewallPolicy pol){
 	lc->net_conf.firewall_policy=pol;
 	if (lc->sip_conf.contact) update_primary_contact(lc);
@@ -3715,6 +3740,9 @@ void net_config_uninit(LinphoneCore *lc)
 		lp_config_set_string(lc->config,"net","nat_address",config->nat_address);
 		ms_free(lc->net_conf.nat_address);
 	}
+	if (lc->net_conf.nat_address_ip !=NULL){
+		ms_free(lc->net_conf.nat_address_ip);
+	}
 	lp_config_set_int(lc->config,"net","firewall_policy",config->firewall_policy);
 	lp_config_set_int(lc->config,"net","mtu",config->mtu);	
 }
diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h
index dc673756617d7477f3f6cfd7083e6f687c7b6fe5..e9e410b11e7fa4ca7e30d17af17dc97a73d6fbb7 100644
--- a/coreapi/linphonecore.h
+++ b/coreapi/linphonecore.h
@@ -994,6 +994,9 @@ LinphoneGlobalState linphone_core_get_global_state(const LinphoneCore *lc);
  * @ingroup proxies
  */
 void linphone_core_refresh_registers(LinphoneCore* lc);	
+
+int parse_hostname_to_addr(const char *server, struct sockaddr_storage *ss, socklen_t *socklen);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/coreapi/misc.c b/coreapi/misc.c
index 9cce4c480643be8ff645cd8fe837bdf4365439ed..ccadf03e2db63fe1d779d625673021999549cfa4 100644
--- a/coreapi/misc.c
+++ b/coreapi/misc.c
@@ -396,7 +396,7 @@ static int sendStunRequest(int sock, const struct sockaddr *server, socklen_t ad
 	return 0;
 }
 
-static int parse_stun_server_addr(const char *server, struct sockaddr_storage *ss, socklen_t *socklen){
+int parse_hostname_to_addr(const char *server, struct sockaddr_storage *ss, socklen_t *socklen){
 	struct addrinfo hints,*res=NULL;
 	int ret;
 	const char *port;
@@ -466,7 +466,7 @@ void linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){
 		ac=&call->localdesc->streams[0].candidates[0];
 		vc=&call->localdesc->streams[1].candidates[0];
 		
-		if (parse_stun_server_addr(server,&ss,&ss_len)<0){
+		if (parse_hostname_to_addr(server,&ss,&ss_len)<0){
 			ms_error("Fail to parser stun server address: %s",server);
 			return;
 		}
@@ -596,7 +596,7 @@ int linphone_core_wake_up_possible_already_running_instance(
 		socklen_t sslen;
 		char tmp[100];
 		snprintf(tmp,sizeof(tmp),"127.0.0.1:%i",port);
-		if (parse_stun_server_addr(tmp,&ss,&sslen)==0){
+		if (parse_hostname_to_addr(tmp,&ss,&sslen)==0){
 			int locport=57123;
 			ortp_socket_t sock=create_socket(locport);
 			if (sock<0) sock=create_socket(++locport);
diff --git a/coreapi/private.h b/coreapi/private.h
index 08c9b6aac51b6626bcb7b58be20f029791152da3..305e5a05c84eb38926aee32045b8e9cad6b237d4 100644
--- a/coreapi/private.h
+++ b/coreapi/private.h
@@ -311,7 +311,8 @@ typedef struct rtp_config
 
 typedef struct net_config
 {
-	char *nat_address;
+	char *nat_address; /* may be IP or host name */
+	char *nat_address_ip; /* ip translated from nat_address */
 	char *stun_server;
 	char *relay;
 	int download_bw;
diff --git a/mediastreamer2 b/mediastreamer2
index 39a3f4ddd4a0f60cdd563fdef1d1b7d6e04d140d..f5aeb6f365a85888c1049c346af6f7912cc4f4f1 160000
--- a/mediastreamer2
+++ b/mediastreamer2
@@ -1 +1 @@
-Subproject commit 39a3f4ddd4a0f60cdd563fdef1d1b7d6e04d140d
+Subproject commit f5aeb6f365a85888c1049c346af6f7912cc4f4f1