From fd7f6a4c73dffc7b757a943d815713eae9f374b5 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Wed, 5 Aug 2015 14:21:14 +0200 Subject: [PATCH] tester: fix quality reporting with custom route test when using tunnel --- tester/quality_reporting_tester.c | 26 ++++++-------------------- tester/tester.c | 2 +- tester/tunnel_tester.c | 4 ++-- 3 files changed, 9 insertions(+), 23 deletions(-) diff --git a/tester/quality_reporting_tester.c b/tester/quality_reporting_tester.c index 038d823ca..debfb2608 100644 --- a/tester/quality_reporting_tester.c +++ b/tester/quality_reporting_tester.c @@ -339,26 +339,9 @@ static void quality_reporting_session_report_if_video_stopped() { } void publish_report_with_route_state_changed(LinphoneCore *lc, LinphoneEvent *ev, LinphonePublishState state){ - stats* counters = get_stats(lc); - const LinphoneAddress* from_addr = linphone_event_get_from(ev); - char* from = linphone_address_as_string(from_addr); - ms_message("Publish state [%s] from [%s]",linphone_publish_state_to_string(state),from); - ms_free(from); - switch(state){ - case LinphonePublishProgress: - BC_ASSERT_STRING_EQUAL(linphone_address_as_string(linphone_event_get_resource(ev)), linphone_proxy_config_get_quality_reporting_collector(linphone_core_get_default_proxy_config(lc))); - counters->number_of_LinphonePublishProgress++; - break; - case LinphonePublishOk: - counters->number_of_LinphonePublishOk++; - break; - case LinphonePublishError: counters->number_of_LinphonePublishError++; break; - case LinphonePublishExpiring: counters->number_of_LinphonePublishExpiring++; break; - case LinphonePublishCleared: counters->number_of_LinphonePublishCleared++;break; - default: - break; + if (state == LinphonePublishProgress) { + BC_ASSERT_STRING_EQUAL(linphone_address_as_string(linphone_event_get_resource(ev)), linphone_proxy_config_get_quality_reporting_collector(linphone_core_get_default_proxy_config(lc))); } - } static void quality_reporting_sent_using_custom_route() { @@ -367,7 +350,10 @@ static void quality_reporting_sent_using_custom_route() { LinphoneCall* call_marie = NULL; LinphoneCall* call_pauline = NULL; - marie->lc->current_vtable->publish_state_changed = publish_report_with_route_state_changed; + LinphoneCoreVTable publish_vtable = {0}; + publish_vtable.publish_state_changed = publish_report_with_route_state_changed; + linphone_core_add_listener(marie->lc, &publish_vtable); + //INVALID collector: sip.linphone.org do not collect reports, so it will throw a 404 Not Found error linphone_proxy_config_set_quality_reporting_collector(linphone_core_get_default_proxy_config(marie->lc), "sip:sip.linphone.org"); diff --git a/tester/tester.c b/tester/tester.c index e51f5a720..b6d6c6980 100644 --- a/tester/tester.c +++ b/tester/tester.c @@ -111,7 +111,7 @@ LinphoneCore* configure_lc_from(LinphoneCoreVTable* v_table, const char* path, c if (file){ filepath = ms_strdup_printf("%s/%s", path, file); - BC_ASSERT_EQUAL_FATAL(ortp_file_exist(filepath),0,int,"%d"); + BC_ASSERT_EQUAL_FATAL(ortp_file_exist(filepath),0,int, "%d"); config = lp_config_new_with_factory(NULL,filepath); } diff --git a/tester/tunnel_tester.c b/tester/tunnel_tester.c index 425247eb8..76ce2a826 100644 --- a/tester/tunnel_tester.c +++ b/tester/tunnel_tester.c @@ -128,8 +128,8 @@ static void call_with_tunnel_base(LinphoneTunnelMode tunnel_mode, bool_t with_si pauline_call=linphone_core_get_current_call(pauline->lc); BC_ASSERT_PTR_NOT_NULL(pauline_call); if (pauline_call!=NULL){ - BC_ASSERT_PTR_EQUAL(linphone_call_params_get_media_encryption(linphone_call_get_current_params(pauline_call)), - encryption); + BC_ASSERT_EQUAL(linphone_call_params_get_media_encryption(linphone_call_get_current_params(pauline_call)), + encryption, int, "%d"); } if (tunnel_mode == LinphoneTunnelModeEnable && with_sip){ /* make sure the call from pauline arrived from the tunnel by checking the contact address*/