Commit 1b6da475 authored by Simon Morlat's avatar Simon Morlat
Browse files

fix potential problem with ringback beeing stopped automatically by mistake.

parent d8469f70
......@@ -89,10 +89,7 @@ void linphone_core_update_streams_destinations(LinphoneCore *lc, LinphoneCall *c
void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMediaDescription *new_md){
SalMediaDescription *oldmd=call->resultdesc;
if (lc->ringstream!=NULL){
ring_stop(lc->ringstream);
lc->ringstream=NULL;
}
linphone_core_stop_ringing(lc);
if (new_md!=NULL){
sal_media_description_ref(new_md);
call->media_pending=FALSE;
......@@ -302,12 +299,8 @@ static void call_ringing(SalOp *h){
md=sal_call_get_final_media_description(h);
if (md==NULL){
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) return; /*already ringing !*/
linphone_core_stop_dtmf_stream(lc);
if (lc->ringstream!=NULL) return;/*already ringing !*/
if (lc->sound_conf.play_sndcard!=NULL){
MSSndCard *ringcard=lc->sound_conf.lsd_card ? lc->sound_conf.lsd_card : lc->sound_conf.play_sndcard;
if (call->localdesc->streams[0].max_rate>0) ms_snd_card_set_preferred_sample_rate(ringcard, call->localdesc->streams[0].max_rate);
......@@ -331,10 +324,7 @@ static void call_ringing(SalOp *h){
if (lc->vtable.display_status)
lc->vtable.display_status(lc,_("Early media."));
linphone_call_set_state(call,LinphoneCallOutgoingEarlyMedia,"Early media");
if (lc->ringstream!=NULL){
ring_stop(lc->ringstream);
lc->ringstream=NULL;
}
linphone_core_stop_ringing(lc);
ms_message("Doing early media...");
linphone_core_update_streams(lc,call,md);
}
......@@ -552,8 +542,7 @@ static void call_terminated(SalOp *op, const char *from){
ms_message("Current call terminated...");
//we stop the call only if we have this current call or if we are in call
if (lc->ringstream!=NULL && ( (ms_list_size(lc->calls) == 1) || linphone_core_in_call(lc) )) {
ring_stop(lc->ringstream);
lc->ringstream=NULL;
linphone_core_stop_ringing(lc);
}
linphone_call_stop_media_streams(call);
if (lc->vtable.show!=NULL)
......@@ -657,10 +646,7 @@ static void call_failure(SalOp *op, SalError error, SalReason sr, const char *de
}
}
if (lc->ringstream!=NULL) {
ring_stop(lc->ringstream);
lc->ringstream=NULL;
}
linphone_core_stop_ringing(lc);
linphone_call_stop_media_streams (call);
if (call->referer && linphone_call_get_state(call->referer)==LinphoneCallPaused && call->referer->was_automatically_paused){
/*resume to the call that send us the refer automatically*/
......
......@@ -2138,9 +2138,7 @@ void linphone_core_iterate(LinphoneCore *lc){
if (lc->ringstream && lc->ringstream_autorelease && lc->dmfs_playing_start_time!=0
&& (curtime-lc->dmfs_playing_start_time)>5){
ring_stop(lc->ringstream);
lc->ringstream=NULL;
lc->dmfs_playing_start_time=0;
linphone_core_stop_dtmf_stream(lc);
}
sal_iterate(lc->sal);
......@@ -2831,9 +2829,7 @@ void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call){
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;
linphone_core_stop_dtmf_stream(lc);
}
if (lc->sound_conf.ring_sndcard!=NULL){
if(lc->ringstream==NULL && lc->sound_conf.local_ring){
......@@ -3192,9 +3188,7 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call,
/*stop ringing */
if (lc->ringstream!=NULL) {
ms_message("stop ringing");
ring_stop(lc->ringstream);
ms_message("ring stopped");
lc->ringstream=NULL;
linphone_core_stop_ringing(lc);
was_ringing=TRUE;
}
if (call->ringing_beep){
......@@ -3249,10 +3243,7 @@ int linphone_core_abort_call(LinphoneCore *lc, LinphoneCall *call, const char *e
sal_call_terminate(call->op);
/*stop ringing*/
if (lc->ringstream!=NULL) {
ring_stop(lc->ringstream);
lc->ringstream=NULL;
}
linphone_core_stop_ringing(lc);
linphone_call_stop_media_streams(call);
#ifdef BUILD_UPNP
......@@ -3271,10 +3262,7 @@ static void terminate_call(LinphoneCore *lc, LinphoneCall *call){
call->reason=LinphoneReasonDeclined;
}
/*stop ringing*/
if (lc->ringstream!=NULL) {
ring_stop(lc->ringstream);
lc->ringstream=NULL;
}
linphone_core_stop_ringing(lc);
linphone_call_stop_media_streams(call);
......@@ -3510,8 +3498,7 @@ void linphone_core_preempt_sound_resources(LinphoneCore *lc){
_linphone_core_pause_call(lc,current_call);
}
if (lc->ringstream){
ring_stop(lc->ringstream);
lc->ringstream=NULL;
linphone_core_stop_ringing(lc);
}
}
......@@ -5523,7 +5510,7 @@ static void linphone_core_uninit(LinphoneCore *lc)
sip_config_uninit(lc);
net_config_uninit(lc);
rtp_config_uninit(lc);
if (lc->ringstream) ring_stop(lc->ringstream);
linphone_core_stop_ringing(lc);
sound_config_uninit(lc);
video_config_uninit(lc);
codecs_config_uninit(lc);
......@@ -5834,10 +5821,18 @@ void linphone_core_start_dtmf_stream(LinphoneCore* lc) {
lc->ringstream_autorelease=FALSE; /*disable autorelease mode*/
}
void linphone_core_stop_dtmf_stream(LinphoneCore* lc) {
if (lc->ringstream && lc->dmfs_playing_start_time!=0) {
void linphone_core_stop_ringing(LinphoneCore* lc) {
if (lc->ringstream) {
ring_stop(lc->ringstream);
lc->ringstream=NULL;
lc->dmfs_playing_start_time=0;
lc->ringstream_autorelease=TRUE;
}
}
void linphone_core_stop_dtmf_stream(LinphoneCore* lc) {
if (lc->dmfs_playing_start_time!=0) {
linphone_core_stop_ringing(lc);
}
}
......
......@@ -757,7 +757,7 @@ void linphone_event_set_state(LinphoneEvent *lev, LinphoneSubscriptionState stat
void linphone_event_set_reason(LinphoneEvent *lev, LinphoneReason reason);
LinphoneSubscriptionState linphone_subscription_state_from_sal(SalSubscribeStatus ss);
const LinphoneContent *linphone_content_from_sal_body(LinphoneContent *obj, const SalBody *ref);
void linphone_core_stop_ringing(LinphoneCore *lc);
void linphone_core_invalidate_friend_subscriptions(LinphoneCore *lc);
#ifdef __cplusplus
......
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