Asterisk voicemail files

I am in the process of integrating my asterisk system with a webserver and I’m looking to understand the rules for voicemail files in the /var/spool/asterisk/voicemail directory. In particular, I think I can easily inspect a voicemail box to search and retrieve messages, however, what are the rules that I need to follow to delete a voicemail file? Is it sufficient to simply delete the set of related files (i.e., msg0001.txt, msg0001.wav, msg000.gsm, msg0001.txt) or do I need to maintain the other files in the directory so that the sequence of filenames always starts at zero and continues sequentially? For each voicemail directory, is there some index file that I also need to maintain?

I’m using Java and JSP’s to implement my webserver. Are there any Java libraries that have been previously developed for interfacing with Asterisk?

Check here for java classes to interact with Asterisk: asterisk-java.org/.

Regards.

Marco Bruni

I found the asterisk-java site very helpful, thank you. I still, however, have some basic questions about deleting voicemail messages programatically (I’m not sure if the directory numbering is significant, or if there is some index file somewhere that needs to be maintained).

I just checked the source code of the app_voicemail (apps/app_voicemail.c), to delete a voicemail element seems you just delete the .msg file and the related .txt file, also it’s better to respect the sequence of the messages but I saw a call to a resequence function when the mailbox is opened, so the system could “survive” to sequence problems.
In the end I think you should read the doxygen annotated source code for the app_voicemail.c, you can find it online here: asterisk.org/doxygen/1.4/, look for app_voicemail.c in the “File list”.

Regards.

Marco Bruni

I think this is just what I needed! Thank you.