Clients in networks different than that of the server cannot see media of each other

Hello MediaSoup Community,

I’m working on implementing a multi-party video calling feature on my Node.js server using MediaSoup, and I’m encountering an issue with clients connecting from external networks. I’m fairly new to WebRTC concepts, so I may have misunderstood somethings. Please correct me if I’ve missed any key steps or concepts.

Setup Details:

  • Video Calling Server (with mediasoup-server library): Running on a VM in my office network. Also by domain name lms.sarjanfoundation.com
  • Functionality Goal: Enable multi-party video calling, where users can join from different networks using a URL (BadriLMS), similar to Google Meet.
  • TURN Configuration: Using Express TURN on the client side in the ICE servers configuration to support NAT traversal for external connections.

Issue Description:

The functionality works as expected for clients on the same network as the server. They can see and hear each other without any problems. However, when a client tries to join from an external network:

  • Video and audio tracks stop transmitting for the external client.
  • Clients from the external network cannot see or hear other participants, and vice versa.

Additional Information and Questions:

  1. Announced Address: I’m currently using my hostname (lms.sarjanfoundation.com) as the announced address, hoping it will point directly to the VM without relying on IPs. However, the stream issue persists for external clients. I’d like to ask if it’s possible to use a domain instead of an IP in the CreateTransportService configuration to ensure connectivity aligns with the public-facing address.

  2. Transport Configuration:
    a. Config with which video calling works on the clients with the same network as the server

    When I pass listenInfos as:

"listenInfos": [
    {
      "ip": "192.1.200.233",   // private IP
      "announcedAddress": "192.1.200.233"
    }
  ],
createRecvTransport / createSendTransport  {
  "id": "ee63140f-274a-4cad-ba0e-e0579da06d25",
  "iceParameters": {
    "usernameFragment": "s72ghfp7arg1koofpsflm4u874p2pxl8",
    "password": "y1sarxjt0h6b6eqxzidvwag6tufsz77u",
    "iceLite": true
  },
  "iceServers": [
    {
      "urls": "stun:stun.l.google.com:19302"
    },
    {
      "urls": "turn:relay1.expressturn.com:3478",
      "username": "efQ1D78SW2M6K7RRAT",
      "credential": "g8yQsbB8wssh7su9"
    }
  ],
  "iceCandidates": [
    {
      "foundation": "udpcandidate",
      "priority": 1076302079,
      "ip": "192.1.200.233",
      "address": "192.1.200.233",  //private IP
      "protocol": "udp",
      "port": 12091,
      "type": "host"
    }
  ],
  "dtlsParameters": {...}
}

b. Config that I made for production but doesn’t work at all.

When I pass listenInfos as:

"listenInfos": [
    {
      "ip": "lms.sarjanfoundation.com",   // public hostname that routes to my vm
      "announcedAddress": "[192.1.200.233](http://lms.sarjanfoundation.com)"
    }
  ],
createRecvTransport / createSendTransport  {
  "id": "ee63140f-274a-4cad-ba0e-e0579da06d25",
  "iceParameters": {
    "usernameFragment": "s72ghfp7arg1koofpsflm4u874p2pxl8",
    "password": "y1sarxjt0h6b6eqxzidvwag6tufsz77u",
    "iceLite": true
  },
  "iceServers": [
    {
      "urls": "stun:stun.l.google.com:19302"
    },
    {
      "urls": "turn:relay1.expressturn.com:3478",
      "username": "efQ1D78SW2M6K7RRAT",
      "credential": "g8yQsbB8wssh7su9"
    }
  ],
  "iceCandidates": [
    {
      "foundation": "udpcandidate",
      "priority": 1076302079,
      "ip": "lms.sarjanfoundation.com",
      "address": "lms.sarjanfoundation.com",  //private IP
      "protocol": "udp",
      "port": 12091,
      "type": "host"
    }
  ],
  "dtlsParameters": {...}
}

If anyone has insights on resolving the stream issue for external connections, I’d greatly appreciate the guidance. Thank you!

Hi, i am just a mediasoup user, so i am not expert in these fileds however i got similar issue some days ago when i wanted to test on public internet and not on intranet.
In my case i forget to set port forwarding to the port between rtcMinPort and rtcMaxPort.
If the website appears and the camera and audio stream does not work on public internet just on your network maybe you have the same issue i had.

Hi @szekelypeti, thank you for your response.

It was an issue with the ports. I was in a VM with a shared public IP where port forwarding was not possible. So I switched my deployment to an EC2 instance with a dedicated public IP.
I opened the ports 40000:49999.
Now it works