]> sjero.net Git - linphone/blobdiff - coreapi/proxy.c
Improve uPnP behaviour (Firewall policy change, local ip change, ...)
[linphone] / coreapi / proxy.c
index 4aae6d3b937e51f3b605706c597fc6d1b096b647..559547727bb348bf365cd60fae4997d946d41895 100644 (file)
@@ -1097,9 +1097,18 @@ void linphone_proxy_config_update(LinphoneProxyConfig *cfg){
                if (cfg->type && cfg->ssctx==NULL){
                        linphone_proxy_config_activate_sip_setup(cfg);
                }
-               if ((!lc->sip_conf.register_only_when_network_is_up || lc->network_reachable) &&
-                       (!lc->sip_conf.register_only_when_upnp_is_ok || linphone_core_get_upnp_state(lc) == LinphoneUpnpStateOk))
-                       linphone_proxy_config_register(cfg);
+               switch(linphone_core_get_firewall_policy(lc)) {
+                       case LinphonePolicyUseUpnp:
+#ifdef BUILD_UPNP
+                       if(lc->upnp != NULL && !linphone_upnp_context_is_ready_for_register(lc->upnp)) {
+                               break;
+                       }
+#endif         
+                       default:
+                       if ((!lc->sip_conf.register_only_when_network_is_up || lc->network_reachable)) {
+                               linphone_proxy_config_register(cfg);
+                       }
+               }       
                if (cfg->publish && cfg->publish_op==NULL){
                        linphone_proxy_config_send_publish(cfg,lc->presence_mode);
                }