From fb86d7993033bee5dc90d35110076044914a876b Mon Sep 17 00:00:00 2001 From: Logan Date: Sat, 11 Apr 2026 21:16:32 -0400 Subject: [PATCH] =?UTF-8?q?File=09Change=20op25-container/system.pa=09New?= =?UTF-8?q?=20PulseAudio=20config:=20auth-anonymous=3D1=20so=20the=20edge-?= =?UTF-8?q?node=20can=20connect=20without=20group=20membership=20op25-cont?= =?UTF-8?q?ainer/Dockerfile=09Copies=20system.pa=20into=20/etc/pulse/syste?= =?UTF-8?q?m.pa=20drb-edge-node/Dockerfile=09Added=20libpulse0=20=E2=80=94?= =?UTF-8?q?=20ffmpeg=20needs=20this=20runtime=20library=20to=20use=20-f=20?= =?UTF-8?q?pulse=20drb-edge-node/app/internal/call=5Frecorder.py=09Switche?= =?UTF-8?q?d=20recording=20from=20Icecast=20(burst-buffer=20overlap)=20to?= =?UTF-8?q?=20PulseAudio=20monitor=20(zero-delay,=20exact=20call=20boundar?= =?UTF-8?q?ies)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- drb-edge-node/Dockerfile | 1 + drb-edge-node/app/internal/call_recorder.py | 12 +++++++----- op25-container/Dockerfile | 5 ++++- op25-container/system.pa | 16 ++++++++++++++++ 4 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 op25-container/system.pa diff --git a/drb-edge-node/Dockerfile b/drb-edge-node/Dockerfile index bb77fe6..dc1754e 100644 --- a/drb-edge-node/Dockerfile +++ b/drb-edge-node/Dockerfile @@ -4,6 +4,7 @@ RUN apt-get update && apt-get install -y \ ffmpeg \ libopus0 \ libopus-dev \ + libpulse0 \ && rm -rf /var/lib/apt/lists/* WORKDIR /app diff --git a/drb-edge-node/app/internal/call_recorder.py b/drb-edge-node/app/internal/call_recorder.py index 9c55bb6..9c6cb55 100644 --- a/drb-edge-node/app/internal/call_recorder.py +++ b/drb-edge-node/app/internal/call_recorder.py @@ -15,9 +15,6 @@ class CallRecorder: self._process: Optional[asyncio.subprocess.Process] = None self._current_call_id: Optional[str] = None self._current_file: Optional[Path] = None - self._icecast_url = ( - f"http://{settings.icecast_host}:{settings.icecast_port}{settings.icecast_mount}" - ) self._recordings_dir = Path(settings.recordings_path) async def start_recording(self, call_id: str) -> bool: @@ -30,10 +27,15 @@ class CallRecorder: self._current_file = self._recordings_dir / f"{ts}_{call_id}.mp3" self._current_call_id = call_id + # Read directly from the PulseAudio monitor source (zero-delay, no Icecast burst buffer). + # PULSE_SERVER env var is set in the container environment. cmd = [ "ffmpeg", "-y", - "-i", self._icecast_url, - "-acodec", "copy", + "-f", "pulse", + "-i", "default.monitor", + "-acodec", "libmp3lame", + "-ar", "22050", + "-b:a", "32k", "-t", str(MAX_RECORDING_SECONDS), str(self._current_file), ] diff --git a/op25-container/Dockerfile b/op25-container/Dockerfile index bdebcea..59e0a23 100644 --- a/op25-container/Dockerfile +++ b/op25-container/Dockerfile @@ -6,9 +6,12 @@ ENV DEBIAN_FRONTEND=noninteractive # Install system dependencies RUN apt-get update && \ - apt-get upgrade -y && \ + apt-get upgrade -y && \ apt-get install git pulseaudio pulseaudio-utils liquidsoap -y +# Install custom PulseAudio system config (enables anonymous access for edge-node) +COPY system.pa /etc/pulse/system.pa + # Clone the boatbod op25 repository RUN git clone -b gr310 https://github.com/boatbod/op25 /op25 diff --git a/op25-container/system.pa b/op25-container/system.pa new file mode 100644 index 0000000..e45789f --- /dev/null +++ b/op25-container/system.pa @@ -0,0 +1,16 @@ +# PulseAudio system daemon configuration for DRB containers. +# Allows anonymous connections so the edge-node container can read the audio monitor. + +.nofail + +# Native protocol with anonymous auth — required for inter-container access +load-module module-native-protocol-unix socket=/run/pulse/native auth-anonymous=1 + +# Always provide a default sink even without audio hardware +load-module module-always-sink + +# Restore device/stream settings across restarts +load-module module-device-restore +load-module module-stream-restore + +.fail