Implementing our own STUN/TURN server for WebRTC Application [duplicate]

TURN it's an extension of STUN, so TURN server has also STUN features.

https://code.google.com/p/rfc5766-turn-server/ works also as a STUN, so you can try to write something like this:

var pc_config = {
    "iceServers": [{
        "url":"turn:my_username@<turn_server_ip_address>",
        "credential":"my_password"
    }]
};
    
pc_new = new webkitRTCPeerConnection(pc_config);

Recently I was capturing my Kurento WebRTC server packets and realized that it has been using this www.stunprotocol.org domain for STUN requests. A tool named stuntman can create a simple STUN server for you.

Just follow these on a Linux host:

  1. sudo apt-get update
  2. sudo apt-get install stuntman-server
  3. stunserver --mode full --primaryinterface 100.101.102.103
    (which the 100.101.102.103 should be replaced by your IP address)
  4. Open This Link to test your STUN server.

e.g. STUN or TURN URI:

stun:100.101.102.103:3478

By this procedure I've mentioned, everything goes well on my machine.