From 11ea1b9ec22b4d81b96cb2f0e2221b70cfa1625e Mon Sep 17 00:00:00 2001
From: Simon Morlat <simon.morlat@linphone.org>
Date: Mon, 13 Sep 2010 09:37:48 +0200
Subject: [PATCH] set current_call to unique call for incoming calls

---
 coreapi/callbacks.c    | 1 +
 coreapi/linphonecore.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c
index 6fbb566dc2..a980b51b12 100644
--- a/coreapi/callbacks.c
+++ b/coreapi/callbacks.c
@@ -97,6 +97,7 @@ static void call_received(SalOp *h){
 
 	/* play the ring if this is the only call*/
 	if (lc->sound_conf.ring_sndcard!=NULL && 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;
diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c
index 9353a7fc57..4b79993eb1 100644
--- a/coreapi/linphonecore.c
+++ b/coreapi/linphonecore.c
@@ -2118,7 +2118,7 @@ int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call)
 			call = (LinphoneCall*)linphone_core_get_calls(lc)->data;
 	}
 
-	if (lc->current_call){
+	if (lc->current_call!=NULL && lc->current_call!=call){
 		ms_warning("Cannot accept this call, there is already one running.");
 		return -1;
 	}
-- 
GitLab