From bb817a6a02547ab1f980674bcc8f065b8b7e85ec Mon Sep 17 00:00:00 2001 From: REIS Benjamin Date: Wed, 19 Oct 2016 16:01:42 +0200 Subject: [PATCH] Set dial prefix when login with username if possible --- coreapi/account_creator.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/coreapi/account_creator.c b/coreapi/account_creator.c index d53fae5d7..7c2fc66c4 100644 --- a/coreapi/account_creator.c +++ b/coreapi/account_creator.c @@ -468,7 +468,14 @@ LinphoneProxyConfig * linphone_account_creator_configure(const LinphoneAccountCr domain = ms_strdup_printf("%s;transport=%s", creator->domain, linphone_transport_to_string(creator->transport)); } linphone_proxy_config_set_identity_address(cfg, identity); - if (creator->phone_country_code) linphone_proxy_config_set_dial_prefix(cfg, creator->phone_country_code); + if (creator->phone_country_code) { + linphone_proxy_config_set_dial_prefix(cfg, creator->phone_country_code); + } else if (creator->phone_number) { + int dial_prefix_number = linphone_dial_plan_lookup_ccc_from_e164(creator->phone_number); + char buff[4]; + snprintf(buff, sizeof(buff), "%d", dial_prefix_number); + linphone_proxy_config_set_dial_prefix(cfg, buff); + } linphone_proxy_config_set_server_addr(cfg, domain); linphone_proxy_config_set_route(cfg, route); linphone_proxy_config_enable_publish(cfg, FALSE);