diff --git a/linphone/coreapi/exevents.c b/linphone/coreapi/exevents.c index c91bec058..907830b42 100644 --- a/linphone/coreapi/exevents.c +++ b/linphone/coreapi/exevents.c @@ -888,7 +888,6 @@ void linphone_call_message_new(LinphoneCore *lc, eXosip_event_t *ev){ #endif } - void linphone_registration_faillure(LinphoneCore *lc, eXosip_event_t *ev){ int status_code=0; char *msg; @@ -907,6 +906,8 @@ void linphone_registration_faillure(LinphoneCore *lc, eXosip_event_t *ev){ case 407: linphone_process_authentication(lc,ev); break; + case 403: + linphone_proxy_config_process_authentication_failure(lc,ev); default: msg=ortp_strdup_printf(_("Registration on %s failed: %s"),ru,(reason!=NULL) ? reason : _("no response timeout")); lc->vtable.display_status(lc,msg); @@ -929,7 +930,6 @@ void linphone_registration_success(LinphoneCore *lc,eXosip_event_t *ev){ osip_free(ru); cfg=linphone_core_get_proxy_config_from_rid(lc,ev->rid); ms_return_if_fail(cfg!=NULL); - cfg->auth_pending=FALSE; gstate_new_state(lc, GSTATE_REG_OK, NULL); osip_message_get_expires(ev->request,0,&h); if (h!=NULL && atoi(h->hvalue)!=0){ diff --git a/linphone/coreapi/linphonecore.h b/linphone/coreapi/linphonecore.h index d2314f577..0cfec9cbb 100644 --- a/linphone/coreapi/linphonecore.h +++ b/linphone/coreapi/linphonecore.h @@ -294,9 +294,9 @@ typedef struct _LinphoneProxyConfig int rid; char *type; struct _SipSetupContext *ssctx; + int auth_failures; bool_t frozen; bool_t reg_sendregister; - bool_t auth_pending; bool_t registered; bool_t publish; } LinphoneProxyConfig; diff --git a/linphone/coreapi/private.h b/linphone/coreapi/private.h index 00e746ad3..bbf1b7525 100644 --- a/linphone/coreapi/private.h +++ b/linphone/coreapi/private.h @@ -106,6 +106,7 @@ void linphone_authentication_ok(LinphoneCore *lc, eXosip_event_t *ev); void linphone_subscription_new(LinphoneCore *lc, eXosip_event_t *ev); void linphone_notify_recv(LinphoneCore *lc,eXosip_event_t *ev); LinphoneProxyConfig *linphone_core_get_proxy_config_from_rid(LinphoneCore *lc, int rid); +void linphone_proxy_config_process_authentication_failure(LinphoneCore *lc, eXosip_event_t *ev); void linphone_subscription_answered(LinphoneCore *lc, eXosip_event_t *ev); void linphone_subscription_closed(LinphoneCore *lc, eXosip_event_t *ev); diff --git a/linphone/coreapi/proxy.c b/linphone/coreapi/proxy.c index 318ad4a84..eb1016b7d 100644 --- a/linphone/coreapi/proxy.c +++ b/linphone/coreapi/proxy.c @@ -211,6 +211,7 @@ void linphone_proxy_config_enable_publish(LinphoneProxyConfig *obj, bool_t val){ void linphone_proxy_config_edit(LinphoneProxyConfig *obj){ obj->frozen=TRUE; + obj->auth_failures=0; if (obj->reg_sendregister){ /* unregister */ if (obj->registered) { @@ -498,6 +499,18 @@ const MSList *linphone_core_get_proxy_config_list(const LinphoneCore *lc){ } +void linphone_proxy_config_process_authentication_failure(LinphoneCore *lc, eXosip_event_t *ev){ + LinphoneProxyConfig *cfg=linphone_core_get_proxy_config_from_rid(lc, ev->rid); + if (cfg){ + cfg->auth_failures++; + /*restart a new register */ + if (cfg->auth_failures==1){ + linphone_proxy_config_done(cfg); + } + } +} + + void linphone_proxy_config_write_to_config_file(LpConfig *config, LinphoneProxyConfig *obj, int index) { char key[50]; diff --git a/linphone/gtk-glade/propertybox.c b/linphone/gtk-glade/propertybox.c index 0461edba3..eba3a7dd0 100644 --- a/linphone/gtk-glade/propertybox.c +++ b/linphone/gtk-glade/propertybox.c @@ -32,12 +32,13 @@ static void linphone_gtk_fill_combo_box(GtkWidget *combo, const char **devices, unless we fill it with a dummy text. This dummy text needs to be removed first*/ gtk_combo_box_remove_text(GTK_COMBO_BOX(combo),0); - for(;*p!=NULL;++p,++i){ + for(;*p!=NULL;++p){ if ( cap==CAP_IGNORE || (cap==CAP_CAPTURE && linphone_core_sound_device_can_capture(linphone_gtk_get_core(),*p)) || (cap==CAP_PLAYBACK && linphone_core_sound_device_can_playback(linphone_gtk_get_core(),*p)) ){ gtk_combo_box_append_text(GTK_COMBO_BOX(combo),*p); if (strcmp(selected,*p)==0) active=i; + i++; } } gtk_combo_box_set_active(GTK_COMBO_BOX(combo),active); diff --git a/linphone/gtk-glade/support.c b/linphone/gtk-glade/support.c index 3f3877b4f..8463ae829 100644 --- a/linphone/gtk-glade/support.c +++ b/linphone/gtk-glade/support.c @@ -119,8 +119,8 @@ const char *linphone_gtk_get_lang(const char *config_file){ break; } } + fclose(f); } - fclose(f); return linphone_lang; }