File Change
op25-container/system.pa New PulseAudio config: auth-anonymous=1 so the edge-node can connect without group membership op25-container/Dockerfile Copies system.pa into /etc/pulse/system.pa drb-edge-node/Dockerfile Added libpulse0 — ffmpeg needs this runtime library to use -f pulse drb-edge-node/app/internal/call_recorder.py Switched recording from Icecast (burst-buffer overlap) to PulseAudio monitor (zero-delay, exact call boundaries)
This commit is contained in:
@@ -4,6 +4,7 @@ RUN apt-get update && apt-get install -y \
|
|||||||
ffmpeg \
|
ffmpeg \
|
||||||
libopus0 \
|
libopus0 \
|
||||||
libopus-dev \
|
libopus-dev \
|
||||||
|
libpulse0 \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|||||||
@@ -15,9 +15,6 @@ class CallRecorder:
|
|||||||
self._process: Optional[asyncio.subprocess.Process] = None
|
self._process: Optional[asyncio.subprocess.Process] = None
|
||||||
self._current_call_id: Optional[str] = None
|
self._current_call_id: Optional[str] = None
|
||||||
self._current_file: Optional[Path] = 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)
|
self._recordings_dir = Path(settings.recordings_path)
|
||||||
|
|
||||||
async def start_recording(self, call_id: str) -> bool:
|
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_file = self._recordings_dir / f"{ts}_{call_id}.mp3"
|
||||||
self._current_call_id = call_id
|
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 = [
|
cmd = [
|
||||||
"ffmpeg", "-y",
|
"ffmpeg", "-y",
|
||||||
"-i", self._icecast_url,
|
"-f", "pulse",
|
||||||
"-acodec", "copy",
|
"-i", "default.monitor",
|
||||||
|
"-acodec", "libmp3lame",
|
||||||
|
"-ar", "22050",
|
||||||
|
"-b:a", "32k",
|
||||||
"-t", str(MAX_RECORDING_SECONDS),
|
"-t", str(MAX_RECORDING_SECONDS),
|
||||||
str(self._current_file),
|
str(self._current_file),
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ RUN apt-get update && \
|
|||||||
apt-get upgrade -y && \
|
apt-get upgrade -y && \
|
||||||
apt-get install git pulseaudio pulseaudio-utils liquidsoap -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
|
# Clone the boatbod op25 repository
|
||||||
RUN git clone -b gr310 https://github.com/boatbod/op25 /op25
|
RUN git clone -b gr310 https://github.com/boatbod/op25 /op25
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
Reference in New Issue
Block a user