Deleting Voicemail By Program

Home » Asterisk Users » Deleting Voicemail By Program
Asterisk Users 6 Comments

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

6 thoughts on - Deleting Voicemail By Program

  • Unfortunately, I’m using a version of asterisk that is old enough to not benefit from this…

    Mike.

  •     The script included with Asterisk (messages-expire.pl) deletes older messages and then renumbers the rest of the messages.  I guess you need to do the same.


    Telecomunicaciones Abiertas de México S.A. de C.V. Carlos Chávez
    +52 (55)8116-9161

  • 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)
    #——————————————————————–

  • John, that is some serious script-fu! I does exactly what I was going to do in perl. However, my initial testing indicates that asterisk will renumber voicemail boxes to eliminate holes. But I’m still testing.

    Thanks again,

    Mike.