I'm running version 21.02.0 and wanted to try out the asterisk-app-voicemail-imap package, but found that if I enabled connecting to the IMAP server via SSL by setting imapflags=ssl in Asterisk's voicemail.conf, Asterisk would report app_voicemail_imap.c: IMAP Error: Can't open mailbox {192.168.1.7:993/imap/ssl/user=someuser}INBOX: invalid remote specification
, and tcpdump showed that it didn't even attempt to connect. If I changed it to not use SSL (changing the port number and imapflags in voicemail.conf), it connected (but doesn't work because the IMAP server requires STARTTLS if not connecting via imaps).
Looking at the source for asterisk and the uw-imap library that asterisk uses, it seems like the problem comes from this patch for uw-imap, in particular where it moves ssl$(SSLTYPE)
to the beginning in once: onceenv ckp$(PASSWDTYPE) ssl$(SSLTYPE) osdep.c
. The Makefile
creates a linkage.c
file containing various initialization calls needed depending on the compile options selected. The ssl$(SSLTYPE)
target appends some stuff to linkage.c
, but the onceenv
target calls the drivers script, which deletes linkage.c
as the very first thing it does.
So originally, the onceenv
target would create an initial linkage.c
file, then subsequent targets, such as ssl$(SSLTYPE)
would append things to it as needed. But the patch moves ssl$(SSLTYPE)
to the front, so it creates/appends its SSL initialization calls to linkage.c
, but then onceenv
clobbers it and the SSL initialization is lost.
What's the purpose of changing the order of those targets? Removing that section of the patch allows asterisk-app-voicemail-imap to connect to the IMAP server over SSL, and it seems to actually work.