diff --git a/Classes/AssistantView.m b/Classes/AssistantView.m index 86cd728d9..05bbfe1e5 100644 --- a/Classes/AssistantView.m +++ b/Classes/AssistantView.m @@ -238,6 +238,21 @@ static UICompositeViewDescription *compositeDescription = nil; new_config = linphone_account_creator_configure(account_creator); if (new_config) { + BOOL usePhoneNumber = [LinphoneManager.instance lpConfigBoolForKey:@"use_phone_number"]; + if (usePhoneNumber) { + char *user = linphone_proxy_config_normalize_phone_number( + new_config, linphone_account_creator_get_username(account_creator)); + if (user) { + LinphoneAddress *addr = linphone_address_clone(linphone_proxy_config_get_identity_address(new_config)); + linphone_address_set_username(addr, user); + linphone_proxy_config_edit(new_config); + linphone_proxy_config_set_identity_address(new_config, addr); + linphone_proxy_config_done(new_config); + linphone_address_destroy(addr); + ms_free(user); + } + } + [lm configurePushTokenForProxyConfig:new_config]; linphone_core_set_default_proxy_config(LC, new_config); // reload address book to prepend proxy config domain to contacts' phone number diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index 35e885d45..3c42d6037 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -485,8 +485,10 @@ LinphoneAddress *linphoneAddress = linphone_core_interpret_url(LC, "sip:user@domain.com"); if ([LinphoneManager.instance lpConfigBoolForKey:@"use_phone_number" inSection:@"assistant"]) { char *user = linphone_proxy_config_normalize_phone_number(proxyCfg, username.UTF8String); - linphone_address_set_username(linphoneAddress, user); - ms_free(user); + if (user) { + linphone_address_set_username(linphoneAddress, user); + ms_free(user); + } } linphone_address_set_domain(linphoneAddress, [domain UTF8String]); linphone_address_set_display_name(linphoneAddress, (displayName.length ? displayName.UTF8String : NULL)); diff --git a/submodules/linphone b/submodules/linphone index e1f34777d..0feee4b5b 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit e1f34777d4cdc4066f626cff999ce6dff4157f22 +Subproject commit 0feee4b5bb3971463545f26eb8b32dba62053abc