From 1e5711f2571d4c8efbd3bea7e01ff91ff5d579e3 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 8 Jan 2016 11:22:17 +0100 Subject: [PATCH 01/10] revert my change about -lstdc++ --- coreapi/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/Makefile.am b/coreapi/Makefile.am index 1724e5090..79300d538 100644 --- a/coreapi/Makefile.am +++ b/coreapi/Makefile.am @@ -118,7 +118,7 @@ liblinphone_la_SOURCES+=linphone_tunnel_stubs.c linphone_tunnel.h endif -liblinphone_la_LDFLAGS=-lstdc++ -version-info $(LIBLINPHONE_SO_VERSION) -no-undefined +liblinphone_la_LDFLAGS= -version-info $(LIBLINPHONE_SO_VERSION) -no-undefined if HAVE_LD_OUTPUT_DEF liblinphone_la_LDFLAGS += -Wl,--output-def,liblinphone-$(LIBLINPHONE_SO_CURRENT).def From 3739d2c8669ad122aa402c35e410f82c53aad662 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Fri, 8 Jan 2016 11:42:49 +0100 Subject: [PATCH 02/10] account creator: detect invalid domain by changing linphone_address_set_* methods to return -1 in case of error --- coreapi/account_creator.c | 25 ++++++++++++------------- coreapi/address.c | 26 ++++++++++++++++++++------ coreapi/linphonecore.h | 10 +++++----- 3 files changed, 37 insertions(+), 24 deletions(-) diff --git a/coreapi/account_creator.c b/coreapi/account_creator.c index 4646806f0..740345fa0 100644 --- a/coreapi/account_creator.c +++ b/coreapi/account_creator.c @@ -132,12 +132,12 @@ void linphone_account_creator_set_user_data(LinphoneAccountCreator *creator, voi static LinphoneAccountCreatorStatus validate_uri(const char* username, const char* domain, const char* route, const char* display_name) { LinphoneProxyConfig* proxy = linphone_proxy_config_new(); LinphoneAddress* addr; - - linphone_proxy_config_set_identity(proxy, "sip:user@domain.com"); + LinphoneAccountCreatorStatus status = LinphoneAccountCreatorOK; + linphone_proxy_config_set_identity(proxy, "sip:userame@domain.com"); if (route && linphone_proxy_config_set_route(proxy, route) != 0) { - linphone_proxy_config_destroy(proxy); - return LinphoneAccountCreatorRouteInvalid; + status = LinphoneAccountCreatorRouteInvalid; + goto end; } if (username) { @@ -145,24 +145,23 @@ static LinphoneAccountCreatorStatus validate_uri(const char* username, const cha } else { addr = linphone_address_clone(linphone_proxy_config_get_identity_address(proxy)); } - linphone_proxy_config_destroy(proxy); if (addr == NULL) { - return LinphoneAccountCreatorUsernameInvalid; + status = LinphoneAccountCreatorUsernameInvalid; } - if (domain) { - ms_error("TODO: detect invalid domain"); - linphone_address_set_domain(addr, domain); + if (domain && linphone_address_set_domain(addr, domain) != 0) { + status = LinphoneAccountCreatorDomainInvalid; } - if (display_name) { - ms_error("TODO: detect invalid display name"); - linphone_address_set_display_name(addr, display_name); + if (display_name && linphone_address_set_display_name(addr, display_name) != 0) { + status = LinphoneAccountCreatorDisplayNameInvalid; } linphone_address_unref(addr); - return LinphoneAccountCreatorOK; +end: + linphone_proxy_config_destroy(proxy); + return status; } static bool_t is_matching_regex(const char *entry, const char* regex) { diff --git a/coreapi/address.c b/coreapi/address.c index 79ed08d60..13fc15d3a 100644 --- a/coreapi/address.c +++ b/coreapi/address.c @@ -89,37 +89,51 @@ const char *linphone_address_get_domain(const LinphoneAddress *u){ /** * Sets the display name. **/ -void linphone_address_set_display_name(LinphoneAddress *u, const char *display_name){ +int linphone_address_set_display_name(LinphoneAddress *u, const char *display_name){ sal_address_set_display_name(u,display_name); + return 0; } /** * Sets the username. **/ -void linphone_address_set_username(LinphoneAddress *uri, const char *username){ +int linphone_address_set_username(LinphoneAddress *uri, const char *username){ sal_address_set_username(uri,username); + return 0; } /** * Sets the domain. **/ -void linphone_address_set_domain(LinphoneAddress *uri, const char *host){ - sal_address_set_domain(uri,host); +int linphone_address_set_domain(LinphoneAddress *uri, const char *host){ + if (host) { + char *identity = ms_strdup_printf("sip:%s", host); + LinphoneAddress* test = linphone_address_new(identity); + ms_free(identity); + if (test) { + sal_address_set_domain(uri,host); + linphone_address_destroy(test); + return 0; + } + } + return -1; } /** * Sets the port number. **/ -void linphone_address_set_port(LinphoneAddress *uri, int port){ +int linphone_address_set_port(LinphoneAddress *uri, int port){ sal_address_set_port(uri,port); + return 0; } /** * Set a transport. **/ -void linphone_address_set_transport(LinphoneAddress *uri, LinphoneTransportType tp){ +int linphone_address_set_transport(LinphoneAddress *uri, LinphoneTransportType tp){ sal_address_set_transport(uri,(SalTransport)tp); + return 0; } /** diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index d28540df4..3eee4c286 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -436,10 +436,11 @@ LINPHONE_PUBLIC const char *linphone_address_get_display_name(const LinphoneAddr LINPHONE_PUBLIC const char *linphone_address_get_username(const LinphoneAddress *u); LINPHONE_PUBLIC const char *linphone_address_get_domain(const LinphoneAddress *u); LINPHONE_PUBLIC int linphone_address_get_port(const LinphoneAddress *u); -LINPHONE_PUBLIC void linphone_address_set_display_name(LinphoneAddress *u, const char *display_name); -LINPHONE_PUBLIC void linphone_address_set_username(LinphoneAddress *uri, const char *username); -LINPHONE_PUBLIC void linphone_address_set_domain(LinphoneAddress *uri, const char *host); -LINPHONE_PUBLIC void linphone_address_set_port(LinphoneAddress *uri, int port); +LINPHONE_PUBLIC int linphone_address_set_display_name(LinphoneAddress *u, const char *display_name); +LINPHONE_PUBLIC int linphone_address_set_username(LinphoneAddress *uri, const char *username); +LINPHONE_PUBLIC int linphone_address_set_domain(LinphoneAddress *uri, const char *host); +LINPHONE_PUBLIC int linphone_address_set_port(LinphoneAddress *uri, int port); +LINPHONE_PUBLIC int linphone_address_set_transport(LinphoneAddress *uri,LinphoneTransportType type); /*remove tags, params etc... so that it is displayable to the user*/ LINPHONE_PUBLIC void linphone_address_clean(LinphoneAddress *uri); LINPHONE_PUBLIC bool_t linphone_address_is_secure(const LinphoneAddress *addr); @@ -447,7 +448,6 @@ LINPHONE_PUBLIC bool_t linphone_address_get_secure(const LinphoneAddress *addr); LINPHONE_PUBLIC void linphone_address_set_secure(LinphoneAddress *addr, bool_t enabled); LINPHONE_PUBLIC bool_t linphone_address_is_sip(const LinphoneAddress *uri); LINPHONE_PUBLIC LinphoneTransportType linphone_address_get_transport(const LinphoneAddress *uri); -LINPHONE_PUBLIC void linphone_address_set_transport(LinphoneAddress *uri,LinphoneTransportType type); LINPHONE_PUBLIC const char *linphone_address_get_method_param(const LinphoneAddress *addr); LINPHONE_PUBLIC void linphone_address_set_method_param(LinphoneAddress *addr, const char *method); LINPHONE_PUBLIC char *linphone_address_as_string(const LinphoneAddress *u); From b118f3584aa6cca4c9179a3db5f848105c94d933 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grisez?= Date: Fri, 8 Jan 2016 11:42:34 +0100 Subject: [PATCH 03/10] Several fixes of JNI code of LinphoneConferenceImpl * Bad declaration of native implementations * Memory leak in getParticipants() * Bad constructor signature --- coreapi/linphonecore_jni.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index e085315a8..d91a15832 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -6746,11 +6746,11 @@ JNIEXPORT jint JNICALL Java_org_linphone_core_LinphoneCoreImpl_getNortpTimeout(J -JNIEXPORT jobjectArray JNICALL Java_org_linphone_core_LinphoneConferenceImpl_getParticipants(JNIEnv *env, jobject thiz, jlong pconference) { +extern "C" jobjectArray Java_org_linphone_core_LinphoneConferenceImpl_getParticipants(JNIEnv *env, jobject thiz, jlong pconference) { MSList *participants, *it; jclass addr_class = env->FindClass("org/linphone/core/LinphoneAddressImpl"); jclass addr_list_class = env->FindClass("[Lorg/linphone/core/LinphoneAddressImpl;"); - jmethodID addr_constructor = env->GetMethodID(addr_class, "", "(J)"); + jmethodID addr_constructor = env->GetMethodID(addr_class, "", "(J)V"); jobjectArray jaddr_list; int i; @@ -6761,10 +6761,11 @@ JNIEXPORT jobjectArray JNICALL Java_org_linphone_core_LinphoneConferenceImpl_get jobject jaddr = env->NewObject(addr_class, addr_constructor, addr); env->SetObjectArrayElement(jaddr_list, i, jaddr); } + ms_list_free(participants); return jaddr_list; } -JNIEXPORT jint JNICALL Java_org_linphone_core_LinphoneConferenteImpl_removeParticipant(JNIEnv *env, jobject thiz, jlong pconference, jobject uri) { +extern "C" jint Java_org_linphone_core_LinphoneConferenteImpl_removeParticipant(JNIEnv *env, jobject thiz, jlong pconference, jobject uri) { jfieldID native_ptr_attr = env->GetFieldID(env->GetObjectClass(uri), "nativePtr", "J"); LinphoneAddress *addr = (LinphoneAddress *)env->GetLongField(uri, native_ptr_attr); return linphone_conference_remove_participant((LinphoneConference *)pconference, addr); From f838206f69631d602a771e3413c8bc763a3058cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grisez?= Date: Fri, 8 Jan 2016 11:45:33 +0100 Subject: [PATCH 04/10] Save a copy of the list of participants in linphone_conference_get_participants() --- coreapi/conference.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/conference.cc b/coreapi/conference.cc index 6cc888a2f..0c7406152 100644 --- a/coreapi/conference.cc +++ b/coreapi/conference.cc @@ -845,7 +845,7 @@ int linphone_conference_get_participant_count(const LinphoneConference *obj) { } MSList *linphone_conference_get_participants(const LinphoneConference *obj) { - const list participants = ((Conference *)obj)->getParticipants(); + const list &participants = ((Conference *)obj)->getParticipants(); MSList *participants_list = NULL; for(list::const_iterator it=participants.begin();it!=participants.end();it++) { LinphoneAddress *uri = linphone_address_clone(it->getUri()); From 94237bf4eebabf8f11044481f6928a3004cbc739 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grisez?= Date: Fri, 8 Jan 2016 11:46:38 +0100 Subject: [PATCH 05/10] Tests call of linphone_conference_get_participants() --- tester/multi_call_tester.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tester/multi_call_tester.c b/tester/multi_call_tester.c index 61135aecd..3807f095c 100644 --- a/tester/multi_call_tester.c +++ b/tester/multi_call_tester.c @@ -185,6 +185,7 @@ static void simple_conference_base(LinphoneCoreManager* marie, LinphoneCoreManag LinphoneCall* marie_call_pauline; LinphoneCall* pauline_called_by_marie; LinphoneCall* marie_call_laure; + LinphoneConference *conference; const MSList* calls; bool_t is_remote_conf; MSList* lcs=ms_list_append(NULL,marie->lc); @@ -258,6 +259,14 @@ static void simple_conference_base(LinphoneCoreManager* marie, LinphoneCoreManag BC_ASSERT_EQUAL(linphone_core_get_media_encryption(marie->lc),linphone_call_params_get_media_encryption(linphone_call_get_current_params(call)),int,"%d"); } + BC_ASSERT_PTR_NOT_NULL(conference = linphone_core_get_conference(marie->lc)); + if(conference) { + MSList *participants = linphone_conference_get_participants(conference); + BC_ASSERT_EQUAL(linphone_conference_get_participant_count(conference), linphone_core_get_conference_size(marie->lc), int, "%d"); + BC_ASSERT_EQUAL(linphone_conference_get_participant_count(conference), ms_list_size(participants), int, "%d"); + ms_list_free_with_data(participants, (void(*)(void *))linphone_address_destroy); + } + linphone_core_terminate_conference(marie->lc); BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,is_remote_conf?2:1,10000)); From c6678acb7042499b6565995befda31f1cb6de315 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 8 Jan 2016 14:51:32 +0100 Subject: [PATCH 06/10] fix compilation --- configure.ac | 6 ------ mediastreamer2 | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 929dc1e59..3932ab2e1 100644 --- a/configure.ac +++ b/configure.ac @@ -1032,12 +1032,6 @@ else ],[foo=bar],[$CUNIT_LIBS]) fi -case "$target_os" in - *linux*) - # Eliminate -lstdc++ addition to postdeps for cross compiles. - postdeps_CXX=`echo " $postdeps_CXX " | sed 's, -lstdc++ ,,g'` - ;; -esac dnl ################################################## diff --git a/mediastreamer2 b/mediastreamer2 index 8472cad77..66ad948e8 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 8472cad77bcc4b0ef3b0a02d2aa962d54f873d1a +Subproject commit 66ad948e85e77f1d92545bb5e12823cd5a489d6a From 82eb6bac0d3b86d381a578cdb9446153d9ec7c2a Mon Sep 17 00:00:00 2001 From: Brieuc Viel Date: Fri, 8 Jan 2016 15:48:51 +0100 Subject: [PATCH 07/10] Fixes typo and bad cast in JNI --- coreapi/linphonecore_jni.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index d91a15832..7029fa780 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -4315,11 +4315,11 @@ extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getConferenceSize(JNIEnv return (jint)linphone_core_get_conference_size((LinphoneCore *) pCore); } -extern "C" jobject Jave_org_linphone_core_LinphoneCoreImpl_getConference(JNIEnv *env, jobject thiz, jlong pCore) { +extern "C" jobject Java_org_linphone_core_LinphoneCoreImpl_getConference(JNIEnv *env, jobject thiz, jlong pCore) { jclass conference_class = env->FindClass("org/linphone/core/LinphoneConferenceImpl"); jmethodID conference_constructor = env->GetMethodID(conference_class, "", "(J)V"); LinphoneConference *conf = linphone_core_get_conference((LinphoneCore *)pCore); - if(conf) return env->NewObject(conference_class, conference_constructor, conf); + if(conf) return env->NewObject(conference_class, conference_constructor, (jlong)conf); else return NULL; } @@ -4461,7 +4461,7 @@ extern "C" jobject Java_org_linphone_core_LinphoneCallImpl_getConference(JNIEnv jclass conference_class = env->FindClass("org/linphone/core/LinphoneConferenceImpl"); jmethodID conference_constructor = env->GetMethodID(conference_class, "", "(J)V"); LinphoneConference *conf = linphone_call_get_conference((LinphoneCall *)ptr); - if(conf) return env->NewObject(conference_class, conference_constructor, conf); + if(conf) return env->NewObject(conference_class, conference_constructor, (jlong)conf); return NULL; } @@ -6749,7 +6749,6 @@ JNIEXPORT jint JNICALL Java_org_linphone_core_LinphoneCoreImpl_getNortpTimeout(J extern "C" jobjectArray Java_org_linphone_core_LinphoneConferenceImpl_getParticipants(JNIEnv *env, jobject thiz, jlong pconference) { MSList *participants, *it; jclass addr_class = env->FindClass("org/linphone/core/LinphoneAddressImpl"); - jclass addr_list_class = env->FindClass("[Lorg/linphone/core/LinphoneAddressImpl;"); jmethodID addr_constructor = env->GetMethodID(addr_class, "", "(J)V"); jobjectArray jaddr_list; int i; From 4836f295b2725466732bbdbbbc799e020db95145 Mon Sep 17 00:00:00 2001 From: Brieuc Viel Date: Fri, 8 Jan 2016 17:08:37 +0100 Subject: [PATCH 08/10] Fixes bad cast in JNI --- coreapi/linphonecore_jni.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 7029fa780..178b74350 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -6757,7 +6757,7 @@ extern "C" jobjectArray Java_org_linphone_core_LinphoneConferenceImpl_getPartici jaddr_list = env->NewObjectArray(ms_list_size(participants), addr_class, NULL); for(it=participants, i=0; it; it=ms_list_next(it), i++) { LinphoneAddress *addr = (LinphoneAddress *)it->data; - jobject jaddr = env->NewObject(addr_class, addr_constructor, addr); + jobject jaddr = env->NewObject(addr_class, addr_constructor, (jlong)addr); env->SetObjectArrayElement(jaddr_list, i, jaddr); } ms_list_free(participants); From 872fe00eda2c58a082f9c00d1c96fbce6d15c9ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grisez?= Date: Fri, 8 Jan 2016 16:33:52 +0100 Subject: [PATCH 09/10] Fixes crash when starting a call at the first time --- coreapi/lpconfig.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/coreapi/lpconfig.c b/coreapi/lpconfig.c index 9973bde9c..83bd411b7 100644 --- a/coreapi/lpconfig.c +++ b/coreapi/lpconfig.c @@ -818,13 +818,13 @@ bool_t lp_config_relative_file_exists(const LpConfig *lpconfig, const char *file if (lpconfig->filename == NULL) { return FALSE; } else { - char *filename = ms_strdup(lpconfig->filename); - const char *dir = _lp_config_dirname(filename); + char *conf_path = ms_strdup(lpconfig->filename); + const char *dir = _lp_config_dirname(conf_path); char *filepath = ms_strdup_printf("%s/%s", dir, filename); char *realfilepath = lp_realpath(filepath, NULL); FILE *file; - ms_free(filename); + ms_free(conf_path); ms_free(filepath); if(realfilepath == NULL) return FALSE; @@ -912,7 +912,7 @@ int lp_config_read_relative_file(const LpConfig *lpconfig, const char *filename, return 0; err: - ms_free(filepath); + ms_free(dup_config_file); ms_free(filepath); if(realfilepath) ms_free(realfilepath); return -1; From d52b445814fe34cf2b21dae44f82e69d626b961b Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 11 Jan 2016 10:43:07 +0100 Subject: [PATCH 10/10] Fix automatic wrapper generation for conference. --- coreapi/linphonecore.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 3eee4c286..df19a5398 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -3924,9 +3924,10 @@ LINPHONE_PUBLIC int linphone_core_stop_conference_recording(LinphoneCore *lc); LINPHONE_PUBLIC LinphoneConference *linphone_core_get_conference(LinphoneCore *lc); /** * Get URIs of all participants of one conference + * The returned MSList contains URIs of all participant. That list must be + * freed after use and each URI must be unref with linphone_address_unref() * @param obj A #LinphoneConference - * @return A #MSList containing URIs of all participant. That list must be - * freed after utilisation and each URI must be unref with linphone_address_unref() + * @return \mslist{LinphoneAddress} */ LINPHONE_PUBLIC MSList *linphone_conference_get_participants(const LinphoneConference *obj); /**