jobs: public IP, trunk and disk watches, retention
apps/api/src/jobs.ts takes over the once-a-minute timer from index.ts (no croner: every schedule in 04 §8 is whole minutes). Each job has a running flag; errors are logged. - Retention (at start and when the date changes, once AMI is up): recordings, voicemail past voicemail.retentionDays (VoicemailRemove, so Asterisk renumbers and updates MWI), expired sessions, webhook deliveries older than 30 days. - publicIpWatch (every 5 min, Settings -> Network): a changed IP is saved, audited, applied (restart required) and emailed to admins. - trunkWatch: a registering trunk rejected/unregistered for 5 minutes -> one email per outage. - diskWatch (hourly): under 10% free -> one email a day. - A failed daily backup emails admins too. Settings gets a Network tab (public IP, Detect, re-check) and voicemail retention on the Recording tab. Task: M11-T4
This commit is contained in:
1 parent
164a5f0990
commit
d229ed2c45
8 files changed
+755
-43
No files matched your search
@@ -447,6 +447,22 @@ Provisioning and inbound hooks (outside `/api`, no session):
|
||||
|
||||
Jobs must never overlap with themselves (use a running flag).
|
||||
|
||||
As built (M11-T4): `jobs.ts`, one setInterval a minute instead of croner (every schedule above is
|
||||
whole minutes). Each job has a running flag; an error is logged, not fatal.
|
||||
- `nightlyRegenerate` and `retentionCleanup` run when the date in `general.timezone` changes and
|
||||
at start, not at 00:05 / 02:00. Retention waits for AMI: voicemail is removed with
|
||||
`VoicemailRemove`, so Asterisk renumbers the folder and updates MWI. It also deletes recordings,
|
||||
expired sessions and webhook deliveries older than 30 days.
|
||||
- `publicIpWatch` asks api.ipify.org (then ifconfig.me), only when the setting is on (Settings →
|
||||
Network). A changed IP is saved, audited, applied (which sets `restartRequired`; the job doesn't
|
||||
restart Asterisk, that drops calls) and emailed.
|
||||
- `trunkWatch` only knows registering trunks (IP-auth trunks are always `unknown`): rejected or
|
||||
unregistered for 5 minutes in a row → one email; registered again ends the outage. Skipped while
|
||||
AMI is down. No "back up" email.
|
||||
- `diskWatch` checks the filesystem of `RECORDINGS_DIR` (`statfs`).
|
||||
- Admin emails go to every active admin; the texts are in `jobs.ts`, not `mail.ts`. A failed daily
|
||||
backup emails them too (08 §3.2). Email not set up: logged, nothing else.
|
||||
|
||||
### 8.1 Backups
|
||||
Folder `/var/lib/selfphoneng/backups/selfphoneng-YYYYMMDD-HHMM.tar.gz` containing:
|
||||
`db.sql` (`pg_dump --no-owner`), `voicemail/`, `sounds-custom/`, `moh/`,
|
||||
|
||||
Reference in new issue
Block a user