A while back I wrote an article for asteriskvoipnews.com about routing loops occurring from misconfigured DNS(or lack there of). My article was about routing loops caused by Asterisk attempting to send mail outside the network when the mail server destination is internal. To correct this issue the Asterisk PBX needs to define a ‘mail relay'(mail relay) on the internal network. This post will discuss using Postfix as an alternative to Sendmail for this purpose.
The goals of this post:
– explain Asterisk voicemail to email routing loops
– LAB: Install Postfix and configure ‘smarthost’ for mail relay
Here is an excerpt from my previous post that explains the nature of the problem:
“One of the most popular features in Asterisk is the Voice Mail to email feature. It’s fairly straight forward to set up as far as Asterisk is concerned, but many people (including myself) have run into a situation where the Asterisk server is on the same internal network as the mail server. When Asterisk resolves email@example.com , it attempts to send the mail to the Fully Qualified Domain Name (FQDN).
In the example above this might be something like 216.39.144.X. This works great if you have hosted email outside your network, or you have internal DNS to send the mail originating inside the network to the correct host. However many small to medium size businesses either don’t have internal DNS or don’t know how to set it up correctly.
The result is that the VM attachment is being sent outside the network and can’t get back because of a routing loop. This discussion isn’t about routing loops, just trust me that sending out packets out of your network when the destination is on the inside causes problems.“
Since I wrote that help article I have found Postfix to be a much better way to specify an internal mail server. Postfix is simple and easy to configure. Troubleshooting and recompiling the sendmail database is annoying and difficult task for newbies. Postfix requires one edit to, ‘/etc/postfix/’ and a reload. Eats routing loop’s for breakfast!
LAB: Install Postfix and configure ‘smarthost’ for mail relay
Lets start off by removing our old mail transport agent, sendmail.
Now install postfix.
Make sure Postfix starts at boot with the chkconfig command.
Find the ‘relayhost’ section below. Uncomment the line and add the internal IP address of your mail server. This will prevent Asterisk from sending the voicemail attachments to the public IP. Routing loop circumvented.
[root@fc-test1 ~]# nano /etc/postfix/main.cf
Now start postfix.
In conclusion I’d like to point out that Postfix is easy to install and easy to use. One note, if you need to leave sendmail installed to satisfy other dependencies that’s okay. Just make sure to turn it off at boot.