]> sjero.net Git - linphone/commitdiff
prevent double registration by config
authorSimon Morlat <simon.morlat@linphone.org>
Wed, 2 Feb 2011 11:33:46 +0000 (12:33 +0100)
committerSimon Morlat <simon.morlat@linphone.org>
Wed, 2 Feb 2011 11:33:46 +0000 (12:33 +0100)
coreapi/linphonecore.c
coreapi/sal.h
coreapi/sal_eXosip2.c
coreapi/sal_eXosip2.h

index db2548a8474ad33b904722e7c30c0abd24d726e0..4490bf451ce0cb926122cbed18d0a746b435c643 100644 (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)
index f20555b0a8ad8b3a64e66f414e66b3096fccc600..2f39c697cf3c3d4e108b699b770f8196527d05b8 100644 (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);
index b993d88bd8cacabc85b4d3e24524d5a8635e55f1..6c10d4c8937167cbc2c54a5bdf6f735089715310 100644 (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);
index 7d50ae823e3b5668f1a324e830435101264db4f7..c60a8128100ccfd7d93af0d375b3dae23fea16c1 100644 (file)
@@ -41,6 +41,7 @@ struct Sal{
        int keepalive_period;
        void *up;
        bool_t one_matching_codec;
+       bool_t double_reg;
 };
 
 struct SalOp{