vdo.ninja/turn-credentials.php
Jumper78 c559b6ad5f generation for turn-server with static-auth-secret in a separate php script
index.html
added a two config-lines that can simply be uncommented for activating the "twilio-mode" or the "php-credentials-mode"

turn-credentials.php (new file)
will generate username and password for a turn server with a static-auth-secret and will offer it in json-format

main.js
added a section that requests output from php-credentials.php and adds the username, password, stun-server and turn-server into the configuration
2021-05-11 07:57:35 +02:00

11 lines
454 B
PHP

<?php
$stun_server = "stun:<stun-server>:<stun-port>";
$turn_server = "turns:<turn-server>:<https-turn-port>";
$turn_expiry = 86400;
$turn_username = time() + $turn_expiry;
$turn_secret = '<turn-server static-auth-secret>';
$turn_password = base64_encode ( hash_hmac ( 'sha1', $turn_username, $turn_secret, true ) );
$arr = array('1' => $turn_username, '2' => $turn_password, '3' => $stun_server, '4' => $turn_server);
echo json_encode($arr);
?>