Product SiteDocumentation Site

11.8. Echtzeit-Kommunikationsdienste

Real-Time Communication (RTC) services include voice, video/webcam, instant messaging (IM) and desktop sharing. This chapter gives a brief introduction to three of the services required to operate RTC, including a TURN server, SIP server and XMPP server. Comprehensive details of how to plan, install and manage these services are available in the Real-Time Communications Quick Start Guide which includes examples specific to Debian.
Sowohl SIP als auch XMPP können die gleiche Funktionalität bieten. SIP ist etwas bekannter für Sprache und Video, während XMPP traditionell als IM-Protokoll angesehen wird. Allerdings können beide für jeden dieser Zwecke verwendet werden. Um die Konnektivitätsmöglichkeiten zu maximieren, wird empfohlen, beide parallel zu betreiben.
These services rely on X.509 certificates both for authentication and confidentiality purposes. See Abschnitt 10.2, „X.509 certificates“ for more information.

11.8.1. DNS-Einstellungen für RTC-Dienste

RTC-Dienste erfordern DNS SRV- und NAPTR-Einträge. Eine Beispielkonfiguration, die in der Zonendatei für falcot.com abgelegt werden kann:
; the server where everything will run
server1            IN     A      198.51.100.19
server1            IN     AAAA   2001:DB8:1000:2000::19

; IPv4 only for TURN for now, some clients are buggy with IPv6
turn-server        IN     A      198.51.100.19

; IPv4 and IPv6 addresses for SIP
sip-proxy          IN     A      198.51.100.19
sip-proxy          IN     AAAA   2001:DB8:1000:2000::19

; IPv4 and IPv6 addresses for XMPP
xmpp-gw            IN     A      198.51.100.19
xmpp-gw            IN     AAAA   2001:DB8:1000:2000::19

; DNS SRV and NAPTR for STUN / TURN
_stun._udp  IN SRV    0 1 3467 turn-server.falcot.com.
_turn._udp  IN SRV    0 1 3467 turn-server.falcot.com.
@           IN NAPTR  10 0 "s" "RELAY:turn.udp" "" _turn._udp.falcot.com.

; DNS SRV and NAPTR records for SIP
_sips._tcp  IN SRV    0 1 5061 sip-proxy.falcot.com.
@           IN NAPTR  10 0 "s" "SIPS+D2T" "" _sips._tcp.falcot.com.

; DNS SRV records for XMPP Server and Client modes:
_xmpp-client._tcp  IN     SRV    5 0 5222 xmpp-gw.falcot.com.
_xmpp-server._tcp  IN     SRV    5 0 5269 xmpp-gw.falcot.com.

11.8.2. TURN-Server

TURN ist ein Dienst, der Clients hinter NAT-Routern und Firewalls hilft, die effizienteste Art der Kommunikation mit anderen Clients zu finden und die Medienströme weiterzuleiten, wenn kein direkter Medienpfad gefunden werden kann. Es wird dringend empfohlen, den TURN-Server zu installieren, bevor die anderen RTC-Dienste den Endbenutzern angeboten werden.
TURN und das zugehörige ICE-Protokoll sind offene Standards. Um von diesen Protokollen zu profitieren, die Konnektivität zu maximieren und die Frustration der Benutzer zu minimieren, ist es wichtig sicherzustellen, dass jede Client-Software ICE und TURN unterstützt.
Damit der ICE-Algorithmus effektiv funktioniert, muss der Server zwei öffentliche IPv4-Adressen haben.
Install the coturn package and edit the /etc/turnserver.conf configuration file. By default, a SQLite database is configured in /var/db/turndb for user account settings, but PostgreSQL, MySQL or Redis can be set up instead if preferred. The most important thing to do is insert the IP addresses of the server.
The server can be started running /usr/bin/turnserver. We want the server to be an an automatically started system service, so we edit the /etc/default/coturn file like this:
#
# Uncomment it if you want to have the turnserver running as
# an automatic system service daemon
#
TURNSERVER_ENABLED=1
By default, the TURN server uses anonymous access. We have to add the users we want to use:
# turnadmin -a -u roland -p secret_password -r falcot.com
# turnadmin -A -u admin -p secret_password
We use the argument -a to add a normal user and -A to add an admin user.

11.8.3. SIP Proxy-Server

Ein SIP-Proxy-Server verwaltet die ein- und ausgehenden SIP-Verbindungen zwischen anderen Organisationen, SIP-Trunking-Providern, SIP-Telefonanlagen wie Asterisk, SIP-Telefonen, SIP-basierten Softphones und WebRTC-Anwendungen.
Es wird dringend empfohlen, den SIP-Proxy zu installieren und zu konfigurieren, bevor Sie eine SIP-Telefonanlage einrichten. Der SIP-Proxy normalisiert einen Großteil des Datenverkehrs, der die Telefonanlage erreicht und sorgt für mehr Konnektivität und Ausfallsicherheit.

11.8.3.1. SIP-Proxy installieren

Install the kamailio package and the package for the database backend, the Falcot administrators chose MySQL, so they install mariadb-server. /etc/kamailio/kamctlrc is the configuration file for the control tools kamctl and kamdbctl. You need to edit and set the SIP_DOMAIN to your SIP service domain and set the DBENGINE to MySQL, another database backend can be used.
[...]
## your SIP domain
SIP_DOMAIN=sip.falcot.com

## chrooted directory
# $CHROOT_DIR="/path/to/chrooted/directory"

## database type: MYSQL, PGSQL, ORACLE, DB_BERKELEY, DBTEXT, or SQLITE
# by default none is loaded
#
# If you want to setup a database with kamdbctl, you must at least specify
# this parameter.
DBENGINE=MYSQL
[...]
Now we focus on the configuration file /etc/kamailio/kamailio.cfg. Falcot needs user authentication and persistent user location, so they add the following #!define directives at the top of that file:
#!KAMAILIO
#
# Kamailio (OpenSER) SIP Server v5.2 - default configuration script
#     - web: https://www.kamailio.org
#     - git: https://github.com/kamailio/kamailio
#!define WITH_MYSQL
#!define WITH_AUTH
#!define WITH_USRLOCDB
[...]
Kamailio needs a database structure that we can create running kamdbctl create as root.
Finally, we can add some users with kamctl.
# kamctl add roland secret_password
Once everything is properly configured you can start or restart the service with systemctl restart kamailio, you can connect with a SIP client providing the ip address and the port (5090 is the default port). The users have the following id: roland@sip.falcot.com, and they can login using a client (see Abschnitt 13.10, „Echtzeit-Kommunikationssoftware“)

11.8.4. XMPP-Server

Ein XMPP-Server verwaltet die Konnektivität zwischen lokalen XMPP-Benutzern und XMPP-Benutzern in anderen Domänen im öffentlichen Internet.
Prosody ist ein beliebter XMPP-Server, der zuverlässig auf Debian-Servern läuft.

11.8.4.1. Installieren des XMPP-Servers

Install the prosody package.
Überprüfen Sie die Konfigurationsdatei /etc/prosody/prosody.cfg.lua. Das Wichtigste ist das Einfügen von JIDs der Benutzer, die den Server verwalten dürfen.
admins = { "joe@falcot.com" }
Außerdem wird für jede Domäne eine eigene Konfigurationsdatei benötigt. Kopieren Sie das Beispiel aus /etc/prosody/conf.avail/example.com.cfg.lua und verwenden Sie es als Ausgangspunkt. Hier ist falcot.com.cfg.lua:
VirtualHost "falcot.com"
        enabled = true
        ssl = {
                key = "/etc/ssl/private/falcot.com-key.pem";
                certificate = "/etc/ssl/public/falcot.com.pem";
                }

-- Set up a MUC (multi-user chat) room server on conference.example.com:
Component "conference.falcot.com" "muc"
Um die Domain zu aktivieren, muss ein Symlink von /etc/prosody/conf.d/ vorhanden sein. Erstellen Sie es so:
# ln -s /etc/prosody/conf.avail/falcot.com.cfg.lua /etc/prosody/conf.d/
Starten Sie den Dienst neu, um die neue Konfiguration zu verwenden.

11.8.4.2. Verwalten des XMPP-Servers

Einige Verwaltungsvorgänge können mit dem Kommandozeilenprogramm prosodyctl durchgeführt werden. Zum Beispiel, um das unter /etc/prosody/prosody.cfg.lua angegebene Administratorkonto hinzuzufügen:
# prosodyctl adduser joe@falcot.com
See the Prosody online documentation for more details about how to customize the configuration.

11.8.5. Laufende Dienste auf Port 443

Einige Administratoren bevorzugen alle ihre RTC-Dienste auf Port 443 laufen zu lassen. Dies hilft Benutzern, sich von entfernten Orten wie Hotels und Flughäfen aus zu verbinden, wo andere Ports blockiert werden können oder der Internetverkehr über HTTP-Proxy-Server geleitet wird.
Um diese Strategie zu nutzen, benötigt jeder Dienst (SIP, XMPP und TURN) eine andere IP-Adresse. Alle Dienste können sich weiterhin auf demselben Host befinden, da Linux mehrere IP-Adressen auf einem einzigen Host unterstützt. Die Portnummer 443 muss in den Konfigurationsdateien für jeden Prozess und auch in den DNS-SRV-Einträgen angegeben werden.

11.8.6. WebRTC hinzufügen

Falcot möchte Kunden direkt von der Website aus telefonieren lassen. Die Falcot-Administratoren wollen WebRTC auch als Teil ihres Disaster-Recovery-Plans nutzen, so dass sich die Mitarbeiter zu Hause über Webbrowser in die Telefonanlage des Unternehmens einloggen und im Notfall normal arbeiten können.
WebRTC is a rapidly evolving technology and it is essential to use packages from the Testing distribution. Another option is to compile the software.
WebRTC uses a simple API to provide browsers and mobile applications with RTC, it is free software and it is being developed by Google.
A very flexible approach is using GStreamer's WebRTC implementation. It enables pipeline-based multimedia applications, which allows developing interesting and highly efficient applications. A good starting point is the following demo by Centricular, the main company that is developing it:
More advanced click-to-call web sites typically use server-side scripting to generate the config.js file dynamically. The DruCall source code demonstrates how to do this with PHP.
Dieses Kapitel hat nur einen Bruchteil der verfügbaren Serversoftware dargestellt; jedoch wurden die meisten der üblichen Netzwerkdienste beschrieben. Jetzt ist es Zeit für ein noch technischeres Kapitel: wir werden tiefer in die Einzelheiten einiger Konzepte eindringen, sowie Masseneinsätze und Virtualisierungen beschreiben.