Commit ba323197 authored by Simon Morlat's avatar Simon Morlat
Browse files

fix bugs in conferencing/multiple calls

save some config parameter sooner.
parent e50de2a2
......@@ -237,6 +237,18 @@ const LinphoneAuthInfo *linphone_core_find_auth_info(LinphoneCore *lc, const cha
return ret;
}
static void write_auth_infos(LinphoneCore *lc){
MSList *elem;
int i;
if (!linphone_core_ready(lc)) return;
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 */
}
/**
* Adds authentication information to the LinphoneCore.
*
......@@ -273,6 +285,7 @@ void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info)
}
}
ms_list_free(l);
write_auth_infos(lc);
}
......@@ -287,18 +300,13 @@ void linphone_core_abort_authentication(LinphoneCore *lc, LinphoneAuthInfo *inf
* Removes an authentication information object.
**/
void linphone_core_remove_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info){
int i;
MSList *elem;
LinphoneAuthInfo *r;
r=(LinphoneAuthInfo*)linphone_core_find_auth_info(lc,info->realm,info->username);
if (r){
lc->auth_info=ms_list_remove(lc->auth_info,r);
/*printf("len=%i newlen=%i\n",len,newlen);*/
linphone_auth_info_destroy(r);
for (elem=lc->auth_info,i=0;elem!=NULL;elem=ms_list_next(elem),i++){
linphone_auth_info_write_config(lc->config,(LinphoneAuthInfo*)elem->data,i);
}
linphone_auth_info_write_config(lc->config,NULL,i);
write_auth_infos(lc);
}
}
......
......@@ -194,24 +194,27 @@ static void call_received(SalOp *h){
lc->vtable.display_status(lc,barmesg);
/* play the ring if this is the only call*/
if (lc->sound_conf.ring_sndcard!=NULL && ms_list_size(lc->calls)==1){
if (ms_list_size(lc->calls)==1){
lc->current_call=call;
if (lc->ringstream && lc->dmfs_playing_start_time!=0){
ring_stop(lc->ringstream);
lc->ringstream=NULL;
lc->dmfs_playing_start_time=0;
}
if(lc->ringstream==NULL && lc->sound_conf.local_ring){
MSSndCard *ringcard=lc->sound_conf.lsd_card ?lc->sound_conf.lsd_card : lc->sound_conf.ring_sndcard;
ms_message("Starting local ring...");
lc->ringstream=ring_start(lc->sound_conf.local_ring,2000,ringcard);
}
else
{
ms_message("the local ring is already started");
if (lc->sound_conf.ring_sndcard!=NULL){
if(lc->ringstream==NULL && lc->sound_conf.local_ring){
MSSndCard *ringcard=lc->sound_conf.lsd_card ?lc->sound_conf.lsd_card : lc->sound_conf.ring_sndcard;
ms_message("Starting local ring...");
lc->ringstream=ring_start(lc->sound_conf.local_ring,2000,ringcard);
}
else
{
ms_message("the local ring is already started");
}
}
}else{
/* play a tone within the context of the current call */
/* else play a tone within the context of the current call */
call->ringing_beep=TRUE;
linphone_core_play_tone(lc);
}
......
......@@ -129,8 +129,12 @@ int linphone_core_add_to_conference(LinphoneCore *lc, LinphoneCall *call){
linphone_core_resume_call(lc,call);
else if (call->state==LinphoneCallStreamsRunning){
/*this will trigger a reINVITE that will later redraw the streams */
if (call->audiostream || call->videostream)
if (call->audiostream || call->videostream){
linphone_call_stop_media_streams (call); /*free the audio & video local resources*/
}
if (call==lc->current_call){
lc->current_call=NULL;
}
linphone_core_update_call(lc,call,&params);
add_local_endpoint(conf,lc);
}else{
......
......@@ -351,7 +351,10 @@ static void linphone_call_set_terminated(LinphoneCall *call){
linphone_core_notify_all_friends(lc,lc->presence_mode);
linphone_core_conference_check_uninit(&lc->conf_ctx);
if (call->ringing_beep){
linphone_core_stop_dtmf(lc);
call->ringing_beep=FALSE;
}
}
const char *linphone_call_state_to_string(LinphoneCallState cs){
......@@ -1205,9 +1208,9 @@ void linphone_call_stop_media_streams(LinphoneCall *call){
video_stream_stop(call->videostream);
call->videostream=NULL;
}
ms_event_queue_skip(call->core->msevq);
#endif
ms_event_queue_skip(call->core->msevq);
if (call->audio_profile){
rtp_profile_clear_all(call->audio_profile);
rtp_profile_destroy(call->audio_profile);
......
......@@ -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;
......
......@@ -102,7 +102,7 @@ struct _LinphoneCall
bool_t all_muted; /*this flag is set during early medias*/
bool_t playing_ringbacktone;
bool_t owns_call_log;
bool_t pad;
bool_t ringing_beep; /* whether this call is ringing through an already existent current call*/
OrtpEvQueue *audiostream_app_evq;
char *auth_token;
OrtpEvQueue *videostream_app_evq;
......
......@@ -31,10 +31,15 @@ Copyright (C) 2000 Simon MORLAT (simon.morlat@linphone.org)
void linphone_proxy_config_write_all_to_config_file(LinphoneCore *lc){
MSList *elem;
int i;
if (!linphone_core_ready(lc)) return;
for(elem=lc->sip_conf.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);
}
/*to ensure removed configs are erased:*/
linphone_proxy_config_write_to_config_file(lc->config,NULL,i);
lp_config_set_int(lc->config,"sip","default_proxy",linphone_core_get_default_proxy(lc,NULL));
}
void linphone_proxy_config_init(LinphoneProxyConfig *obj){
......@@ -536,6 +541,7 @@ void linphone_core_remove_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *cf
if (lc->default_proxy==cfg){
lc->default_proxy=NULL;
}
linphone_proxy_config_write_all_to_config_file(lc);
}
/**
* Erase all proxies from config.
......@@ -548,6 +554,7 @@ void linphone_core_clear_proxy_config(LinphoneCore *lc){
linphone_core_remove_proxy_config(lc,(LinphoneProxyConfig *)list->data);
}
ms_list_free(list);
linphone_proxy_config_write_all_to_config_file(lc);
}
/**
* Sets the default proxy.
......@@ -566,7 +573,8 @@ void linphone_core_set_default_proxy(LinphoneCore *lc, LinphoneProxyConfig *conf
}
}
lc->default_proxy=config;
if (linphone_core_ready(lc))
lp_config_set_int(lc->config,"sip","default_proxy",linphone_core_get_default_proxy(lc,NULL));
}
void linphone_core_set_default_proxy_index(LinphoneCore *lc, int index){
......
......@@ -755,7 +755,6 @@ void linphone_gtk_decline_clicked(GtkWidget *button){
void linphone_gtk_answer_clicked(GtkWidget *button){
LinphoneCall *call=linphone_gtk_get_currently_displayed_call(NULL);
if (call){
linphone_core_pause_all_calls(linphone_gtk_get_core());
linphone_core_accept_call(linphone_gtk_get_core(),call);
linphone_gtk_show_main_window(); /* useful when the button is clicked on a notification */
}
......
mediastreamer2 @ 188a7363
Subproject commit d9957eac4e4409b1eccc65c59b3851542582b718
Subproject commit 188a736305a526b34daf454f6f6581fce38ea589
oRTP @ 443580aa
Subproject commit 845e0cf4e33cc9964c48aa9191005d4108dfebbd
Subproject commit 443580aabf873e1b30b39909d38ddaecf6ec0871
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