Fax2Send Shell API - Loglink
Loglink enables applications to react to Fax2Send events as they happen.
loglink is a script that can be run by Fax2Send every time an event occurs,
such as the completion of a request.
Fax2Send always waits for loglink to complete - so a loglink that doesn't exit will
hang the fax system!
To configure loglink do the following:
- In the [General] section of /etc/fax2send/config set Loglink=loglink
- Restart Fax2Send
- Create a file in /usr/lib/fax2send/bin called loglink that is
executable and owned by the user fax2.
The script will be executed every time the Fax2Send log file is updated.
An example script that prints out a copy of every successful fax might
look like:
#!/bin/sh
# Make sure that PATH contains the basics
PATH=/usr/bin:/usr/sbin:/sbin:$PATH export PATH
type=$1
if [ $type = "REQUEST" ]
then
id=$2
user=$3
phone=$4
time=$5
event=$6
pages=$8
if [ $event = "COMPLETED" ]
then
tiffread $UFXSPOOL/outbound/image/$id.tif -ohpIII-300 | lpr
fi
fi
When the script is called the following arguments are set depending on the
type of event:
- New Request Added to Queue:
REQUEST [id] [user] [phone] 0 ADDED
- Cancelled request:
REQUEST [id] [user] [phone] 0 CANCELLED [pr file]
- Retried Request:
REQUEST [id] [user] [phone] 0 BACK
- Request starting to format:
REQUEST [id] [user] [phone] 0 FORMATTING [time str] [time secs]
- Request starting to transmit
REQUEST [id] [user] [phone] 0 TRANSMITTING [time str] [time secs] [pages]
- Fax number engaged
REQUEST [id] [user] [phone] [time] ENGAGED [pr file] [pages sent]
- No dial tone on phone line
REQUEST [id] [user] [phone] [time] NO_DIAL_TONE [pr file] [pages sent]
- No answer on fax number
REQUEST [id] [user] [phone] [time] NO_ANSWER [pr file] [pages sent]
- Remote fax incompatible with fax modem
REQUEST [id] [user] [phone] [time] INCOMPATIBLE_FAX [pr file] [pages sent]
- Answerback mis-match
REQUEST [id] [user] [phone] [time] BAD_ABACK [pr file] [pages sent]
- Communication failure with remote fax machine
REQUEST [id] [user] [phone] [time] FAILED_TO_TRAIN [pr file] [pages sent]
- Transmission interrupted during page transmission
REQUEST [id] [user] [phone] [time] INTERRUPTED [pr file] [pages sent]
- 'Other' failure of request
REQUEST [id] [user] [phone] [time] FAILED [pr file] [pages sent]
- Request abandoned by Fax2Send
REQUEST [id] [user] [phone] [time] ABANDONED [pr file] [pages sent]
- Request completed successfully
REQUEST [id] [user] [phone] [time] COMPLETED [pr file] [pages sent] [csi]
- Fax modem interface started
FAXBOX [name] ATTACHED
- Fax modem interface stopped
FAXBOX [name] DETACHED
- Fax modem interface enabled
FAXBOX [name] ENABLED
- Fax modem interface disabled
FAXBOX [name] DISABLED
- Fax modem interface killed
FAXBOX [name] LOST
- Fax modem reset by system
FAXBOX [name] RESET
- Fax modem starting to receive message
FAXBOX [name] RECSTART
- Fax modem reception completed
FAXBOX [name] RECEND
- Fax2Send started
SYSTEM UP
- Fax2Send Stopped
SYSTEM DOWN