]> sjero.net Git - linphone/blobdiff - coreapi/linphonecall.c
Disable ping options when uPnP is working
[linphone] / coreapi / linphonecall.c
index 6a39783e754ed01f64d38ba0d999e7f7ff49745d..a7cad386c3895b0c87491c3d00b37840ae20465a 100644 (file)
@@ -508,14 +508,21 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro
        call->core=lc;
 
        if (lc->sip_conf.ping_with_options){
-               /*the following sends an option request back to the caller so that
-                we get a chance to discover our nat'd address before answering.*/
-               call->ping_op=sal_op_new(lc->sal);
-               from_str=linphone_address_as_string_uri_only(from);
-               sal_op_set_route(call->ping_op,sal_op_get_network_origin(op));
-               sal_op_set_user_pointer(call->ping_op,call);
-               sal_ping(call->ping_op,linphone_core_find_best_identity(lc,from,NULL),from_str);
-               ms_free(from_str);
+#ifdef BUILD_UPNP
+               if (lc->upnp != NULL && linphone_core_get_firewall_policy(lc)==LinphonePolicyUseUpnp &&
+                       linphone_upnp_context_get_state(lc->upnp) == LinphoneUpnpStateOk) {
+#else //BUILD_UPNP
+               {
+#endif //BUILD_UPNP
+                       /*the following sends an option request back to the caller so that
+                        we get a chance to discover our nat'd address before answering.*/
+                       call->ping_op=sal_op_new(lc->sal);
+                       from_str=linphone_address_as_string_uri_only(from);
+                       sal_op_set_route(call->ping_op,sal_op_get_network_origin(op));
+                       sal_op_set_user_pointer(call->ping_op,call);
+                       sal_ping(call->ping_op,linphone_core_find_best_identity(lc,from,NULL),from_str);
+                       ms_free(from_str);
+               }
        }
 
        linphone_address_clean(from);