26

I have just downloaded a video chat project. It uses a STUN server and specifies the URL stun:23.21.150.121. How can I use my own server instead of the STUN server? What do I have to enter instead of this URL?

knocte
  • 16,941
  • 11
  • 79
  • 125
Vicky
  • 1,412
  • 4
  • 18
  • 30
  • 2
    possible duplicate of [what is STUN stun.l.google.com:19302 used for](http://stackoverflow.com/questions/20067739/what-is-stun-stun-l-google-com19302-used-for) – Paul Mougel Nov 19 '13 at 10:27

4 Answers4

58

Actually there is no need to setup your own STUN or TURN servers, because there are a lot of public/semipublic servers. STUN from Google not always works very well.

This is my latest verified list (don't forget stun:/turn: scheme in URL):

{url:'stun:stun01.sipphone.com'},
{url:'stun:stun.ekiga.net'},
{url:'stun:stun.fwdnet.net'},
{url:'stun:stun.ideasip.com'},
{url:'stun:stun.iptel.org'},
{url:'stun:stun.rixtelecom.se'},
{url:'stun:stun.schlund.de'},
{url:'stun:stun.l.google.com:19302'},
{url:'stun:stun1.l.google.com:19302'},
{url:'stun:stun2.l.google.com:19302'},
{url:'stun:stun3.l.google.com:19302'},
{url:'stun:stun4.l.google.com:19302'},
{url:'stun:stunserver.org'},
{url:'stun:stun.softjoys.com'},
{url:'stun:stun.voiparound.com'},
{url:'stun:stun.voipbuster.com'},
{url:'stun:stun.voipstunt.com'},
{url:'stun:stun.voxgratia.org'},
{url:'stun:stun.xten.com'},
{
    url: 'turn:numb.viagenie.ca',
    credential: 'muazkh',
    username: 'webrtc@live.com'
},
{
    url: 'turn:192.158.29.39:3478?transport=udp',
    credential: 'JZEOEt2V3Qb0y27GRntt2u2PAYA=',
    username: '28224511:1379330808'
},
{
    url: 'turn:192.158.29.39:3478?transport=tcp',
    credential: 'JZEOEt2V3Qb0y27GRntt2u2PAYA=',
    username: '28224511:1379330808'
}

https://gist.github.com/yetithefoot/7592580

In case if you need your own STUN server, you can use this one written for Node.js, or find some here.

Also you can check this and this pages for better understanding.

Vlad Tsepelev
  • 2,056
  • 1
  • 21
  • 32
  • should we use this given credential? – Blake May 08 '14 at 12:27
  • To check ICE servers' working check: https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/ – Devaroop Jul 18 '16 at 12:37
  • 27
    This answer is VERY misleading. You can't really find any free TURN servers, and you will need TURN for a commercial product. Run your own or buy it as a service. Use free STUN servers only if this is a proof of concept or a hobby – Tsahi Levent-Levi Mar 29 '17 at 19:03
  • 1
    @TsahiLevent-Levi What is the problem with [this one](http://numb.viagenie.ca)? It still works after 4 years and I have tested it using [this answer](https://stackoverflow.com/a/34033938/1533609) – bugwheels94 Dec 04 '17 at 20:25
  • 2
    If it scales in any decent way or offers the global optimized routing real services needs then I'll be VERY surprised. It also comes with 0 SLA or guarantees and you don't really know what's its downtime. There are only to alternatives here if you're serious about what you are doing: 1. Deploy and maintain your own 2. Pay for the NAT traversal service you are using – Tsahi Levent-Levi Dec 05 '17 at 21:21
  • @Vlad Tsepelev If my client requirement is to use our own TURN server, where should I host it? On the network with firewall? Or on the cloud? If on cloud, which is best option for cloud hosting? – Aakash Patel Mar 08 '19 at 05:02
  • 5
    -1 because this answer basically encourages stealing other people's quota because they left their TURN credentials unchanged. There are many public free STUN servers (for example Google's), but not really for TURN. You can read more relevant info in [this article](https://bloggeek.me/google-free-turn-server/). – Thomas Orlita Jun 02 '19 at 14:44
  • Hi, does anyone know if these public servers have limits? I and wondering if it would be possible to query these servers too often and get our services blocked for running queries? More specifically the stun.l.google.com servers. Thanks – Dieskim Mar 03 '22 at 03:26
5

EmerCoin has large list of public STUN servers: http://enumer.org/public-stun.txt You can use any of them.

olegarch
  • 3,670
  • 1
  • 20
  • 19
  • 3
    To check ICE servers' working check: https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/ – Devaroop Jul 18 '16 at 12:37
4

This is the new way to config STUN and TURN in RTCPeerConnection initialization. Below is the working mode from apprtc.appspot.com

var peerConnectionConfig = {
  iceServers:[
    {urls: ["turn:173.194.72.127:19305?transport=udp",
       "turn:[2404:6800:4008:C01::7F]:19305?transport=udp",
       "turn:173.194.72.127:443?transport=tcp",
       "turn:[2404:6800:4008:C01::7F]:443?transport=tcp"
       ],
     username:"CKjCuLwFEgahxNRjuTAYzc/s6OMT",
     credential:"u1SQDR/SQsPQIxXNWQT7czc/G4c="
    },
    {urls:["stun:stun.l.google.com:19302"]}
  ]};

More info here

Devaroop
  • 7,900
  • 2
  • 37
  • 34
3

There are a few options to set up your own stun server. There is the rfc5766-turn-server. Once you set it up on your server, you can use that server's IP address and port you have set it to listen to. You will need some basic linux sysadmin knowledge for this.

Munim
  • 6,310
  • 2
  • 35
  • 44
  • 1
    we are using only windows 8 – Vicky Nov 19 '13 at 11:17
  • @Vicky I think you can find a server which runs on Windows 8, but I wouldn't go that way. I think its best if you use a public stun server, like Google's. – Munim Nov 19 '13 at 11:29
  • 1
    @Vicky - STUNTMAN (www.stunprotocol.org) has a Windows port via Cygwin that works on Windows 8. You are welcome to give that a try. – selbie Nov 25 '13 at 10:42
  • restund is another good alterative, but yeah you'll need cygwin – ggez44 Mar 29 '16 at 18:47
  • For windows you can use [IceLink](https://www.frozenmountain.com/products/icelink) they have a .net SDK – mark gamache May 30 '16 at 01:16
  • To check ICE servers' working check: https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/ – Devaroop Jul 18 '16 at 12:37
  • i downloaded one video chat example but it contains url: ('stun:stun1.l.google.com:19302') and (url: 'turn:numb.viagenie.ca', credential: 'muazkh', username: 'webrtc@live.com') when i removed turn and also it working,may i know i need to use these both or onlyone.. is it open source??Is there any issues will occur for using these STUN and TURN\ – heart hacker Nov 15 '17 at 10:00