From 7af7898ddd1c133a934667bdf9f209e80ef17c96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grisez?= Date: Tue, 19 Jan 2016 10:55:55 +0100 Subject: [PATCH 1/3] Fixes 'make install' with autotools --- coreapi/Makefile.am | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/coreapi/Makefile.am b/coreapi/Makefile.am index 353071c07..27100c6f5 100644 --- a/coreapi/Makefile.am +++ b/coreapi/Makefile.am @@ -43,8 +43,7 @@ linphone_include_HEADERS=\ lpconfig.h \ sipsetup.h \ xml2lpc.h \ - xmlrpc.h \ - conference.h + xmlrpc.h lib_LTLIBRARIES=liblinphone.la From 0d5ffa5086e64f8493c491adf7f49d479fca7ae6 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 19 Jan 2016 12:21:30 +0100 Subject: [PATCH 2/3] No longer change remote destination when ice completed because already done in ms2 ice module --- coreapi/linphonecall.c | 35 ++++------------------------------- mediastreamer2 | 2 +- tester/presence_tester.c | 35 +++++++++++++++++++++++++++++++++-- tester/setup_tester.c | 38 +++++++++++++++++++++++++++++++++++++- 4 files changed, 75 insertions(+), 35 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index c5159ba5f..3b734ef3f 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -4226,25 +4226,6 @@ static void linphone_call_lost(LinphoneCall *call, LinphoneReason reason){ ms_free(temp); } -static void change_ice_media_destinations(LinphoneCall *call) { - const char *rtp_addr; - const char *rtcp_addr; - int rtp_port; - int rtcp_port; - bool_t result; - int i; - IceCheckList *cl; - - for (i = 0; i < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; ++i){ - if ((cl = ice_session_check_list(call->ice_session, i)) != NULL){ - result = ice_check_list_selected_valid_remote_candidate(cl, &rtp_addr, &rtp_port, &rtcp_addr, &rtcp_port); - if (result == TRUE) { - ms_message("Change stream index %i destination: RTP=%s:%d RTCP=%s:%d", i, rtp_addr, rtp_port, rtcp_addr, rtcp_port); - rtp_session_set_remote_addr_full(call->sessions[i].rtp_session, rtp_addr, rtp_port, rtcp_addr, rtcp_port); - } - } - } -} static void linphone_call_on_ice_gathering_finished(LinphoneCall *call){ int ping_time; @@ -4281,28 +4262,20 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ switch (ice_session_state(call->ice_session)) { case IS_Completed: - ice_session_select_candidates(call->ice_session); - if (ice_session_role(call->ice_session) == IR_Controlling - && params->update_call_when_ice_completed) { - params->internal_call_update = TRUE; - linphone_core_update_call(call->core, call, params); - } - change_ice_media_destinations(call); - start_dtls_on_all_streams(call); - break; case IS_Failed: + /* At least one ICE session has succeeded, so perform a call update. */ if (ice_session_has_completed_check_list(call->ice_session) == TRUE) { - ice_session_select_candidates(call->ice_session); - if (ice_session_role(call->ice_session) == IR_Controlling) { - /* At least one ICE session has succeeded, so perform a call update. */ + if (ice_session_role(call->ice_session) == IR_Controlling && params->update_call_when_ice_completed ) { params->internal_call_update = TRUE; linphone_core_update_call(call->core, call, params); } + start_dtls_on_all_streams(call); } break; default: break; } + linphone_core_update_ice_state_in_call_stats(call); linphone_call_params_unref(params); } else if (evt == ORTP_EVENT_ICE_GATHERING_FINISHED) { diff --git a/mediastreamer2 b/mediastreamer2 index 832cf4174..d948afeba 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 832cf41745c6d28f8c62f694a792619be7c88783 +Subproject commit d948afeba99b3203d5dfeb967a9b7950d3be91f8 diff --git a/tester/presence_tester.c b/tester/presence_tester.c index f0fa5ed14..9abda838c 100644 --- a/tester/presence_tester.c +++ b/tester/presence_tester.c @@ -129,7 +129,7 @@ static void simple_publish_with_expire(int expires) { LinphoneProxyConfig* proxy; LinphonePresenceModel* presence; - linphone_core_get_default_proxy(marie->lc,&proxy); + proxy = linphone_core_get_default_proxy_config(marie->lc); linphone_proxy_config_edit(proxy); if (expires >0) { linphone_proxy_config_set_publish_expires(proxy,expires); @@ -743,6 +743,36 @@ static void test_presence_list_subscribe_before_publish(void) { linphone_core_manager_destroy(pauline); } +static void test_presence_list_subscription_expire(void) { + LinphoneCoreManager *laure = linphone_core_manager_new("laure_tcp_rc"); + const char *rls_uri = "sip:rls@sip.example.org"; + LinphoneFriendList *lfl; + LinphoneFriend *lf; + lp_config_set_int(laure->lc->config, "sip", "rls_presence_expires", 3); + + lfl = linphone_core_create_friend_list(laure->lc); + linphone_friend_list_set_rls_uri(lfl, rls_uri); + lf = linphone_core_create_friend_with_address(laure->lc, "sip:michelle@sip.inexistentdomain.com"); + linphone_friend_list_add_friend(lfl, lf); + linphone_core_set_friend_list(laure->lc, lfl); + linphone_friend_list_update_subscriptions(lfl,NULL,FALSE); + + linphone_friend_list_unref(lfl); + + /* wait for refresh*/ + BC_ASSERT_FALSE(wait_for_until(laure->lc, NULL, &laure->stat.number_of_NotifyPresenceReceived, 1, 4000)); + + /*sal_set_send_error(laure->lc->sal,1500);*/ /*make sure no refresh is sent, trash the message without generating error*/ + + /*make sure we don't received any notify, even when subscribtion has expired*/ + /*BC_ASSERT_FALSE(wait_for_until(laure->lc, NULL, &laure->stat.number_of_NotifyPresenceReceived, 1, 5000)); + + sal_set_send_error(laure->lc->sal,0);*/ + + linphone_core_manager_destroy(laure); +} + + test_t presence_tests[] = { { "Simple Subscribe", simple_subscribe }, { "Simple Publish", simple_publish }, @@ -758,7 +788,8 @@ test_t presence_tests[] = { { "Forked subscribe with late publish", test_forked_subscribe_notify_publish }, #endif { "Presence list", test_presence_list }, - { "Presence list (subscribe before publish)", test_presence_list_subscribe_before_publish } + { "Presence list (subscribe before publish)", test_presence_list_subscribe_before_publish }, + { "Presence list, subscription expiration",test_presence_list_subscription_expire} }; test_suite_t presence_test_suite = {"Presence", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each, diff --git a/tester/setup_tester.c b/tester/setup_tester.c index 8aa744666..f41324d3f 100644 --- a/tester/setup_tester.c +++ b/tester/setup_tester.c @@ -79,10 +79,19 @@ static void linphone_interpret_url_test(void) LinphoneCore* lc; const char* sips_address = "sips:margaux@sip.linphone.org"; LinphoneAddress* address; - + LinphoneProxyConfig *proxy_config; + char *tmp; memset ( &v_table,0,sizeof ( v_table ) ); lc = linphone_core_new ( &v_table,NULL,NULL,NULL ); BC_ASSERT_PTR_NOT_NULL_FATAL ( lc ); + + proxy_config =linphone_core_create_proxy_config(lc); + linphone_proxy_config_set_identity(proxy_config, "sip:moi@sip.linphone.org"); + linphone_proxy_config_enable_register(proxy_config, FALSE); + linphone_proxy_config_set_server_addr(proxy_config,"sip:sip.linphone.org"); + linphone_core_add_proxy_config(lc, proxy_config); + linphone_core_set_default_proxy_config(lc,proxy_config); + address = linphone_core_interpret_url(lc, sips_address); @@ -93,6 +102,33 @@ static void linphone_interpret_url_test(void) linphone_address_destroy(address); + address = linphone_core_interpret_url(lc,"23"); + + BC_ASSERT_PTR_NOT_NULL(address); + BC_ASSERT_STRING_EQUAL(linphone_address_get_scheme(address), "sip"); + BC_ASSERT_STRING_EQUAL(linphone_address_get_username(address), "23"); + BC_ASSERT_STRING_EQUAL(linphone_address_get_domain(address), "sip.linphone.org"); + linphone_address_destroy(address); + + address = linphone_core_interpret_url(lc,"#24"); + + BC_ASSERT_PTR_NOT_NULL(address); + BC_ASSERT_STRING_EQUAL(linphone_address_get_scheme(address), "sip"); + BC_ASSERT_STRING_EQUAL(linphone_address_get_username(address), "#24"); + BC_ASSERT_STRING_EQUAL(linphone_address_get_domain(address), "sip.linphone.org"); + tmp = linphone_address_as_string(address); + BC_ASSERT_TRUE(strcmp (tmp,"sip:%2324@sip.linphone.org") == 0); + linphone_address_destroy(address); + + address = linphone_core_interpret_url(lc,tmp); + BC_ASSERT_STRING_EQUAL(linphone_address_get_scheme(address), "sip"); + BC_ASSERT_STRING_EQUAL(linphone_address_get_username(address), "#24"); + BC_ASSERT_STRING_EQUAL(linphone_address_get_domain(address), "sip.linphone.org"); + + linphone_address_destroy(address); + ms_free(tmp); + + linphone_core_destroy ( lc ); } From 2e42434290bda29bd376ef78035a98ae40cfaae0 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 19 Jan 2016 12:41:06 +0100 Subject: [PATCH 3/3] prevent crash when call log has invalid URIso --- coreapi/call_log.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/coreapi/call_log.c b/coreapi/call_log.c index a9ecf0149..b82131560 100644 --- a/coreapi/call_log.c +++ b/coreapi/call_log.c @@ -423,6 +423,9 @@ static int create_call_log(void *data, int argc, char **argv, char **colName) { unsigned int storage_id = atoi(argv[0]); from = linphone_address_new(argv[1]); to = linphone_address_new(argv[2]); + + if (from == NULL || to == NULL) goto error; + dir = (LinphoneCallDir) atoi(argv[3]); log = linphone_call_log_new(dir, from, to); @@ -445,7 +448,16 @@ static int create_call_log(void *data, int argc, char **argv, char **colName) { } *list = ms_list_append(*list, log); - + return 0; + +error: + if (from){ + linphone_address_destroy(from); + } + if (to){ + linphone_address_destroy(to); + } + ms_error("Bad call log at storage_id %u", storage_id); return 0; }