How to configure Janus to use Cloudflare TURN

I use Janus with Coturn on a Linux Ubuntu 22.04, all installed locally, however I have not had the expected performance, and I would really like to test Cloudflare’s TURN, together with Janus. However, I can’t find anything about this subject, which leaves me lost and confused about it. I wonder why there is nothing about it.
Is it bad to use Cloudflare TURN with Janus ?
Has anyone used Janus with Cloudflare TURN ?

I appreciate any comments

I don’t know what you expect Cloudflare to do for you, especially since you’re not explaining what you mean by “expected performance”. As explained in our FAQ, TURN is usually only needed on the client side: you will 99.99% of the times NOT need it on the Janus side, since it’s expected that Janus is more often than not publicly reachable, and that if a firewall is there, there are rules configured to allow it to work as expected.

Hello, thank you very much for the quick response.
You’re right, the performance issue I reported is not internal to Janus, but on the client side, for that I use Coturn as a TURN server so that clients can connect.
I would like to use Cloudflare’s TURN on Janus, but I looked and saw that there is a problem with Cloudflare’s response

It can dynamically connect to TURN servers by calling a REST endpoint. Janus expects a json response as defined in their

{
    "username" : "12334939:mbzrxpgjys",
    "password" : "adfsaflsjfldssia",
    "ttl" : 86400,
    "uris" : [
        "turn:1.2.3.4:9991?transport=udp",
        "turn:1.2.3.4:9992?transport=tcp",
        "turns:1.2.3.4:443?transport=tcp"
    ]
}

Cloudflare, however, generates a json response similar to the following

{
  "iceServers": {
    "urls": [
      "stun:stun.cloudflare.com:3478",
      "turn:turn.cloudflare.com:3478?transport=udp",
      "turn:turn.cloudflare.com:3478?transport=tcp",
      "turns:turn.cloudflare.com:5349?transport=tcp"
    ],
    "username": "username",
    "credential": "password"
  }
}

I believe that for this to work, I may need some script, which acts between Janus and CloudFlare, and transforms this response from Cloudflare, into a correct format for Janus to interpret.

If you’re trying to send this to Janus, you’re doing something wrong. The JSON response you get should be passed on the client side via the JSEP APIs (not Janus), that is as part of the object you pass to a new RTCPeerConnection() call. This is how janus.js does it, using the iceServers object demos pass to it.