[asterisk-users] VOICEMAIL : I've tried a lot but mailing through Asterisk is just not working...

jonas kellens jonas.kellens at telenet.be
Fri May 22 07:33:09 CDT 2009


Don't be afraid about the info that I'm going to post in this mail, but
I want you to give as much info as possible. Also I want to show you
what I've tried.

What do I want
When a voicemail-message is left via the Voicemail()-application, I want
the .wav-file send to my mail-address as an attachment.

My mail-setup
I'm not using sendmail as MTA. I have msmtp as MTA and mutt as MUA.
Mailing with mutt and msmtp works well. I have a crontab running that
sends me every Saturday my Asterisk logfiles like this :
#!/bin/bash
DATUM=`date`
mutt -s "LOGFILE verbose $DATUM" -a /var/log/asterisk/verbose
jonas.kellens at telenet.be < /dev/null
mutt -s "LOGFILE debug $DATUM" -a /var/log/asterisk/debug
jonas.kellens at telenet.be < /dev/null

My /root/.msmtprc-file has the following :
# Set default values for all following accounts.
defaults
logfile ~/.msmtp.log

# The SMTP server of the provider.
account default
host uit.telenet.be
user my_username
password my_password
from jonas.kellens at telenet.be

The logfile of msmtp (/root/.msmtp.log) shows a successful sending :
May 17 03:01:30 host=uit.telenet.be tls=off auth=off
from=jonas.kellens at telenet.be recipients=jonas.kellens at telenet.be
mailsize=197590 smtpstatus=250 smtpms
g='250 2.0.0 Message accepted for delivery (sR311b0033o2nLm0HR31q7)'
exitcode=EX_OK
(this was last sunday morning at 3 am)

Msmtp vs Sendmail

I have made a symbolic link from sendmail to msmtp :
[root at asterisk asterisk]# ls -l /usr/sbin/sendmail
lrwxrwxrwx 1 root root 20 May 17 21:10 /usr/sbin/sendmail
-> /usr/local/bin/msmtp

When I use the default setting in voicemail.conf
(mailcmd=/usr/sbin/sendmail -v -t -f), then msmtp will be used. I
hoped...

Voicemail.conf

[general]
format=wav49|gsm|wav
serveremail=jonas.kellens at telenet.be
attach=yes
emailsubject=[PBX]: New message ${VM_MSGNUM} in mailbox ${VM_MAILBOX}
emailbody=Dear ${VM_NAME}:\n\n\tjust wanted to let you know you were
just left a ${VM_DUR} long message (number ${VM_MSGNUM})\nin mailbox
${VM_MAILBOX} from ${VM_CALLERID}, on ${VM_DATE}, so you might\nwant to
check it when you get a chance.  Thanks!\n\n\t\t\t\t--Asterisk\n
emaildateformat=%A, %B %d, %Y at %r
mailcmd=/usr/sbin/sendmail -v -t -f

[zonemessages]
eastern=America/New_York|'vm-received' Q 'digits/at' IMp
central=America/Chicago|'vm-received' Q 'digits/at' IMp
central24=America/Chicago|'vm-received' q 'digits/at' H N 'hours'
military=Zulu|'vm-received' q 'digits/at' H N 'hours' 'phonetic/z_p'
european=Europe/Copenhagen|'vm-received' a d b 'digits/at' HM
belgie=Europe/Brussels|'vm-received' Q 'digits/at' R

[Voicemail-context]
60 => 4569,Jonas Kellens,jonas.kellens at telenet.be

In my extensions.conf I has the following :

exten => 2000,1,Voicemail(60 at voicemail-context,u)


Now, which settings have I tried :

voicemail.conf :

serveremail= Asterisk PBX
serveremail=jonas.kellens at telenet.be


mailcmd=/usr/sbin/sendmail -v -t -f
mailcmd=/usr/local/bin/msmtp -v -t -f
mailcmd=/usr/local/bin/mutt -v -f -a
mailcmd=/usr/sbin/sendmail -v -t -f jonas.kellens at telenet.be
mailcmd=/usr/local/bin/msmtp -v -t -f jonas.kellens at telenet.be

Logfile msmtp

Whenever I call extension 2000, I get the voicemail. I leave a message.
There is no fault on the Asterisk CLI.
There is NO entry in the logfile of msmtp (/root/.msmtp.log). No error,
no success.

I have the impression that Asterisk is unable to communicate with
sendmail or msmtp...

Let's try something different :

So if Asterisk does not want to send mail, I can maybe write a dialplan
that checks for messages and sends the voicemailmessages to my
mailaddress.

So I have the following :
[root at asterisk agi-bin]# ls -l /var/lib/asterisk/agi-bin/mail2.sh 
-rwxr-xr-x 1 root root 58 May 21
15:16 /var/lib/asterisk/agi-bin/mail2.sh
[root at asterisk agi-bin]# cat /var/lib/asterisk/agi-bin/mail2.sh 
mutt -s "$1" -a "$2" jonas.kellens at telenet.be < /dev/null

and this in my dialplan :

exten => 3000,1,NoOp(test mailscript)
exten => 3000,n,System(/var/lib/asterisk/agi-bin/mail2.sh
test-email /etc/asterisk/iax.conf)
exten => 3000,n,NoOp(systemstatus : ${SYSTEMSTATUS})


But this does not work according to the output on the CLI :

    -- Executing [3000 at TCS-personeel-zoiper:1]
NoOp("IAX2/jonaskellens-10491", "test mailscript") in new stack
    -- Executing [3000 at TCS-personeel-zoiper:2]
System("IAX2/jonaskellens-10491", "/var/lib/asterisk/agi-bin/mail2.sh
test-email /etc/asterisk/iax.conf") in new stack
    -- Executing [3000 at TCS-personeel-zoiper:3]
NoOp("IAX2/jonaskellens-10491", "systemstatus : APPERROR") in new stack


So I'm stuck

There is no way for me to get my voicemail-messages through mailing...
and I absolutely want to implement this.


Can someone please help me with this issue ???

Greetingz,
Jonas.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20090522/bb3795be/attachment.htm 


More information about the asterisk-users mailing list