diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 888765c98..cdb07e589 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -5250,6 +5250,8 @@ LinphoneStatus linphone_call_resume(LinphoneCall *call) { static void terminate_call(LinphoneCall *call) { LinphoneCore *lc = linphone_call_get_core(call); + const bctbx_list_t *calls = linphone_core_get_calls(lc); + bool_t stop_ringing = true; if ((call->state == LinphoneCallIncomingReceived) && (linphone_error_info_get_reason(call->ei) != LinphoneReasonNotAnswered)){ linphone_error_info_set_reason(call->ei, LinphoneReasonDeclined); @@ -5257,7 +5259,16 @@ static void terminate_call(LinphoneCall *call) { } /* Stop ringing */ - linphone_core_stop_ringing(lc); + while(calls) { + if (((LinphoneCall *)calls->data)->state == LinphoneCallIncomingReceived) { + stop_ringing = false; + break; + } + calls = calls->next; + } + if(stop_ringing) { + linphone_core_stop_ringing(lc); + } linphone_call_stop_media_streams(call); #ifdef BUILD_UPNP