make sure call media encryption call param is not 'fixed' in case of ZRTP

This commit is contained in:
Jehan Monnier 2014-01-14 14:47:47 +01:00
parent 9d315fd5ec
commit f0250b5a5f
2 changed files with 28 additions and 9 deletions

View file

@ -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);
}
}
}

View file

@ -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},