]> sjero.net Git - linphone/commitdiff
Reject incoming calls from people already in call with.
authorGuillaume Beraudo <guillaume.beraudo@belledonne-communications.com>
Wed, 26 Oct 2011 11:11:44 +0000 (13:11 +0200)
committerGuillaume Beraudo <guillaume.beraudo@belledonne-communications.com>
Wed, 26 Oct 2011 11:11:44 +0000 (13:11 +0200)
Note that the other call will change state to paused by other.

coreapi/callbacks.c
java/common/org/linphone/core/LinphoneCore.java

index dc03944a54e9c2f0dac99eac241c79e9c21a87aa..6cee4473d51a3267f5ca9a50670ed1fefac6a6b8 100644 (file)
@@ -108,6 +108,21 @@ static bool_t is_duplicate_call(LinphoneCore *lc, const LinphoneAddress *from, c
 }
 #endif
 
+static bool_t already_a_call_with_remote_address(const LinphoneCore *lc, const LinphoneAddress *remote) {
+       ms_warning(" searching for already_a_call_with_remote_address.");
+
+       MSList *elem;
+       for(elem=lc->calls;elem!=NULL;elem=elem->next){
+               const LinphoneCall *call=(LinphoneCall*)elem->data;
+               const LinphoneAddress *cRemote=linphone_call_get_remote_address(call);
+               if (linphone_address_weak_equal(cRemote,remote)) {
+                       ms_warning("already_a_call_with_remote_address found.");
+                       return TRUE;
+               }
+       }
+       return FALSE;
+}
+
 static bool_t already_a_call_pending(LinphoneCore *lc){
        MSList *elem;
        for(elem=lc->calls;elem!=NULL;elem=elem->next){
@@ -161,7 +176,7 @@ static void call_received(SalOp *h){
        from_addr=linphone_address_new(from);
        to_addr=linphone_address_new(to);
 
-       if (already_a_call_pending(lc)){
+       if (already_a_call_with_remote_address(lc,from_addr) || already_a_call_pending(lc)){
                ms_warning("Receiving another call while one is ringing or initiated, refusing this one with busy message.");
                sal_call_decline(h,SalReasonBusy,NULL);
                sal_op_release(h);
index 88f1be6fff35ac58ccfdf000f2b4766f62d65549..0d560f4e2648600c93f6e8b3bcd5bf050a41cb36 100644 (file)
@@ -623,5 +623,6 @@ public interface LinphoneCore {
        LinphoneCall findCallFromUri(String uri);
 
        int getMaxCalls();
+       boolean isMyself(String uri);
 
 }