Setup Asterisk to use SMTP with AUTH

If you don’t have your Asterisk sending your voicemails to your email because you don’t want to setup an SMTP service on you machine, you can use sendmail to transfer e-mail to another mail server.

If sendmail is not installed, install sendmail

yum install sendmail

yum install sendmail-cf

Change your current directory to the one where your sendmail configuration files are located

cd /etc/mail/

Create a subdirectory

mkdir auth

chmod 700 auth

Create a new file to hold your configuration information

vim auth/client-info

Add the following line to the file using your information

AuthInfo:your.isp.net “U:smtp.yourdomain.com” “I:user@yourdomain.com” “P:password”

Generate the authentication database and make both files readable only by root:

  1. cd auth
  2. makemap hash client-info < client-info
  3. chmod 600 client-info*
  4. cd ..

5. Add the following lines to your sendmail.mc file, filling in your ISP’s mail server:
Search for SMART_HOST put following line just below that.(Dont forget to change smtp.yourdomain.com to your domain name).

define(`SMART_HOST’,`smtp.yourdomain.com’)dnl
define(`confAUTH_MECHANISMS’, `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN’)dnl
FEATURE(`authinfo’,`hash /etc/mail/auth/client-info’)dnl

6. Generate sendmail.cf:

  1. m4 sendmail.mc > sendmail.cf

7. Restart the sendmail daemon, e.g., (this depends on your OS):

  1. /etc/init.d/sendmail restart

Configuration files

voicemail.conf

[general]
; Formats for writing Voicemail. Note that when using IMAP storage for
; voicemail, only the first format specified will be used.
;format=g723sf|wav49|wav
format = wav49|gsm|wav
serveremail = server@email.com
attach = yes
fromstring=The Asterisk PBX
sendvoicemail = yes ; Allow the user to compose and send a voicemail while inside
emailonly = no
emailsubject = You have a New Voicemail from ${VM_CALLERID}
emailbody = Dear ${VM_NAME} ,\n \t\t\t You have received a new voicemail from ${VM_CALLERID} \non ${VM_DATE}. \n Find attached.\n\n—-\nAsterisk PBX
maxgreet =
operator = no
maxmsg = 25
maxmessage = 300
minmessage = 0
saycid = no
sayduration = no
envelope = no
review = no

Thats it !
Leave a voicemail on your extension and check if it arrives at your mail box.

Leave Comment