From 9abc48cc943eea9fb6e4f54ca1d9923fa18848ff Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 18 May 2017 14:20:50 +0200 Subject: [PATCH 01/19] fix crash when LinphoneConference object is created from wrapper. --- coreapi/linphonecore.c | 1 + 1 file changed, 1 insertion(+) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 7a0b53e0d..d6f4cafdf 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -7085,6 +7085,7 @@ LinphoneStatus linphone_core_add_to_conference(LinphoneCore *lc, LinphoneCall *c LinphoneConferenceParams *params = linphone_conference_params_new(lc); conference = linphone_core_create_conference_with_params(lc, params); linphone_conference_params_unref(params); + linphone_conference_unref(conference); /*actually linphone_core_create_conference_with_params() takes a ref for lc->conf_ctx */ } if(conference) return linphone_conference_add_participant(lc->conf_ctx, call); else return -1; From 84441343adedad0007a05b438abe04a7c105c6ca Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 18 May 2017 15:11:17 +0200 Subject: [PATCH 02/19] Fix crash because of unref of event. --- coreapi/callbacks.c | 1 - 1 file changed, 1 deletion(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 369513b52..d3bb3b6fb 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -1138,7 +1138,6 @@ static void register_failure(SalOp *op){ if (cfg->long_term_event){ /*prevent publish to be sent now until registration gets successful*/ linphone_event_terminate(cfg->long_term_event); - linphone_event_unref(cfg->long_term_event); cfg->long_term_event=NULL; cfg->send_publish=cfg->publish; } From de154b5207067d593c494091074ba73258b8b5ab Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Thu, 18 May 2017 15:58:17 +0200 Subject: [PATCH 03/19] keep ringing in early media when declining one of many incoming calls if linphone_core_set_ring_during_incoming_early_media=true --- coreapi/callbacks.c | 2 +- coreapi/linphonecall.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index d3bb3b6fb..62147c4cd 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -1016,7 +1016,7 @@ static void call_failure(SalOp *op){ /* Stop ringing */ while(calls) { - if (((LinphoneCall *)calls->data)->state == LinphoneCallIncomingReceived) { + if (((LinphoneCall *)calls->data)->state == LinphoneCallIncomingReceived || (linphone_core_get_ring_during_incoming_early_media(lc) && ((LinphoneCall *)calls->data)->state == LinphoneCallIncomingEarlyMedia)) { stop_ringing = FALSE; break; } diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index dcd420ebf..5bc756aa0 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -5260,7 +5260,7 @@ static void terminate_call(LinphoneCall *call) { /* Stop ringing */ while(calls) { - if (((LinphoneCall *)calls->data)->state == LinphoneCallIncomingReceived) { + if (((LinphoneCall *)calls->data)->state == LinphoneCallIncomingReceived || (linphone_core_get_ring_during_incoming_early_media(lc) && ((LinphoneCall *)calls->data)->state == LinphoneCallIncomingEarlyMedia)) { stop_ringing = FALSE; break; } From 1e113618275ba4ab8bcadb8cbbd6c641045d8d41 Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Thu, 18 May 2017 16:10:54 +0200 Subject: [PATCH 04/19] reduce call to lp_config --- coreapi/callbacks.c | 3 ++- coreapi/linphonecall.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 62147c4cd..65911275d 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -1015,8 +1015,9 @@ static void call_failure(SalOp *op){ } /* Stop ringing */ + bool_t ring_during_early_media = linphone_core_get_ring_during_incoming_early_media(lc); while(calls) { - if (((LinphoneCall *)calls->data)->state == LinphoneCallIncomingReceived || (linphone_core_get_ring_during_incoming_early_media(lc) && ((LinphoneCall *)calls->data)->state == LinphoneCallIncomingEarlyMedia)) { + if (((LinphoneCall *)calls->data)->state == LinphoneCallIncomingReceived || (ring_during_early_media && ((LinphoneCall *)calls->data)->state == LinphoneCallIncomingEarlyMedia)) { stop_ringing = FALSE; break; } diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 5bc756aa0..dc4c83a49 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -5259,8 +5259,9 @@ static void terminate_call(LinphoneCall *call) { } /* Stop ringing */ + bool_t ring_during_early_media = linphone_core_get_ring_during_incoming_early_media(lc); while(calls) { - if (((LinphoneCall *)calls->data)->state == LinphoneCallIncomingReceived || (linphone_core_get_ring_during_incoming_early_media(lc) && ((LinphoneCall *)calls->data)->state == LinphoneCallIncomingEarlyMedia)) { + if (((LinphoneCall *)calls->data)->state == LinphoneCallIncomingReceived || (ring_during_early_media && ((LinphoneCall *)calls->data)->state == LinphoneCallIncomingEarlyMedia)) { stop_ringing = FALSE; break; } From 2b6bcbc7f46423d17c18f2e2eafe52ac245e337f Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Fri, 19 May 2017 09:34:11 +0200 Subject: [PATCH 05/19] fix(conference): wrap correctly `get_participants --- include/linphone/conference.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linphone/conference.h b/include/linphone/conference.h index ab2ad2add..3caa31604 100644 --- a/include/linphone/conference.h +++ b/include/linphone/conference.h @@ -25,7 +25,7 @@ #ifndef LINPHONE_CONFERENCE_H #define LINPHONE_CONFERENCE_H - + #include "linphone/types.h" #ifdef __cplusplus @@ -54,7 +54,7 @@ LINPHONE_PUBLIC LinphoneConferenceParams *linphone_conference_params_ref(Linphon /** * Release a #LinphoneConferenceParams. * @param[in] params The #LinphoneConferenceParams to release. - */ + */ LINPHONE_PUBLIC void linphone_conference_params_unref(LinphoneConferenceParams *params); /** @@ -120,7 +120,7 @@ LINPHONE_PUBLIC bctbx_list_t *linphone_conference_get_participants(const Linphon /** * Invite participants to the conference, by supplying a list of LinphoneAddress * @param obj The conference. - * @param addresses bctbx_list_t of #LinphoneAddress object + * @param addresses \bctbx_list{LinphoneAddress} * @param params #LinphoneCallParams to use for inviting the participants. **/ LINPHONE_PUBLIC LinphoneStatus linphone_conference_invite_participants(LinphoneConference *conf, const bctbx_list_t *addresses, const LinphoneCallParams *params); From 38638e543d1641ff637f32c4424f61684c861cea Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 19 May 2017 11:17:53 +0200 Subject: [PATCH 06/19] fix previous commit (was incomplete) --- coreapi/linphonecore.c | 12 ++++++++++-- tester/call_multi_tester.c | 5 ++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index d6f4cafdf..7f20bb081 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -7052,22 +7052,30 @@ static void _linphone_core_conference_state_changed(LinphoneConference *conf, Li } } +/*This function sets the "unique" conference object for the LinphoneCore - which is necessary as long as + * liblinphone is used in a client app. When liblinphone will be used in a server app, this shall not be done anymore.*/ +static void linphone_core_set_conference(LinphoneCore *lc, LinphoneConference *conf){ + lc->conf_ctx = linphone_conference_ref(conf); +} + LinphoneConference *linphone_core_create_conference_with_params(LinphoneCore *lc, const LinphoneConferenceParams *params) { const char *conf_method_name; + LinphoneConference *conf; if(lc->conf_ctx == NULL) { LinphoneConferenceParams *params2 = linphone_conference_params_clone(params); linphone_conference_params_set_state_changed_callback(params2, _linphone_core_conference_state_changed, lc); conf_method_name = lp_config_get_string(lc->config, "misc", "conference_type", "local"); if(strcasecmp(conf_method_name, "local") == 0) { - lc->conf_ctx = linphone_local_conference_new_with_params(lc, params2); + conf = linphone_local_conference_new_with_params(lc, params2); } else if(strcasecmp(conf_method_name, "remote") == 0) { - lc->conf_ctx = linphone_remote_conference_new_with_params(lc, params2); + conf = linphone_remote_conference_new_with_params(lc, params2); } else { ms_error("'%s' is not a valid conference method", conf_method_name); linphone_conference_params_unref(params2); return NULL; } linphone_conference_params_unref(params2); + linphone_core_set_conference(lc, conf); } else { ms_error("Could not create a conference: a conference instance already exists"); return NULL; diff --git a/tester/call_multi_tester.c b/tester/call_multi_tester.c index fed22b5a0..444481bf4 100644 --- a/tester/call_multi_tester.c +++ b/tester/call_multi_tester.c @@ -443,7 +443,7 @@ static void simple_conference_from_scratch(void){ BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallReleased,1,1000)); BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallReleased,1,1000)); } - + linphone_conference_unref(conf); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); linphone_core_manager_destroy(laure); @@ -452,6 +452,9 @@ static void simple_conference_from_scratch(void){ bctbx_list_free(lcs); } + + + static void simple_encrypted_conference_with_ice(LinphoneMediaEncryption mode) { LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc"); From c3f94fbddf73fdab12c403a6c3ee2cfb6d0ba334 Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Mon, 22 May 2017 11:14:02 +0200 Subject: [PATCH 07/19] Fix javadoc in ErrorInfo.java --- java/common/org/linphone/core/ErrorInfo.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/java/common/org/linphone/core/ErrorInfo.java b/java/common/org/linphone/core/ErrorInfo.java index 6c4e76dc6..ad95278e3 100644 --- a/java/common/org/linphone/core/ErrorInfo.java +++ b/java/common/org/linphone/core/ErrorInfo.java @@ -28,7 +28,7 @@ public interface ErrorInfo { * Get additional error information, which is provided as a Reason header in SIP response. **/ ErrorInfo getSubErrorInfo(); - + /** * Set Reason enum. */ @@ -39,12 +39,10 @@ public interface ErrorInfo { void setProtocol(String protocol); /** * Set the protocol code corresponding to the error (typically a SIP status code). - * @return the code. */ void setProtocolCode(int code); /** * Set the reason-phrase provided by the protocol (typically a SIP reason-phrase). - * @return the reason phrase. */ void setPhrase(String phrase); /** @@ -55,7 +53,7 @@ public interface ErrorInfo { * Set additional error information, which is provided as a Reason header in SIP response. **/ void setSubErrorInfo(ErrorInfo sub_ei); - + /** * Get details about the error, if provided by the protocol. For SIP it consists of the content of a Warning or Reason header. * @return details about the error. From 974daa4bb5b8011cf90b1adfb99cf09e9f349cb9 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Mon, 22 May 2017 16:44:24 +0200 Subject: [PATCH 08/19] fix(linphonecall): test conference context before `on_call_stream_starting` call --- coreapi/linphonecall.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index dc4c83a49..e8aee4deb 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1109,18 +1109,18 @@ static void linphone_call_init_common(LinphoneCall *call, LinphoneAddress *from, linphone_call_init_stats(call->audio_stats, LINPHONE_CALL_STATS_AUDIO); linphone_call_init_stats(call->video_stats, LINPHONE_CALL_STATS_VIDEO); linphone_call_init_stats(call->text_stats, LINPHONE_CALL_STATS_TEXT); - + if (call->dest_proxy == NULL) { /* Try to define the destination proxy if it has not already been done to have a correct contact field in the SIP messages */ call->dest_proxy = linphone_core_lookup_known_proxy(call->core, call->log->to); } - - + + if (call->dest_proxy != NULL) call->nat_policy = linphone_proxy_config_get_nat_policy(call->dest_proxy); if (call->nat_policy == NULL) call->nat_policy = linphone_core_get_nat_policy(call->core); - + linphone_nat_policy_ref(call->nat_policy); } @@ -3506,7 +3506,7 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, LinphoneCallSta setup_ring_player(lc,call); } - if (call->params->in_conference){ + if (call->params->in_conference && lc->conf_ctx){ /*transform the graph to connect it to the conference filter */ mute = stream->dir==SalStreamRecvOnly; linphone_conference_on_call_stream_starting(lc->conf_ctx, call, mute); From 8e6f7b0bc37b75c9a30427c7ff4733ebf395d6be Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Mon, 22 May 2017 17:04:26 +0200 Subject: [PATCH 09/19] add multible publish aggregation test --- tester/presence_server_tester.c | 66 +++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/tester/presence_server_tester.c b/tester/presence_server_tester.c index ce55d2e40..d344204d4 100644 --- a/tester/presence_server_tester.c +++ b/tester/presence_server_tester.c @@ -1101,6 +1101,71 @@ static void long_term_presence_with_crossed_references(void) { }else ms_warning("Test skipped, no vcard support"); } +static void multiple_publish_aggregation(void) { + LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc"); + //LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); + //LinphoneCoreManager* pauline2 = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); + LinphoneCoreManager* pauline = linphone_core_manager_new("pauline_tcp_rc"); + LinphoneCoreManager* pauline2 = linphone_core_manager_new("pauline_tcp_rc"); + LinphonePresenceModel *pauline_presence = linphone_presence_model_new_with_activity(LinphonePresenceActivityDinner, NULL); + LinphonePresenceModel *pauline_presence2 = linphone_presence_model_new_with_activity(LinphonePresenceActivityAway, NULL); + LinphoneFriend* f = linphone_core_create_friend_with_address(marie->lc, get_identity(pauline)); + LinphonePresenceActivity *activity = NULL; + LinphoneCoreCbs *callbacks = linphone_factory_create_core_cbs(linphone_factory_get()); + int nb_act = 0; + int i = 0; + bool_t eq = FALSE; + + linphone_core_cbs_set_publish_state_changed(callbacks, linphone_publish_state_changed); + _linphone_core_add_callbacks(pauline->lc, callbacks, TRUE); + _linphone_core_add_callbacks(pauline2->lc, callbacks, TRUE); + linphone_core_cbs_unref(callbacks); + + lp_config_set_int(marie->lc->config, "sip", "subscribe_expires", 40); + linphone_core_set_user_agent(pauline->lc, "full-presence-support", NULL); + linphone_core_set_user_agent(pauline2->lc, "full-presence-support", NULL); + linphone_core_set_user_agent(marie->lc, "full-presence-support", NULL); + enable_publish(pauline, TRUE); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphonePublishOk,1)); + enable_publish(pauline2, TRUE); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline2->lc,&pauline2->stat.number_of_LinphonePublishOk,1)); + + linphone_friend_enable_subscribes(f, TRUE); + linphone_friend_set_inc_subscribe_policy(f,LinphoneSPAccept); /* Accept incoming subscription request for this friend*/ + linphone_core_add_friend(marie->lc, f); + + linphone_core_set_presence_model(pauline->lc, pauline_presence); + linphone_presence_model_unref(pauline_presence); + linphone_core_set_presence_model(pauline2->lc, pauline_presence2); + linphone_presence_model_unref(pauline_presence2); + + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePresenceActivityDinner,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline2->lc,&marie->stat.number_of_LinphonePresenceActivityAway,1)); + nb_act = linphone_presence_model_get_nb_activities(linphone_friend_get_presence_model(f)); + BC_ASSERT_EQUAL(nb_act, 2, int, "%d"); + + for(i = 0; i < nb_act; i++) { + activity = linphone_presence_model_get_nth_activity(linphone_friend_get_presence_model(f),i); + eq = (linphone_presence_activity_get_type(activity) == LinphonePresenceActivityAway || linphone_presence_activity_get_type(activity) == LinphonePresenceActivityDinner); + BC_ASSERT_TRUE(eq); + } + + BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphonePublishOk,2)); + BC_ASSERT_TRUE(wait_for(marie->lc,pauline2->lc,&pauline2->stat.number_of_LinphonePublishOk,2)); + + linphone_friend_unref(f); + linphone_core_manager_destroy(marie); + + linphone_core_manager_stop(pauline); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphonePublishCleared,1,int,"%i"); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphonePublishOk,2,int,"%i"); + linphone_core_manager_destroy(pauline); + linphone_core_manager_stop(pauline2); + BC_ASSERT_EQUAL(pauline2->stat.number_of_LinphonePublishCleared,1,int,"%i"); + BC_ASSERT_EQUAL(pauline2->stat.number_of_LinphonePublishOk,2,int,"%i"); + linphone_core_manager_destroy(pauline2); +} + test_t presence_server_tests[] = { TEST_NO_TAG("Simple", simple), TEST_NO_TAG("Fast activity change", fast_activity_change), @@ -1121,6 +1186,7 @@ test_t presence_server_tests[] = { TEST_ONE_TAG("Long term presence with cross references", long_term_presence_with_crossed_references,"longtern"), TEST_NO_TAG("Subscriber no longer reachable using server",subscriber_no_longer_reachable), TEST_NO_TAG("Subscribe with late publish", subscribe_with_late_publish), + TEST_NO_TAG("Multiple publish aggregation", multiple_publish_aggregation), }; test_suite_t presence_server_test_suite = {"Presence using server", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each, From 6ffb8dbd3152390716284e47cffdf9599302c7ce Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Tue, 23 May 2017 09:58:11 +0200 Subject: [PATCH 10/19] allow different transports to a test --- tester/presence_server_tester.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tester/presence_server_tester.c b/tester/presence_server_tester.c index d344204d4..bc901d797 100644 --- a/tester/presence_server_tester.c +++ b/tester/presence_server_tester.c @@ -1103,10 +1103,8 @@ static void long_term_presence_with_crossed_references(void) { static void multiple_publish_aggregation(void) { LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc"); - //LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); - //LinphoneCoreManager* pauline2 = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); - LinphoneCoreManager* pauline = linphone_core_manager_new("pauline_tcp_rc"); - LinphoneCoreManager* pauline2 = linphone_core_manager_new("pauline_tcp_rc"); + LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); + LinphoneCoreManager* pauline2 = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); LinphonePresenceModel *pauline_presence = linphone_presence_model_new_with_activity(LinphonePresenceActivityDinner, NULL); LinphonePresenceModel *pauline_presence2 = linphone_presence_model_new_with_activity(LinphonePresenceActivityAway, NULL); LinphoneFriend* f = linphone_core_create_friend_with_address(marie->lc, get_identity(pauline)); From 146ad28960f3bfae159dad5893c1ba6554b47846 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 16 May 2017 11:20:17 +0200 Subject: [PATCH 11/19] make default rls uri fully dynamic --- coreapi/friendlist.c | 14 +++++++++++++- coreapi/linphonecore.c | 3 --- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/coreapi/friendlist.c b/coreapi/friendlist.c index 8417541fc..9c4bc9eeb 100644 --- a/coreapi/friendlist.c +++ b/coreapi/friendlist.c @@ -459,8 +459,20 @@ const LinphoneAddress * linphone_friend_list_get_rls_address(const LinphoneFrien const LinphoneAddress * _linphone_friend_list_get_rls_address(const LinphoneFriendList *list) { if (list->rls_addr) return list->rls_addr; - else if (list->lc) + else if (list->lc) { + const char* rls_uri = lp_config_get_string(list->lc->config, "sip", "rls_uri", NULL); + if (list->lc->default_rls_addr) + linphone_address_unref(list->lc->default_rls_addr); + + list->lc->default_rls_addr=NULL; + + if (rls_uri) { + /*to make sure changes in config are used if any*/ + list->lc->default_rls_addr = linphone_address_new(rls_uri); + } + return list->lc->default_rls_addr; + } else return NULL; } diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 7f20bb081..126c9b0b1 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1353,9 +1353,6 @@ static void sip_config_read(LinphoneCore *lc) { linphone_core_set_sip_transport_timeout(lc, lp_config_get_int(lc->config, "sip", "transport_timeout", 63000)); sal_set_supported_tags(lc->sal,lp_config_get_string(lc->config,"sip","supported","replaces, outbound")); lc->sip_conf.save_auth_info = lp_config_get_int(lc->config, "sip", "save_auth_info", 1); - if (lp_config_get_string(lc->config, "sip", "rls_uri", NULL)) - lc->default_rls_addr = linphone_address_new(lp_config_get_string(lc->config, "sip", "rls_uri", NULL)); - linphone_core_create_im_notif_policy(lc); } From 6ded32bfffbbf8863f0a638c3394d34ea7c39eac Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 23 May 2017 09:54:51 +0200 Subject: [PATCH 12/19] fix nat policy check for incoming calls --- coreapi/linphonecall.c | 1 + 1 file changed, 1 insertion(+) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index e8aee4deb..5170f3c80 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1580,6 +1580,7 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro } } + nat_policy=call->nat_policy; if ((nat_policy != NULL) && linphone_nat_policy_ice_enabled(nat_policy)) { /* Create the ice session now if ICE is required */ if (md){ From 3a850c1a0323bb49101571b3b278b5e62b5a5552 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 23 May 2017 12:24:43 +0200 Subject: [PATCH 13/19] Don't select telephone-event for audio stream even if it appears first in the list. --- coreapi/linphonecall.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 5170f3c80..eeefc8577 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -3081,9 +3081,15 @@ static RtpProfile *make_profile(LinphoneCall *call, const SalMediaDescription *m up_ptime=params->up_ptime; else up_ptime=linphone_core_get_upload_ptime(lc); } - *used_pt=payload_type_get_number(pt); first=FALSE; } + if (*used_pt == -1){ + /*don't select telephone-event as a payload type*/ + if (strcasecmp(pt->mime_type, "telephone-event") != 0){ + *used_pt = payload_type_get_number(pt); + } + } + if (pt->flags & PAYLOAD_TYPE_BITRATE_OVERRIDE){ ms_message("Payload type [%s/%i] has explicit bitrate [%i] kbit/s", pt->mime_type, pt->clock_rate, pt->normal_bitrate/1000); pt->normal_bitrate=get_min_bandwidth(pt->normal_bitrate,bw*1000); From 82f227554907a3dd42056ec1e762610c5da9dd38 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 23 May 2017 12:40:35 +0200 Subject: [PATCH 14/19] make sure publish listeners do no try to access proxies during deletions --- coreapi/linphonecore.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 126c9b0b1..395097823 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -5819,7 +5819,9 @@ void sip_config_uninit(LinphoneCore *lc) } if (i>=20) ms_warning("Cannot complete unregistration, giving up"); } - config->proxies=bctbx_list_free_with_data(config->proxies,(void (*)(void*)) _linphone_proxy_config_release); + elem = config->proxies; + config->proxies=NULL; /*to make sure proxies cannot be refferenced during deletion*/ + bctbx_list_free_with_data(elem,(void (*)(void*)) _linphone_proxy_config_release); config->deleted_proxies=bctbx_list_free_with_data(config->deleted_proxies,(void (*)(void*)) _linphone_proxy_config_release); From ef9a19def1bb0ac28af4f1963a248959e46dee97 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Wed, 24 May 2017 12:08:41 +0200 Subject: [PATCH 15/19] small fix to avoid cfg->long_term_event double unref --- coreapi/proxy.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/coreapi/proxy.c b/coreapi/proxy.c index fc8519429..f6300e0ef 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -417,8 +417,11 @@ void linphone_proxy_config_stop_refreshing(LinphoneProxyConfig * cfg){ } if (cfg->long_term_event){ /*might probably do better*/ linphone_event_terminate(cfg->long_term_event); - linphone_event_unref(cfg->long_term_event); - cfg->long_term_event=NULL; + if (cfg->long_term_event) { + linphone_event_unref(cfg->long_term_event); /*probably useless as cfg->long_term_event is already unref in linphone_proxy_config_notify_publish_state_changed. To be check with Ghislain*/ + cfg->long_term_event=NULL; + } + } if (cfg->op){ sal_op_release(cfg->op); From 87ca1adf5ef967bb3876ea0c060cb9135f36718d Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 24 May 2017 14:03:27 +0200 Subject: [PATCH 16/19] add getWarnings() wrapper --- coreapi/linphonecore_jni.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index ebc5a5d26..6c79fe09e 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -7449,6 +7449,16 @@ JNIEXPORT jstring JNICALL Java_org_linphone_core_ErrorInfoImpl_getDetails(JNIEnv return tmp ? env->NewStringUTF(tmp) : NULL; } +/* + * Class: org_linphone_core_ErrorInfoImpl + * Method: getDetails + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_org_linphone_core_ErrorInfoImpl_getWarnings(JNIEnv *env, jobject jobj, jlong ei){ + const char *tmp=linphone_error_info_get_warnings((const LinphoneErrorInfo*)ei); + return tmp ? env->NewStringUTF(tmp) : NULL; +} + /* * Class: org_linphone_core_ErrorInfoImpl * Method: ref From 609888e8127d77fdef45f95434d0f976af7f1828 Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Fri, 26 May 2017 15:32:31 +0200 Subject: [PATCH 17/19] Add log on account_creator request --- coreapi/account_creator.c | 81 ++++++++++++++++++++++++++++++++++----- 1 file changed, 72 insertions(+), 9 deletions(-) diff --git a/coreapi/account_creator.c b/coreapi/account_creator.c index 36b3bc765..bfaac8af2 100644 --- a/coreapi/account_creator.c +++ b/coreapi/account_creator.c @@ -676,6 +676,10 @@ LinphoneAccountCreatorStatus linphone_account_creator_is_account_exist_linphone( return LinphoneAccountCreatorStatusMissingArguments; } + ms_debug("Account creator: is_account_exist (%s=%s, domain=%s)", + (creator->username) ? "username" : "phone number", + (creator->username) ? creator->username : creator->phone_number, + linphone_proxy_config_get_domain(creator->proxy_cfg)); request = linphone_xml_rpc_request_new_with_args(LinphoneXmlRpcArgString, "get_phone_number_for_account", LinphoneXmlRpcArgString, creator->username ? creator->username : creator->phone_number, LinphoneXmlRpcArgString, linphone_proxy_config_get_domain(creator->proxy_cfg), @@ -712,6 +716,12 @@ static LinphoneXmlRpcRequest * _create_account_with_phone_custom(LinphoneAccount if (!creator->phone_number) { return NULL; } + ms_debug("Account creator: create_account_with_phone (phone number=%s, username=%s, domain=%s, language=%s)", + creator->phone_number, + (creator->username) ? creator->username : creator->phone_number, + linphone_proxy_config_get_domain(creator->proxy_cfg), + creator->language); + request = linphone_xml_rpc_request_new_with_args(LinphoneXmlRpcArgString, "create_phone_account", LinphoneXmlRpcArgString, creator->phone_number, LinphoneXmlRpcArgString, creator->username ? creator->username : creator->phone_number, @@ -728,6 +738,11 @@ static LinphoneXmlRpcRequest * _create_account_with_email_custom(LinphoneAccount if (!creator->username || !creator->email || !creator->password) { return NULL; } + ms_debug("Account creator: create_account_with_email (username=%s, email=%s, domain=%s)", + creator->username, + creator->email, + linphone_proxy_config_get_domain(creator->proxy_cfg)); + request = linphone_xml_rpc_request_new_with_args(LinphoneXmlRpcArgString, "create_email_account", LinphoneXmlRpcArgString, creator->username, LinphoneXmlRpcArgString, creator->email, @@ -787,13 +802,18 @@ LinphoneAccountCreatorStatus linphone_account_creator_activate_account_linphone( } return LinphoneAccountCreatorStatusMissingArguments; } + ms_debug("Account creator: activate_account_phone (phone number=%s, username=%s, activation code=%s, domain=%s)", + creator->phone_number, + creator->username ? creator->username : creator->phone_number, + creator->activation_code, + linphone_proxy_config_get_domain(creator->proxy_cfg)); request = linphone_xml_rpc_request_new_with_args(LinphoneXmlRpcArgString, "activate_phone_account", - LinphoneXmlRpcArgString, creator->phone_number, - LinphoneXmlRpcArgString, creator->username ? creator->username : creator->phone_number, - LinphoneXmlRpcArgString, creator->activation_code, - linphone_proxy_config_get_domain(creator->proxy_cfg), - LinphoneXmlRpcArgNone); + LinphoneXmlRpcArgString, creator->phone_number, + LinphoneXmlRpcArgString, creator->username ? creator->username : creator->phone_number, + LinphoneXmlRpcArgString, creator->activation_code, + linphone_proxy_config_get_domain(creator->proxy_cfg), + LinphoneXmlRpcArgNone); linphone_xml_rpc_request_set_user_data(request, creator); linphone_xml_rpc_request_cbs_set_response(linphone_xml_rpc_request_get_callbacks(request), _activate_account_cb_custom); @@ -811,11 +831,16 @@ LinphoneAccountCreatorStatus linphone_account_creator_activate_email_account_lin return LinphoneAccountCreatorStatusMissingArguments; } + ms_debug("Account creator: activate_account_email (username=%s, activation code=%s, domain=%s)", + creator->username, + creator->activation_code, + linphone_proxy_config_get_domain(creator->proxy_cfg)); + request = linphone_xml_rpc_request_new_with_args(LinphoneXmlRpcArgString, "activate_email_account", - LinphoneXmlRpcArgString, creator->username, - LinphoneXmlRpcArgString, creator->activation_code, - linphone_proxy_config_get_domain(creator->proxy_cfg), - LinphoneXmlRpcArgNone); + LinphoneXmlRpcArgString, creator->username, + LinphoneXmlRpcArgString, creator->activation_code, + linphone_proxy_config_get_domain(creator->proxy_cfg), + LinphoneXmlRpcArgNone); linphone_xml_rpc_request_set_user_data(request, creator); linphone_xml_rpc_request_cbs_set_response(linphone_xml_rpc_request_get_callbacks(request), _activate_account_cb_custom); @@ -847,6 +872,10 @@ LinphoneAccountCreatorStatus linphone_account_creator_is_account_activated_linph } return LinphoneAccountCreatorStatusMissingArguments; } + ms_debug("Account creator: is_account_activated (username=%s, domain=%s)", + creator->username ? creator->username : creator->phone_number, + linphone_proxy_config_get_domain(creator->proxy_cfg)); + request = linphone_xml_rpc_request_new_with_args(LinphoneXmlRpcArgString, "is_account_activated", LinphoneXmlRpcArgString, creator->username ? creator->username : creator->phone_number, LinphoneXmlRpcArgString, linphone_proxy_config_get_domain(creator->proxy_cfg), @@ -885,6 +914,11 @@ LinphoneAccountCreatorStatus linphone_account_creator_is_phone_number_used_linph } return LinphoneAccountCreatorStatusMissingArguments; } + + ms_debug("Account creator: is_phone_number_used (phone number=%s, domain=%s)", + creator->phone_number, + linphone_proxy_config_get_domain(creator->proxy_cfg)); + request = linphone_xml_rpc_request_new_with_args(LinphoneXmlRpcArgString, "is_phone_number_used", LinphoneXmlRpcArgString, creator->phone_number, LinphoneXmlRpcArgString, linphone_proxy_config_get_domain(creator->proxy_cfg), @@ -920,6 +954,13 @@ LinphoneAccountCreatorStatus linphone_account_creator_link_phone_number_with_acc } return LinphoneAccountCreatorStatusMissingArguments; } + + ms_debug("Account creator: link_phone_number_with_account (phone number=%s, username=%s, domain=%s, language=%s)", + creator->phone_number, + creator->username, + linphone_proxy_config_get_domain(creator->proxy_cfg), + creator->language); + request = linphone_xml_rpc_request_new_with_args(LinphoneXmlRpcArgString, "link_phone_number_with_account", LinphoneXmlRpcArgString, creator->phone_number, LinphoneXmlRpcArgString, creator->username, @@ -952,6 +993,11 @@ LinphoneAccountCreatorStatus linphone_account_creator_is_account_linked_linphone if (!creator->username || !linphone_proxy_config_get_domain(creator->proxy_cfg)) { return LinphoneAccountCreatorStatusMissingArguments; } + + ms_debug("Account creator: is_account_linked (username=%s, domain=%s)", + creator->username, + linphone_proxy_config_get_domain(creator->proxy_cfg)); + request = linphone_xml_rpc_request_new_with_args(LinphoneXmlRpcArgString, "get_phone_number_for_account", LinphoneXmlRpcArgString, creator->username, LinphoneXmlRpcArgString, linphone_proxy_config_get_domain(creator->proxy_cfg), @@ -985,6 +1031,13 @@ LinphoneAccountCreatorStatus linphone_account_creator_activate_phone_number_link } return LinphoneAccountCreatorStatusMissingArguments; } + + ms_debug("Account creator: activate_phone_number_link (phone number=%s, username=%s, activation code=%s, domain=%s)", + creator->phone_number, + creator->username, + creator->acactivation_code, + linphone_proxy_config_get_domain(creator->proxy_cfg)); + request = linphone_xml_rpc_request_new_with_args(LinphoneXmlRpcArgString, "activate_phone_number_link", LinphoneXmlRpcArgString, creator->phone_number, LinphoneXmlRpcArgString, creator->username, @@ -1028,6 +1081,12 @@ LinphoneAccountCreatorStatus linphone_account_creator_recover_phone_account_linp } return LinphoneAccountCreatorStatusMissingArguments; } + + ms_debug("Account creator: recover_phone_account (phone number=%s, domain=%s, language=%s)", + creator->phone_number, + linphone_proxy_config_get_domain(creator->proxy_cfg), + creator->language); + request = linphone_xml_rpc_request_new_with_args(LinphoneXmlRpcArgString, "recover_phone_account", LinphoneXmlRpcArgString, creator->phone_number, LinphoneXmlRpcArgString, linphone_proxy_config_get_domain(creator->proxy_cfg), @@ -1080,6 +1139,10 @@ LinphoneAccountCreatorStatus linphone_account_creator_update_password_linphone(L const char * ha1 = ms_strdup(creator->ha1 ? creator->ha1 : ha1_for_passwd(username, linphone_proxy_config_get_domain(creator->proxy_cfg), creator->password) ); const char * new_ha1 = ms_strdup(ha1_for_passwd(username, linphone_proxy_config_get_domain(creator->proxy_cfg), new_pwd)); + ms_debug("Account creator: update_password (username=%s, domain=%s)", + creator->username, + linphone_proxy_config_get_domain(creator->proxy_cfg)); + request = linphone_xml_rpc_request_new_with_args(LinphoneXmlRpcArgString, "update_hash", LinphoneXmlRpcArgString, username, LinphoneXmlRpcArgString, ha1, From 07c37fdbc96422f4f8e6db6227377ebe6e8edb41 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 26 May 2017 15:35:08 +0200 Subject: [PATCH 18/19] Add missing symbol export. --- coreapi/private.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/private.h b/coreapi/private.h index a5ab60f19..1bd94ac8e 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -1783,7 +1783,7 @@ struct _LinphoneVideoActivationPolicy { BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneVideoActivationPolicy); -LinphoneVideoActivationPolicy *linphone_video_activation_policy_new(void); +LINPHONE_PUBLIC LinphoneVideoActivationPolicy *linphone_video_activation_policy_new(void); /** * The LinphoneCallStats objects carries various statistic informations regarding quality of audio or video streams. From 57792f40144982a181961dc98f727c09968c69c4 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Mon, 29 May 2017 11:12:45 +0200 Subject: [PATCH 19/19] Added JNI methods for getting sent/received FPS in call params --- coreapi/linphonecore_jni.cc | 10 ++++++++++ .../common/org/linphone/core/LinphoneCallParams.java | 12 ++++++++++++ .../org/linphone/core/LinphoneCallParamsImpl.java | 12 ++++++++++++ 3 files changed, 34 insertions(+) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 6c79fe09e..dda287d9a 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -5101,6 +5101,16 @@ extern "C" jintArray Java_org_linphone_core_LinphoneCallParamsImpl_getReceivedVi return arr; } +extern "C" jfloat Java_org_linphone_core_LinphoneCallParamsImpl_getSentFramerate(JNIEnv *env, jobject thiz, jlong lcp) { + const LinphoneCallParams *params = (LinphoneCallParams *) lcp; + return (jfloat)linphone_call_params_get_sent_framerate(params); +} + +extern "C" jfloat Java_org_linphone_core_LinphoneCallParamsImpl_getReceivedFramerate(JNIEnv *env, jobject thiz, jlong lcp) { + const LinphoneCallParams *params = (LinphoneCallParams *) lcp; + return (jfloat)linphone_call_params_get_received_framerate(params); +} + JNIEXPORT jint JNICALL Java_org_linphone_core_LinphoneCallParamsImpl_getAudioDirection(JNIEnv *env, jobject thiz, jlong ptr) { return (jint)linphone_call_params_get_audio_direction((LinphoneCallParams *)ptr); } diff --git a/java/common/org/linphone/core/LinphoneCallParams.java b/java/common/org/linphone/core/LinphoneCallParams.java index 2f2220053..d8ec6607c 100644 --- a/java/common/org/linphone/core/LinphoneCallParams.java +++ b/java/common/org/linphone/core/LinphoneCallParams.java @@ -236,4 +236,16 @@ public interface LinphoneCallParams { * @param dir The video stream direction associated with this call params. **/ void setVideoDirection(MediaDirection dir); + + /** + * Gets the FPS sent in a video call. + * @return the fps + */ + float getSentFramerate(); + + /** + * Gets the FPS received in a video call. + * @return the fps + */ + float getReceivedFramerate(); } diff --git a/java/impl/org/linphone/core/LinphoneCallParamsImpl.java b/java/impl/org/linphone/core/LinphoneCallParamsImpl.java index 3fc57257f..affe01203 100644 --- a/java/impl/org/linphone/core/LinphoneCallParamsImpl.java +++ b/java/impl/org/linphone/core/LinphoneCallParamsImpl.java @@ -245,4 +245,16 @@ public class LinphoneCallParamsImpl implements LinphoneCallParams { public void setVideoDirection(MediaDirection direction) { setVideoDirection(nativePtr, direction.mValue); } + + private native float getSentFramerate(long nativePtr); + @Override + public float getSentFramerate() { + return getSentFramerate(nativePtr); + } + + private native float getReceivedFramerate(long nativePtr); + @Override + public float getReceivedFramerate() { + return getReceivedFramerate(nativePtr); + } }