This issue is related to voicemail. When system has been idle for more than 5 minutes, in teh first call to voicemail the process just hangs and user keeps listening the ring. After some troubleshooting what we found that in AGI::ReadParse() the STDIN does not contain all the parameters, and since it doesn’t reveive EOF character in STDIN the ReadParse() gets stuck in IO.
When user hangsup and makes another call it then goes through properly. The issue can be reproduced everytime the system sits idle for approximately 5 minutes.
What version of asterisk are you running? Are you sure the problem is not with the system, or hard drive(s) going to standby and thus missing some packets or something timing out while trying to read / write something to a hard drive spinning up?