Janus not able to resolve ice candidates on cellular data

700 views
Skip to first unread message

Ani Ravi

unread,
Apr 18, 2020, 8:47:54 PM4/18/20
to meetecho-janus
Hi all! I've tried absolutely everything I can think of but am unable to get Janus to work when the client is on cellular data.

Our config
We're trying to get a mobile app using react-native-webrtc to connect to Janus. Our use case for Janus is that we're using the videoroom plugin to have a broadcaster stream their mobile camera feed to Janus. We use https://github.com/atyenoria/janus-webrtc-gateway-docker for our base Janus configuration (with latest Janus and libnice), only modifying janus.jcfg to support IPv6, nat 1-1 mapping, tcp support and the HTTP cfg to add the admin API so I can give you the log I did below.

Problem
It works perfectly fine while on WiFi, but Janus is unable to connect with the publisher or any viewers as soon as they are on cellular data. We're located in the USA, and it happens on different cellular service providers, not just one.

Things we've tried
We've tried running our own stun/turn server as well as using third-party ones and it works fine on WiFi with any Janus configuration we use or change. However, none of those configurations work with cellular data. On WiFi, since I am behind a router, the client does generate ice candidates of the "srflx" type. On cellular, the client only generates ice candidates with the "host" type and does not communicate with the stun/turn servers.

I've looked across other issues in this group that have suggested the same problem, and thought it might be a TURN server issue. After setting one up, it didn't address the issue, however our TURN server is definitely working correctly because it works on WiFi and we can see it retrieving the proper info/streaming as usual.

We wanted to make sure it wasn't a client problem, so we also did a "peer-to-peer" video chat between two phones purely with the client webrtc peerconnection and not Janus, which works fine on cellular data. It's specifically Janus that appears to be failing to connect, and we're not sure why. We would really appreciate any help or thoughts on this! Thank you so much. Janus is a super cool project and this is the final piece we need working. What you guys are doing is really cool.

Logs
The following are logs (please note my public IP has been scrubbed and replaced with "PUBLIC_IP"):
https://pastebin.com/BADa6pR1 (successful connection on wifi)
https://pastebin.com/gTgZi1q5 (failed connection on cellular, sometimes continues to gather or state is "failed" with basically the same information)

Mirko Brankovic

unread,
Apr 19, 2020, 7:39:10 AM4/19/20
to meetecho-janus
As you can see from the logs, on wifi, your client is in same lan as janus, and possible as turn/stun, so they are reachable trough host/udp candidate. Which you can see by this:
"selected-pair": "192.168.0.111:39414 [host,udp] <-> 192.168.0.105:46966 [host,udp]"

But nevertheless your client managed to get srflx on that network, which means connection to stun from iceServers worked

On cellular data there is no srflx candidate gathered and host candidate obviously can't work.
Just figure out is you client able to reach stun you provided? Try with google stun, 
stun.l.google.com:19302

I don't think client should be filtering them out or have different PC constraints based on network connections

--
You received this message because you are subscribed to the Google Groups "meetecho-janus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to meetecho-janu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/meetecho-janus/b30bf39c-0265-471a-b302-f88e8760f63b%40googlegroups.com.

Ani Ravi

unread,
Apr 19, 2020, 4:23:27 PM4/19/20
to meetecho-janus
Thank you for the response! I thought something was weird about the fact that it was only generating host candidates too so I investigated further, and I figured it out! Just in case anyone else is looking at this issue and stumbled upon the same problem - while on cellular data, I used Google's STUN server and it indeed generated some srflx candidates instead of only host candidates, but it still wasn't working (https://pastebin.com/wZ4WkReq, my public IP is replaced with "PUBLIC_IPV4"). The mobile client never reached our TURN server, and I was wondering why. It turns out that passing an IP address wasn't working in the iceServers list on the mobile client (works on WiFi, but not on cellular data). I specifically had to give the client the DNS of the server that was running our TURN server, and it started working in all cases.

So in summary, yes, you probably need a TURN server for it to work on cellular data and many other scenarios. You can deploy your own by setting up a Linux distro in the cloud and install coturn.

Thank you again!
To unsubscribe from this group and stop receiving emails from it, send an email to meetech...@googlegroups.com.

Ben Davenport

unread,
Apr 20, 2020, 10:10:21 AM4/20/20
to Ani Ravi, meetecho-janus
Have you tried implementing TURN over TLS? Configure your TURN server to listen for TCP on 443 and specify the turns (note the S at the end) propety of the iceServers array in your peer connection.

--
You received this message because you are subscribed to the Google Groups "meetecho-janus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to meetecho-janu...@googlegroups.com.

Ani Ravi

unread,
Apr 22, 2020, 6:33:36 PM4/22/20
to meetecho-janus
I haven't yet! It's working without it but I'll look into it so we can support more configurations.
To unsubscribe from this group and stop receiving emails from it, send an email to meetech...@googlegroups.com.

Ben Davenport

unread,
Apr 22, 2020, 6:35:29 PM4/22/20
to Ani Ravi, meetecho-janus
Hey Ani,

Yes, utilizing something like coturn for STUN, TURN, and TURNS is pretty crucial for production-grade. Could you please share with the group what ended up changing to get mobile to work over cellular in your case?


To unsubscribe from this group and stop receiving emails from it, send an email to meetecho-janu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/meetecho-janus/b3640a0a-1c68-4e5c-90dd-7f044c200889%40googlegroups.com.

Ani Ravi

unread,
Apr 23, 2020, 1:06:40 AM4/23/20
to meetecho-janus
Hey Ben! Sorry, not super familiar with Google Groups. Are you able to see my response where I mentioned how I got it working? I just had to put a coturn instance on EC2 and give my client the credentials to connect to it. Worked fine after that! I needed a TURN server for it to work over cellular, and up until that point, I had only tried STUN servers.

Ben Davenport

unread,
Apr 23, 2020, 9:43:37 AM4/23/20
to Ani Ravi, meetecho-janus
No worries, now I see the reply you mentioned when I visit the group thread directly (I typically just use email for it). Thanks!

To unsubscribe from this group and stop receiving emails from it, send an email to meetecho-janu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/meetecho-janus/4180d978-7e35-4692-8c4f-92370b00f2ef%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages