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