From 2056181844f10b9fb51974f05ad237eb714cd9e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grisez?= Date: Mon, 3 Oct 2016 15:34:51 +0200 Subject: [PATCH 01/22] =?UTF-8?q?Updute=20ms2=C2=A0submodule=20(fix=20ms2?= =?UTF-8?q?=20javadoc)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 26f884bf9..2524b0f99 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 26f884bf977977041fe6f98a0af186be1580bf22 +Subproject commit 2524b0f99d47cd7e47c5c2e13181c34264dc6cb2 From 5aa97cae22bee134ba01c37f1071b7eabeaf948c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grisez?= Date: Mon, 3 Oct 2016 15:35:30 +0200 Subject: [PATCH 02/22] Add a target to generate Liblinphone's JavaDoc --- CMakeLists.txt | 1 + coreapi/help/CMakeLists.txt | 19 +++++++++++++++++++ coreapi/help/generate_javadoc.sh.in | 11 +++++++++++ 3 files changed, 31 insertions(+) create mode 100755 coreapi/help/generate_javadoc.sh.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 86647c052..f83e275e1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,6 +42,7 @@ option(ENABLE_CONSOLE_UI "Turn on or off compilation of console interface." YES) option(ENABLE_DATE "Use build date in internal version number." NO) cmake_dependent_option(ENABLE_DAEMON "Enable the linphone daemon interface." YES "NOT WIN32" NO) option(ENABLE_DOC "Enable documentation generation with Doxygen." YES) +option(ENABLE_JAVADOC "Add a target to generate documentation for Java API" NO) option(ENABLE_GTK_UI "Turn on or off compilation of gtk interface." YES) option(ENABLE_LDAP "Enable LDAP support." NO) option(ENABLE_LIME "Enable Instant Messaging Encryption." YES) diff --git a/coreapi/help/CMakeLists.txt b/coreapi/help/CMakeLists.txt index f407e72e9..fb6c39278 100644 --- a/coreapi/help/CMakeLists.txt +++ b/coreapi/help/CMakeLists.txt @@ -45,6 +45,25 @@ if (ENABLE_DOC) endif() endif() +if(ENABLE_JAVADOC) + find_package(Java REQUIRED) + set(JAVADOC_PACKAGES "org.linphone.core org.linphone.mediastream") + set(JAVADOC_CLASSPATHS + "${PROJECT_SOURCE_DIR}/java/common" + "${PROJECT_SOURCE_DIR}/java/j2se" + "${PROJECT_SOURCE_DIR}/mediastreamer2/java/src" + ) + string(REPLACE ";" ":" JAVADOC_CLASSPATHS "${JAVADOC_CLASSPATHS}") + set(JAVADOC_TITLE "Linphone SDK ${PROJECT_VERSION} reference documentation") + set(JAVADOC_JAVA_REFERENCE "http://docs.oracle.com/javase/8/docs/api/") + set(JAVADOC_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/doc/java") + set(JAVADOC_LOGFILE "${CMAKE_CURRENT_BINARY_DIR}/javadoc.log") + configure_file("generate_javadoc.sh.in" "generate_javadoc.sh" @ONLY) + add_custom_target(javadoc + COMMAND "${CMAKE_CURRENT_BINARY_DIR}/generate_javadoc.sh" + ) +endif() + if (ENABLE_TOOLS) set(USE_BUNDLE ) if (IOS) diff --git a/coreapi/help/generate_javadoc.sh.in b/coreapi/help/generate_javadoc.sh.in new file mode 100755 index 000000000..0c4595ddb --- /dev/null +++ b/coreapi/help/generate_javadoc.sh.in @@ -0,0 +1,11 @@ +#!/bin/bash -x + +packages='@JAVADOC_PACKAGES@' +classpaths='@JAVADOC_CLASSPATHS@' +title='@JAVADOC_TITLE@' +javaref='@JAVADOC_JAVA_REFERENCE@' +outputdir='@JAVADOC_OUTPUT_DIR@' + +@Java_JAVADOC_EXECUTABLE@ ${packages} -classpath ${classpaths} -doctitle "${title}" -link ${javaref} -d ${outputdir} 2>&1 | tee @JAVADOC_LOGFILE@ +grep -E '^[0-9]{1,3} errors?' @JAVADOC_LOGFILE@ &> /dev/null && exit 1 +exit 0 From ccb11fa363bfbef6b1c283a819cd11e201321f43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grisez?= Date: Mon, 3 Oct 2016 16:55:20 +0200 Subject: [PATCH 03/22] Add javadoc target as dependence of all target when ENABLE_JAVADOC is enabled --- coreapi/help/CMakeLists.txt | 2 +- coreapi/help/generate_javadoc.sh.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/coreapi/help/CMakeLists.txt b/coreapi/help/CMakeLists.txt index fb6c39278..64a18c024 100644 --- a/coreapi/help/CMakeLists.txt +++ b/coreapi/help/CMakeLists.txt @@ -59,7 +59,7 @@ if(ENABLE_JAVADOC) set(JAVADOC_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/doc/java") set(JAVADOC_LOGFILE "${CMAKE_CURRENT_BINARY_DIR}/javadoc.log") configure_file("generate_javadoc.sh.in" "generate_javadoc.sh" @ONLY) - add_custom_target(javadoc + add_custom_target(javadoc ALL COMMAND "${CMAKE_CURRENT_BINARY_DIR}/generate_javadoc.sh" ) endif() diff --git a/coreapi/help/generate_javadoc.sh.in b/coreapi/help/generate_javadoc.sh.in index 0c4595ddb..b2af1b048 100755 --- a/coreapi/help/generate_javadoc.sh.in +++ b/coreapi/help/generate_javadoc.sh.in @@ -1,4 +1,4 @@ -#!/bin/bash -x +#!/bin/bash packages='@JAVADOC_PACKAGES@' classpaths='@JAVADOC_CLASSPATHS@' From 3dbde7bc4832a104312a8bfb7d3d03fe310c0c8e Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Mon, 3 Oct 2016 17:38:08 +0200 Subject: [PATCH 04/22] update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 2524b0f99..5ad4fc409 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 2524b0f99d47cd7e47c5c2e13181c34264dc6cb2 +Subproject commit 5ad4fc409f454f0e1c0422c5736e35042948aa96 From c2002e29a58cbb94ebed369add966929d1481076 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 4 Oct 2016 11:31:50 +0200 Subject: [PATCH 05/22] allow repair of calls when no proxy config is used or proxy config doesn't register. --- coreapi/linphonecall.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 70dd7f2ff..82284836b 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -5046,12 +5046,17 @@ void linphone_call_repair_if_broken(LinphoneCall *call){ LinphoneCallParams *params; if (!call->broken) return; - - /*First, make sure that the proxy from which we received this call, or to which we routed this call is registered*/ - if (!call->dest_proxy || linphone_proxy_config_get_state(call->dest_proxy) != LinphoneRegistrationOk) return; - if (!call->core->media_network_reachable) return; + /*Make sure that the proxy from which we received this call, or to which we routed this call is registered first*/ + if (call->dest_proxy){ + /*in all other cases, ie no proxy config, or a proxy config for which no registration was requested, we can start the + * call repair immediately.*/ + if (linphone_proxy_config_register_enabled(call->dest_proxy) + && linphone_proxy_config_get_state(call->dest_proxy) != LinphoneRegistrationOk) return; + } + + switch (call->state){ case LinphoneCallStreamsRunning: case LinphoneCallPaused: From 4d20d107862dd0304ea226a2d69d683763692ab3 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 4 Oct 2016 13:23:41 +0200 Subject: [PATCH 06/22] fix invalid reads in tunnel code --- coreapi/bellesip_sal/sal_op_impl.c | 3 +++ coreapi/linphonecore.c | 20 ++++++++++++-------- tester/tunnel_tester.c | 25 +++++++++++-------------- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/coreapi/bellesip_sal/sal_op_impl.c b/coreapi/bellesip_sal/sal_op_impl.c index aa1b7ca55..23a8ea4ed 100644 --- a/coreapi/bellesip_sal/sal_op_impl.c +++ b/coreapi/bellesip_sal/sal_op_impl.c @@ -342,6 +342,9 @@ static int _sal_op_send_request_with_contact(SalOp* op, belle_sip_request_t* req } #endif } + /*because in case of tunnel, transport can be changed*/ + transport=belle_sip_uri_get_transport_param(next_hop_uri); + if ((strcmp(method,"REGISTER")==0 || strcmp(method,"SUBSCRIBE")==0) && transport && (strcasecmp(transport,"TCP")==0 || strcasecmp(transport,"TLS")==0)){ /*RFC 5923: add 'alias' parameter to tell the server that we want it to keep the connection for future requests*/ diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 0ad4bb216..df44c3529 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -6514,14 +6514,7 @@ void sip_config_uninit(LinphoneCore *lc) lc->auth_info=bctbx_list_free_with_data(lc->auth_info,(void (*)(void*))linphone_auth_info_destroy); - /*now that we are unregisted, we no longer need the tunnel.*/ -#ifdef TUNNEL_ENABLED - if (lc->tunnel) { - linphone_tunnel_destroy(lc->tunnel); - lc->tunnel=NULL; - ms_message("Tunnel destroyed."); - } -#endif + if (lc->vcard_context) { linphone_vcard_context_destroy(lc->vcard_context); @@ -6537,9 +6530,20 @@ void sip_config_uninit(LinphoneCore *lc) belle_sip_object_unref(lc->http_crypto_config); lc->http_crypto_config=NULL; } + + /*now that we are unregisted, there is no more channel using tunnel socket we no longer need the tunnel.*/ +#ifdef TUNNEL_ENABLED + if (lc->tunnel) { + linphone_tunnel_destroy(lc->tunnel); + lc->tunnel=NULL; + ms_message("Tunnel destroyed."); + } +#endif + sal_iterate(lc->sal); /*make sure event are purged*/ sal_uninit(lc->sal); lc->sal=NULL; + if (lc->sip_conf.guessed_contact) ms_free(lc->sip_conf.guessed_contact); diff --git a/tester/tunnel_tester.c b/tester/tunnel_tester.c index cf02ff267..48bebd4cf 100644 --- a/tester/tunnel_tester.c +++ b/tester/tunnel_tester.c @@ -24,26 +24,21 @@ #include "liblinphone_tester.h" /* Retrieve the public IP from a given hostname */ -static const char* get_ip_from_hostname(const char * tunnel_hostname){ +int get_ip_from_hostname(const char * tunnel_hostname, char *ip, size_t ip_size){ struct addrinfo hints; - struct addrinfo *res = NULL, *it = NULL; - struct sockaddr_in *add; - char * output = NULL; + struct addrinfo *res = NULL; int err; memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; if ((err = getaddrinfo(tunnel_hostname, NULL, &hints, &res))){ ms_error("error while retrieving IP from %s: %s", tunnel_hostname, gai_strerror(err)); - return NULL; + return err; } - for (it=res; it!=NULL; it=it->ai_next){ - add = (struct sockaddr_in *) it->ai_addr; - output = inet_ntoa( add->sin_addr ); - } + bctbx_addrinfo_to_ip_address(res, ip, ip_size, NULL); freeaddrinfo(res); - return output; + return err; } static char* get_public_contact_ip(LinphoneCore* lc) { const LinphoneAddress * contact = linphone_proxy_config_get_contact(linphone_core_get_default_proxy_config(lc)); @@ -60,9 +55,10 @@ static void call_with_tunnel_base(LinphoneTunnelMode tunnel_mode, bool_t with_si LinphoneProxyConfig *proxy = linphone_core_get_default_proxy_config(pauline->lc); LinphoneAddress *server_addr = linphone_address_new(linphone_proxy_config_get_server_addr(proxy)); LinphoneAddress *route = linphone_address_new(linphone_proxy_config_get_route(proxy)); - const char * tunnel_ip = get_ip_from_hostname("tunnel.linphone.org"); + char tunnel_ip[64]; char *public_ip, *public_ip2=NULL; - + BC_ASSERT_FALSE(get_ip_from_hostname("tunnel.linphone.org",tunnel_ip,sizeof(tunnel_ip))); + BC_ASSERT_TRUE(wait_for(pauline->lc,NULL,&pauline->stat.number_of_LinphoneRegistrationOk,1)); public_ip = get_public_contact_ip(pauline->lc); BC_ASSERT_STRING_NOT_EQUAL(public_ip, tunnel_ip); @@ -245,9 +241,10 @@ static void register_on_second_tunnel(void) { LinphoneTunnel *tunnel = linphone_core_get_tunnel(pauline->lc); LinphoneTunnelConfig *config1 = linphone_tunnel_config_new(); LinphoneTunnelConfig *config2 = linphone_tunnel_config_new(); - const char * tunnel_ip = get_ip_from_hostname("tunnel.linphone.org"); + char tunnel_ip[64]; char* public_ip; - + + BC_ASSERT_FALSE(get_ip_from_hostname("tunnel.linphone.org",tunnel_ip,sizeof(tunnel_ip))); linphone_tunnel_simulate_udp_loss(tunnel, TRUE); // add a first tunnel config with an invalid port From 6caf23eb5ce9c7c14e107a95cd4d3255ecc3a8c0 Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Thu, 29 Sep 2016 11:21:37 +0200 Subject: [PATCH 07/22] Add new status in accountcreator + add new stats in call --- coreapi/account_creator.c | 3 +++ coreapi/account_creator.h | 1 + coreapi/dial_plan.c | 6 ++++++ coreapi/linphonecore_jni.cc | 14 ++++++++++++++ coreapi/linphonecore_utils.h | 5 +++++ .../linphone/core/LinphoneAccountCreator.java | 1 + .../org/linphone/core/LinphoneCallStats.java | 14 ++++++++++++++ .../org/linphone/core/LinphoneCoreFactory.java | 5 +++++ .../linphone/core/LinphoneCallStatsImpl.java | 18 +++++++++++++++++- .../linphone/core/LinphoneCoreFactoryImpl.java | 5 +++++ 10 files changed, 71 insertions(+), 1 deletion(-) diff --git a/coreapi/account_creator.c b/coreapi/account_creator.c index c1a6fb00e..f98146d07 100644 --- a/coreapi/account_creator.c +++ b/coreapi/account_creator.c @@ -304,6 +304,9 @@ LinphoneAccountCreatorStatus linphone_account_creator_set_phone_number(LinphoneA { const LinphoneDialPlan* plan = linphone_dial_plan_by_ccc(country_code); int size = (int)strlen(phone_number); + if (linphone_dial_plan_is_generic(plan)) { + return LinphoneAccountCreatorCountryCodeInvalid; + } if (size < plan->nnl - 1) { return LinphoneAccountCreatorPhoneNumberTooShort; } else if (size > plan->nnl + 1) { diff --git a/coreapi/account_creator.h b/coreapi/account_creator.h index 32a4cd9ad..09c7523b9 100644 --- a/coreapi/account_creator.h +++ b/coreapi/account_creator.h @@ -63,6 +63,7 @@ typedef enum _LinphoneAccountCreatorStatus { LinphoneAccountCreatorRouteInvalid, LinphoneAccountCreatorDisplayNameInvalid, LinphoneAccountCreatorTransportNotSupported, + LinphoneAccountCreatorCountryCodeInvalid, } LinphoneAccountCreatorStatus; /** diff --git a/coreapi/dial_plan.c b/coreapi/dial_plan.c index 4f23b05e6..bcd9c3ae4 100644 --- a/coreapi/dial_plan.c +++ b/coreapi/dial_plan.c @@ -310,3 +310,9 @@ const LinphoneDialPlan* linphone_dial_plan_by_ccc(const char *ccc) { const LinphoneDialPlan* linphone_dial_plan_get_all() { return dial_plans; } + +const bool_t linphone_dial_plan_is_generic(const LinphoneDialPlan *ccc) { + if (strcmp(ccc->country, most_common_dialplan.country) == 0) + return TRUE; + return FALSE; +} diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 98dd7859b..2490a2421 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -3346,6 +3346,20 @@ extern "C" void Java_org_linphone_core_LinphoneCallStatsImpl_updateStats(JNIEnv linphone_call_get_video_stats((LinphoneCall*)call_ptr); } +extern "C" jstring Java_org_linphone_core_LinphoneCallStatsImpl_getEncoderName(JNIEnv *env, jobject thiz, jlong stats_ptr, jlong call_ptr, jlong payload_ptr) { + LinphoneCore *lc = linphone_call_get_core((LinphoneCall*)call_ptr); + PayloadType* jpayload = (PayloadType*)payload_ptr; + jstring jencodername =env->NewStringUTF(ms_factory_get_encoder(linphone_core_get_ms_factory(lc), jpayload->mime_type)->text); + return jencodername; +} + +extern "C" jstring Java_org_linphone_core_LinphoneCallStatsImpl_getDecoderName(JNIEnv *env, jobject thiz, jlong stats_ptr, jlong call_ptr, jlong payload_ptr) { + LinphoneCore *lc = linphone_call_get_core((LinphoneCall*)call_ptr); + PayloadType* jpayload = (PayloadType*)payload_ptr; + jstring jdecodername =env->NewStringUTF(ms_factory_get_decoder(linphone_core_get_ms_factory(lc), jpayload->mime_type)->text); + return jdecodername; +} + /*payloadType*/ extern "C" jstring Java_org_linphone_core_PayloadTypeImpl_toString(JNIEnv* env,jobject thiz,jlong ptr) { PayloadType* pt = (PayloadType*)ptr; diff --git a/coreapi/linphonecore_utils.h b/coreapi/linphonecore_utils.h index 1eb87893f..30c3f583d 100644 --- a/coreapi/linphonecore_utils.h +++ b/coreapi/linphonecore_utils.h @@ -134,6 +134,11 @@ LINPHONE_PUBLIC const LinphoneDialPlan* linphone_dial_plan_get_all(void); **/ LINPHONE_PUBLIC const LinphoneDialPlan* linphone_dial_plan_by_ccc(const char *ccc); +/** + * Return if given plan is generic +**/ +LINPHONE_PUBLIC const bool_t linphone_dial_plan_is_generic(const LinphoneDialPlan *ccc); + #ifdef __cplusplus } #endif diff --git a/java/common/org/linphone/core/LinphoneAccountCreator.java b/java/common/org/linphone/core/LinphoneAccountCreator.java index 9bf198658..6eeab11fa 100644 --- a/java/common/org/linphone/core/LinphoneAccountCreator.java +++ b/java/common/org/linphone/core/LinphoneAccountCreator.java @@ -62,6 +62,7 @@ public interface LinphoneAccountCreator { public final static Status RouteInvalid = new Status(21, "RouteInvalid"); public final static Status DisplayNameInvalid = new Status(22, "DisplayNameInvalid"); public final static Status TransportNotSupported = new Status(23, "TransportNotSupported"); + public final static Status CountryCodeInvalid = new Status(24, "CountryCodeInvalid"); private Status(int value, String stringValue) { mValue = value; diff --git a/java/common/org/linphone/core/LinphoneCallStats.java b/java/common/org/linphone/core/LinphoneCallStats.java index 20d40185d..4f56f9ec3 100644 --- a/java/common/org/linphone/core/LinphoneCallStats.java +++ b/java/common/org/linphone/core/LinphoneCallStats.java @@ -177,4 +177,18 @@ public interface LinphoneCallStats { * @return The local late rate percentage. **/ public float getLocalLateRate(); + + /** + * Get the encoder name of specified payload + * @param pl payload + * @return The name of encoder + */ + public String getEncoderName(PayloadType pl); + + /** + * Get the decoder name of specified payload + * @param pl payload + * @return The name of decoder + */ + public String getDecoderName(PayloadType pl); } diff --git a/java/common/org/linphone/core/LinphoneCoreFactory.java b/java/common/org/linphone/core/LinphoneCoreFactory.java index 80ca5f82c..7b33532d2 100644 --- a/java/common/org/linphone/core/LinphoneCoreFactory.java +++ b/java/common/org/linphone/core/LinphoneCoreFactory.java @@ -181,4 +181,9 @@ abstract public class LinphoneCoreFactory { * Create TunnelConfig object, used to configure voip anti blocking extension. */ abstract public TunnelConfig createTunnelConfig(); + + /** + * Create LinphoneAccountCreator object + */ + abstract public LinphoneAccountCreator createAccountCreator(LinphoneCore lc, String url); } diff --git a/java/impl/org/linphone/core/LinphoneCallStatsImpl.java b/java/impl/org/linphone/core/LinphoneCallStatsImpl.java index 3897c03f6..3c68bffd7 100644 --- a/java/impl/org/linphone/core/LinphoneCallStatsImpl.java +++ b/java/impl/org/linphone/core/LinphoneCallStatsImpl.java @@ -34,6 +34,7 @@ class LinphoneCallStatsImpl implements LinphoneCallStats { private float localLossRate; private float localLateRate; private long nativePtr; + private long nativeCPtr; private native int getMediaType(long nativeStatsPtr); private native int getIceState(long nativeStatsPtr); @@ -48,10 +49,13 @@ class LinphoneCallStatsImpl implements LinphoneCallStats { private native float getJitterBufferSize(long nativeStatsPtr); private native float getLocalLossRate(long nativeStatsPtr); private native float getLocalLateRate(long nativeStatsPtr); + private native String getEncoderName(long nativeStatsPtr, long nativeCallPtr, long payloadPtr); + private native String getDecoderName(long nativeStatsPtr, long nativeCallPtr, long payloadPtr); private native void updateStats(long nativeCallPtr, int mediaType); protected LinphoneCallStatsImpl(long nativeCallPtr, long nativeStatsPtr) { - nativePtr=nativeStatsPtr; + nativePtr = nativeStatsPtr; + nativeCPtr = nativeCallPtr; mediaType = getMediaType(nativeStatsPtr); iceState = getIceState(nativeStatsPtr); downloadBandwidth = getDownloadBandwidth(nativeStatsPtr); @@ -123,4 +127,16 @@ class LinphoneCallStatsImpl implements LinphoneCallStats { public float getLocalLateRate(){ return localLateRate; } + + public String getEncoderName(PayloadType pl) { + if (pl == null) + return ""; + return getEncoderName(nativePtr, nativeCPtr, ((PayloadTypeImpl)pl).nativePtr); + } + + public String getDecoderName(PayloadType pl) { + if (pl == null) + return ""; + return getDecoderName(nativePtr, nativeCPtr, ((PayloadTypeImpl)pl).nativePtr); + } } diff --git a/java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java b/java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java index 11cb0d87e..3e6a07e22 100644 --- a/java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java +++ b/java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java @@ -239,4 +239,9 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { public TunnelConfig createTunnelConfig() { return (TunnelConfig)_createTunnelConfig(); } + + @Override + public LinphoneAccountCreator createAccountCreator(LinphoneCore lc, String url) { + return new LinphoneAccountCreatorImpl(lc, url); + } } From d6e44b60e85595f7eea5c3759758171a9cd5fba8 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 4 Oct 2016 16:17:50 +0200 Subject: [PATCH 08/22] update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 5ad4fc409..d3b1c96b5 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 5ad4fc409f454f0e1c0422c5736e35042948aa96 +Subproject commit d3b1c96b5d040d1da67fbe47537f2018883ea210 From 2c01e3f61f96ba375f5a8f0017dec0a419a4dfdc Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 5 Oct 2016 10:28:17 +0200 Subject: [PATCH 09/22] fix crash in publish without expires --- coreapi/event.c | 15 +++++---------- coreapi/event.h | 6 ++---- tester/call_video_tester.c | 7 +------ tester/eventapi_tester.c | 3 ++- 4 files changed, 10 insertions(+), 21 deletions(-) diff --git a/coreapi/event.c b/coreapi/event.c index f4f69b7a5..3961a0d50 100644 --- a/coreapi/event.c +++ b/coreapi/event.c @@ -133,14 +133,9 @@ void linphone_event_set_publish_state(LinphoneEvent *lev, LinphonePublishState s linphone_core_notify_publish_state_changed(lev->lc,lev,state); switch(state){ case LinphonePublishCleared: - if (lev->expires!=-1){ - linphone_event_release(lev); - } + linphone_event_release(lev); break; case LinphonePublishOk: - if (lev->expires==-1){ - linphone_event_release(lev); - } break; case LinphonePublishError: linphone_event_release(lev); @@ -200,7 +195,7 @@ int linphone_event_send_subscribe(LinphoneEvent *lev, const LinphoneContent *bod switch (lev->subscription_state){ case LinphoneSubscriptionIncomingReceived: case LinphoneSubscriptionTerminated: - case LinphoneSubscriptionOutgoingInit: + case LinphoneSubscriptionOutgoingProgress: ms_error("linphone_event_send_subscribe(): cannot update subscription while in state [%s]", linphone_subscription_state_to_string(lev->subscription_state)); return -1; break; @@ -223,7 +218,7 @@ int linphone_event_send_subscribe(LinphoneEvent *lev, const LinphoneContent *bod err=sal_subscribe(lev->op,NULL,NULL,lev->name,lev->expires,body_handler); if (err==0){ if (lev->subscription_state==LinphoneSubscriptionNone) - linphone_event_set_state(lev,LinphoneSubscriptionOutgoingInit); + linphone_event_set_state(lev,LinphoneSubscriptionOutgoingProgress); } return err; } @@ -372,8 +367,8 @@ void linphone_event_terminate(LinphoneEvent *lev){ if (lev->publish_state!=LinphonePublishNone){ if (lev->publish_state==LinphonePublishOk && lev->expires!=-1){ - sal_publish(lev->op,NULL,NULL,NULL,0,NULL); - }else sal_op_unpublish(lev->op); + sal_op_unpublish(lev->op); + } linphone_event_set_publish_state(lev,LinphonePublishCleared); return; } diff --git a/coreapi/event.h b/coreapi/event.h index 7f281b629..247df2a9d 100644 --- a/coreapi/event.h +++ b/coreapi/event.h @@ -49,6 +49,7 @@ typedef enum _LinphoneSubscriptionDir LinphoneSubscriptionDir; /** * Enum for subscription states. + * LinphoneSubscriptionTerminated and LinphoneSubscriptionError are final states. **/ enum _LinphoneSubscriptionState{ LinphoneSubscriptionNone, /**< Initial state, should not be used.**/ @@ -57,13 +58,10 @@ enum _LinphoneSubscriptionState{ LinphoneSubscriptionPending, /**refresh_generic_subscribe property is set to 0.*/ }; -/*typo compatibility*/ -#define LinphoneSubscriptionOutoingInit LinphoneSubscriptionOutgoingInit -#define LinphoneSubscriptionOutgoingInit LinphoneSubscriptionOutgoingProgress /** * Typedef for subscription state enum. **/ diff --git a/tester/call_video_tester.c b/tester/call_video_tester.c index 2c5e7bc06..1719d6a77 100644 --- a/tester/call_video_tester.c +++ b/tester/call_video_tester.c @@ -954,8 +954,6 @@ static void call_with_ice_video_added_with_video_policies_to_false(void) { _call_with_ice_video(vpol, vpol, FALSE, TRUE, FALSE, FALSE); } -#if ICE_WAS_WORKING_WITH_REAL_TIME_TEXT /*which is not the case at the moment*/ - static void call_with_ice_video_and_rtt(void) { LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); @@ -980,7 +978,7 @@ static void call_with_ice_video_and_rtt(void) { linphone_core_set_video_port(pauline->lc, -1); linphone_core_set_text_port(pauline->lc, -1); - params = linphone_core_create_default_call_parameters(pauline->lc); + params = linphone_core_create_call_params(pauline->lc, NULL); linphone_call_params_enable_realtime_text(params, TRUE); BC_ASSERT_TRUE(call_ok = call_with_caller_params(pauline, marie, params)); if (!call_ok) goto end; @@ -998,7 +996,6 @@ end: linphone_core_manager_destroy(pauline); } -#endif static void video_call_with_early_media_no_matching_audio_codecs(void) { LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc"); @@ -1750,9 +1747,7 @@ test_t call_video_tests[] = { TEST_ONE_TAG("Call with ICE and video added 3", call_with_ice_video_added_3, "ICE"), TEST_ONE_TAG("Call with ICE and video added and refused", call_with_ice_video_added_and_refused, "ICE"), TEST_ONE_TAG("Call with ICE and video added with video policies to false", call_with_ice_video_added_with_video_policies_to_false, "ICE"), -#if ICE_WAS_WORKING_WITH_REAL_TIME_TEXT TEST_ONE_TAG("Call with ICE, video and realtime text", call_with_ice_video_and_rtt, "ICE"), -#endif TEST_ONE_TAG("Video call with ICE accepted using call params", video_call_ice_params, "ICE"), TEST_ONE_TAG("Audio call with ICE paused with caller video policy enabled", audio_call_with_ice_with_video_policy_enabled, "ICE"), TEST_NO_TAG("Video call recording (H264)", video_call_recording_h264_test), diff --git a/tester/eventapi_tester.c b/tester/eventapi_tester.c index e98e40c70..76533857b 100644 --- a/tester/eventapi_tester.c +++ b/tester/eventapi_tester.c @@ -436,8 +436,9 @@ static void publish_test_with_args(bool_t refresh, int expires){ lev=linphone_core_create_publish(marie->lc,pauline->identity,"dodo",expires); linphone_event_add_custom_header(lev,"CustomHeader","someValue"); - linphone_event_send_publish(lev,content); linphone_event_ref(lev); + linphone_event_send_publish(lev,content); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishProgress,1,1000)); BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishOk,1,3000)); From 4d500e84fe12bd0348e4da4129e7f71c3962f095 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 5 Oct 2016 22:40:29 +0200 Subject: [PATCH 10/22] Fix tests around ICE and video that were not testing what they should do. Add a big error to help understanding a common misuse of the library. --- coreapi/linphonecore.c | 4 ++++ coreapi/linphonecore.h | 2 +- tester/call_video_tester.c | 43 ++++++++++++++++++++++++++++++++++---- 3 files changed, 44 insertions(+), 5 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index df44c3529..028d0a62e 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -7435,6 +7435,10 @@ void linphone_core_set_media_encryption_mandatory(LinphoneCore *lc, bool_t m) { void linphone_core_init_default_params(LinphoneCore*lc, LinphoneCallParams *params) { params->has_audio = TRUE; params->has_video=linphone_core_video_enabled(lc) && lc->video_policy.automatically_initiate; + if (!linphone_core_video_enabled(lc) && lc->video_policy.automatically_initiate){ + ms_error("LinphoneCore has video disabled for both capture and display, but video policy is to start the call with video. " + "This is a possible mis-use of the API. In this case, video is disabled in default LinphoneCallParams"); + } params->media_encryption=linphone_core_get_media_encryption(lc); params->in_conference=FALSE; params->realtimetext_enabled = linphone_core_realtime_text_enabled(lc); diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 1e3f9a8c7..d81056acf 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -189,7 +189,7 @@ enum _LinphoneReason{ LinphoneReasonIOError, /**lc, TRUE); + linphone_core_enable_video_capture(pauline->lc, TRUE); + linphone_core_enable_video_display(marie->lc, TRUE); + linphone_core_enable_video_display(pauline->lc, TRUE); linphone_core_set_video_policy(pauline->lc, &caller_policy); linphone_core_set_video_policy(marie->lc, &callee_policy); linphone_core_set_firewall_policy(marie->lc, LinphonePolicyUseIce); linphone_core_set_firewall_policy(pauline->lc, LinphonePolicyUseIce); + /* This is to activate media relay on Flexisip server. + * Indeed, we want to test ICE with relay candidates as well, even though + * they will not be used at the end.*/ + linphone_core_set_user_agent(marie->lc,"Natted Linphone",NULL); + linphone_core_set_user_agent(pauline->lc,"Natted Linphone",NULL); + linphone_core_set_audio_port(marie->lc, -1); linphone_core_set_video_port(marie->lc, -1); linphone_core_set_audio_port(pauline->lc, -1); linphone_core_set_video_port(pauline->lc, -1); - BC_ASSERT_TRUE(call_ok = call(pauline, marie)); - if (!call_ok) goto end; - + + linphone_core_invite_address(pauline->lc, marie->identity); + if (!BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneCallIncomingReceived, 1))) goto end; + marie_remote_params = linphone_call_get_remote_params(linphone_core_get_current_call(marie->lc)); + BC_ASSERT_PTR_NOT_NULL(marie_remote_params); + if (marie_remote_params){ + BC_ASSERT_TRUE(linphone_call_params_video_enabled(marie_remote_params) == caller_policy.automatically_initiate); + } + + linphone_core_accept_call(marie->lc, linphone_core_get_current_call(marie->lc)); + BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1) + && wait_for(pauline->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 1)); + + pauline_current_params = linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc)); + BC_ASSERT_PTR_NOT_NULL(pauline_current_params); + if (pauline_current_params){ + BC_ASSERT_TRUE(linphone_call_params_video_enabled(pauline_current_params) == + (caller_policy.automatically_initiate && callee_policy.automatically_accept)); + } + /* Wait for ICE reINVITEs to complete. */ BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 2) && wait_for(pauline->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 2)); @@ -954,6 +982,12 @@ static void call_with_ice_video_added_with_video_policies_to_false(void) { _call_with_ice_video(vpol, vpol, FALSE, TRUE, FALSE, FALSE); } +static void call_with_ice_video_declined_then_added_by_callee(void) { + LinphoneVideoPolicy caller_policy = { TRUE, TRUE }; + LinphoneVideoPolicy callee_policy = { FALSE, FALSE }; + _call_with_ice_video(caller_policy, callee_policy, FALSE, TRUE, FALSE, FALSE); +} + static void call_with_ice_video_and_rtt(void) { LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); @@ -1747,6 +1781,7 @@ test_t call_video_tests[] = { TEST_ONE_TAG("Call with ICE and video added 3", call_with_ice_video_added_3, "ICE"), TEST_ONE_TAG("Call with ICE and video added and refused", call_with_ice_video_added_and_refused, "ICE"), TEST_ONE_TAG("Call with ICE and video added with video policies to false", call_with_ice_video_added_with_video_policies_to_false, "ICE"), + TEST_ONE_TAG("Call with ICE and video declined then added by callee", call_with_ice_video_declined_then_added_by_callee, "ICE"), TEST_ONE_TAG("Call with ICE, video and realtime text", call_with_ice_video_and_rtt, "ICE"), TEST_ONE_TAG("Video call with ICE accepted using call params", video_call_ice_params, "ICE"), TEST_ONE_TAG("Audio call with ICE paused with caller video policy enabled", audio_call_with_ice_with_video_policy_enabled, "ICE"), From a85bce34309ee3e48cd961d835c492a40d8b1f82 Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Thu, 6 Oct 2016 17:12:17 +0200 Subject: [PATCH 11/22] Fix set_phone_number --- coreapi/account_creator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/account_creator.c b/coreapi/account_creator.c index f98146d07..4a13fc551 100644 --- a/coreapi/account_creator.c +++ b/coreapi/account_creator.c @@ -302,7 +302,7 @@ LinphoneAccountCreatorStatus linphone_account_creator_set_phone_number(LinphoneA // if phone is valid, we lastly want to check that length is OK { - const LinphoneDialPlan* plan = linphone_dial_plan_by_ccc(country_code); + const LinphoneDialPlan* plan = linphone_dial_plan_by_ccc(creator->phone_country_code); int size = (int)strlen(phone_number); if (linphone_dial_plan_is_generic(plan)) { return LinphoneAccountCreatorCountryCodeInvalid; From 511bd799a578f33eb1f4756fa677c1f62396f9d2 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 6 Oct 2016 21:35:12 +0200 Subject: [PATCH 12/22] don't use TLS for "sipv4" subdomain of example.org because the server's certificate is not for this domain. --- tester/rcfiles/pauline_nat64_rc | 4 ++-- tester/rcfiles/pauline_v4proxy_rc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tester/rcfiles/pauline_nat64_rc b/tester/rcfiles/pauline_nat64_rc index c90b6a363..6cfa5ace0 100644 --- a/tester/rcfiles/pauline_nat64_rc +++ b/tester/rcfiles/pauline_nat64_rc @@ -15,8 +15,8 @@ realm=sip.example.org [proxy_0] -reg_proxy=sipv4-nat64.example.org;transport=tls -reg_route=sipv4-nat64.example.org;transport=tls +reg_proxy=sipv4-nat64.example.org;transport=tcp +reg_route=sipv4-nat64.example.org;transport=tcp reg_identity=sip:pauline@sip.example.org reg_expires=3600 reg_sendregister=1 diff --git a/tester/rcfiles/pauline_v4proxy_rc b/tester/rcfiles/pauline_v4proxy_rc index b2255c3c6..9b850e715 100644 --- a/tester/rcfiles/pauline_v4proxy_rc +++ b/tester/rcfiles/pauline_v4proxy_rc @@ -15,8 +15,8 @@ realm=sip.example.org [proxy_0] -reg_proxy=sipv4.example.org;transport=tls -reg_route=sipv4.example.org;transport=tls +reg_proxy=sipv4.example.org;transport=tcp +reg_route=sipv4.example.org;transport=tcp reg_identity=sip:pauline@sip.example.org reg_expires=3600 reg_sendregister=1 From 1abb2429fbd15ff97befb0857fef3c6e0c7da4a5 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 6 Oct 2016 21:44:04 +0200 Subject: [PATCH 13/22] fix regression in error_info reporting of LinphoneEvent --- coreapi/event.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/coreapi/event.c b/coreapi/event.c index 3961a0d50..c50ca460d 100644 --- a/coreapi/event.c +++ b/coreapi/event.c @@ -70,9 +70,8 @@ LINPHONE_PUBLIC const char *linphone_publish_state_to_string(LinphonePublishStat static void linphone_event_release(LinphoneEvent *lev){ if (lev->op) { - /*this will stop the refreesher*/ - sal_op_release(lev->op); - lev->op = NULL; + /*this will stop the refresher*/ + sal_op_stop_refreshing(lev->op); } linphone_event_unref(lev); } From a47a9a9c0610cbb37b4b676d856b328e5f8d6a7b Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 6 Oct 2016 22:43:14 +0200 Subject: [PATCH 14/22] fix tests --- tester/flexisip_tester.c | 7 ++++--- tester/stun_tester.c | 9 +++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/tester/flexisip_tester.c b/tester/flexisip_tester.c index 7f68bb684..600d20f1f 100644 --- a/tester/flexisip_tester.c +++ b/tester/flexisip_tester.c @@ -675,6 +675,7 @@ static void call_with_sips_not_achievable(void){ if (ei){ BC_ASSERT_EQUAL(linphone_error_info_get_reason(ei), LinphoneReasonTemporarilyUnavailable, int, "%d"); } + linphone_call_unref(call); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline1); @@ -946,7 +947,7 @@ static void dos_module_trigger(void) { } while (i < number_of_messge_to_send); // At this point we should be banned for a minute - ms_usleep(65000000); // Wait several seconds to ensure we are not banned anymore + ms_sleep(65); // Wait several seconds to ensure we are not banned anymore BC_ASSERT_LOWER(marie->stat.number_of_LinphoneMessageReceived, number_of_messge_to_send, int, "%d"); reset_counters(&marie->stat); @@ -1203,7 +1204,7 @@ test_t flexisip_tests[] = { TEST_NO_TAG("Call forking not responded", call_forking_not_responded), TEST_NO_TAG("Early-media call forking", early_media_call_forking), TEST_NO_TAG("Call with sips", call_with_sips), - TEST_ONE_TAG("Call with sips not achievable", call_with_sips_not_achievable, "LeaksMemory"), + TEST_NO_TAG("Call with sips not achievable", call_with_sips_not_achievable), TEST_NO_TAG("Call ipv6 to ipv6", call_with_ipv6), TEST_NO_TAG("Call ipv6 to ipv4", call_ipv6_to_ipv4), TEST_NO_TAG("Call ipv4 to ipv6", call_ipv4_to_ipv6), @@ -1212,7 +1213,7 @@ test_t flexisip_tests[] = { /*TEST_ONE_TAG("Subscribe Notify with sipp double publish", test_subscribe_notify_with_sipp_publisher_double_publish, "LeaksMemory"),*/ #endif TEST_NO_TAG("Publish/unpublish", test_publish_unpublish), - TEST_ONE_TAG("List subscribe", test_list_subscribe,"LeaksMemory"), + TEST_NO_TAG("List subscribe", test_list_subscribe), TEST_NO_TAG("File transfer message rcs to external body client", file_transfer_message_rcs_to_external_body_client), TEST_ONE_TAG("File transfer message external body to rcs client", file_transfer_message_external_body_to_rcs_client, "LeaksMemory"), TEST_ONE_TAG("File transfer message external body to external body client", file_transfer_message_external_body_to_external_body_client, "LeaksMemory"), diff --git a/tester/stun_tester.c b/tester/stun_tester.c index eb97d7472..0a2b1b608 100644 --- a/tester/stun_tester.c +++ b/tester/stun_tester.c @@ -47,11 +47,19 @@ static void linphone_stun_test_encode(void) static void linphone_stun_test_grab_ip(void) { + LinphoneCoreManager* lc_stun = linphone_core_manager_new2("stun_rc", FALSE); LinphoneCall dummy_call; int ping_time; int tmp = 0; + /*this test verifies the very basic STUN support of liblinphone, which is deprecated. + * It works only in IPv4 mode and there is no plan to make it work over ipv6.*/ + if (liblinphone_tester_ipv4_available()){ + goto end; + } + linphone_core_enable_ipv6(lc_stun->lc, FALSE); + memset(&dummy_call, 0, sizeof(LinphoneCall)); dummy_call.main_audio_stream_index = 0; dummy_call.main_video_stream_index = 1; @@ -85,6 +93,7 @@ static void linphone_stun_test_grab_ip(void) #endif ms_message("STUN test result: local text port maps to %s:%i", dummy_call.tc.addr, dummy_call.tc.port); +end: linphone_core_manager_destroy(lc_stun); } From a5cdc5953c545ddc5f630ec896a2f313ccd552c5 Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Fri, 7 Oct 2016 17:23:40 +0200 Subject: [PATCH 15/22] Add status if an account is linked + JNI --- coreapi/account_creator.c | 38 +++++++++++++++++++ coreapi/account_creator.h | 24 ++++++++++++ coreapi/linphonecore_jni.cc | 33 +++++++++++++++- coreapi/private.h | 1 + .../linphone/core/LinphoneAccountCreator.java | 37 ++++++++++-------- .../core/LinphoneAccountCreatorImpl.java | 6 +++ 6 files changed, 122 insertions(+), 17 deletions(-) diff --git a/coreapi/account_creator.c b/coreapi/account_creator.c index 4a13fc551..ead252c1f 100644 --- a/coreapi/account_creator.c +++ b/coreapi/account_creator.c @@ -101,6 +101,14 @@ void linphone_account_creator_cbs_set_activate_phone_number_link(LinphoneAccount cbs->activate_phone_number_link = cb; } +void linphone_account_creator_cbs_set_is_account_linked(LinphoneAccountCreatorCbs *cbs, LinphoneAccountCreatorCbsStatusCb cb) { + cbs->is_account_linked = cb; +} + +LinphoneAccountCreatorCbsStatusCb linphone_account_creator_cbs_get_is_account_linked(const LinphoneAccountCreatorCbs *cbs) { + return cbs->is_account_linked; +} + LinphoneAccountCreatorCbsStatusCb linphone_account_creator_cbs_get_is_account_activated(const LinphoneAccountCreatorCbs *cbs) { return cbs->is_account_activated; } @@ -701,6 +709,36 @@ LinphoneAccountCreatorStatus linphone_account_creator_link_phone_number_with_acc linphone_xml_rpc_request_unref(request); return LinphoneAccountCreatorOK; } + +static void _get_phone_number_for_account_cb(LinphoneXmlRpcRequest *request) { + LinphoneAccountCreator *creator = (LinphoneAccountCreator *)linphone_xml_rpc_request_get_user_data(request); + if (creator->callbacks->is_account_linked != NULL) { + LinphoneAccountCreatorStatus status = LinphoneAccountCreatorReqFailed; + const char* resp = linphone_xml_rpc_request_get_string_response(request); + if (linphone_xml_rpc_request_get_status(request) == LinphoneXmlRpcStatusOk) { + status = (strcmp(resp, "ERROR_USERNAME_PARAMETER_NOT_FOUND") == 0 + || strcmp(resp, "ERROR_ACCOUNT_DOESNT_EXIST") == 0 + || strcmp(resp, "ERROR_ALIAS_DOESNT_EXIST") == 0) ? LinphoneAccountCreatorAccountNotLinked : LinphoneAccountCreatorAccountLinked; + } + creator->callbacks->link_phone_number_with_account(creator, status, resp); + } +} + +LinphoneAccountCreatorStatus linphone_account_creator_is_account_linked(LinphoneAccountCreator *creator) { + LinphoneXmlRpcRequest *request; + if (!creator->username || !creator->domain) { + return LinphoneAccountCreatorReqFailed; + } + request = linphone_xml_rpc_request_new_with_args("get_phone_number_for_account",LinphoneXmlRpcArgString, + LinphoneXmlRpcArgString, creator->username, + LinphoneXmlRpcArgString, creator->domain, + LinphoneXmlRpcArgNone); + linphone_xml_rpc_request_set_user_data(request, creator); + linphone_xml_rpc_request_cbs_set_response(linphone_xml_rpc_request_get_callbacks(request), _get_phone_number_for_account_cb); + linphone_xml_rpc_session_send_request(creator->xmlrpc_session, request); + linphone_xml_rpc_request_unref(request); + return LinphoneAccountCreatorOK; +} /****************** END OF LINK PHONE NUMBER WITH ACCOUNT SECTION *************/ /****************** START OF ACTIVE PHONE NUMBER LINK **************************/ diff --git a/coreapi/account_creator.h b/coreapi/account_creator.h index 09c7523b9..f8400f02d 100644 --- a/coreapi/account_creator.h +++ b/coreapi/account_creator.h @@ -49,6 +49,9 @@ typedef enum _LinphoneAccountCreatorStatus { LinphoneAccountCreatorAccountAlreadyActivated, LinphoneAccountCreatorAccountNotActivated, + LinphoneAccountCreatorAccountLinked, + LinphoneAccountCreatorAccountNotLinked, + LinphoneAccountCreatorEmailInvalid, LinphoneAccountCreatorUsernameInvalid, LinphoneAccountCreatorUsernameTooShort, @@ -312,6 +315,13 @@ LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_activate_p LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_recover_phone_account(LinphoneAccountCreator *creator); +/** + * Send an XML-RPC request to ask if an account is linked with a phone number + * @param[in] creator LinphoneAccountCreator object + * @return if this account is linked with a phone number +**/ +LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_is_account_linked(LinphoneAccountCreator *creator); + /** * Configure an account (create a proxy config and authentication info for it). * @param[in] creator LinphoneAccountCreator object @@ -346,6 +356,20 @@ LINPHONE_PUBLIC void *linphone_account_creator_cbs_get_user_data(const LinphoneA **/ LINPHONE_PUBLIC void linphone_account_creator_cbs_set_user_data(LinphoneAccountCreatorCbs *cbs, void *ud); +/** + * Get the current linked tested callback. + * @param[in] cbs LinphoneAccountCreatorCbs object. + * @return The current linked tested callback. +**/ +LINPHONE_PUBLIC LinphoneAccountCreatorCbsStatusCb linphone_account_creator_cbs_get_is_account_linked(const LinphoneAccountCreatorCbs *cbs); + +/** + * Set the linked tested callback + * @param[in] cbs LinphoneAccountCreatorCbs object. + * @param[in] cb The existence tested callback to be used. +**/ +LINPHONE_PUBLIC void linphone_account_creator_cbs_set_is_account_linked(LinphoneAccountCreatorCbs *cbs, LinphoneAccountCreatorCbsStatusCb cb); + /** * Get the existence tested callback. * @param[in] cbs LinphoneAccountCreatorCbs object. diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 2490a2421..7026fe9b4 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -8066,6 +8066,32 @@ static void account_creator_activate_phone_number_link(LinphoneAccountCreator *c ms_error("cannot attach VM\n"); return; } + + LinphoneAccountCreatorCbs *cbs = linphone_account_creator_get_callbacks(creator); + jobject listener = (jobject) linphone_account_creator_cbs_get_user_data(cbs); + if (listener == NULL) { + ms_error("account_creator_response() notification without listener"); + return ; + } + + LinphoneCore *lc = (LinphoneCore *)creator->core; + LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc); + + jclass clazz = (jclass) env->GetObjectClass(listener); + jmethodID method = env->GetMethodID(clazz, "onAccountCreatorPhoneNumberLinkActivated","(Lorg/linphone/core/LinphoneAccountCreator;Lorg/linphone/core/LinphoneAccountCreator$Status;)V"); + env->DeleteLocalRef(clazz); + + jobject statusObject = env->CallStaticObjectMethod(ljb->accountCreatorStatusClass, ljb->accountCreatorStatusFromIntId, (jint)status); + env->CallVoidMethod(listener, method, getAccountCreator(env, creator), statusObject); +} + +static void account_creator_is_account_linked(LinphoneAccountCreator *creator, LinphoneAccountCreatorStatus status, const char *resp) { + JNIEnv *env = 0; + jint result = jvm->AttachCurrentThread(&env,NULL); + if (result != 0) { + ms_error("cannot attach VM\n"); + return; + } LinphoneAccountCreatorCbs *cbs = linphone_account_creator_get_callbacks(creator); jobject listener = (jobject) linphone_account_creator_cbs_get_user_data(cbs); @@ -8078,7 +8104,7 @@ static void account_creator_activate_phone_number_link(LinphoneAccountCreator *c LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc); jclass clazz = (jclass) env->GetObjectClass(listener); - jmethodID method = env->GetMethodID(clazz, "onAccountCreatorPhoneNumberLinkActivated","(Lorg/linphone/core/LinphoneAccountCreator;Lorg/linphone/core/LinphoneAccountCreator$Status;)V"); + jmethodID method = env->GetMethodID(clazz, "onAccountCreatorIsAccountLinked","(Lorg/linphone/core/LinphoneAccountCreator;Lorg/linphone/core/LinphoneAccountCreator$Status;)V"); env->DeleteLocalRef(clazz); jobject statusObject = env->CallStaticObjectMethod(ljb->accountCreatorStatusClass, ljb->accountCreatorStatusFromIntId, (jint)status); @@ -8315,6 +8341,11 @@ extern "C" jint Java_org_linphone_core_LinphoneAccountCreatorImpl_activateAccoun return (jint) linphone_account_creator_activate_account(account_creator); } +extern "C" jint Java_org_linphone_core_LinphoneAccountCreatorImpl_isAccountLinked(JNIEnv *env, jobject thiz, jlong ptr) { + LinphoneAccountCreator *account_creator = (LinphoneAccountCreator *)ptr; + return (jint) linphone_account_creator_is_account_linked(account_creator); +} + extern "C" jint Java_org_linphone_core_LinphoneAccountCreatorImpl_isAccountActivated(JNIEnv *env, jobject thiz, jlong ptr) { LinphoneAccountCreator *account_creator = (LinphoneAccountCreator *)ptr; return (jint) linphone_account_creator_is_account_activated(account_creator); diff --git a/coreapi/private.h b/coreapi/private.h index 641bca192..66194714a 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -1335,6 +1335,7 @@ struct _LinphoneAccountCreatorCbs { LinphoneAccountCreatorCbsStatusCb link_phone_number_with_account; LinphoneAccountCreatorCbsStatusCb activate_phone_number_link; LinphoneAccountCreatorCbsStatusCb recover_phone_account; + LinphoneAccountCreatorCbsStatusCb is_account_linked; }; BELLE_SIP_DECLARE_VPTR(LinphoneAccountCreatorCbs); diff --git a/java/common/org/linphone/core/LinphoneAccountCreator.java b/java/common/org/linphone/core/LinphoneAccountCreator.java index 6eeab11fa..298a4acb9 100644 --- a/java/common/org/linphone/core/LinphoneAccountCreator.java +++ b/java/common/org/linphone/core/LinphoneAccountCreator.java @@ -30,6 +30,7 @@ public interface LinphoneAccountCreator { void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, Status status); void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, Status status); void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, Status status); + void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, Status status); } public static class Status { @@ -48,21 +49,23 @@ public interface LinphoneAccountCreator { public final static Status AccountActivated = new Status(7, "AccountActivated"); public final static Status AccountAlreadyActivated = new Status(8, "AccountAlreadyActivated"); public final static Status AccountNotActivated = new Status(9, "AccountNotActivated"); - public final static Status EmailInvalid = new Status(10, "EmailInvalid"); - public final static Status UsernameInvalid = new Status(11, "UsernameInvalid"); - public final static Status UsernameTooShort = new Status(12, "UsernameTooShort"); - public final static Status UsernameTooLong = new Status(13, "UsernameTooLong"); - public final static Status UsernameInvalidSize = new Status(14, "UsernameInvalidSize"); - public final static Status PhoneNumberInvalid = new Status(15, "PhoneNumberInvalid"); - public final static Status PhoneNumberTooShort = new Status(16, "PhoneNumberTooShort"); - public final static Status PhoneNumberTooLong = new Status(17, "PhoneNumberTooLong"); - public final static Status PasswordTooShort = new Status(18, "PasswordTooShort"); - public final static Status PasswordTooLong = new Status(19, "PasswordTooLong"); - public final static Status DomainInvalid = new Status(20, "DomainInvalid"); - public final static Status RouteInvalid = new Status(21, "RouteInvalid"); - public final static Status DisplayNameInvalid = new Status(22, "DisplayNameInvalid"); - public final static Status TransportNotSupported = new Status(23, "TransportNotSupported"); - public final static Status CountryCodeInvalid = new Status(24, "CountryCodeInvalid"); + public final static Status AccountLinked = new Status(10, "AccountLinked"); + public final static Status AccountNotLinked = new Status(11, "AccountNotLinked"); + public final static Status EmailInvalid = new Status(12, "EmailInvalid"); + public final static Status UsernameInvalid = new Status(13, "UsernameInvalid"); + public final static Status UsernameTooShort = new Status(14, "UsernameTooShort"); + public final static Status UsernameTooLong = new Status(15, "UsernameTooLong"); + public final static Status UsernameInvalidSize = new Status(16, "UsernameInvalidSize"); + public final static Status PhoneNumberInvalid = new Status(17, "PhoneNumberInvalid"); + public final static Status PhoneNumberTooShort = new Status(18, "PhoneNumberTooShort"); + public final static Status PhoneNumberTooLong = new Status(19, "PhoneNumberTooLong"); + public final static Status PasswordTooShort = new Status(20, "PasswordTooShort"); + public final static Status PasswordTooLong = new Status(21, "PasswordTooLong"); + public final static Status DomainInvalid = new Status(22, "DomainInvalid"); + public final static Status RouteInvalid = new Status(23, "RouteInvalid"); + public final static Status DisplayNameInvalid = new Status(24, "DisplayNameInvalid"); + public final static Status TransportNotSupported = new Status(25, "TransportNotSupported"); + public final static Status CountryCodeInvalid = new Status(26, "CountryCodeInvalid"); private Status(int value, String stringValue) { mValue = value; @@ -138,7 +141,9 @@ public interface LinphoneAccountCreator { Status linkPhoneNumberWithAccount(); Status activatePhoneNumberLink(); - + + Status isAccountLinked(); + Status recoverPhoneAccount(); LinphoneProxyConfig configure(); diff --git a/java/impl/org/linphone/core/LinphoneAccountCreatorImpl.java b/java/impl/org/linphone/core/LinphoneAccountCreatorImpl.java index aa6a0199b..d47cedc7e 100644 --- a/java/impl/org/linphone/core/LinphoneAccountCreatorImpl.java +++ b/java/impl/org/linphone/core/LinphoneAccountCreatorImpl.java @@ -177,6 +177,12 @@ public class LinphoneAccountCreatorImpl implements LinphoneAccountCreator { public Status activateAccount() { return Status.fromInt(activateAccount(nativePtr)); } + + private native int isAccountLinked(long ptr); + @Override + public Status isAccountLinked() { + return Status.fromInt(isAccountLinked(nativePtr)); + } private native int isAccountActivated(long ptr); @Override From f1ae36112bf0180bfe9a10d7f4e6fa5591f958ff Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 7 Oct 2016 19:57:40 +0200 Subject: [PATCH 16/22] fix tests --- tester/vcard_tester.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tester/vcard_tester.c b/tester/vcard_tester.c index 9754acccf..526cf2a1c 100644 --- a/tester/vcard_tester.c +++ b/tester/vcard_tester.c @@ -799,8 +799,8 @@ test_t vcard_tests[] = { TEST_NO_TAG("vCard creation for existing friends", linphone_vcard_update_existing_friends_test), TEST_NO_TAG("vCard phone numbers and SIP addresses", linphone_vcard_phone_numbers_and_sip_addresses), #ifdef SQLITE_STORAGE_ENABLED - TEST_ONE_TAG("Friends working if no db set", friends_if_no_db_set, "LeaksMemory"), - TEST_ONE_TAG("Friends storage migration from rc to db", friends_migration, "LeaksMemory"), + TEST_NO_TAG("Friends working if no db set", friends_if_no_db_set), + TEST_NO_TAG("Friends storage migration from rc to db", friends_migration), TEST_NO_TAG("Friends storage in sqlite database", friends_sqlite_storage), #endif TEST_NO_TAG("CardDAV clean", carddav_clean), // This is to ensure the content of the test addressbook is in the correct state for the following tests From 0be87c5c242d5c05e00df06f3ba39d180ac61c76 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Sat, 8 Oct 2016 09:13:57 +0200 Subject: [PATCH 17/22] don't send register when nothing has changed. --- coreapi/proxy.c | 18 +++++++++++------- tester/presence_server_tester.c | 2 +- tester/tester.c | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/coreapi/proxy.c b/coreapi/proxy.c index b15c57453..9ccd5ac4b 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -65,6 +65,10 @@ LinphoneProxyConfigAddressComparisonResult linphone_proxy_config_is_server_confi LinphoneProxyConfigAddressComparisonResult result_identity; LinphoneProxyConfigAddressComparisonResult result; + ms_message("linphone_proxy_config_is_server_config_changed: %s->%s %s->%s", + cfg->saved_identity ? linphone_address_as_string(cfg->saved_identity) : "", linphone_address_as_string(cfg->identity_address), + cfg->saved_proxy ? linphone_address_as_string(cfg->saved_proxy) : "", linphone_address_as_string(current_proxy)); + result = linphone_proxy_config_address_equal(cfg->saved_identity,cfg->identity_address); if (result == LinphoneProxyConfigAddressDifferent) goto end; result_identity = result; @@ -79,6 +83,7 @@ LinphoneProxyConfigAddressComparisonResult linphone_proxy_config_is_server_confi end: if (current_proxy) linphone_address_destroy(current_proxy); + ms_message("linphone_proxy_config_is_server_config_changed : %i", result); return result; } @@ -762,7 +767,7 @@ int linphone_proxy_config_done(LinphoneProxyConfig *cfg) if (!linphone_proxy_config_check(cfg->lc,cfg)) return -1; - /*check if server address as changed*/ + /*check if server address has changed*/ res = linphone_proxy_config_is_server_config_changed(cfg); if (res != LinphoneProxyConfigAddressEqual) { /* server config has changed, need to unregister from previous first*/ @@ -778,22 +783,21 @@ int linphone_proxy_config_done(LinphoneProxyConfig *cfg) if (res == LinphoneProxyConfigAddressDifferent) { _linphone_proxy_config_unpublish(cfg); } - } + cfg->commit = TRUE; } if (linphone_proxy_config_compute_publish_params_hash(cfg)) { ms_message("Publish params have changed on proxy config [%p]",cfg); if (cfg->long_term_event) { - if (!cfg->publish) { - /*publish is terminated*/ - linphone_event_terminate(cfg->long_term_event); - } else { + if (cfg->publish) { const char * sip_etag = linphone_event_get_custom_header(cfg->long_term_event, "SIP-ETag"); if (sip_etag) { if (cfg->sip_etag) ms_free(cfg->sip_etag); cfg->sip_etag = ms_strdup(sip_etag); } } + /*publish is terminated*/ + linphone_event_terminate(cfg->long_term_event); linphone_event_unref(cfg->long_term_event); cfg->long_term_event = NULL; } @@ -801,7 +805,7 @@ int linphone_proxy_config_done(LinphoneProxyConfig *cfg) } else { ms_message("Publish params have not changed on proxy config [%p]",cfg); } - cfg->commit=TRUE; + linphone_proxy_config_write_all_to_config_file(cfg->lc); return 0; } diff --git a/tester/presence_server_tester.c b/tester/presence_server_tester.c index fbed526bb..e60b28396 100644 --- a/tester/presence_server_tester.c +++ b/tester/presence_server_tester.c @@ -447,7 +447,7 @@ static void test_presence_list_base(bool_t enable_compression) { reset_counters(&laure->stat); reset_counters(&marie->stat); - /*keep in ming long terme presence*/ + /*keep in mind long terme presence*/ if (!BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphonePresenceActivityOnline, 1, 4000))) goto end; diff --git a/tester/tester.c b/tester/tester.c index 131252823..c48887034 100644 --- a/tester/tester.c +++ b/tester/tester.c @@ -424,7 +424,7 @@ void linphone_core_manager_stop(LinphoneCoreManager *mgr){ if (mgr->lc) { const char *record_file = linphone_core_get_record_file(mgr->lc); char *chatdb = ms_strdup(linphone_core_get_chat_database_path(mgr->lc)); - if (!liblinphone_tester_keep_record_files && record_file) { + if (!liblinphone_tester_keep_record_files && record_file && ortp_file_exist(record_file)) { if ((bc_get_number_of_failures() - mgr->number_of_bcunit_error_at_creation)>0) { ms_error("Test has failed, keeping recorded file [%s]", record_file); } From e3570d9edd96f9b7e7c2ad524d9379d11abb18d7 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Sat, 8 Oct 2016 18:10:43 +0200 Subject: [PATCH 18/22] fix regressions due to last commit --- coreapi/linphonecore.c | 21 +++++++++++---------- coreapi/private.h | 4 +++- coreapi/proxy.c | 6 ++++++ 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 028d0a62e..0086029d7 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2411,6 +2411,17 @@ static bool_t transports_unchanged(const LCSipTransports * tr1, const LCSipTrans tr2->tls_port==tr1->tls_port; } +static void __linphone_core_invalidate_registers(LinphoneCore* lc){ + const bctbx_list_t *elem=linphone_core_get_proxy_config_list(lc); + for(;elem!=NULL;elem=elem->next){ + LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)elem->data; + if (linphone_proxy_config_register_enabled(cfg)) { + /*this will force a re-registration at next iterate*/ + cfg->commit = TRUE; + } + } +} + int _linphone_core_apply_transports(LinphoneCore *lc){ Sal *sal=lc->sal; const char *anyaddr; @@ -6880,16 +6891,6 @@ void linphone_core_refresh_registers(LinphoneCore* lc) { } } -void __linphone_core_invalidate_registers(LinphoneCore* lc){ - const bctbx_list_t *elem=linphone_core_get_proxy_config_list(lc); - for(;elem!=NULL;elem=elem->next){ - LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)elem->data; - if (linphone_proxy_config_register_enabled(cfg)) { - linphone_proxy_config_edit(cfg); - linphone_proxy_config_done(cfg); - } - } -} static void disable_internal_network_reachability_detection(LinphoneCore *lc){ if (lc->auto_net_state_mon) { diff --git a/coreapi/private.h b/coreapi/private.h index 66194714a..21f57e974 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -651,6 +651,9 @@ struct _LinphoneProxyConfig /*use to check if server config has changed between edit() and done()*/ LinphoneAddress *saved_proxy; LinphoneAddress *saved_identity; + int saved_expires; + bool_t saved_sendregister; + bool_t unused[3]; /*---*/ LinphoneAddress *pending_contact; /*use to store previous contact in case of network failure*/ LinphoneEvent *long_term_event; @@ -1159,7 +1162,6 @@ bool_t linphone_core_sound_resources_available(LinphoneCore *lc); void linphone_core_notify_refer_state(LinphoneCore *lc, LinphoneCall *referer, LinphoneCall *newcall); unsigned int linphone_core_get_audio_features(LinphoneCore *lc); -void __linphone_core_invalidate_registers(LinphoneCore* lc); void _linphone_core_codec_config_write(LinphoneCore *lc); #define HOLD_OFF (0) diff --git a/coreapi/proxy.c b/coreapi/proxy.c index 9ccd5ac4b..8014f2739 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -29,6 +29,7 @@ Copyright (C) 2000 Simon MORLAT (simon.morlat@linphone.org) /*store current config related to server location*/ static void linphone_proxy_config_store_server_config(LinphoneProxyConfig* cfg) { + cfg->saved_sendregister = cfg->reg_sendregister; if (cfg->saved_identity) linphone_address_destroy(cfg->saved_identity); if (cfg->identity_address) cfg->saved_identity = linphone_address_clone(cfg->identity_address); @@ -786,6 +787,11 @@ int linphone_proxy_config_done(LinphoneProxyConfig *cfg) } cfg->commit = TRUE; } + if ((cfg->saved_sendregister != cfg->reg_sendregister) + || (cfg->saved_expires != cfg->expires)){ + cfg->commit = TRUE; + } + if (linphone_proxy_config_compute_publish_params_hash(cfg)) { ms_message("Publish params have changed on proxy config [%p]",cfg); if (cfg->long_term_event) { From 9db6015d3e485f18c3de28544444145b080978ac Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 10 Oct 2016 10:16:54 +0200 Subject: [PATCH 19/22] remove log --- coreapi/proxy.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/coreapi/proxy.c b/coreapi/proxy.c index 8014f2739..a3b963a43 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -65,10 +65,6 @@ LinphoneProxyConfigAddressComparisonResult linphone_proxy_config_is_server_confi LinphoneAddress *current_proxy=cfg->reg_proxy?linphone_address_new(cfg->reg_proxy):NULL; LinphoneProxyConfigAddressComparisonResult result_identity; LinphoneProxyConfigAddressComparisonResult result; - - ms_message("linphone_proxy_config_is_server_config_changed: %s->%s %s->%s", - cfg->saved_identity ? linphone_address_as_string(cfg->saved_identity) : "", linphone_address_as_string(cfg->identity_address), - cfg->saved_proxy ? linphone_address_as_string(cfg->saved_proxy) : "", linphone_address_as_string(current_proxy)); result = linphone_proxy_config_address_equal(cfg->saved_identity,cfg->identity_address); if (result == LinphoneProxyConfigAddressDifferent) goto end; From be43cdfc41738a5bb75bff98428407259592d8f9 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 10 Oct 2016 10:36:22 +0200 Subject: [PATCH 20/22] fix crashing test --- tester/call_single_tester.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tester/call_single_tester.c b/tester/call_single_tester.c index 691f1dfb1..0ef27fe6e 100644 --- a/tester/call_single_tester.c +++ b/tester/call_single_tester.c @@ -1381,8 +1381,8 @@ static void call_with_custom_headers(void) { linphone_call_params_add_custom_header(params,"Weather","bad"); linphone_call_params_add_custom_header(params,"Working","yes"); - BC_ASSERT_TRUE(call_with_caller_params(pauline,marie,params)); - linphone_call_params_destroy(params); + if (!BC_ASSERT_TRUE(call_with_caller_params(pauline,marie,params))) goto end; + call_marie=linphone_core_get_current_call(marie->lc); call_pauline=linphone_core_get_current_call(pauline->lc); @@ -1419,7 +1419,9 @@ static void call_with_custom_headers(void) { ms_free(marie_remote_contact_header); end_call(pauline, marie); - + +end: + linphone_call_params_destroy(params); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); } From 88e41d4893b25823f380b667f19199043de1f222 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 10 Oct 2016 10:55:06 +0200 Subject: [PATCH 21/22] update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index d3b1c96b5..8b4fca52b 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit d3b1c96b5d040d1da67fbe47537f2018883ea210 +Subproject commit 8b4fca52b0e6939f908a33da9952cf4a8c862a07 From 0a9176ebbacdf22aeb4ee5d73b50ced25d186d9b Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 10 Oct 2016 11:47:56 +0200 Subject: [PATCH 22/22] Fix audio stream accidentally muted if early media was received. --- coreapi/linphonecore.c | 2 +- tester/call_multi_tester.c | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 0086029d7..057b3dde7 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -5114,7 +5114,7 @@ void linphone_core_enable_mic(LinphoneCore *lc, bool_t enable) { call = (LinphoneCall *)elem->data; call->audio_muted = !enable; if (call->audiostream) - linphone_core_mute_audio_stream(lc, call->audiostream, enable); + linphone_core_mute_audio_stream(lc, call->audiostream, call->audio_muted); } } diff --git a/tester/call_multi_tester.c b/tester/call_multi_tester.c index 9a23a3205..7b1e85778 100644 --- a/tester/call_multi_tester.c +++ b/tester/call_multi_tester.c @@ -254,19 +254,21 @@ static void simple_conference_base(LinphoneCoreManager* marie, LinphoneCoreManag bool_t is_remote_conf; bool_t focus_is_up = (focus && ((LinphoneConferenceServer *)focus)->reg_state == LinphoneRegistrationOk); bctbx_list_t* lcs=bctbx_list_append(NULL,marie->lc); + lcs=bctbx_list_append(lcs,pauline->lc); lcs=bctbx_list_append(lcs,laure->lc); - if(focus) lcs=bctbx_list_append(lcs,focus->lc); + if (focus) lcs=bctbx_list_append(lcs,focus->lc); is_remote_conf = (strcmp(lp_config_get_string(marie->lc->config, "misc", "conference_type", "local"), "remote") == 0); if(is_remote_conf) BC_ASSERT_PTR_NOT_NULL(focus); - BC_ASSERT_TRUE(call(marie,pauline)); + if (!BC_ASSERT_TRUE(call(marie,pauline))) goto end; + marie_call_pauline=linphone_core_get_current_call(marie->lc); pauline_called_by_marie=linphone_core_get_current_call(pauline->lc); BC_ASSERT_TRUE(pause_call_1(marie,marie_call_pauline,pauline,pauline_called_by_marie)); - BC_ASSERT_TRUE(call(marie,laure)); + if (!BC_ASSERT_TRUE(call(marie,laure))) goto end; initial_marie_stat=marie->stat; initial_pauline_stat=pauline->stat; initial_laure_stat=laure->stat;