Problem Description
I’m experiencing an intermittent issue with AGI call recordings where agi.record_file() sometimes produces audio files that are only 44 bytes in size. These files contain only the WAV header with no actual audio data.
Code Example
recording_file = f"/tmp/customer_input1_{unique_id}.wav"
agi.record_file(recording_file.replace(“.wav”, “”), “wav”, “#”, 3000, 0, 0)
Symptoms
- Expected: WAV files with actual audio content (typically several KB)
- Actual: Some files are exactly 44 bytes (WAV header only)
- Frequency: Intermittent - happens randomly, not consistently
- Impact: Speech recognition fails on these empty files
Observations
- The issue appears to be more common during certain call scenarios
- No obvious error messages in AGI logs when this occurs
- The recording timeout (3000ms) should be sufficient for normal responses
- File permissions and disk space are not issues
Questions
- Has anyone experienced similar issues with
agi.record_file()? - What could cause the recording to stop immediately after creating the WAV header?
- Are there any AGI configuration parameters that might help?
- Should I implement additional error checking or retry logic?
What I’ve Tried
- Verified file paths and permissions
- Checked available disk space
- Confirmed the recording timeout is reasonable
- Added logging to track when this occurs
- Retry file saving
Request for Help
Any suggestions for:
- Debugging this issue further
- Alternative recording approaches
- AGI best practices for reliable audio recording
- Configuration tweaks that might resolve this
Thanks in advance for any insights or suggestions!