CometChat.getActiveCall() on target user

I tried to block any new call when the initiator and the target is in call by using CometChat.getActiveCall() --> let’s say it is “the function”

In ringing state:

  • “the function” returned not null on the initiator, but
  • it returned null on the target.

So, the initiator could block any new call, but the target could not block any new call before he/she accepted the call. What should I do?

Hello @hilmyas,
At the initiator’s end, the active call for the SDK is set as soon as the call is initiated successfully. However, for the receiver of the call, the active call is set once the receiver accepts the call. This is done as at the receiver’s end if the user is not available at that point of time, the call cannot be marked as active as the real-time events wont be received.
In this case, this can be easily handled at your end. All you need to do is on the calling screen maintain a flag at your end if there is an incoming call already, if the flag is true, you can reject the second incoming call using the CometChat.rejectCall() method provided by the SDK.
Hope this answers your question. IF you have any more doubts, please do let us know and we will be happy to help you.

2 Likes

OK, thank you so much

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.