This article tells you how to set up your Linux box as an
answering machine. Please read it carefully and modify the lines where needed. Be careful when working as root, and take care to make backup copies of any file before editing it, so that you can restore it back to the previous state in case something doesn’t work.
You’ll need the following to get started:
-
A working phone line
-
A data-fax-voice modem–internal or external–working
in Linux, -
A microphone to record the greeting message, and
-
vgetty installed.
Installation
First, you’ll need to compile and install mgetty and vgetty. Here, we
detail the process for source tarballs, RPM-based Linux distributions, and
Deb-based distributions.
For source tarballs (tgz, tar.gz)
-
Download the tarball from http://alpha.greenie.net/mgetty/
-
For starters, it’s a good idea to read the file
"README.1st which comes along with the tarball. -
Change to the directory where you’ve extracted the
mgetty source tree, copy the policy.h-dist to policy.h, and edit the same
file to suit your needs. Usually, the defaults are fine. -
Do a "make" and if all goes well, you should
have mgetty in the same directory. -
Then cd to the "voice" directory and do a
"make". That should finish the compilation part of vgetty and
mgetty. -
Since you’re always concerned about crackers wanting
to overtake your system, you’ll first do a "make -n install"
to see all the evil things the installation procedure will do. -
If everything is okay, then do a "make
install" and you should have mgetty and vgetty compiled and installed
successfully.
For RPM-based distros (Red Hat, SuSE, Caldera, Mandrake, et al)
-
Check if you already have mgetty and mgetty-voice
packages installed, by giving the command "rpm -qa | grep mgetty".
If they’re installed, you can skip this section completely. -
The RPMs you need on Red Hat are mgetty-x.x.xx.rpm and
mgetty-voice-x.x.xx.rpm, where x.x.xx is the version number. The RPM you
need on SuSE is mgetty.rpm, and on Caldera it’s mgetty-x.x.xx.rpm. If you
don’t have mgetty or vgetty installed already, download the RPMs from one
of your favorite mirrors or from http://rufus.w3.org/linux/RPM/MByName.html -
Install the downloaded RPMs using the command "rpm -ivh
" For Deb-based distros (Debian, Corel Linux, et al)
-
If you use apt, you can do an "apt-get install
mgetty-voice" to install vgetty and dependent packages. Skip the next
two steps if you do this. -
Download the mgetty-x.x.xx.deb and
mgetty-voice-x.x.xx.deb from your favorite Debian mirrors or search for it
at www.debian.org/distrib/packages/ -
Do a "dpkg -i
" to install
the Deb packages.Configuration
voice.conf resides in either /etc/mgetty or /etc/mgetty+sendfax
directory. If you’ve installed vgetty from a tarball, the conf file may be
in /usr/local/lib or /usr/local/etc. In case you don’t find the voice.conf
file, then it must be there as voice.conf.dist file in the /usr/doc/mgetty-*
directory. Copy it to /etc/mgetty* or /usr/local/etc/ and start editing. -
Open voice.conf with your favorite editor (I use vi). You
need to edit four lines in the voice.conf file. -
Search for the line "voice_devices". This line
tells vgetty about the voice devices on your system. Change it to "voice_devices
your_modem_device".For example, my configuration has: voice_devices ttyS1 /*
My modem is on COM2 */ -
Search for the line "rings 5" or a similar
line. This line tells vgetty after what number of rings it should be
invoked. Change this line "rings no_of_rings". My configuration
has: rings 5 /* After 5 rings */ -
Search for the line "port ttyS0" or a similar
line. This line tells vgetty on which port to listen. Change this line to
"port your_modem_device" My configuration has: port ttyS1 /* My
modem is on COM2 */ -
Search for the line "voice_dir". This line
tells vgetty where it can find your voice mail and where to save your
incoming messages. Change this line to "voice_dir /var/spool/voice"That ends the configuration. You can experiment with
voice.conf after you have a working answering machine.Recording the greeting message
There are two ways to record a greeting message on your
answering machine -
Using vm:
Connect your microphone to the mic port of your modem,
and record your message with the command"vm record -m standard.rmd".
The file is stored as standard.rmd. This can be done
using an internal microphone or a local handset (type vm to see options).
Type vm to see the options. -
Using a pre-recorded voice file:
You just have to convert your sound file into a format
expected by your modem, using the pvf tools.For example, let’s convert a VOC file to Rockwell
(compression type 4) format."voctopvf file.voc | pvftormd Rockwell 4 > standard.rmd "
You can replace Rockwell in the above command by whatever
format you need. Type pvftormd -h for details.Preparing vgetty
-
Be sure to make the "voice_dir" directories
specified in your voice.conf file. For example, /var/spool/voice, /var/spool/voice/incoming
and /var/spool/voice/messages. Make sure you copy the file standard.rmd
created above to /var/spool/voice/messages -
To invoke vgetty every time your system is booted, add
the line "S1:345:respawn:/usr/local/sbin/vgetty ttyxx" to your
/etc/inittab file, where ttyxx is your modem device, and replace /usr/local/sbin/vgetty
with the proper path to vgetty, like /sbin/vgetty or /usr/sbin/vgetty. You
might be wondering what 345 is doing there. "345" tells init as to
which runlevels vgetty will be running in. Here, it means that vgetty will
be running in 3rd, 4th and the 5th runlevels. For more information check out
"man inittab". -
The vgetty logfiles are by default in /var/log/vgetty.ttyxx.log,
and the vm logfile is in /var/log/vm.log. Read these files if you have
problems–they’re quite readable and give you many hints as to where the
problem could be. If you want to see more details in the logfile, increase
the debug level in your voice.conf file to the highest possible value.Using vgetty
After making the necessary changes in /etc/inittab, you
can either reboot or run "init q" to start vgetty. vgetty is then
launched at init and will answer incoming calls. Incoming messages are
stored in receive_dir–that is, /var/spool/voice/incoming (see voice.conf).To play incoming messages, go to the incoming messages
dir /var/spool/voice/incomingThen, to use vm, play the message with "vm play -s
file_name.rmd" (type vm to see options), and you can hear the message
through the speaker of your modem.To use an audio card and sox, type
rmdtopvf file.rmd | pvfspeed -s 8000 | pvftobasic > /dev/audio
(See rmdtopvf -h and rmdtopvf -L for more).
Congratulations, you have a working Linux answering
machine now. Tweak your voice.conf file if you want to experiment with your
Linux answering machine, but remember to backup the voice.conf before you do
anything.Syed Khader Vali works at IBM global services, Bangalore