diff --git a/linphone/console/commands.c b/linphone/console/commands.c
index 75421bad8da6772297d11465465e7cf908fa097c..e9cf3e7046c6670ccc62dc809fc1a13b25544c4e 100644
--- a/linphone/console/commands.c
+++ b/linphone/console/commands.c
@@ -1249,12 +1249,13 @@ linphonec_proxy_use(LinphoneCore *lc, int index)
 static void
 linphonec_friend_display(LinphoneFriend *fr)
 {
-	char *name = linphone_friend_get_name(fr);
-	char *addr = linphone_friend_get_addr(fr);
-	//char *url = linphone_friend_get_url(fr);
-
-	linphonec_out("name: %s\n", name);
-	linphonec_out("address: %s\n", addr);
+	LinphoneUri *uri=linphone_uri_clone(linphone_friend_get_uri(fr));
+	char *str;
+	
+	linphonec_out("name: %s\n", linphone_uri_get_display_name(uri));
+	linphone_uri_set_display_name(uri,NULL);
+	str=linphone_uri_as_string(uri);
+	linphonec_out("address: %s\n", str);
 }
 
 static int
@@ -1272,8 +1273,9 @@ linphonec_friend_list(LinphoneCore *lc, char *pat)
 	for(n=0; friend!=NULL; friend=ms_list_next(friend), ++n )
 	{
 		if ( pat ) {
-			char *name = linphone_friend_get_name(friend->data);
-			if ( ! strstr(name, pat) ) continue;
+			const char *name = linphone_uri_get_display_name(
+			    linphone_friend_get_uri((LinphoneFriend*)friend->data));
+			if (name && ! strstr(name, pat) ) continue;
 		}
 		linphonec_out("****** Friend %i *******\n",n);
 		linphonec_friend_display((LinphoneFriend*)friend->data);
@@ -1293,8 +1295,11 @@ linphonec_friend_call(LinphoneCore *lc, unsigned int num)
 	{
 		if ( n == num )
 		{
-			addr = linphone_friend_get_addr(friend->data);
-			return lpc_cmd_call(lc, addr);
+			int ret;
+			addr = linphone_uri_as_string(linphone_friend_get_uri((LinphoneFriend*)friend->data));
+			ret=lpc_cmd_call(lc, addr);
+			ms_free(addr);
+			return ret;
 		}
 	}
 	linphonec_out("No such friend %u\n", num);
diff --git a/linphone/coreapi/chat.c b/linphone/coreapi/chat.c
index 500c957d96ae300976587cbcff16ff78a74d0fb2..7d8fc4d034665aa9c0be05e4b88dc6f639f39edc 100644
--- a/linphone/coreapi/chat.c
+++ b/linphone/coreapi/chat.c
@@ -27,13 +27,12 @@
  #include <eXosip2/eXosip.h>
  
  LinphoneChatRoom * linphone_core_create_chat_room(LinphoneCore *lc, const char *to){
-	char *real_url=NULL;
-	osip_from_t *parsed_url=NULL;
+	LinphoneUri *parsed_url=NULL;
 	char *route;
-	if (linphone_core_interpret_url(lc,to,&real_url,&parsed_url,&route)){
+	if (linphone_core_interpret_url(lc,to,&parsed_url,&route)){
 		LinphoneChatRoom *cr=ms_new0(LinphoneChatRoom,1);
 		cr->lc=lc;
-		cr->peer=real_url;
+		cr->peer=linphone_uri_as_string(parsed_url);
 		cr->peer_url=parsed_url;
 		cr->route=route;
 		lc->chatrooms=ms_list_append(lc->chatrooms,(void *)cr);
@@ -46,7 +45,7 @@
  void linphone_chat_room_destroy(LinphoneChatRoom *cr){
 	LinphoneCore *lc=cr->lc;
 	lc->chatrooms=ms_list_remove(lc->chatrooms,(void *) cr);
-	osip_from_free(cr->peer_url);
+	linphone_uri_destroy(cr->peer_url);
 	ms_free(cr->peer);
 	ms_free(cr->route);
  }
@@ -60,9 +59,9 @@ void linphone_chat_room_send_message(LinphoneChatRoom *cr, const char *msg){
 	eXosip_message_send_request(sip);
 }
 
-bool_t linphone_chat_room_matches(LinphoneChatRoom *cr, osip_from_t *from){
-	if (cr->peer_url->url->username && from->url->username && 
-		strcmp(cr->peer_url->url->username,from->url->username)==0) return TRUE;
+bool_t linphone_chat_room_matches(LinphoneChatRoom *cr, const LinphoneUri *from){
+	if (linphone_uri_get_username(cr->peer_url) && linphone_uri_get_username(from) && 
+		strcmp(linphone_uri_get_username(cr->peer_url),linphone_uri_get_username(from))==0) return TRUE;
 	return FALSE;
 }
 
@@ -74,9 +73,10 @@ void linphone_core_text_received(LinphoneCore *lc, eXosip_event_t *ev){
 	MSList *elem;
 	const char *msg;
 	LinphoneChatRoom *cr=NULL;
-	char *cleanfrom;
+	char *from;
 	osip_from_t *from_url=ev->request->from;
 	osip_body_t *body=NULL;
+	LinphoneUri *uri;
 
 	osip_message_get_body(ev->request,0,&body);
 	if (body==NULL){
@@ -84,20 +84,25 @@ void linphone_core_text_received(LinphoneCore *lc, eXosip_event_t *ev){
 		return;
 	}
 	msg=body->body;
-	from_2char_without_params(from_url,&cleanfrom);
+	osip_from_to_str(from_url,&from);
+	uri=linphone_uri_new(from);
+	osip_free(from);
+	linphone_uri_clean(uri);
 	for(elem=lc->chatrooms;elem!=NULL;elem=ms_list_next(elem)){
 		cr=(LinphoneChatRoom*)elem->data;
-		if (linphone_chat_room_matches(cr,from_url)){
+		if (linphone_chat_room_matches(cr,uri)){
 			break;
 		}
 		cr=NULL;
 	}
+	from=linphone_uri_as_string(uri);
 	if (cr==NULL){
 		/* create a new chat room */
-		cr=linphone_core_create_chat_room(lc,cleanfrom);
+		cr=linphone_core_create_chat_room(lc,from);
 	}
-	linphone_chat_room_text_received(cr,lc,cleanfrom,msg);
-	osip_free(cleanfrom);
+	linphone_uri_destroy(uri);
+	linphone_chat_room_text_received(cr,lc,from,msg);
+	ms_free(from);
 }
 
 
diff --git a/linphone/coreapi/exevents.c b/linphone/coreapi/exevents.c
index 1c29bb820ff90b06a08305135b30f880e11b1d4e..b961f70ccb163d1c17b2b6e4395252392efeea90 100644
--- a/linphone/coreapi/exevents.c
+++ b/linphone/coreapi/exevents.c
@@ -321,7 +321,7 @@ int linphone_inc_new_call(LinphoneCore *lc, eXosip_event_t *ev)
 		eXosip_unlock();
 		goto end;
 	}
-	lc->call=linphone_call_new_incoming(lc,from,to,ev);
+	lc->call=linphone_call_new_incoming(lc,linphone_uri_new(from),linphone_uri_new(to),ev);
 	
 	sdp=eXosip_get_sdp_info(ev->request);
 	if (sdp==NULL){
diff --git a/linphone/coreapi/friend.c b/linphone/coreapi/friend.c
index ba86e69417b7fb681959fac74fd78cba04cb3485..77321fdef1de3167fb284fa531b41e1f00ed8105 100644
--- a/linphone/coreapi/friend.c
+++ b/linphone/coreapi/friend.c
@@ -77,19 +77,19 @@ const char *linphone_online_status_to_string(LinphoneOnlineStatus ss){
 }
 
 static int friend_data_compare(const void * a, const void * b, void * data){
-	osip_from_t *fa=((LinphoneFriend*)a)->url;
-	osip_from_t *fb=((LinphoneFriend*)b)->url;
-	char *ua,*ub;
-	ua=fa->url->username;
-	ub=fb->url->username;
+	LinphoneUri *fa=((LinphoneFriend*)a)->uri;
+	LinphoneUri *fb=((LinphoneFriend*)b)->uri;
+	const char *ua,*ub;
+	ua=linphone_uri_get_username(fa);
+	ub=linphone_uri_get_username(fb);
 	if (ua!=NULL && ub!=NULL) {
 		//printf("Comparing usernames %s,%s\n",ua,ub);
 		return strcasecmp(ua,ub);
 	}
 	else {
 		/* compare hosts*/
-		ua=fa->url->host;
-		ub=fb->url->host;
+		ua=linphone_uri_get_domain(fa);
+		ub=linphone_uri_get_domain(fb);
 		if (ua!=NULL && ub!=NULL){
 			int ret=strcasecmp(ua,ub);
 			//printf("Comparing hostnames %s,%s,res=%i\n",ua,ub,ret);
@@ -104,11 +104,11 @@ static int friend_compare(const void * a, const void * b){
 }
 
 
-MSList *find_friend(MSList *fl, const osip_from_t *friend, LinphoneFriend **lf){
+MSList *linphone_find_friend(MSList *fl, const LinphoneUri *friend, LinphoneFriend **lf){
 	MSList *res=NULL;
 	LinphoneFriend dummy;
 	if (lf!=NULL) *lf=NULL;
-	dummy.url=(osip_from_t*)friend;
+	dummy.uri=(LinphoneUri*)friend;
 	res=ms_list_find_custom(fl,friend_compare,&dummy);
 	if (lf!=NULL && res!=NULL) *lf=(LinphoneFriend*)res->data;
 	return res;
@@ -137,7 +137,7 @@ void __linphone_friend_do_subscribe(LinphoneFriend *fr){
 	const char *route=NULL;
 	const char *from=NULL;
 	osip_message_t *msg=NULL;
-	osip_from_to_str(fr->url,&friend);
+	friend=linphone_uri_as_string(fr->uri);
 	if (fr->proxy!=NULL){
 		route=fr->proxy->reg_route;
 		from=fr->proxy->reg_identity;
@@ -150,7 +150,7 @@ void __linphone_friend_do_subscribe(LinphoneFriend *fr){
 	eXosip_subscribe_build_initial_request(&msg,friend,from,route,"presence",600);
 	eXosip_subscribe_send_initial_request(msg);
 	eXosip_unlock();
-	osip_free(friend);
+	ms_free(friend);
 }
 
 
@@ -176,63 +176,56 @@ LinphoneFriend *linphone_friend_new_with_addr(const char *addr){
 }
 
 void linphone_core_interpret_friend_uri(LinphoneCore *lc, const char *uri, char **result){
-	int err;
-	osip_from_t *fr=NULL;
-	osip_from_init(&fr);
-	err=osip_from_parse(fr,uri);
-	if (err<0){
+	LinphoneUri *fr=NULL;
+	*result=NULL;
+	fr=linphone_uri_new(uri);
+	if (fr==NULL){
 		char *tmp=NULL;
 		if (strchr(uri,'@')!=NULL){
+			LinphoneUri *u;
 			/*try adding sip:*/
 			tmp=ms_strdup_printf("sip:%s",uri);
+			u=linphone_uri_new(tmp);
+			if (u!=NULL){
+				*result=tmp;
+			}
 		}else if (lc->default_proxy!=NULL){
 			/*try adding domain part from default current proxy*/
-			osip_from_t *id=NULL;
-			osip_from_init(&id);
-			if (osip_from_parse(id,linphone_core_get_identity(lc))==0){
-				if (id->url->port!=NULL && strlen(id->url->port)>0)
-					tmp=ms_strdup_printf("sip:%s@%s:%s",uri,id->url->host,id->url->port);
-				else tmp=ms_strdup_printf("sip:%s@%s",uri,id->url->host);
+			LinphoneUri * id=linphone_uri_new(linphone_core_get_identity(lc));
+			if (id!=NULL){
+				linphone_uri_set_username(id,uri);
+				*result=linphone_uri_as_string(id);
+				linphone_uri_destroy(id);
 			}
-			osip_from_free(id);
 		}
-		if (osip_from_parse(fr,tmp)==0){
+		if (*result){
 			/*looks good */
-			ms_message("%s interpreted as %s",uri,tmp);
-			*result=tmp;
-		}else *result=NULL;
-	}else *result=ms_strdup(uri);
-	osip_from_free(fr);
+			ms_message("%s interpreted as %s",uri,*result);
+		}else{
+			ms_warning("Fail to interpret friend uri %s",uri);
+		}
+	}else *result=linphone_uri_as_string(fr);
+	linphone_uri_destroy(fr);
 }
 
 int linphone_friend_set_sip_addr(LinphoneFriend *lf, const char *addr){
-	int err;
-	osip_from_t *fr=NULL;
-	osip_from_init(&fr);
-	err=osip_from_parse(fr,addr);
-	if (err<0) {
+	LinphoneUri *fr=linphone_uri_new(addr);
+	if (fr==NULL) {
 		ms_warning("Invalid friend sip uri: %s",addr);
-		osip_from_free(fr);
 		return -1;
 	}
-	if (lf->url!=NULL) osip_from_free(lf->url);	
-	lf->url=fr;
+	if (lf->uri!=NULL) linphone_uri_destroy(lf->uri);	
+	lf->uri=fr;
 	return 0;
 }
 
 int linphone_friend_set_name(LinphoneFriend *lf, const char *name){
-	osip_from_t *fr=lf->url;
+	LinphoneUri *fr=lf->uri;
 	if (fr==NULL){
 		ms_error("linphone_friend_set_sip_addr() must be called before linphone_friend_set_name().");
 		return -1;
 	}
-	if (fr->displayname!=NULL){
-		osip_free(fr->displayname);
-		fr->displayname=NULL;
-	}
-	if (name && name[0]!='\0'){
-		fr->displayname=osip_strdup(name);
-	}
+	linphone_uri_set_display_name(fr,name);
 	return 0;
 }
 
@@ -560,7 +553,7 @@ static void linphone_friend_unsubscribe(LinphoneFriend *lf){
 void linphone_friend_destroy(LinphoneFriend *lf){
 	linphone_friend_notify(lf,EXOSIP_SUBCRSTATE_TERMINATED,LINPHONE_STATUS_CLOSED);
 	linphone_friend_unsubscribe(lf);
-	if (lf->url!=NULL) osip_from_free(lf->url);
+	if (lf->uri!=NULL) linphone_uri_destroy(lf->uri);
 	if (lf->info!=NULL) buddy_info_free(lf->info);
 	ms_free(lf);
 }
@@ -571,29 +564,10 @@ void linphone_friend_check_for_removed_proxy(LinphoneFriend *lf, LinphoneProxyCo
 	}
 }
 
-char *linphone_friend_get_addr(LinphoneFriend *lf){
-	char *ret,*tmp;
-	if (lf->url==NULL) return NULL;
-	osip_uri_to_str(lf->url->url,&tmp);
-	ret=ms_strdup(tmp);
-	osip_free(tmp);
-	return ret;
+const LinphoneUri *linphone_friend_get_uri(const LinphoneFriend *lf){
+	return lf->uri;
 }
 
-char *linphone_friend_get_name(LinphoneFriend *lf){
-	if (lf->url==NULL) return NULL;
-	if (lf->url->displayname==NULL) return NULL;
-	return ms_strdup(lf->url->displayname);
-}
-
-char * linphone_friend_get_url(LinphoneFriend *lf){
-	char *tmp,*ret;
-	if (lf->url==NULL) return NULL;
-	osip_from_to_str(lf->url,&tmp);
-	ret=ms_strdup(tmp);
-	ms_free(tmp);
-	return ret;
-}
 
 bool_t linphone_friend_get_send_subscribe(const LinphoneFriend *lf){
 	return lf->subscribe;
@@ -612,7 +586,7 @@ BuddyInfo * linphone_friend_get_info(const LinphoneFriend *lf){
 }
 
 void linphone_friend_apply(LinphoneFriend *fr, LinphoneCore *lc){
-	if (fr->url==NULL) {
+	if (fr->uri==NULL) {
 		ms_warning("No sip url defined.");
 		return;
 	}
@@ -657,7 +631,7 @@ void linphone_friend_done(LinphoneFriend *fr){
 void linphone_core_add_friend(LinphoneCore *lc, LinphoneFriend *lf)
 {
 	ms_return_if_fail(lf->lc==NULL);
-	ms_return_if_fail(lf->url!=NULL);
+	ms_return_if_fail(lf->uri!=NULL);
 	lc->friends=ms_list_append(lc->friends,lf);
 	linphone_friend_apply(lf,lc);
 	return ;
@@ -679,22 +653,26 @@ static bool_t username_match(const char *u1, const char *u2){
 }
 
 LinphoneFriend *linphone_core_get_friend_by_uri(const LinphoneCore *lc, const char *uri){
-	osip_from_t *from;
-	osip_from_init(&from);
+	LinphoneUri *puri=linphone_uri_new(uri);
 	const MSList *elem;
-	if (osip_from_parse(from,uri)!=0){
-		osip_from_free(from);
+	const char *username=linphone_uri_get_username(puri);
+	const char *domain=linphone_uri_get_domain(puri);
+	LinphoneFriend *lf=NULL;
+		
+	if (puri==NULL){
 		return NULL;
 	}
 	for(elem=lc->friends;elem!=NULL;elem=ms_list_next(elem)){
-		LinphoneFriend *lf=(LinphoneFriend*)elem->data;
-		const char *it_username=lf->url->url->username;
-		const char *it_host=lf->url->url->host;
-		if (strcasecmp(from->url->host,it_host)==0 && username_match(from->url->username,it_username)){
-			return lf;
+		lf=(LinphoneFriend*)elem->data;
+		const char *it_username=linphone_uri_get_username(lf->uri);
+		const char *it_host=linphone_uri_get_domain(lf->uri);;
+		if (strcasecmp(domain,it_host)==0 && username_match(username,it_username)){
+			break;
 		}
+		lf=NULL;
 	}
-	return NULL;
+	linphone_uri_destroy(puri);
+	return lf;
 }
 
 #define key_compare(key, word) strncasecmp((key),(word),strlen(key))
@@ -781,8 +759,8 @@ void linphone_friend_write_to_config_file(LpConfig *config, LinphoneFriend *lf,
 		lp_config_clean_section(config,key);
 		return;
 	}
-	if (lf->url!=NULL){
-		osip_from_to_str(lf->url,&tmp);
+	if (lf->uri!=NULL){
+		tmp=linphone_uri_as_string(lf->uri);
 		if (tmp==NULL) {
 			return;
 		}
diff --git a/linphone/coreapi/linphonecore.c b/linphone/coreapi/linphonecore.c
index 91d7897dcaab21b3e391c069269f0f106caaa5b8..1c47bece354ce7833d882847f657f6ccd71eda88 100644
--- a/linphone/coreapi/linphonecore.c
+++ b/linphone/coreapi/linphonecore.c
@@ -73,7 +73,7 @@ int lc_callback_obj_invoke(LCCallbackObj *obj, LinphoneCore *lc){
 	return 0;
 }
 
-static void  linphone_call_init_common(LinphoneCall *call, char *from, char *to){
+static void  linphone_call_init_common(LinphoneCall *call, LinphoneUri *from, LinphoneUri *to){
 	call->state=LCStateInit;
 	call->start_time=time(NULL);
 	call->media_start_time=0;
@@ -102,32 +102,28 @@ static void discover_mtu(LinphoneCore *lc, const char *remote){
 	}
 }
 
-LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, const osip_from_t *from, const osip_to_t *to)
+LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneUri *from, LinphoneUri *to)
 {
 	LinphoneCall *call=ms_new0(LinphoneCall,1);
-	char *fromstr=NULL,*tostr=NULL;
 	call->dir=LinphoneCallOutgoing;
 	call->cid=-1;
 	call->did=-1;
 	call->tid=-1;
 	call->core=lc;
-	linphone_core_get_local_ip(lc,to->url->host,call->localip);
-	osip_from_to_str(from,&fromstr);
-	osip_to_to_str(to,&tostr);
-	linphone_call_init_common(call,fromstr,tostr);
+	linphone_core_get_local_ip(lc,linphone_uri_get_domain(to),call->localip);
+	linphone_call_init_common(call,from,to);
 	call->sdpctx=sdp_handler_create_context(&linphone_sdphandler,
 		call->audio_params.natd_port>0 ? call->audio_params.natd_addr : call->localip,
-		from->url->username,NULL);
+		linphone_uri_get_username (from),NULL);
 	sdp_context_set_user_pointer(call->sdpctx,(void*)call);
-	discover_mtu(lc,to->url->host);
+	discover_mtu(lc,linphone_uri_get_domain (to));
 	return call;
 }
 
 
-LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, const char *from, const char *to, eXosip_event_t *ev){
+LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneUri *from, LinphoneUri *to, eXosip_event_t *ev){
 	LinphoneCall *call=ms_new0(LinphoneCall,1);
-	osip_from_t *me= linphone_core_get_primary_contact_parsed(lc);
-	osip_from_t *from_url=NULL;
+	LinphoneUri *me=linphone_core_get_primary_contact_parsed(lc);
 	osip_header_t *h=NULL;
 
 	call->dir=LinphoneCallIncoming;
@@ -135,17 +131,17 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, const char *from, co
 	call->did=ev->did;
 	call->tid=ev->tid;
 	call->core=lc;
-	osip_from_init(&from_url);
-	osip_from_parse(from_url, from);
-	linphone_core_get_local_ip(lc,from_url->url->host,call->localip);
-	linphone_call_init_common(call, osip_strdup(from), osip_strdup(to));
+	
+	linphone_uri_clean(from);
+	
+	linphone_core_get_local_ip(lc,linphone_uri_get_domain(from),call->localip);
+	linphone_call_init_common(call, from, to);
 	call->sdpctx=sdp_handler_create_context(&linphone_sdphandler,
 		call->audio_params.natd_port>0 ? call->audio_params.natd_addr : call->localip,
-		me->url->username,NULL);
+		linphone_uri_get_username (me),NULL);
 	sdp_context_set_user_pointer(call->sdpctx,(void*)call);
-	discover_mtu(lc,from_url->url->host);
-	osip_from_free(me);
-	osip_from_free(from_url);
+	discover_mtu(lc,linphone_uri_get_domain(from));
+	linphone_uri_destroy(me);
 	osip_message_header_get_byname(ev->request,"Session-expires",0,&h);
 	if (h) call->supports_session_timers=TRUE;
 	return call;
@@ -166,7 +162,7 @@ static size_t my_strftime(char *s, size_t max, const char  *fmt,  const struct t
 	return strftime(s, max, fmt, tm);
 }
 
-LinphoneCallLog * linphone_call_log_new(LinphoneCall *call, char *from, char *to){
+LinphoneCallLog * linphone_call_log_new(LinphoneCall *call, LinphoneUri *from, LinphoneUri *to){
 	LinphoneCallLog *cl=ms_new0(LinphoneCallLog,1);
 	struct tm loctime;
 	cl->dir=call->dir;
@@ -218,6 +214,9 @@ void linphone_call_log_completed(LinphoneCallLog *calllog, LinphoneCall *call){
 
 char * linphone_call_log_to_str(LinphoneCallLog *cl){
 	char *status;
+	char *tmp;
+	char *from=linphone_uri_as_string (cl->from);
+	char *to=linphone_uri_as_string (cl->to);
 	switch(cl->status){
 		case LinphoneCallAborted:
 			status=_("aborted");
@@ -231,14 +230,17 @@ char * linphone_call_log_to_str(LinphoneCallLog *cl){
 		default:
 			status="unknown";
 	}
-	return ortp_strdup_printf(_("%s at %s\nFrom: %s\nTo: %s\nStatus: %s\nDuration: %i mn %i sec\n"),
+	tmp=ortp_strdup_printf(_("%s at %s\nFrom: %s\nTo: %s\nStatus: %s\nDuration: %i mn %i sec\n"),
 			(cl->dir==LinphoneCallIncoming) ? _("Incoming call") : _("Outgoing call"),
 			cl->start_date,
-			cl->from,
-			cl->to,
+			from,
+			to,
 			status,
 			cl->duration/60,
 			cl->duration%60);
+	ms_free(from);
+	ms_free(to);
+	return tmp;
 }
 
 void linphone_call_log_destroy(LinphoneCallLog *cl){
@@ -254,7 +256,7 @@ int linphone_core_get_current_call_duration(const LinphoneCore *lc){
 	return time(NULL)-call->media_start_time;
 }
 
-const char *linphone_core_get_remote_uri(LinphoneCore *lc){
+const LinphoneUri *linphone_core_get_remote_uri(LinphoneCore *lc){
 	LinphoneCall *call=lc->call;
 	if (call==NULL) return 0;
 	return call->dir==LinphoneCallIncoming ? call->log->from : call->log->to;
@@ -857,16 +859,8 @@ bool_t linphone_core_get_guess_hostname(LinphoneCore *lc){
 	return lc->sip_conf.guess_hostname;
 }
 
-osip_from_t *linphone_core_get_primary_contact_parsed(LinphoneCore *lc){
-	int err;
-	osip_from_t *contact;
-	osip_from_init(&contact);
-	err=osip_from_parse(contact,linphone_core_get_primary_contact(lc));
-	if (err<0) {
-		osip_from_free(contact);
-		return NULL;
-	}
-	return contact;
+LinphoneUri *linphone_core_get_primary_contact_parsed(LinphoneCore *lc){
+	return linphone_uri_new(linphone_core_get_primary_contact(lc));
 }
 
 int linphone_core_set_audio_codecs(LinphoneCore *lc, MSList *codecs)
@@ -1091,20 +1085,18 @@ static void linphone_core_grab_buddy_infos(LinphoneCore *lc, LinphoneProxyConfig
 	for(elem=linphone_core_get_friend_list(lc);elem!=NULL;elem=elem->next){
 		LinphoneFriend *lf=(LinphoneFriend*)elem->data;
 		if (lf->info==NULL){
-			char *url=linphone_friend_get_url(lf);
-			if (linphone_core_lookup_known_proxy(lc,url)==cfg){
-				if (lf->url->url->username!=NULL && lf->url->url->username[0]!='\0'){
+			if (linphone_core_lookup_known_proxy(lc,lf->uri)==cfg){
+				if (linphone_uri_get_username(lf->uri)!=NULL){
 					BuddyLookupRequest *req;
-					char tmp[255];
-					snprintf(tmp,sizeof(tmp),"sip:%s@%s",lf->url->url->username,lf->url->url->host);
+					char *tmp=linphone_uri_as_string_without_display_name(lf->uri);
 					req=sip_setup_context_create_buddy_lookup_request(ctx);
 					buddy_lookup_request_set_key(req,tmp);
 					buddy_lookup_request_set_max_results(req,1);
 					sip_setup_context_buddy_lookup_submit(ctx,req);
 					lc->bl_reqs=ms_list_append(lc->bl_reqs,req);
+					ms_free(tmp);
 				}
 			}
-			ms_free(url);
 		}
 	}
 }
@@ -1210,16 +1202,6 @@ bool_t linphone_core_is_in_main_thread(LinphoneCore *lc){
 	return TRUE;
 }
 
-static osip_to_t *osip_to_create(const char *to){
-	osip_to_t *ret;
-	osip_to_init(&ret);
-	if (osip_to_parse(ret,to)<0){
-		osip_to_free(ret);
-		return NULL;
-	}
-	return ret;
-}
-
 static char *guess_route_if_any(LinphoneCore *lc, osip_to_t *parsed_url){
 	const MSList *elem=linphone_core_get_proxy_config_list(lc);
 	for(;elem!=NULL;elem=elem->next){
@@ -1247,14 +1229,13 @@ static char *guess_route_if_any(LinphoneCore *lc, osip_to_t *parsed_url){
 	return NULL;
 }
 
-bool_t linphone_core_interpret_url(LinphoneCore *lc, const char *url, char **real_url, osip_to_t **real_parsed_url, char **route){
+bool_t linphone_core_interpret_url(LinphoneCore *lc, const char *url, LinphoneUri **real_parsed_url, char **route){
 	enum_lookup_res_t *enumres=NULL;
 	osip_to_t *parsed_url=NULL;
 	char *enum_domain=NULL;
 	LinphoneProxyConfig *proxy;
 	char *tmpurl;
 	const char *tmproute;
-	if (real_url!=NULL) *real_url=NULL;
 	if (real_parsed_url!=NULL) *real_parsed_url=NULL;
 	*route=NULL;
 	tmproute=linphone_core_get_route(lc);
@@ -1268,8 +1249,7 @@ bool_t linphone_core_interpret_url(LinphoneCore *lc, const char *url, char **rea
 		}
 		ms_free(enum_domain);
 		tmpurl=enumres->sip_address[0];
-		if (real_url!=NULL) *real_url=ms_strdup(tmpurl);
-		if (real_parsed_url!=NULL) *real_parsed_url=osip_to_create(tmpurl);
+		if (real_parsed_url!=NULL) *real_parsed_url=linphone_uri_new(tmpurl);
 		enum_lookup_res_free(enumres);
 		if (tmproute) *route=ms_strdup(tmproute);
 		return TRUE;
@@ -1280,22 +1260,14 @@ bool_t linphone_core_interpret_url(LinphoneCore *lc, const char *url, char **rea
 		proxy=lc->default_proxy;
 		if (proxy!=NULL){
 			/* append the proxy domain suffix */
-			osip_from_t *uri;
-			char *sipaddr;
+			LinphoneUri *uri;
 			const char *identity=linphone_proxy_config_get_identity(proxy);
-			osip_from_init(&uri);
-			if (osip_from_parse(uri,identity)<0){
-				osip_from_free(uri);
+			uri=linphone_uri_new(identity);
+			if (uri==NULL){
 				return FALSE;
 			}
-			if (uri->url->port!=NULL && uri->url->port[0]!='\0')
-				sipaddr=ortp_strdup_printf("sip:%s@%s:%s",url,uri->url->host,uri->url->port);
-			else
-				sipaddr=ortp_strdup_printf("sip:%s@%s",url,uri->url->host);
-			osip_from_free(uri);
-			if (real_parsed_url!=NULL) *real_parsed_url=osip_to_create(sipaddr);
-			if (real_url!=NULL) *real_url=sipaddr;
-			else ms_free(sipaddr);
+			linphone_uri_set_username(uri,url);
+			if (real_parsed_url!=NULL) *real_parsed_url=uri;
 #if 0
 			/*if the prompted uri was auto-suffixed with proxy domain,
 			then automatically set a route so that the request goes
@@ -1320,11 +1292,10 @@ bool_t linphone_core_interpret_url(LinphoneCore *lc, const char *url, char **rea
 			return TRUE;
 		}
 	}
-	parsed_url=osip_to_create(url);
+	parsed_url=linphone_uri_new(url);
 	if (parsed_url!=NULL){
-		if (real_url!=NULL) *real_url=ms_strdup(url);
 		if (real_parsed_url!=NULL) *real_parsed_url=parsed_url;
-		else osip_to_free(parsed_url);
+		else linphone_uri_destroy(parsed_url);
 		if (tmproute) *route=ms_strdup(tmproute);
 		else *route=guess_route_if_any(lc,*real_parsed_url);
 		return TRUE;
@@ -1365,21 +1336,17 @@ void linphone_set_sdp(osip_message_t *sip, const char *sdpmesg){
 	osip_message_set_content_length(sip,clen);
 }
 
-LinphoneProxyConfig * linphone_core_lookup_known_proxy(LinphoneCore *lc, const char *uri){
+LinphoneProxyConfig * linphone_core_lookup_known_proxy(LinphoneCore *lc, const LinphoneUri *uri){
 	const MSList *elem;
 	LinphoneProxyConfig *found_cfg=NULL;
-	osip_from_t *parsed_uri;
-	osip_from_init(&parsed_uri);
-	osip_from_parse(parsed_uri,uri);
 	for (elem=linphone_core_get_proxy_config_list(lc);elem!=NULL;elem=elem->next){
 		LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)elem->data;
 		const char *domain=linphone_proxy_config_get_domain(cfg);
-		if (domain!=NULL && strcmp(domain,parsed_uri->url->host)==0){
+		if (domain!=NULL && strcmp(domain,linphone_uri_get_domain(uri))==0){
 			found_cfg=cfg;
 			break;
 		}
 	}
-	osip_from_free(parsed_uri);
 	return found_cfg;
 }
 
@@ -1426,8 +1393,8 @@ int linphone_core_invite(LinphoneCore *lc, const char *url)
 	osip_message_t *invite=NULL;
 	sdp_context_t *ctx=NULL;
 	LinphoneProxyConfig *proxy=NULL;
-	osip_from_t *parsed_url2=NULL;
-	osip_to_t *real_parsed_url=NULL;
+	LinphoneUri *parsed_url2=NULL;
+	LinphoneUri *real_parsed_url=NULL;
 	char *real_url=NULL;
 	LinphoneProxyConfig *dest_proxy=NULL;
 	
@@ -1438,12 +1405,13 @@ int linphone_core_invite(LinphoneCore *lc, const char *url)
 
 	gstate_new_state(lc, GSTATE_CALL_OUT_INVITE, url);
 	linphone_core_get_default_proxy(lc,&proxy);
-	if (!linphone_core_interpret_url(lc,url,&real_url,&real_parsed_url,&route)){
+	if (!linphone_core_interpret_url(lc,url,&real_parsed_url,&route)){
 		/* bad url */
 		gstate_new_state(lc, GSTATE_CALL_ERROR, NULL);
 		return -1;
 	}
-	dest_proxy=linphone_core_lookup_known_proxy(lc,real_url);
+	real_url=linphone_uri_as_string(real_parsed_url);
+	dest_proxy=linphone_core_lookup_known_proxy(lc,real_parsed_url);
 
 	if (proxy!=dest_proxy && dest_proxy!=NULL) {
 		ms_message("Overriding default proxy setting for this call:");
@@ -1470,8 +1438,7 @@ int linphone_core_invite(LinphoneCore *lc, const char *url)
 	}
 	/* make sdp message */
 	
-	osip_from_init(&parsed_url2);
-	osip_from_parse(parsed_url2,from);
+	parsed_url2=linphone_uri_new(from);
 	
 	lc->call=linphone_call_new_outgoing(lc,parsed_url2,real_parsed_url);
 	/*try to be best-effort in giving real local or routable contact address,
@@ -1503,8 +1470,6 @@ int linphone_core_invite(LinphoneCore *lc, const char *url)
 	goto end;
 	end:
 		if (real_url!=NULL) ms_free(real_url);
-		if (real_parsed_url!=NULL) osip_to_free(real_parsed_url);
-		if (parsed_url2!=NULL) osip_from_free(parsed_url2);
 		if (err<0)
 			gstate_new_state(lc, GSTATE_CALL_ERROR, NULL);
 		if (route!=NULL) ms_free(route);
@@ -1514,11 +1479,11 @@ int linphone_core_invite(LinphoneCore *lc, const char *url)
 int linphone_core_refer(LinphoneCore *lc, const char *url)
 {
 	char *real_url=NULL;
-	osip_to_t *real_parsed_url=NULL;
+	LinphoneUri *real_parsed_url=NULL;
 	LinphoneCall *call;
 	osip_message_t *msg=NULL;
 	char *route;
-	if (!linphone_core_interpret_url(lc,url,&real_url,&real_parsed_url, &route)){
+	if (!linphone_core_interpret_url(lc,url,&real_parsed_url, &route)){
 		/* bad url */
 		return -1;
 	}
@@ -1529,7 +1494,9 @@ int linphone_core_refer(LinphoneCore *lc, const char *url)
 		return -1;
 	}
 	lc->call=NULL;
+	real_url=linphone_uri_as_string (real_parsed_url);
 	eXosip_call_build_refer(call->did, real_url, &msg);
+	ms_free(real_url);
 	eXosip_lock();
 	eXosip_call_send_request(call->did, msg);
 	eXosip_unlock();
@@ -1723,14 +1690,14 @@ static void post_configure_audio_streams(LinphoneCore *lc){
 }
 
 void linphone_core_start_media_streams(LinphoneCore *lc, LinphoneCall *call){
-	osip_from_t *me=linphone_core_get_primary_contact_parsed(lc);
+	LinphoneUri *me=linphone_core_get_primary_contact_parsed(lc);
 	const char *tool="linphone-" LINPHONE_VERSION;
 	/* adjust rtp jitter compensation. It must be at least the latency of the sound card */
 	int jitt_comp=MAX(lc->sound_conf.latency,lc->rtp_conf.audio_jitt_comp);
 
 	if (call->media_start_time==0) call->media_start_time=time(NULL);
 
-	char *cname=ortp_strdup_printf("%s@%s",me->url->username,me->url->host);
+	char *cname=ortp_strdup_printf("%s@%s",linphone_uri_get_username(me),linphone_uri_get_domain(me));
 	{
 		StreamParams *audio_params=&call->audio_params;
 		if (!lc->use_files){
@@ -1809,7 +1776,7 @@ void linphone_core_start_media_streams(LinphoneCore *lc, LinphoneCall *call){
 	goto end;
 	end:
 	ms_free(cname);
-	osip_from_free(me);
+	linphone_uri_destroy(me);
 	lc->call->state=LCStateAVRunning;
 }
 
@@ -2809,3 +2776,108 @@ void linphone_core_destroy(LinphoneCore *lc){
 	linphone_core_uninit(lc);
 	ms_free(lc);
 }
+
+LinphoneUri * linphone_uri_new(const char *uri){
+	osip_from_t *from;
+	osip_from_init(&from);
+	if (osip_from_parse(from,uri)!=0){
+		osip_from_free(from);
+		return NULL;
+	}
+	return from;
+}
+
+LinphoneUri * linphone_uri_clone(const LinphoneUri *uri){
+	osip_from_t *ret=NULL;
+	osip_from_clone(uri,&ret);
+	return ret;
+}
+
+#define null_if_empty(s) (((s)!=NULL && (s)[0]!='\0') ? (s) : NULL )
+
+const char *linphone_uri_get_scheme(const LinphoneUri *u){
+	return null_if_empty(u->url->scheme);
+}
+
+const char *linphone_uri_get_display_name(const LinphoneUri* u){
+	return null_if_empty(u->displayname);
+}
+
+const char *linphone_uri_get_username(const LinphoneUri *u){
+	return null_if_empty(u->url->username);
+}
+
+const char *linphone_uri_get_domain(const LinphoneUri *u){
+	return null_if_empty(u->url->host);
+}
+
+void linphone_uri_set_display_name(LinphoneUri *u, const char *display_name){
+	if (u->displayname!=NULL){
+		osip_free(u->displayname);
+		u->displayname=NULL;
+	}
+	if (display_name!=NULL)
+		u->displayname=osip_strdup(display_name);
+}
+
+void linphone_uri_set_username(LinphoneUri *uri, const char *username){
+	if (uri->url->username!=NULL){
+		osip_free(uri->url->username);
+		uri->url->username=NULL;
+	}
+	if (username)
+		uri->url->username=osip_strdup(username);
+}
+
+void linphone_uri_set_domain(LinphoneUri *uri, const char *host){
+	if (uri->url->host!=NULL){
+		osip_free(uri->url->host);
+		uri->url->host=NULL;
+	}
+	if (host)
+		uri->url->host=osip_strdup(host);
+}
+
+void linphone_uri_set_port(LinphoneUri *uri, const char *port){
+	if (uri->url->port!=NULL){
+		osip_free(uri->url->port);
+		uri->url->port=NULL;
+	}
+	if (port)
+		uri->url->port=osip_strdup(port);
+}
+
+void linphone_uri_set_port_int(LinphoneUri *uri, int port){
+	char tmp[12];
+	if (port==5060){
+		/*this is the default, special case to leave the port field blank*/
+		linphone_uri_set_port(uri,NULL);
+		return;
+	}
+	snprintf(tmp,sizeof(tmp),"%i",port);
+	linphone_uri_set_port(uri,tmp);
+}
+
+void linphone_uri_clean(LinphoneUri *uri){
+	osip_generic_param_freelist(&uri->gen_params);
+}
+
+char *linphone_uri_as_string(const LinphoneUri *u){
+	char *tmp,*ret;
+	osip_from_to_str(u,&tmp);
+	ret=ms_strdup(tmp);
+	osip_free(tmp);
+	return ret;
+}
+
+char *linphone_uri_as_string_without_display_name(const LinphoneUri *u){
+	char *tmp=NULL,*ret;
+	osip_uri_to_str(u->url,&tmp);
+	ret=ms_strdup(tmp);
+	osip_free(tmp);
+	return ret;
+}
+
+void linphone_uri_destroy(LinphoneUri *u){
+	osip_from_free(u);
+}
diff --git a/linphone/coreapi/linphonecore.h b/linphone/coreapi/linphonecore.h
index aac57eb93cc33f822b149c8fd80378abdde1c88d..beeef3028894701f5940e3ae76cbe0122ec61e76 100644
--- a/linphone/coreapi/linphonecore.h
+++ b/linphone/coreapi/linphonecore.h
@@ -19,8 +19,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #ifndef LINPHONECORE_H
 #define LINPHONECORE_H
 
-
-#include <osipparser2/osip_message.h>
 #include "ortp/ortp.h"
 #include "ortp/payloadtype.h"
 #include "mediastreamer2/mscommon.h"
@@ -147,6 +145,26 @@ typedef struct autoreplier_config
 	const char *message;		/* the path of the file to be played */
 }autoreplier_config_t;
 
+struct osip_from;
+
+typedef struct osip_from LinphoneUri;
+
+LinphoneUri * linphone_uri_new(const char *uri);
+LinphoneUri * linphone_uri_clone(const LinphoneUri *uri);
+const char *linphone_uri_get_scheme(const LinphoneUri *u);
+const char *linphone_uri_get_display_name(const LinphoneUri* u);
+const char *linphone_uri_get_username(const LinphoneUri *u);
+const char *linphone_uri_get_domain(const LinphoneUri *u);
+void linphone_uri_set_display_name(LinphoneUri *u, const char *display_name);
+void linphone_uri_set_username(LinphoneUri *uri, const char *username);
+void linphone_uri_set_domain(LinphoneUri *uri, const char *host);
+void linphone_uri_set_port(LinphoneUri *uri, const char *port);
+void linphone_uri_set_port_int(LinphoneUri *uri, int port);
+/*remove tags, params etc... so that it is displayable to the user*/
+void linphone_uri_clean(LinphoneUri *uri);
+char *linphone_uri_as_string(const LinphoneUri *u);
+char *linphone_uri_as_string_without_display_name(const LinphoneUri *u);
+void linphone_uri_destroy(LinphoneUri *u);
 
 struct _LinphoneCore;
 struct _sdp_context;
@@ -166,11 +184,10 @@ typedef enum _LinphoneCallStatus {
 typedef struct _LinphoneCallLog{
 	LinphoneCallDir dir;
 	LinphoneCallStatus status;
-	char *from;
-	char *to;
+	LinphoneUri *from;
+	LinphoneUri *to;
 	char start_date[128];
 	int duration;
-	
 } LinphoneCallLog;
 
 
@@ -204,7 +221,7 @@ typedef enum _LinphoneOnlineStatus{
 const char *linphone_online_status_to_string(LinphoneOnlineStatus ss);
 
 typedef struct _LinphoneFriend{
-	osip_from_t *url;
+	LinphoneUri *uri;
 	int in_did;
 	int out_did;
 	int sid;
@@ -228,10 +245,7 @@ int linphone_friend_set_proxy(LinphoneFriend *fr, struct _LinphoneProxyConfig *c
 void linphone_friend_edit(LinphoneFriend *fr);
 void linphone_friend_done(LinphoneFriend *fr);
 void linphone_friend_destroy(LinphoneFriend *lf);
-/* memory returned by those 3 functions must be freed */
-char *linphone_friend_get_name(LinphoneFriend *lf);
-char *linphone_friend_get_addr(LinphoneFriend *lf);
-char *linphone_friend_get_url(LinphoneFriend *lf);	/* name <sip address> */
+const LinphoneUri *linphone_friend_get_uri(const LinphoneFriend *lf);
 bool_t linphone_friend_get_send_subscribe(const LinphoneFriend *lf);
 LinphoneSubscribePolicy linphone_friend_get_inc_subscribe_policy(const LinphoneFriend *lf);
 LinphoneOnlineStatus linphone_friend_get_status(const LinphoneFriend *lf);
@@ -336,7 +350,7 @@ struct _LinphoneChatRoom{
 	struct _LinphoneCore *lc;
 	char  *peer;
 	char *route;
-	osip_from_t *peer_url;
+	LinphoneUri *peer_url;
 	void * user_data;
 };
 typedef struct _LinphoneChatRoom LinphoneChatRoom;
@@ -560,7 +574,7 @@ bool_t linphone_core_get_guess_hostname(LinphoneCore *lc);
 bool_t linphone_core_ipv6_enabled(LinphoneCore *lc);
 void linphone_core_enable_ipv6(LinphoneCore *lc, bool_t val);
 
-osip_from_t *linphone_core_get_primary_contact_parsed(LinphoneCore *lc);
+LinphoneUri *linphone_core_get_primary_contact_parsed(LinphoneCore *lc);
 
 /*0= no bandwidth limit*/
 void linphone_core_set_download_bandwidth(LinphoneCore *lc, int bw);
@@ -749,7 +763,7 @@ void linphone_core_set_record_file(LinphoneCore *lc, const char *file);
 
 gstate_t linphone_core_get_state(const LinphoneCore *lc, gstate_group_t group);
 int linphone_core_get_current_call_duration(const LinphoneCore *lc);
-const char *linphone_core_get_remote_uri(LinphoneCore *lc);
+const LinphoneUri *linphone_core_get_remote_uri(LinphoneCore *lc);
 
 int linphone_core_get_mtu(const LinphoneCore *lc);
 void linphone_core_set_mtu(LinphoneCore *lc, int mtu);
@@ -791,7 +805,7 @@ void linphone_core_start_media_streams(LinphoneCore *lc, struct _LinphoneCall *c
 void linphone_core_stop_media_streams(LinphoneCore *lc);
 const char * linphone_core_get_identity(LinphoneCore *lc);
 const char * linphone_core_get_route(LinphoneCore *lc);
-bool_t linphone_core_interpret_url(LinphoneCore *lc, const char *url, char **real_url, osip_to_t **real_parsed_url, char **route);
+bool_t linphone_core_interpret_url(LinphoneCore *lc, const char *url, LinphoneUri **real_parsed_url, char **route);
 void linphone_core_start_waiting(LinphoneCore *lc, const char *purpose);
 void linphone_core_update_progress(LinphoneCore *lc, const char *purpose, float progresses);
 void linphone_core_stop_waiting(LinphoneCore *lc);
diff --git a/linphone/coreapi/presence.c b/linphone/coreapi/presence.c
index 0664fbee79333f972da24ff2de9df47198ec714f..7a19521f2c30d18bfeb82a7f9b96af5bea220fff 100644
--- a/linphone/coreapi/presence.c
+++ b/linphone/coreapi/presence.c
@@ -35,10 +35,9 @@ void linphone_core_add_subscriber(LinphoneCore *lc, const char *subscriber, int
 	fl->inc_subscribe_pending=TRUE;
 	lc->subscribers=ms_list_append(lc->subscribers,(void *)fl);
 	if (lc->vtable.new_unknown_subscriber!=NULL) {
-		char *clean_subscriber;	/* we need to remove tags...*/
-		from_2char_without_params(fl->url,&clean_subscriber);
-		lc->vtable.new_unknown_subscriber(lc,fl,clean_subscriber);
-		ms_free(clean_subscriber);
+		char *subscriber=linphone_uri_as_string(fl->uri);
+		lc->vtable.new_unknown_subscriber(lc,fl,subscriber);
+		ms_free(subscriber);
 	}
 }
 
@@ -75,12 +74,12 @@ void linphone_subscription_new(LinphoneCore *lc, eXosip_event_t *ev){
 	osip_from_t *from=ev->request->from;
 	char *tmp;
 	osip_message_t *msg=NULL;
-
+	LinphoneUri *uri;
 	osip_from_to_str(ev->request->from,&tmp);
-
+	uri=linphone_uri_new(tmp);
 	ms_message("Receiving new subscription from %s.",tmp);
 	/* check if we answer to this subscription */
-	if (find_friend(lc->friends,from,&lf)!=NULL){
+	if (linphone_find_friend(lc->friends,uri,&lf)!=NULL){
 		lf->in_did=ev->did;
 		linphone_friend_set_nid(lf,ev->nid);
 		eXosip_insubscription_build_answer(ev->tid,202,&msg);
@@ -89,7 +88,7 @@ void linphone_subscription_new(LinphoneCore *lc, eXosip_event_t *ev){
 		linphone_friend_done(lf);	/*this will do all necessary actions */
 	}else{
 		/* check if this subscriber is in our black list */
-		if (find_friend(lc->subscribers,from,&lf)){
+		if (linphone_find_friend(lc->subscribers,uri,&lf)){
 			if (lf->pol==LinphoneSPDeny){
 				ms_message("Rejecting %s because we already rejected it once.",from);
 				eXosip_insubscription_send_answer(ev->tid,401,NULL);
@@ -113,7 +112,7 @@ void linphone_notify_recv(LinphoneCore *lc, eXosip_event_t *ev)
 	const char *img="sip-closed.png";
 	char *tmp;
 	LinphoneFriend *lf;
-	osip_from_t *friend=NULL;
+	LinphoneUri *friend=NULL;
 	osip_from_t *from=NULL;
 	osip_body_t *body=NULL;
 	LinphoneOnlineStatus estatus=LINPHONE_STATUS_UNKNOWN;
@@ -169,8 +168,8 @@ void linphone_notify_recv(LinphoneCore *lc, eXosip_event_t *ev)
 	}
 	lf=linphone_find_friend_by_sid(lc->friends,ev->sid);
 	if (lf!=NULL){
-		friend=lf->url;
-		from_2char_without_params(friend,&tmp);
+		friend=lf->uri;
+		tmp=linphone_uri_as_string(friend);
 		lf->status=estatus;
 		lc->vtable.notify_recv(lc,(LinphoneFriend*)lf,tmp,status,img);
 		ms_free(tmp);
@@ -187,13 +186,17 @@ void linphone_notify_recv(LinphoneCore *lc, eXosip_event_t *ev)
 void linphone_subscription_answered(LinphoneCore *lc, eXosip_event_t *ev){
 	LinphoneFriend *lf;
 	osip_from_t *from=ev->response->to;
-	find_friend(lc->friends,from,&lf);
+	char *tmp;
+	osip_from_to_str(from,&tmp);
+	LinphoneUri *uri=linphone_uri_new(tmp);
+	linphone_find_friend(lc->friends,uri,&lf);
 	if (lf!=NULL){
 		lf->out_did=ev->did;
 		linphone_friend_set_sid(lf,ev->sid);
 	}else{
 		ms_warning("Receiving answer for unknown subscribe sip:%s@%s", from->url->username,from->url->host);
 	}
+	ms_free(tmp);
 }
 void linphone_subscription_closed(LinphoneCore *lc,eXosip_event_t *ev){
 	LinphoneFriend *lf;
diff --git a/linphone/coreapi/private.h b/linphone/coreapi/private.h
index 84fbbbbfad3b22948ea34fe0510abf49f0f7407e..bba041b1314ea1062fabd81bd4e3e67dc3621479 100644
--- a/linphone/coreapi/private.h
+++ b/linphone/coreapi/private.h
@@ -100,13 +100,13 @@ typedef struct _LinphoneCall
 	bool_t supports_session_timers;
 } LinphoneCall;
 
-LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, const osip_from_t *from, const osip_to_t *to);
-LinphoneCall * linphone_call_new_incoming(struct _LinphoneCore *lc, const char *from, const char *to, eXosip_event_t *ev);
+LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneUri *from, LinphoneUri *to);
+LinphoneCall * linphone_call_new_incoming(struct _LinphoneCore *lc, LinphoneUri *from, LinphoneUri *to, eXosip_event_t *ev);
 #define linphone_call_set_state(lcall,st)	(lcall)->state=(st)
 void linphone_call_destroy(struct _LinphoneCall *obj);
 
 /* private: */
-LinphoneCallLog * linphone_call_log_new(LinphoneCall *call, char *local, char * remote);
+LinphoneCallLog * linphone_call_log_new(LinphoneCall *call, LinphoneUri *local, LinphoneUri * remote);
 void linphone_call_log_completed(LinphoneCallLog *calllog, LinphoneCall *call);
 void linphone_call_log_destroy(LinphoneCallLog *cl);
 
@@ -176,7 +176,7 @@ void linphone_call_init_media_params(LinphoneCall *call);
 
 void linphone_set_sdp(osip_message_t *sip, const char *sdp);
 
-MSList *find_friend(MSList *fl, const osip_from_t *friend, LinphoneFriend **lf);
+MSList *linphone_find_friend(MSList *fl, const LinphoneUri *fri, LinphoneFriend **lf);
 LinphoneFriend *linphone_find_friend_by_nid(MSList *l, int nid);
 LinphoneFriend *linphone_find_friend_by_sid(MSList *l, int sid);
 
@@ -187,7 +187,7 @@ void linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call);
 void linphone_core_write_friends_config(LinphoneCore* lc);
 void linphone_proxy_config_update(LinphoneProxyConfig *cfg);
 void linphone_proxy_config_get_contact(LinphoneProxyConfig *cfg, const char **ip, int *port);
-LinphoneProxyConfig * linphone_core_lookup_known_proxy(LinphoneCore *lc, const char *uri);
+LinphoneProxyConfig * linphone_core_lookup_known_proxy(LinphoneCore *lc, const LinphoneUri *uri);
 int linphone_core_get_local_ip_for(const char *dest, char *result);
 
 #endif /* _PRIVATE_H */
diff --git a/linphone/coreapi/siplogin.c b/linphone/coreapi/siplogin.c
index 0b6cb43cb1e56ad8e791bba2bc6949dd3f8fdf0f..e6e72065ef95e06846273e2f2e7b0f703ba488e2 100644
--- a/linphone/coreapi/siplogin.c
+++ b/linphone/coreapi/siplogin.c
@@ -30,13 +30,13 @@ static void sip_login_init_instance(SipSetupContext *ctx){
 	linphone_proxy_config_enable_register(cfg,FALSE);
 }
 
-static void guess_display_name(osip_from_t *from){
-	char *dn=(char*)osip_malloc(strlen(from->url->username)+3);
-	char *it=from->url->username;
+static void guess_display_name(LinphoneUri *from){
+	char *dn=(char*)ms_malloc(strlen(linphone_uri_get_username(from))+3);
+	const char *it;
 	char *wptr=dn;
 	bool_t begin=TRUE;
 	bool_t surname=0;
-	for(it=from->url->username;*it!='\0';++it){
+	for(it=linphone_uri_get_username(from);*it!='\0';++it){
 		if (begin){
 			*wptr=toupper(*it);
 			begin=FALSE;
@@ -48,35 +48,34 @@ static void guess_display_name(osip_from_t *from){
 		}else *wptr=*it;
 		wptr++;
 	}
-	if (from->displayname!=NULL) osip_free(from->displayname);
-	from->displayname=dn;
+	linphone_uri_set_display_name(from,dn);
+	ms_free(dn);
 }
 
 static int sip_login_do_login(SipSetupContext * ctx, const char *uri, const char *passwd){
 	LinphoneProxyConfig *cfg=sip_setup_context_get_proxy_config(ctx);
 	LinphoneCore *lc=linphone_proxy_config_get_core(cfg);
 	LinphoneAuthInfo *auth;
-	osip_from_t *parsed_uri;
+	LinphoneUri *parsed_uri;
 	char *tmp;
 
-	osip_from_init(&parsed_uri);
-	if (osip_from_parse(parsed_uri,uri)==-1){
-		osip_from_free(parsed_uri);
+	parsed_uri=linphone_uri_new(uri);
+	if (parsed_uri==NULL){
 		return -1;
 	}
-	if (parsed_uri->displayname==NULL || strlen(parsed_uri->displayname)==0){
+	if (linphone_uri_get_display_name(parsed_uri)!=NULL){
 		guess_display_name(parsed_uri);
 	}
-	osip_from_to_str(parsed_uri,&tmp);
+	tmp=linphone_uri_as_string(parsed_uri);
 	linphone_proxy_config_set_identity(cfg,tmp);
 	if (passwd ) {
-		auth=linphone_auth_info_new(parsed_uri->url->username,NULL,passwd,NULL,NULL);
+		auth=linphone_auth_info_new(linphone_uri_get_username(parsed_uri),NULL,passwd,NULL,NULL);
 		linphone_core_add_auth_info(lc,auth);
 	}
 	linphone_proxy_config_enable_register(cfg,TRUE);
 	linphone_proxy_config_done(cfg);
-	osip_free(tmp);
-	osip_from_free(parsed_uri);
+	ms_free(tmp);
+	linphone_uri_destroy(parsed_uri);
 	ms_message("SipLogin: done");
 	return 0;
 }
diff --git a/linphone/coreapi/sipsetup.c b/linphone/coreapi/sipsetup.c
index cd7fb6693907ced6ad2aec6e48d30c4f280b0274..df9aed89d64778418f805949fecc28833218e712 100644
--- a/linphone/coreapi/sipsetup.c
+++ b/linphone/coreapi/sipsetup.c
@@ -136,12 +136,14 @@ int sip_setup_context_account_exists(SipSetupContext *ctx, const char *uri){
 }
 
 int sip_setup_context_login_account(SipSetupContext * ctx, const char *uri, const char *passwd){
-	osip_from_t *from;
-	osip_from_init(&from);
-	osip_from_parse(from,uri);
-	strncpy(ctx->domain,from->url->host,sizeof(ctx->domain));
-	strncpy(ctx->username,from->url->username,sizeof(ctx->username));
-	osip_from_free(from);
+	LinphoneUri *from=linphone_uri_new(uri);
+	if (from==NULL) {
+		ms_warning("Fail to parse %s",uri);
+		return -1;
+	}
+	strncpy(ctx->domain,linphone_uri_get_domain(from),sizeof(ctx->domain));
+	strncpy(ctx->username,linphone_uri_get_username(from),sizeof(ctx->username));
+	linphone_uri_destroy(from);
 	if (ctx->funcs->login_account)
 		return ctx->funcs->login_account(ctx,uri,passwd);
 	return -1;
diff --git a/linphone/gtk-glade/friendlist.c b/linphone/gtk-glade/friendlist.c
index 0ab9cf1967e01fe4acdd931dfca50f368f57fc94..a2ac3234af46b4b2fe28b0b09609cbe139009c0e 100644
--- a/linphone/gtk-glade/friendlist.c
+++ b/linphone/gtk-glade/friendlist.c
@@ -104,7 +104,7 @@ static void linphone_gtk_set_selection_to_uri_bar(GtkTreeView *treeview){
 	if (gtk_tree_selection_get_selected (select, &model, &iter))
 	{
 		gtk_tree_model_get (model, &iter,FRIEND_ID , &lf, -1);
-		friend=linphone_friend_get_url(lf);
+		friend=linphone_uri_as_string(linphone_friend_get_uri(lf));
 		gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(linphone_gtk_get_main_window(),"uribar")),friend);
 		ms_free(friend);
 	}
@@ -309,22 +309,20 @@ void linphone_gtk_show_friends(void){
 
 	for(itf=linphone_core_get_friend_list(core);itf!=NULL;itf=ms_list_next(itf)){
 		LinphoneFriend *lf=(LinphoneFriend*)itf->data;
-		char *uri=linphone_friend_get_url(lf);
-		char *name=linphone_friend_get_name(lf);
-		char *addr=linphone_friend_get_addr(lf);
-		char *display=name;
+		const LinphoneUri *f_uri=linphone_friend_get_uri(lf);
+		char *uri=linphone_uri_as_string(f_uri);
+		const char *name=linphone_uri_get_display_name(f_uri);
+		const char *display=name;
 		char *escaped=NULL;
 		if (lookup){
 			if (strstr(uri,search)==NULL){
 				ms_free(uri);
-				if (name) ms_free(name);
-				if (addr) ms_free(addr);
 				continue;
 			}
 		}
 		if (!online_only || (linphone_friend_get_status(lf)!=LINPHONE_STATUS_OFFLINE)){
 			BuddyInfo *bi;
-			if (name==NULL || name[0]=='\0') display=addr;
+			if (name==NULL || name[0]=='\0') display=uri;
 			gtk_list_store_append(store,&iter);
 			gtk_list_store_set(store,&iter,FRIEND_NAME, display,
 					FRIEND_PRESENCE_STATUS, linphone_online_status_to_string(linphone_friend_get_status(lf)),
@@ -346,8 +344,6 @@ void linphone_gtk_show_friends(void){
 			}
 		}
 		ms_free(uri);
-		if (name) ms_free(name);
-		if (addr) ms_free(addr);
 	}
 }
 
@@ -378,16 +374,17 @@ void linphone_gtk_remove_contact(GtkWidget *button){
 
 void linphone_gtk_show_contact(LinphoneFriend *lf){
 	GtkWidget *w=linphone_gtk_create_window("contact");
-	char *uri,*name;
-	uri=linphone_friend_get_addr(lf);
-	name=linphone_friend_get_name(lf);
+	char *uri;
+	const char *name;
+	const LinphoneUri *f_uri=linphone_friend_get_uri(lf);
+	uri=linphone_uri_as_string_without_display_name(f_uri);
+	name=linphone_uri_get_display_name(f_uri);
 	if (uri) {
 		gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(w,"sip_address")),uri);
 		ms_free(uri);
 	}
 	if (name){
 		gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(w,"name")),name);
-		ms_free(name);
 	}
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(w,"show_presence")),
 					linphone_friend_get_send_subscribe(lf));
@@ -422,7 +419,7 @@ void linphone_gtk_chat_selected(GtkWidget *item){
 	{
 		char *uri;
 		gtk_tree_model_get (model, &iter,FRIEND_ID , &lf, -1);
-		uri=linphone_friend_get_url(lf);
+		uri=linphone_uri_as_string(linphone_friend_get_uri(lf));
 		linphone_gtk_create_chatroom(uri);
 		ms_free(uri);
 	}
diff --git a/linphone/gtk-glade/incall_view.c b/linphone/gtk-glade/incall_view.c
index a209c3393e68bb91a4d0f4143507367237b9b702..9291e1cf57c5cfa5d779c41341cc93fba4365726 100644
--- a/linphone/gtk-glade/incall_view.c
+++ b/linphone/gtk-glade/incall_view.c
@@ -53,8 +53,9 @@ void linphone_gtk_show_idle_view(void){
 }
 
 void display_peer_name_in_label(GtkWidget *label, const char *uri){
-	osip_from_t *from;
-	char *displayname=NULL,*id=NULL;
+	LinphoneUri *from;
+	const char *displayname=NULL;
+	char *id=NULL;
 	char *uri_label;
 
 	if (uri==NULL) {
@@ -62,31 +63,25 @@ void display_peer_name_in_label(GtkWidget *label, const char *uri){
 		return;
 	}
 
-	osip_from_init(&from);
-	if (osip_from_parse(from,uri)==0){
+	from=linphone_uri_new(uri);
+	if (from!=NULL){
 		
-		if (from->displayname!=NULL && strlen(from->displayname)>0)
-			displayname=osip_strdup(from->displayname);
-		if (from->displayname!=NULL){
-			osip_free(from->displayname);
-			from->displayname=NULL;
-		}
-		osip_uri_param_freelist(&from->url->url_params);
-		osip_uri_header_freelist(&from->url->url_params);
-		osip_generic_param_freelist(&from->gen_params);
-		osip_from_to_str(from,&id);
-
-	}else id=osip_strdup(uri);
-	osip_from_free(from);
+		if (linphone_uri_get_display_name(from))
+			displayname=linphone_uri_get_display_name(from);
+
+		id=linphone_uri_as_string_without_display_name(from);
+
+	}else id=ms_strdup(uri);
+
 	if (displayname!=NULL)
 		uri_label=g_markup_printf_escaped("<span size=\"large\">%s</span>\n<i>%s</i>", 
 			displayname,id);
 	else
 		uri_label=g_markup_printf_escaped("<span size=\"large\"><i>%s</i></span>\n",id);
 	gtk_label_set_markup(GTK_LABEL(label),uri_label);
-	if (displayname!=NULL) osip_free(displayname);
-	osip_free(id);
+	ms_free(id);
 	g_free(uri_label);
+	if (from!=NULL) linphone_uri_destroy(from);
 }
 
 void linphone_gtk_in_call_view_set_calling(const char *uri){
@@ -118,9 +113,10 @@ void linphone_gtk_in_call_view_set_in_call(){
 	GtkWidget *animation=linphone_gtk_get_widget(main_window,"in_call_animation");
 	GdkPixbufAnimation *pbuf=create_pixbuf_animation("incall_anim.gif");
 	GtkWidget *terminate_button=linphone_gtk_get_widget(main_window,"in_call_terminate");
-	const char *uri=linphone_core_get_remote_uri(lc);
-
-	display_peer_name_in_label(callee,uri);
+	const LinphoneUri *uri=linphone_core_get_remote_uri(lc);
+	char *tmp=linphone_uri_as_string(uri);
+	display_peer_name_in_label(callee,tmp);
+	ms_free(tmp);
 
 	gtk_widget_set_sensitive(terminate_button,TRUE);
 	gtk_label_set_markup(GTK_LABEL(status),_("<b>In call with</b>"));
diff --git a/linphone/gtk-glade/linphone.h b/linphone/gtk-glade/linphone.h
index 5d497b417860ea4aa993a48b3a6d018480cb8c9c..d7185c9e156b366944da34650fa85afac618f313 100644
--- a/linphone/gtk-glade/linphone.h
+++ b/linphone/gtk-glade/linphone.h
@@ -79,7 +79,6 @@ SipSetupContext* linphone_gtk_get_default_sip_setup_context(void);
 GtkWidget * linphone_gtk_show_buddy_lookup_window(SipSetupContext *ctx);
 void linphone_gtk_buddy_lookup_set_keyword(GtkWidget *w, const char *kw);
 void * linphone_gtk_wait(LinphoneCore *lc, void *ctx, LinphoneWaitingState ws, const char *purpose, float progress);
-gchar *linphone_gtk_get_display_name(const char *sip_uri);
 
 void linphone_gtk_show_directory_search(void);
 
diff --git a/linphone/gtk-glade/loginframe.c b/linphone/gtk-glade/loginframe.c
index 898d8a8236c8730b61f0ba98eb612e83747bd8e5..c62066d9ef446b0e5436b777b6c2cf1d31610d67 100644
--- a/linphone/gtk-glade/loginframe.c
+++ b/linphone/gtk-glade/loginframe.c
@@ -57,7 +57,7 @@ void linphone_gtk_show_login_frame(LinphoneProxyConfig *cfg){
 	GtkWidget *label=linphone_gtk_get_widget(mw,"login_label");
 	LinphoneAuthInfo *ai;
 	gchar *str;
-	osip_from_t *from;
+	LinphoneUri *from;
 	LinphoneCore *lc=linphone_gtk_get_core();
 	int nettype;
 
@@ -84,18 +84,17 @@ void linphone_gtk_show_login_frame(LinphoneProxyConfig *cfg){
 	g_object_set_data(G_OBJECT(mw),"login_proxy_config",cfg);
 	g_free(str);
 
-	osip_from_init(&from);
-	osip_from_parse(from,linphone_proxy_config_get_identity(cfg));
+	from=linphone_uri_new(linphone_proxy_config_get_identity(cfg));
 	
-	ai=linphone_core_find_auth_info(lc,linphone_proxy_config_get_domain(cfg),from->url->username);
+	ai=linphone_core_find_auth_info(lc,linphone_proxy_config_get_domain(cfg),linphone_uri_get_username(from));
 	/*display the last entered username, if not '?????'*/
-	if (from->url->username[0]!='?')
+	if (linphone_uri_get_username(from)[0]!='?')
 		gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(mw,"login_username")),
-			from->url->username);
+			linphone_uri_get_username(from));
 	gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(mw,"login_password")),
 		ai!=NULL ? ai->passwd : "");
 	
-	osip_from_free(from);
+	linphone_uri_destroy(from);
 }
 
 void linphone_gtk_exit_login_frame(void){
@@ -130,7 +129,7 @@ void linphone_gtk_login_frame_connect_clicked(GtkWidget *button){
 	char *identity;
 	gboolean autologin;
 	LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)g_object_get_data(G_OBJECT(mw),"login_proxy_config");
-	osip_from_t *from;
+	LinphoneUri *from;
 	SipSetupContext *ssctx=linphone_proxy_config_get_sip_setup_context(cfg);
 
 	username=gtk_entry_get_text(GTK_ENTRY(linphone_gtk_get_widget(mw,"login_username")));
@@ -142,12 +141,9 @@ void linphone_gtk_login_frame_connect_clicked(GtkWidget *button){
 	autologin=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(mw,"automatic_login")));
 	linphone_gtk_set_ui_config_int("automatic_login",autologin);
 
-	osip_from_init(&from);
-	osip_from_parse(from,linphone_proxy_config_get_identity(cfg));
-	osip_free(from->url->username);
-	from->url->username=osip_strdup(username);
-	osip_from_to_str(from,&identity);
-	osip_from_free(from);
+	from=linphone_uri_new(linphone_proxy_config_get_identity(cfg));
+	linphone_uri_set_username(from,username);
+	identity=linphone_uri_as_string(from);
 	do_login(ssctx,identity,password);
 	/*we need to refresh the identities since the proxy config may have changed.*/
 	linphone_gtk_load_identities();
diff --git a/linphone/gtk-glade/main.c b/linphone/gtk-glade/main.c
index 25374370f50815103b1fb0fb0c45ec0b673ffe1f..3d86a0f6971f60b019b9bf2330f88b368f834e0d 100644
--- a/linphone/gtk-glade/main.c
+++ b/linphone/gtk-glade/main.c
@@ -371,10 +371,15 @@ static void set_video_window_decorations(GdkWindow *w){
 	if (!linphone_core_in_call(linphone_gtk_get_core())){
 		snprintf(video_title,sizeof(video_title),"%s video",title);	
 	}else{
-		const char *uri=linphone_core_get_remote_uri(linphone_gtk_get_core());
-		gchar *display_name=linphone_gtk_get_display_name(uri);
-		snprintf(video_title,sizeof(video_title),"Call with %s",display_name);
-		g_free(display_name);
+		const LinphoneUri *uri=linphone_core_get_remote_uri(linphone_gtk_get_core());
+		char *display_name;
+		if (linphone_uri_get_display_name(uri)!=NULL)
+			display_name=ms_strdup(linphone_uri_get_display_name(uri));
+		else{
+			display_name=linphone_uri_as_string(uri);
+		}
+		snprintf(video_title,sizeof(video_title),_("Call with %s"),display_name);
+		ms_free(display_name);
 	}
 	gdk_window_set_title(w,video_title);
 	/*gdk_window_set_urgency_hint(w,TRUE);*/
@@ -861,14 +866,17 @@ static void icon_popup_menu(GtkStatusIcon *status_icon, guint button, guint acti
 
 void linphone_gtk_open_browser(const char *url){
 	/*in gtk 2.16, gtk_show_uri does not work...*/
-	/*gtk_show_uri(NULL,url,GDK_CURRENT_TIME,NULL);*/
-#ifdef WIN32
-	ShellExecute(0,"open",url,NULL,NULL,1);
+#ifndef WIN32
+#if GTK_CHECK_VERSION(2,18,3)
+	gtk_show_uri(NULL,url,GDK_CURRENT_TIME,NULL);
 #else
 	char cl[255];
 	snprintf(cl,sizeof(cl),"/usr/bin/x-www-browser %s",url);
 	g_spawn_command_line_async(cl,NULL);
 #endif
+#else /*WIN32*/
+	ShellExecute(0,"open",url,NULL,NULL,1);
+#endif
 }
 
 void linphone_gtk_link_to_website(GtkWidget *item){
diff --git a/linphone/gtk-glade/propertybox.c b/linphone/gtk-glade/propertybox.c
index 35d60009eeb5d75efa8b8f4fab505b4831014608..490a7d4ce6f7dd1ffdb59ab73aa9f02a2a90f230 100644
--- a/linphone/gtk-glade/propertybox.c
+++ b/linphone/gtk-glade/propertybox.c
@@ -71,17 +71,19 @@ void linphone_gtk_update_my_contact(GtkWidget *w){
 	const char *username=gtk_entry_get_text(GTK_ENTRY(linphone_gtk_get_widget(pb,"username")));
 	const char *displayname=gtk_entry_get_text(GTK_ENTRY(linphone_gtk_get_widget(pb,"displayname")));
 	int port=linphone_core_get_sip_port(linphone_gtk_get_core());
-	osip_from_t *parsed=linphone_core_get_primary_contact_parsed(linphone_gtk_get_core());
+	LinphoneUri *parsed=linphone_core_get_primary_contact_parsed(linphone_gtk_get_core());
 	char *contact;
 	g_return_if_fail(parsed!=NULL);
 	if (username[0]=='\0') return;
-	if (port!=5060)
-		contact=g_strdup_printf("%s <sip:%s@%s:%i>",displayname,username,parsed->url->host,port);
-	else
-		contact=g_strdup_printf("%s <sip:%s@%s>",displayname,username,parsed->url->host);
+
+	linphone_uri_set_display_name(parsed,displayname);
+	linphone_uri_set_username(parsed,username);
+	linphone_uri_set_port_int(parsed,port);
+	contact=linphone_uri_as_string(parsed);
 	gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(pb,"sip_address")),contact);
 	linphone_core_set_primary_contact(linphone_gtk_get_core(),contact);
-	g_free(contact);
+	ms_free(contact);
+	linphone_uri_destroy(parsed);
 	linphone_gtk_load_identities();
 }
 
@@ -703,7 +705,7 @@ void linphone_gtk_show_parameters(void){
 	LinphoneCore *lc=linphone_gtk_get_core();
 	const char **sound_devices=linphone_core_get_sound_devices(lc);
 	const char *tmp;
-	osip_from_t *contact;
+	LinphoneUri *contact;
 	LinphoneFirewallPolicy pol;
 	GtkWidget *codec_list=linphone_gtk_get_widget(pb,"codec_list");
 	int mtu;
@@ -762,11 +764,12 @@ void linphone_gtk_show_parameters(void){
 	/* SIP CONFIG */
 	contact=linphone_core_get_primary_contact_parsed(lc);
 	if (contact){
-		if (contact->displayname) 
-			gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(pb,"displayname")),contact->displayname);
-		if (contact->url->username)
-			gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(pb,"username")),contact->url->username);
+		if (linphone_uri_get_display_name(contact)) 
+			gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(pb,"displayname")),linphone_uri_get_display_name(contact));
+		if (linphone_uri_get_username(contact))
+			gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(pb,"username")),linphone_uri_get_username(contact));
 	}
+	linphone_uri_destroy(contact);
 	linphone_gtk_show_sip_accounts(pb);
 	/* CODECS CONFIG */
 	linphone_gtk_init_codec_list(GTK_TREE_VIEW(codec_list));
diff --git a/linphone/gtk-glade/utils.c b/linphone/gtk-glade/utils.c
index 0c9fdd2040393d10693dc1ac45360967eb1a0485..69ae435a12e21e3d73cb68bd4e79e915e7d387d3 100644
--- a/linphone/gtk-glade/utils.c
+++ b/linphone/gtk-glade/utils.c
@@ -76,22 +76,6 @@ void *linphone_gtk_wait(LinphoneCore *lc, void *ctx, LinphoneWaitingState ws, co
 	return NULL;
 }
 
-gchar *linphone_gtk_get_display_name(const char *sip_uri){
-	osip_from_t *from;
-	gchar *ret=NULL;
-	if (strchr(sip_uri,'@')){
-		osip_from_init(&from);
-		if (osip_from_parse(from,sip_uri)==0){
-			if (from->displayname!=NULL && strlen(from->displayname)>0){
-				ret=g_strdup(from->displayname);
-			}
-		}
-		osip_from_free(from);
-	}
-	if (ret==NULL) ret=g_strdup(sip_uri);
-	return ret;
-}
-
 GdkPixbuf *_gdk_pixbuf_new_from_memory_at_scale(const void *data, gint len, gint w, gint h, gboolean preserve_ratio){
 	GInputStream *stream=g_memory_input_stream_new_from_data (data,len,NULL);
 	GError *error=NULL;