tigase / Martin

(M) Martin - XMPP client library for Swift
Other
69 stars 27 forks source link

Video call from iOS to Android not working #14

Closed molobala closed 3 years ago

molobala commented 3 years ago

With the Siskin IM app we have trouble to make a video call to an Android device due to the fact that JingleModule in Android library has no JingleMessageInitiationEvent, so initiating call failed instantly.

We tried to use iq instead of chat message to initiate call, but the problem persists, the Android receive no iq event from iOS.

Bellow the code we use to initiate the call:


self.generateLocalDescription(completionHandler: { result in
  switch result {
    case .failure(_):
        self.reset();
    case .success(let sdp):
        if let session = JingleManager.instance.open(for: client.sessionObject, with: JID(call.jid), sid: call.sid, role: .initiator, initiationType: .iq) {
            session.delegate = self;

            Log.log("SessionId::", session.id, call.jid, call.sid)
            call.sessionId = session.id;
            session.initiate(contents: sdp.contents, bundle: nil, completionHandler: nil);
        } else {
            completionHandler(.failure(ErrorCondition.conflict));
        }
  }
})

Note that when passing call from Android to iOS there's no problem.

hantu85 commented 3 years ago

Most likely the issue is with with: JID(call.jid) as you are passing (if I'm correct) a bare JID (ie. user@example.com) for <iq/> based Jingle message exchange and that will not work as <iq/> stanzas are routed to the XMPP clients if they are addressed to the client's full JID (ie. user@example.com/res-1).

In this case, you need to fetch the full JID of the remote client (most likely from PresenceStore) and use this value as a with parameter value.

molobala commented 3 years ago

You are completely right.
That's what we did and everything went well.

Thank you.