From 009f3f83c7bd9b0a573c2945387631deddae23dd Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Wed, 11 Jun 2014 14:36:14 +0200 Subject: [PATCH] Add test for 2 calls --- tester/call_tester.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tester/call_tester.c b/tester/call_tester.c index 0c1b50392..2e01751fd 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -266,6 +266,46 @@ static void simple_call(void) { } } +static void multiple_answers_call() { + /* Scenario is this: pauline calls marie, which is registered 2 times. + Both linphones answer at the same time, and only one should get the + call running, the other should be terminated */ + LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc" ); + LinphoneCoreManager* marie1 = linphone_core_manager_new( "marie_rc" ); + LinphoneCoreManager* marie2 = linphone_core_manager_new( "marie_rc" ); + + LinphoneCall* call1, *call2; + + MSList* lcs = ms_list_append(NULL,pauline->lc); + lcs = ms_list_append(lcs,marie1->lc); + lcs = ms_list_append(lcs,marie2->lc); + + CU_ASSERT_PTR_NOT_NULL( linphone_core_invite_address(pauline->lc, marie1->identity ) ); + + CU_ASSERT_TRUE(wait_for_list(lcs,&marie1->stat->number_of_LinphoneCallIncomingReceived, 1, 2000)); + CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat->number_of_LinphoneCallIncomingReceived, 1, 2000)); + + // marie 1 and 2 answer at the same time + call1 = linphone_core_get_current_call(marie1->lc); + call2 = linphone_core_get_current_call(marie2->lc); + + CU_ASSERT_PTR_NOT_NULL_FATAL(call1); + CU_ASSERT_PTR_NOT_NULL_FATAL(call2); + + CU_ASSERT_EQUAL( linphone_core_accept_call(marie1->lc, call1), 0); + CU_ASSERT_EQUAL( linphone_core_accept_call(marie2->lc, call2), 0); + + CU_ASSERT_TRUE( wait_for_list(lcs, &pauline->stat->number_of_LinphoneCallStreamsRunning, 1, 2000) ); + CU_ASSERT_TRUE( wait_for_list(lcs, &marie1->stat->number_of_LinphoneCallStreamsRunning, 1, 2000) ); + CU_ASSERT_TRUE( wait_for_list(lcs, &marie2->stat->number_of_LinphoneCallReleased, 1, 2000) ); + + + linphone_core_manager_destroy(pauline); + linphone_core_manager_destroy(marie1); + linphone_core_manager_destroy(marie2); + +} + static void call_with_specified_codec_bitrate(void) { LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc"); @@ -2279,6 +2319,7 @@ test_t call_tests[] = { { "Cancelled ringing call", cancelled_ringing_call }, { "Call failed because of codecs", call_failed_because_of_codecs }, { "Simple call", simple_call }, + { "Multiple answers to a call", multiple_answers_call }, { "Call with media relay", call_with_media_relay}, { "Call with media relay (random ports)", call_with_media_relay_random_ports}, { "Simple call compatibility mode", simple_call_compatibility_mode },