]> sjero.net Git - linphone/blobdiff - coreapi/linphonecore.c
fix bugs in conferencing/multiple calls
[linphone] / coreapi / linphonecore.c
index e8c159a12de94412104a0084065c02ac85fbd607..d1a84ba7f84388bc748b3c8d0cd3cb1933ce7393 100644 (file)
@@ -831,6 +831,7 @@ bool_t linphone_core_rtcp_enabled(const LinphoneCore *lc){
  */
 void linphone_core_set_download_bandwidth(LinphoneCore *lc, int bw){
        lc->net_conf.download_bw=bw;
+       if (linphone_core_ready(lc)) lp_config_set_int(lc->config,"net","download_bw",bw);
 }
 
 /**
@@ -848,6 +849,7 @@ void linphone_core_set_download_bandwidth(LinphoneCore *lc, int bw){
  */
 void linphone_core_set_upload_bandwidth(LinphoneCore *lc, int bw){
        lc->net_conf.upload_bw=bw;
+       if (linphone_core_ready(lc)) lp_config_set_int(lc->config,"net","upload_bw",bw);
 }
 
 /**
@@ -1495,6 +1497,12 @@ int linphone_core_set_sip_transports(LinphoneCore *lc, const LCSipTransports * t
                return 0;
        memcpy(&lc->sip_conf.transports,tr,sizeof(*tr));
 
+       if (linphone_core_ready(lc)){
+               lp_config_set_int(lc->config,"sip","sip_port",tr->udp_port);
+               lp_config_set_int(lc->config,"sip","sip_tcp_port",tr->tcp_port);
+               lp_config_set_int(lc->config,"sip","sip_tls_port",tr->tls_port);
+       }
+
        if (lc->sal==NULL) return 0;
        return apply_transports(lc);
 }
@@ -2304,6 +2312,10 @@ int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call)
                ms_message("ring stopped");
                lc->ringstream=NULL;
        }
+       if (call->ringing_beep){
+               linphone_core_stop_dtmf(lc);
+               call->ringing_beep=FALSE;
+       }
 
        linphone_core_get_default_proxy(lc,&cfg);
        dest_proxy=cfg;
@@ -2361,10 +2373,6 @@ static void terminate_call(LinphoneCore *lc, LinphoneCall *call){
                lc->ringstream=NULL;
        }
 
-       /*stop any dtmf tone still playing */
-       ms_message("test");
-       linphone_core_stop_dtmf(lc);
-
        linphone_call_stop_media_streams(call);
        if (lc->vtable.display_status!=NULL)
                lc->vtable.display_status(lc,_("Call ended") );
@@ -3686,11 +3694,14 @@ void linphone_core_set_record_file(LinphoneCore *lc, const char *file){
 
 static MSFilter *get_dtmf_gen(LinphoneCore *lc){
        LinphoneCall *call=linphone_core_get_current_call (lc);
+       AudioStream *stream=NULL;
        if (call){
-               AudioStream *stream=call->audiostream;
-               if (stream){
-                       return stream->dtmfgen;
-               }
+               stream=call->audiostream;
+       }else if (linphone_core_is_in_conference(lc)){
+               stream=lc->conf_ctx.local_participant;
+       }
+       if (stream){
+               return stream->dtmfgen;
        }
        if (lc->ringstream==NULL){
                float amp=0.1;
@@ -3739,7 +3750,7 @@ void linphone_core_play_tone(LinphoneCore *lc){
        def.duration=300;
        def.frequency=500;
        def.amplitude=1;
-       def.interval=800;
+       def.interval=2000;
        ms_filter_call_method(f, MS_DTMF_GEN_PLAY_CUSTOM,&def);
 }
 
@@ -3845,8 +3856,6 @@ int linphone_core_get_current_call_stats(LinphoneCore *lc, rtp_stats_t *local, r
 void net_config_uninit(LinphoneCore *lc)
 {
        net_config_t *config=&lc->net_conf;
-       lp_config_set_int(lc->config,"net","download_bw",config->download_bw);
-       lp_config_set_int(lc->config,"net","upload_bw",config->upload_bw);
 
        if (config->stun_server!=NULL){
                lp_config_set_string(lc->config,"net","stun_server",config->stun_server);
@@ -3869,9 +3878,7 @@ void sip_config_uninit(LinphoneCore *lc)
        MSList *elem;
        int i;
        sip_config_t *config=&lc->sip_conf;
-       lp_config_set_int(lc->config,"sip","sip_port",config->transports.udp_port);
-       lp_config_set_int(lc->config,"sip","sip_tcp_port",config->transports.tcp_port);
-       lp_config_set_int(lc->config,"sip","sip_tls_port",config->transports.tls_port);
+       
        lp_config_set_int(lc->config,"sip","guess_hostname",config->guess_hostname);
        lp_config_set_string(lc->config,"sip","contact",config->contact);
        lp_config_set_int(lc->config,"sip","inc_timeout",config->inc_timeout);
@@ -3881,15 +3888,12 @@ void sip_config_uninit(LinphoneCore *lc)
        lp_config_set_int(lc->config,"sip","register_only_when_network_is_up",config->register_only_when_network_is_up);
 
 
-       lp_config_set_int(lc->config,"sip","default_proxy",linphone_core_get_default_proxy(lc,NULL));
+       
 
        for(elem=config->proxies,i=0;elem!=NULL;elem=ms_list_next(elem),i++){
                LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)(elem->data);
-               linphone_proxy_config_write_to_config_file(lc->config,cfg,i);
                linphone_proxy_config_edit(cfg);        /* to unregister */
        }
-       /*to ensure remove configs are erased:*/
-       linphone_proxy_config_write_to_config_file(lc->config,NULL,i);
 
        for (i=0;i<20;i++){
                sal_iterate(lc->sal);
@@ -3906,11 +3910,6 @@ void sip_config_uninit(LinphoneCore *lc)
 
        linphone_proxy_config_write_to_config_file(lc->config,NULL,i);  /*mark the end */
 
-       for(elem=lc->auth_info,i=0;elem!=NULL;elem=ms_list_next(elem),i++){
-               LinphoneAuthInfo *ai=(LinphoneAuthInfo*)(elem->data);
-               linphone_auth_info_write_config(lc->config,ai,i);
-       }
-       linphone_auth_info_write_config(lc->config,NULL,i); /* mark the end */
        ms_list_for_each(lc->auth_info,(void (*)(void*))linphone_auth_info_destroy);
        ms_list_free(lc->auth_info);
        lc->auth_info=NULL;