]> sjero.net Git - linphone/commitdiff
fix lookup_known_proxy() to prefer the default proxy if it can do the job (instead...
authorSimon Morlat <simon.morlat@linphone.org>
Tue, 24 Jan 2012 16:39:54 +0000 (17:39 +0100)
committerSimon Morlat <simon.morlat@linphone.org>
Tue, 24 Jan 2012 16:39:54 +0000 (17:39 +0100)
coreapi/linphonecore.c

index 7e822699f3a4e11b318296a4a90afd5c62906acf..d2ef423644933f34a6dd9c8b2059af53b30a5ef4 100644 (file)
@@ -1966,6 +1966,16 @@ void linphone_core_start_refered_call(LinphoneCore *lc, LinphoneCall *call){
 LinphoneProxyConfig * linphone_core_lookup_known_proxy(LinphoneCore *lc, const LinphoneAddress *uri){
        const MSList *elem;
        LinphoneProxyConfig *found_cfg=NULL;
+       LinphoneProxyConfig *default_cfg=lc->default_proxy;
+
+       /*always prefer the 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)
+                       return default_cfg;
+       }
+
+       /*otherwise iterate through the other proxy config and return the 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);