mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-07 14:18:25 +00:00
Prefer default, then registering proxy in linphone_core_lookup_known_proxy
Simple backward compatible evolution of the algorithm. Not registering proxy does not mean disabled: they are the fallback in case no other proxy matches. A better description of the proxy config modes would be: - enabled; - noregister; - disabled. However, it is a bit invasive as many places enable/disable registrations.
This commit is contained in:
parent
93f5e85967
commit
0f31299139
1 changed files with 10 additions and 4 deletions
|
|
@ -2490,9 +2490,10 @@ static MSList *make_routes_for_proxy(LinphoneProxyConfig *proxy, const LinphoneA
|
|||
LinphoneProxyConfig * linphone_core_lookup_known_proxy(LinphoneCore *lc, const LinphoneAddress *uri){
|
||||
const MSList *elem;
|
||||
LinphoneProxyConfig *found_cfg=NULL;
|
||||
LinphoneProxyConfig *found_noreg_cfg=NULL;
|
||||
LinphoneProxyConfig *default_cfg=lc->default_proxy;
|
||||
|
||||
/*always prefer the default proxy if it is matching the destination uri*/
|
||||
/*return default proxy if it is matching the destination uri*/
|
||||
if (default_cfg){
|
||||
const char *domain=linphone_proxy_config_get_domain(default_cfg);
|
||||
if (strcmp(domain,linphone_address_get_domain(uri))==0){
|
||||
|
|
@ -2501,16 +2502,21 @@ LinphoneProxyConfig * linphone_core_lookup_known_proxy(LinphoneCore *lc, const L
|
|||
}
|
||||
}
|
||||
|
||||
/*otherwise iterate through the other proxy config and return the first matching*/
|
||||
/*otherwise return first registering matching, otherwise first matching */
|
||||
for (elem=linphone_core_get_proxy_config_list(lc);elem!=NULL;elem=elem->next){
|
||||
LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)elem->data;
|
||||
const char *domain=linphone_proxy_config_get_domain(cfg);
|
||||
if (domain!=NULL && strcmp(domain,linphone_address_get_domain(uri))==0){
|
||||
found_cfg=cfg;
|
||||
goto end;
|
||||
if (linphone_proxy_config_register_enabled(cfg)) {
|
||||
found_cfg=cfg;
|
||||
goto end;
|
||||
} else if (!found_noreg_cfg){
|
||||
found_noreg_cfg=cfg;
|
||||
}
|
||||
}
|
||||
}
|
||||
end:
|
||||
if (found_noreg_cfg) found_cfg = found_noreg_cfg;
|
||||
if (found_cfg!=NULL && found_cfg!=default_cfg){
|
||||
ms_debug("Overriding default proxy setting for this call/message/subscribe operation.");
|
||||
}else found_cfg=default_cfg;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue