From ccc60f16ece1f1d4c95763bca89a3becff53d7be Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 29 Sep 2015 14:22:19 +0200 Subject: [PATCH] Added test for SRTP and realtime text --- coreapi/linphonecall.c | 3 +++ coreapi/linphonecore.c | 5 ----- tester/message_tester.c | 25 ++++++++++++++++++++----- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index dd4f5917a..d11a4e1dd 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -705,6 +705,9 @@ void linphone_call_make_local_media_description(LinphoneCall *call) { ms_warning("Cannot get audio local ssrc for call [%p]",call); if (call->main_audio_stream_index > max_index) max_index = call->main_audio_stream_index; + } else { + ms_message("Don't put audio stream on local offer for call [%p]",call); + md->streams[call->main_audio_stream_index].dir = SalStreamInactive; } md->streams[call->main_video_stream_index].proto=md->streams[call->main_audio_stream_index].proto; diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 9e3c49049..fb7cd222d 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -3050,11 +3050,6 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const parsed_url2=linphone_address_new(from); - /*rtt text stub*/ - if (cp->realtimetext_enabled) { - linphone_call_params_add_custom_header(cp,"X-RTT","on"); - } - call=linphone_call_new_outgoing(lc,parsed_url2,linphone_address_clone(addr),cp,proxy); if(linphone_core_add_call(lc,call)!= 0) diff --git a/tester/message_tester.c b/tester/message_tester.c index 49d5078b0..6ea814d86 100644 --- a/tester/message_tester.c +++ b/tester/message_tester.c @@ -1282,17 +1282,27 @@ static void file_transfer_io_error_after_destroying_chatroom() { file_transfer_io_error_base("https://www.linphone.org:444/lft.php", TRUE); } -static void real_time_text(bool_t audio_stream_enabled) { +static void real_time_text(bool_t audio_stream_enabled, bool_t srtp_enabled) { LinphoneChatRoom *pauline_chat_room; LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc"); - LinphoneCallParams *marie_params = linphone_core_create_default_call_parameters(marie->lc); + LinphoneCallParams *marie_params = NULL; LinphoneCall *pauline_call, *marie_call; + + if (srtp_enabled) { + BC_ASSERT_TRUE(linphone_core_media_encryption_supported(marie->lc, LinphoneMediaEncryptionSRTP)); + linphone_core_set_media_encryption(marie->lc, LinphoneMediaEncryptionSRTP); + linphone_core_set_media_encryption(pauline->lc, LinphoneMediaEncryptionSRTP); + linphone_core_set_media_encryption_mandatory(marie->lc, TRUE); + linphone_core_set_media_encryption_mandatory(pauline->lc, TRUE); + } + + marie_params = linphone_core_create_default_call_parameters(marie->lc); linphone_call_params_enable_realtime_text(marie_params,TRUE); if (!audio_stream_enabled) { linphone_call_params_enable_audio(marie_params,FALSE); } - + BC_ASSERT_TRUE(call_with_caller_params(marie, pauline, marie_params)); pauline_call=linphone_core_get_current_call(pauline->lc); marie_call=linphone_core_get_current_call(marie->lc); @@ -1332,7 +1342,7 @@ static void real_time_text(bool_t audio_stream_enabled) { } static void real_time_text_message(void) { - real_time_text(TRUE); + real_time_text(TRUE, FALSE); } static void real_time_text_conversation(void) { @@ -1435,7 +1445,11 @@ static void real_time_text_conversation(void) { } static void real_time_text_without_audio(void) { - real_time_text(FALSE); + real_time_text(FALSE, FALSE); +} + +static void real_time_text_srtp(void) { + real_time_text(TRUE, TRUE); } void file_transfer_with_http_proxy(void) { @@ -1489,6 +1503,7 @@ test_t message_tests[] = { {"Real Time Text message", real_time_text_message}, {"Real Time Text conversation", real_time_text_conversation}, {"Real Time Text without audio", real_time_text_without_audio}, + {"Real Time Text with srtp", real_time_text_srtp}, }; test_suite_t message_test_suite = {