prevent double registration by config

This commit is contained in:
Simon Morlat 2011-02-02 12:33:46 +01:00
parent e7f46ddfbb
commit fcf4cf44b2
4 changed files with 11 additions and 0 deletions

View file

@ -575,6 +575,7 @@ static void sip_config_read(LinphoneCore *lc)
lc->sip_conf.keepalive_period=lp_config_get_int(lc->config,"sip","keepalive_period",10000);
sal_set_keepalive_period(lc->sal,lc->sip_conf.keepalive_period);
sal_use_one_matching_codec_policy(lc->sal,lp_config_get_int(lc->config,"sip","only_one_codec",0));
sal_use_double_registrations(lc->sal,lp_config_get_int(lc->config,"sip","use_double_registrations",1));
}
static void rtp_config_read(LinphoneCore *lc)

View file

@ -257,6 +257,7 @@ void sal_set_keepalive_period(Sal *ctx,unsigned int value);
* */
unsigned int sal_get_keepalive_period(Sal *ctx);
void sal_use_session_timers(Sal *ctx, int expires);
void sal_use_double_registrations(Sal *ctx, bool_t enabled);
void sal_use_one_matching_codec_policy(Sal *ctx, bool_t one_matching_codec);
int sal_iterate(Sal *sal);
MSList * sal_get_pending_auths(Sal *sal);

View file

@ -264,6 +264,7 @@ Sal * sal_init(){
eXosip_init();
sal=ms_new0(Sal,1);
sal->keepalive_period=30;
sal->double_reg=TRUE;
return sal;
}
@ -393,6 +394,10 @@ MSList *sal_get_pending_auths(Sal *sal){
return ms_list_copy(sal->pending_auths);
}
void sal_use_double_registrations(Sal *ctx, bool_t enabled){
ctx->double_reg=enabled;
}
static int extract_received_rport(osip_message_t *msg, const char **received, int *rportval){
osip_via_t *via=NULL;
osip_generic_param_t *param=NULL;
@ -1552,6 +1557,9 @@ static bool_t register_again_with_updated_contact(SalOp *op, osip_message_t *ori
char *tmp;
char port[20];
SalAddress *addr;
Sal *sal=op->base.root;
if (sal->double_reg==FALSE) return FALSE;
if (extract_received_rport(last_answer,&received,&rport)==-1) return FALSE;
osip_message_get_contact(orig_request,0,&ctt);

View file

@ -41,6 +41,7 @@ struct Sal{
int keepalive_period;
void *up;
bool_t one_matching_codec;
bool_t double_reg;
};
struct SalOp{