Voicemail Server

From Webmin Documentation
Jump to: navigation, search

If your system has a modem with voice capabilities attached, this page explains how to set up it up as an answering machine using the vgetty program.

The Voicemail Server module

If you have a modem attached to your Linux system that supports voice recording and playback, this module can be used to turn your computer into a powerful answering machine. Not all modems support voice, so check your user manual to make sure that yours does before trying to use this module. Some modems that require special drivers (often called Winmodems) are not generally usable on Linux at all, and so cannot be used with this module. However, almost all modern external modems that attach to a serial port will work fine. Some internal modems that emulate a serial port can be used as well.

A Linux system running as an answering machine is far more flexible than a traditional machine. The number of messages that you can store is limited only by hard disk space, messages can be viewed and listened to from any host on the network, and actions can be taken when a message is received (such as emailing it to some address). Like any answering machine, your system can be configured to answer the phone after a certain number of rings so that you have a chance to pick up the phone before it kicks in.

The underlying software that makes all this possible is called vgetty, which is a modified version of the mgetty modem control program covered in PPP Dialin Server. Not all Linux distributions include it, but it can be downloaded from http://rpmfind.net/ or the developer's website at http://alpha.greenie.net/mgetty/. Webmin adds entries to the /etc/inittab file so that vgetty will be started at boot time and listen on the appropriate serial ports. This is exactly the same was the method used to set up mgetty as explained in chapter PPP Dialin Server.

The Voicemail Server module can be found in Webmin under the Hardware category, and when you enter it the main page simply displays four icons. If the module detects that vgetty is not installed, the main page will display an error message instead telling you that you need to install it before the module can be used. All of the actual configuration forms and pages can be reached by clicking on the appropriate icons.

Configuring your system as an answering machine

Assuming you have a modem attached to a serial port on your system and plugged into a phone line, and that it supports voice recording nd playback, the steps to set your system up as an answering machine are :

  1. On the main page of the Voicemail Server module, click on the Serial Port Configuration icon. This will take you to a page listing any existing ports that have been configured for PPP or voicemail.
  2. Click on the Add a new serial port link, which will bring up the port configuration form shown in the first screenshot below.
  3. Set the Serial device to the port on which your modem or null-modem cable is connected. Serial port 1 corresponds to the device file /dev/ttyS0, and so on. For modems on serial devices not starting with /dev/ttyS (such as USB modems), select the Other device option and enter the full device file path into the text field next to the menu.
  4. If the Rings before answering field is visible, you can de-select Global default and enter the number of rings that your system will wait for before answering a call. This applies only to the modem on this serial port though. If the field is not visible or you want to use the same setting on all modems, you can set the number of rings in step 6 instead.
  5. If the Answer mode field is visible, just leave it set to Global default.
  6. Click the Create button at the bottom of the page to return to the list of serial ports.
  7. Return to the module's main page and click on the *Voicemail Server Options* icon. This will take you to the form shown in the second screenshot.
  8. Enter the number of rings that the server should wait for before picking up a call into the *Rings before answering *field, unless it has already been set in step 2. If you have multiple modems and want to set a different number of rings for each of them, check the Can be set for each serial port box.
  9. In the Answer mode field, make sure that at least one of the menus is set to Voice. If this phone line is only going to be used for answering voice calls, you should set the first menu to Voice and leave the other two blank.
  10. To limit the length of a message than can be left on your system, change the Maximum message length field. Entering too high a number could cause all of your disk space to be consumed by an extremely long messages.
  11. To stop very short messages being saved, change the *Minimum message length* field. If a caller hangs up before the time specified in this field is elapsed, the recorded message will not be saved to a file.
  12. The Silence threshold level field determines the percentage volume level that below which vgetty treats recorded audio as silence. If the Remove silence from end of messages? field is set to Yes, any audio at the end of a message that falls belong the threshold will be truncated.
  13. To set the volume levels for recorded messages and for greeting messages played by the modem, set the Recording volume level and Playback volume level fields respectively. Both can be set to either Default, or to a volume percentage. Not all modems support playback and recording volume configuration though.
  14. To have newly recorded messages emailed to you, change the After recording message field to Email in WAV format to and enter your address into the field next to it. Or select Run command on message file and enter the path to a program into its field. Whenever a message is recorded, the program will be run with the message file in RMD format as its first command-line argument.
  15. Click the Save button to record your new configuration settings and return to the module's main page.
  16. Click the Apply Configuration button to tell vgetty and init to use the new configuration. You can now try calling your phone number to test if the call is answered and a message recorded. Because no greeting message has been set yet, you will only hear a beep when the system is ready to record.

The serial port configuration form

The voicemail server options form

There are several things that can go wrong that cannot be detected until vgetty tries to communicate with your modem and answer a call. Fortunately, detailed logs are written to the file /var/log/vgetty._ttyname_ so that you can see what is going wrong. If your modem is on the first serial port, the log file will be /var/log/vgetty.ttyS0. Login as root and use the tail -f command on it to monitor it when a call comes in, so that you can see what is happening.

If your modem does not support voice playback and recording, an appropriate error message will be written to the log as soon as the Apply Configuration button is clicked. If this happens, there is nothing you can do apart from buying a new modem. Another common problem is a failure playing the greeting message, due to the same rate or compression format not being supported by your modem. See the Setting a greeting message section for details on how to resolve this.

Listening to recorded messages

Every time a message is received, it is written to a file in the /var/spool/voice/incoming directory in RMD format. Fortunately, these files can be easily converted to more useful formats like WAV using commands like rmdtopvf and pvftowav which come with vgetty. Webmin does this for you automatically when you use it to listen to a message.

To view and manage recorded messages, the steps to follow are:

  1. On the module's main page, click on the Received Messages icon. This will take you to a page listing all available recorded messages, their sizes and audio formats. The most recently recorded message is shown at the top of the table.
  2. To listen to a message, just click on the date and time under the Received at column. Webmin will convert it to WAV format, and if your browser has been configured to play audio files in this format you should hear it immediately.
  3. To delete messages, check the box to the left of each message in the table and click the Delete selected messages button.

Even if a message has been emailed to some address or had a program run on it when received, it will still be displayed on this page.

Setting a greeting message

When your system answers the phone, it can play a greeting message so that callers know who they have reached. After the message, vgetty will play a short beep as well so that the caller knows when to start talking. However, by default there is no greeting message, so callers will just hear a beep. Because this is not very friendly, you can use Webmin to set up one or more messages to be played when the call is answered. If multiple messages are set up, vgetty will choose one of them at random for each call.

To add a greeting message, the steps to follow are :

  1. On the module's main page, click on the Greeting Messages icon. This will take you to a page listing all existing messages, if any.
  2. Record a message in WAV format using some other program. Make sure that the sample rate is the same as the rate used by recorded messages shown on the Received Messages page. If it is not, your modem will probably not be able to play it.
  3. Back in Webmin, select the WAV file using the Upload message field. From the menu next to it, select the same audio format and number of bits as is used by recorded messages. Once again, the chosen format must be correct for your modem to be able to play the message.
  4. Click the Upload message button to have the file converted to RMD format and added to the greeting messages list.

Existing greeting messages can be listened to by clicking on their filename from the list, which will cause Webmin to convert the chosen audio file back to WAV format before sending it to your browser. If you don't want to use some of the greeting messages any more, just select the checkbox next to them and click the *Delete selected messages* button below the list.

There is another way to create a greeting message that avoids any format or sample rate problems and does not require a sound card or microphone to be attached to your computer. An existing recorded message can be converted to a greeting by following these steps :

  1. Call your own answering machine and leave the greeting message as a recording.
  2. On the module's main page, click on the Received Messages icon and find the new recording on the list.
  3. Select the checkbox next to it and click the *Convert selected to greetings* button. This will remove the message from the list, and add it to the list on the Greeting Messages page.

The only problem with converting messages like this is that they may be of poor audio quality or have silence or telephone sounds at the start and end.