Search code examples
webrtcstunltepeer

local stun server inside a closed LTE network


First of all, apologies if the title doesn't match the description.

We, in our organization are working on peer-peer video communication solution within a closedLTE network. For this purpose, we are using open source webrtc client peerjs along with their local peerjs server. The server by default refers to google stun server.

1. Is stun server required in case of closed LTE network?
2. If yes, can we make use of a open source stun server which could run locally instead of the default one?
3. If no, what are the changes I would need to do?

I have setup one open source stun server [https://github.com/enobufs/stun] but failed to carry out further connections with the clients.

I setup the server as per the instructions provided in the link. Now instead of the default stun server , I put the 'local-ip-address:port' and tried to make a connection between the peers. But it dint work.

var configuration = { "iceServers": [{ "urls": "local-ip-address:port" }] };
pc = new RTCPeerConnection(configuration);

Am i doing it the wrong way? Please guide me through.

Thanks in advance


Solution

  • Coturn is very popular stun/turn server with active community support. Pre-built packages available at https://github.com/coturn/coturn/wiki/Downloads

    You can test the server with sample demo

    If both the parties are in same network, then no need to configure turn stuff like credentials. Read more

    Configuring the peerConnection:
    
    STUN server: //server_ip is coturn instance ip should be reachable from clients 
    var iceServers= [{"url": "stun:server_ip:port"}];
    
    or TURN server:
    var iceServers= [{"url":["turn:server_ip:port"],"username":"turn_username","credential":"turn_password"}];
    var pc_config = {"iceServers": iceServers};
    var pc_constraints = {
            "optional": [{"DtlsSrtpKeyAgreement": true}]
        };
    pc = new RTCPeerConnection(pc_config, pc_constraints);