Webrtc 使用coturn眩晕/转身服务器进行进近

Webrtc 使用coturn眩晕/转身服务器进行进近,webrtc,stun,rfc5766turnserver,apprtcdemo,Webrtc,Stun,Rfc5766turnserver,Apprtcdemo,简单地说,我将运行本地流行的WEBRTC应用程序示例: github.com/webrtc/apprtc apprtc已安装,甚至可以在没有turn server的情况下在本地工作(“同源策略”不允许使用Google turn server,它只能从apprtc.appspot.com运行:访问控制允许源:“”) 但我知道在真实的互联网世界(NAT和防火墙)中,我需要转向服务器。所以我决定使用自己的眩晕/转身服务器: code.google.com/p/coturn/ 我正在尝试将我的apprt

简单地说,我将运行本地流行的WEBRTC应用程序示例: github.com/webrtc/apprtc

apprtc已安装,甚至可以在没有turn server的情况下在本地工作(“同源策略”不允许使用Google turn server,它只能从apprtc.appspot.com运行:访问控制允许源:“”)

但我知道在真实的互联网世界(NAT和防火墙)中,我需要转向服务器。所以我决定使用自己的眩晕/转身服务器:

code.google.com/p/coturn/

我正在尝试将我的apprtc与coturn集成:

 +apprtc: http://localhost:8080/?wstls=false
 +coturn: http://localhost: 3478
我有问题:

a) 我是否需要执行一些turnadmin命令,如安装指南中所述? 或者可以从以下示例运行turnserver: 我的_name@my_machine:~/WEBRTC/turnserver-4.4.5.2/examples/scripts/restapi$。/secure\u relay\u secret.sh

其中包括:

if [ -d examples ] ; then
       cd examples
fi

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib/:/usr/local/mysql/lib/
export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:/usr/local/lib/:/usr/local/mysql/lib/

PATH="./bin/:../bin/:../../bin/:${PATH}" turnserver -v --syslog -a -L 127.0.0.1 -L ::1 -E 127.0.0.1 -E ::1 --max-bps=3000000 -f -m 3 --min-port=32355 --max-port=65535 --use-auth-secret --static-auth-secret=logen --realm=north.gov --cert=turn_server_cert.pem --pkey=turn_server_pkey.pem --log-file=stdout -q 100 -Q 300 --cipher-list=ALL $@
b) 在浏览器中打开localhost:3478时,我看到: “打开服务器 对管理会话使用https连接: RESTAPI的uri是什么

c) 在RESTAPI中,我需要传递一些参数:用户名和密钥。这足够了吗? 只需在turnserver命令中添加额外的-u开关就足够了吗?我需要一些额外的配置吗

e) 如何解决“同源策略”?我不打算尝试使用相同的端口和nginx,而只是简单地将“访问控制允许源”标题设置为turnserver响应。没有nginx代理如何解决?或者使用其他一些解决方案如何解决

d) 还有其他一些重要问题,运行apprtc应用程序和coturn服务器的人应该知道哪些

编辑


对我来说,最大的问题是认为Coturn有自己的api方法返回TURN服务器,但没有。因此需要自己在自己的http服务器上执行此操作。下面是python/django中的示例:

from hashlib import sha1
import hmac

TURN_SERVER_SECRET_KEY = 'my_pass'
def get_turn_servers(request):
    if 'username' not in request.GET.keys():
        return HttpResponseForbidden()

    unix_timestamp_tomorrow = int(time()) + (24*60*60)
    new_username = str(unix_timestamp_tomorrow)+':'+request.GET['username']
    hashed = hmac.new(TURN_SERVER_SECRET_KEY, new_username, sha1)
    password = hashed.digest().encode("base64").rstrip('\n')

    turn_udp_uri = 'turn:%s:3478?transport=udp' % settings.DOMAIN.split(':')[0] #bez portu
    turn_tcp_uri = 'turn:%s:3478?transport=tcp' % settings.DOMAIN.split(':')[0]

    return JsonResponse({
            'username':new_username,
            'password':password,
            'uris':[turn_udp_uri,
                    turn_tcp_uri,
                   ]
        })
以下小组将提供帮助:


如果sombody需要django代码中的webrtc,请写信给我。

Hi@Thomas,我也在尝试同样的事情。你找到答案了吗?你能给我指出正确的方向或提到一些教程吗?