AnsweredAssumed Answered

HylaFax , Alfresco Integeration , with stamping  date & time

Question asked by bisana on May 29, 2012
Latest reply on May 30, 2012 by bisana
Document Management integration with Fax

Objective:-
After  FAX is received by the FAX server, it needs to be stamped with date and copied it to the DM
Once copied it to the DM, a notification is to be send to the user

Software used:- Hylafax and Alfresco 4.0.d

How to do :-
I have done the Hylafax setup in a CentOS 6.2. The installation for Hylafax server was straight simple, except the entry for "faxgetty"
In previous release of CentOS we normally added the faxgetty in /etc/inittab
In centOS 6.2 , we need to create a file in "/etc/init/" . I created a file known as "faxgetty.conf" over there
cat /etc/init/faxgetty.conf
start on runlevel [2345]
stop on runlevel [S016]
respawn
exec /usr/sbin/faxgetty ttyS1

Now the fax are received in a folder "/var/spool/hylafax/recvq/"
I have to read the new faxes every 5 minutes, If new fax comes I need to stamp the fax with the date and copy it to the DM

Alfresco setup
CIFS setup
For port redirecting, I created file "alfresco_cifs.sh" and run it , and then save the iptables setting using "iptables-save"
The content of "alfresco_cifs.sh" is given below
echo 1 > /proc/sys/net/ipv4/ip_forward
modprobe iptable_nat
iptables -F
iptables -t nat -F
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
iptables -t nat -A PREROUTING -p tcp –dport 445 -j REDIRECT –to-ports 1445
iptables -t nat -A PREROUTING -p tcp –dport 139 -j REDIRECT –to-ports 1139
iptables -t nat -A PREROUTING -p udp –dport 137 -j REDIRECT –to-ports 1137
iptables -t nat -A PREROUTING -p udp –dport 138 -j REDIRECT –to-ports 1138

Then I needed to add the below configuration in  "/tomcat/shared/classes/alfresco-global.properties"

cifs.enabled=true
cifs.Server.Name=fax_a
cifs.domain=MYDOMAIN
cifs.hostanounce=true
cifs.broadcast=0.0.0.0
cifs.tcpipSMB.port=1445
cifs.ipv6.enabled=false
cifs.netBIOSSMB.namePort=1137
cifs.netBIOSSMB.datagramPort=1138
cifs.netBIOSSMB.sessionPort=1139
audit.enabled=true
audit.dod5015.enabled=true

Now again back to the Faxserver, we need to do steps for
(a) Mounting the Alfresco Share
(b) call a script using crontab to execute every 5 minutes,[ which will stamp the fax and copy to the DM)

Mounting the Alfresco Share in Hylfax server
make a directory to mount the Alfresco share
mkdir /mnt/faxdm
edit the "/etc/fstab" add simillar content
//Give-IP-DM/Alfresco/yoursite/documentLibrary/faxin   /mnt/faxdm   cifs   rw,suid,credentials=/etc/faxpass,domain=MYDOMAIN

give mount -a
if success you should be seeing  DM contents using ls /mnt/faxdm

Now for copying the file, create a script named "FaxstampScript.sh"  with the following contents

#!/bin/bash
touch /root/myoutput
# search all the files which has been created since the last 5 minute
find /var/spool/hylafax/recvq  -mmin -5 -type f -name "*.tif"  > /root/myoutput

for i in `cat /root/myoutput`
do
cp -f $i /mnt/faxdm
cd /mnt/faxdm
# Stamping The copied FAX with present time
convert $i -pointsize 60 -draw "gravity south  fill yellow  text 8,26 '`date`' fill blue  text 12,20 '`date`' "  $i

done
rm /root/myoutput
To call this file, every 5 minutes make a crontab entry, similar to
*/5 * * * *   /root/scripts/FaxStampScript.sh


At this stage we have a system now ready in which Fax is received by Hylafax, after each 5 minutes, the spool directory is checked for new faxes and the new fax is stamped and copied to the DM

For the notification, set rules on the folder "faxin"

Hope this post will be helpful to new comers like me
Thanks
Joseph John
Will be happy to personally help and guide  free of cost to users in UAE

Outcomes