From f0250b5a5fb9cb6a2bbf0432f7b4bb352189dafe Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 14 Jan 2014 14:47:47 +0100 Subject: [PATCH] make sure call media encryption call param is not 'fixed' in case of ZRTP --- coreapi/linphonecall.c | 5 +++-- tester/call_tester.c | 32 +++++++++++++++++++++++++------- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index b386a3e33..0700577dc 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -688,7 +688,8 @@ static void linphone_call_set_terminated(LinphoneCall *call){ void linphone_call_fix_call_parameters(LinphoneCall *call){ call->params.has_video=call->current_params.has_video; - call->params.media_encryption=call->current_params.media_encryption; + if (call->params.media_encryption != LinphoneMediaEncryptionZRTP) /*in case of ZRTP call parameter are handle after zrtp negociation*/ + call->params.media_encryption=call->current_params.media_encryption; } const char *linphone_call_state_to_string(LinphoneCallState cs){ @@ -2770,4 +2771,4 @@ void linphone_call_set_contact_op(LinphoneCall* call) { sal_op_set_contact(call->op, contact); linphone_address_destroy(contact); } -} \ No newline at end of file +} diff --git a/tester/call_tester.c b/tester/call_tester.c index f65a4028d..347259bf4 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -916,19 +916,23 @@ static void simple_conference(void) { } -static void srtp_call(void) { +static void encrypted_call(LinphoneMediaEncryption mode) { LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc"); - if (linphone_core_media_encryption_supported(marie->lc,LinphoneMediaEncryptionSRTP)) { - linphone_core_set_media_encryption(marie->lc,LinphoneMediaEncryptionSRTP); - linphone_core_set_media_encryption(pauline->lc,LinphoneMediaEncryptionSRTP); + if (linphone_core_media_encryption_supported(marie->lc,mode)) { + linphone_core_set_media_encryption(marie->lc,mode); + linphone_core_set_media_encryption(pauline->lc,mode); CU_ASSERT_TRUE(call(pauline,marie)); - CU_ASSERT_EQUAL(linphone_core_get_media_encryption(marie->lc),LinphoneMediaEncryptionSRTP); - CU_ASSERT_EQUAL(linphone_core_get_media_encryption(pauline->lc),LinphoneMediaEncryptionSRTP); - + CU_ASSERT_EQUAL(linphone_core_get_media_encryption(marie->lc),mode); + CU_ASSERT_EQUAL(linphone_core_get_media_encryption(pauline->lc),mode); + if (linphone_core_get_media_encryption(pauline->lc) == linphone_core_get_media_encryption(pauline->lc) == LinphoneMediaEncryptionZRTP) { + /*check SAS*/ + CU_ASSERT_STRING_EQUAL(linphone_call_get_authentication_token(linphone_core_get_current_call(pauline->lc)) + ,linphone_call_get_authentication_token(linphone_core_get_current_call(marie->lc))); + } /*just to sleep*/ linphone_core_terminate_all_calls(marie->lc); CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1)); @@ -939,6 +943,16 @@ static void srtp_call(void) { linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); } +static void srtp_call(LinphoneMediaEncryptionSRTP) { + encrypted_call(LinphoneMediaEncryptionSRTP); +} + +/* + * futur work +static void zrtp_call(LinphoneMediaEncryptionSRTP) { + encrypted_call(LinphoneMediaEncryptionZRTP); +}*/ + static void call_with_declined_srtp(void) { LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc"); @@ -1007,6 +1021,9 @@ static void srtp_ice_call(void) { } + + + static void early_media_call(void) { LinphoneCoreManager* marie = linphone_core_manager_new( "marie_early_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc"); @@ -1476,6 +1493,7 @@ test_t call_tests[] = { { "Call paused resumed", call_paused_resumed }, { "Call paused resumed from callee", call_paused_resumed_from_callee }, { "SRTP call", srtp_call }, + /*{ "ZRTP call",zrtp_call}, futur work*/ { "SRTP call with declined srtp", call_with_declined_srtp }, #ifdef VIDEO_ENABLED { "Simple video call",video_call},