Solving Asterisk PBX Voice Mail to Email Name Resolution Issues

Note:  Matt Birkland (Network Engineer) is on a roll by sending in another Asterisk Help article about Email Name Resolution on internal networks.
 
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 intoo a situation where the Asterisk server is on the same internal network as the mail server.  When Asterisk resolves somebody@somecompany.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 orginating inside the network to the correct host.  However many small to medium size businesses eithe 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.  If you want more go get your CCNA.  Moving on...

Asterisk by default uses sendmail to send the VM attachments.  Sendmail will by default resolve from it's name server BEFORE it resolves from the /etc/hosts file.  Luckily, I have a solution that may just work for you.

The first step is to install the sendmail-cf package.  Without this package we cannot reconfigure sendmail.

Example:

[root@localhost ~]# yum install sendmail-cf

Altenativly you can use the add/remove software program in Fedora Core or whatever your distribution of choice is.

The second step is to edit /etc/mail/sendmail.mc and rebuild sendmail.  In the example below I'm using the nano text editor, but any will do.  Note:  I'm only showing the portion of we need to edit.  Before we make any changes lets back up the sendmail.mc file.  Type: 'cp sendmail.mc sendmail.mc.old'.  Great job, we're ready to go.  Follow the example below.

Example:

[root@localhost ~]# nano /etc/mail/sendmail.mc

sendmail.cf:
------------------------------------------------------------------------------------
dnl # Uncomment and edit the following line if your outgoing mail needs to
dnl # be sent out through an external mail server:
dnl #
dnl  # define(`SMART_HOST',`smtp.your.provider')
dnl #
-----------------------------------------------------------------------------------

Now change the SMART_HOST name to something arbitrary like 'mymailserver' and uncomment it.

Example:
---------------------------------------------------------------------------------------
dnl # Uncomment and edit the following line if your outgoing mail needs to
dnl # be sent out through an external mail server:
dnl #
define(`SMART_HOST',`mymailserver')
dnl #

------------------------------------------------------------------------------------------

Now we have to update these changes to sendmail and restart the server.

Example:

[root@localhost mail]# make -C /etc/mail

Followed by a restart of the service.

[root@localhost ~]# service sendmail reload
reloading sendmail:                                        [  OK  ]
reloading sm-client:                                       [  OK  ]
[root@localhost ~]#

Great, if you made it this far you are either a huge nerd or your job is on the line.  Either way we're almost done.  The last step is to make an entry in your /etc/hosts file.  
Example:

/etc/hosts
-------------------------------------------------------------------
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1       localhost.localdomain   localhost
192.168.1.18    mattserv.voiceipsolutions.com

#IP Address of mail server below

192.168.1.200         mymailserver
-------------------------------------------------------------------

Thats it!  Call and leave yourself a message.
 
Source: 
Matt Birkland
Network Engineer
Seattle Business PBX

TrackBack

TrackBack URL for this entry:
http://www.asteriskvoipnews.com/cgi-bin/mt/mt-t.cgi/91

« Vocalscape Releases Load Balancer for VoIP Networks | Main | Telrex Announces CallRex Release 3.5 »