save some config parameter sooner.
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.
*
}
}
ms_list_free(l);
+ write_auth_infos(lc);
}
* 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);
}
}
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);
}
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,¶ms);
add_local_endpoint(conf,lc);
}else{
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){
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);
*/
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);
}
/**
*/
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);
}
/**
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);
}
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;
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") );
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;
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);
}
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);
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);
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);
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;
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;
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){
if (lc->default_proxy==cfg){
lc->default_proxy=NULL;
}
+ linphone_proxy_config_write_all_to_config_file(lc);
}
/**
* Erase all proxies from config.
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.
}
}
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){
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 */
}
-Subproject commit d9957eac4e4409b1eccc65c59b3851542582b718
+Subproject commit 188a736305a526b34daf454f6f6581fce38ea589
-Subproject commit 845e0cf4e33cc9964c48aa9191005d4108dfebbd
+Subproject commit 443580aabf873e1b30b39909d38ddaecf6ec0871