I recently ran into a similar problem (getting a REST API working with a TURN server) and found out that the TURN server does not support REST API calls at all and just supports support for the authentication format with a shared secret when we enable REST API support in the TURN configuration. The project only contains information about the things that we need to consider when implementing such a REST API, and we need to create the API ourselves or use something like turnhttp to create a combination of passwords with a temporary username.
Since @mido is detailed, you can implement the username / password generation part in the application itself. But if you have reasons to separate this from the application and want to implement it as a completely different API service, instead of implementing the full API in accordance with the project , I came across another message in which the OP provided a PHP script to create the username temp and password, and this works very well once you change the hash_hmac () function as follows:
$turn_password = hash_hmac('sha1', $turn_user, $secret_key, true);
We need base64 to encode the hash_hmac RAW output to make it work, and I believe that is why it did not work for the OP in this link.
You must verify the test authentication with the turnutils_uclient command to ensure that the temp username / password command is working properly .
turnutils_uclient -y -u GENERATED_USERNAME -w GENERATED_PASSWORD yourturnserver.com
After you have verified the authentication and confirmed that it works, you can configure the web server for the PHP script to make it available to your application and get a temporary username / password. In addition, to protect the API from unauthorized access, you will need to implement a different security setting (authentication).
I know this is an old post, just sharing its findings, hoping that someday it will be useful to someone.
Sparx
source share