Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TURN REST API: Error parsing API from Janus #891

Open
ehfd opened this issue Dec 28, 2024 · 1 comment
Open

TURN REST API: Error parsing API from Janus #891

ehfd opened this issue Dec 28, 2024 · 1 comment

Comments

@ehfd
Copy link

ehfd commented Dec 28, 2024

CC @fancycode

Issue number one: The TURN REST API capability provided by the signaling server is not well documented, when one must use TURN with Janus.

r.HandleFunc("/turn/credentials", b.setComonHeaders(b.getTurnCredentials)).Methods("GET")

Documentation should specify correctly that they should add the turn_rest_api option in Janus pointing to /turn/credentials for janus.jcfg in order to utilze turn_rest_api_key:

nat: {
    stun_server = "stun.myurl.invalid"
    stun_port = 3478
    full_trickle = true
    turn_rest_api = "http://localhost:8080/turn/credentials"
    turn_rest_api_key = "<REDACTED>"
}

Issue number two:

Directly accessing http://localhost:8080/turn/credentials?service=turn&api=<REDACTED>&key=<REDACTED>&username=example (same format as https://github.com/meetecho/janus-gateway/blob/dc8323741043a75537fb770d42ca37498a3d8947/src/turnrest.c#L140) results correctly in:

{"username":"1700000000:example","password":"<REDACTED>","ttl":86400,"uris":["turn:turn.myurl.invalid:3478?transport=udp","turn:turn.myurl.invalid:3478?transport=tcp"]}

But in Janus:

[ERR] [turnrest.c:janus_turnrest_request:198] Couldn't parse response: error on line 1: '[' or '{' expected near end of file
[WARN] [{REDACTED}] Failed to add some remote candidates (added 0, expected 1)

Therefore, the TURN REST API is not usable, possibly an empty response for some reason?

@fancycode
Copy link
Member

If you increase the log level in Janus, you should see what was received:
https://github.com/meetecho/janus-gateway/blob/dc8323741043a75537fb770d42ca37498a3d8947/src/turnrest.c#L192-L194

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants