diff --git a/tester/flexisip_tester.c b/tester/flexisip_tester.c index 9b87c3c55..64f6b4c7e 100644 --- a/tester/flexisip_tester.c +++ b/tester/flexisip_tester.c @@ -259,6 +259,46 @@ static void message_forking_with_unreachable_recipients_with_gruu(void) { bctbx_list_free(lcs); } +static void text_message_expires(void) { + LinphoneCoreManager* marie = linphone_core_manager_new4("marie_rc",TRUE,NULL,"message-expires=60",3); + LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc"); + + linphone_core_set_network_reachable(marie->lc, FALSE); + /* Wait for 5 seconds for surely cut marie of network */ + wait_for_until(pauline->lc, marie->lc, NULL, NULL, 5000); + + linphone_chat_room_send_message(linphone_core_get_chat_room(pauline->lc,marie->identity), "hello"); + linphone_core_set_network_reachable(marie->lc, TRUE); + + BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1)); + + linphone_core_manager_destroy(marie); + linphone_core_manager_destroy(pauline); +} + +static void text_call_expires(void) { + LinphoneCoreManager* marie = linphone_core_manager_new4("marie_rc",TRUE,NULL,"message-expires=60",3); + LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc"); + bctbx_list_t* lcs=bctbx_list_append(NULL,pauline->lc); + lcs=bctbx_list_append(lcs,marie->lc); + + linphone_core_set_network_reachable(marie->lc, FALSE); + /* Wait for 5 seconds for surely cut marie of network */ + wait_for_until(pauline->lc, marie->lc, NULL, NULL, 5000); + + linphone_core_invite_address(pauline->lc,marie->identity); + linphone_core_set_network_reachable(marie->lc, TRUE); + + /*pauline shouldn't hear ringback*/ + BC_ASSERT_FALSE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,5000)); + /*all devices from Marie shouldn't be ringing*/ + BC_ASSERT_FALSE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,5000)); + + linphone_core_manager_destroy(marie); + linphone_core_manager_destroy(pauline); + bctbx_list_free(lcs); +} + static void call_forking(void){ LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new( transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); @@ -1774,6 +1814,8 @@ test_t flexisip_tests[] = { TEST_NO_TAG("Message forking with unreachable recipients", message_forking_with_unreachable_recipients), TEST_NO_TAG("Message forking with all recipients unreachable", message_forking_with_all_recipients_unreachable), TEST_NO_TAG("Message forking with unreachable recipients with gruu", message_forking_with_unreachable_recipients_with_gruu), + TEST_NO_TAG("Message expires", text_message_expires), + TEST_NO_TAG("Call expires", text_call_expires), TEST_NO_TAG("Call forking", call_forking), TEST_NO_TAG("Call forking cancelled", call_forking_cancelled), TEST_NO_TAG("Call forking declined globaly", call_forking_declined_globaly), diff --git a/tester/liblinphone_tester.h b/tester/liblinphone_tester.h index 9a7531460..0979de45c 100644 --- a/tester/liblinphone_tester.h +++ b/tester/liblinphone_tester.h @@ -328,6 +328,7 @@ void linphone_core_manager_configure (LinphoneCoreManager *mgr); void linphone_core_manager_start(LinphoneCoreManager *mgr, bool_t check_for_proxies); LinphoneCoreManager* linphone_core_manager_create2(const char* rc_file, const char* phone_alias); LinphoneCoreManager* linphone_core_manager_create(const char* rc_file); +LinphoneCoreManager* linphone_core_manager_new4(const char* rc_file, int check_for_proxies, const char* phone_aliasconst, const char* contact_params, int expires); LinphoneCoreManager* linphone_core_manager_new3(const char* rc_file, bool_t check_for_proxies, const char* phone_alias); LinphoneCoreManager* linphone_core_manager_new2(const char* rc_file, bool_t check_for_proxies); LinphoneCoreManager* linphone_core_manager_new(const char* rc_file); diff --git a/tester/tester.c b/tester/tester.c index 595739902..15e83ac56 100644 --- a/tester/tester.c +++ b/tester/tester.c @@ -432,6 +432,17 @@ LinphoneCoreManager* linphone_core_manager_create(const char* rc_file) { return linphone_core_manager_create2(rc_file, NULL); } +LinphoneCoreManager* linphone_core_manager_new4(const char* rc_file, int check_for_proxies, const char* phone_alias, const char* contact_params, int expires) { + /* This function is for testing purposes. */ + LinphoneCoreManager *manager = ms_new0(LinphoneCoreManager, 1); + + linphone_core_manager_init(manager, rc_file, phone_alias); + linphone_proxy_config_set_contact_parameters(linphone_core_get_default_proxy_config(manager->lc), contact_params); + linphone_proxy_config_set_expires(linphone_core_get_default_proxy_config(manager->lc), expires); + linphone_core_manager_start(manager, check_for_proxies); + return manager; +} + LinphoneCoreManager* linphone_core_manager_new3(const char* rc_file, bool_t check_for_proxies, const char* phone_alias) { LinphoneCoreManager *manager = linphone_core_manager_create2(rc_file, phone_alias); linphone_core_manager_start(manager, check_for_proxies);