diff --git a/drb-edge-node/app/internal/call_recorder.py b/drb-edge-node/app/internal/call_recorder.py index 9c6cb55..b5ae03d 100644 --- a/drb-edge-node/app/internal/call_recorder.py +++ b/drb-edge-node/app/internal/call_recorder.py @@ -43,10 +43,18 @@ class CallRecorder: try: self._process = await asyncio.create_subprocess_exec( *cmd, - stdout=asyncio.subprocess.DEVNULL, - stderr=asyncio.subprocess.DEVNULL, + stdout=asyncio.subprocess.PIPE, + stderr=asyncio.subprocess.PIPE, ) - logger.info(f"Recording started: {self._current_file.name}") + + # Quick check if it died immediately (e.g. Pulse source not found) + await asyncio.sleep(0.5) + if self._process.returncode is not None: + _, stderr = await self._process.communicate() + logger.error(f"FFmpeg exited immediately ({self._process.returncode}): {stderr.decode()}") + return False + + logger.info(f"Recording process started: {self._current_file.name}") return True except Exception as e: logger.error(f"FFmpeg start failed: {e}") diff --git a/drb-edge-node/app/main.py b/drb-edge-node/app/main.py index 323edf9..af08d05 100644 --- a/drb-edge-node/app/main.py +++ b/drb-edge-node/app/main.py @@ -34,6 +34,10 @@ async def on_call_end(data: dict): audio_url = await call_recorder.upload_recording(file_path, data["call_id"]) if audio_url: data["audio_url"] = audio_url + else: + logger.error(f"Audio upload failed for call {data['call_id']}. Verify C2_URL and Node API Key.") + else: + logger.warning(f"No recording file generated for call {data['call_id']}. Is PulseAudio working?") await mqtt_manager.publish_metadata("call_end", data) await mqtt_manager.publish_status("online")