Commit c20d0546 authored by Gautier Pelloux-Prayer's avatar Gautier Pelloux-Prayer
Browse files

tester: move phone number normalization test in proxy tester suite

parent f929bbe6
mediastreamer2 @ 2ded5190
Subproject commit 80b70c52a4dbf7d1d1df8319a96159e769b46139
Subproject commit 2ded519059ba997e2dffe0a2aee0bacbe9a0c6b5
......@@ -465,39 +465,6 @@ static void call_with_timeouted_bye(void) {
}
}
static void phone_number_normalization(void){
LinphoneCoreManager *marie = linphone_core_manager_new( "marie_rc");
LinphoneProxyConfig *cfg = linphone_core_create_proxy_config(marie->lc);
char result[128];
linphone_proxy_config_set_dial_prefix(cfg, "33");
linphone_proxy_config_normalize_number(cfg, "0952636505", result, sizeof(result));
BC_ASSERT_STRING_EQUAL(result, "+33952636505");
linphone_proxy_config_normalize_number(cfg, "09 52 63 65 05", result, sizeof(result));
BC_ASSERT_STRING_EQUAL(result, "+33952636505");
linphone_proxy_config_normalize_number(cfg, "09-52-63-65-05", result, sizeof(result));
BC_ASSERT_STRING_EQUAL(result, "+33952636505");
linphone_proxy_config_normalize_number(cfg, "+31952636505", result, sizeof(result));
BC_ASSERT_STRING_EQUAL(result, "+31952636505");
linphone_proxy_config_normalize_number(cfg, "0033952636505", result, sizeof(result));
BC_ASSERT_STRING_EQUAL(result, "+33952636505");
linphone_proxy_config_normalize_number(cfg, "0033952636505", result, sizeof(result));
BC_ASSERT_STRING_EQUAL(result, "+33952636505");
linphone_proxy_config_normalize_number(cfg, "toto", result, sizeof(result));
BC_ASSERT_STRING_EQUAL(result, "toto");
linphone_proxy_config_set_dial_escape_plus(cfg, TRUE);
linphone_proxy_config_normalize_number(cfg, "0033952636505", result, sizeof(result));
BC_ASSERT_STRING_EQUAL(result, "0033952636505");
linphone_proxy_config_normalize_number(cfg, "0952636505", result, sizeof(result));
BC_ASSERT_STRING_EQUAL(result, "0033952636505");
linphone_proxy_config_normalize_number(cfg, "+34952636505", result, sizeof(result));
BC_ASSERT_STRING_EQUAL(result, "0034952636505");
linphone_proxy_config_unref(cfg);
linphone_core_manager_destroy(marie);
}
static void direct_call_over_ipv6(){
LinphoneCoreManager* marie;
LinphoneCoreManager* pauline;
......@@ -4251,7 +4218,6 @@ static void simple_mono_call_opus(void){
}
test_t call_tests[] = {
{ "Phone number normalization", phone_number_normalization },
{ "Early declined call", early_declined_call },
{ "Call declined", call_declined },
{ "Cancelled call", cancelled_call },
......
......@@ -512,8 +512,8 @@ static void call_forking_not_responded(void){
static void early_media_call_forking(void) {
LinphoneCoreManager* marie = linphone_core_manager_new("marie_early_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
LinphoneCoreManager* marie2 = linphone_core_manager_new("marie_early_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
MSList *lcs=NULL;
LinphoneCallParams *params=linphone_core_create_default_call_parameters(pauline->lc);
LinphoneVideoPolicy pol;
......@@ -586,9 +586,9 @@ static void early_media_call_forking(void) {
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,5000));
ms_list_free(lcs);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(marie2);
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(marie2);
linphone_core_manager_destroy(marie);
}
static void call_with_sips(void){
......
......@@ -56,16 +56,34 @@ static void phone_normalization_with_proxy() {
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+990012345678"), "+990012345678");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "0952636505"), "+33952636505");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "09 52 63 65 05"), "+33952636505");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "09-52-63-65-05"), "+33952636505");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+31952636505"), "+31952636505");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "0033952636505"), "+33952636505");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "0033952636505"), "+33952636505");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "toto"), "toto");
linphone_proxy_config_set_dial_prefix(proxy, "99");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "0012345678"), "+12345678");
linphone_proxy_config_destroy(proxy);
}
static void phone_normalization_with_dial_escape_plus(void){
LinphoneProxyConfig *proxy = linphone_proxy_config_new();
linphone_proxy_config_set_dial_prefix(proxy, "33");
linphone_proxy_config_set_dial_escape_plus(proxy, TRUE);
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "0033952636505"), "0033952636505");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "0952636505"), "0033952636505");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+34952636505"), "0034952636505");
linphone_proxy_config_destroy(proxy);
}
test_t proxy_config_tests[] = {
{ "Phone normalization without proxy", phone_normalization_without_proxy },
{ "Phone normalization with proxy", phone_normalization_with_proxy },
{ "Phone normalization with dial escape plus", phone_normalization_with_dial_escape_plus },
};
test_suite_t proxy_config_test_suite = {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment