Skip to content

recording-daemon: lifecycle notification events#2142

Open
goolanceman wants to merge 4 commits into
sipwise:masterfrom
goolanceman:recording-notify-lifecycle
Open

recording-daemon: lifecycle notification events#2142
goolanceman wants to merge 4 commits into
sipwise:masterfrom
goolanceman:recording-notify-lifecycle

Conversation

@goolanceman

@goolanceman goolanceman commented Jul 18, 2026

Copy link
Copy Markdown

Summary

Extends rtpengine-recording notifications from the historical finished-only path to a configurable call/stream lifecycle event set, while remaining backward compatible.

Events (notify-events CSV)

Token Event name
opened recording_file_opened
started recording_started
finished (default) recording_finished
discarded recording_discarded
failed recording_failed
call-started call_recording_started
call-finished call_recording_finished
call-discarded call_recording_discarded
all all of the above

Default remains finished only so existing deployments are unchanged.

New options

  • notify-events — CSV list (default finished)
  • notify-json — POST JSON body via json-glib
  • notify-no-metadata — omit call metadata from payloads
  • notify-command-formatlegacy | extended | json-env
  • notify-queue-limit — bound non-terminal queue depth (default 1000; 0 = unlimited). Terminal events are always accepted.

Design

  • Keeps upstream action-based notify model (notif_action_t / notif_req_t) and lib/http.c helpers
  • Pure event helpers in notify_events.c (shared with unit tests)
  • Stream hooks in output.c; call hooks in metafile.c / packet.c
  • Snapshots strings into notif_req before queueing (workers never touch live objects)
  • Metrics logged on shutdown: enqueued / success / retry / giveup / dropped

Tests

  • Unit: t/test-notify-events.c — PASS
  • E2E smoke: t/notify_e2e/ temp Python HTTP receiver + metafile lifecycle — E2E_NOTIFY_OK
    • Built/ran in Docker
    • Received call_recording_finished with JSON body + lifecycle headers

Docs

  • docs/rtpengine-recording.md
  • etc/rtpengine-recording.conf

Example

notify-uri = https://example.com/rec/events
notify-events = opened,started,finished,discarded,failed,call-started,call-finished,call-discarded
notify-json = true
notify-concurrency = 5
notify-retries = 10

Compatibility

  • Default config behavior is identical to previous finished-only notifications
  • Legacy notify-command argv (path, db_id) preserved when notify-command-format=legacy

I used an AI assistant to help with some of the repetitive work (e.g. scaffolding, draft text), but the architecture, behaviour, and all final code changes were reviewed, adapted, and validated by me. The goal is to speed up the mechanical parts while still having a human developer take responsibility for correctness, style, and alignment with rtpengine 's conventions. Feedback is very welcome and I'll iterate on the implementation as needed.

@goolanceman
goolanceman marked this pull request as ready for review July 18, 2026 17:53
@goolanceman
goolanceman force-pushed the recording-notify-lifecycle branch from a4ccba2 to fd097da Compare July 18, 2026 18:10

@rfuchs rfuchs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is all AI generated, isn't it

Comment thread recording-daemon/notify.c
Comment thread recording-daemon/notify.c
@goolanceman

Copy link
Copy Markdown
Author

This is all AI generated, isn't it

Good eye 🙂
I did use an AI assistant to help draft parts of this (especially the docs/text), but I've reviewed and adjusted everything myself and verified the code and tests. I'm fully responsible for the changes here, so if anything looks off, please call it out and I'll fix it.

@goolanceman
goolanceman force-pushed the recording-notify-lifecycle branch from a6f6824 to bf74310 Compare July 20, 2026 06:14
Mansoor Khan M added 4 commits July 21, 2026 12:52
Extend rtpengine-recording HTTP/command notifications beyond the
historical finished-only path so operators can track call and stream
recording lifecycle.

Events (notify-events CSV, default: finished):
  opened, started, finished, discarded, failed,
  call-started, call-finished, call-discarded

New options: notify-events, notify-json, notify-no-metadata,
notify-command-format, notify-queue-limit.

Docs/conf only document the new notify options; upstream storage
(S3/GCS/output-storage) docs are left unchanged.

Backward compatible: default mask is finished only.
Includes unit tests and Docker e2e smoke harness.
notify_setup must not require notify-uri/notify-command: the same
thread pool backs S3, GCS and DB notif_action_t work. Also leave
object_name to action cleanup to avoid double-free on those paths.
@goolanceman
goolanceman force-pushed the recording-notify-lifecycle branch from 70d8ba9 to a1ae952 Compare July 21, 2026 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants