IMAP Errors

Hello all,

Here is my voicemail.conf

2992 =>0131,Erik,,|imapuser=ewilhelmsen

I am able to telnet on port 143 to the IMAP server from Linux just fine. But when I start asterisk I get these errors.

[Mar 20 08:31:31] ERROR[15359]: app_voicemail.c:8489 mm_log: IMAP Error: Can’t open mailbox {}INBOX: invalid remote specification
[Mar 20 08:31:31] ERROR[15359]: app_voicemail.c:4662 init_mailstream: Can’t connect to imap server {}INBOX
[Mar 20 08:31:31] ERROR[15359]: app_voicemail.c:2542 inboxcount: IMAP mailstream is NULL

I am trying to connect to a MS Exchange IMAP server. I have also tried Dovecot IMAP.
If anyone could help I would appreciate it.


check the permissions of the folder your posting to.
does /imap/imap/notls/user=ewilhelmsen even exist?

Same here.

I HAD IMAP storage working on a test machine before. I left the machine for some time (required to do other things). Came back the other day and it wasn’t working anymore, with the same error as yours.

Went from 1.4.0 to 1.4.2, still no luck. I’m using dovecot by the way.

Sigh yet again

It’s the same as when I couldn’t get it to work in the beginning. It doesn’t even hit the damned imap server even if half the planet can connect to it just fine. Bleh.

I am having such a hard time with this. “X marks the spot” have you ever tried to connect it to MS Exchange IMAP server?

Has anyone for that matter tried to get asterisk VM to work with MS Exchange IMAP server?


I think some guy got it to work with an exchange server, you can try googling it (or maybe it was on this forum).

I think everyone has a hard time on this one, I’ve been trying on 1.4.0 and got it to work after weeks of messing around.

Now I’m back to square one.

This IMAP storage thing is so cool, but I think it was made by the devil.

I wiped a few times before it worked, and it looks like it’s going to be like this again.

Well, I am joining the group that cannot get IMAP voicemail working. It previously worked with 1.4B3 I am sure. I have a Dovecot IMAP server on the same subnet, that works correctly with Outlook and Outlook Express clients. It supports virtual email accounts for multiple domains. This is the server I used previously. I also installed Dovecot on the same machine as Asterisk-1.4.2 and it also works correctly with Outlook Express client. For Asterisk, I used the latest UW client. Everything compiles correctly, but I do not seem to be able to get Asterisk to even contact the IMAP server, at least according to “maillog”. I get same errors you all mention. To help me, could someone please clarify a few items.

I am using an IMAP ID and password in the VM config file. Why do you need a master auth ID? Would not the Asterisk email client just use the user credentials in the config file? I have seen the entry for the password listed as imappasswd and imappassword. Which is correct? On last thing, my voicemail.conf file is resident as a mysql table, using realtime static. This has worked well for me for sometime, but I am wondering if this could be an additional wrinkle.

What is the purpose of the “file folder” entry in the VM config file? If Asterisk is talking to the IMAP server, what control does it have on the IMAP servers file structure? I don’t think it should have any control. So, this must relate to files on the Asterisk box, but what does it mean?

Some posts when mentioning the error /imap/Asterisk/user/INBOX seem to imply that this is a directory structure? Again, this does not make sense, since the remote IMAP server is a self contained entity. Seems to me it is just an error string.

Funny thing is that the first time I set this up, was done very quickly since the IMAP server was already on line. I just wanted to give it a try., and it worked. I normally use voicemail stored in mysql tables, with ODBC interface. In the case of 1.4.2, I spent a lot of time chasing rabits and got nowhere. I must be doing something basically wrong.

What config options for UW client should be considered. I did nothing fancy, jut that mentioned in many of the posts. I did not do anything about the MD format. Should I?

Thanks in advance for any advice.

An update. I removed authuser and authpassword from voicemail.conf and included imappassword for user and it sort of works. I can leave messages and retrieve them with Outlook Express. If I open a file, it gets correctly marked as old. Voicemailmain reports the correct number of messages, but I never get an MWI. If I try to record “voicemail options”. asterisk crashes with a seg-fault. I tried UW-TKV(g) and V(e) with same results.

Any words of wisdom would be greatly appreciated.


Had a lot other things to do for a while, but recap:

I ditched dovecot completely in favor of courier-imap (I was unsuccessful in fixing the once working Dovecot machine).

And IMAP storage only works halfway.

I’m using maildir and virtual users.

For it to work with maildir I included only:

imapserver=ipaddyoftheserver imapport=143 expungeonhangup=yes

That’s the only way I could get it to work: with no imapflags and no imapfolder settings. (Of course you have to include imapuser and imappassword for the mailbox).

It works when you record a message, which is good, and the voicemail message ends up in the mailbox. The thing that goes wrong is trying to listen to the messages from a phone.

Looking at the logs, the message I get in Asterisk is “Invalid mailbox name”. Courier doesn’t seem to cause any problems, as nothing wrong is logged.

I’m guessing it doesn’t know where the messages are or something, but I’m completely mystified.

I’m no expert on mail servers so I have little knowledge of maildir, and why if I specify an “imapfolder” I get a “mailbox does not exist or not subscribed” message.

I have the exact same problem. I am still using Dovecot, TLS and I do use the IMAPFLAGS=novalidate-cert. Same as you, if I include a master imap user and password, voicemail does not even attempt to log into the IMAP server. I have established a master user for dovecot and it seems to work, As with you, if I include a user level imapuser|imappassword, it works - sort of. I get no MWI, but if I access voicemailmain, it tells me I have a message, just does not play it. I can also crash asterisk if I try to record a greeting using mail box options. It does leave the message in the correct folder and it is correctly accessed by my imap client (Outlook Express). I have tried different mailbox formats, TLS or NOTLS, all with the same results. I am using Centos 4.4 and asterisk 1.4.4. It would be great if it worked, and it seems to be a file location problem, as you suggest, but I have not made any progress.

Yargh, this is getting annoying.

I did Dovecot once, it was a disastrous failure, so never again. (It stopped working at some point and I couldn’t find what the hell was up with it).

Right now I’m on a (superb/clean) setup of Debian+Courier-Imap+MySQL (Virtual users, the whole nine yards)+Maildir/Exim smtp with virtual auth and Asterisk still messes up.

The courier-imap logfile acts if everything is correct (Why?). Maybe I need to increase the debug on Asterisk and Courier-Imap.

So I’m getting to the point where I have to redo the setup entirely (sighs) and start over with Cyrus. (I read that the Asterisk Imap thingy was in fact developed with Cyrus in mind).

It’s definitely a pain in the rear end.

I tried (negligently, I have to admit) Cyrus before and hated it powerfully.

I wish I could be more help. Dovecot, for me has been very stable. I have it running on a Centos 4.4 Linux active-passive cluster and it NEVER goes down. I connect the shared storage two the two computer cluster via fiber channel with GFS partitions. This production IMAP server is on the same subnet as my test Asterisk box, and I get the same problems when connecting to it as I do to the mail server as localhost. On this Asterisk server, I wrote some PHP test scripts and I can access all functions, including appending mail into the “Voicemail” folder either on the dovecot server on the same box or the standalone server. I thought this would be a good test since PHP uses the same (almost) UW client that Asterisk uses. I really think that the IMAP support is broken. If anyone has it working with 1.4, it would be a great help to know, so that we can focus on troubleshooting my install. By the way, did you get a chance to see is Asterisk crashes if the “mailbox options” is used to save a greeting in voicemailmain?

Wow… so apparently it’s impossible to get it to work with Cyrus (from my own experience).

So all in all I tried and learned how to use Dovecot, Courier-Imap and Cyrus

Dovecot worked for a while but it’s sort of simplistic, plus it broke down really really awfully and I couldn’t really fix it. Did you have to create users with adduser for Dovecot? It was horrible.

Courier-Imap in maildir with virtual users worked beautifully, but not with asterisk. Ditto Cyrus (Cyrus is definitely the best of the bunch).

I guess I’ll try some more before giving up on Cyrus completely… how did you get it to actually do something to the mail server? i.e. attempt to log in?

Well, I hate to throw in the towel, but I really feel that IMAP support is broken. After little success in 1.4.4, today I tried the trunk version. When I try to leave a message, I get an immediate segmentation fault. No complaints about connectivity, accounts, just a crash. Since I can use the UW client throught PHP to talk to the same mailserver, I think it is not totally a configuration issue. The original error messages that are mentioned previously when a global user and password are defined in voicemail.conf, comes from the UW client code. In this case, no attempt is made to log into the server. I guess I would try to go through the code and try to find out why the “OPEN” parameters are bad, and possibly fix it if I thought I was on the right track. But since there seems to be know one that knows if IMAP support in 1.4 is broken or it should work and is a config/mailbox/who-knows problem, then I will just forget it for the moment. If anyone has any insight, it would be greatly appreciated.

To your questions, I could get it to leave messages in the correct folder for the correct user account only if I included an imapuser=someone|imappassword=password for each user. If I defined a global user and password in the general section, it never attempted a login, because the UW client code was not happy with the parameters given to it from Asterisk. That cases the error you mentioned:

[Mar 20 08:31:31] ERROR[15359]: app_voicemail.c:8489 mm_log: IMAP Error: Can’t open mailbox {}INBOX: invalid remote specification

I used TLS, but since I generated self signed certs, I included novalidate-certs in the imapflags parameter. This would allow Asterisk to log in to the mailserver, and leave a voicemail. I could retrieve with Outlook, but trying to retrieve from phone with voicemailmain did not work.
As to Dovecot on my production server, I set up virtual mailboxes and use mysql to authenticate. Same for Postfix. It works well.
Ed Horton

Well I’ve reverted to Dovecot (third time bleh!)

I’ve ditched Cyrus before I got the chance to really try it but whatever now.

But I think I’m getting the hang of it/starting to see what is going on/wrong.

I’ll be back with more info next week.

All right got a new error for you!

[May 14 11:40:24] WARNING[2698]: app_voicemail.c:8490 mm_log: IMAP Warning: SECURITY PROBLEM: insecure server advertised AUTH=PLAIN

So far so good, it’s not like security matters for the time being.

Then all hell breaks loose:

[May 14 11:40:24] ERROR[2698]: app_voicemail.c:8493 mm_log: IMAP Error: IMAP protocol error: Authentication aborted [May 14 11:40:24] ERROR[2698]: app_voicemail.c:8493 mm_log: IMAP Error: IMAP Authentication cancelled [May 14 11:40:24] ERROR[2698]: app_voicemail.c:4666 init_mailstream: Can't connect to imap server {localhost:143/imap/notls/user=jdoe}INBOX

All right, What The Hell is that?!? Authentication aborted!? And it does hit the server, the attempt is logged:

2007-05-14 11:40:24 Info: auth(default): client in: AUTH 1 PLAIN service=IMAP secured lip= rip= 2007-05-14 11:40:24 Info: auth(default): client out: CONT 1 2007-05-14 11:40:24 Info: imap-login: Authenticate PLAIN failed: Authentication aborted: method=PLAIN, rip=, lip=, secured 2007-05-14 11:37:20 Info: imap-login: Aborted login: method=PLAIN, rip=, lip=, secured

Does anyone understand what the hell this is? Authentication aborted!? Why? How? When? Where? Which?

You can see I have only the notls imap flag.

Never you mind, that previous error was a typo in one of the settings.

Now I get the much more annoying:

[May 14 12:04:59] ERROR[2763]: app_voicemail.c:8493 mm_log: IMAP Error: Mailbox doesn't exist: {localhost:143/imap/notls/user=jdoe}INBOX

Can anyone tell me how it doesn’t exist if mtest says it exists, and so does pine?

mtest says this about it:

[code]Mailbox (’?’ for help): {localhost:143/imap/notls/user=jdoe}INBOX
[Trying IP address []]

  • OK Dovecot ready.
    [Dovecot ready.]
    00000000 CAPABILITY
    00000000 OK Capability completed.
    %SECURITY PROBLEM: insecure server advertised AUTH=PLAIN

{localhost/imap/user=“jdoe”} password:

00000001 OK Logged in.

    00000002 OK Capability completed.
    00000003 SELECT INBOX
  • FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
  • OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft *)] Flags permitted.
  • 0 EXISTS
  • 0 RECENT
  • OK [UIDVALIDITY 1178839276] UIDs valid
  • OK [UIDNEXT 5] Predicted next UID
    00000003 OK [READ-WRITE] Select completed.
    [Mailbox is empty]
    Mon, 14 May 2007 12:14:22 -0400 (EDT)
    imap mailbox: {localhost:143/imap/notls/user=“jdoe”}INBOX, 0 messages, 0 recent
    IMAP4rev1 (RFC 3501) server localhost
    Supported standard extensions:
    Quotas (RFC 2087)
    Non-synchronizing literals (RFC 2088)
    IDLE unsolicited update (RFC 2177)
    Login referrals (RFC 2221)
    Multiple namespaces (RFC 2342)
    LIST children announcement (RFC 3348)
    Atomic multiple APPEND (RFC 3502)
    Supported draft extensions:
    Mailbox unselect
    SASL initial client response
    Server-based sorting
    Server-based threading: REFERENCES

Maybe asterisk is just being wussy about it and doesn’t want to auth in plaintext? Maybe I should enable TLS or something.

Anyway I think version is key here, as you said. Imap storage in 1.4.4 is a trainwreck apparently.

Small victory, I managed a workaround for using a master user in 1.4.4. Seems to work.

However I still get the horrible MAILBOX DOES NOT EXIST message? What the hell!

And I made a bad decision I guess, I’m using mbox, which means I can’t create subdirectories (or can I?).

Well, I guess I’m sort of stuck.

I don’t really know how the dovecot quota thing works with mbox so I get an error for that, in particular so that the GETQUOTAROOT imap command yields something that asterisk likes.

Other than that, I’m unable to playback the messages from the phones. If this has ever worked, in what format soundfile or whatever in 1.4.4, I really don’t know.

It even finds the messages in the mailbox properly, but when comes the time to play them, it doesn’t play anything, as if the sound file is not there.

I see that it the file is played out of /var/spool/asterisk/voicemail/VoiceMailBoxes/Extension/tmp/msg0000, but I have no idea if the message is placed properly before playback.