diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index dd49a4c9e..7a702ca45 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -3743,7 +3743,7 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call, SalOp *replaced; SalMediaDescription *new_md; bool_t was_ringing=FALSE; - MSList * iterator; + MSList * iterator, *copy; if (call==NULL){ //if just one call is present answer the only one ... @@ -3765,26 +3765,24 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call, } - for (iterator=ms_list_copy(linphone_core_get_calls(lc));iterator!=NULL;iterator=iterator->next) { + for (iterator=copy=ms_list_copy(linphone_core_get_calls(lc));iterator!=NULL;iterator=iterator->next) { LinphoneCall *a_call=(LinphoneCall*)iterator->data; if (a_call==call) continue; switch(a_call->state){ - case LinphoneCallOutgoingInit: - case LinphoneCallOutgoingProgress: - case LinphoneCallOutgoingRinging: - case LinphoneCallOutgoingEarlyMedia: - - ms_message("Already existing call [%p] in state [%s], canceling it before accepting new call [%p]" ,a_call - ,linphone_call_state_to_string(a_call->state) - ,call); + case LinphoneCallOutgoingInit: + case LinphoneCallOutgoingProgress: + case LinphoneCallOutgoingRinging: + case LinphoneCallOutgoingEarlyMedia: + ms_message("Already existing call [%p] in state [%s], canceling it before accepting new call [%p]",a_call + ,linphone_call_state_to_string(a_call->state) + ,call); linphone_core_terminate_call(lc,a_call); break; default: break; /*nothing to do*/ } - } - if (iterator) ms_list_free(iterator); + ms_list_free(copy); /* check if this call is supposed to replace an already running one*/ replaced=sal_call_get_replaces(call->op); @@ -4191,7 +4189,7 @@ LinphoneCall *linphone_core_get_call_by_remote_address(LinphoneCore *lc, const c } return call; } -LinphoneCall *linphone_core_get_call_by_remote_address2(LinphoneCore *lc, LinphoneAddress *raddr){ +LinphoneCall *linphone_core_get_call_by_remote_address2(LinphoneCore *lc, const LinphoneAddress *raddr){ MSList *elem=ms_list_find_custom(lc->calls,(int (*)(const void*,const void *))remote_address_compare,raddr); if (elem) return (LinphoneCall*) elem->data; diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 53f8cbcfb..cec387e66 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -2247,7 +2247,7 @@ LINPHONE_PUBLIC LinphoneCall *linphone_core_get_call_by_remote_address(LinphoneC * * @ingroup call_control */ -LINPHONE_PUBLIC LinphoneCall *linphone_core_get_call_by_remote_address2(LinphoneCore *lc, LinphoneAddress *remote_address); +LINPHONE_PUBLIC LinphoneCall *linphone_core_get_call_by_remote_address2(LinphoneCore *lc, const LinphoneAddress *remote_address); /** diff --git a/coreapi/private.h b/coreapi/private.h index 40fd9b2e4..f79875697 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -389,7 +389,7 @@ void linphone_core_update_allocated_audio_bandwidth_in_call(LinphoneCall *call, LINPHONE_PUBLIC int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call); void linphone_core_resolve_stun_server(LinphoneCore *lc); -const struct addrinfo *linphone_core_get_stun_server_addrinfo(LinphoneCore *lc); +LINPHONE_PUBLIC const struct addrinfo *linphone_core_get_stun_server_addrinfo(LinphoneCore *lc); void linphone_core_adapt_to_network(LinphoneCore *lc, int ping_time_ms, LinphoneCallParams *params); int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call); void linphone_core_update_ice_state_in_call_stats(LinphoneCall *call); diff --git a/coreapi/sal.c b/coreapi/sal.c index 2d6ed1dde..c9f3facf7 100644 --- a/coreapi/sal.c +++ b/coreapi/sal.c @@ -153,7 +153,6 @@ int sal_media_description_get_nb_active_streams(const SalMediaDescription *md) { return nb; } - static bool_t is_null_address(const char *addr){ return strcmp(addr,"0.0.0.0")==0 || strcmp(addr,"::0")==0; } diff --git a/tester/flexisip_tester.c b/tester/flexisip_tester.c index 84f0d04c1..3df7a5a43 100644 --- a/tester/flexisip_tester.c +++ b/tester/flexisip_tester.c @@ -370,22 +370,29 @@ static void call_forking_declined_localy(void){ static void call_forking_with_push_notification_single(void){ MSList* lcs; - LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); - LinphoneCoreManager* pauline = linphone_core_manager_new( transport_supported(marie->lc, LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); + LinphoneCoreManager* marie = linphone_core_manager_new2( "marie_rc", FALSE); + LinphoneCoreManager* pauline = linphone_core_manager_new2( transport_supported(marie->lc, LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc",FALSE); + int dummy=0; linphone_core_set_user_agent(marie->lc,"Natted Linphone",NULL); linphone_core_set_user_agent(pauline->lc,"Natted Linphone",NULL); + linphone_proxy_config_set_contact_uri_parameters( + linphone_core_get_default_proxy_config(marie->lc), + "app-id=org.linphonetester;pn-tok=aaabbb;pn-type=apple;pn-msg-str=33;pn-call-str=34;"); lcs=ms_list_append(NULL,pauline->lc); - lcs=ms_list_append(lcs,marie->lc); + + BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneRegistrationOk,1,5000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneRegistrationOk,1,5000)); /*unfortunately marie gets unreachable due to crappy 3G operator or iOS bug...*/ linphone_core_set_network_reachable(marie->lc,FALSE); linphone_core_invite_address(pauline->lc,marie->identity); - /*the server is expected to send a push notification to marie, this will wake up linphone, that will reconnect:*/ + /*After 5 seconds the server is expected to send a push notification to marie, this will wake up linphone, that will reconnect:*/ + wait_for_list(lcs,&dummy,1,6000); linphone_core_set_network_reachable(marie->lc,TRUE); /*Marie shall receive the call immediately*/ diff --git a/tester/multi_call_tester.c b/tester/multi_call_tester.c index ac7dfdd38..a1ca03ec3 100644 --- a/tester/multi_call_tester.c +++ b/tester/multi_call_tester.c @@ -271,7 +271,7 @@ static void simple_encrypted_conference_with_ice(LinphoneMediaEncryption mode) { /*work around a to avoid stun resolution to be initiate in call_received callback leading a mainloop reentrency*/ /* - belle_sip_main_loop_iterate() at belle_sip_loop.c:369 + belle_sip_main_loop_iterate() at belle_sip_loop.c:369 belle_sip_main_loop_run [inlined]() at belle_sip_loop.c:478 belle_sip_main_loop_sleep() at belle_sip_loop.c:490 sal_iterate() at sal_impl.c:745 @@ -283,7 +283,11 @@ static void simple_encrypted_conference_with_ice(LinphoneMediaEncryption mode) { ... linphone_core_iterate() at linphonecore.c:2 620 ... - */ + + linphone_core_set_stun_server() initiates an asynchronous resolution, but it needs a few iteration before it is completed. + By calling private function linphone_core_get_stun_server_addrinfo() we make sure to wait that the resolution is done before the + test calls actually start. + */ linphone_core_get_stun_server_addrinfo(marie->lc); linphone_core_get_stun_server_addrinfo(pauline->lc); linphone_core_get_stun_server_addrinfo(laure->lc);