[Fixed] How to spin up disks at beginning of incoming call?

I’ve been running Asterisk for a few weeks now on my home office Linux server. In addition to Asterisk, the machine is a file server for the other computers, using an Areca RAID 5 controller. For a variety of reasons (noise, heat, cost, disk lifetime) I have the disks on this machine spin down when not in use. Unfortunately this leads to the following situation during an incoming call:

1 phone rings
2 maybe nobody picks up
3 server spins up all four disks, taking up to ten seconds
(during this stage the caller hears silence)
4 with the disks now spinning, the call goes to voicemail.

The delay is long enough that when you call, it sounds like something has gone wrong and you hang up before reaching voicemail.

I would like to have the disks begin to spin up immediately upon an incoming call, while the phone is ringing. This way, by the time the call is ready to go to voicemail, Asterisk can send it to voicemail without waiting for the disks to become ready. Does anyone have an idea how to do this?

Here is the relevant part of my extensions.conf:

exten => 617xxxxxxx,1,Answer()
exten => 617xxxxxxx,2,DIAL(zap/3,20,rt)
exten => 617xxxxxxx,3,VoiceMail(u999@default)
exten => 617xxxxxxx,103,VoiceMail(b999@default)

Thanks!

James

Yea you could create a big ram disk (got tons of ram) and hack up asterisk to load on the ram drive…
and you knbow that your are wrong about the power off to save disk life right.

It is like a light bulb, if you turn on the hall every time you down hall or leave it on for two three or four on and off as bruned more juice and leaving it on, but by on and off you took weeks off the life of the bulb.

it takes a lot more to spin up disk and when the disk is stopped it also must work the to reset the drive head arm.

unless the system is powering down for hours at a time then all you are doing is wasting power and short-ing the life of the drives…

A scsi box of asterisk is way over kill grab cheap epia setup quiet, and cheap to run (can run off 12V) no fans…

agreed, i think your best bet would be to have voicemail record to a ramdisk, and then dump it to disk storage when the voicemail is done recording. That way you only spin the disks if they are actually needed.

That said, you could do what you are asking with a System() command…

ie
exten => s,1,System(command-to-spin-up-disks)
exten => s,2,Answer()
etc etc

If the command to spin the disks takes a few seconds, have a shell script run which calls it and then exits, leaving it to take its own sweet time to spin while the caller hears the IVR.

Another option- add a flash memory drive (usb stick or CF card) to your system and use that as the temporary voicemail storage… slightly safer as it won’t lose data if the power fails between leaving the voice mail and recording it…

Thanks for the reply. Potentially I could use the ram disk just for the files Asterisk needs to access to run voicemail (probably just the sound samples, I’m guessing). Worth a try…

Regarding the disks they stay idle for like 8 hours at a time, basically all the time except when the VOIP line gets a call or when we are editing image files on a group of macs. (The Linux server serves the images.) Idling them down cuts the average power consumption of the box from 110 watts to 65 watts. Power consumption at spin-up peaks at 130 watts.

I totally agree that an EPIA setup is better for a small standalone Asterisk install, but I’d like to solve this without spending additional money or having an additional machine to maintain. Thanks again for the ramdisk suggestion.

I wound up doing a variant of the two suggestions given:

I wrote a small C program that forks, opens a temp file, and writes some data, flushes the file and then deletes it. I statically linked this executable. When asterisk starts up this program gets copied to a ramdisk, where it is executed at the beginning of an incoming call. The ramdisk and static linking are there to prevent the System call from blocking. It works great! Here is the code for anyone who is interested:

#include <stdio.h>
#include <unistd.h>

int main(int argc, char **argv) {

if (fork()) {
return 0;
} else {
FILE * t = tmpfile();
int fd = fileno(t);
write(fd, “foo”, 3);
fsync(fd);
close(fd);
return 0;
}
}

OK and you shared with rest of us, very COOL…

Glad you got it the way you like…
server sleeping for 8 hours…man that is the life…I am lucky if the backup completes before the next backup starts