Voicemail storage on USB drive

Anyone know how to change where voicemail files are stored? Simple thing here. RasPBX running FreePBX 13.0.150 on top of Asterisk 11 on a new Pi3. I have a USB drive plugged into a port and I simply want to mount it and send voicemail storage over to it. I’ve done it on my Pi2, using a bind mount or something like that. For some reason, my brain vapor-locks when I try it these days. Now I know you guys will say to just look at what I did on my Pi2, but that was a bunch of rebuilds ago. So if anyone has a quick soup-to-nuts method, I’d be eternally grateful.

In your advanced settings there is a place to change your “asterisk spool directory” (maybe you need to turn on display and override at the top of that page)

Doesn’t show up even if I override readonly settings

It does on all mine, sorry, but it actually refers to what is in /etc/asterisk/asterisk.conf which is set in mysql in the table freepbx_settings where the keyword is ASTSPOOLDIR.

Wonder if I could change it there in asterisk.conf and have it work?

You should probably let FreePBX or mysql do that or a reload might override your work.

Y’know…I changed the view and override settings, but I didn’t see a submit button pop up, so I figured it wasn’t needed. Interesting. So I scrolled down a bit and the button pops up. Click it, Apply it. Voila! the settings are visible!

So when I change the directory in the advanced settings, I get an error. Clearly there are more things dependent on that spool directory than I thought.

exit: 1
Whoops\Exception\ErrorException: mkdir(): Permission denied in file /var/www/html/admin/modules/ivr/Ivr.class.php on line 15
Stack trace:

  1. Whoops\Exception\ErrorException->() /var/www/html/admin/modules/ivr/Ivr.class.php:15
  2. Whoops\Run->handleError() :0
  3. mkdir() /var/www/html/admin/modules/ivr/Ivr.class.php:15
  4. FreePBX\modules\Ivr->__construct() /var/www/html/admin/libraries/BMO/Self_Helper.class.php:125
  5. FreePBX\Self_Helper->autoLoad() /var/www/html/admin/libraries/BMO/Self_Helper.class.php:37
  6. FreePBX\Self_Helper->__get() /var/www/html/admin/libraries/BMO/Hooks.class.php:279
  7. FreePBX\Hooks->preloadBMOModules() /var/www/html/admin/libraries/BMO/Hooks.class.php:39
  8. FreePBX\Hooks->updateBMOHooks() /var/lib/asterisk/bin/retrieve_conf:63

Look like it was a permissions thing

Wrong again. Something bad in the directory structure that I built on the USB. Going back to defaults untill I figure this out

The directory used must be rw for the asterisk user.

I set it as 777 all the way down

An update. This machine is driving me nuts. I’ve set up the USB drive as a bind mount to /var/spool/asterisk. When I try to enable voicemail on any given extension I get a symlink error. Ok, so I undo the bind mount and all that, and I see in /var/spool/aasterisk/voicemail/device that the device (each extension has one) directories appear to be symbolic links. So I guess we can’t do a bind mount where a symbolic link is involved? We should, becasue I had this working on my Pi2, which has the very same layout.

Does your chosen filesystem support symlinks?

Debian. If it has symlinks in there, I suppose it supports them.

Don’t suppose it will hurt you :slight_smile: you need to know.

Debian is not a filesystem it is an OS, ext2/3/4/vfat (and many others) are, stick with ext2 for Raspberry’s using USB sticks , vfat and windoze based ones will likely not work for you.

Right you are. Sometimes hard to think with one side of my head flattened on one side. I’m trying one more thing, then off to bed. But to answer your question, I’m using ext4. Wait…ext2 is what I will use.

Still a permissions thing. FreePBX was unable to make the directory “tmp” in the spool lib. Really depends on whatever user is your web user.

I think I got it! I saw the symlink pointing to a non-existent directory, /var/spool/asterisk/voicemail/default, and that was throwing me off The default directory doesn’t exist until a voicemail is left, then it’s there, along with relevant directories underneath the extension number. So I did the bind mount to the default directory once it was in place, and all is well. The usb drive is mounted to /media/usb. The bind mount is /media/usb/voicemail mounted to /var/spool/asterisk/voicemail/default. Only one thing I see is all the directories down to the extension number on the usb drive are all root:root, but the files are asterisk:asterisk. I wonder if that will give me any issues down the line as new extensions are created? And on that note, lights out for me.