diff --git a/Classes/ChatConversationCreateView.m b/Classes/ChatConversationCreateView.m index b0e9a6a8d..72d225601 100644 --- a/Classes/ChatConversationCreateView.m +++ b/Classes/ChatConversationCreateView.m @@ -165,7 +165,14 @@ typedef enum { ContactsAll, ContactsLinphone, ContactsMAX } ContactsCategory; UIChatCreateCollectionViewCell *cell = (UIChatCreateCollectionViewCell *)[_collectionView dequeueReusableCellWithReuseIdentifier:uri forIndexPath:indexPath]; cell.controller = self; cell.uri = uri; - LinphoneAddress *addr = linphone_address_new(uri.UTF8String); + LinphoneAddress *addr = NULL; + LinphoneProxyConfig *cfg = linphone_core_get_default_proxy_config(LC); + if (cfg && linphone_proxy_config_is_phone_number(cfg, uri.UTF8String)) { + char *phone = linphone_proxy_config_normalize_phone_number(cfg, uri.UTF8String); + addr = linphone_proxy_config_normalize_sip_uri(cfg, phone); + ms_free(phone); + } else + addr = linphone_address_new(uri.UTF8String); cell = [cell initWithName:[FastAddressBook displayNameForAddress:addr]]; linphone_address_unref(addr); return cell; diff --git a/Classes/Utils/Utils.m b/Classes/Utils/Utils.m index e7061da59..bebbd9fbb 100644 --- a/Classes/Utils/Utils.m +++ b/Classes/Utils/Utils.m @@ -494,11 +494,10 @@ // since user wants to escape plus, we assume it expects to have phone // numbers by default if (addr && cfg) { - if (linphone_proxy_config_get_dial_escape_plus(cfg) && linphone_proxy_config_is_phone_number(cfg, normvalue)) - linphone_address_set_username(addr, normvalue); - else if (linphone_proxy_config_is_phone_number(cfg, value.UTF8String)) - linphone_address_set_username(addr, value.UTF8String); - } + const char *username = linphone_proxy_config_get_dial_escape_plus(cfg) ? normvalue : value.UTF8String; + if (linphone_proxy_config_is_phone_number(cfg, username)) + linphone_address_set_username(addr, username); + } return addr; }