Skip to content

DTLS support for WebRTC streaming

WCS supports DTLS 1.2 handshake while establishing WebRTC connections, this protocol version is гыув by default. However, DTLS 1.0 is also supported for compatibility. Obsolete protocol support can be forced for all the clients using the following parameter in flashphoner.properties file

dtls_force_version_0=true

Or, since build 5.2.399, it can be switched per browser according to User Agent string that client sends during handshake.

User Agent strings should be listed in dtls0_ua file which is placed to /usr/local/FlashphonerWebCallServer/conf folder. For example,

Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0

Since build 5.2.546, the following parameter in flashphoner.properties

dtls0_ua_match_substring=true

can be used to enable matching of User Agent by substring specified in dtls0_ua, for example

Firefox/62.0
Firefox/60.0

DTLS handshake errors can be written to dtls-error.log file which is placed to  /usr/local/FlashphonerWebCallServer/logs folder

17:15:42,889 ERROR            DtlsError - Stun-Clbk-thread udp//192.168.0.111:31016 User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0; alert level: 2; alert description: 40; message: null

To do this, the following settings should be added to log4j.properties file

log4j.logger.DtlsError=error, dtlsErrorAppender
log4j.additivity.DtlsError=false
log4j.appender.dtlsErrorAppender=org.apache.log4j.DailyRollingFileAppender
log4j.appender.dtlsErrorAppender.DatePattern='.'yyyy-MM-dd-HH
log4j.appender.dtlsErrorAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.dtlsErrorAppender.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p %20.20c{1} - %t %m%n
log4j.appender.dtlsErrorAppender.File=${com.flashphoner.fms.AppHome}/logs/dtls-error.log

These settings will be added by default if WCS is cleanly installed, but the log4j.properties file is not overwritten when WCS is updated. In this case, the settings should be added manually.

User-agent string from dtls-error.log should be added to dtls0_ua file, for example

Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0

DTLS 1.0 will be used while WebRTC connection is establishing with the browsers listed above