0

I have already implemented chat through xmpp with openfire server and it is working fine. Now i want to implement audio/video call in my app and i don't want to use any other third party library/service like Socket.IO, websockets etc. I want to implement it with the help of XMPP's jingle extension itself. I did lot of R&D but didn't find anything useful and I don't know where to start.

So if anyone has already implemented it can you please provide me some example or demo ?

I have tried to initiate session by creating iq query but look like it is not working. Below is my code for initiating session.

func initiateSession() {
    
    let iq = XMPPIQ(type: "set", to: XMPPJID(string: "user5@localhost"), elementID: "zid615d9")
    
    let jingle = XMLElement(name: "jingle", xmlns: "urn:xmpp:jingle:1")
    
    jingle.addAttribute(withName: "action", stringValue: "session-initiate")
    jingle.addAttribute(withName: "initiator", stringValue: "user8@localhost")
    jingle.addAttribute(withName: "sid", stringValue: "a73sjjvkla37jfea")
    

    let iqProperties = XMLElement(name: "content")
    iqProperties.addAttribute(withName: "creator", stringValue: "initiator")
    iqProperties.addAttribute(withName: "name", stringValue: "this-is-a-stub")
    
    iqProperties.addChild(XMLElement(name: "description", xmlns: "urn:xmpp:jingle:apps:stub:0"))
    iqProperties.addChild(XMLElement(name: "transport", xmlns: "urn:xmpp:jingle:transports:stub:0"))

    jingle.addChild(iqProperties)
    
    iq.addChild(jingle)

    xmppStream.send(iq)
}
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

0 Answers0