static void profile_call_base(bool_t avpf1, LinphoneMediaEncryption srtp1,bool_t avpf2, LinphoneMediaEncryption srtp2, bool_t encryption_mandatory, const char *expected_profile) { LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc"); LinphoneCoreManager *pauline = linphone_core_manager_new("pauline_rc"); LinphoneProxyConfig *lpc; const LinphoneCallParams *params; if (avpf1) { linphone_core_get_default_proxy(marie->lc, &lpc); linphone_proxy_config_enable_avpf(lpc, TRUE); linphone_proxy_config_set_avpf_rr_interval(lpc, 3); } if (avpf2) { linphone_core_get_default_proxy(pauline->lc, &lpc); linphone_proxy_config_enable_avpf(lpc, TRUE); linphone_proxy_config_set_avpf_rr_interval(lpc, 3); } if (encryption_mandatory) { linphone_core_set_media_encryption_mandatory(marie->lc,TRUE); linphone_core_set_media_encryption_mandatory(pauline->lc,TRUE); } if (linphone_core_media_encryption_supported(marie->lc, srtp1)) { linphone_core_set_media_encryption(marie->lc, srtp1); } else { ms_message("Unsupported [%s] encryption type, cannot test",linphone_media_encryption_to_string(srtp1)); goto end; } if (linphone_core_media_encryption_supported(pauline->lc, srtp2)) { linphone_core_set_media_encryption(pauline->lc, srtp2); }else { ms_message("Unsupported [%s] encryption type, cannot test",linphone_media_encryption_to_string(srtp2)); goto end; } CU_ASSERT_TRUE(call(marie, pauline)); CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 1)); CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1)); if (linphone_core_get_current_call(marie->lc)) { params = linphone_call_get_current_params(linphone_core_get_current_call(marie->lc)); CU_ASSERT_STRING_EQUAL(linphone_call_params_get_rtp_profile(params), expected_profile); } if (linphone_core_get_current_call(pauline->lc)) { params = linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc)); CU_ASSERT_STRING_EQUAL(linphone_call_params_get_rtp_profile(params), expected_profile); } linphone_core_terminate_all_calls(marie->lc); CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallEnd, 1)); CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallEnd, 1)); CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallConnected, 1); CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallConnected, 1); end: linphone_core_manager_destroy(pauline); linphone_core_manager_destroy(marie); }
static void call_forking_with_urgent_reply(void){ LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc_tcp"); LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); LinphoneCoreManager* marie2 = linphone_core_manager_new( "marie_rc"); LinphoneCoreManager* marie3 = linphone_core_manager_new( "marie_rc"); MSList* lcs=ms_list_append(NULL,pauline->lc); lcs=ms_list_append(lcs,marie->lc); lcs=ms_list_append(lcs,marie2->lc); lcs=ms_list_append(lcs,marie3->lc); linphone_core_set_user_agent(marie->lc,"Natted Linphone",NULL); linphone_core_set_user_agent(marie2->lc,"Natted Linphone",NULL); linphone_core_set_user_agent(marie3->lc,"Natted Linphone",NULL); linphone_core_set_user_agent(pauline->lc,"Natted Linphone",NULL); CU_ASSERT_TRUE(linphone_core_media_encryption_supported(pauline->lc,LinphoneMediaEncryptionSRTP)); linphone_core_set_media_encryption(pauline->lc,LinphoneMediaEncryptionSRTP); linphone_core_set_network_reachable(marie2->lc,FALSE); linphone_core_set_network_reachable(marie3->lc,FALSE); linphone_core_invite_address(pauline->lc,marie->identity); /*pauline should hear ringback, after 5 seconds, when it will retry without SRTP*/ CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,6000)); /*Marie should be ringing*/ CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,1000)); /*marie accepts the call on its first device*/ linphone_core_accept_call(marie->lc,linphone_core_get_current_call(marie->lc)); CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,1000)); CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,1000)); CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallConnected,1,1000)); CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,1,1000)); linphone_core_terminate_call(pauline->lc,linphone_core_get_current_call(pauline->lc)); CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000)); CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000)); linphone_core_manager_destroy(pauline); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(marie2); linphone_core_manager_destroy(marie3); ms_list_free(lcs); }