Skip to content

Asterisk: enabling email

The basic configuration I described will work successfully; however, there are a number of features that you may want to enable. For example, accepting incoming faxes to email, and automatic sending of voicemail messages by email.

The problem is that the default hostname of an AAH server is asterisk1.local, and most mail servers will reject mail from unresolvable hostnames. Your first thought may be to change the hostname, which is perfectly acceptable if your PBX has a static IP on the internet; but for many situations this won’t be feasible.

The more flexible solution is to reconfigure sendmail, which would normally be considered a world class nightmare. However, just follow these instructions:

Log in to your AAH server; if you haven’t made changes, you will have to enter as root (I use ssh -l root ‘my-aah-hostname.local’). Then edit /etc/mail/sendmail.mc (I use vi, but nano is installed, which is a pico clone, and may be easier for some people to use than vi).

Near the bottom of the file are some lines with MASQUERADE in them, all of which start with ‘dnl’, which sendmail treats as a comment. Remove the dnl from the start (but not the end) of the two lines MASQUERADE_AS and FEATURE(masquerade_envelope), and change the name in the MASQUERADE_AS line to some domain that your mailserver will recognise, and preferably one that maps to the IP address that your mailserver will see.

Then, about halfway through the file, edit the line EXPOSED_USER to start with ‘dnl ‘. This comments out the line, so that mail from root, which means all your asterisk generated mail, will pass through the masquerading code we just enabled.

Now run these commands:

yum install sendmail-cf
make -C /etc/mail
/etc/init.d/sendmail restart

It will be a good idea to run a test, which I do by using ‘mail -v’. This shows the smtp connection dialogue as the mail is sent, which you should be able to see is a successfull delivery.

Postscript:

If you want to change the hostname for any reason, just edit the two files: /etc/hosts and /etc/systconfig/network.

Post a Comment

Your email is never published nor shared. Required fields are marked *