Commit 18141ff1 authored by jehan's avatar jehan
Browse files

make sure 00 are replaced by + only if proxy_config dial prefix is set

parent 67b57316
......@@ -651,12 +651,14 @@ char* linphone_proxy_config_normalize_phone_number(LinphoneProxyConfig *proxy, c
//probably generic dialplan, preserving proxy dial prefix
strncpy(dialplan.ccc,tmpproxy->dial_prefix,sizeof(dialplan.ccc));
}
}
if (strstr(flatten,dialplan.icp)==flatten) {
char *e164 = replace_icp_with_plus(flatten,dialplan.icp);
result = linphone_proxy_config_normalize_phone_number(tmpproxy,e164);
ms_free(e164);
goto end;
/*it does not make sens to try replace icp with + if we are not sure from the country we are (I.E tmpproxy->dial_prefix==NULL)*/
if (strstr(flatten,dialplan.icp)==flatten) {
char *e164 = replace_icp_with_plus(flatten,dialplan.icp);
result = linphone_proxy_config_normalize_phone_number(tmpproxy,e164);
ms_free(e164);
goto end;
}
}
nationnal_significant_number=flatten;
}
......
......@@ -67,7 +67,8 @@ static void phone_normalization_with_proxy(void) {
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+3301234567891"), "+33234567891");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+33 (0) 1 23 45 67 89"), "+33123456789");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+90 (903) 1234567"), "+909031234567");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "0033123456789"), "0033123456789");
linphone_proxy_config_set_dial_prefix(proxy, "33");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "123456789"), "+33123456789");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, " 0123456789"), "+33123456789");
......@@ -126,7 +127,7 @@ static void phone_normalization_with_proxy(void) {
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "0123456789"), "+990123456789");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "01234567890"), "+991234567890");
linphone_proxy_config_destroy(proxy);
linphone_proxy_config_unref(proxy);
}
static void phone_normalization_with_dial_escape_plus(void){
......@@ -149,8 +150,10 @@ static void phone_normalization_with_dial_escape_plus(void){
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "0123456789"), "0033123456789");
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "01234567890"), "0033234567890");
linphone_proxy_config_set_dial_escape_plus(proxy, FALSE);
BC_ASSERT_STRING_EQUAL(phone_normalization(proxy, "+34952636505"), "+34952636505");
linphone_proxy_config_destroy(proxy);
linphone_proxy_config_unref(proxy);
}
#define SIP_URI_CHECK(actual, expected) { \
......
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