Despite Faxes slowly going the way of the Dodo, there are still some circumstances that require a fax machine.
We need to collect meter reading son a monthly basis form many of our customers.
Although we have tried to move all of our customers to email or automated recovery systems, there remain a few hundred that we still have to fax once a month.
For this, we use a Crystal report with an embedded fax number, using a special font, which the fax printer driver recognises.
However the software that we use for this is antediluvian, and we were running a Win2K VM to support it.
Now that we are moving to windows 2008 and a new domain structure, this will no longer be viable.
There are several windows solutions that could replace this, but we decided to try Hylafax, running on our backup server, which is idle much of the day.
The server is running Ubuntu server 10.04, and the process was quite simple, even though there were a few bumps on the road.
1. Install Hylafax.
sudo apt-get install hylafax-server
which asks various questions (area codes, etc), and then runs
which tests and sets up the modem device, in our case on ttys0.
sudo /etc/init.d/hylafax restart, and everything should be up and running.
The /var/spool/hylafax/etc/hosts.hfaxd file needs to be edited it manually, I found a default one on the web. The format is:
client:uid:passwd:adminwd (passwords should be encrypted)
# Hylafax Faxing Users
# Hylafax Faxing Hosts
On testing it with a hylafax client, I got blank faxes
a swift Google later,I added the line
So now I could send faxes.
I was using Winprint Hylafax reloaded, but I could only send individual faxes or batches of identical ones.
Our customer faxes contain the customer’s name, account number, machines on site and a space next to each machine for the meter readings, so I needed a way of splitting the job into single pages, and extracting the fax number for each one.
Next step was to look for a simple way to do this.
I found a script called salsafax (an earlier version is called sambafax), by Mark Bennett, which is a perl script to allow Samba printing to Hylafax.
I installed CUPS, perl and psutils
sudo apt-get install perl
sudo apt-get install cups
sudo apt-get install psutils
I also needed the perl modules
perl module Getopt-Long-2.32
perl module Mail-Sendmail-0.78
I copied salsafax to the /usr/lib/cups/backend directory, and changed the permissions
sudo chmod 755 salsafax.pl
I added the line:
to /etc/cups/cupsd.conf near the top of the file.
(it is recommended to remove this after creating the printer configuration, as it is a security risk).
Then I created a printer
sudo lpadmin -p SalsaFax -E -v salsafax.pl:
and restarted cups.
now I could print a file to hylafax, but it was still a single fax
I then installed another perl script called pipe by Jiri Srain of Suse ( I tried a later, bash script by Johannes Meixner, but it failed for some reason that I could not fathom) this pipes print input to a command.
I added it to the cups/backend directory, and
chmod 755 pipe
I then wrote a script, I called pssplitter, which uses psselect to split the print file into pages, then prints them to Salsafax, which in turn sends them via Hylafax.
and added another printer
sudo lpadmin -p Piper -E -v pipe:/usr/lib/cups/backend/pssplitter.sh
After a few false starts, pssplitter worked fine, except it seemed the maximum number of jobs it could send was 50.
This was cured by editing the /etc/cups/cupsd.conf file line
MaxJobs 50 to read
I now print the Crystal report to a postscript printer on the local PC, and it is split into single pages and then faxed.
In a complex page, Salsafax can fail to detect the fax number (formatted as Fax-Nr. : ), so it is a good idea to place the fax number at the top of the page. If you don’t want it to be visible on the fax, set the font colour to white, it will still be detected.
psselect may not be the best solution, as it has to parse the file repeatedly, but it works.
We use Webmin a lot, so I installed the Hylafax server Webmin Module to monitor the queues.
the perl modules were installed from the webmin
Final Hiccup, Hylafax has a “Killtime” of 3 hours.
corrected this by adding
KillTime: “now + 7 days” to /etc/hyla.conf
Many thanks to those in the forums that I extracted the relevant information from.