On 13/05/13 08:56, Daniel Pocock wrote:
For TURN, has anybody tried the TURN server project from Google code?
It appears more advanced than the existing two TURN servers in Debian
(e.g. it has database-backed authentication)
http://code.google.com/p/rfc5766-turn-server/
I have used this TURN Server. I have made some RPMs of it too (.spec and .patch (patch contains init.d scripts etc)) are attached.

The TURN Server itself seems to work well, though I think there are some bugs relating to configuration file parsing (I have had problems with DB configuration strings in the file that work fine on the command line).

The good thing about this server is the support for ephemeral credentials (if you create a web-service to generate them). This is a necessity for WebRTC as the alternative is often to embed the TURN credentials in the Javascript.

Regards,

Peter
Name:		turnserver
Version:	1.8.3.6
Release:	0%{dist}
Summary:	RFC5766 TURN Server

Group:		System Environment/Libraries
License:	BSD
URL:		https://code.google.com/p/rfc5766-turn-server/ 
Source0:	https://rfc5766-turn-server.googlecode.com/files/%{name}-%{version}.tar.gz
Patch00:	turnserver-1.8.3.6-CentOS.patch

BuildRequires:	gcc, make, redhat-rpm-config
BuildRequires:	openssl-devel, libevent-devel >= 2.0.0, mysql-devel
BuildRequires:	postgresql-devel
Requires:	openssl, libevent >= 2.0.0, mysql-libs, postgresql-libs


%description
The TURN Server is a VoIP media traffic NAT traversal server and gateway. It
can be used as a general-purpose network traffic TURN server/gateway, too.

This implementation also includes some extra features. Supported RFCs:

TURN specs:
- RFC 5766 - base TURN specs
- RFC 6062 - TCP relaying TURN extension
- RFC 6156 - IPv6 extension for TURN
- Experimental DTLS support as client protocol.

STUN specs:
- RFC 5389 - base "new" STUN specs
- RFC 5769 - test vectors for STUN protocol testing
- RFC 5780 - NAT behavior discovery support

The implementation fully supports UDP, TCP, TLS and DTLS as protocols between
the TURN client and the TURN Server. Both UDP and TCP relaying are supported.

Flat files, MySQL or PostgreSQL are supported for the user repository (if
authentication is required). Both short-term and long-term credentials
mechanisms are supported.

For WebRTC applications, TURN Server REST API for time-limited secret-based
authentication is implemented.

The load balancing can be implemented either by external networking tools, or
by the built-in ALTERNATE-SERVER mechanism.

The implementation is supposed to be simple, easy to install and configure. The
project focuses on performance, scalability and simplicity. The aim is to
provide an enterprise-grade TURN solution.

To achieve high performance and scalability, the TURN server is implemented
with the following features:
- High-performance industrial-strength Network IO engine libevent2 is used
- Configurable multi-threading model implemented to allow full usage of
  available CPU resources (if OS allows multi-threading)
- Multiple listening and relay addresses can be configured
- Efficient memory model used
- The TURN project code can be used in a custom proprietary networking
  environment. In the TURN server code, an abstract networking API is used.
  Only couple files in the project have to be re-written to plug-in the TURN
  server into a proprietary environment. With this project, only implementation
  for standard UNIX Networking/IO API is provided, but the user can implement
  any other environment. The TURN server code was originally developed for a
  high-performance proprietary corporate environment, then adopted for UNIX
  Networking API
- The TURN server works as a user space process, without imposing any special
  requirements on the system

%package	utils
Summary:	TURN Server utils and client development tools
Group:		Development/Libraries
Requires:	%{name} = %{version}-%{release}

%description	utils
This package contains the TURN server utils and client development tools.

%package	doc
Summary:	TURN Server documentation and examples
Group:		Development/Libraries
Requires:	%{name} = %{version}-%{release}
BuildArch:	noarch

%description	doc
This package contains the TURN server documentation and examples.

%prep
%setup -q -n %{name}-%{version}
%patch00 -p1

%build
PREFIX=/usr CONFPREFIX=%{_sysconfdir} EXAMPLESDIR=%{_datadir}/%{name} \
	MANPREFIX=%{_datadir} LIBDIR=%{_libdir} ./configure
make

%install
rm -rf $RPM_BUILD_ROOT
DESTDIR=$RPM_BUILD_ROOT make install
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/rc.d/init.d
install -m755 centos/turnserver.init \
		$RPM_BUILD_ROOT/%{_sysconfdir}/rc.d/init.d/turnserver
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig
install -m644 centos/turnserver.sysconfig \
		$RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/turnserver

%clean
rm -rf "$RPM_BUILD_ROOT"

%pre
%{_sbindir}/groupadd -r turnserver 2> /dev/null || :
%{_sbindir}/useradd -r -g turnserver -s /bin/false -c "TURN Server daemin" -d \
		%{_datadir}/%{name} turnserver 2> /dev/null || :

%post
/sbin/chkconfig --add turnserver

%preun
/sbin/service turnserver stop > /dev/null 2>&1
/sbin/chkconfig --del turnserver

%files
%defattr(-,root,root)
%{_bindir}/turnserver
%{_bindir}/turnadmin
%{_mandir}/man1/turnserver.1.gz
%{_mandir}/man1/turnadmin.1.gz
%dir %attr(-,turnserver,turnserver) %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/turnserver.conf
%config(noreplace) %{_sysconfdir}/%{name}/turnuserdb.conf
%config(noreplace) %{_sysconfdir}/sysconfig/turnserver
%config %{_sysconfdir}/rc.d/init.d/turnserver
%dir %{_docdir}/%{name}
%{_docdir}/%{name}/INSTALL
%{_docdir}/%{name}/postinstall.txt
%{_docdir}/%{name}/README.turnadmin
%{_docdir}/%{name}/README.turnserver
%{_docdir}/%{name}/schema.sql

%files		utils
%defattr(-,root,root)
%{_bindir}/turnutils_peer
%{_bindir}/turnutils_rfc5769check
%{_bindir}/turnutils_stunclient
%{_bindir}/turnutils_uclient
%{_mandir}/man1/turnutils.1.gz
%{_mandir}/man1/turnutils_peer.1.gz
%{_mandir}/man1/turnutils_rfc5769check.1.gz
%{_mandir}/man1/turnutils_stunclient.1.gz
%{_mandir}/man1/turnutils_uclient.1.gz
%{_libdir}/libturnclient.a
%dir %{_includedir}/turn
%{_includedir}/turn/ns_turn_defs.h
%dir %{_includedir}/turn/client
%{_includedir}/turn/client/ns_turn_ioaddr.h
%{_includedir}/turn/client/ns_turn_msg_addr.h
%{_includedir}/turn/client/ns_turn_msg_defs.h
%{_includedir}/turn/client/ns_turn_msg.h
%{_includedir}/turn/client/TurnMsgLib.h
%{_docdir}/%{name}/README.turnutils

%files		doc
%{_docdir}/%{name}/TURNServerRESTAPI.pdf
%{_docdir}/%{name}/TurnNetworks.pdf
%dir %{_docdir}/%{name}/html
%{_docdir}/%{name}/html/*
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/*

%changelog
* Fri May 3 2013 Peter Dunkley <pe...@dunkley.me.uk>
- First version
diff -uprN turnserver-1.8.3.6.orig/centos/turnserver.init turnserver-1.8.3.6/centos/turnserver.init
--- turnserver-1.8.3.6.orig/centos/turnserver.init	1970-01-01 01:00:00.000000000 +0100
+++ turnserver-1.8.3.6/centos/turnserver.init	2013-05-04 22:54:48.044001115 +0100
@@ -0,0 +1,78 @@
+#!/bin/bash
+#
+# Startup script for TURN Server
+#
+# chkconfig: 345 85 15
+# description: RFC 5766 TURN Server
+#
+# processname: turnserver
+# pidfile: /var/run/turnserver.pid
+# config: /etc/turnserver/turnserver.conf
+#
+### BEGIN INIT INFO
+# Provides: turnserver
+# Required-Start: $local_fs $network
+# Short-Description: RFC 5766 TURN Server
+# Description: RFC 5766 TURN Server
+### END INIT INFO
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+turn=/usr/bin/turnserver
+prog=turnserver
+pidfile=/var/run/$prog.pid
+lockfile=/var/lock/subsys/$prog
+user=turnserver
+RETVAL=0
+
+[ -f /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
+
+start() {
+	echo -n $"Starting $prog: "
+	# there is something at end of this output which is needed to
+	# report proper [ OK ] status in CentOS scripts
+	daemon --pidfile=$pidfile --user=$user $turn $OPTIONS
+	RETVAL=$?
+	echo
+	[ $RETVAL = 0 ] && touch $lockfile
+}
+
+stop() {
+	echo -n $"Stopping $prog: "
+	killproc $turn
+	RETVAL=$?
+	echo
+	[ $RETVAL = 0 ] && rm -f $lockfile $pidfile
+}
+
+[ -z "$OPTIONS" ] && OPTIONS="-c /etc/turnserver/turnserver.conf -o --no-stdout-log"
+
+# See how we were called.
+case "$1" in
+	start)
+		start
+		;;
+	stop)
+		stop
+		;;
+	status)
+		status $turn
+		RETVAL=$?
+		;;
+	restart)
+		stop
+		start
+		;;
+	condrestart)
+		if [ -f /var/run/$prog.pid ] ; then
+			stop
+			start
+		fi
+		;;
+	*)
+		echo $"Usage: $prog {start|stop|restart|condrestart|status|help}"
+		exit 1
+esac
+
+exit $RETVAL
diff -uprN turnserver-1.8.3.6.orig/centos/turnserver.sysconfig turnserver-1.8.3.6/centos/turnserver.sysconfig
--- turnserver-1.8.3.6.orig/centos/turnserver.sysconfig	1970-01-01 01:00:00.000000000 +0100
+++ turnserver-1.8.3.6/centos/turnserver.sysconfig	2013-05-04 22:52:41.819999834 +0100
@@ -0,0 +1,5 @@
+#
+# TURN Server startup options
+#
+
+OPTIONS="-c /etc/turnserver/turnserver.conf -o --no-stdout-log"
diff -uprN turnserver-1.8.3.6.orig/configure turnserver-1.8.3.6/configure
--- turnserver-1.8.3.6.orig/configure	2013-05-01 06:49:50.000000000 +0100
+++ turnserver-1.8.3.6/configure	2013-05-04 22:34:01.322999200 +0100
@@ -183,6 +183,10 @@ if [ -z "${MANPREFIX}" ] ; then
 	MANPREFIX=${PREFIX}
 fi
 
+if [ -z "${CONFPREFIX}" ] ; then
+	CONFPREFIX=${PREFIX}/etc
+fi
+
 if [ -z "${EXAMPLESDIR}" ] ; then
 	EXAMPLESDIR=${PREFIX}/share/examples/${PORTNAME}
 fi
@@ -642,6 +646,7 @@ echo "#" >> Makefile
 echo "PORTNAME = ${PORTNAME}" >> Makefile
 echo "PREFIX = ${PREFIX}" >> Makefile
 echo "MANPREFIX = ${MANPREFIX}" >> Makefile
+echo "CONFPREFIX = ${CONFPREFIX}" >> Makefile
 echo "EXAMPLESDIR = ${EXAMPLESDIR}" >> Makefile
 echo "DOCSDIR = ${DOCSDIR}" >> Makefile
 echo "LIBDIR = ${LIBDIR}" >> Makefile
diff -uprN turnserver-1.8.3.6.orig/Makefile.in turnserver-1.8.3.6/Makefile.in
--- turnserver-1.8.3.6.orig/Makefile.in	2013-05-01 06:49:50.000000000 +0100
+++ turnserver-1.8.3.6/Makefile.in	2013-05-04 22:34:08.076994550 +0100
@@ -105,64 +105,63 @@ distclean:	clean
 ### Install all:
 
 install:	all ${MAKE_DEPS}
-	${MKDIR} ${PREFIX}
-	${MKDIR} ${PREFIX}/bin
-	${MKDIR} ${MANPREFIX}/man/man1
-	${MKDIR} ${PREFIX}/etc
-	${MKDIR} ${LIBDIR}
-	${MKDIR} ${EXAMPLESDIR}
-	${MKDIR} ${DOCSDIR}
-	${MKDIR} ${SCHEMADIR}
-	${MKDIR} ${TURNINCLUDEDIR}
-	${INSTALL_PROGRAM} bin/turnserver ${PREFIX}/bin/
-	${INSTALL_PROGRAM} bin/turnadmin ${PREFIX}/bin/
-	${INSTALL_PROGRAM} bin/turnutils_uclient ${PREFIX}/bin/
-	${INSTALL_PROGRAM} bin/turnutils_peer ${PREFIX}/bin/
-	${INSTALL_PROGRAM} bin/turnutils_stunclient ${PREFIX}/bin/
-	${INSTALL_PROGRAM} bin/turnutils_rfc5769check ${PREFIX}/bin/
-	${INSTALL_MAN} man/man1/turnserver.1 ${MANPREFIX}/man/man1/
-	${INSTALL_MAN} man/man1/turnadmin.1 ${MANPREFIX}/man/man1/
-	${INSTALL_MAN} man/man1/turnutils.1 ${MANPREFIX}/man/man1/
-	${INSTALL_MAN} man/man1/turnutils_uclient.1 ${MANPREFIX}/man/man1/
-	${INSTALL_MAN} man/man1/turnutils_rfc5769check.1 ${MANPREFIX}/man/man1/
-	${INSTALL_MAN} man/man1/turnutils_stunclient.1 ${MANPREFIX}/man/man1/
-	${INSTALL_MAN} man/man1/turnutils_peer.1 ${MANPREFIX}/man/man1/
-	${INSTALL_STATIC_LIB} lib/libturnclient.a ${LIBDIR}
-	${INSTALL_DIR} docs/html ${DOCSDIR}
-	${INSTALL_DATA} docs/TURNServerRESTAPI.pdf ${DOCSDIR}
-	${INSTALL_DATA} docs/TurnNetworks.pdf ${DOCSDIR}
-	${INSTALL_DATA} README.turnserver ${DOCSDIR}
-	${INSTALL_DATA} README.turnadmin ${DOCSDIR}
-	${INSTALL_DATA} README.turnutils ${DOCSDIR}
-	${INSTALL_DATA} INSTALL ${DOCSDIR}
-	${INSTALL_DATA} postinstall.txt ${DOCSDIR}
-	${INSTALL_DATA} turndb/schema.sql ${DOCSDIR}
-	${INSTALL_DATA} turndb/schema.sql ${SCHEMADIR}
-	${INSTALL_DATA} examples/etc/turnserver.conf ${PREFIX}/etc/turnserver.conf.default
-	${INSTALL_DATA} examples/etc/turnuserdb.conf ${PREFIX}/etc/turnuserdb.conf.default
-	${INSTALL_DIR} examples/etc ${EXAMPLESDIR}
-	${INSTALL_DIR} examples/scripts ${EXAMPLESDIR}
-	${INSTALL_DIR} include/turn/client ${TURNINCLUDEDIR}
-	${INSTALL_DATA} include/turn/ns_turn_defs.h ${TURNINCLUDEDIR}
-	${MORECMD} ${DOCSDIR}/postinstall.txt
+	${MKDIR} ${DESTDIR}${PREFIX}
+	${MKDIR} ${DESTDIR}${PREFIX}/bin
+	${MKDIR} ${DESTDIR}${MANPREFIX}/man/man1
+	${MKDIR} ${DESTDIR}${CONFPREFIX}/turnserver
+	${MKDIR} ${DESTDIR}${LIBDIR}
+	${MKDIR} ${DESTDIR}${EXAMPLESDIR}
+	${MKDIR} ${DESTDIR}${DOCSDIR}
+	${MKDIR} ${DESTDIR}${SCHEMADIR}
+	${MKDIR} ${DESTDIR}${TURNINCLUDEDIR}
+	${INSTALL_PROGRAM} bin/turnserver ${DESTDIR}${PREFIX}/bin/
+	${INSTALL_PROGRAM} bin/turnadmin ${DESTDIR}${PREFIX}/bin/
+	${INSTALL_PROGRAM} bin/turnutils_uclient ${DESTDIR}${PREFIX}/bin/
+	${INSTALL_PROGRAM} bin/turnutils_peer ${DESTDIR}${PREFIX}/bin/
+	${INSTALL_PROGRAM} bin/turnutils_stunclient ${DESTDIR}${PREFIX}/bin/
+	${INSTALL_PROGRAM} bin/turnutils_rfc5769check ${DESTDIR}${PREFIX}/bin/
+	${INSTALL_MAN} man/man1/turnserver.1 ${DESTDIR}${MANPREFIX}/man/man1/
+	${INSTALL_MAN} man/man1/turnadmin.1 ${DESTDIR}${MANPREFIX}/man/man1/
+	${INSTALL_MAN} man/man1/turnutils.1 ${DESTDIR}${MANPREFIX}/man/man1/
+	${INSTALL_MAN} man/man1/turnutils_uclient.1 ${DESTDIR}${MANPREFIX}/man/man1/
+	${INSTALL_MAN} man/man1/turnutils_rfc5769check.1 ${DESTDIR}${MANPREFIX}/man/man1/
+	${INSTALL_MAN} man/man1/turnutils_stunclient.1 ${DESTDIR}${MANPREFIX}/man/man1/
+	${INSTALL_MAN} man/man1/turnutils_peer.1 ${DESTDIR}${MANPREFIX}/man/man1/
+	${INSTALL_STATIC_LIB} lib/libturnclient.a ${DESTDIR}${LIBDIR}
+	${INSTALL_DIR} docs/html ${DESTDIR}${DOCSDIR}
+	${INSTALL_DATA} docs/TURNServerRESTAPI.pdf ${DESTDIR}${DOCSDIR}
+	${INSTALL_DATA} docs/TurnNetworks.pdf ${DESTDIR}${DOCSDIR}
+	${INSTALL_DATA} README.turnserver ${DESTDIR}${DOCSDIR}
+	${INSTALL_DATA} README.turnadmin ${DESTDIR}${DOCSDIR}
+	${INSTALL_DATA} README.turnutils ${DESTDIR}${DOCSDIR}
+	${INSTALL_DATA} INSTALL ${DESTDIR}${DOCSDIR}
+	${INSTALL_DATA} postinstall.txt ${DESTDIR}${DOCSDIR}
+	${INSTALL_DATA} turndb/schema.sql ${DESTDIR}${DOCSDIR}
+	${INSTALL_DATA} turndb/schema.sql ${DESTDIR}${SCHEMADIR}
+	${INSTALL_DATA} examples/etc/turnserver.conf ${DESTDIR}${CONFPREFIX}/turnserver/turnserver.conf
+	${INSTALL_DATA} examples/etc/turnuserdb.conf ${DESTDIR}${CONFPREFIX}/turnserver/turnuserdb.conf
+	${INSTALL_DIR} examples/etc ${DESTDIR}${EXAMPLESDIR}
+	${INSTALL_DIR} examples/scripts ${DESTDIR}${EXAMPLESDIR}
+	${INSTALL_DIR} include/turn/client ${DESTDIR}${TURNINCLUDEDIR}
+	${INSTALL_DATA} include/turn/ns_turn_defs.h ${DESTDIR}${TURNINCLUDEDIR}
+#	${MORECMD} ${DESTDIR}${DOCSDIR}/postinstall.txt
 
 deinstall:	${MAKE_DEPS}
-	${RMCMD} ${DOCSDIR}
-	${RMCMD} ${SCHEMADIR}
-	${RMCMD} ${PREFIX}/bin/turnserver
-	${RMCMD} ${PREFIX}/bin/turnadmin
-	${RMCMD} ${PREFIX}/bin/turnutils_peer
-	${RMCMD} ${PREFIX}/bin/turnutils_uclient
-	${RMCMD} ${PREFIX}/bin/turnutils_rfc5769check
-	${RMCMD} ${PREFIX}/bin/turnutils_stunclient
-	${RMCMD} ${MANPREFIX}/man/man1/turnserver.1
-	${RMCMD} ${MANPREFIX}/man/man1/turnadmin.1
-	${RMCMD} ${MANPREFIX}/man/man1/turnutils.1
-	${RMCMD} ${LIBDIR}/libturnclient.a
-	${RMCMD} ${EXAMPLESDIR}/
-	${RMCMD} ${PREFIX}/etc/turnserver.conf.default
-	${RMCMD} ${PREFIX}/etc/turnuserdb.conf.default
-	${RMCMD} ${TURNINCLUDEDIR}
+	${RMCMD} ${DESTDIR}${DOCSDIR}
+	${RMCMD} ${DESTDIR}${SCHEMADIR}
+	${RMCMD} ${DESTDIR}${PREFIX}/bin/turnserver
+	${RMCMD} ${DESTDIR}${PREFIX}/bin/turnadmin
+	${RMCMD} ${DESTDIR}${PREFIX}/bin/turnutils_peer
+	${RMCMD} ${DESTDIR}${PREFIX}/bin/turnutils_uclient
+	${RMCMD} ${DESTDIR}${PREFIX}/bin/turnutils_rfc5769check
+	${RMCMD} ${DESTDIR}${PREFIX}/bin/turnutils_stunclient
+	${RMCMD} ${DESTDIR}${MANPREFIX}/man/man1/turnserver.1
+	${RMCMD} ${DESTDIR}${MANPREFIX}/man/man1/turnadmin.1
+	${RMCMD} ${DESTDIR}${MANPREFIX}/man/man1/turnutils.1
+	${RMCMD} ${DESTDIR}${LIBDIR}/libturnclient.a
+	${RMCMD} ${DESTDIR}${EXAMPLESDIR}/
+	${RMCMD} ${DESTDIR}${CONFPREFIX}/turnserver
+	${RMCMD} ${DESTDIR}${TURNINCLUDEDIR}
 
 uninstall:	deinstall
 
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

Reply via email to