coTurn工程提供了較完整的STUN和TURN服務,記錄其主要的命令行參數配置說明mysql
針對TURN/STUN服務進程turnserver.exe的使用參數作簡單說明sql
-L 監聽的IP地址數據庫
-p 監聽端口服務器
-E 中繼IPtcp
-X 公網/內網 映射配置oop
--no-loopback-peers 不使用127.x.x.x,::1迴路IP地址spa
-m <numbeer> 當前鏈接上的線程數,默認CPU個數命令行
--min-port 起始用的最小端口線程
--max-port 最大端口號日誌
-o 以守護進程模式運行(後臺運行)
-f 使用指紋
-a 長期驗證機制
-z 不進行驗證,全部客戶端都可訪問
-u 用戶名:密碼
-r realm組別
--check-origin-consistency 連續檢測會話的屬性值
-q, --user-quota <number> allocation配額
-Q, --total-quota <number> 總配額值
-s, --max-bps 帶寬
-B, --bps-capacity 總帶寬容量
-c 配置文件名稱
-b, --db, --userdb <filename> 數據庫名
-M, --mysql-userdb <con-string> mysql鏈接字符串
--server-name 服務名,默認同realm
-n 不使用配置,所有使用命令行參數
--cert PEM格式的證書
--pkey PEM格式的私鑰文件
--pky-pwd 私鑰的密碼
--no-udp 不提供UDP協議的服務
--no-tcp 不提供TCP協議的服務
--no-tls 不使用TLS服務
--no-udp-relay 不使用UDP中繼
--no-tcp-relay 不使用TCP中繼
-l, --log-file,<filename> 指定日誌文件
--no-stdout-log 控制檯不輸出std-out格式的日誌
--syslog 使用系統日誌
--simple-log 使用建議日誌記錄,全部日誌會覆蓋以前對應日誌文件的內容(日誌文件同名)
-S, --stun-only 只使用STUN服務
--no-stun 不使用STUN服務
--mobility 支持Mobility ICE(MICE specs)協議
簡單舉例以下:
turnserver.exe -L 61.59.55.23 -p 6666 -E 61.59.55.23 -a -u test:123456 -r demo -s --max-bps=10000000 -n -o --no-loopback-peers --no-cli
針對PJSIP使用的STUN服務和TURN服務,因爲對於STUN服務沒法進行用戶驗證,而對TRUN服務須要驗證,因此在一臺服務器上,分別將應用程序放在兩個目錄下,分別啓用STUN服務(不帶驗證的)和TURN服務(帶驗證),固然,兩個服務的監聽端口要有一個改變一下,不能都使用3478.
配置STUN服務以下,使用conf配置文件:
#STUN服務配置 listening-port=3488 alt-listening-port=0 listening-ip=192.168.25.3 relay-ip=192.168.25.3 relay-threads=6 min-port=49152 max-port=65535 verbose fingerprint #lt-cred-mech #user=test1:123456 #user=test2:123456 #realm=test.com max-bps=100000 log-file=stdout #secure-stun #no-stun stun-only no-auth no-cli
配置TURN服務的conf文件以下:
#TURN服務配置 listening-port=3478 alt-listening-port=0 listening-ip=192.168.25.3 relay-ip=192.168..25.3 relay-threads=6 min-port=49152 max-port=65535 verbose fingerprint lt-cred-mech user=test1:123456 user=test2:123456 realm=test.com max-bps=100000 log-file=stdout secure-stun no-stun #no-auth no-cli