diff --git a/MANIFEST.in b/MANIFEST.in index 429a8e9..9322668 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,7 +1,7 @@ recursive-include debian changelog compat control copyright docs rules -recursive-include debian callcontrol.init lintian-overrides manpages +recursive-include debian lintian-overrides manpages callcontrol.service recursive-include debian/source format recursive-include doc/man *.[1-9] prune debian/tmp prune debian/callcontrol include INSTALL LICENSE MANIFEST.in changelog diff --git a/debian/callcontrol.init b/debian/callcontrol.init deleted file mode 100644 index 4fe4c95..0000000 --- a/debian/callcontrol.init +++ /dev/null @@ -1,65 +0,0 @@ -#! /bin/sh -# -### BEGIN INIT INFO -# Provides: callcontrol -# Required-Start: $syslog $network $local_fs $remote_fs $time -# Required-Stop: $syslog $network $local_fs $remote_fs -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Start the SIP call control application -# Description: Start the SIP call control application -### END INIT INFO - -NAME="callcontrol" -DESC="SIP Call Control" - -PATH=/sbin:/bin:/usr/sbin:/usr/bin -DAEMON=/usr/bin/call-control -PIDFILE=/var/run/callcontrol/call-control.pid -OPTIONS= - -test -f $DAEMON || exit 0 - -. /lib/lsb/init-functions - -start() { - echo -n "Starting $DESC: $NAME" - start-stop-daemon --start --quiet --pidfile $PIDFILE \ - --exec $DAEMON -- $OPTIONS || echo -n " already running" - echo "." -} - -stop() { - echo -n "Stopping $DESC: $NAME" - start-stop-daemon --oknodo --stop --quiet --retry=TERM/15/KILL/5 --pidfile $PIDFILE - echo "." -} - -case "$1" in - start) - start - ;; - stop) - stop - ;; - restart|force-reload) - stop - start - ;; - sessions) - $DAEMON "--debug=sessions" - ;; - session) - $DAEMON "--debug=session" "callid=$2" - ;; - terminate) - $DAEMON "--terminate=$2" - ;; - *) - N=/etc/init.d/$NAME - echo "Usage: $N {start|stop|restart|force-reload|sessions|session|terminate}" >&2 - exit 1 - ;; -esac - -exit 0 diff --git a/debian/callcontrol.service b/debian/callcontrol.service new file mode 100644 index 0000000..718763e --- /dev/null +++ b/debian/callcontrol.service @@ -0,0 +1,13 @@ +[Unit] +Description=Call Control Engine +After=network.target nss-lookup.target mysqld.service mariadb.service thor-eventserver.service + +[Service] +Type=simple +Environment=PYTHONUNBUFFERED=yes +ExecStart=/usr/bin/call-control --systemd +Restart=on-abnormal +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/debian/control b/debian/control index cb69bbf..23a02c8 100644 --- a/debian/control +++ b/debian/control @@ -1,28 +1,27 @@ Source: callcontrol Section: net Priority: optional Maintainer: Dan Pascu Uploaders: Tijmen de Mes Build-Depends: debhelper (>= 11), dh-python, python Standards-Version: 3.9.8 Package: callcontrol Architecture: all Depends: ${python:Depends}, ${misc:Depends}, - lsb-base, python-application (>= 2.8.0), python-gnutls (>= 3.0.0), python-twisted-core, python-sqlobject, python-systemd Description: Call Control prepaid application for OpenSIPS Call Control is a prepaid application that can be used together with OpenSIPS call_control module and CDRTool rating engine to limit the duration of SIP sessions based on a prepaid balance. It can also be used to limit the duration of any session to a predefined maximum value without debiting a balance. . Call Control achieves this by maintaining a timer for each session and sending BYE messages to both SIP end-points, if the session exceeds its maximum session limit or if the Call Control receives a command to forcefully close the call from outside. diff --git a/debian/rules b/debian/rules index 9ef71e9..61ee64a 100755 --- a/debian/rules +++ b/debian/rules @@ -1,19 +1,22 @@ #!/usr/bin/make -f #export DH_VERBOSE=1 %: dh $@ --with python2 --buildsystem=pybuild override_dh_clean: dh_clean rm -rf build dist MANIFEST override_dh_auto_install: dh_auto_install mv debian/callcontrol/etc/callcontrol/config.ini.sample debian/callcontrol/etc/callcontrol/config.ini +override_dh_installsystemd: + dh_installsystemd --no-start + override_dh_fixperms: dh_fixperms chmod 600 debian/callcontrol/etc/callcontrol/config.ini