From 8b18bc5d23dcfc1199a11db80bb7fd4033d82734 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Thu, 2 Feb 2017 14:36:03 -0500 Subject: [PATCH] TT#10155 split recording daemon into separate debian package Change-Id: Iadbc629b8aa9e241fee3348bd957b4e0d4057fce --- debian/control | 15 ++- debian/ngcp-rtpengine-daemon.install | 1 - .../ngcp-rtpengine-recording-daemon.default | 9 ++ debian/ngcp-rtpengine-recording-daemon.init | 106 ++++++++++++++++++ .../ngcp-rtpengine-recording-daemon.install | 1 + debian/rules | 3 +- 6 files changed, 132 insertions(+), 3 deletions(-) create mode 100644 debian/ngcp-rtpengine-recording-daemon.default create mode 100755 debian/ngcp-rtpengine-recording-daemon.init create mode 100644 debian/ngcp-rtpengine-recording-daemon.install diff --git a/debian/control b/debian/control index d8b950c66..fa2988706 100644 --- a/debian/control +++ b/debian/control @@ -24,7 +24,8 @@ Homepage: http://sipwise.com/ Package: ngcp-rtpengine-daemon Architecture: any -Recommends: ngcp-rtpengine-utils +Recommends: ngcp-rtpengine-recording-daemon, + ngcp-rtpengine-utils Suggests: ngcp-system-tools Depends: lsb-base (>= 3.0-6), ${misc:Depends}, @@ -37,6 +38,17 @@ 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: ngcp-rtpengine-recording-daemon +Architecture: any +Recommends: ngcp-rtpengine-utils +Suggests: ngcp-system-tools +Depends: lsb-base (>= 3.0-6), + nfs-common, + ${misc:Depends}, + ${shlibs:Depends} +Description: Recording daemon for RTP and media streams + This daemon handles the call recording (media intercept) component of rtpengine. + Package: ngcp-rtpengine-iptables Architecture: any Depends: ${misc:Depends}, @@ -51,6 +63,7 @@ Architecture: all Depends: ngcp-rtpengine-daemon (>= ${source:Version}), ngcp-rtpengine-iptables (>= ${source:Version}), ngcp-rtpengine-kernel-dkms (>= ${source:Version}), + ngcp-rtpengine-recording-daemon (>= ${source:Version}), ngcp-rtpengine-utils (>= ${source:Version}) Conflicts: ngcp-mediaproxy-ng Replaces: ngcp-mediaproxy-ng diff --git a/debian/ngcp-rtpengine-daemon.install b/debian/ngcp-rtpengine-daemon.install index ef5a57dae..cdd5be3e2 100644 --- a/debian/ngcp-rtpengine-daemon.install +++ b/debian/ngcp-rtpengine-daemon.install @@ -1,3 +1,2 @@ daemon/rtpengine /usr/sbin/ etc/rtpengine.sample.conf /etc/rtpengine/ -recording-daemon/rtpengine-recording /usr/sbin/ diff --git a/debian/ngcp-rtpengine-recording-daemon.default b/debian/ngcp-rtpengine-recording-daemon.default new file mode 100644 index 000000000..6346c6003 --- /dev/null +++ b/debian/ngcp-rtpengine-recording-daemon.default @@ -0,0 +1,9 @@ +RUN_RTPENGINE_RECORDING=no +CONFIG_FILE=/etc/rtpengine/rtpengine-recording.conf +# CONFIG_SECTION=rtpengine-recording +PIDFILE=/var/run/ngcp-rtpengine-recording-daemon.pid + +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 diff --git a/debian/ngcp-rtpengine-recording-daemon.init b/debian/ngcp-rtpengine-recording-daemon.init new file mode 100755 index 000000000..d63d0ca56 --- /dev/null +++ b/debian/ngcp-rtpengine-recording-daemon.init @@ -0,0 +1,106 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: ngcp-rtpengine-recording-daemon +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Should-Start: sshd +# 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=ngcp-rtpengine-recording-daemon +DESC="RTP/media recording daemon" +TABLE=0 + +DAEMON=$(which rtpengine-recording) +DEFAULTS=/etc/default/${NAME} + +test -f "$DAEMON" || exit 0 + +# Load startup options if available +if [ -f "$DEFAULTS" ]; then + . "$DEFAULTS" || true +fi + +if [ "$RUN_RTPENGINE_RECORDING" != "yes" ]; then + echo "rtpengine-recording not yet configured. Edit $DEFAULTS first." + exit 0 +fi +[ -z "$PIDFILE" ] && PIDFILE="/var/run/rtpengine-recording.pid" + +set -e + +. /lib/lsb/init-functions + +OPTIONS="" + + +[ -z "$CONFIG_FILE" ] || OPTIONS="$OPTIONS --config-file=$CONFIG_FILE" +[ -z "$PIDFILE" ] || OPTIONS="$OPTIONS --pidfile=$PIDFILE" + +if [ -x /usr/sbin/ngcp-virt-identify ]; then + if /usr/sbin/ngcp-virt-identify --type container; then + VIRT="yes" + fi +fi + +case "$1" in + start) + set +e + if [ -x "/usr/sbin/ngcp-check_active" ]; then + /usr/sbin/ngcp-check_active -q + status=$? + case "${status}" in + 0|3) + echo "Active node or transition." + ;; + *) + echo "Ignored start action in inactive node ($status)" + exit 0 + ;; + esac + fi + set -e + + log_daemon_msg "Starting $DESC: $NAME" + + if [ "$MUST_NFS" = yes ]; then + if ! egrep -q '^[^ :]+:[^ :]+ '"$NFS_LOCAL_MOUNT"' nfs.? ' /proc/mounts; then + log_progress_msg "Mounting NFS share" + test -d "$NFS_LOCAL_MOUNT" || mkdir -p "$NFS_LOCAL_MOUNT" + mount -t nfs -o hard,intr,tcp "$NFS_HOST":"$NFS_REMOTE_PATH" "$NFS_LOCAL_MOUNT" + fi + fi + + start-stop-daemon --start --quiet --pidfile "$PIDFILE" \ + --exec "$DAEMON" -- $OPTIONS || log_progress_msg " already running" + log_end_msg $? + ;; + stop) + log_daemon_msg "Stopping $DESC: $NAME" + start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \ + --exec "$DAEMON" + if [ "$?" -ne 0 ]; then + return $? + fi + rm -f $PIDFILE + log_end_msg $? + ;; + 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 diff --git a/debian/ngcp-rtpengine-recording-daemon.install b/debian/ngcp-rtpengine-recording-daemon.install new file mode 100644 index 000000000..b5754cc90 --- /dev/null +++ b/debian/ngcp-rtpengine-recording-daemon.install @@ -0,0 +1 @@ +recording-daemon/rtpengine-recording /usr/sbin/ diff --git a/debian/rules b/debian/rules index 43abde60a..741c1a033 100755 --- a/debian/rules +++ b/debian/rules @@ -107,7 +107,8 @@ install: build binary-arch: install \ ngcp-rtpengine-daemon \ ngcp-rtpengine-dbg \ - ngcp-rtpengine-iptables + ngcp-rtpengine-iptables \ + ngcp-rtpengine-recording-daemon # Build architecture independant packages binary-indep: build install \