diff --git a/tester/call_single_tester.c b/tester/call_single_tester.c index 97cb65a32..6fcc548ff 100644 --- a/tester/call_single_tester.c +++ b/tester/call_single_tester.c @@ -260,6 +260,10 @@ bool_t call_with_params2(LinphoneCoreManager* caller_mgr LinphoneCall *callee_call=NULL; LinphoneCall *caller_call=NULL; + /* TODO: This should be handled correctly inside the liblinphone library but meanwhile handle this here. */ + linphone_core_manager_wait_for_stun_resolution(caller_mgr); + linphone_core_manager_wait_for_stun_resolution(callee_mgr); + setup_sdp_handling(caller_test_params, caller_mgr); setup_sdp_handling(callee_test_params, callee_mgr); diff --git a/tester/liblinphone_tester.h b/tester/liblinphone_tester.h index 898c0ed24..9b759bb78 100644 --- a/tester/liblinphone_tester.h +++ b/tester/liblinphone_tester.h @@ -286,6 +286,7 @@ LinphoneCoreManager* linphone_core_manager_new2(const char* rc_file, int check_f LinphoneCoreManager* linphone_core_manager_new(const char* rc_file); void linphone_core_manager_stop(LinphoneCoreManager *mgr); void linphone_core_manager_uninit(LinphoneCoreManager *mgr); +void linphone_core_manager_wait_for_stun_resolution(LinphoneCoreManager *mgr); void linphone_core_manager_destroy(LinphoneCoreManager* mgr); void reset_counters( stats* counters); diff --git a/tester/tester.c b/tester/tester.c index ad0c9fe69..2a8544bac 100644 --- a/tester/tester.c +++ b/tester/tester.c @@ -354,7 +354,6 @@ void linphone_core_manager_init(LinphoneCoreManager *mgr, const char* rc_file) { void linphone_core_manager_start(LinphoneCoreManager *mgr, int check_for_proxies) { LinphoneProxyConfig* proxy; - LinphoneNatPolicy *nat_policy; int proxy_count; /*BC_ASSERT_EQUAL(bctbx_list_size(linphone_core_get_proxy_config_list(lc)),proxy_count, int, "%d");*/ @@ -386,16 +385,7 @@ void linphone_core_manager_start(LinphoneCoreManager *mgr, int check_for_proxies linphone_address_clean(mgr->identity); } - nat_policy = linphone_core_get_nat_policy(mgr->lc); - if ((nat_policy != NULL) && (linphone_nat_policy_get_stun_server(nat_policy) != NULL) && - (linphone_nat_policy_stun_enabled(nat_policy) || linphone_nat_policy_turn_enabled(nat_policy))) { - /*before we go, ensure that the stun server is resolved, otherwise all ice related test will fail*/ - const char **tags = bc_tester_current_test_tags(); - int ice_test = (tags && ((tags[0] && !strcmp(tags[0], "ICE")) || (tags[1] && !strcmp(tags[1], "ICE")))); - if (ice_test) { - BC_ASSERT_TRUE(wait_for_stun_resolution(mgr)); - } - } + linphone_core_manager_wait_for_stun_resolution(mgr); if (!check_for_proxies){ /*now that stun server resolution is done, we can start registering*/ linphone_core_set_network_reachable(mgr->lc, TRUE); @@ -448,6 +438,16 @@ void linphone_core_manager_uninit(LinphoneCoreManager *mgr) { manager_count--; } +void linphone_core_manager_wait_for_stun_resolution(LinphoneCoreManager *mgr) { + LinphoneNatPolicy *nat_policy = linphone_core_get_nat_policy(mgr->lc); + if ((nat_policy != NULL) && (linphone_nat_policy_get_stun_server(nat_policy) != NULL) && + (linphone_nat_policy_stun_enabled(nat_policy) || linphone_nat_policy_turn_enabled(nat_policy)) && + (linphone_nat_policy_ice_enabled(nat_policy))) { + /*before we go, ensure that the stun server is resolved, otherwise all ice related test will fail*/ + BC_ASSERT_TRUE(wait_for_stun_resolution(mgr)); + } +} + void linphone_core_manager_destroy(LinphoneCoreManager* mgr) { linphone_core_manager_uninit(mgr); ms_free(mgr);