Howto: Receiving Faxes With efax
The following text describes how to setup the efax software and an additional shell script on Linux systems to receive faxes with a standard Class 2 modem connected to the serial port (RS-232). At Leisenfels we use this solution to access incoming faxes also while being out of office and because faxes are directly feeded into the support ticket system. In addition to this reception-only solution we use a classic fax device to send faxes in order to get a reliable protocol of outgoing messages. The classic fax device works as a failsafe device in this scenario, too.
|If you have a Linux system up and running already then it could be easily extended to receive and distribute fax pages by e-mail. In many cases it is not necessary to print the fax pages, so this solution helps saving natural resources. You could also recycle a modem e.g. buy a used one from eBay.|
This installation has been successfully tested with the following configurations, other modem hardware and (Linux) operating systems may also work. Just give it a try.
SuSE Linux SLES 10 (AMD64 64-bit)
Standard RS-232 COM port /dev/ttySx
|Class 2 Modem||
3Com U.S. Robotics 56K FAXMODEM
Notices: Serial extension cards for RS-232 like the EXSYS EX41098 normally work as long as regular /dev/ttySx devices are being created. Modem must support Class 2, Class 1 modems like Acer Modem 56 Surf will not work!
Please read the following steps to setup your Linux system:
- Step 1: Setup hardware and connection
- Step 2: Download and install efax
- Step 3: Configure the fax_xxxxxx shell skript
- Step 4: Start fax server via inittab
- Step 5: Testing
First of all please setup your hardware. Connect the fax modem to a free serial port of your Linux server as described in the manual shipped with the modem. Make sure that the modem is connected to the telephone line to receive incoming fax calls. Your external fax MSN must be routed to this telephone line.
The following list shows some useful commands to check your modem. Please read the man pages or documentation of the mentioned tools to setup your modem properly. Normally, none of these commands need to be executed in order to get the fax solution up and running as described by the next steps.
- setserial: Show port configuration
- stty: Configure RS-232 port
- minicom: Serial communication program
You may want to edit the file /opt/efax-0.9/Makefile to install the executables in /usr/local/bin instead of /usr/bin. Please adjust the following lines this way with your favorite editor (here emacs, save with CTRL+X/CTRL+S and exit with CTRL+X/CTRL+C). If you use another Linux distribution please adjust the paths accordingly to your system.
Then please type the following commands to compile and install the efax executables. If errors are being generated please consult the efax documentation. Often libraries are missing which can be installed easily by using the system's administration tool like YAST for SuSe Linux distributions.
The basic fax reception is done with efax, sending the fax pages attached to an e-mail must be done separately with an additional fax shell script. Please download the fax_xxxxxx script to the /usr/local/bin directory of your system. Rename the script according to the external fax number like fax_123456 using the mv command if you want to operate multiple fax numbers with separate modems. The scripts can be easily configured to send the fax pages to different e-mail addresses etc. Allow the shell script be executed with the chmod command.
Wherever you see the fax_xxxxxx script name in the next sections please replace by your renamed file name.
The following snippet shows the configuration section of the shell script with variable values that need to be adjusted for your server. Please make sure that all expected paths to executables like mimencode are correct (e.g. /usr/bin/mimencode), adjust paths otherwise. If executables are missing on your system, please check out the admin tool that comes with the Linux distribution like YAST for SuSE.
As you can see, only a few values require to be adjusted:
- MAILTO: Add the recipient e-mail address(es) as comma separated list
- SENDER: Set the sender e-mail address and optional name
- TARGET_MSN: Add your external fax MSN
- DEV: Specify your serial device
- FROM: Set your full station identifier transmitted to the fax senders
- ANSRINGS: Set the desired number of rings to take the call
Feel free to adjust the e-mail subject and English body text used by the script. Please consult your modem's manual if the AT commands used by the script do not work (INIT).
Basic configuration should be complete by now, let's start the fax server by adding a new entry at the end of the /etc/inittab file of your Linux system. Replace the "S0" value by the number of the /dev/ttySx device that you are using. For instance if you are using /dev/ttyS7 then set "S7" to the very beginning of the inittab line. The respawn field causes the fax script to be automatically restarted if a fax has been received or if the process has been interrupted.
Then reinitialize the runlevel services with the following command. The efax application should now be listed with the other processes of your system.
Now it's time to check if the fax functionality works as expected. Please make sure that your modem is attached to a line that is signaled when your fax number is being dialed.
Please dial your fax number (possible also from your phone or cell phone). The modem should take the call after the configured number of rings. You should hear the typical fax initiating sounds. If nothing happens then probably the call is not signaled to your modem. Please check your modem's manual if there is a way to see when a call has been detected (e.g. some flashing LED).
If this test has been successful then please send a fax from another fax device. The fax modem should then receive the fax completely (all pages) and the fax pages should be send as attachments to the configured e-mail account(s). The script stores the fax pages together with the reception log in the /var/spool/fax/incoming directory. This sort of archive can still be viewed of sending the fax pages via e-mail did not work e.g. due to a misconfigured e-mail server.
Depending on the e-mail client you use the TIFF image attachments may be visible directly. It may be necessary to install and configure an appropriate image viewer like The GIMP to view the fax pages attached to your e-mails. The following screenshot shows how such an e-mail is displayed by the Thunderbird e-mail client (click to enlarge).
|In the case of errors or unexpected behaviour please send us a bug report. For improvement suggestions or any other feedback please fill out our support request form. It is also possible to obtain premium support options for the Tech Zone products, please contact us for a quote.|
How to continue
- Howto: VFSLib - Apache Commons VFS Reloaded
- Tech Zone: Java System Properties (JavaInfo)
- Tech Zone: JAR File Extension (JarInfo)
- Supported Projects