AsterFax the Email to Fax Gateway for Asterisk.
---------------   We have moved -----------------


AsterFax and Asterisk IT have both been renamed.

Asterfax is now known as Noojee Fax

Asterisk IT is now known as Noojee Telephony Solutions.

Noojee Fax documentation and support can now be obtained via:
http://www.noojee.com.au/Page/NoojeeFax
https://wiki.noojee.com.au/Noojee_Fax
http://forums.noojee.com.au

---------------   We have moved -----------------


Asterisk IT is the primary developer and sponsor of AsterFax the Open Source Email to Fax Gateway for Asterisk.
Asterisk I.T. offer a range of support options for AsterFax as well as general Asterisk consulting services.  Contact sales@asteriskit.com.au for more information.
You can also receive support from the Asterfax and Asterisk communities by by posting at the relevant forum.
Asterisk
trixbox

AsterFax - Asterisk Fax

SourceForge.net Logo

Configuring AsterFax to work with Sendmail

The following principles (but not the detail) can be applied to any mail server not just sendmail.

Overview
The ideal AsterFax configuration is to have you existing mail server accept mail on behalf of AsterFax. The primary benefit of this is that your users don't have to reconfigure their mail client in order to send a fax.

Sendmail with procmail

Thanks to Robert Moskowitz for his contribution on using procmail with sendmail:

Scenario:

One IP, two host names:

sip.domain
fax.domain

sip is in DNS as an A RR and fax as a CNAME.

Note: this setup might not be right for sip.domain to recieve mail. But right now, it seems to only need to send it.

Sendmail:
/etc/mail/mailertable
fax.domain procmail:/etc/procmailrc

/etc/mail/access
fax.domain RELAY

Spamassasin:
/etc/spamassassin/local.cf
required_hits 5
report_safe 0

Procmail contribution (spam to maildir format):
:0fw
| /usr/bin/spamassassin
:0
* ^X-Spam-Status: Yes
/var/spool/asterfax/spam/

Use /dev/nul to throw spam out

Procmail (fax to maildir format):
:0
* ^(To|Cc|Bcc).*@fax.htt-consult.com
/var/spool/asterfax/inbox/

Note that since the maildir format is used here, the emails are actually in

/var/spool/asterfax/inbox/new

I will be refining my procmail.


Postfix

Thanks to Levente Farkas for his contribution on configuring postfix:

1. create a CNAME in your dns to the asterisk servers as:
------------------------------------
faxserver CNAME asterisk
------------------------------------

2. in /etc/postfix/main.cf:
------------------------------------
mydestination = $myhostname, localhost.$mydomain, localhost, faxserver.bppiac.hu
virtual_maps = hash:$config_directory/virtual
------------------------------------

3. in /etc/postfix/virtual add this line:
------------------------------------
@faxserver.yourdomain.com faxserver
------------------------------------

4. in /etc/aliases add this line:
------------------------------------
faxserver: /var/spool/asterfax/inbox/
------------------------------------

5. in /usr/lib/asterfax/config/AsterFax.xml modify this line:
------------------------------------
External ... /var/spool/asterfax/inbox/new ------------------------------------ Now send mail to @faxserver.yourdomain.com and AsterFax should process it.

Exim4

Thanks to Woolitel for his contribution on Exim4 configuration for AsterFax.
HowTo configure exim4 under Debian to store faxes in the file /var/spool/asterfax/inbox/new:

First step to configure exim4 :

dpkg-reconfigure exim-4
Split configuration into small files? => Yes
General type of mail configuration: => internet site; mail is sent and received directly using SMTP
System mail name: => pbx.loc
IP-addresses to listen on for incoming SMTP connections: =>
Other destinations for which mail is accepted: => fax.loc
Domains to relay mail for: =>
Machines to relay mail for: => 192.168.0.0/24 ( your local subnet )
Keep number of DNS-queries minimal (Dial-on-Demand)? => No


Create file :
/etc/exim4/conf.d/transport/30_exim4-config_fax_spool
With :
######################
fax_spool:
debug_print = "T: appendfile to fax spool"
driver = appendfile
file = /var/spool/asterfax/inbox/new
delivery_date_add
envelope_to_add
return_path_add
user = mail
mode = 0770
######################

Create file :
/etc/exim4/conf.d/router/115_exim4-config_fax_loc

######################
fax_router:
debug_print = "R: Fax spool"
driver = accept
domains = fax.loc
transport = fax_spool
######################

Restart exim4 :
/etc/init.d/exim4 restart


So the basic principle is to configure your mail server to relay mail to AsterFax. The key word here is 'relay'. Due to SPAM issues most mail servers (make that all of them) are configured not to relay mail.

This technique effectively makes AsterFax a zero install and zero configuration at the client.

How you configure your mail server all depends on how you want users to enter the 'To' address when sending a fax.
The standard recommendation is to use the domain 'fax.local', however you could also use a domain such as 'fax.yourdomain.com'.

Just replace fax.local in the following examples with your chosen domain name.

Assuming you are using sendmail all you need to do to relay the whole fax.local domain  in sendmail is to use
the "mailertable". The standard /etc/mail/sendmail.mc on most distributions (including Centos) will include this.

The file to add entrees is : /etc/mail/mailertable.

The format of an entry is:
<domain> <transport> : [ <target fqdn or ip that this domains email has to be sent to> ]

So for the domain fax.local the required entry is:

fax.local smtp:[fax.local]

The thing to note here is the square brackets around the target host.
These mean that the MTA will ignore MX records. If the target is an IP address, no entry in Dns is required if the square brackets are in place.

If you use a host name as above you will need to create either a DNS or a host entry so that (for the above example) fax.local can be resolved to an ip address.
The simplest method is to create an entry in the /etc/host file. Note: this needs to be done on the sendmail server.
Create an entry similar to the following where the IP address is the IP address of the server AsterFax is running on.
192.168.0.5    fax.local

Running Sendmail and AsterFax on the same machine

If AsterFax and sendmail are running on the same server you need to do some extra work. As both sendmail and AsterFax listen on port 25 they will get in each others way unless you make some adjustments.
The simplest way of resolving the problem is to add a second IP address to you asterisk server and have AsterFax listen on that address.

[I'm assuming here that you have previously reconfigured sendmail so that it isn't listening only on localhost].

You need to edit the AsterFax configuration file /usr/lib/asterfax/config/AsterFax.xml.
Find the nested element <InBound><SMTP><Host> and modify the host to be the selected IP address.

Start by confirming your existing IP address by typing:
ifconfig

As an example lets say that your current IP address is 192.168.0.4.

To add a second address to your network card you need to know an available network address and its subnet mask (consult your network administrator). Assuming the address 192.168.0.5 is available and its netmask is 255.255.255.0 and the interface name is eth0, then create a new ifcfg file which will create a virtual interface with a second IP address.

If you have a gui installed then run netconfig and its pretty straight forward otherwise you can do the following:
http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/custom-guide/s1-network-aliases.html
The following instructions apply to Centos 4.2 (asterisk@home)
I found this article useful:
http://www.xenocafe.com/tutorials/linux/redhat/bind_multiple_ip_addresses_to_single_nic/index.php

Create a new file (substitute eth0 for what ever device you wish to modify)
/etc/sysconfig/network-scripts/ifcfg-eth0:1

Add the following lines (again substitute eth0 for the appropriate device).
DEVICE=eth0:1
BOOTPROTO=static
IPADDR=192.168.0.5
NETMASK=255.255.255.0
ONBOOT=yes
Once down, reboot your system to make the changes take affect.

Once the system comes up check that you have two ip addresses by running:

ifconfig eth0
and
ifconfig eth0:1

You then need to configure sendmail to only listen on the 192.168.0.4 address rather than all addresses.
This can be accomplished by modifying your /etc/mail/sendmail.mf file.

Add the following line (check that a similar one doesn't already exist).

DAEMON_OPTIONS('Port=smtp,Addr=192.168.0.4,Name=MTA')dnl
Once you have added the required line you will need to recompile sendmail.mf as follows:

First install the sendmail-cf package (if you don't already have it) using:
yum install sendmail-cf

Now compile the modified sendmail.mc file:
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

Finally restart sendmail.
service sendmail stop
service sendmail start

You can now check what ip addresses sendmail is listening on by running:
netstat -na

you should see a line similar to :
tcp 0 0 192.168.0.4:25 0.0.0.0.* LISTEN

Restart Asterfax.

You can now send faxes using your standard email client without any modifications.

Note: AsterFax is not a secure SMTP gateway so please ensure that its MX record is not visible externally. Your external smtp server should also be configured to not accept faxes for the domain fax.local.


Home
Downloads
Support
Licensing
News
FAQ
RoadMap
AsterFax UserGuide
Configuring Email Clients
Supported File Formats
Installing AsterFax
Configuring AsterFax
Testing AsterFax
Trouble Shooting AsterFax
Running AsterFax
Configuring SendMail
Configuring GhostScript
Configuring OpenOffice
SpanDSP
Add your own File format
Web2Fax

AsterFax is Sponsored by Asterisk I.T.
©2006  Asterisk I.T. all rights reserved. Some parts of this site may be the copyright of other authors. If you want to copy parts of this page you may do so provided you have gained permission from Asterisk I.T. first. Email asterfax@asteriskit.com.au
AsterFax™ is a trade mark of Asterisk I.T..
I'm not a great believer in Trade Marking Open Source software but unfortunately someone has been running a scam to redirect traffic to a bogus AsterFax web site. As such I've trade marked AsterFax's name to provide protection from such people.