more call success when calling a number

This commit is contained in:
REIS Benjamin 2016-10-19 17:08:59 +02:00
parent 8b0486f169
commit cd509ca387

View file

@ -457,16 +457,21 @@
if (!value) {
return NULL;
}
LinphoneProxyConfig *cfg = linphone_core_get_default_proxy_config(LC);
LinphoneAddress *addr = linphone_proxy_config_normalize_sip_uri(cfg, value.UTF8String);
const char * normvalue;
if (linphone_proxy_config_is_phone_number(cfg, value.UTF8String)) {
normvalue = linphone_proxy_config_normalize_phone_number(cfg, value.UTF8String);
} else {
normvalue = value.UTF8String;
}
LinphoneAddress *addr = linphone_proxy_config_normalize_sip_uri(cfg, normvalue);
// first try to find a friend with the given address
Contact *c = [FastAddressBook getContactWithAddress:addr];
if (c && c.friend) {
LinphoneFriend *f = c.friend;
const LinphonePresenceModel *m =
f ? linphone_friend_get_presence_model_for_uri_or_tel(f, value.UTF8String) : NULL;
f ? linphone_friend_get_presence_model_for_uri_or_tel(f, normvalue) : NULL;
const char *contact = m ? linphone_presence_model_get_contact(m) : NULL;
if (contact) {
LinphoneAddress *contact_addr = linphone_address_new(contact);
@ -478,7 +483,7 @@
}
// since user wants to escape plus, we assume it expects to have phone numbers by default
if (addr && cfg && linphone_proxy_config_get_dial_escape_plus(cfg)) {
if (addr && cfg && (linphone_proxy_config_get_dial_escape_plus(cfg) || linphone_proxy_config_get_dial_prefix(cfg))) {
char *phone = linphone_proxy_config_normalize_phone_number(cfg, value.UTF8String);
if (phone) {
linphone_address_set_username(addr, phone);