Commit d0fe2ae5 authored by smorlat's avatar smorlat
Browse files

retry a register after a failure, if the contact was not up to date (incorrect local address).

git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@618 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
parent 1c5c44a9
......@@ -932,9 +932,8 @@ void linphone_registration_faillure(LinphoneCore *lc, eXosip_event_t *ev){
const char *reason=NULL;
osip_uri_t *requri=osip_message_get_uri(ev->request);
char *ru;
LinphoneProxyConfig *cfg;
osip_uri_to_str(requri,&ru);
if (ev->response){
status_code=osip_message_get_status_code(ev->response);
reason=osip_message_get_reason_phrase(ev->response);
......@@ -945,14 +944,21 @@ void linphone_registration_faillure(LinphoneCore *lc, eXosip_event_t *ev){
linphone_process_authentication(lc,ev);
break;
case 403:
linphone_proxy_config_process_authentication_failure(lc,ev);
cfg=linphone_core_get_proxy_config_from_rid(lc,ev->rid);
/* if contact is up to date, process the failure, otherwise resend a new register with
updated contact first, just in case the faillure is due to incorrect contact */
if (!linphone_proxy_config_register_again_with_updated_contact(cfg,ev->request,ev->response)){
linphone_proxy_config_process_authentication_failure(lc,ev);
return;
}
default:
osip_uri_to_str(requri,&ru);
msg=ortp_strdup_printf(_("Registration on %s failed: %s"),ru,(reason!=NULL) ? reason : _("no response timeout"));
lc->vtable.display_status(lc,msg);
gstate_new_state(lc, GSTATE_REG_FAILED, msg);
ms_free(msg);
osip_free(ru);
}
osip_free(ru);
}
void linphone_registration_success(LinphoneCore *lc,eXosip_event_t *ev){
......
......@@ -32,10 +32,6 @@
#include "config.h"
#endif
#ifndef LINPHONE_VERSION
#define LINPHONE_VERSION "3.1.2"
#endif
#ifndef LIBLINPHONE_VERSION
#define LIBLINPHONE_VERSION LINPHONE_VERSION
#endif
......@@ -112,7 +108,7 @@ static inline void set_string(char **dest, const char *src){
}
#define PAYLOAD_TYPE_ENABLED PAYLOAD_TYPE_USER_FLAG_0
void linphone_proxy_config_register_again_with_updated_contact(LinphoneProxyConfig *obj, osip_message_t *orig_request, osip_message_t *last_answer);
bool_t linphone_proxy_config_register_again_with_updated_contact(LinphoneProxyConfig *obj, osip_message_t *orig_request, osip_message_t *last_answer);
void linphone_process_authentication(LinphoneCore* lc, eXosip_event_t *ev);
void linphone_authentication_ok(LinphoneCore *lc, eXosip_event_t *ev);
void linphone_subscription_new(LinphoneCore *lc, eXosip_event_t *ev);
......
......@@ -60,25 +60,25 @@ bool_t linphone_proxy_config_is_registered(const LinphoneProxyConfig *obj){
return obj->registered;
}
void linphone_proxy_config_register_again_with_updated_contact(LinphoneProxyConfig *obj, osip_message_t *orig_request, osip_message_t *last_answer){
bool_t linphone_proxy_config_register_again_with_updated_contact(LinphoneProxyConfig *obj, osip_message_t *orig_request, osip_message_t *last_answer){
osip_message_t *msg;
const char *rport,*received;
osip_via_t *via=NULL;
osip_generic_param_t *param=NULL;
osip_contact_t *ctt=NULL;
osip_message_get_via(last_answer,0,&via);
if (!via) return;
if (!via) return FALSE;
osip_via_param_get_byname(via,"rport",&param);
if (param) rport=param->gvalue;
else return;
else return FALSE;
param=NULL;
osip_via_param_get_byname(via,"received",&param);
if (param) received=param->gvalue;
else return;
else return FALSE;
osip_message_get_contact(orig_request,0,&ctt);
if (strcmp(ctt->url->host,received)==0 && (ctt->url->port!=0 && strcmp(ctt->url->port,rport)==0)){
ms_message("Register has up to date contact, doing nothing.");
return;
return FALSE;
}
eXosip_lock();
msg=NULL;
......@@ -95,6 +95,7 @@ void linphone_proxy_config_register_again_with_updated_contact(LinphoneProxyConf
eXosip_register_send_register(obj->rid,msg);
eXosip_unlock();
ms_message("Resending new register with updated contact %s:%s",received,rport);
return TRUE;
}
int linphone_proxy_config_set_server_addr(LinphoneProxyConfig *obj, const char *server_addr){
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment