Changing voicemail file name

Currently my PBX names voicemails “msg001”, “msg002”, etc. I would like them to be labeled with the caller ID number and the date and time. Something like 5155551234_01012014_141551 (phone number_date_time)

Is this possible anywhere?

No. It would break comedian mail. There is no permanence to the sequence of any voicemail, it will change as the voicemail system is exercised. The meta-data is however available in the msgNNNN.txt file

1 Like

Bummer. Thanks for the reply!

I am intrigued, what are really trying to do?

Because of the way linux file systems, hardlinks and comedian mail all work, perhaps a variation on the theme of :-

for j in `find /var/spool/asterisk/voicemail/default/*/INBOX -name "msg*.txt"`;do mkdir -p /var/spool/asterisk/voicemail/bradbpw/$(cat $j|grep origmailbox|cut -d "=" -f2);ln -f $(echo $j|sed s'/txt/wav/') /var/spool/asterisk/voicemail/bradbpw/$(cat $j|grep origmailbox|cut -d "=" -f2)/$( date -d "`cat $j|grep origdate|cut -d "=" -f2`" +`cat $j|grep callerid|cut -d "<" -f2 |cut -d ">" -f1`_%m%d%Y_%H%M%S.wav) ;done

might get you close if run appropriately.

Hi, I know this is an old topic but I hope you can help @dicko

Is there a way to use your script at the end of this sendmail command so the email attachment will be the new filename that your script above makes?

What ‘sendmail command’ ?

I’m sorry its the Mail Command (mailcmd) from Settings → Voicemail Admin → Setting → Email Config.

If your script can some how be combined with this script so the email attachment will follow your format while the files in the voicemail system path are left untouched

Hmm, I can’t really guess what you are attempting, but any ‘attached file’ is actually a statically mime encoded binary blob of the vmail message.

Intrinsically, comedian mail’s files are all in a constant state of flux, what I posted was a method to statically created ‘hard links’ to the ephemerally named vmail files identified by their metadata in the associated .txt file,

If you cared to, you could arrange for such hard links to be created on each ‘CLOSE_WRITE’ of any msg0000.{wav,WAV,gsm} much as monitor files are, as such their permanence would outlast Comedian Mail’s ‘delete/move to read/purge’ methods

Arranging for them to be available over any network based access method is another (and non trivial) project though, but as such you could contrive to so identify the ‘cast in stone’ permanent file name in the vmail header and or body

Thanks for replying so quickly. I will rephrase the request and end goal.

I would like to use the voicemail transcription script along with renaming the filename. So each extension will receive an email with their voicemail transcribed and the attachment in the email will be CIDNumber_Date_Time.mp3 or .wav instead of msg000.

I was hoping I could combine what you wrote with the transcription script so the emails will have attachments of the new filename strcuture.

Well of course you can, and that would best be done in whatever ‘voicemail transcription’ script you are using.
As I intimated look at the contents of the’ instantaneous’ msg0000.txt file for inspiration :slight_smile:

I dont know how to incorporate your sample code from this thread into this script gist.github(dot)com/lgaetz/2cd9c54fb1714e0d509f5f8215b3f5e6

Is it something you could help with even for a charge? Or point me into the right direction of what to modify in that script and what the command should be?

1 Like

As a shell script, you could perhaps extract the path to write to by using the ‘origtime’ in the *.txt file , where that ‘1620159478’ then

date   -d @1620159478 +'/your/publish/directory/%Y/%M/%d/%H

would render /your/publish/directory/2021/17/04/13 using your locale’s TZ, add -u to get UTC

Sorry, I am not excited to comment , least edit, someone else’s 5 year old script, and as these STT engines change on a regular basis, keeping up with them would be a chore and an expense above and beyond what you likely budget for.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.