# cd /opt
# tar -xvzf efax-0.9.tar.gz
# cd efax-0.9
Howto: Receiving Faxes With efax
|Written by Axel Schwolow|
|Tuesday, December 11 2012 14:24|
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.
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.
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:
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.
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:
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).
How to continue