Search code examples
iosopentok

CallKit using with OpenTok


I using Opentok with call kit for audio & video calling. Everything is working fine, but I am facing the issue when receiver rejects the call then the caller didn’t get notified that the receiver has rejected the call or if caller end call before picking the call same receiver didn't get notified that call has disconnected the call. If the receiver has been disconnected the call then the caller should get notified instantly. If anyone has the solution for this please suggest me. Thanks


Solution

  • You can notifiy to caller with signal. when receiver end the call then pass signal.

    Session.sendSignal("type", "message", Connection);
    

    At the receiver end To start receiving all signals, call the setSignalListener(Session.SignalListener listener) method of the Session object, passing in an object that implements the Session.SignalListener interface:

    Session.setSignalListener(this);
    

    The onSignalReceived(Session session, String type, String data, Connection connection) method of the SignalListener object is called when a signal is received in the session:

    protected void onSignalReceived(Session session, String type, String data, Connection connection) {
    String myConnectionId = session.getConnection().getConnectionId();
    if (connection != null && connection.getConnectionId().equals(myConnectionId)) {
        // Signal received from another client
    }
    

    }