Search code examples
iosswiftwebrtcjanus-gateway

Connecting to janus server always hangs with hangup message from janus


I have problem connecting to janus janus.plugin.videoroom plugin from iOS device using swift. Although every steps take place correctly but janus server send following message:

{
   "janus": "hangup",
   "session_id": 3201104494179497,
   "sender": 7759980289270843,
   "reason": "ICE failed"
}

and disconnect.

Debugging the messages of connecting to janus leads me to following:

1- RTCIceGatheringState never changes to Completed

2- The generated candidates are like following:

candidate:3215141415 1 udp 1686052607 w.x.y.z 57168 typ srflx raddr w.x.y.z rport 57168 generation 0 ufrag 340a network-id 1 network-cost 10

as you can see video and audio words are replaced by 1 and 0 respectively in the generated candidate.

Do you have any idea about these two observations!

And why janus send the "ICE failed" message?


Solution

  • I found that the reason of getting "hang up" message is because I did not set the received jsep (from janus) to my peerconnection. after setAnswer the jsep "hang up" message gone!

    1- RTCIceGatheringState never changes to Completed

    For the problem of not having "Completed" state For RTCIceGatheringState was because of "continualGatheringPolicy" options in configuring the peerConnection which was set to "gatherContinually" after setting that to "gatherOnce" the Completed state seen! :)

    2- The generated candidates are like following:

    It seem this is normal to have audio/video or 0/1