TURN server configuration for 3G mobile connection

581 views
Skip to first unread message

Federico Pici

unread,
Jan 3, 2014, 3:59:52 AM1/3/14
to eas...@googlegroups.com
Hi,
i'm new to easyrtc. Before making this question i have tried to read everything i can find on web....but have no luck.

I am setting up a little application using latest easyrtc (v1.0.7) and latest node.js.
I am able to start a video/audio call between device under my home network (phone to desktop, phone to tablet, and so on...).
If I try to make a call from my phone under 3G connection and my desktop browser (both using chrome) I obtain the classic black screen even if i successfully get into success function callback in method easyrtc.call.

I have read that many carriers block in some way traffic, and that this kind of problem may be resolved by using a TURN server for relaying.
So i have made a free subscription to "numb.viagenie.ca" and to "turn.anyfirewall.com". I have added another line to easyrtc_default_options.js in option.appIceServers object

{
        username: "XXXXX",
        credential: "YYYYY"
}

and obtained an error (popup in browser) telling "turn server url looked like turn:turn.anyfirewall.com:3478?transport=udp" with a split error on line 3811 of easyrtc.js file

If i change url format removing initial "turn:" previous error goes away but i get "RTCPeerConnection constructor passed invalid RTCConfiguration - improper scheme: turn.anyfirewall.com""

Trying different schemas (i.e.: removing port or transport) give me same results.

So the question is: how can i correctly use a TURN server to make my call work under 3g connection?

Thank you for your help.

Federico

Federico Pici

unread,
Jan 3, 2014, 6:24:48 AM1/3/14
to eas...@googlegroups.com
Just an update.
Everything works fine using tawk.com example....

Eric Davies

unread,
Jan 3, 2014, 11:30:47 AM1/3/14
to eas...@googlegroups.com
Hi Federico,

If you are seeing the error "turn server url looked like turn:turn.anyfirewall.com:3478?transport=udp" , it means that in one of your ice server entries you haven't supplied a username field AND you didn't supply a username with the old  url:"username@address" syntax. In retrospect, it's a really uninformative error message (for which I apologize as the author of said error message) so in the next release we push out, the error message will look like:   "Iceserver entry doesn't have a username:  " + JSON.stringify(entry) . 

That said, udp is the transport used when you don't specify "?transport=...", so
is actually equivalent to
     url:"turn:turn.anyfirewall.com:3478"

And udp is often blocked by 3G and 4G networks. So what you actually want is:

Port 443 is usually used for https, so it's unlikely to be blocked.

Federico Pici

unread,
Jan 3, 2014, 1:00:17 PM1/3/14
to eas...@googlegroups.com
Hi Eric,
thank you for your reply.
I have tryied to use both syntax "username@address" and "username" attribute. 

option.appIceServers = [ 
    {'url':'stun:stun.anyfirewall.com:3478'},
    {'url':'turn:turn.anyfirewall.com:3478?transport=udp', 'username': 'pici01', 'credential':'pici01'},
    {'url':'turn:turn.anyfirewall.com:443?transport=tcp', 'username': 'pici01', 'credential': 'pici01'}
];

cause an error "Uncaught TypeError: Cannot call method 'split' of undefined" in chrome console and a popup with "urn server url looked like turn:turn.anyfirewall.com:3478?transport=udp"

while using

option.appIceServers = [                                  
    {'url':'stun:stun.anyfirewall.com:3478'},
];

cause this error "TCPeerConnection constructor passed invalid RTCConfiguration - improper scheme: turn.anyfirewall.com" )in firefox console) or "The type of an object was incompatible with the expected type of the parameter associated to the object." in chrome console

It looks like a simple task, but i am not understanding why it fails. I even tried with "numb.viagenie.ca" and i have same problems.

Hope you can help me.

Thank you again

Federico

Eric Davies

unread,
Jan 3, 2014, 7:44:42 PM1/3/14
to eas...@googlegroups.com
Hi Federico,

A few thoughts:
  1) Use the new form, not the old form   
               ie, use   {url:'turn:turn.anyfirewall.com:3478?transport=tcp', username:'pici01' ,credential:'pici01'}

  2) I've just pushed a new copy of easyrtc.js client library to the beta branch. The new copy has the improved error message that shows you the entire text for the offending entry. Pull it down and install.

  3) I'm not the expert on the server side, but your option.appIceServers line looks suspicious to me. See the docs for the current way of setting your ice configuration 
      
https://github.com/priologic/easyrtc/blob/master/docs/easyrtc_server_ice.md
     The added text goes into your server.js. This resolved the problems of the last person who had turn server issues.

  4) Firefox used to choke on "?transport=tcp" terms, so easyrtc currently filters out turn server entries using such on firefox. This may not be still necessary. I'd suggest doing your testing with Chrome, and only try out Firefox when the Chrome is working.

  5) Be aware that you need to restart the server after changing your ice configuration. 

Eric.

Reply all
Reply to author
Forward
0 new messages