diff --git a/linphone/coreapi/authentication.c b/linphone/coreapi/authentication.c
index 59d8f43b3fff0e2f46217c7340a78e16b2bdd10f..ee360ecfe0f966a86415f4f813a0771a87a04432 100644
--- a/linphone/coreapi/authentication.c
+++ b/linphone/coreapi/authentication.c
@@ -362,10 +362,12 @@ void linphone_process_authentication(LinphoneCore *lc, eXosip_event_t *ev)
 	osip_www_authenticate_t *www_auth;
 	osip_message_t *resp=ev->response;
 	char *username;
-	
+
+	/*
 	if (strcmp(ev->request->sip_method,"REGISTER")==0) {
 		gstate_new_state(lc, GSTATE_REG_FAILED, "Authentication required");
 	}
+	*/
 
 	username=osip_uri_get_username(resp->from->url);
 	prx_auth=(osip_proxy_authenticate_t*)osip_list_get(&resp->proxy_authenticates,0);
diff --git a/linphone/coreapi/proxy.c b/linphone/coreapi/proxy.c
index 28975b2231d8d5222224d247db74d8e5f1be33ff..75e918f62cfc2a2e3702a9b8bfd5585e9275bfb6 100644
--- a/linphone/coreapi/proxy.c
+++ b/linphone/coreapi/proxy.c
@@ -624,6 +624,9 @@ void linphone_proxy_config_process_authentication_failure(LinphoneCore *lc, eXos
 	LinphoneProxyConfig *cfg=linphone_core_get_proxy_config_from_rid(lc, ev->rid);
 	if (cfg){
 		cfg->auth_failures++;
+		if (strcmp(ev->request->sip_method,"REGISTER")==0) {
+			gstate_new_state(lc, GSTATE_REG_FAILED, "Authentication failed.");
+		}
 		/*restart a new register so that the user gets a chance to be prompted for a password*/
 		if (cfg->auth_failures==1){
 			linphone_proxy_config_register(cfg);