From d770e133919cf7f97686bc075d4ddfbbf517caf0 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Fri, 14 May 2010 16:49:54 +0200 Subject: [PATCH 01/11] fix linphonecoreexception --- java/common/org/linphone/core/LinphoneCore.java | 3 ++- java/j2me/org/linphone/core/LinphoneCoreException.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index 927c9596e..e02b19351 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -130,8 +130,9 @@ public interface LinphoneCore { * {@link LinphoneCoreListener#inviteReceived(LinphoneCore, String)} listener. * The application can later respond positively to the call using * this method. + * @throws LinphoneCoreException */ - public void acceptCall(); + public void acceptCall() throws LinphoneCoreException; /** diff --git a/java/j2me/org/linphone/core/LinphoneCoreException.java b/java/j2me/org/linphone/core/LinphoneCoreException.java index 105224ee4..9ebb98fad 100644 --- a/java/j2me/org/linphone/core/LinphoneCoreException.java +++ b/java/j2me/org/linphone/core/LinphoneCoreException.java @@ -30,6 +30,7 @@ public class LinphoneCoreException extends Exception { } public LinphoneCoreException(Throwable e) { + this(e.getClass().getName()+" "+ e.getMessage()); mE = e; } @@ -40,7 +41,7 @@ public class LinphoneCoreException extends Exception { public void printStackTrace() { super.printStackTrace(); - mE.printStackTrace(); + if (mE!=null) mE.printStackTrace(); } From 7404ff61636c1c019d80121a60dda09c318c78ab Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 14 May 2010 17:40:04 +0200 Subject: [PATCH 02/11] fix duplicated codecs in config. --- coreapi/linphonecore.c | 6 ++++++ oRTP | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 1bed57f2c..6247f39b8 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -3480,6 +3480,9 @@ void codecs_config_uninit(LinphoneCore *lc) lp_config_set_int(lc->config,key,"enabled",linphone_core_payload_type_enabled(lc,pt)); index++; } + sprintf(key,"audio_codec_%i",index); + lp_config_clean_section (lc->config,key); + index=0; for(node=config->video_codecs;node!=NULL;node=ms_list_next(node)){ pt=(PayloadType*)(node->data); @@ -3490,6 +3493,9 @@ void codecs_config_uninit(LinphoneCore *lc) lp_config_set_string(lc->config,key,"recv_fmtp",pt->recv_fmtp); index++; } + sprintf(key,"video_codec_%i",index); + lp_config_clean_section (lc->config,key); + ms_list_free(lc->codecs_conf.audio_codecs); ms_list_free(lc->codecs_conf.video_codecs); } diff --git a/oRTP b/oRTP index ba73b8155..a80e7b594 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit ba73b8155b3a6aa64f8df95dee6b25ca9b95cbca +Subproject commit a80e7b5949e64ec01d4149d5e0f56c9843df35b0 From 9a7053e4d22fa72ec50d88d8e3349ffe6ca03120 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 14 May 2010 18:42:39 +0200 Subject: [PATCH 03/11] add new target 'sdk' to generate full liblinphone-sdk --- Makefile.am | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/Makefile.am b/Makefile.am index 5cd5cdd2b..37abf47a9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -16,11 +16,7 @@ SUBDIRS = m4 pixmaps po $(ORTP_DIR) mediastreamer2\ ACLOCAL_FLAGS=-I$(top_srcdir)/m4 - -INSTALLDIR=$(shell cd $(top_builddir) && pwd)/linphone-install -INSTALLDIR_WITH_PREFIX=$(INSTALLDIR)/$(prefix) -ZIPFILE=$(shell cd $(top_builddir) && pwd)/$(PACKAGE)-win32-$(VERSION).zip -ZIP_EXCLUDED=include lib \ +OPTIONAL_SOUNDS=\ share/sounds/linphone/rings/synth.wav \ share/sounds/linphone/rings/tapping.wav \ share/sounds/linphone/rings/orig.wav \ @@ -28,6 +24,23 @@ ZIP_EXCLUDED=include lib \ share/sounds/linphone/rings/rock.wav +INSTALLDIR=$(shell cd $(top_builddir) && pwd)/linphone-install +INSTALLDIR_WITH_PREFIX=$(INSTALLDIR)/$(prefix) +ZIPFILE=$(shell cd $(top_builddir) && pwd)/$(PACKAGE)-win32-$(VERSION).zip +ZIP_EXCLUDED=include lib \ + $(OPTIONAL_SOUNDS) + +SDK_ZIPFILE=$(shell cd $(top_builddir) && pwd)/lib$(PACKAGE)-win32-$(VERSION).zip +SDK_EXCLUDED= \ + bin/linphone-3.exe \ + lib/*.la \ + share/linphone \ + share/pixmaps \ + share/locale \ + share/gnome \ + $(OPTIONAL_SOUNDS) + + GTK_PREFIX=/usr GTK_FILELIST=gtk+-2.18.5.filelist GTK_FILELIST_PATH=$(shell cd $(top_srcdir) && pwd)/$(GTK_FILELIST) @@ -117,6 +130,18 @@ zip: cp -f $(top_srcdir)/COPYING $(INSTALLDIR_WITH_PREFIX)/. cd $(INSTALLDIR_WITH_PREFIX) && zip -r $(ZIPFILE) * +sdk: + rm -f $(SDK_ZIPFILE) + rm -rf $(INSTALLDIR) + mkdir -p $(INSTALLDIR) + make install DESTDIR=$(INSTALLDIR) +# remove unwanted stuff (gtk interface) + cd $(INSTALLDIR_WITH_PREFIX) && rm -rf $(SDK_EXCLUDED) + make other-cherrypick + cp -f $(top_srcdir)/README $(INSTALLDIR_WITH_PREFIX)/. + cp -f $(top_srcdir)/COPYING $(INSTALLDIR_WITH_PREFIX)/. + cd $(INSTALLDIR_WITH_PREFIX) && zip -r $(SDK_ZIPFILE) * + filelist: zip cd $(INSTALLDIR_WITH_PREFIX) && \ rm -f $(PACKAGE_WIN32_FILELIST) && \ From 936920203a4fa75c798ba142a8bd7407497deea5 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Mon, 17 May 2010 17:08:56 +0200 Subject: [PATCH 04/11] add ilbc for android + add keep alive parameter for sal --- build/android/Android.mk | 2 +- coreapi/linphonecore.c | 3 +++ coreapi/linphonecore_jni.cc | 3 +++ coreapi/private.h | 1 + coreapi/sal.h | 2 ++ coreapi/sal_eXosip2.c | 3 +++ mediastreamer2 | 2 +- 7 files changed, 14 insertions(+), 2 deletions(-) diff --git a/build/android/Android.mk b/build/android/Android.mk index 529fc02ee..50ad5bef2 100755 --- a/build/android/Android.mk +++ b/build/android/Android.mk @@ -78,7 +78,7 @@ LOCAL_STATIC_LIBRARIES := \ libeXosip2 \ libosip2 \ libgsm - +# libmsilbc \ LOCAL_MODULE_CLASS = SHARED_LIBRARIES include $(BUILD_SHARED_LIBRARY) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 6247f39b8..3d5cb9a4e 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -688,6 +688,8 @@ static void sip_config_read(LinphoneCore *lc) lp_config_get_int(lc->config,"sip","register_only_when_network_is_up",1); lc->sip_conf.ping_with_options=lp_config_get_int(lc->config,"sip","ping_with_options",1); lc->sip_conf.auto_net_state_mon=lp_config_get_int(lc->config,"sip","auto_net_state_mon",1); + lc->sip_conf.keepalive_period=lp_config_get_int(lc->config,"sip","keepalive_period",10000); + sal_set_keepalive_period(lc->sal,lc->sip_conf.keepalive_period); } static void rtp_config_read(LinphoneCore *lc) @@ -3385,6 +3387,7 @@ void sip_config_uninit(LinphoneCore *lc) lp_config_set_int(lc->config,"sip","use_ipv6",config->ipv6_enabled); lp_config_set_int(lc->config,"sip","register_only_when_network_is_up",config->register_only_when_network_is_up); + lp_config_set_int(lc->config,"sip","default_proxy",linphone_core_get_default_proxy(lc,NULL)); for(elem=config->proxies,i=0;elem!=NULL;elem=ms_list_next(elem),i++){ diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 390c56232..7efc94ff5 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "linphonecore.h" #ifdef ANDROID #include +extern "C" void libmsilbc_init(); #endif /*ANDROID*/ extern "C" void ms_andsnd_register_card(JavaVM *jvm) ; @@ -160,7 +161,9 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_newLinphoneCore(JNIEnv* LinphoneCoreData* ldata = new LinphoneCoreData(env,thiz,jlistener,juserdata); #ifdef ANDROID ms_andsnd_register_card(jvm); + // requires an fpu libmsilbc_init(); #endif /*ANDROID*/ + jlong nativePtr = (jlong)linphone_core_new( &ldata->vTable ,userConfig ,factoryConfig diff --git a/coreapi/private.h b/coreapi/private.h index 4a3c1dbaa..c3e2960a3 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -260,6 +260,7 @@ typedef struct sip_config bool_t register_only_when_network_is_up; bool_t ping_with_options; bool_t auto_net_state_mon; + unsigned int keepalive_period; /* interval in ms between keep alive messages sent to the proxy server*/ } sip_config_t; typedef struct rtp_config diff --git a/coreapi/sal.h b/coreapi/sal.h index 882761ffb..d3943a64d 100644 --- a/coreapi/sal.h +++ b/coreapi/sal.h @@ -226,6 +226,8 @@ void sal_set_callbacks(Sal *ctx, const SalCallbacks *cbs); int sal_listen_port(Sal *ctx, const char *addr, int port, SalTransport tr, int is_secure); ortp_socket_t sal_get_socket(Sal *ctx); void sal_set_user_agent(Sal *ctx, const char *user_agent); +/*keepalive period in ms*/ +void sal_set_keepalive_period(Sal *ctx,unsigned int value); void sal_use_session_timers(Sal *ctx, int expires); int sal_iterate(Sal *sal); MSList * sal_get_pending_auths(Sal *sal); diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index d1ade9af2..ba5730139 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -1690,4 +1690,7 @@ char *sal_address_as_string_uri_only(const SalAddress *u){ void sal_address_destroy(SalAddress *u){ osip_from_free((osip_from_t*)u); } +void sal_set_keepalive_period(Sal *ctx,unsigned int value) { + eXosip_set_option (EXOSIP_OPT_UDP_KEEP_ALIVE, &value); +} diff --git a/mediastreamer2 b/mediastreamer2 index 488263428..166db20a4 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 4882634280c82ca495d5bebec482d2744ddb7f61 +Subproject commit 166db20a49a308e161d7b5c74fdc5aff000db9a2 From 2cb7be8f7d16f5174cd3651a73c6f5c7cfec98d2 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 18 May 2010 17:50:14 +0200 Subject: [PATCH 05/11] add external log handler --- .../linphone/core/LinphoneCoreFactory.java | 3 +- .../org/linphone/core/LinphoneLogHandler.java | 29 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 java/common/org/linphone/core/LinphoneLogHandler.java diff --git a/java/common/org/linphone/core/LinphoneCoreFactory.java b/java/common/org/linphone/core/LinphoneCoreFactory.java index b267373a3..b3e2952fb 100644 --- a/java/common/org/linphone/core/LinphoneCoreFactory.java +++ b/java/common/org/linphone/core/LinphoneCoreFactory.java @@ -60,5 +60,6 @@ abstract public class LinphoneCoreFactory { * @param enable */ abstract public void setDebugMode(boolean enable); - + + abstract public void setLogHandler(LinphoneLogHandler handler); } diff --git a/java/common/org/linphone/core/LinphoneLogHandler.java b/java/common/org/linphone/core/LinphoneLogHandler.java new file mode 100644 index 000000000..d1330a400 --- /dev/null +++ b/java/common/org/linphone/core/LinphoneLogHandler.java @@ -0,0 +1,29 @@ +/* +LinphoneLogHandler.java +Copyright (C) 2010 Belledonne Communications, Grenoble, France + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +package org.linphone.core; + +public interface LinphoneLogHandler { + public static final int Fatal=1<<4; + public static final int Error=1<<3|Fatal; + public static final int Warn=1<<2|Error; + public static final int Info=1<<1|Warn; + public static final int Debug=1|Info; + + public void log(String loggerName, int level, String levelString, String msg, Throwable e); +} From 9040037e437fee8fede1e98774589e3bf99d6ab1 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 19 May 2010 14:46:04 +0200 Subject: [PATCH 06/11] update news --- NEWS | 2 +- mediastreamer2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index cc43b585d..04d7ebc35 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -linphone-3.3.0 -- May 10, 2010 +linphone-3.3.0 -- May 19, 2010 * liblinphone is ported to iphoneOS and Google Android * Internal refactoring of liblinphone (code factorisation, encapsulation of signaling) diff --git a/mediastreamer2 b/mediastreamer2 index 488263428..049945684 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 4882634280c82ca495d5bebec482d2744ddb7f61 +Subproject commit 049945684790ca2651ed3cefa80abdf81ba5587e From f159efb812f54ccb0bc6c23293a6d20802594d14 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 19 May 2010 16:19:46 +0200 Subject: [PATCH 07/11] add missing file --- po/POTFILES.in | 1 + 1 file changed, 1 insertion(+) diff --git a/po/POTFILES.in b/po/POTFILES.in index 66401f817..4c792a11f 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -67,5 +67,6 @@ mediastreamer2/src/ice.c mediastreamer2/src/void.c mediastreamer2/src/equalizer.c mediastreamer2/src/msdscap-mingw.cc +mediastreamer2/src/drawdib-display.c From 574f492441002911b7d0f8a44df7a42d2cf233b8 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 20 May 2010 12:10:50 +0200 Subject: [PATCH 08/11] add support for retrieving RTP statistics. --- coreapi/linphonecore.c | 39 +++++++++++++++++++++++++++++++++++++++ coreapi/linphonecore.h | 6 ++++++ 2 files changed, 45 insertions(+) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 3d5cb9a4e..5b4016ffe 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -379,6 +379,23 @@ char * linphone_call_log_to_str(LinphoneCallLog *cl){ return tmp; } +/** + * Returns RTP statistics computed locally regarding the call. + * +**/ +const rtp_stats_t *linphone_call_log_get_local_stats(const LinphoneCallLog *cl){ + return &cl->local_stats; +} + +/** + * Returns RTP statistics computed by remote end and sent back via RTCP. + * + * @note Not implemented yet. +**/ +const rtp_stats_t *linphone_call_log_get_remote_stats(const LinphoneCallLog *cl){ + return &cl->remote_stats; +} + void linphone_call_log_set_user_pointer(LinphoneCallLog *cl, void *up){ cl->user_pointer=up; } @@ -3354,6 +3371,28 @@ void linphone_core_set_audio_transports(LinphoneCore *lc, RtpTransport *rtp, Rtp lc->a_rtcp=rtcp; } +/** + * Retrieve RTP statistics regarding current call. + * @param local RTP statistics computed locally. + * @param remote RTP statistics computed by far end (obtained via RTCP feedback). + * + * @note Remote RTP statistics is not implemented yet. + * + * @returns 0 or -1 if no call is running. +**/ + +int linphone_core_get_current_call_stats(LinphoneCore *lc, rtp_stats_t *local, rtp_stats_t *remote){ + LinphoneCall *call=linphone_core_get_current_call (lc); + if (call!=NULL){ + if (lc->audiostream!=NULL){ + memset(remote,0,sizeof(*remote)); + audio_stream_get_local_rtp_stats (lc->audiostream,local); + return 0; + } + } + return -1; +} + void net_config_uninit(LinphoneCore *lc) { net_config_t *config=&lc->net_conf; diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 945ea25ea..a19f1f7b3 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -127,6 +127,8 @@ typedef struct _LinphoneCallLog{ int duration; /** Date: Thu, 20 May 2010 12:11:49 +0200 Subject: [PATCH 09/11] update mediastreamer --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 049945684..57896d513 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 049945684790ca2651ed3cefa80abdf81ba5587e +Subproject commit 57896d513f6fbf41fde3c777931ebc744e53e366 From ff1bcf922596183432a5599f14cccbcbdd13cb1b Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 20 May 2010 15:01:54 +0200 Subject: [PATCH 10/11] set RTP stats at end of call --- coreapi/linphonecore.c | 5 +++++ oRTP | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 5b4016ffe..f62449e62 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2316,8 +2316,13 @@ void linphone_core_start_media_streams(LinphoneCore *lc, LinphoneCall *call){ lc->call->state=LCStateAVRunning; } +static void linphone_call_log_fill_stats(LinphoneCallLog *log, AudioStream *st){ + audio_stream_get_local_rtp_stats (st,&log->local_stats); +} + void linphone_core_stop_media_streams(LinphoneCore *lc, LinphoneCall *call){ if (lc->audiostream!=NULL) { + linphone_call_log_fill_stats (call->log,lc->audiostream); audio_stream_stop(lc->audiostream); lc->audiostream=NULL; } diff --git a/oRTP b/oRTP index a80e7b594..4ad63e9a1 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit a80e7b5949e64ec01d4149d5e0f56c9843df35b0 +Subproject commit 4ad63e9a106aee8d9dfb675aa0532962f322609c From b5497652f2f970174464bfd3e7dbde440d16b8a5 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 21 May 2010 12:19:12 +0200 Subject: [PATCH 11/11] automatically surround displayname without quotes, to allow users to use non ascii characters. --- coreapi/address.c | 8 ++++++++ coreapi/linphonecore.h | 3 ++- coreapi/sal.h | 1 + coreapi/sal_eXosip2.c | 29 +++++++++++++++++++++++++++-- gtk-glade/friendlist.c | 8 +++++--- gtk-glade/incall_view.c | 13 +++++-------- gtk-glade/main.c | 2 +- gtk-glade/propertybox.c | 7 +++++-- 8 files changed, 54 insertions(+), 17 deletions(-) diff --git a/coreapi/address.c b/coreapi/address.c index 1d893aede..f8051318c 100644 --- a/coreapi/address.c +++ b/coreapi/address.c @@ -57,6 +57,14 @@ const char *linphone_address_get_display_name(const LinphoneAddress* u){ return sal_address_get_display_name(u); } +/** + * Returns the display name without quotes. + * @note WARNING: the returned string must be freed by user. +**/ +char *linphone_address_get_display_name_unquoted(const LinphoneAddress *addr){ + return sal_address_get_display_name_unquoted(addr); +} + /** * Returns the username. **/ diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index a19f1f7b3..39606ae35 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -1,6 +1,6 @@ /* linphone -Copyright (C) 2000 Simon MORLAT (simon.morlat@linphone.org) +Copyright (C) 2000 - 2010 Simon MORLAT (simon.morlat@linphone.org) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -64,6 +64,7 @@ LinphoneAddress * linphone_address_new(const char *uri); LinphoneAddress * linphone_address_clone(const LinphoneAddress *uri); const char *linphone_address_get_scheme(const LinphoneAddress *u); const char *linphone_address_get_display_name(const LinphoneAddress* u); +char *linphone_address_get_display_name_unquoted(const LinphoneAddress *u); const char *linphone_address_get_username(const LinphoneAddress *u); const char *linphone_address_get_domain(const LinphoneAddress *u); void linphone_address_set_display_name(LinphoneAddress *u, const char *display_name); diff --git a/coreapi/sal.h b/coreapi/sal.h index d3943a64d..6cb1fd426 100644 --- a/coreapi/sal.h +++ b/coreapi/sal.h @@ -45,6 +45,7 @@ SalAddress * sal_address_new(const char *uri); SalAddress * sal_address_clone(const SalAddress *addr); const char *sal_address_get_scheme(const SalAddress *addr); const char *sal_address_get_display_name(const SalAddress* addr); +char *sal_address_get_display_name_unquoted(const SalAddress *addr); const char *sal_address_get_username(const SalAddress *addr); const char *sal_address_get_domain(const SalAddress *addr); void sal_address_set_display_name(SalAddress *addr, const char *display_name); diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index ba5730139..d9612fe11 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -1575,7 +1575,17 @@ int sal_unregister(SalOp *h){ return 0; } - +static void sal_address_quote_displayname(SalAddress *addr){ + osip_from_t *u=(osip_from_t*)addr; + if (u->displayname!=NULL && u->displayname[0]!='\0' + && u->displayname[0]!='"'){ + int len=strlen(u->displayname)+1+2; + char *quoted=osip_malloc(len); + snprintf(quoted,len,"\"%s\"",u->displayname); + osip_free(u->displayname); + u->displayname=quoted; + } +} SalAddress * sal_address_new(const char *uri){ osip_from_t *from; @@ -1584,6 +1594,7 @@ SalAddress * sal_address_new(const char *uri){ osip_from_free(from); return NULL; } + sal_address_quote_displayname ((SalAddress*)from); return (SalAddress*)from; } @@ -1605,6 +1616,18 @@ const char *sal_address_get_display_name(const SalAddress* addr){ return null_if_empty(u->displayname); } +char *sal_address_get_display_name_unquoted(const SalAddress *addr){ + const osip_from_t *u=(const osip_from_t*)addr; + const char *dn=null_if_empty(u->displayname); + char *ret=NULL; + if (dn!=NULL) { + char *tmp=osip_strdup_without_quote(dn); + ret=ms_strdup(tmp); + osip_free(tmp); + } + return ret; +} + const char *sal_address_get_username(const SalAddress *addr){ const osip_from_t *u=(const osip_from_t*)addr; return null_if_empty(u->url->username); @@ -1621,8 +1644,10 @@ void sal_address_set_display_name(SalAddress *addr, const char *display_name){ osip_free(u->displayname); u->displayname=NULL; } - if (display_name!=NULL) + if (display_name!=NULL && display_name[0]!='\0'){ u->displayname=osip_strdup(display_name); + sal_address_quote_displayname(addr); + } } void sal_address_set_username(SalAddress *addr, const char *username){ diff --git a/gtk-glade/friendlist.c b/gtk-glade/friendlist.c index d4fddf871..ecb3ee963 100644 --- a/gtk-glade/friendlist.c +++ b/gtk-glade/friendlist.c @@ -308,7 +308,7 @@ void linphone_gtk_show_friends(void){ LinphoneFriend *lf=(LinphoneFriend*)itf->data; const LinphoneAddress *f_uri=linphone_friend_get_address(lf); char *uri=linphone_address_as_string(f_uri); - const char *name=linphone_address_get_display_name(f_uri); + char *name=linphone_address_get_display_name_unquoted (f_uri); const char *display=name; char *escaped=NULL; if (lookup){ @@ -341,6 +341,7 @@ void linphone_gtk_show_friends(void){ } } ms_free(uri); + if (name!=NULL) ms_free(name); } } @@ -372,16 +373,17 @@ void linphone_gtk_remove_contact(GtkWidget *button){ void linphone_gtk_show_contact(LinphoneFriend *lf){ GtkWidget *w=linphone_gtk_create_window("contact"); char *uri; - const char *name; + char *name; const LinphoneAddress *f_uri=linphone_friend_get_address(lf); uri=linphone_address_as_string_uri_only(f_uri); - name=linphone_address_get_display_name(f_uri); + name=linphone_address_get_display_name_unquoted (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)); diff --git a/gtk-glade/incall_view.c b/gtk-glade/incall_view.c index c3c95eabe..4e6baf6a3 100644 --- a/gtk-glade/incall_view.c +++ b/gtk-glade/incall_view.c @@ -72,7 +72,7 @@ void linphone_gtk_show_idle_view(void){ void display_peer_name_in_label(GtkWidget *label, const char *uri){ LinphoneAddress *from; - const char *displayname=NULL; + char *displayname=NULL; char *id=NULL; char *uri_label; @@ -83,18 +83,15 @@ void display_peer_name_in_label(GtkWidget *label, const char *uri){ from=linphone_address_new(uri); if (from!=NULL){ - - if (linphone_address_get_display_name(from)) - displayname=linphone_address_get_display_name(from); - + displayname=linphone_address_get_display_name_unquoted (from); id=linphone_address_as_string_uri_only(from); - }else id=ms_strdup(uri); - if (displayname!=NULL) + if (displayname!=NULL){ uri_label=g_markup_printf_escaped("%s\n%s", displayname,id); - else + ms_free(displayname); + }else uri_label=g_markup_printf_escaped("%s\n",id); gtk_label_set_markup(GTK_LABEL(label),uri_label); ms_free(id); diff --git a/gtk-glade/main.c b/gtk-glade/main.c index 3ce841ad0..e59aec0ca 100644 --- a/gtk-glade/main.c +++ b/gtk-glade/main.c @@ -395,7 +395,7 @@ static void set_video_window_decorations(GdkWindow *w){ linphone_address_clean(uri); if (linphone_address_get_display_name(uri)!=NULL){ - display_name=ms_strdup(linphone_address_get_display_name(uri)); + display_name=linphone_address_get_display_name_unquoted (uri); }else{ display_name=linphone_address_as_string(uri); } diff --git a/gtk-glade/propertybox.c b/gtk-glade/propertybox.c index 85ebdbb8d..3faf28dab 100644 --- a/gtk-glade/propertybox.c +++ b/gtk-glade/propertybox.c @@ -802,8 +802,11 @@ void linphone_gtk_show_parameters(void){ /* SIP CONFIG */ contact=linphone_core_get_primary_contact_parsed(lc); if (contact){ - if (linphone_address_get_display_name(contact)) - gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(pb,"displayname")),linphone_address_get_display_name(contact)); + if (linphone_address_get_display_name(contact)) { + char *dn=linphone_address_get_display_name_unquoted (contact); + gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(pb,"displayname")),dn); + ms_free(dn); + } if (linphone_address_get_username(contact)) gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(pb,"username")),linphone_address_get_username(contact)); }