mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-02 20:16:25 +00:00
add registration error cause
This commit is contained in:
parent
87c480fdbc
commit
6757edcdee
4 changed files with 19 additions and 2 deletions
|
|
@ -24,6 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "private.h"
|
||||
#include "mediastreamer2/mediastream.h"
|
||||
|
||||
static void register_failure(SalOp *op, SalError error, SalReason reason, const char *details);
|
||||
|
||||
static void linphone_connect_incoming(LinphoneCore *lc, LinphoneCall *call){
|
||||
if (lc->ringstream!=NULL){
|
||||
|
|
@ -426,6 +427,9 @@ static void auth_requested(SalOp *h, const char *realm, const char *username){
|
|||
sal_op_authenticate(h,&sai);
|
||||
ai->usecount++;
|
||||
}else{
|
||||
if (ai && ai->works==FALSE) {
|
||||
register_failure(h, SalErrorFailure, SalReasonForbidden, _("Authentication failure"));
|
||||
}
|
||||
if (lc->vtable.auth_info_requested)
|
||||
lc->vtable.auth_info_requested(lc,realm,username);
|
||||
}
|
||||
|
|
@ -446,6 +450,7 @@ static void register_success(SalOp *op, bool_t registered){
|
|||
char *msg;
|
||||
|
||||
cfg->registered=registered;
|
||||
linphone_proxy_config_set_error(cfg,LinphoneErrorNone);
|
||||
linphone_proxy_config_set_state(cfg, registered ? LinphoneRegistrationOk : LinphoneRegistrationCleared ,
|
||||
registered ? "Registration sucessful" : "Unregistration done");
|
||||
if (lc->vtable.display_status){
|
||||
|
|
@ -473,6 +478,11 @@ static void register_failure(SalOp *op, SalError error, SalReason reason, const
|
|||
lc->vtable.display_status(lc,msg);
|
||||
ms_free(msg);
|
||||
}
|
||||
if (error== SalErrorFailure && reason == SalReasonForbidden) {
|
||||
linphone_proxy_config_set_error(cfg, LinphoneErrorBadCredentials);
|
||||
} else if (error == SalErrorNoResponse) {
|
||||
linphone_proxy_config_set_error(cfg, LinphoneErrorNoResponse);
|
||||
}
|
||||
linphone_proxy_config_set_state(cfg,LinphoneRegistrationFailed,details);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ LinphoneCallLog *linphone_call_get_call_log(const LinphoneCall *call);
|
|||
const char *linphone_call_get_refer_to(const LinphoneCall *call);
|
||||
bool_t linphone_call_has_transfer_pending(const LinphoneCall *call);
|
||||
int linphone_call_get_duration(const LinphoneCall *call);
|
||||
const LinphoneCallParams linphone_call_get_current_params(const LinphoneCall *call);
|
||||
LinphoneCallParams linphone_call_get_current_params(const LinphoneCall *call);
|
||||
void linphone_call_enable_camera(LinphoneCall *lc, bool_t enabled);
|
||||
bool_t linphone_call_camera_enabled(const LinphoneCall *lc);
|
||||
LinphoneError linphone_call_get_error(const LinphoneCall *call);
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ void linphone_core_stop_waiting(LinphoneCore *lc);
|
|||
int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call, LinphoneProxyConfig *dest_proxy);
|
||||
void linphone_core_start_pending_refered_calls(LinphoneCore *lc);
|
||||
extern SalCallbacks linphone_sal_callbacks;
|
||||
|
||||
void linphone_proxy_config_set_error(LinphoneProxyConfig *cfg,LinphoneError error);
|
||||
|
||||
struct _LinphoneProxyConfig
|
||||
{
|
||||
|
|
@ -216,6 +216,7 @@ struct _LinphoneProxyConfig
|
|||
bool_t dial_escape_plus;
|
||||
void* user_data;
|
||||
time_t deletion_date;
|
||||
LinphoneError error;
|
||||
};
|
||||
|
||||
struct _LinphoneAuthInfo
|
||||
|
|
|
|||
|
|
@ -829,5 +829,11 @@ LinphoneRegistrationState linphone_proxy_config_get_state(const LinphoneProxyCon
|
|||
}
|
||||
return NULL;
|
||||
}
|
||||
LinphoneError linphone_proxy_config_get_error(const LinphoneProxyConfig *cfg) {
|
||||
return cfg->error;
|
||||
}
|
||||
void linphone_proxy_config_set_error(LinphoneProxyConfig *cfg,LinphoneError error) {
|
||||
cfg->error = error;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue