diff --git a/debian/control b/debian/control index 54d8548..6e73e72 100644 --- a/debian/control +++ b/debian/control @@ -1,38 +1,38 @@ Source: cdrtool Section: web Priority: optional Maintainer: Adrian Georgescu Uploaders: Tijmen de Mes -Build-Depends: debhelper (>= 9) +Build-Depends: debhelper (>= 12) Standards-Version: 3.9.8 Homepage: http://cdrtool.ag-projects.com Package: cdrtool Architecture: all Depends: ${misc:Depends}, debconf (>= 1.5), apache2 | httpd, libapache2-mod-php | libapache2-mod-php5, php | php5, php-cli | php5-cli, php-mysql | php5-mysql, php-curl | php5-curl, php-gd | php5-gd, php-pear, php-net-socket, php-net-url2, php-monolog, mrtg, smarty3, php-geoip | php5-geoip, geoip-database Suggests: Description: CDR mediation and rating engine for OpenSIPS CDRTool provides a CDR mediation and rating engine for Call Details Records generated by OpenSIPS SIP Proxy/Registrar/Presence server. . CDRTool is a simple to use WEB application, which can be put in service with minimal training of the helpdesk and operations staff. It provides instant access to SIP usage information, traces from CDR level to protocol level, statistics grouped by criteria like release cause, destination or billing parties and can help pin-point SIP call flows failure reason. diff --git a/debian/cron.d b/debian/cron.d index 91a35c3..37cc2ca 100644 --- a/debian/cron.d +++ b/debian/cron.d @@ -1,23 +1,23 @@ # Normalization -*/5 * * * * root php /var/www/CDRTool/scripts/normalize.php >/dev/null +*/5 * * * * root test /var/www/CDRTool/scripts/normalize.php -a \! -d /run/systemd/system && /var/www/CDRTool/scripts/normalize.php >/dev/null # Check quota -*/5 * * * * root php /var/www/CDRTool/scripts/OpenSIPS/quotaCheck.php >/dev/null - 0 2 1 * * root php /var/www/CDRTool/scripts/OpenSIPS/quotaReset.php >/dev/null - 10 3 1 * * root php /var/www/CDRTool/scripts/OpenSIPS/quotaDeblock.php >/dev/null +*/5 * * * * root test /var/www/CDRTool/scripts/OpenSIPS/quotaCheck.php -a \! -d /run/systemd/system && /var/www/CDRTool/scripts/OpenSIPS/quotaCheck.php >/dev/null + 0 2 1 * * root test /var/www/CDRTool/scripts/OpenSIPS/quotaReset.php -a \! -d /run/systemd/system && /var/www/CDRTool/scripts/OpenSIPS/quotaReset.php >/dev/null + 10 0 * * * root test /var/www/CDRTool/scripts/OpenSIPS/quotaDailyReset.php -a \! -d /run/systemd/system && /var/www/CDRTool/scripts/OpenSIPS/quotaDailyReset.php >/dev/null -# Purge SIP trace table - 20 3 * * * root php /var/www/CDRTool/scripts/OpenSIPS/purgeSIPTrace.php >/dev/null +# Purge SIP trace table + 20 3 * * * root test /var/www/CDRTool/scripts/OpenSIPS/purgeSIPTrace.php -a \! -d /run/systemd/system && /var/www/CDRTool/scripts/OpenSIPS/purgeSIPTrace.php >/dev/null # Statistics -*/5 * * * * root php /var/www/CDRTool/scripts/buildStatistics.php >/dev/null +*/5 * * * * root test /var/www/CDRTool/scripts/buildStatistics.php -a \! -d /run/systemd/system && /var/www/CDRTool/scripts/buildStatistics.php >/dev/null # Next two jobs are only used when using a central radacct table: -# 0 3 1 * * root php /var/www/CDRTool/scripts/OpenSIPS/rotateTables.php >/dev/null -# 0 4 * * * root php /var/www/CDRTool/scripts/purgeTables.php >/dev/null +# 0 3 1 * * root test /var/www/CDRTool/scripts/OpenSIPS/rotateTables.php -a \! -d /run/systemd/system && /var/www/CDRTool/scripts/OpenSIPS/rotateTables.php >/dev/null +# 0 4 * * * root test /var/www/CDRTool/scripts/purgeTables.php -a \! -d /run/systemd/system && /var/www/CDRTool/scripts/purgeTables.php >/dev/null # Send email with last missed calls to SIP subscribers -15 2 * * * root /var/www/CDRTool/scripts/OpenSIPS/notifyLastSessions.php >/dev/null +15 2 * * * root test /var/www/CDRTool/scripts/notifyLastSessions.php -a \! -d /run/systemd/system && /var/www/CDRTool/scripts/OpenSIPS/notifyLastSessions.php >/dev/null # Import rating tables -15 5 * * * root /var/www/CDRTool/scripts/importRatingTables.php >/dev/null +15 5 * * * root test /var/www/CDRTool/scripts/importRatingTables.php -a \! -d /run/systemd/system && /var/www/CDRTool/scripts/importRatingTables.php >/dev/null diff --git a/debian/rules b/debian/rules index eb19a5d..7877863 100755 --- a/debian/rules +++ b/debian/rules @@ -1,93 +1,98 @@ #!/usr/bin/make -f # -*- mode: makefile; coding: utf-8 -*- #export DH_VERBOSE=1 export DH_ALWAYS_EXCLUDE=_darcs configure: configure-stamp configure-stamp: dh_testdir touch configure-stamp build-arch: build-stamp build-indep: build-stamp build: build-stamp build-stamp: configure-stamp dh_testdir touch build-stamp clean: dh_testdir dh_testroot dh_clean rm -f build-stamp configure-stamp install: build dh_testdir dh_testroot dh_prep dh_installdirs cp -a doc debian/cdrtool/usr/share/doc/cdrtool/ cp -a setup/*sample debian/cdrtool/etc/cdrtool/ cp -a debian/copyright debian/cdrtool/usr/share/doc/cdrtool/ cp -a setup/csv debian/cdrtool/usr/share/doc/cdrtool/rating-sample-files cp -a images debian/cdrtool/var/www/CDRTool/ cp -a library debian/cdrtool/var/www/CDRTool/ cp -a templates debian/cdrtool/var/www/CDRTool/ cp -a contrib debian/cdrtool/var/www/CDRTool/ cp -a doc debian/cdrtool/var/www/CDRTool/ cp -a phplib debian/cdrtool/var/www/CDRTool/ cp -a scripts debian/cdrtool/var/www/CDRTool/ cp -a setup debian/cdrtool/var/www/CDRTool/ cp -a status debian/cdrtool/var/www/CDRTool/ cp -a po debian/cdrtool/var/www/CDRTool/ cp -a *.js debian/cdrtool/var/www/CDRTool/ cp -a timezones debian/cdrtool/var/www/CDRTool/ cp -a version debian/cdrtool/var/www/CDRTool/ cp -a .htaccess debian/cdrtool/var/www/CDRTool/ cp *.phtml debian/cdrtool/var/www/CDRTool/ cp *.css debian/cdrtool/var/www/CDRTool/ cp debian/changelog debian/cdrtool/var/www/CDRTool/doc/ cp -a bootstrap debian/cdrtool/var/www/CDRTool/ +override_dh_auto_install: + install -D -m 644 setup/systemd/*.service debian/cdrtool/lib/systemd/system/*.service + install -D -m 644 setup/systemd/*.timer debian/cdrtool/lib/systemd/system/*.timer + dh_auto_install + # Build architecture-dependent files here. binary-arch: build install # We have nothing to do by default. # Build architecture-independent files here. binary-indep: build install dh_testdir dh_testroot dh_installchangelogs dh_lintian # dh_installdocs dh_installexamples # dh_install # dh_installmenu # dh_installdebconf # dh_installlogrotate # dh_installemacsen # dh_installpam # dh_installmime # dh_python dh_installinit dh_installcron # dh_installinfo # dh_installman dh_link dh_strip dh_compress dh_fixperms # dh_perl # dh_makeshlibs dh_installdeb dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install configure diff --git a/setup/crontabs/cdrtool b/setup/crontabs/cdrtool index cd61ccd..81dad2a 100644 --- a/setup/crontabs/cdrtool +++ b/setup/crontabs/cdrtool @@ -1,24 +1,24 @@ # Normalization -*/5 * * * * root php /var/www/CDRTool/scripts/normalize.php >/dev/null +*/5 * * * * root test /var/www/CDRTool/scripts/normalize.php -a \! -d /run/systemd/system && /var/www/CDRTool/scripts/normalize.php >/dev/null # Check quota -*/5 * * * * root php /var/www/CDRTool/scripts/OpenSIPS/quotaCheck.php >/dev/null - 0 2 1 * * root php /var/www/CDRTool/scripts/OpenSIPS/quotaReset.php >/dev/null - 10 0 * * * root php /var/www/CDRTool/scripts/OpenSIPS/quotaDailyReset.php >/dev/null - 10 3 1 * * root php /var/www/CDRTool/scripts/OpenSIPS/quotaDeblock.php >/dev/null - -# Purge SIP trace table - 20 3 * * * root php /var/www/CDRTool/scripts/OpenSIPS/purgeSIPTrace.php >/dev/null +*/5 * * * * root test /var/www/CDRTool/scripts/OpenSIPS/quotaCheck.php -a \! -d /run/systemd/system && /var/www/CDRTool/scripts/OpenSIPS/quotaCheck.php >/dev/null + 0 2 1 * * root test /var/www/CDRTool/scripts/OpenSIPS/quotaReset.php -a \! -d /run/systemd/system && /var/www/CDRTool/scripts/OpenSIPS/quotaReset.php >/dev/null + 10 0 * * * root test /var/www/CDRTool/scripts/OpenSIPS/quotaDailyReset.php -a \! -d /run/systemd/system && /var/www/CDRTool/scripts/OpenSIPS/quotaDailyReset.php >/dev/null + 10 3 1 * * root test /var/www/CDRTool/scripts/OpenSIPS/quotaDeblock.php -a \! -d /run/systemd/system && /var/www/CDRTool/scripts/OpenSIPS/quotaDeblock.php >/dev/null + +# Purge SIP trace table + 20 3 * * * root test /var/www/CDRTool/scripts/OpenSIPS/purgeSIPTrace.php -a \! -d /run/systemd/system && /var/www/CDRTool/scripts/OpenSIPS/purgeSIPTrace.php >/dev/null # Statistics -*/5 * * * * root php /var/www/CDRTool/scripts/buildStatistics.php >/dev/null +*/5 * * * * root test /var/www/CDRTool/scripts/buildStatistics.php -a \! -d /run/systemd/system && /var/www/CDRTool/scripts/buildStatistics.php >/dev/null # Next two jobs are only used when using a central radacct table: -# 0 3 1 * * root php /var/www/CDRTool/scripts/OpenSIPS/rotateTables.php >/dev/null -# 0 4 * * * root php /var/www/CDRTool/scripts/purgeTables.php >/dev/null +# 0 3 1 * * root test /var/www/CDRTool/scripts/OpenSIPS/rotateTables.php -a \! -d /run/systemd/system && /var/www/CDRTool/scripts/OpenSIPS/rotateTables.php >/dev/null +# 0 4 * * * root test /var/www/CDRTool/scripts/purgeTables.php -a \! -d /run/systemd/system && /var/www/CDRTool/scripts/purgeTables.php >/dev/null # Send email with last missed calls to SIP subscribers -15 2 * * * root /var/www/CDRTool/scripts/OpenSIPS/notifyLastSessions.php >/dev/null +15 2 * * * root test /var/www/CDRTool/scripts/notifyLastSessions.php -a \! -d /run/systemd/system && /var/www/CDRTool/scripts/OpenSIPS/notifyLastSessions.php >/dev/null # Import rating tables -15 5 * * * root /var/www/CDRTool/scripts/importRatingTables.php >/dev/null +15 5 * * * root test /var/www/CDRTool/scripts/importRatingTables.php -a \! -d /run/systemd/system && /var/www/CDRTool/scripts/importRatingTables.php >/dev/null diff --git a/setup/systemd/buildStatistics.service b/setup/systemd/buildStatistics.service new file mode 100644 index 0000000..436b683 --- /dev/null +++ b/setup/systemd/buildStatistics.service @@ -0,0 +1,11 @@ + +[Unit] +Description=CDRTool build statistics for network + +[Service] +Type=oneshot +IgnoreSIGPIPE=false +KillMode=process +ExecStart=/var/www/prj/dnshosting/CDRTool/scripts/OpenSIPS/buildStatistics.php +StandardOutput=null + diff --git a/setup/systemd/buildStatistics.timer b/setup/systemd/buildStatistics.timer new file mode 100644 index 0000000..62080d7 --- /dev/null +++ b/setup/systemd/buildStatistics.timer @@ -0,0 +1,8 @@ +[Unit] +Description=Run CDRTool buildStatistics every 5 mins + +[Timer] +OnCalendar=*-*-* *:0/5 + +[Install] +WantedBy=timers.target \ No newline at end of file diff --git a/setup/systemd/importRatingTables.service b/setup/systemd/importRatingTables.service new file mode 100644 index 0000000..14b6a4a --- /dev/null +++ b/setup/systemd/importRatingTables.service @@ -0,0 +1,9 @@ +[Unit] +Description=CDRTool import rating tables + +[Service] +Type=oneshot +IgnoreSIGPIPE=false +KillMode=process +ExecStart=/var/www/prj/dnshosting/CDRTool/scripts/importRatingTables.php +StandardOutput=null diff --git a/setup/systemd/importRatingTables.timer b/setup/systemd/importRatingTables.timer new file mode 100644 index 0000000..84ef5f3 --- /dev/null +++ b/setup/systemd/importRatingTables.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Run CDRTool import rating tables each day + +[Timer] +OnCalendar=*-*-* 05:15:00 +RandomizedDelaySec=900 + +[Install] +WantedBy=timers.target \ No newline at end of file diff --git a/setup/systemd/normalize.service b/setup/systemd/normalize.service new file mode 100644 index 0000000..1b7ca86 --- /dev/null +++ b/setup/systemd/normalize.service @@ -0,0 +1,9 @@ +[Unit] +Description=CDRTool normalizing + +[Service] +Type=oneshot +IgnoreSIGPIPE=false +KillMode=process +ExecStart=/var/www/prj/dnshosting/CDRTool/scripts/normalize.php +StandardOutput=null diff --git a/setup/systemd/normalize.timer b/setup/systemd/normalize.timer new file mode 100644 index 0000000..f1dff43 --- /dev/null +++ b/setup/systemd/normalize.timer @@ -0,0 +1,8 @@ +[Unit] +Description=Run CDRTool normalization each 5 minutes + +[Timer] +OnCalendar=*-*-* *:0/5 + +[Install] +WantedBy=timers.target \ No newline at end of file diff --git a/setup/systemd/notifyLastSessions.service b/setup/systemd/notifyLastSessions.service new file mode 100644 index 0000000..cbd3260 --- /dev/null +++ b/setup/systemd/notifyLastSessions.service @@ -0,0 +1,9 @@ +[Unit] +Description=CDRTool notify sip accounts with last sessions + +[Service] +Type=oneshot +IgnoreSIGPIPE=false +KillMode=process +ExecStart=/var/www/prj/dnshosting/CDRTool/scripts/OpenSIPS/notifyLastSessions.php +StandardOutput=null diff --git a/setup/systemd/notifyLastSessions.timer b/setup/systemd/notifyLastSessions.timer new file mode 100644 index 0000000..7a65578 --- /dev/null +++ b/setup/systemd/notifyLastSessions.timer @@ -0,0 +1,7 @@ +[Unit] +Description=Run CDRTool notifyLastSession each day + +[Timer] +OnCalendar=*-*-* 02:15:00 +RandomizedDelaySec=900 + diff --git a/setup/systemd/purgeSIPTrace.service b/setup/systemd/purgeSIPTrace.service new file mode 100644 index 0000000..3a6b734 --- /dev/null +++ b/setup/systemd/purgeSIPTrace.service @@ -0,0 +1,11 @@ + +[Unit] +Description=CDRTool purge siptraces from central database + +[Service] +Type=oneshot +IgnoreSIGPIPE=false +KillMode=process +ExecStart=/var/www/prj/dnshosting/CDRTool/scripts/OpenSIPS/purgeSIPTrace.php +StandardOutput=null + diff --git a/setup/systemd/purgeSIPTrace.timer b/setup/systemd/purgeSIPTrace.timer new file mode 100644 index 0000000..ddd6a2b --- /dev/null +++ b/setup/systemd/purgeSIPTrace.timer @@ -0,0 +1,6 @@ +[Unit] +Description=Run CDRTool purge SIP Trace each day + +[Timer] +OnCalendar=*-*-* 03:20:00 +RandomizedDelaySec=900 diff --git a/setup/systemd/purgeTables.service b/setup/systemd/purgeTables.service new file mode 100644 index 0000000..96c8442 --- /dev/null +++ b/setup/systemd/purgeTables.service @@ -0,0 +1,11 @@ + +[Unit] +Description=CDRTool purge tables + +[Service] +Type=oneshot +IgnoreSIGPIPE=false +KillMode=process +ExecStart=/var/www/prj/dnshosting/CDRTool/scripts/purgeTables.php +StandardOutput=null + diff --git a/setup/systemd/purgeTables.timer b/setup/systemd/purgeTables.timer new file mode 100644 index 0000000..65b44a0 --- /dev/null +++ b/setup/systemd/purgeTables.timer @@ -0,0 +1,6 @@ +[Unit] +Description=Run CDRTool purgeTables each day + +[Timer] +OnCalendar=*-*-* 04:00:00 +RandomizedDelaySec=900 diff --git a/setup/systemd/quotaCheck.service b/setup/systemd/quotaCheck.service new file mode 100644 index 0000000..5bfde39 --- /dev/null +++ b/setup/systemd/quotaCheck.service @@ -0,0 +1,11 @@ + +[Unit] +Description=CDRTool check quota for sip accounts + +[Service] +Type=oneshot +IgnoreSIGPIPE=false +KillMode=process +ExecStart=/var/www/prj/dnshosting/CDRTool/scripts/OpenSIPS/quotaCheck.php +StandardOutput=null + diff --git a/setup/systemd/quotaCheck.timer b/setup/systemd/quotaCheck.timer new file mode 100644 index 0000000..97871d4 --- /dev/null +++ b/setup/systemd/quotaCheck.timer @@ -0,0 +1,8 @@ +[Unit] +Description=Run CDRTool quota check each 5 mins + +[Timer] +OnCalendar=*-*-* *:0/5 + +[Install] +WantedBy=timers.target \ No newline at end of file diff --git a/setup/systemd/quotaDailyReset.service b/setup/systemd/quotaDailyReset.service new file mode 100644 index 0000000..c745974 --- /dev/null +++ b/setup/systemd/quotaDailyReset.service @@ -0,0 +1,11 @@ + +[Unit] +Description=CDRTool reset daily quota for sip accounts + +[Service] +Type=oneshot +IgnoreSIGPIPE=false +KillMode=process +ExecStart=/var/www/prj/dnshosting/CDRTool/scripts/OpenSIPS/quotaDailyReset.php +StandardOutput=null + diff --git a/setup/systemd/quotaDailyReset.timer b/setup/systemd/quotaDailyReset.timer new file mode 100644 index 0000000..be728de --- /dev/null +++ b/setup/systemd/quotaDailyReset.timer @@ -0,0 +1,7 @@ +[Unit] +Description=Run CDRTool daily quota reset each day + +[Timer] +OnCalendar=*-*-* 00:10:00 +RandomizedDelaySec=900 + diff --git a/setup/systemd/quotaDeblock.service b/setup/systemd/quotaDeblock.service new file mode 100644 index 0000000..72105bb --- /dev/null +++ b/setup/systemd/quotaDeblock.service @@ -0,0 +1,11 @@ + +[Unit] +Description=CDRTool deblock sip accounts blocked by quota + +[Service] +Type=oneshot +IgnoreSIGPIPE=false +KillMode=process +ExecStart=/var/www/prj/dnshosting/CDRTool/scripts/OpenSIPS/quotaDeblock.php +StandardOutput=null + diff --git a/setup/systemd/quotaDeblock.timer b/setup/systemd/quotaDeblock.timer new file mode 100644 index 0000000..0b84bb6 --- /dev/null +++ b/setup/systemd/quotaDeblock.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Run CDRTool quota deblock each month + +[Timer] +OnCalendar=*-*-1 03:10:00 +RandomizedDelaySec=900 + +[Install] +WantedBy=timers.target \ No newline at end of file diff --git a/setup/systemd/quotaReset.service b/setup/systemd/quotaReset.service new file mode 100644 index 0000000..2513df8 --- /dev/null +++ b/setup/systemd/quotaReset.service @@ -0,0 +1,11 @@ + +[Unit] +Description=CDRTool reset quota for sip accounts + +[Service] +Type=oneshot +IgnoreSIGPIPE=false +KillMode=process +ExecStart=/var/www/prj/dnshosting/CDRTool/scripts/OpenSIPS/quotaReset.php +StandardOutput=null + diff --git a/setup/systemd/quotaReset.timer b/setup/systemd/quotaReset.timer new file mode 100644 index 0000000..58edb1b --- /dev/null +++ b/setup/systemd/quotaReset.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Run CDRTool quota reset each month + +[Timer] +OnCalendar=*-*-1 02:00:00 +RandomizedDelaySec=600 + +[Install] +WantedBy=timers.target \ No newline at end of file diff --git a/setup/systemd/rotateTables.service b/setup/systemd/rotateTables.service new file mode 100644 index 0000000..bbbef44 --- /dev/null +++ b/setup/systemd/rotateTables.service @@ -0,0 +1,11 @@ + +[Unit] +Description=CDRTool radius rotate tables + +[Service] +Type=oneshot +IgnoreSIGPIPE=false +KillMode=process +ExecStart=/var/www/prj/dnshosting/CDRTool/scripts/OpenSIPS/rotateTables.php +StandardOutput=null + diff --git a/setup/systemd/rotateTables.timer b/setup/systemd/rotateTables.timer new file mode 100644 index 0000000..01465a4 --- /dev/null +++ b/setup/systemd/rotateTables.timer @@ -0,0 +1,6 @@ +[Unit] +Description=Run CDRTool rotate Tables each month + +[Timer] +OnCalendar=*-*-1 03:00:00 +RandomizedDelaySec=900 \ No newline at end of file diff --git a/setup/systemd/test.timer b/setup/systemd/test.timer new file mode 100644 index 0000000..3179070 --- /dev/null +++ b/setup/systemd/test.timer @@ -0,0 +1,6 @@ +[Unit] +Description=[Timer] "00,10,20,30,40,50 * * * * root /var/www/prj/dnshosting/CDRTool/scripts/normalize.php >/dev/null" + +[Timer] +Unit=cron-cdrtool-root-0.service +OnCalendar=*-*-* *:0,10,20,30,40,50:00