TT#124273 add non-NGCP Debian packaging

For this initial version, these are mostly copies of the existing
/debian tree, with `ngcp-rtpengine` renamed to `rtpengine`, added
"conflicts" with the `ngcp-rtpengine` packages, and NGCP-specific
"suggests" removed.

Change-Id: I64289f9907ec09d003a96b8ac81f83c79d413747
(cherry picked from commit bbfe168b72)
mr9.5.3
Richard Fuchs 4 years ago committed by Victor Seva
parent 1e0de79e1b
commit 6ec66b5338

@ -0,0 +1,15 @@
*.debhelper
*.log
*.substvars
/.debhelper/
/debhelper-build-stamp
/files
/rtpengine-daemon/
/rtpengine-iptables/
/rtpengine-kernel-dkms/
/rtpengine-kernel-source/
/rtpengine-recording-daemon/
/rtpengine-utils/
/rtpengine/
README.html.gz
README.md.gz

@ -0,0 +1,2 @@
debian/README.html.gz
debian/README.md.gz

@ -0,0 +1,144 @@
Source: rtpengine
Section: net
Priority: optional
Maintainer: Sipwise Development Team <support@sipwise.com>
Homepage: https://www.sipwise.com/
Standards-Version: 3.9.8
Build-Depends:
debhelper-compat (= 12),
default-libmysqlclient-dev,
gperf,
libavcodec-dev (>= 6:10),
libavfilter-dev (>= 6:10),
libavformat-dev (>= 6:10),
libavutil-dev (>= 6:10),
libbcg729-dev <!pkg.rtpengine.nobcg729>,
libbencode-perl,
libcrypt-openssl-rsa-perl,
libcrypt-rijndael-perl,
libcurl4-openssl-dev | libcurl4-gnutls-dev,
libdigest-crc-perl,
libdigest-hmac-perl,
libevent-dev (>= 2.0),
libglib2.0-dev (>= 2.30),
libhiredis-dev,
libio-multiplex-perl,
libio-socket-inet6-perl,
libio-socket-ip-perl,
libiptc-dev,
libjson-glib-dev,
libnet-interface-perl,
libpcap0.8-dev,
libpcre3-dev,
libsocket6-perl,
libspandsp-dev,
libssl-dev (>= 1.0.1),
libswresample-dev (>= 6:10),
libsystemd-dev,
libwebsockets-dev,
libxmlrpc-core-c3-dev (>= 1.16.07),
libxtables-dev (>= 1.4) | iptables-dev (>= 1.4),
markdown,
zlib1g-dev,
Package: rtpengine-daemon
Architecture: any
Recommends:
rtpengine-recording-daemon,
rtpengine-utils,
Depends:
iptables,
lsb-base (>= 3.0-6),
${misc:Depends},
${shlibs:Depends},
Conflicts:
ngcp-rtpengine-daemon,
Description: proxy for RTP and media streams used in NGCP, userspace part
This daemon handles the first stages of proxying media streams and talks to
the kernel part of the proxy for eventual high-performance packet forwarding.
Package: rtpengine-recording-daemon
Architecture: any
Build-Profiles: <!pkg.rtpengine.no-transcoding>
Recommends:
rtpengine-utils,
Depends:
lsb-base (>= 3.0-6),
nfs-common,
${misc:Depends},
${shlibs:Depends},
Conflicts:
ngcp-rtpengine-recording-daemon,
Description: recording daemon for RTP and media streams
This daemon handles the call recording (media intercept) component of rtpengine.
Package: rtpengine-iptables
Architecture: any
Depends:
${misc:Depends},
${shlibs:Depends},
Conflicts:
ngcp-rtpengine-iptables,
Description: IPtables extension module for the kernel-space NGCP media proxy
Provides the IPtables extension needed to configure the mediaproxy rule.
Package: rtpengine
Architecture: all
Depends:
rtpengine-daemon (>= ${source:Version}),
rtpengine-iptables (>= ${source:Version}),
rtpengine-kernel-dkms (>= ${source:Version}),
rtpengine-recording-daemon (>= ${source:Version}),
rtpengine-utils (>= ${source:Version}),
${misc:Depends},
Description: NGCP RTP/media proxy - meta package
This is a meta package for easy installation of all four parts of the NGCP
media proxy. It will install the user-space daemon, the kernel-space IPtables
module, the IPtables extension module and utility scripts.
Package: rtpengine-kernel-source
Architecture: all
Section: kernel
Depends:
debhelper-compat (= 12),
module-assistant,
${misc:Depends},
Conflicts:
ngcp-rtpengine-kernel-source,
Description: IPtables kernel module for the NGCP media proxy - source
Provides the kernel-space part of the NGCP media proxy for high-
performance packet forwarding.
This package contains the source to be built with module-assistant or
kernel-package.
Package: rtpengine-kernel-dkms
Architecture: all
Section: kernel
Depends:
dkms (>= 1.95),
lsb-release,
${misc:Depends},
Conflicts:
ngcp-rtpengine-kernel-dkms,
Description: IPtables kernel module for the NGCP media proxy - DKMS
Provides the kernel-space part of the NGCP media proxy for high-
performance packet forwarding.
This package contains the source to be built with dkms.
Package: rtpengine-utils
Architecture: all
Depends:
libbencode-perl,
libconfig-tiny-perl,
libcrypt-rijndael-perl,
libdigest-hmac-perl,
libio-socket-inet6-perl,
libio-socket-ip-perl,
libsocket6-perl,
netcat-openbsd | netcat,
${misc:Depends},
${perl:Depends},
Conflicts:
ngcp-rtpengine-utils,
Description: scripts and Perl modules for NGCP rtpengine
This package contains scripts and Perl modules for NGCP rtpengine

@ -0,0 +1,18 @@
Source: rtpengine
Section: kernel
Priority: optional
Maintainer: Sipwise Development Team <support@sipwise.com>
Build-Depends:
debhelper-compat (= 12),
Standards-Version: 3.9.8
Homepage: https://www.sipwise.com/
Package: rtpengine-kernel-modules-_KVERS_
Architecture: any
Depends:
linux-modules-_KVERS_ | linux-image-_KVERS_,
Conflicts:
ngcp-rtpengine-kernel-modules-_KVERS_,
Description: IPtables kernel module for the NGCP media proxy
This package provides the rtpengine module for
the Linux kernel version _KVERS_.

@ -0,0 +1,36 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Source: https://www.sipwise.com/
Upstream-Contact: Sipwise Development Team <support@sipwise.com>
Files: *
Copyright:
Copyright © 2007-2019 Sipwise GmbH, Austria
License: GPL-3+ with OpenSSL exception
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
.
In addition, as a special exception, the copyright holders give
permission to link the code of this release with the OpenSSL project's
"OpenSSL" library (or with modified versions of it that use the same
license as the "OpenSSL" library), and distribute the linked executables.
.
You must obey the GNU General Public License in all respects for all
of the code used other than "OpenSSL". If you modify file(s) with this
exception, you may extend this exception to your version of the file(s),
but you are not obligated to do so. If you do not wish to do so,
delete this exception statement from your version. If you delete
this exception statement from all source files in the program, then
also delete it here.
.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Comment:
On Debian systems, the full text of the GNU General Public License
version 3 can be found in the file '/usr/share/common-licenses/GPL-3'.

@ -0,0 +1,7 @@
PACKAGE_NAME="rtpengine"
PACKAGE_VERSION="__VERSION__"
MAKE[0]="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build RTPENGINE_VERSION=\"__VERSION__\""
CLEAN="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build clean"
AUTOINSTALL=yes
BUILT_MODULE_NAME[0]="xt_RTPENGINE"
DEST_MODULE_LOCATION[0]=/extra

@ -0,0 +1,8 @@
RUN_RTPENGINE=no
CONFIG_FILE=/etc/rtpengine/rtpengine.conf
# CONFIG_SECTION=rtpengine
PIDFILE=/run/rtpengine-daemon.pid
MANAGE_IPTABLES=yes
TABLE=0
#SET_USER=root
#SET_GROUP=root # GROUP only needs to be set if USER is not set or if the user isn't in the group

@ -0,0 +1,187 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: rtpengine-daemon
# Required-Start: $network $local_fs $remote_fs $syslog
# Required-Stop: $network $local_fs $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Ngcp Rtpengine
# Description: Proxy for RTP and other media streams
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
NAME=rtpengine-daemon
DESC="RTP/media proxy"
TABLE=0
DAEMON=$(which rtpengine)
DEFAULTS=/etc/default/${NAME}
test -f "$DAEMON" || exit 0
. /lib/lsb/init-functions
# Load startup options if available
if [ -f "$DEFAULTS" ]; then
. "$DEFAULTS" || true
fi
if [ "$RUN_RTPENGINE" != "yes" ]; then
log_action_msg "rtpengine not yet configured. Edit $DEFAULTS first."
exit 0
fi
[ -z "$PIDFILE" ] && PIDFILE="/run/rtpengine.pid"
OPTIONS=""
START_OPTIONS=""
if [ -n "$INTERFACES" ]; then
for interface in $INTERFACES; do
OPTIONS="$OPTIONS --interface=$interface"
done
fi
if [ -n "$SUBSCRIBE_KEYSPACES" ]; then
for ks in $SUBSCRIBE_KEYSPACES; do
OPTIONS="$OPTIONS --subscribe-keyspace=$ks"
done
fi
[ -z "$CONFIG_FILE" ] || OPTIONS="$OPTIONS --config-file=$CONFIG_FILE"
[ -z "$CONFIG_SECTION" ] || OPTIONS="$OPTIONS --config-section=$CONFIG_SECTION"
[ -z "$ADDRESS" ] || OPTIONS="$OPTIONS --interface=$ADDRESS"
[ -z "$ADV_ADDRESS" ] || OPTIONS="$OPTIONS!$ADV_ADDRESS"
[ -z "$ADDRESS_IPV6" ] || OPTIONS="$OPTIONS --interface=$ADDRESS_IPV6"
[ -z "$ADV_ADDRESS_IPV6" ] || OPTIONS="$OPTIONS!$ADV_ADDRESS_IPV6"
[ -z "$LISTEN_TCP" ] || OPTIONS="$OPTIONS --listen-tcp=$LISTEN_TCP"
[ -z "$LISTEN_UDP" ] || OPTIONS="$OPTIONS --listen-udp=$LISTEN_UDP"
[ -z "$LISTEN_NG" ] || OPTIONS="$OPTIONS --listen-ng=$LISTEN_NG"
[ -z "$LISTEN_CLI" ] || OPTIONS="$OPTIONS --listen-cli=$LISTEN_CLI"
[ -z "$TIMEOUT" ] || OPTIONS="$OPTIONS --timeout=$TIMEOUT"
[ -z "$SILENT_TIMEOUT" ] || OPTIONS="$OPTIONS --silent-timeout=$SILENT_TIMEOUT"
[ -z "$FINAL_TIMEOUT" ] || OPTIONS="$OPTIONS --final-timeout=$FINAL_TIMEOUT"
[ -z "$PIDFILE" ] || OPTIONS="$OPTIONS --pidfile=$PIDFILE"
[ -z "$TOS" ] || OPTIONS="$OPTIONS --tos=$TOS"
[ -z "$PORT_MIN" ] || OPTIONS="$OPTIONS --port-min=$PORT_MIN"
[ -z "$PORT_MAX" ] || OPTIONS="$OPTIONS --port-max=$PORT_MAX"
[ -z "$REDIS" ] || [ -z "$REDIS_DB" ] || OPTIONS="$OPTIONS --redis=$REDIS/$REDIS_DB"
[ -z "$REDIS_AUTH_PW" ] || export RTPENGINE_REDIS_AUTH_PW="$REDIS_AUTH_PW"
[ -z "$REDIS_WRITE" ] || [ -z "$REDIS_WRITE_DB" ] || OPTIONS="$OPTIONS --redis-write=$REDIS_WRITE/$REDIS_WRITE_DB"
[ -z "$REDIS_WRITE_AUTH_PW" ] || export RTPENGINE_REDIS_WRITE_AUTH_PW="$REDIS_WRITE_AUTH_PW"
[ -z "$REDIS_NUM_THREADS" ] || OPTIONS="$OPTIONS --redis-num-threads=$REDIS_NUM_THREADS"
[ -z "$REDIS_EXPIRES" ] || OPTIONS="$OPTIONS --redis-expires=$REDIS_EXPIRES"
[ -z "$REDIS_MULTIKEY" ] || OPTIONS="$OPTIONS --redis-multikey=$REDIS_MULTIKEY"
[ -z "$NO_REDIS_REQUIRED" ] || { [ "$NO_REDIS_REQUIRED" != "1" ] && [ "$NO_REDIS_REQUIRED" != "yes" ] ; } || OPTIONS="$OPTIONS --no-redis-required"
[ -z "$B2B_URL" ] || OPTIONS="$OPTIONS --b2b-url=$B2B_URL"
[ -z "$NO_FALLBACK" ] || { [ "$NO_FALLBACK" != "1" ] && [ "$NO_FALLBACK" != "yes" ] ; } || OPTIONS="$OPTIONS --no-fallback"
OPTIONS="$OPTIONS --table=$TABLE"
[ -z "$LOG_LEVEL" ] || OPTIONS="$OPTIONS --log-level=$LOG_LEVEL"
[ -z "$LOG_FACILITY" ] || OPTIONS="$OPTIONS --log-facility=$LOG_FACILITY"
[ -z "$LOG_FACILITY_CDR" ] || OPTIONS="$OPTIONS --log-facility-cdr=$LOG_FACILITY_CDR"
[ -z "$LOG_FACILITY_RTCP" ] || OPTIONS="$OPTIONS --log-facility-rtcp=$LOG_FACILITY_RTCP"
[ -z "$NUM_THREADS" ] || OPTIONS="$OPTIONS --num-threads=$NUM_THREADS"
[ -z "$DELETE_DELAY" ] || OPTIONS="$OPTIONS --delete-delay=$DELETE_DELAY"
[ -z "$GRAPHITE" ] || OPTIONS="$OPTIONS --graphite=$GRAPHITE"
[ -z "$GRAPHITE_INTERVAL" ] || OPTIONS="$OPTIONS --graphite-interval=$GRAPHITE_INTERVAL"
[ -z "$GRAPHITE_PREFIX" ] || OPTIONS="$OPTIONS --graphite-prefix=$GRAPHITE_PREFIX"
[ -z "$MAX_SESSIONS" ] || OPTIONS="$OPTIONS --max-sessions=$MAX_SESSIONS"
[ -z "$HOMER" ] || OPTIONS="$OPTIONS --homer=$HOMER"
[ -z "$HOMER_PROTOCOL" ] || OPTIONS="$OPTIONS --homer-protocol=$HOMER_PROTOCOL"
[ -z "$HOMER_ID" ] || OPTIONS="$OPTIONS --homer-id=$HOMER_ID"
if [ -n "$RECORDING_DIR" ]; then
OPTIONS="$OPTIONS --recording-dir=$RECORDING_DIR"
if [ ! -d "$RECORDING_DIR" ]; then
mkdir "$RECORDING_DIR" 2> /dev/null
chmod 700 "$RECORDING_DIR" 2> /dev/null
fi
fi
[ -z "$RECORDING_METHOD" ] || OPTIONS="$OPTIONS --recording-method=$RECORDING_METHOD"
[ -z "$RECORDING_FORMAT" ] || OPTIONS="$OPTIONS --recording-format=$RECORDING_FORMAT"
[ -z "$DTLS_PASSIVE" ] || { [ "$DTLS_PASSIVE" != "yes" ] && [ "$DTLS_PASSIVE" != "1" ] ; } || OPTIONS="$OPTIONS --dtls-passive"
if test "$FORK" = "no" ; then
OPTIONS="$OPTIONS --foreground"
fi
if test "$LOG_STDERR" = "yes" ; then
OPTIONS="$OPTIONS --log-stderr"
fi
# check if directory for pid file needs to be created
PIDDIR=$(dirname "$PIDFILE")
DO_DIR_CHOWN=0
if ! test -z "$PIDDIR" && ! test -d "$PIDDIR"; then
mkdir -p "$PIDDIR"
DO_DIR_CHOWN=1
fi
# handle requested setuid/setgid
if ! test -z "$SET_USER"; then
START_OPTIONS="$START_OPTIONS --chuid $SET_USER"
test "$DO_DIR_CHOWN" = 1 && chown "$SET_USER": "$PIDDIR"
fi
if ! test -z "$SET_GROUP"; then
START_OPTIONS="$START_OPTIONS --group $SET_GROUP"
test "$DO_DIR_CHOWN" = 1 && chgrp "$SET_GROUP" "$PIDDIR"
fi
###
case "$1" in
start)
if [ -x "$(which ngcp-check-active)" ]; then
case "$(ngcp-check-active -v)" in
active|transition)
log_action_msg "Active node or transition."
;;
*)
log_action_msg "Ignored start action in inactive node"
exit 0
;;
esac
fi
RC=0
rtpengine-iptables-setup start || RC=$?
if [ "$RC" -ne 0 ]; then
log_action_msg "Failed to start rtpengine-iptables-setup"
log_end_msg "$RC"
exit 1
fi
log_daemon_msg "Starting $DESC" "$NAME"
# shellcheck disable=SC2086
start-stop-daemon --start --quiet --pidfile "$PIDFILE" \
--exec "$DAEMON" $START_OPTIONS -- $OPTIONS || log_progress_msg " already running"
log_end_msg $?
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
RC=0
start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \
--retry 5 --exec "$DAEMON" || RC=$?
if [ "$RC" -eq 0 ]; then
rtpengine-iptables-setup stop || true
fi
rm -f "$PIDFILE"
log_end_msg "$RC"
exit "$RC"
;;
restart|force-reload)
$0 stop
$0 start
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
*)
echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2
exit 1
;;
esac
exit 0

@ -0,0 +1,3 @@
daemon/rtpengine /usr/sbin/
debian/rtpengine-iptables-setup /usr/sbin
etc/rtpengine.sample.conf /etc/rtpengine/

@ -0,0 +1 @@
/lib/systemd/system/rtpengine-daemon.service /lib/systemd/system/rtpengine.service

@ -0,0 +1,38 @@
#!/bin/sh
set -e
default=/etc/default/rtpengine-daemon
modname=xt_RTPENGINE
if [ -x "$(which ngcp-virt-identify)" ]; then
if ngcp-virt-identify --type container; then
VIRT="yes"
fi
fi
if [ "$VIRT" = "yes" ]; then
echo "Container environment detected. Skip kernel module check"
else
if [ -f $default ]; then
. $default || true
fi
if [ -n "$TABLE" ] && [ "$TABLE" -ge 0 ] && \
[ -n "$NO_FALLBACK" ] && \
{ [ "$NO_FALLBACK" = "1" ] || [ "$NO_FALLBACK" = "yes" ] ; }
then
if lsmod | grep -q $modname || modinfo $modname > /dev/null 2> /dev/null; then
true
else
echo "Kernel module $modname not found and NO_FALLBACK is set."
echo "Daemon restart not performed."
exit 0
fi
fi
fi
#DEBHELPER#
exit 0

@ -0,0 +1,16 @@
[Unit]
Description=NGCP RTP/media Proxy Daemon
After=network-online.target
After=remote-fs.target
Requires=network-online.target
[Service]
Type=notify
EnvironmentFile=/etc/default/rtpengine-daemon
PIDFile=/run/rtpengine-daemon.pid
ExecStartPre=/usr/sbin/rtpengine-iptables-setup start
ExecStart=/usr/sbin/rtpengine -f -E --no-log-timestamps --pidfile /run/rtpengine-daemon.pid --config-file /etc/rtpengine/rtpengine.conf
ExecStopPost=/usr/sbin/rtpengine-iptables-setup stop
[Install]
WantedBy=multi-user.target

@ -0,0 +1 @@
daemon/*.h /usr/include/rtpengine/

@ -0,0 +1,101 @@
#!/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
TABLE=0
MODNAME=xt_RTPENGINE
MANAGE_IPTABLES=yes
DEFAULTS=/etc/default/rtpengine-daemon
# Load startup options if available
if [ -f "$DEFAULTS" ]; then
. "$DEFAULTS" || true
fi
MODPROBE_OPTIONS=""
# Handle requested setuid/setgid.
if ! test -z "$SET_USER"; then
PUID=$(id -u "$SET_USER" 2> /dev/null)
test -z "$PUID" || MODPROBE_OPTIONS="$MODPROBE_OPTIONS proc_uid=$PUID"
if test -z "$SET_GROUP"; then
PGID=$(id -g "$SET_USER" 2> /dev/null)
test -z "$PGID" || MODPROBE_OPTIONS="$MODPROBE_OPTIONS proc_gid=$PGID"
fi
fi
if ! test -z "$SET_GROUP"; then
PGID=$(grep "^$SET_GROUP:" /etc/group | cut -d: -f3 2> /dev/null)
test -z "$PGID" || MODPROBE_OPTIONS="$MODPROBE_OPTIONS proc_gid=$PGID"
fi
###
if [ -x "$(which ngcp-virt-identify)" ]; then
if ngcp-virt-identify --type container; then
VIRT="yes"
fi
fi
firewall_setup()
{
if [ "$TABLE" -lt 0 ] || [ "$VIRT" = "yes" ]; then
return
fi
if [ "$MANAGE_IPTABLES" != "yes" ]; then
return
fi
# shellcheck disable=SC2086
modprobe $MODNAME $MODPROBE_OPTIONS
iptables -N rtpengine 2>/dev/null
iptables -D INPUT -j rtpengine 2>/dev/null
iptables -D INPUT -p udp -j rtpengine 2>/dev/null
iptables -I INPUT -p udp -j rtpengine
iptables -D rtpengine -p udp -j RTPENGINE --id "$TABLE" 2>/dev/null
iptables -I rtpengine -p udp -j RTPENGINE --id "$TABLE"
ip6tables -N rtpengine 2>/dev/null
ip6tables -D INPUT -j rtpengine 2>/dev/null
ip6tables -D INPUT -p udp -j rtpengine 2>/dev/null
ip6tables -I INPUT -p udp -j rtpengine
ip6tables -D rtpengine -p udp -j RTPENGINE --id "$TABLE" 2>/dev/null
ip6tables -I rtpengine -p udp -j RTPENGINE --id "$TABLE"
}
firewall_teardown()
{
if [ "$TABLE" -lt 0 ] || [ "$VIRT" = "yes" ]; then
return
fi
# XXX: Wait a bit to make sure the daemon has been stopped.
sleep 1
if [ -e /proc/rtpengine/control ]; then
echo "del $TABLE" >/proc/rtpengine/control 2>/dev/null
fi
if [ "$MANAGE_IPTABLES" != "yes" ]; then
return
fi
iptables -D rtpengine -p udp -j RTPENGINE --id "$TABLE" 2>/dev/null
ip6tables -D rtpengine -p udp -j RTPENGINE --id "$TABLE" 2>/dev/null
}
case "$1" in
start)
firewall_setup
;;
stop)
firewall_teardown
;;
*)
echo "Usage: $0 {start|stop}" >&2
exit 1
;;
esac
exit 0

@ -0,0 +1,46 @@
#!/bin/sh
set -e
package=rtpengine-kernel-dkms
name=rtpengine
version=$(dpkg-query -W -f="\${Version}" "$package" \
|rev|cut -d- -f2-|rev|cut -d':' -f2|tr -d "\n")
if [ -x "$(which ngcp-virt-identify)" ]; then
if ngcp-virt-identify --type container; then
VIRT="yes"
fi
fi
if [ "$VIRT" = "yes" ]; then
echo "Container environment detected. Skip dkms"
else
isadded=$(dkms status -m "$name" -v "$version")
if [ -z "${isadded}" ] ; then
dkms add -m "$name" -v "$version"
fi
if [ "$1" = 'configure' ] ; then
KERNELS=$(ls /lib/modules/ 2>/dev/null || true)
for kernel in $KERNELS; do
if [ ! -r "/lib/modules/$kernel/build" ]; then
# cannot build modules for this kernel
continue
fi
( dkms build -m "$name" -v "$version" -k "$kernel" && dkms install -m "$name" -v "$version" -k "$kernel" ) || true
done
# try to start the daemon
if [ -x /etc/init.d/rtpengine-daemon ] ; then
invoke-rc.d rtpengine-daemon restart || true
fi
fi
fi
#DEBHELPER#
exit 0

@ -0,0 +1,32 @@
#!/bin/sh
set -e
package=rtpengine-kernel-dkms
name=rtpengine
modname=xt_RTPENGINE
version=$(dpkg-query -W -f="\${Version}" "$package" \
|rev|cut -d- -f2-|rev|cut -d':' -f2|tr -d "\n")
if [ -x "$(which ngcp-virt-identify)" ]; then
if ngcp-virt-identify --type container; then
VIRT="yes"
fi
fi
# make sure it's not running
if [ -x /etc/init.d/rtpengine-daemon ] ; then
invoke-rc.d rtpengine-daemon stop || true
rmmod "$modname" 2>/dev/null || true
fi
if [ "$VIRT" = "yes" ]; then
echo "Container environment detected. Skip dkms"
else
dkms remove -m "$name" -v "$version" --all || true
fi
#DEBHELPER#
exit 0

@ -0,0 +1 @@
/usr/share/modass/packages/default.sh /usr/share/modass/overrides/rtpengine-kernel-source

@ -0,0 +1,12 @@
RUN_RTPENGINE_RECORDING=no
CONFIG_FILE=/etc/rtpengine/rtpengine-recording.conf
# CONFIG_SECTION=rtpengine-recording
PIDFILE=/run/rtpengine-recording-daemon.pid
#SET_USER=root
#SET_GROUP=root # GROUP only needs to be set if USER is not set or if the user isn't in the group
#
MUST_NFS=no
NFS_HOST=192.168.1.1
NFS_REMOTE_PATH=/var/recordings
NFS_LOCAL_MOUNT=/var/lib/rtpengine-recording # must match output-dir if used
NFS_OPTIONS=hard,intr,tcp

@ -0,0 +1,2 @@
var/lib/rtpengine-recording
var/spool/rtpengine

@ -0,0 +1,116 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: rtpengine-recording-daemon
# Required-Start: $network $local_fs $remote_fs $syslog
# Required-Stop: $network $local_fs $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Ngcp Rtpengine Recording Daemon
# Description: Recording daemon for RTP and other media streams
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
NAME=rtpengine-recording-daemon
DESC="RTP/media recording daemon"
DAEMON=$(which rtpengine-recording)
DEFAULTS=/etc/default/${NAME}
test -f "$DAEMON" || exit 0
. /lib/lsb/init-functions
# Load startup options if available
if [ -f "$DEFAULTS" ]; then
. "$DEFAULTS" || true
fi
if [ "$RUN_RTPENGINE_RECORDING" != "yes" ]; then
log_action_msg "rtpengine-recording not yet configured. Edit $DEFAULTS first."
exit 0
fi
[ -z "$PIDFILE" ] && PIDFILE="/run/rtpengine-recording.pid"
OPTIONS=""
START_OPTIONS=""
[ -z "$CONFIG_FILE" ] || OPTIONS="$OPTIONS --config-file=$CONFIG_FILE"
[ -z "$PIDFILE" ] || OPTIONS="$OPTIONS --pidfile=$PIDFILE"
# check if directory for pid file needs to be created
PIDDIR=$(dirname "$PIDFILE")
DO_DIR_CHOWN=0
if ! test -z "$PIDDIR" && ! test -d "$PIDDIR"; then
mkdir -p "$PIDDIR"
DO_DIR_CHOWN=1
fi
# handle requested setuid/setgid
if ! test -z "$SET_USER"; then
START_OPTIONS="$START_OPTIONS --chuid $SET_USER"
test "$DO_DIR_CHOWN" = 1 && chown "$SET_USER": "$PIDDIR"
fi
if ! test -z "$SET_GROUP"; then
START_OPTIONS="$START_OPTIONS --group $SET_GROUP"
test "$DO_DIR_CHOWN" = 1 && chgrp "$SET_GROUP" "$PIDDIR"
fi
###
case "$1" in
start)
if [ -x "$(which ngcp-check-active)" ]; then
case "$(ngcp-check-active -v)" in
active|transition)
log_action_msg "Active node or transition."
;;
*)
log_action_msg "Ignored start action in inactive node"
exit 0
;;
esac
fi
RC=0
rtpengine-recording-nfs-setup start || RC=$?
if [ "$RC" -ne 0 ] ; then
log_action_msg "Failed to start rtpengine-recording-nfs-setup"
log_end_msg "$RC"
exit "$RC"
fi
log_daemon_msg "Starting $DESC" "$NAME"
# shellcheck disable=SC2086
start-stop-daemon --start --quiet --pidfile "$PIDFILE" \
--exec "$DAEMON" $START_OPTIONS -- $OPTIONS || log_progress_msg " already running"
log_end_msg $?
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
RC=0
start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \
--retry 5 --exec "$DAEMON" || RC=$?
rm -f "$PIDFILE"
log_end_msg "$RC"
exit "$RC"
;;
force-reload|restart)
$0 stop
$0 start
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
*)
echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2
exit 1
;;
esac
exit 0

@ -0,0 +1,3 @@
debian/rtpengine-recording-nfs-setup /usr/sbin/
etc/rtpengine-recording.sample.conf /etc/rtpengine/
recording-daemon/rtpengine-recording /usr/sbin/

@ -0,0 +1 @@
/lib/systemd/system/rtpengine-recording-daemon.service /lib/systemd/system/rtpengine-recording.service

@ -0,0 +1 @@
recording-daemon/rtpengine-recording.8

@ -0,0 +1,20 @@
[Unit]
Description=NGCP RTP/media Recording Daemon NFS mount point
After=network-online.target
After=remote-fs.target
After=rpcbind.socket
After=rpcbind.service
After=nfs-client.target
Requires=network-online.target
Requires=rpcbind.socket
Requires=rpcbind.service
Requires=nfs-client.target
[Service]
Type=simple
RemainAfterExit=yes
ExecStart=/usr/sbin/rtpengine-recording-nfs-setup start
ExecStop=/usr/sbin/rtpengine-recording-nfs-setup stop
[Install]
WantedBy=multi-user.target

@ -0,0 +1,16 @@
[Unit]
Description=NGCP RTP/media Recording Daemon
After=network-online.target
After=remote-fs.target
After=rtpengine-recording-nfs-mount.service
Requires=network-online.target
Requires=rtpengine-recording-nfs-mount.service
[Service]
Type=notify
LimitNOFILE=100000
PIDFile=/run/rtpengine-recording-daemon.pid
ExecStart=/usr/sbin/rtpengine-recording -f -E --no-log-timestamps --pidfile /run/rtpengine-recording-daemon.pid --config-file /etc/rtpengine/rtpengine-recording.conf
[Install]
WantedBy=multi-user.target

@ -0,0 +1,42 @@
#!/bin/sh
set -e
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DEFAULTS=/etc/default/rtpengine-recording-daemon
DESC="RTP engine recording NFS share"
. /lib/lsb/init-functions
# Load startup options if available
if [ -f "$DEFAULTS" ]; then
. "$DEFAULTS" || true
fi
[ -z "$NFS_OPTIONS" ] && NFS_OPTIONS="hard,tcp,intr"
###
case "$1" in
start)
if [ "$MUST_NFS" = yes ]; then
if ! grep -E -q "^[^ :]+:[^ :]+ $NFS_LOCAL_MOUNT nfs.? " /proc/mounts; then
log_action_msg "Mounting $DESC"
test -d "$NFS_LOCAL_MOUNT" || mkdir -p "$NFS_LOCAL_MOUNT"
mount -t nfs -o "$NFS_OPTIONS" "$NFS_HOST:$NFS_REMOTE_PATH" "$NFS_LOCAL_MOUNT"
fi
fi
;;
stop)
if grep -E -q "^[^ :]+:[^ :]+ $NFS_LOCAL_MOUNT nfs.? " /proc/mounts; then
log_action_msg "Unmounting $DESC"
umount "$NFS_LOCAL_MOUNT"
fi
;;
*)
echo "Usage: $0 {start|stop}" >&2
exit 1
;;
esac
exit 0

@ -0,0 +1,3 @@
perl/* /usr/share/perl5/
utils/rtpengine-ctl /usr/sbin/
utils/rtpengine-ng-client /usr/sbin/

@ -0,0 +1,2 @@
debian/README.html.gz
debian/README.md.gz

@ -0,0 +1,64 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
# export DH_VERBOSE=1
include /usr/share/dpkg/pkg-info.mk
## kernel package specific stuff
# Name of the source package
psource:=rtpengine-kernel-source
# Name of the dkms package
pdkms:=rtpengine-kernel-dkms
# short upstream name, used for module source directory
sname:=rtpengine
# Source version
sversion:=$(DEB_VERSION_UPSTREAM)
## end of kernel package specific stuff
XTABLES_DIR:=$(shell pkg-config xtables --variable=xtlibdir || echo /lib/xtables)
ifneq (,$(filter $(DEB_BUILD_PROFILES),pkg.rtpengine.no-transcoding))
export with_transcoding = no
endif
%:
dh $@
override_dh_auto_install-indep:
# Create the directories to install the source into
dh_installdirs -p$(psource) usr/src/modules/$(sname)/debian
dh_installdirs -p$(pdkms) usr/src/$(sname)-$(sversion)
# Copy only the driver source to the proper locations
cd kernel-module && cp Makefile *.c *.h ../debian/$(psource)/usr/src/modules/$(sname)
cd kernel-module && cp Makefile *.c *.h ../debian/$(pdkms)/usr/src/$(sname)-$(sversion)
# Copy the needed debian/ pieces to the proper location
cp debian/*.modules.in* debian/$(psource)/usr/src/modules/$(sname)/debian
cp debian/control debian/changelog debian/copyright \
debian/$(psource)/usr/src/modules/$(sname)/debian/
install -m 0755 debian/rules.modules debian/$(psource)/usr/src/modules/$(sname)/debian/rules
cd debian/$(psource)/usr/src && tar c modules | bzip2 -9 > $(sname).tar.bz2 && rm -rf modules
# Prepare dkms.conf from the dkms.conf.in template
sed "s/__VERSION__/$(sversion)/g" debian/dkms.conf.in > debian/$(pdkms)/usr/src/$(sname)-$(sversion)/dkms.conf
# markdown README
markdown README.md | gzip -9 > debian/README.html.gz
gzip -9 < README.md > debian/README.md.gz
dh_auto_install
override_dh_install:
dh_install
dh_installdirs -prtpengine-iptables $(XTABLES_DIR)
install -m 0644 iptables-extension/libxt_RTPENGINE.so debian/rtpengine-iptables/$(XTABLES_DIR)
override_dh_dwz:
# Disable, as dwz cannot cope with some of the plugins generated.
override_dh_installsystemd:
dh_installsystemd
dh_installsystemd -prtpengine-recording-daemon --name=rtpengine-recording-nfs-mount

@ -0,0 +1,82 @@
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
CFLAGS ?= -g -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wstrict-prototypes
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif
# Name of the source package
psource:=rtpengine-kernel-source
# The short upstream name, used for the module source directory
sname:=rtpengine
### KERNEL SETUP
### Setup the stuff needed for making kernel module packages
### taken from /usr/share/kernel-package/sample.module.rules
# prefix of the target package name
PACKAGE=rtpengine-kernel-modules
# modifieable for experiments or debugging m-a
MA_DIR ?= /usr/share/modass
# load generic variable handling
-include $(MA_DIR)/include/generic.make
# load default rules, including kdist, kdist_image, ...
-include $(MA_DIR)/include/common-rules.make
# module assistant calculates all needed things for us and sets
# following variables:
# KSRC (kernel source directory), KVERS (kernel version string), KDREV
# (revision of the Debian kernel-image package), CC (the correct
# compiler), VERSION (the final package version string), PKGNAME (full
# package name with KVERS included), DEB_DESTDIR (path to store DEBs)
# The kdist_configure target is called by make-kpkg modules_config and
# by kdist* rules by dependency. It should configure the module so it is
# ready for compilation (mostly useful for calling configure).
# prep-deb-files from module-assistant creates the necessary debian/ files
kdist_configure: prep-deb-files
# the kdist_clean target is called by make-kpkg modules_clean and from
# kdist* rules. It is responsible for cleaning up any changes that have
# been made by the other kdist_commands (except for the .deb files created)
kdist_clean: clean
$(MAKE) $(MFLAGS) -f debian/rules clean
#
### end KERNEL SETUP
# the binary-modules rule is invoked by module-assistant while processing the
# kdist* targets. It is called by module-assistant or make-kpkg and *not*
# during a normal build
binary-modules: prep-deb-files
dh_testroot
dh_prep
# Build the module
$(MAKE) modules KSRC=$(KSRC) KVER=$(KVERS)
# Install the module
install -D -m 0644 xt_RTPENGINE.ko debian/$(PACKAGE)-$(KVERS)/lib/modules/$(KVERS)/extra/xt_RTPENGINE.ko
dh_installdocs
dh_installchangelogs
dh_compress
dh_fixperms
dh_installmodules
dh_installdeb
dh_gencontrol -- -v$(VERSION)
dh_md5sums
dh_builddeb --destdir=$(DEB_DESTDIR)
clean:
dh_testdir
$(MAKE) clean
dh_clean
.PHONY: clean binary-modules kdist kdist_configure kdist_image kdist_clean

@ -0,0 +1 @@
extend-diff-ignore=.gitreview

@ -0,0 +1,15 @@
*.debhelper
*.log
*.substvars
/.debhelper/
/debhelper-build-stamp
/files
/rtpengine-daemon/
/rtpengine-iptables/
/rtpengine-kernel-dkms/
/rtpengine-kernel-source/
/rtpengine-recording-daemon/
/rtpengine-utils/
/rtpengine/
README.html.gz
README.md.gz

@ -0,0 +1,2 @@
debian/README.html.gz
debian/README.md.gz

@ -0,0 +1,144 @@
Source: rtpengine
Section: net
Priority: optional
Maintainer: Sipwise Development Team <support@sipwise.com>
Homepage: https://www.sipwise.com/
Standards-Version: 3.9.8
Build-Depends:
debhelper-compat (= 12),
default-libmysqlclient-dev,
gperf,
libavcodec-dev (>= 6:10),
libavfilter-dev (>= 6:10),
libavformat-dev (>= 6:10),
libavutil-dev (>= 6:10),
libbcg729-dev <!pkg.rtpengine.nobcg729>,
libbencode-perl,
libcrypt-openssl-rsa-perl,
libcrypt-rijndael-perl,
libcurl4-openssl-dev | libcurl4-gnutls-dev,
libdigest-crc-perl,
libdigest-hmac-perl,
libevent-dev (>= 2.0),
libglib2.0-dev (>= 2.30),
libhiredis-dev,
libio-multiplex-perl,
libio-socket-inet6-perl,
libio-socket-ip-perl,
libiptc-dev,
libjson-glib-dev,
libnet-interface-perl,
libpcap0.8-dev,
libpcre3-dev,
libsocket6-perl,
libspandsp-dev,
libssl-dev (>= 1.0.1),
libswresample-dev (>= 6:10),
libsystemd-dev,
libwebsockets-dev,
libxmlrpc-core-c3-dev (>= 1.16.07),
libxtables-dev (>= 1.4) | iptables-dev (>= 1.4),
markdown,
zlib1g-dev,
Package: rtpengine-daemon
Architecture: any
Recommends:
rtpengine-recording-daemon,
rtpengine-utils,
Depends:
iptables,
lsb-base (>= 3.0-6),
${misc:Depends},
${shlibs:Depends},
Conflicts:
ngcp-rtpengine-daemon,
Description: proxy for RTP and media streams used in NGCP, userspace part
This daemon handles the first stages of proxying media streams and talks to
the kernel part of the proxy for eventual high-performance packet forwarding.
Package: rtpengine-recording-daemon
Architecture: any
Build-Profiles: <!pkg.rtpengine.no-transcoding>
Recommends:
rtpengine-utils,
Depends:
lsb-base (>= 3.0-6),
nfs-common,
${misc:Depends},
${shlibs:Depends},
Conflicts:
ngcp-rtpengine-recording-daemon,
Description: recording daemon for RTP and media streams
This daemon handles the call recording (media intercept) component of rtpengine.
Package: rtpengine-iptables
Architecture: any
Depends:
${misc:Depends},
${shlibs:Depends},
Conflicts:
ngcp-rtpengine-iptables,
Description: IPtables extension module for the kernel-space NGCP media proxy
Provides the IPtables extension needed to configure the mediaproxy rule.
Package: rtpengine
Architecture: all
Depends:
rtpengine-daemon (>= ${source:Version}),
rtpengine-iptables (>= ${source:Version}),
rtpengine-kernel-dkms (>= ${source:Version}),
rtpengine-recording-daemon (>= ${source:Version}),
rtpengine-utils (>= ${source:Version}),
${misc:Depends},
Description: NGCP RTP/media proxy - meta package
This is a meta package for easy installation of all four parts of the NGCP
media proxy. It will install the user-space daemon, the kernel-space IPtables
module, the IPtables extension module and utility scripts.
Package: rtpengine-kernel-source
Architecture: all
Section: kernel
Depends:
debhelper-compat (= 12),
module-assistant,
${misc:Depends},
Conflicts:
ngcp-rtpengine-kernel-source,
Description: IPtables kernel module for the NGCP media proxy - source
Provides the kernel-space part of the NGCP media proxy for high-
performance packet forwarding.
This package contains the source to be built with module-assistant or
kernel-package.
Package: rtpengine-kernel-dkms
Architecture: all
Section: kernel
Depends:
dkms (>= 1.95),
lsb-release,
${misc:Depends},
Conflicts:
ngcp-rtpengine-kernel-dkms,
Description: IPtables kernel module for the NGCP media proxy - DKMS
Provides the kernel-space part of the NGCP media proxy for high-
performance packet forwarding.
This package contains the source to be built with dkms.
Package: rtpengine-utils
Architecture: all
Depends:
libbencode-perl,
libconfig-tiny-perl,
libcrypt-rijndael-perl,
libdigest-hmac-perl,
libio-socket-inet6-perl,
libio-socket-ip-perl,
libsocket6-perl,
netcat-openbsd | netcat,
${misc:Depends},
${perl:Depends},
Conflicts:
ngcp-rtpengine-utils,
Description: scripts and Perl modules for NGCP rtpengine
This package contains scripts and Perl modules for NGCP rtpengine

@ -0,0 +1,18 @@
Source: rtpengine
Section: kernel
Priority: optional
Maintainer: Sipwise Development Team <support@sipwise.com>
Build-Depends:
debhelper-compat (= 12),
Standards-Version: 3.9.8
Homepage: https://www.sipwise.com/
Package: rtpengine-kernel-modules-_KVERS_
Architecture: any
Depends:
linux-modules-_KVERS_ | linux-image-_KVERS_,
Conflicts:
ngcp-rtpengine-kernel-modules-_KVERS_,
Description: IPtables kernel module for the NGCP media proxy
This package provides the rtpengine module for
the Linux kernel version _KVERS_.

@ -0,0 +1,36 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Source: https://www.sipwise.com/
Upstream-Contact: Sipwise Development Team <support@sipwise.com>
Files: *
Copyright:
Copyright © 2007-2019 Sipwise GmbH, Austria
License: GPL-3+ with OpenSSL exception
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
.
In addition, as a special exception, the copyright holders give
permission to link the code of this release with the OpenSSL project's
"OpenSSL" library (or with modified versions of it that use the same
license as the "OpenSSL" library), and distribute the linked executables.
.
You must obey the GNU General Public License in all respects for all
of the code used other than "OpenSSL". If you modify file(s) with this
exception, you may extend this exception to your version of the file(s),
but you are not obligated to do so. If you do not wish to do so,
delete this exception statement from your version. If you delete
this exception statement from all source files in the program, then
also delete it here.
.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Comment:
On Debian systems, the full text of the GNU General Public License
version 3 can be found in the file '/usr/share/common-licenses/GPL-3'.

@ -0,0 +1,7 @@
PACKAGE_NAME="rtpengine"
PACKAGE_VERSION="__VERSION__"
MAKE[0]="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build RTPENGINE_VERSION=\"__VERSION__\""
CLEAN="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build clean"
AUTOINSTALL=yes
BUILT_MODULE_NAME[0]="xt_RTPENGINE"
DEST_MODULE_LOCATION[0]=/extra

@ -0,0 +1,8 @@
RUN_RTPENGINE=no
CONFIG_FILE=/etc/rtpengine/rtpengine.conf
# CONFIG_SECTION=rtpengine
PIDFILE=/run/rtpengine-daemon.pid
MANAGE_IPTABLES=yes
TABLE=0
#SET_USER=root
#SET_GROUP=root # GROUP only needs to be set if USER is not set or if the user isn't in the group

@ -0,0 +1,187 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: rtpengine-daemon
# Required-Start: $network $local_fs $remote_fs $syslog
# Required-Stop: $network $local_fs $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Ngcp Rtpengine
# Description: Proxy for RTP and other media streams
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
NAME=rtpengine-daemon
DESC="RTP/media proxy"
TABLE=0
DAEMON=$(which rtpengine)
DEFAULTS=/etc/default/${NAME}
test -f "$DAEMON" || exit 0
. /lib/lsb/init-functions
# Load startup options if available
if [ -f "$DEFAULTS" ]; then
. "$DEFAULTS" || true
fi
if [ "$RUN_RTPENGINE" != "yes" ]; then
log_action_msg "rtpengine not yet configured. Edit $DEFAULTS first."
exit 0
fi
[ -z "$PIDFILE" ] && PIDFILE="/run/rtpengine.pid"
OPTIONS=""
START_OPTIONS=""
if [ -n "$INTERFACES" ]; then
for interface in $INTERFACES; do
OPTIONS="$OPTIONS --interface=$interface"
done
fi
if [ -n "$SUBSCRIBE_KEYSPACES" ]; then
for ks in $SUBSCRIBE_KEYSPACES; do
OPTIONS="$OPTIONS --subscribe-keyspace=$ks"
done
fi
[ -z "$CONFIG_FILE" ] || OPTIONS="$OPTIONS --config-file=$CONFIG_FILE"
[ -z "$CONFIG_SECTION" ] || OPTIONS="$OPTIONS --config-section=$CONFIG_SECTION"
[ -z "$ADDRESS" ] || OPTIONS="$OPTIONS --interface=$ADDRESS"
[ -z "$ADV_ADDRESS" ] || OPTIONS="$OPTIONS!$ADV_ADDRESS"
[ -z "$ADDRESS_IPV6" ] || OPTIONS="$OPTIONS --interface=$ADDRESS_IPV6"
[ -z "$ADV_ADDRESS_IPV6" ] || OPTIONS="$OPTIONS!$ADV_ADDRESS_IPV6"
[ -z "$LISTEN_TCP" ] || OPTIONS="$OPTIONS --listen-tcp=$LISTEN_TCP"
[ -z "$LISTEN_UDP" ] || OPTIONS="$OPTIONS --listen-udp=$LISTEN_UDP"
[ -z "$LISTEN_NG" ] || OPTIONS="$OPTIONS --listen-ng=$LISTEN_NG"
[ -z "$LISTEN_CLI" ] || OPTIONS="$OPTIONS --listen-cli=$LISTEN_CLI"
[ -z "$TIMEOUT" ] || OPTIONS="$OPTIONS --timeout=$TIMEOUT"
[ -z "$SILENT_TIMEOUT" ] || OPTIONS="$OPTIONS --silent-timeout=$SILENT_TIMEOUT"
[ -z "$FINAL_TIMEOUT" ] || OPTIONS="$OPTIONS --final-timeout=$FINAL_TIMEOUT"
[ -z "$PIDFILE" ] || OPTIONS="$OPTIONS --pidfile=$PIDFILE"
[ -z "$TOS" ] || OPTIONS="$OPTIONS --tos=$TOS"
[ -z "$PORT_MIN" ] || OPTIONS="$OPTIONS --port-min=$PORT_MIN"
[ -z "$PORT_MAX" ] || OPTIONS="$OPTIONS --port-max=$PORT_MAX"
[ -z "$REDIS" ] || [ -z "$REDIS_DB" ] || OPTIONS="$OPTIONS --redis=$REDIS/$REDIS_DB"
[ -z "$REDIS_AUTH_PW" ] || export RTPENGINE_REDIS_AUTH_PW="$REDIS_AUTH_PW"
[ -z "$REDIS_WRITE" ] || [ -z "$REDIS_WRITE_DB" ] || OPTIONS="$OPTIONS --redis-write=$REDIS_WRITE/$REDIS_WRITE_DB"
[ -z "$REDIS_WRITE_AUTH_PW" ] || export RTPENGINE_REDIS_WRITE_AUTH_PW="$REDIS_WRITE_AUTH_PW"
[ -z "$REDIS_NUM_THREADS" ] || OPTIONS="$OPTIONS --redis-num-threads=$REDIS_NUM_THREADS"
[ -z "$REDIS_EXPIRES" ] || OPTIONS="$OPTIONS --redis-expires=$REDIS_EXPIRES"
[ -z "$REDIS_MULTIKEY" ] || OPTIONS="$OPTIONS --redis-multikey=$REDIS_MULTIKEY"
[ -z "$NO_REDIS_REQUIRED" ] || { [ "$NO_REDIS_REQUIRED" != "1" ] && [ "$NO_REDIS_REQUIRED" != "yes" ] ; } || OPTIONS="$OPTIONS --no-redis-required"
[ -z "$B2B_URL" ] || OPTIONS="$OPTIONS --b2b-url=$B2B_URL"
[ -z "$NO_FALLBACK" ] || { [ "$NO_FALLBACK" != "1" ] && [ "$NO_FALLBACK" != "yes" ] ; } || OPTIONS="$OPTIONS --no-fallback"
OPTIONS="$OPTIONS --table=$TABLE"
[ -z "$LOG_LEVEL" ] || OPTIONS="$OPTIONS --log-level=$LOG_LEVEL"
[ -z "$LOG_FACILITY" ] || OPTIONS="$OPTIONS --log-facility=$LOG_FACILITY"
[ -z "$LOG_FACILITY_CDR" ] || OPTIONS="$OPTIONS --log-facility-cdr=$LOG_FACILITY_CDR"
[ -z "$LOG_FACILITY_RTCP" ] || OPTIONS="$OPTIONS --log-facility-rtcp=$LOG_FACILITY_RTCP"
[ -z "$NUM_THREADS" ] || OPTIONS="$OPTIONS --num-threads=$NUM_THREADS"
[ -z "$DELETE_DELAY" ] || OPTIONS="$OPTIONS --delete-delay=$DELETE_DELAY"
[ -z "$GRAPHITE" ] || OPTIONS="$OPTIONS --graphite=$GRAPHITE"
[ -z "$GRAPHITE_INTERVAL" ] || OPTIONS="$OPTIONS --graphite-interval=$GRAPHITE_INTERVAL"
[ -z "$GRAPHITE_PREFIX" ] || OPTIONS="$OPTIONS --graphite-prefix=$GRAPHITE_PREFIX"
[ -z "$MAX_SESSIONS" ] || OPTIONS="$OPTIONS --max-sessions=$MAX_SESSIONS"
[ -z "$HOMER" ] || OPTIONS="$OPTIONS --homer=$HOMER"
[ -z "$HOMER_PROTOCOL" ] || OPTIONS="$OPTIONS --homer-protocol=$HOMER_PROTOCOL"
[ -z "$HOMER_ID" ] || OPTIONS="$OPTIONS --homer-id=$HOMER_ID"
if [ -n "$RECORDING_DIR" ]; then
OPTIONS="$OPTIONS --recording-dir=$RECORDING_DIR"
if [ ! -d "$RECORDING_DIR" ]; then
mkdir "$RECORDING_DIR" 2> /dev/null
chmod 700 "$RECORDING_DIR" 2> /dev/null
fi
fi
[ -z "$RECORDING_METHOD" ] || OPTIONS="$OPTIONS --recording-method=$RECORDING_METHOD"
[ -z "$RECORDING_FORMAT" ] || OPTIONS="$OPTIONS --recording-format=$RECORDING_FORMAT"
[ -z "$DTLS_PASSIVE" ] || { [ "$DTLS_PASSIVE" != "yes" ] && [ "$DTLS_PASSIVE" != "1" ] ; } || OPTIONS="$OPTIONS --dtls-passive"
if test "$FORK" = "no" ; then
OPTIONS="$OPTIONS --foreground"
fi
if test "$LOG_STDERR" = "yes" ; then
OPTIONS="$OPTIONS --log-stderr"
fi
# check if directory for pid file needs to be created
PIDDIR=$(dirname "$PIDFILE")
DO_DIR_CHOWN=0
if ! test -z "$PIDDIR" && ! test -d "$PIDDIR"; then
mkdir -p "$PIDDIR"
DO_DIR_CHOWN=1
fi
# handle requested setuid/setgid
if ! test -z "$SET_USER"; then
START_OPTIONS="$START_OPTIONS --chuid $SET_USER"
test "$DO_DIR_CHOWN" = 1 && chown "$SET_USER": "$PIDDIR"
fi
if ! test -z "$SET_GROUP"; then
START_OPTIONS="$START_OPTIONS --group $SET_GROUP"
test "$DO_DIR_CHOWN" = 1 && chgrp "$SET_GROUP" "$PIDDIR"
fi
###
case "$1" in
start)
if [ -x "$(which ngcp-check-active)" ]; then
case "$(ngcp-check-active -v)" in
active|transition)
log_action_msg "Active node or transition."
;;
*)
log_action_msg "Ignored start action in inactive node"
exit 0
;;
esac
fi
RC=0
rtpengine-iptables-setup start || RC=$?
if [ "$RC" -ne 0 ]; then
log_action_msg "Failed to start rtpengine-iptables-setup"
log_end_msg "$RC"
exit 1
fi
log_daemon_msg "Starting $DESC" "$NAME"
# shellcheck disable=SC2086
start-stop-daemon --start --quiet --pidfile "$PIDFILE" \
--exec "$DAEMON" $START_OPTIONS -- $OPTIONS || log_progress_msg " already running"
log_end_msg $?
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
RC=0
start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \
--retry 5 --exec "$DAEMON" || RC=$?
if [ "$RC" -eq 0 ]; then
rtpengine-iptables-setup stop || true
fi
rm -f "$PIDFILE"
log_end_msg "$RC"
exit "$RC"
;;
restart|force-reload)
$0 stop
$0 start
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
*)
echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2
exit 1
;;
esac
exit 0

@ -0,0 +1,3 @@
daemon/rtpengine /usr/sbin/
debian/rtpengine-iptables-setup /usr/sbin
etc/rtpengine.sample.conf /etc/rtpengine/

@ -0,0 +1 @@
/lib/systemd/system/rtpengine-daemon.service /lib/systemd/system/rtpengine.service

@ -0,0 +1,38 @@
#!/bin/sh
set -e
default=/etc/default/rtpengine-daemon
modname=xt_RTPENGINE
if [ -x "$(which ngcp-virt-identify)" ]; then
if ngcp-virt-identify --type container; then
VIRT="yes"
fi
fi
if [ "$VIRT" = "yes" ]; then
echo "Container environment detected. Skip kernel module check"
else
if [ -f $default ]; then
. $default || true
fi
if [ -n "$TABLE" ] && [ "$TABLE" -ge 0 ] && \
[ -n "$NO_FALLBACK" ] && \
{ [ "$NO_FALLBACK" = "1" ] || [ "$NO_FALLBACK" = "yes" ] ; }
then
if lsmod | grep -q $modname || modinfo $modname > /dev/null 2> /dev/null; then
true
else
echo "Kernel module $modname not found and NO_FALLBACK is set."
echo "Daemon restart not performed."
exit 0
fi
fi
fi
#DEBHELPER#
exit 0

@ -0,0 +1,16 @@
[Unit]
Description=NGCP RTP/media Proxy Daemon
After=network-online.target
After=remote-fs.target
Requires=network-online.target
[Service]
Type=notify
EnvironmentFile=/etc/default/rtpengine-daemon
PIDFile=/run/rtpengine-daemon.pid
ExecStartPre=/usr/sbin/rtpengine-iptables-setup start
ExecStart=/usr/sbin/rtpengine -f -E --no-log-timestamps --pidfile /run/rtpengine-daemon.pid --config-file /etc/rtpengine/rtpengine.conf
ExecStopPost=/usr/sbin/rtpengine-iptables-setup stop
[Install]
WantedBy=multi-user.target

@ -0,0 +1 @@
daemon/*.h /usr/include/rtpengine/

@ -0,0 +1,101 @@
#!/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
TABLE=0
MODNAME=xt_RTPENGINE
MANAGE_IPTABLES=yes
DEFAULTS=/etc/default/rtpengine-daemon
# Load startup options if available
if [ -f "$DEFAULTS" ]; then
. "$DEFAULTS" || true
fi
MODPROBE_OPTIONS=""
# Handle requested setuid/setgid.
if ! test -z "$SET_USER"; then
PUID=$(id -u "$SET_USER" 2> /dev/null)
test -z "$PUID" || MODPROBE_OPTIONS="$MODPROBE_OPTIONS proc_uid=$PUID"
if test -z "$SET_GROUP"; then
PGID=$(id -g "$SET_USER" 2> /dev/null)
test -z "$PGID" || MODPROBE_OPTIONS="$MODPROBE_OPTIONS proc_gid=$PGID"
fi
fi
if ! test -z "$SET_GROUP"; then
PGID=$(grep "^$SET_GROUP:" /etc/group | cut -d: -f3 2> /dev/null)
test -z "$PGID" || MODPROBE_OPTIONS="$MODPROBE_OPTIONS proc_gid=$PGID"
fi
###
if [ -x "$(which ngcp-virt-identify)" ]; then
if ngcp-virt-identify --type container; then
VIRT="yes"
fi
fi
firewall_setup()
{
if [ "$TABLE" -lt 0 ] || [ "$VIRT" = "yes" ]; then
return
fi
if [ "$MANAGE_IPTABLES" != "yes" ]; then
return
fi
# shellcheck disable=SC2086
modprobe $MODNAME $MODPROBE_OPTIONS
iptables -N rtpengine 2>/dev/null
iptables -D INPUT -j rtpengine 2>/dev/null
iptables -D INPUT -p udp -j rtpengine 2>/dev/null
iptables -I INPUT -p udp -j rtpengine
iptables -D rtpengine -p udp -j RTPENGINE --id "$TABLE" 2>/dev/null
iptables -I rtpengine -p udp -j RTPENGINE --id "$TABLE"
ip6tables -N rtpengine 2>/dev/null
ip6tables -D INPUT -j rtpengine 2>/dev/null
ip6tables -D INPUT -p udp -j rtpengine 2>/dev/null
ip6tables -I INPUT -p udp -j rtpengine
ip6tables -D rtpengine -p udp -j RTPENGINE --id "$TABLE" 2>/dev/null
ip6tables -I rtpengine -p udp -j RTPENGINE --id "$TABLE"
}
firewall_teardown()
{
if [ "$TABLE" -lt 0 ] || [ "$VIRT" = "yes" ]; then
return
fi
# XXX: Wait a bit to make sure the daemon has been stopped.
sleep 1
if [ -e /proc/rtpengine/control ]; then
echo "del $TABLE" >/proc/rtpengine/control 2>/dev/null
fi
if [ "$MANAGE_IPTABLES" != "yes" ]; then
return
fi
iptables -D rtpengine -p udp -j RTPENGINE --id "$TABLE" 2>/dev/null
ip6tables -D rtpengine -p udp -j RTPENGINE --id "$TABLE" 2>/dev/null
}
case "$1" in
start)
firewall_setup
;;
stop)
firewall_teardown
;;
*)
echo "Usage: $0 {start|stop}" >&2
exit 1
;;
esac
exit 0

@ -0,0 +1,46 @@
#!/bin/sh
set -e
package=rtpengine-kernel-dkms
name=rtpengine
version=$(dpkg-query -W -f="\${Version}" "$package" \
|rev|cut -d- -f2-|rev|cut -d':' -f2|tr -d "\n")
if [ -x "$(which ngcp-virt-identify)" ]; then
if ngcp-virt-identify --type container; then
VIRT="yes"
fi
fi
if [ "$VIRT" = "yes" ]; then
echo "Container environment detected. Skip dkms"
else
isadded=$(dkms status -m "$name" -v "$version")
if [ -z "${isadded}" ] ; then
dkms add -m "$name" -v "$version"
fi
if [ "$1" = 'configure' ] ; then
KERNELS=$(ls /lib/modules/ 2>/dev/null || true)
for kernel in $KERNELS; do
if [ ! -r "/lib/modules/$kernel/build" ]; then
# cannot build modules for this kernel
continue
fi
( dkms build -m "$name" -v "$version" -k "$kernel" && dkms install -m "$name" -v "$version" -k "$kernel" ) || true
done
# try to start the daemon
if [ -x /etc/init.d/rtpengine-daemon ] ; then
invoke-rc.d rtpengine-daemon restart || true
fi
fi
fi
#DEBHELPER#
exit 0

@ -0,0 +1,32 @@
#!/bin/sh
set -e
package=rtpengine-kernel-dkms
name=rtpengine
modname=xt_RTPENGINE
version=$(dpkg-query -W -f="\${Version}" "$package" \
|rev|cut -d- -f2-|rev|cut -d':' -f2|tr -d "\n")
if [ -x "$(which ngcp-virt-identify)" ]; then
if ngcp-virt-identify --type container; then
VIRT="yes"
fi
fi
# make sure it's not running
if [ -x /etc/init.d/rtpengine-daemon ] ; then
invoke-rc.d rtpengine-daemon stop || true
rmmod "$modname" 2>/dev/null || true
fi
if [ "$VIRT" = "yes" ]; then
echo "Container environment detected. Skip dkms"
else
dkms remove -m "$name" -v "$version" --all || true
fi
#DEBHELPER#
exit 0

@ -0,0 +1 @@
/usr/share/modass/packages/default.sh /usr/share/modass/overrides/rtpengine-kernel-source

@ -0,0 +1,12 @@
RUN_RTPENGINE_RECORDING=no
CONFIG_FILE=/etc/rtpengine/rtpengine-recording.conf
# CONFIG_SECTION=rtpengine-recording
PIDFILE=/run/rtpengine-recording-daemon.pid
#SET_USER=root
#SET_GROUP=root # GROUP only needs to be set if USER is not set or if the user isn't in the group
#
MUST_NFS=no
NFS_HOST=192.168.1.1
NFS_REMOTE_PATH=/var/recordings
NFS_LOCAL_MOUNT=/var/lib/rtpengine-recording # must match output-dir if used
NFS_OPTIONS=hard,intr,tcp

@ -0,0 +1,2 @@
var/lib/rtpengine-recording
var/spool/rtpengine

@ -0,0 +1,116 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: rtpengine-recording-daemon
# Required-Start: $network $local_fs $remote_fs $syslog
# Required-Stop: $network $local_fs $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Ngcp Rtpengine Recording Daemon
# Description: Recording daemon for RTP and other media streams
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
NAME=rtpengine-recording-daemon
DESC="RTP/media recording daemon"
DAEMON=$(which rtpengine-recording)
DEFAULTS=/etc/default/${NAME}
test -f "$DAEMON" || exit 0
. /lib/lsb/init-functions
# Load startup options if available
if [ -f "$DEFAULTS" ]; then
. "$DEFAULTS" || true
fi
if [ "$RUN_RTPENGINE_RECORDING" != "yes" ]; then
log_action_msg "rtpengine-recording not yet configured. Edit $DEFAULTS first."
exit 0
fi
[ -z "$PIDFILE" ] && PIDFILE="/run/rtpengine-recording.pid"
OPTIONS=""
START_OPTIONS=""
[ -z "$CONFIG_FILE" ] || OPTIONS="$OPTIONS --config-file=$CONFIG_FILE"
[ -z "$PIDFILE" ] || OPTIONS="$OPTIONS --pidfile=$PIDFILE"
# check if directory for pid file needs to be created
PIDDIR=$(dirname "$PIDFILE")
DO_DIR_CHOWN=0
if ! test -z "$PIDDIR" && ! test -d "$PIDDIR"; then
mkdir -p "$PIDDIR"
DO_DIR_CHOWN=1
fi
# handle requested setuid/setgid
if ! test -z "$SET_USER"; then
START_OPTIONS="$START_OPTIONS --chuid $SET_USER"
test "$DO_DIR_CHOWN" = 1 && chown "$SET_USER": "$PIDDIR"
fi
if ! test -z "$SET_GROUP"; then
START_OPTIONS="$START_OPTIONS --group $SET_GROUP"
test "$DO_DIR_CHOWN" = 1 && chgrp "$SET_GROUP" "$PIDDIR"
fi
###
case "$1" in
start)
if [ -x "$(which ngcp-check-active)" ]; then
case "$(ngcp-check-active -v)" in
active|transition)
log_action_msg "Active node or transition."
;;
*)
log_action_msg "Ignored start action in inactive node"
exit 0
;;
esac
fi
RC=0
rtpengine-recording-nfs-setup start || RC=$?
if [ "$RC" -ne 0 ] ; then
log_action_msg "Failed to start rtpengine-recording-nfs-setup"
log_end_msg "$RC"
exit "$RC"
fi
log_daemon_msg "Starting $DESC" "$NAME"
# shellcheck disable=SC2086
start-stop-daemon --start --quiet --pidfile "$PIDFILE" \
--exec "$DAEMON" $START_OPTIONS -- $OPTIONS || log_progress_msg " already running"
log_end_msg $?
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
RC=0
start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \
--retry 5 --exec "$DAEMON" || RC=$?
rm -f "$PIDFILE"
log_end_msg "$RC"
exit "$RC"
;;
force-reload|restart)
$0 stop
$0 start
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
*)
echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2
exit 1
;;
esac
exit 0

@ -0,0 +1,3 @@
debian/rtpengine-recording-nfs-setup /usr/sbin/
etc/rtpengine-recording.sample.conf /etc/rtpengine/
recording-daemon/rtpengine-recording /usr/sbin/

@ -0,0 +1 @@
/lib/systemd/system/rtpengine-recording-daemon.service /lib/systemd/system/rtpengine-recording.service

@ -0,0 +1 @@
recording-daemon/rtpengine-recording.8

@ -0,0 +1,20 @@
[Unit]
Description=NGCP RTP/media Recording Daemon NFS mount point
After=network-online.target
After=remote-fs.target
After=rpcbind.socket
After=rpcbind.service
After=nfs-client.target
Requires=network-online.target
Requires=rpcbind.socket
Requires=rpcbind.service
Requires=nfs-client.target
[Service]
Type=simple
RemainAfterExit=yes
ExecStart=/usr/sbin/rtpengine-recording-nfs-setup start
ExecStop=/usr/sbin/rtpengine-recording-nfs-setup stop
[Install]
WantedBy=multi-user.target

@ -0,0 +1,16 @@
[Unit]
Description=NGCP RTP/media Recording Daemon
After=network-online.target
After=remote-fs.target
After=rtpengine-recording-nfs-mount.service
Requires=network-online.target
Requires=rtpengine-recording-nfs-mount.service
[Service]
Type=notify
LimitNOFILE=100000
PIDFile=/run/rtpengine-recording-daemon.pid
ExecStart=/usr/sbin/rtpengine-recording -f -E --no-log-timestamps --pidfile /run/rtpengine-recording-daemon.pid --config-file /etc/rtpengine/rtpengine-recording.conf
[Install]
WantedBy=multi-user.target

@ -0,0 +1,42 @@
#!/bin/sh
set -e
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DEFAULTS=/etc/default/rtpengine-recording-daemon
DESC="RTP engine recording NFS share"
. /lib/lsb/init-functions
# Load startup options if available
if [ -f "$DEFAULTS" ]; then
. "$DEFAULTS" || true
fi
[ -z "$NFS_OPTIONS" ] && NFS_OPTIONS="hard,tcp,intr"
###
case "$1" in
start)
if [ "$MUST_NFS" = yes ]; then
if ! grep -E -q "^[^ :]+:[^ :]+ $NFS_LOCAL_MOUNT nfs.? " /proc/mounts; then
log_action_msg "Mounting $DESC"
test -d "$NFS_LOCAL_MOUNT" || mkdir -p "$NFS_LOCAL_MOUNT"
mount -t nfs -o "$NFS_OPTIONS" "$NFS_HOST:$NFS_REMOTE_PATH" "$NFS_LOCAL_MOUNT"
fi
fi
;;
stop)
if grep -E -q "^[^ :]+:[^ :]+ $NFS_LOCAL_MOUNT nfs.? " /proc/mounts; then
log_action_msg "Unmounting $DESC"
umount "$NFS_LOCAL_MOUNT"
fi
;;
*)
echo "Usage: $0 {start|stop}" >&2
exit 1
;;
esac
exit 0

@ -0,0 +1,3 @@
perl/* /usr/share/perl5/
utils/rtpengine-ctl /usr/sbin/
utils/rtpengine-ng-client /usr/sbin/

@ -0,0 +1,2 @@
debian/README.html.gz
debian/README.md.gz

@ -0,0 +1,64 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
# export DH_VERBOSE=1
include /usr/share/dpkg/pkg-info.mk
## kernel package specific stuff
# Name of the source package
psource:=rtpengine-kernel-source
# Name of the dkms package
pdkms:=rtpengine-kernel-dkms
# short upstream name, used for module source directory
sname:=rtpengine
# Source version
sversion:=$(DEB_VERSION_UPSTREAM)
## end of kernel package specific stuff
XTABLES_DIR:=$(shell pkg-config xtables --variable=xtlibdir || echo /lib/xtables)
ifneq (,$(filter $(DEB_BUILD_PROFILES),pkg.rtpengine.no-transcoding))
export with_transcoding = no
endif
%:
dh $@
override_dh_auto_install-indep:
# Create the directories to install the source into
dh_installdirs -p$(psource) usr/src/modules/$(sname)/debian
dh_installdirs -p$(pdkms) usr/src/$(sname)-$(sversion)
# Copy only the driver source to the proper locations
cd kernel-module && cp Makefile *.c *.h ../debian/$(psource)/usr/src/modules/$(sname)
cd kernel-module && cp Makefile *.c *.h ../debian/$(pdkms)/usr/src/$(sname)-$(sversion)
# Copy the needed debian/ pieces to the proper location
cp debian/*.modules.in* debian/$(psource)/usr/src/modules/$(sname)/debian
cp debian/control debian/changelog debian/copyright \
debian/$(psource)/usr/src/modules/$(sname)/debian/
install -m 0755 debian/rules.modules debian/$(psource)/usr/src/modules/$(sname)/debian/rules
cd debian/$(psource)/usr/src && tar c modules | bzip2 -9 > $(sname).tar.bz2 && rm -rf modules
# Prepare dkms.conf from the dkms.conf.in template
sed "s/__VERSION__/$(sversion)/g" debian/dkms.conf.in > debian/$(pdkms)/usr/src/$(sname)-$(sversion)/dkms.conf
# markdown README
markdown README.md | gzip -9 > debian/README.html.gz
gzip -9 < README.md > debian/README.md.gz
dh_auto_install
override_dh_install:
dh_install
dh_installdirs -prtpengine-iptables $(XTABLES_DIR)
install -m 0644 iptables-extension/libxt_RTPENGINE.so debian/rtpengine-iptables/$(XTABLES_DIR)
override_dh_dwz:
# Disable, as dwz cannot cope with some of the plugins generated.
override_dh_installsystemd:
dh_installsystemd
dh_installsystemd -prtpengine-recording-daemon --name=rtpengine-recording-nfs-mount

@ -0,0 +1,82 @@
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
CFLAGS ?= -g -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wstrict-prototypes
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif
# Name of the source package
psource:=rtpengine-kernel-source
# The short upstream name, used for the module source directory
sname:=rtpengine
### KERNEL SETUP
### Setup the stuff needed for making kernel module packages
### taken from /usr/share/kernel-package/sample.module.rules
# prefix of the target package name
PACKAGE=rtpengine-kernel-modules
# modifieable for experiments or debugging m-a
MA_DIR ?= /usr/share/modass
# load generic variable handling
-include $(MA_DIR)/include/generic.make
# load default rules, including kdist, kdist_image, ...
-include $(MA_DIR)/include/common-rules.make
# module assistant calculates all needed things for us and sets
# following variables:
# KSRC (kernel source directory), KVERS (kernel version string), KDREV
# (revision of the Debian kernel-image package), CC (the correct
# compiler), VERSION (the final package version string), PKGNAME (full
# package name with KVERS included), DEB_DESTDIR (path to store DEBs)
# The kdist_configure target is called by make-kpkg modules_config and
# by kdist* rules by dependency. It should configure the module so it is
# ready for compilation (mostly useful for calling configure).
# prep-deb-files from module-assistant creates the necessary debian/ files
kdist_configure: prep-deb-files
# the kdist_clean target is called by make-kpkg modules_clean and from
# kdist* rules. It is responsible for cleaning up any changes that have
# been made by the other kdist_commands (except for the .deb files created)
kdist_clean: clean
$(MAKE) $(MFLAGS) -f debian/rules clean
#
### end KERNEL SETUP
# the binary-modules rule is invoked by module-assistant while processing the
# kdist* targets. It is called by module-assistant or make-kpkg and *not*
# during a normal build
binary-modules: prep-deb-files
dh_testroot
dh_prep
# Build the module
$(MAKE) modules KSRC=$(KSRC) KVER=$(KVERS)
# Install the module
install -D -m 0644 xt_RTPENGINE.ko debian/$(PACKAGE)-$(KVERS)/lib/modules/$(KVERS)/extra/xt_RTPENGINE.ko
dh_installdocs
dh_installchangelogs
dh_compress
dh_fixperms
dh_installmodules
dh_installdeb
dh_gencontrol -- -v$(VERSION)
dh_md5sums
dh_builddeb --destdir=$(DEB_DESTDIR)
clean:
dh_testdir
$(MAKE) clean
dh_clean
.PHONY: clean binary-modules kdist kdist_configure kdist_image kdist_clean

@ -0,0 +1 @@
extend-diff-ignore=.gitreview

@ -0,0 +1,15 @@
*.debhelper
*.log
*.substvars
/.debhelper/
/debhelper-build-stamp
/files
/rtpengine-daemon/
/rtpengine-iptables/
/rtpengine-kernel-dkms/
/rtpengine-kernel-source/
/rtpengine-recording-daemon/
/rtpengine-utils/
/rtpengine/
README.html.gz
README.md.gz

@ -0,0 +1,2 @@
debian/README.html.gz
debian/README.md.gz

@ -0,0 +1,144 @@
Source: rtpengine
Section: net
Priority: optional
Maintainer: Sipwise Development Team <support@sipwise.com>
Homepage: https://www.sipwise.com/
Standards-Version: 3.9.8
Build-Depends:
debhelper-compat (= 12),
default-libmysqlclient-dev,
gperf,
libavcodec-dev (>= 6:10),
libavfilter-dev (>= 6:10),
libavformat-dev (>= 6:10),
libavutil-dev (>= 6:10),
libbcg729-dev <!pkg.rtpengine.nobcg729>,
libbencode-perl,
libcrypt-openssl-rsa-perl,
libcrypt-rijndael-perl,
libcurl4-openssl-dev | libcurl4-gnutls-dev,
libdigest-crc-perl,
libdigest-hmac-perl,
libevent-dev (>= 2.0),
libglib2.0-dev (>= 2.30),
libhiredis-dev,
libio-multiplex-perl,
libio-socket-inet6-perl,
libio-socket-ip-perl,
libiptc-dev,
libjson-glib-dev,
libnet-interface-perl,
libpcap0.8-dev,
libpcre3-dev,
libsocket6-perl,
libspandsp-dev,
libssl-dev (>= 1.0.1),
libswresample-dev (>= 6:10),
libsystemd-dev,
libwebsockets-dev,
libxmlrpc-core-c3-dev (>= 1.16.07),
libxtables-dev (>= 1.4) | iptables-dev (>= 1.4),
markdown,
zlib1g-dev,
Package: rtpengine-daemon
Architecture: any
Recommends:
rtpengine-recording-daemon,
rtpengine-utils,
Depends:
iptables,
lsb-base (>= 3.0-6),
${misc:Depends},
${shlibs:Depends},
Conflicts:
ngcp-rtpengine-daemon,
Description: proxy for RTP and media streams used in NGCP, userspace part
This daemon handles the first stages of proxying media streams and talks to
the kernel part of the proxy for eventual high-performance packet forwarding.
Package: rtpengine-recording-daemon
Architecture: any
Build-Profiles: <!pkg.rtpengine.no-transcoding>
Recommends:
rtpengine-utils,
Depends:
lsb-base (>= 3.0-6),
nfs-common,
${misc:Depends},
${shlibs:Depends},
Conflicts:
ngcp-rtpengine-recording-daemon,
Description: recording daemon for RTP and media streams
This daemon handles the call recording (media intercept) component of rtpengine.
Package: rtpengine-iptables
Architecture: any
Depends:
${misc:Depends},
${shlibs:Depends},
Conflicts:
ngcp-rtpengine-iptables,
Description: IPtables extension module for the kernel-space NGCP media proxy
Provides the IPtables extension needed to configure the mediaproxy rule.
Package: rtpengine
Architecture: all
Depends:
rtpengine-daemon (>= ${source:Version}),
rtpengine-iptables (>= ${source:Version}),
rtpengine-kernel-dkms (>= ${source:Version}),
rtpengine-recording-daemon (>= ${source:Version}),
rtpengine-utils (>= ${source:Version}),
${misc:Depends},
Description: NGCP RTP/media proxy - meta package
This is a meta package for easy installation of all four parts of the NGCP
media proxy. It will install the user-space daemon, the kernel-space IPtables
module, the IPtables extension module and utility scripts.
Package: rtpengine-kernel-source
Architecture: all
Section: kernel
Depends:
debhelper-compat (= 12),
module-assistant,
${misc:Depends},
Conflicts:
ngcp-rtpengine-kernel-source,
Description: IPtables kernel module for the NGCP media proxy - source
Provides the kernel-space part of the NGCP media proxy for high-
performance packet forwarding.
This package contains the source to be built with module-assistant or
kernel-package.
Package: rtpengine-kernel-dkms
Architecture: all
Section: kernel
Depends:
dkms (>= 1.95),
lsb-release,
${misc:Depends},
Conflicts:
ngcp-rtpengine-kernel-dkms,
Description: IPtables kernel module for the NGCP media proxy - DKMS
Provides the kernel-space part of the NGCP media proxy for high-
performance packet forwarding.
This package contains the source to be built with dkms.
Package: rtpengine-utils
Architecture: all
Depends:
libbencode-perl,
libconfig-tiny-perl,
libcrypt-rijndael-perl,
libdigest-hmac-perl,
libio-socket-inet6-perl,
libio-socket-ip-perl,
libsocket6-perl,
netcat-openbsd | netcat,
${misc:Depends},
${perl:Depends},
Conflicts:
ngcp-rtpengine-utils,
Description: scripts and Perl modules for NGCP rtpengine
This package contains scripts and Perl modules for NGCP rtpengine

@ -0,0 +1,18 @@
Source: rtpengine
Section: kernel
Priority: optional
Maintainer: Sipwise Development Team <support@sipwise.com>
Build-Depends:
debhelper-compat (= 12),
Standards-Version: 3.9.8
Homepage: https://www.sipwise.com/
Package: rtpengine-kernel-modules-_KVERS_
Architecture: any
Depends:
linux-modules-_KVERS_ | linux-image-_KVERS_,
Conflicts:
ngcp-rtpengine-kernel-modules-_KVERS_,
Description: IPtables kernel module for the NGCP media proxy
This package provides the rtpengine module for
the Linux kernel version _KVERS_.

@ -0,0 +1,36 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Source: https://www.sipwise.com/
Upstream-Contact: Sipwise Development Team <support@sipwise.com>
Files: *
Copyright:
Copyright © 2007-2019 Sipwise GmbH, Austria
License: GPL-3+ with OpenSSL exception
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
.
In addition, as a special exception, the copyright holders give
permission to link the code of this release with the OpenSSL project's
"OpenSSL" library (or with modified versions of it that use the same
license as the "OpenSSL" library), and distribute the linked executables.
.
You must obey the GNU General Public License in all respects for all
of the code used other than "OpenSSL". If you modify file(s) with this
exception, you may extend this exception to your version of the file(s),
but you are not obligated to do so. If you do not wish to do so,
delete this exception statement from your version. If you delete
this exception statement from all source files in the program, then
also delete it here.
.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Comment:
On Debian systems, the full text of the GNU General Public License
version 3 can be found in the file '/usr/share/common-licenses/GPL-3'.

@ -0,0 +1,7 @@
PACKAGE_NAME="rtpengine"
PACKAGE_VERSION="__VERSION__"
MAKE[0]="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build RTPENGINE_VERSION=\"__VERSION__\""
CLEAN="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build clean"
AUTOINSTALL=yes
BUILT_MODULE_NAME[0]="xt_RTPENGINE"
DEST_MODULE_LOCATION[0]=/extra

@ -0,0 +1,8 @@
RUN_RTPENGINE=no
CONFIG_FILE=/etc/rtpengine/rtpengine.conf
# CONFIG_SECTION=rtpengine
PIDFILE=/run/rtpengine-daemon.pid
MANAGE_IPTABLES=yes
TABLE=0
#SET_USER=root
#SET_GROUP=root # GROUP only needs to be set if USER is not set or if the user isn't in the group

@ -0,0 +1,187 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: rtpengine-daemon
# Required-Start: $network $local_fs $remote_fs $syslog
# Required-Stop: $network $local_fs $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Ngcp Rtpengine
# Description: Proxy for RTP and other media streams
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
NAME=rtpengine-daemon
DESC="RTP/media proxy"
TABLE=0
DAEMON=$(which rtpengine)
DEFAULTS=/etc/default/${NAME}
test -f "$DAEMON" || exit 0
. /lib/lsb/init-functions
# Load startup options if available
if [ -f "$DEFAULTS" ]; then
. "$DEFAULTS" || true
fi
if [ "$RUN_RTPENGINE" != "yes" ]; then
log_action_msg "rtpengine not yet configured. Edit $DEFAULTS first."
exit 0
fi
[ -z "$PIDFILE" ] && PIDFILE="/run/rtpengine.pid"
OPTIONS=""
START_OPTIONS=""
if [ -n "$INTERFACES" ]; then
for interface in $INTERFACES; do
OPTIONS="$OPTIONS --interface=$interface"
done
fi
if [ -n "$SUBSCRIBE_KEYSPACES" ]; then
for ks in $SUBSCRIBE_KEYSPACES; do
OPTIONS="$OPTIONS --subscribe-keyspace=$ks"
done
fi
[ -z "$CONFIG_FILE" ] || OPTIONS="$OPTIONS --config-file=$CONFIG_FILE"
[ -z "$CONFIG_SECTION" ] || OPTIONS="$OPTIONS --config-section=$CONFIG_SECTION"
[ -z "$ADDRESS" ] || OPTIONS="$OPTIONS --interface=$ADDRESS"
[ -z "$ADV_ADDRESS" ] || OPTIONS="$OPTIONS!$ADV_ADDRESS"
[ -z "$ADDRESS_IPV6" ] || OPTIONS="$OPTIONS --interface=$ADDRESS_IPV6"
[ -z "$ADV_ADDRESS_IPV6" ] || OPTIONS="$OPTIONS!$ADV_ADDRESS_IPV6"
[ -z "$LISTEN_TCP" ] || OPTIONS="$OPTIONS --listen-tcp=$LISTEN_TCP"
[ -z "$LISTEN_UDP" ] || OPTIONS="$OPTIONS --listen-udp=$LISTEN_UDP"
[ -z "$LISTEN_NG" ] || OPTIONS="$OPTIONS --listen-ng=$LISTEN_NG"
[ -z "$LISTEN_CLI" ] || OPTIONS="$OPTIONS --listen-cli=$LISTEN_CLI"
[ -z "$TIMEOUT" ] || OPTIONS="$OPTIONS --timeout=$TIMEOUT"
[ -z "$SILENT_TIMEOUT" ] || OPTIONS="$OPTIONS --silent-timeout=$SILENT_TIMEOUT"
[ -z "$FINAL_TIMEOUT" ] || OPTIONS="$OPTIONS --final-timeout=$FINAL_TIMEOUT"
[ -z "$PIDFILE" ] || OPTIONS="$OPTIONS --pidfile=$PIDFILE"
[ -z "$TOS" ] || OPTIONS="$OPTIONS --tos=$TOS"
[ -z "$PORT_MIN" ] || OPTIONS="$OPTIONS --port-min=$PORT_MIN"
[ -z "$PORT_MAX" ] || OPTIONS="$OPTIONS --port-max=$PORT_MAX"
[ -z "$REDIS" ] || [ -z "$REDIS_DB" ] || OPTIONS="$OPTIONS --redis=$REDIS/$REDIS_DB"
[ -z "$REDIS_AUTH_PW" ] || export RTPENGINE_REDIS_AUTH_PW="$REDIS_AUTH_PW"
[ -z "$REDIS_WRITE" ] || [ -z "$REDIS_WRITE_DB" ] || OPTIONS="$OPTIONS --redis-write=$REDIS_WRITE/$REDIS_WRITE_DB"
[ -z "$REDIS_WRITE_AUTH_PW" ] || export RTPENGINE_REDIS_WRITE_AUTH_PW="$REDIS_WRITE_AUTH_PW"
[ -z "$REDIS_NUM_THREADS" ] || OPTIONS="$OPTIONS --redis-num-threads=$REDIS_NUM_THREADS"
[ -z "$REDIS_EXPIRES" ] || OPTIONS="$OPTIONS --redis-expires=$REDIS_EXPIRES"
[ -z "$REDIS_MULTIKEY" ] || OPTIONS="$OPTIONS --redis-multikey=$REDIS_MULTIKEY"
[ -z "$NO_REDIS_REQUIRED" ] || { [ "$NO_REDIS_REQUIRED" != "1" ] && [ "$NO_REDIS_REQUIRED" != "yes" ] ; } || OPTIONS="$OPTIONS --no-redis-required"
[ -z "$B2B_URL" ] || OPTIONS="$OPTIONS --b2b-url=$B2B_URL"
[ -z "$NO_FALLBACK" ] || { [ "$NO_FALLBACK" != "1" ] && [ "$NO_FALLBACK" != "yes" ] ; } || OPTIONS="$OPTIONS --no-fallback"
OPTIONS="$OPTIONS --table=$TABLE"
[ -z "$LOG_LEVEL" ] || OPTIONS="$OPTIONS --log-level=$LOG_LEVEL"
[ -z "$LOG_FACILITY" ] || OPTIONS="$OPTIONS --log-facility=$LOG_FACILITY"
[ -z "$LOG_FACILITY_CDR" ] || OPTIONS="$OPTIONS --log-facility-cdr=$LOG_FACILITY_CDR"
[ -z "$LOG_FACILITY_RTCP" ] || OPTIONS="$OPTIONS --log-facility-rtcp=$LOG_FACILITY_RTCP"
[ -z "$NUM_THREADS" ] || OPTIONS="$OPTIONS --num-threads=$NUM_THREADS"
[ -z "$DELETE_DELAY" ] || OPTIONS="$OPTIONS --delete-delay=$DELETE_DELAY"
[ -z "$GRAPHITE" ] || OPTIONS="$OPTIONS --graphite=$GRAPHITE"
[ -z "$GRAPHITE_INTERVAL" ] || OPTIONS="$OPTIONS --graphite-interval=$GRAPHITE_INTERVAL"
[ -z "$GRAPHITE_PREFIX" ] || OPTIONS="$OPTIONS --graphite-prefix=$GRAPHITE_PREFIX"
[ -z "$MAX_SESSIONS" ] || OPTIONS="$OPTIONS --max-sessions=$MAX_SESSIONS"
[ -z "$HOMER" ] || OPTIONS="$OPTIONS --homer=$HOMER"
[ -z "$HOMER_PROTOCOL" ] || OPTIONS="$OPTIONS --homer-protocol=$HOMER_PROTOCOL"
[ -z "$HOMER_ID" ] || OPTIONS="$OPTIONS --homer-id=$HOMER_ID"
if [ -n "$RECORDING_DIR" ]; then
OPTIONS="$OPTIONS --recording-dir=$RECORDING_DIR"
if [ ! -d "$RECORDING_DIR" ]; then
mkdir "$RECORDING_DIR" 2> /dev/null
chmod 700 "$RECORDING_DIR" 2> /dev/null
fi
fi
[ -z "$RECORDING_METHOD" ] || OPTIONS="$OPTIONS --recording-method=$RECORDING_METHOD"
[ -z "$RECORDING_FORMAT" ] || OPTIONS="$OPTIONS --recording-format=$RECORDING_FORMAT"
[ -z "$DTLS_PASSIVE" ] || { [ "$DTLS_PASSIVE" != "yes" ] && [ "$DTLS_PASSIVE" != "1" ] ; } || OPTIONS="$OPTIONS --dtls-passive"
if test "$FORK" = "no" ; then
OPTIONS="$OPTIONS --foreground"
fi
if test "$LOG_STDERR" = "yes" ; then
OPTIONS="$OPTIONS --log-stderr"
fi
# check if directory for pid file needs to be created
PIDDIR=$(dirname "$PIDFILE")
DO_DIR_CHOWN=0
if ! test -z "$PIDDIR" && ! test -d "$PIDDIR"; then
mkdir -p "$PIDDIR"
DO_DIR_CHOWN=1
fi
# handle requested setuid/setgid
if ! test -z "$SET_USER"; then
START_OPTIONS="$START_OPTIONS --chuid $SET_USER"
test "$DO_DIR_CHOWN" = 1 && chown "$SET_USER": "$PIDDIR"
fi
if ! test -z "$SET_GROUP"; then
START_OPTIONS="$START_OPTIONS --group $SET_GROUP"
test "$DO_DIR_CHOWN" = 1 && chgrp "$SET_GROUP" "$PIDDIR"
fi
###
case "$1" in
start)
if [ -x "$(which ngcp-check-active)" ]; then
case "$(ngcp-check-active -v)" in
active|transition)
log_action_msg "Active node or transition."
;;
*)
log_action_msg "Ignored start action in inactive node"
exit 0
;;
esac
fi
RC=0
rtpengine-iptables-setup start || RC=$?
if [ "$RC" -ne 0 ]; then
log_action_msg "Failed to start rtpengine-iptables-setup"
log_end_msg "$RC"
exit 1
fi
log_daemon_msg "Starting $DESC" "$NAME"
# shellcheck disable=SC2086
start-stop-daemon --start --quiet --pidfile "$PIDFILE" \
--exec "$DAEMON" $START_OPTIONS -- $OPTIONS || log_progress_msg " already running"
log_end_msg $?
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
RC=0
start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \
--retry 5 --exec "$DAEMON" || RC=$?
if [ "$RC" -eq 0 ]; then
rtpengine-iptables-setup stop || true
fi
rm -f "$PIDFILE"
log_end_msg "$RC"
exit "$RC"
;;
restart|force-reload)
$0 stop
$0 start
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
*)
echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2
exit 1
;;
esac
exit 0

@ -0,0 +1,3 @@
daemon/rtpengine /usr/sbin/
debian/rtpengine-iptables-setup /usr/sbin
etc/rtpengine.sample.conf /etc/rtpengine/

@ -0,0 +1 @@
/lib/systemd/system/rtpengine-daemon.service /lib/systemd/system/rtpengine.service

@ -0,0 +1,38 @@
#!/bin/sh
set -e
default=/etc/default/rtpengine-daemon
modname=xt_RTPENGINE
if [ -x "$(which ngcp-virt-identify)" ]; then
if ngcp-virt-identify --type container; then
VIRT="yes"
fi
fi
if [ "$VIRT" = "yes" ]; then
echo "Container environment detected. Skip kernel module check"
else
if [ -f $default ]; then
. $default || true
fi
if [ -n "$TABLE" ] && [ "$TABLE" -ge 0 ] && \
[ -n "$NO_FALLBACK" ] && \
{ [ "$NO_FALLBACK" = "1" ] || [ "$NO_FALLBACK" = "yes" ] ; }
then
if lsmod | grep -q $modname || modinfo $modname > /dev/null 2> /dev/null; then
true
else
echo "Kernel module $modname not found and NO_FALLBACK is set."
echo "Daemon restart not performed."
exit 0
fi
fi
fi
#DEBHELPER#
exit 0

@ -0,0 +1,16 @@
[Unit]
Description=NGCP RTP/media Proxy Daemon
After=network-online.target
After=remote-fs.target
Requires=network-online.target
[Service]
Type=notify
EnvironmentFile=/etc/default/rtpengine-daemon
PIDFile=/run/rtpengine-daemon.pid
ExecStartPre=/usr/sbin/rtpengine-iptables-setup start
ExecStart=/usr/sbin/rtpengine -f -E --no-log-timestamps --pidfile /run/rtpengine-daemon.pid --config-file /etc/rtpengine/rtpengine.conf
ExecStopPost=/usr/sbin/rtpengine-iptables-setup stop
[Install]
WantedBy=multi-user.target

@ -0,0 +1 @@
daemon/*.h /usr/include/rtpengine/

@ -0,0 +1,101 @@
#!/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
TABLE=0
MODNAME=xt_RTPENGINE
MANAGE_IPTABLES=yes
DEFAULTS=/etc/default/rtpengine-daemon
# Load startup options if available
if [ -f "$DEFAULTS" ]; then
. "$DEFAULTS" || true
fi
MODPROBE_OPTIONS=""
# Handle requested setuid/setgid.
if ! test -z "$SET_USER"; then
PUID=$(id -u "$SET_USER" 2> /dev/null)
test -z "$PUID" || MODPROBE_OPTIONS="$MODPROBE_OPTIONS proc_uid=$PUID"
if test -z "$SET_GROUP"; then
PGID=$(id -g "$SET_USER" 2> /dev/null)
test -z "$PGID" || MODPROBE_OPTIONS="$MODPROBE_OPTIONS proc_gid=$PGID"
fi
fi
if ! test -z "$SET_GROUP"; then
PGID=$(grep "^$SET_GROUP:" /etc/group | cut -d: -f3 2> /dev/null)
test -z "$PGID" || MODPROBE_OPTIONS="$MODPROBE_OPTIONS proc_gid=$PGID"
fi
###
if [ -x "$(which ngcp-virt-identify)" ]; then
if ngcp-virt-identify --type container; then
VIRT="yes"
fi
fi
firewall_setup()
{
if [ "$TABLE" -lt 0 ] || [ "$VIRT" = "yes" ]; then
return
fi
if [ "$MANAGE_IPTABLES" != "yes" ]; then
return
fi
# shellcheck disable=SC2086
modprobe $MODNAME $MODPROBE_OPTIONS
iptables -N rtpengine 2>/dev/null
iptables -D INPUT -j rtpengine 2>/dev/null
iptables -D INPUT -p udp -j rtpengine 2>/dev/null
iptables -I INPUT -p udp -j rtpengine
iptables -D rtpengine -p udp -j RTPENGINE --id "$TABLE" 2>/dev/null
iptables -I rtpengine -p udp -j RTPENGINE --id "$TABLE"
ip6tables -N rtpengine 2>/dev/null
ip6tables -D INPUT -j rtpengine 2>/dev/null
ip6tables -D INPUT -p udp -j rtpengine 2>/dev/null
ip6tables -I INPUT -p udp -j rtpengine
ip6tables -D rtpengine -p udp -j RTPENGINE --id "$TABLE" 2>/dev/null
ip6tables -I rtpengine -p udp -j RTPENGINE --id "$TABLE"
}
firewall_teardown()
{
if [ "$TABLE" -lt 0 ] || [ "$VIRT" = "yes" ]; then
return
fi
# XXX: Wait a bit to make sure the daemon has been stopped.
sleep 1
if [ -e /proc/rtpengine/control ]; then
echo "del $TABLE" >/proc/rtpengine/control 2>/dev/null
fi
if [ "$MANAGE_IPTABLES" != "yes" ]; then
return
fi
iptables -D rtpengine -p udp -j RTPENGINE --id "$TABLE" 2>/dev/null
ip6tables -D rtpengine -p udp -j RTPENGINE --id "$TABLE" 2>/dev/null
}
case "$1" in
start)
firewall_setup
;;
stop)
firewall_teardown
;;
*)
echo "Usage: $0 {start|stop}" >&2
exit 1
;;
esac
exit 0

@ -0,0 +1,46 @@
#!/bin/sh
set -e
package=rtpengine-kernel-dkms
name=rtpengine
version=$(dpkg-query -W -f="\${Version}" "$package" \
|rev|cut -d- -f2-|rev|cut -d':' -f2|tr -d "\n")
if [ -x "$(which ngcp-virt-identify)" ]; then
if ngcp-virt-identify --type container; then
VIRT="yes"
fi
fi
if [ "$VIRT" = "yes" ]; then
echo "Container environment detected. Skip dkms"
else
isadded=$(dkms status -m "$name" -v "$version")
if [ -z "${isadded}" ] ; then
dkms add -m "$name" -v "$version"
fi
if [ "$1" = 'configure' ] ; then
KERNELS=$(ls /lib/modules/ 2>/dev/null || true)
for kernel in $KERNELS; do
if [ ! -r "/lib/modules/$kernel/build" ]; then
# cannot build modules for this kernel
continue
fi
( dkms build -m "$name" -v "$version" -k "$kernel" && dkms install -m "$name" -v "$version" -k "$kernel" ) || true
done
# try to start the daemon
if [ -x /etc/init.d/rtpengine-daemon ] ; then
invoke-rc.d rtpengine-daemon restart || true
fi
fi
fi
#DEBHELPER#
exit 0

@ -0,0 +1,32 @@
#!/bin/sh
set -e
package=rtpengine-kernel-dkms
name=rtpengine
modname=xt_RTPENGINE
version=$(dpkg-query -W -f="\${Version}" "$package" \
|rev|cut -d- -f2-|rev|cut -d':' -f2|tr -d "\n")
if [ -x "$(which ngcp-virt-identify)" ]; then
if ngcp-virt-identify --type container; then
VIRT="yes"
fi
fi
# make sure it's not running
if [ -x /etc/init.d/rtpengine-daemon ] ; then
invoke-rc.d rtpengine-daemon stop || true
rmmod "$modname" 2>/dev/null || true
fi
if [ "$VIRT" = "yes" ]; then
echo "Container environment detected. Skip dkms"
else
dkms remove -m "$name" -v "$version" --all || true
fi
#DEBHELPER#
exit 0

@ -0,0 +1 @@
/usr/share/modass/packages/default.sh /usr/share/modass/overrides/rtpengine-kernel-source

@ -0,0 +1,12 @@
RUN_RTPENGINE_RECORDING=no
CONFIG_FILE=/etc/rtpengine/rtpengine-recording.conf
# CONFIG_SECTION=rtpengine-recording
PIDFILE=/run/rtpengine-recording-daemon.pid
#SET_USER=root
#SET_GROUP=root # GROUP only needs to be set if USER is not set or if the user isn't in the group
#
MUST_NFS=no
NFS_HOST=192.168.1.1
NFS_REMOTE_PATH=/var/recordings
NFS_LOCAL_MOUNT=/var/lib/rtpengine-recording # must match output-dir if used
NFS_OPTIONS=hard,intr,tcp

@ -0,0 +1,2 @@
var/lib/rtpengine-recording
var/spool/rtpengine

@ -0,0 +1,116 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: rtpengine-recording-daemon
# Required-Start: $network $local_fs $remote_fs $syslog
# Required-Stop: $network $local_fs $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Ngcp Rtpengine Recording Daemon
# Description: Recording daemon for RTP and other media streams
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
NAME=rtpengine-recording-daemon
DESC="RTP/media recording daemon"
DAEMON=$(which rtpengine-recording)
DEFAULTS=/etc/default/${NAME}
test -f "$DAEMON" || exit 0
. /lib/lsb/init-functions
# Load startup options if available
if [ -f "$DEFAULTS" ]; then
. "$DEFAULTS" || true
fi
if [ "$RUN_RTPENGINE_RECORDING" != "yes" ]; then
log_action_msg "rtpengine-recording not yet configured. Edit $DEFAULTS first."
exit 0
fi
[ -z "$PIDFILE" ] && PIDFILE="/run/rtpengine-recording.pid"
OPTIONS=""
START_OPTIONS=""
[ -z "$CONFIG_FILE" ] || OPTIONS="$OPTIONS --config-file=$CONFIG_FILE"
[ -z "$PIDFILE" ] || OPTIONS="$OPTIONS --pidfile=$PIDFILE"
# check if directory for pid file needs to be created
PIDDIR=$(dirname "$PIDFILE")
DO_DIR_CHOWN=0
if ! test -z "$PIDDIR" && ! test -d "$PIDDIR"; then
mkdir -p "$PIDDIR"
DO_DIR_CHOWN=1
fi
# handle requested setuid/setgid
if ! test -z "$SET_USER"; then
START_OPTIONS="$START_OPTIONS --chuid $SET_USER"
test "$DO_DIR_CHOWN" = 1 && chown "$SET_USER": "$PIDDIR"
fi
if ! test -z "$SET_GROUP"; then
START_OPTIONS="$START_OPTIONS --group $SET_GROUP"
test "$DO_DIR_CHOWN" = 1 && chgrp "$SET_GROUP" "$PIDDIR"
fi
###
case "$1" in
start)
if [ -x "$(which ngcp-check-active)" ]; then
case "$(ngcp-check-active -v)" in
active|transition)
log_action_msg "Active node or transition."
;;
*)
log_action_msg "Ignored start action in inactive node"
exit 0
;;
esac
fi
RC=0
rtpengine-recording-nfs-setup start || RC=$?
if [ "$RC" -ne 0 ] ; then
log_action_msg "Failed to start rtpengine-recording-nfs-setup"
log_end_msg "$RC"
exit "$RC"
fi
log_daemon_msg "Starting $DESC" "$NAME"
# shellcheck disable=SC2086
start-stop-daemon --start --quiet --pidfile "$PIDFILE" \
--exec "$DAEMON" $START_OPTIONS -- $OPTIONS || log_progress_msg " already running"
log_end_msg $?
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
RC=0
start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \
--retry 5 --exec "$DAEMON" || RC=$?
rm -f "$PIDFILE"
log_end_msg "$RC"
exit "$RC"
;;
force-reload|restart)
$0 stop
$0 start
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
*)
echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2
exit 1
;;
esac
exit 0

@ -0,0 +1,3 @@
debian/rtpengine-recording-nfs-setup /usr/sbin/
etc/rtpengine-recording.sample.conf /etc/rtpengine/
recording-daemon/rtpengine-recording /usr/sbin/

@ -0,0 +1 @@
/lib/systemd/system/rtpengine-recording-daemon.service /lib/systemd/system/rtpengine-recording.service

@ -0,0 +1 @@
recording-daemon/rtpengine-recording.8

@ -0,0 +1,20 @@
[Unit]
Description=NGCP RTP/media Recording Daemon NFS mount point
After=network-online.target
After=remote-fs.target
After=rpcbind.socket
After=rpcbind.service
After=nfs-client.target
Requires=network-online.target
Requires=rpcbind.socket
Requires=rpcbind.service
Requires=nfs-client.target
[Service]
Type=simple
RemainAfterExit=yes
ExecStart=/usr/sbin/rtpengine-recording-nfs-setup start
ExecStop=/usr/sbin/rtpengine-recording-nfs-setup stop
[Install]
WantedBy=multi-user.target

@ -0,0 +1,16 @@
[Unit]
Description=NGCP RTP/media Recording Daemon
After=network-online.target
After=remote-fs.target
After=rtpengine-recording-nfs-mount.service
Requires=network-online.target
Requires=rtpengine-recording-nfs-mount.service
[Service]
Type=notify
LimitNOFILE=100000
PIDFile=/run/rtpengine-recording-daemon.pid
ExecStart=/usr/sbin/rtpengine-recording -f -E --no-log-timestamps --pidfile /run/rtpengine-recording-daemon.pid --config-file /etc/rtpengine/rtpengine-recording.conf
[Install]
WantedBy=multi-user.target

@ -0,0 +1,42 @@
#!/bin/sh
set -e
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DEFAULTS=/etc/default/rtpengine-recording-daemon
DESC="RTP engine recording NFS share"
. /lib/lsb/init-functions
# Load startup options if available
if [ -f "$DEFAULTS" ]; then
. "$DEFAULTS" || true
fi
[ -z "$NFS_OPTIONS" ] && NFS_OPTIONS="hard,tcp,intr"
###
case "$1" in
start)
if [ "$MUST_NFS" = yes ]; then
if ! grep -E -q "^[^ :]+:[^ :]+ $NFS_LOCAL_MOUNT nfs.? " /proc/mounts; then
log_action_msg "Mounting $DESC"
test -d "$NFS_LOCAL_MOUNT" || mkdir -p "$NFS_LOCAL_MOUNT"
mount -t nfs -o "$NFS_OPTIONS" "$NFS_HOST:$NFS_REMOTE_PATH" "$NFS_LOCAL_MOUNT"
fi
fi
;;
stop)
if grep -E -q "^[^ :]+:[^ :]+ $NFS_LOCAL_MOUNT nfs.? " /proc/mounts; then
log_action_msg "Unmounting $DESC"
umount "$NFS_LOCAL_MOUNT"
fi
;;
*)
echo "Usage: $0 {start|stop}" >&2
exit 1
;;
esac
exit 0

@ -0,0 +1,3 @@
perl/* /usr/share/perl5/
utils/rtpengine-ctl /usr/sbin/
utils/rtpengine-ng-client /usr/sbin/

@ -0,0 +1,2 @@
debian/README.html.gz
debian/README.md.gz

@ -0,0 +1,64 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
# export DH_VERBOSE=1
include /usr/share/dpkg/pkg-info.mk
## kernel package specific stuff
# Name of the source package
psource:=rtpengine-kernel-source
# Name of the dkms package
pdkms:=rtpengine-kernel-dkms
# short upstream name, used for module source directory
sname:=rtpengine
# Source version
sversion:=$(DEB_VERSION_UPSTREAM)
## end of kernel package specific stuff
XTABLES_DIR:=$(shell pkg-config xtables --variable=xtlibdir || echo /lib/xtables)
ifneq (,$(filter $(DEB_BUILD_PROFILES),pkg.rtpengine.no-transcoding))
export with_transcoding = no
endif
%:
dh $@
override_dh_auto_install-indep:
# Create the directories to install the source into
dh_installdirs -p$(psource) usr/src/modules/$(sname)/debian
dh_installdirs -p$(pdkms) usr/src/$(sname)-$(sversion)
# Copy only the driver source to the proper locations
cd kernel-module && cp Makefile *.c *.h ../debian/$(psource)/usr/src/modules/$(sname)
cd kernel-module && cp Makefile *.c *.h ../debian/$(pdkms)/usr/src/$(sname)-$(sversion)
# Copy the needed debian/ pieces to the proper location
cp debian/*.modules.in* debian/$(psource)/usr/src/modules/$(sname)/debian
cp debian/control debian/changelog debian/copyright \
debian/$(psource)/usr/src/modules/$(sname)/debian/
install -m 0755 debian/rules.modules debian/$(psource)/usr/src/modules/$(sname)/debian/rules
cd debian/$(psource)/usr/src && tar c modules | bzip2 -9 > $(sname).tar.bz2 && rm -rf modules
# Prepare dkms.conf from the dkms.conf.in template
sed "s/__VERSION__/$(sversion)/g" debian/dkms.conf.in > debian/$(pdkms)/usr/src/$(sname)-$(sversion)/dkms.conf
# markdown README
markdown README.md | gzip -9 > debian/README.html.gz
gzip -9 < README.md > debian/README.md.gz
dh_auto_install
override_dh_install:
dh_install
dh_installdirs -prtpengine-iptables $(XTABLES_DIR)
install -m 0644 iptables-extension/libxt_RTPENGINE.so debian/rtpengine-iptables/$(XTABLES_DIR)
override_dh_dwz:
# Disable, as dwz cannot cope with some of the plugins generated.
override_dh_installsystemd:
dh_installsystemd
dh_installsystemd -prtpengine-recording-daemon --name=rtpengine-recording-nfs-mount

@ -0,0 +1,82 @@
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
CFLAGS ?= -g -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wstrict-prototypes
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif
# Name of the source package
psource:=rtpengine-kernel-source
# The short upstream name, used for the module source directory
sname:=rtpengine
### KERNEL SETUP
### Setup the stuff needed for making kernel module packages
### taken from /usr/share/kernel-package/sample.module.rules
# prefix of the target package name
PACKAGE=rtpengine-kernel-modules
# modifieable for experiments or debugging m-a
MA_DIR ?= /usr/share/modass
# load generic variable handling
-include $(MA_DIR)/include/generic.make
# load default rules, including kdist, kdist_image, ...
-include $(MA_DIR)/include/common-rules.make
# module assistant calculates all needed things for us and sets
# following variables:
# KSRC (kernel source directory), KVERS (kernel version string), KDREV
# (revision of the Debian kernel-image package), CC (the correct
# compiler), VERSION (the final package version string), PKGNAME (full
# package name with KVERS included), DEB_DESTDIR (path to store DEBs)
# The kdist_configure target is called by make-kpkg modules_config and
# by kdist* rules by dependency. It should configure the module so it is
# ready for compilation (mostly useful for calling configure).
# prep-deb-files from module-assistant creates the necessary debian/ files
kdist_configure: prep-deb-files
# the kdist_clean target is called by make-kpkg modules_clean and from
# kdist* rules. It is responsible for cleaning up any changes that have
# been made by the other kdist_commands (except for the .deb files created)
kdist_clean: clean
$(MAKE) $(MFLAGS) -f debian/rules clean
#
### end KERNEL SETUP
# the binary-modules rule is invoked by module-assistant while processing the
# kdist* targets. It is called by module-assistant or make-kpkg and *not*
# during a normal build
binary-modules: prep-deb-files
dh_testroot
dh_prep
# Build the module
$(MAKE) modules KSRC=$(KSRC) KVER=$(KVERS)
# Install the module
install -D -m 0644 xt_RTPENGINE.ko debian/$(PACKAGE)-$(KVERS)/lib/modules/$(KVERS)/extra/xt_RTPENGINE.ko
dh_installdocs
dh_installchangelogs
dh_compress
dh_fixperms
dh_installmodules
dh_installdeb
dh_gencontrol -- -v$(VERSION)
dh_md5sums
dh_builddeb --destdir=$(DEB_DESTDIR)
clean:
dh_testdir
$(MAKE) clean
dh_clean
.PHONY: clean binary-modules kdist kdist_configure kdist_image kdist_clean

@ -0,0 +1 @@
extend-diff-ignore=.gitreview

@ -0,0 +1,15 @@
*.debhelper
*.log
*.substvars
/.debhelper/
/debhelper-build-stamp
/files
/rtpengine-daemon/
/rtpengine-iptables/
/rtpengine-kernel-dkms/
/rtpengine-kernel-source/
/rtpengine-recording-daemon/
/rtpengine-utils/
/rtpengine/
README.html.gz
README.md.gz

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save