]> sjero.net Git - linphone/commitdiff
avoid prompting password for ping (OPTIONS) requests
authorSimon Morlat <simon.morlat@linphone.org>
Thu, 8 Mar 2012 09:51:41 +0000 (10:51 +0100)
committerSimon Morlat <simon.morlat@linphone.org>
Thu, 8 Mar 2012 09:51:41 +0000 (10:51 +0100)
coreapi/callbacks.c
coreapi/misc.c
coreapi/private.h

index f2917f876c8b5fecbba8402f56286d0b5311a882..579a5336a14f9cf8daba76dbf1d89b6582a1761f 100644 (file)
@@ -602,6 +602,16 @@ static void call_released(SalOp *op){
 static void auth_requested(SalOp *h, const char *realm, const char *username){
        LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(h));
        LinphoneAuthInfo *ai=(LinphoneAuthInfo*)linphone_core_find_auth_info(lc,realm,username);
+       LinphoneCall *call=is_a_linphone_call(sal_op_get_user_pointer(h));
+
+       if (call && call->ping_op==h){
+               /*don't request authentication for ping requests. Their purpose is just to get any
+                * answer to get the Via's received and rport parameters.
+                */
+               ms_message("auth_requested(): ignored for ping request.");
+               return;
+       }
+       
        ms_message("auth_requested() for realm=%s, username=%s",realm,username);
 
        if (ai && ai->works==FALSE && ai->usecount>=3){
index 607ee6b3f5d931fe03d00900b92415bc4edf0cdf..ea85f1036ccf6b87a2b41078675566513503c41e 100644 (file)
@@ -557,6 +557,19 @@ void linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){
        }
 }
 
+LinphoneCall * is_a_linphone_call(void *user_pointer){
+       LinphoneCall *call=(LinphoneCall*)user_pointer;
+       if (call==NULL) return NULL;
+       return call->magic==linphone_call_magic ? call : NULL;
+}
+
+LinphoneProxyConfig * is_a_linphone_proxy_config(void *user_pointer){
+       LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)user_pointer;
+       if (cfg==NULL) return NULL;
+       return cfg->magic==linphone_proxy_config_magic ? cfg : NULL;
+}
+
+
 #ifdef HAVE_GETIFADDRS
 
 #include <ifaddrs.h>
index 10876734beb25db2418874bada0a7e3e8fddd02f..ab317c981850205d8eb725bed7c5d2879b8fabb0 100644 (file)
@@ -75,8 +75,11 @@ struct _LinphoneCallParams{
        
 };
 
+static const int linphone_call_magic=0x3343;
+
 struct _LinphoneCall
 {
+       int magic; /*used to distinguish from proxy config*/
        struct _LinphoneCore *core;
        SalMediaDescription *localdesc;
        SalMediaDescription *resultdesc;
@@ -238,9 +241,14 @@ extern SalCallbacks linphone_sal_callbacks;
 void linphone_proxy_config_set_error(LinphoneProxyConfig *cfg, LinphoneReason error);
 bool_t linphone_core_rtcp_enabled(const LinphoneCore *lc);
 
+LinphoneCall * is_a_linphone_call(void *user_pointer);
+LinphoneProxyConfig * is_a_linphone_proxy_config(void *user_pointer);
+
+static const int linphone_proxy_config_magic=0x7979;
 
 struct _LinphoneProxyConfig
 {
+       int magic;
        struct _LinphoneCore *lc;
        char *reg_proxy;
        char *reg_identity;