Open Source - How do I free a locked file causing msgs button to fail to retrieve voicemail?

Open Source - How do I free a locked file causing msgs button to fail to retrieve voicemail?

A .lock file is created when a file is in use, generally these files are deleted when a process is done with them, it seems that the process using /var/spool/asterisk/voicemail never released the lock, this could be due to a previous crash of the process that locked the file, or something along those lines. 

 

The asterisk CLI will show the following when msgs button is pressed and no voicemail is retrievable: 

"WARNING[1861]: app.c:1743 ast_lock_path_lockfile: Failed to lock path '/var/spool/asterisk/voicemail/default/XXX/Old': File exists 

WARNING[1861]: app_voicemail.c:15069 vm_mailbox_snapshot_create: Could not open mailbox XXX

WARNING[1861]: app.c:1743 ast_lock_path_lockfile: Failed to lock path ‘/var/spool/asterisk/voicemail/default/XXX/Old’: File exists"

 

Run the following commands to find and remove the .lock files: 

run: find /var/spool/asterisk/voicemail/default -name ".lock" 

 

if it finds any .lock files run the following command 

/usr/bin/find /var/spool/asterisk/voicemail -name ".lock*" -mmin +1 -exec rm -f {} \;

 

Example:

[root@freepbx ~]# find /var/spool/asterisk/voicemail/default -name ".lock" 

/var/spool/asterisk/voicemail/default/XXX/Old/.lock 

[root@freepbx ~]# /usr/bin/find /var/spool/asterisk/voicemail -name ".lock*" -mmin +1 -exec rm -f {} \;