Hi all, I need to be able to delete a voicemail message using a program. Is is sufficient to simply delete the .wav and .txt files in the spool directory? Or do I need to also renumber the remaining files? For example, let say a given mailbox has 20 messages in it and I want to delete message number 5. Can I just delete the 2 files and expect that asterisk will renumber them? Or do I need to? Also, is the answer the same when I migrate to storing voicemails in a database? Thanks in advance. Mike
Hi Mike, New AMI actions were recently added to app_voicemail to let you remotely manipulate a mailbox: https://github.com/asterisk/asterisk/issues/181 Hope this helps. BR, -Mike On Mon, Oct 9, 2023 at 1:06 PM Mike Diehl <mdiehl at diehlnet.com> wrote:> Hi all, > > I need to be able to delete a voicemail message using a program. > > Is is sufficient to simply delete the .wav and .txt files in the spool > directory? > Or do I need to also renumber the remaining files? > > For example, let say a given mailbox has 20 messages in it and I want to > delete message number 5. Can I just delete the 2 files and expect that > asterisk will renumber them? Or do I need to? > > Also, is the answer the same when I migrate to storing voicemails in a > database? > > Thanks in advance. > > Mike > > > > -- > _____________________________________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > > Check out the new Asterisk community forum at: > https://community.asterisk.org/ > > New to Asterisk? Start here: > https://wiki.asterisk.org/wiki/display/AST/Getting+Started > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20231009/851f25b4/attachment.html>
On Monday 09 October 2023 at 21:05:55, Mike Diehl wrote:> Hi all, > > I need to be able to delete a voicemail message using a program. > > Is is sufficient to simply delete the .wav and .txt files in the spool > directory? Or do I need to also renumber the remaining files?My approach in a situation like this would often be "try it and see". Leave yourself three voicemail messages, remove the middle one simply by deleting the files, and see what Asterisk makes of what's left behind: - does it report three messages but only play two? - does it report either two or three messages but can only play the first? - does it report two messages and play them without problem? - does it report two messages and fail to play anything? - does it report no messages? - does it have a problem when a fourth message gets left? None of the above behaviour is _necessarily_ transferrable to a future version of Asterisk, but at least it tells you what your current version does when you interfere with in this way.. Antony. -- .evah I serutangis sseltniop tsom eht fo eno eb tsum sihT Please reply to the list; please *don't* CC me.
Here is something I wrote years ago. I expect you can adjust it for your needs # cat remove_blank_vmail #!/bin/bash # remove_blank_vmail takes arguments as voicemail boxes and removes messages with audio files shorter then MINSIZE (in bytes) #---------------------------------------------------------------------- # Description: # Author: John Harragin Monroe-Woodbury CSD # Created at: Thu Nov 6 12:27:35 EST 2008 # # Copyright: None. Modify and use however you like... # #---------------------------------------------------------------------- # Configure section: BASEDIR=/var/spool/asterisk/voicemail/default/ # default context MINSIZE=12000 # 1.5 seconds #--------------------------------------------------------------subroutines: ProcessDir () { lastfile="" delcnt=0 for file in $(ls -A ${msgdir}/msg*.txt 2>/dev/null); do # the redirect supresses msg when dir empty if [ $(stat --format=%s ${file/.txt/.wav}) -lt ${MINSIZE} ]; then rm ${file/.txt/.*} let delcnt++ fi lastfile=${file} done if [ $delcnt -gt 0 ]; then echo "$delcnt short messages deleted from ${msgdir}"; fi partfilename=${lastfile/*\/msg/} # get number from file name highest=${partfilename/.txt/} while [[ $highest = 0* ]]; do highest=${highest#0}; done # bash does not like leading zeros if [ ${#highest} -eq 0 ]; then highest=0; fi # ...or blanks for math realcount=0 for ((x=0;x<=${highest};x+=1)); do chkname=msg$(printf "%04d" $x) # build name - pad with zeros... if [ -e ${msgdir}/${chkname}.txt ]; then if [ $realcount -ne $x ];then newname=msg$(printf "%04d" $realcount) for idivfile in $(ls -A ${msgdir}/${chkname}.*); do mv ${idivfile} ${msgdir}/${newname}.${idivfile/*\/*./} done fi let realcount++ fi done } #--------------------------------------------------------------main: for ext in "$@"; do if [ -d ${BASEDIR}${ext} ];then for msgdir in $(ls -d ${BASEDIR}${ext}/*); do ProcessDir ${msgdir} done else echo "${BASEDIR}${ext} is not a valid directory" fi echo "Processed extension $ext" done On Mon, Oct 9, 2023 at 3:06 PM Mike Diehl <mdiehl at diehlnet.com> wrote:> Hi all, > > I need to be able to delete a voicemail message using a program. > > Is is sufficient to simply delete the .wav and .txt files in the spool > directory? > Or do I need to also renumber the remaining files? > > For example, let say a given mailbox has 20 messages in it and I want to > delete message number 5. Can I just delete the 2 files and expect that > asterisk will renumber them? Or do I need to? > > Also, is the answer the same when I migrate to storing voicemails in a > database? > > Thanks in advance. > > Mike > > > > -- > _____________________________________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > > Check out the new Asterisk community forum at: > https://community.asterisk.org/ > > New to Asterisk? Start here: > https://wiki.asterisk.org/wiki/display/AST/Getting+Started > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20231010/880f52e6/attachment.html>
Reasonably Related Threads
- Deleting voicemail by program
- E-mail advice sought
- Importing a SAS file to R: Alas, STILL more problems--has anyone gotten this message before, and why
- [PATCH 23/28] lib82596: convert from dma_cache_sync to dma_sync_single_for_device
- [PATCH 11/18] lib82596: convert to dma_alloc_noncoherent