[Home]

Summary:ASTERISK-14863: [patch] app_voicemail.so doesn't refresh information from database on reload
Reporter:viniciusfontes (viniciusfontes)Labels:
Date Opened:2009-09-22 13:38:42Date Closed:2009-09-22 16:50:18
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Applications/app_voicemail/IMAP
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20090922__issue15934.diff.txt
Description:I have Asterisk 1.4.26.2 with voicemail configured on the realtime engine. When I change the imapuser field on the database, app_voicemail seems to use some kind of cache, because it doesn't store the voicemail in the newly set mailbox, not even after triggering "module reload app_voicemail.so" on the CLI. The only way it can read the new value is by unloading and loading the module again, as in:

*CLI> module unload app_voicemail.so
*CLI> module load app_voicemail.so

****** ADDITIONAL INFORMATION ******

extconfig.conf:
sipusers => mysql,asterisk,sip
sippeers => mysql,asterisk,sip
voicemail => mysql,asterisk,voicemail_users

res_mysql.conf:
[general]
dbhost = 192.168.0.151
dbname = realtime
dbuser = root
dbpass = XXXXXXXX
dbport = 3306

voicemail.conf:
[general]
format=wav49
imapserver=mail.mydomain.com
imapport=143
expungeonhangup=yes
imapfolder=INBOX
imapflags=notls
authuser=admin@mydomain.com
authpassword=XXXXXXXXXX
serveremail=no-reply@mydomain.com
attach=yes
skipms=3000
maxsilence=10
silencethreshold=128
maxlogins=3
emailsubject=[PBX]: Nova mensagem [${VM_MSGNUM}] na caixa postal ${VM_MAILBOX}
emailbody=${VM_NAME}:\n\nVoce recebeu um recado com a duracao de ${VM_DUR} (numero ${VM_MSGNUM}) na caixa postal numero ${VM_MAILBOX}.\n\nRemetente: ${VM_CALLERID}\nData: ${VM_DATE}
emaildateformat=%A, %d %B %Y as %H:%M:%S

database dump:
-- MySQL dump 10.11
--
-- Host: localhost    Database: asterisk
-- ------------------------------------------------------
-- Server version 5.0.51a-24+lenny1-log

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `voicemail_users`
--

DROP TABLE IF EXISTS `voicemail_users`;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `voicemail_users` (
 `uniqueid` int(11) NOT NULL auto_increment,
 `customer_id` varchar(11) NOT NULL default '0',
 `context` varchar(50) NOT NULL default '',
 `mailbox` varchar(11) NOT NULL default '0',
 `password` varchar(5) NOT NULL default '0',
 `fullname` varchar(150) NOT NULL default '',
 `email` varchar(50) NOT NULL default '',
 `pager` varchar(50) NOT NULL default '',
 `tz` varchar(10) NOT NULL default 'central',
 `attach` varchar(4) NOT NULL default 'yes',
 `saycid` varchar(4) NOT NULL default 'yes',
 `dialout` varchar(10) NOT NULL default '',
 `callback` varchar(10) NOT NULL default '',
 `review` varchar(4) NOT NULL default 'no',
 `operator` varchar(4) NOT NULL default 'no',
 `envelope` varchar(4) NOT NULL default 'no',
 `sayduration` varchar(4) NOT NULL default 'no',
 `saydurationm` tinyint(4) NOT NULL default '1',
 `sendvoicemail` varchar(4) NOT NULL default 'no',
 `delete` varchar(4) NOT NULL default 'no',
 `nextaftercmd` varchar(4) NOT NULL default 'yes',
 `forcename` varchar(4) NOT NULL default 'no',
 `forcegreetings` varchar(4) NOT NULL default 'no',
 `hidefromdir` varchar(4) NOT NULL default 'yes',
 `stamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
 `imapuser` varchar(40) NOT NULL,
 PRIMARY KEY  (`uniqueid`),
 KEY `mailbox_context` (`mailbox`,`context`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;

--
-- Dumping data for table `voicemail_users`
--

LOCK TABLES `voicemail_users` WRITE;
/*!40000 ALTER TABLE `voicemail_users` DISABLE KEYS */;
INSERT INTO `voicemail_users` VALUES (1,'0','default','1001','1001','Fulano','','','central','yes','yes','','','no','no','no','no',1,'no','no','yes','no','no','yes','2009-09-22 15:06:09','vinicius'),(2,'0','default','1002','1002','Beltrano','','','central','yes','yes','','','no','no','no','no',1,'no','no','yes','no','no','yes','2009-09-22 18:30:17','eleandro');
/*!40000 ALTER TABLE `voicemail_users` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2009-09-22 18:39:29

Comments:By: Tilghman Lesher (tilghman) 2009-09-22 14:40:50

Patch uploaded.  This will need testing and feedback.

By: viniciusfontes (viniciusfontes) 2009-09-22 15:12:38

Had a few warnings when patching and compiling:

patching file apps/app_voicemail.c
Hunk ASTERISK-1 succeeded at 737 (offset 1 line).
Hunk ASTERISK-2 succeeded at 790 (offset 1 line).
Hunk ASTERISK-3 succeeded at 1072 (offset 1 line).
Hunk ASTERISK-4 succeeded at 1562 (offset 1 line).
Hunk ASTERISK-5 succeeded at 1933 (offset 1 line).
Hunk ASTERISK-6 succeeded at 1958 (offset 1 line).
Hunk ASTERISK-7 succeeded at 2003 (offset 1 line).
Hunk ASTERISK-8 succeeded at 8479 (offset -5 lines).


make[1]: Entrando no diretório `/usr/src/asterisk-1.4.26.2/apps'
  [CC] app_voicemail.c -> app_voicemail.o
In file included from /usr/src/imap-2007e/c-client/osdep.h:63,
                from /usr/src/imap-2007e/c-client/c-client.h:42,
                from app_voicemail.c:82:
/usr/src/imap-2007e/c-client/env_unix.h:71: warning: function declaration isn’t a prototype


When I change the value on the field imapuser, app_voicemail still sends to the old value. The difference is that now "module reload app_voicemail.so" works. After that app_voicemail reads the new value and the email is sent to the right mailbox.

Is that correct behaviour? I was expecting not being necessary to reload the module, since the voicemail boxes are defined on a MySQL database.

By: Tilghman Lesher (tilghman) 2009-09-22 15:14:20

Yes, a reload is required, because caching is an important part of the IMAP implementation (it would be rather slow, otherwise).

By: viniciusfontes (viniciusfontes) 2009-09-22 15:18:05

OK then, thanks a lot. I really wasn't expecting it to be solved THAT fast! :)

By: Digium Subversion (svnbot) 2009-09-22 16:39:13

Repository: asterisk
Revision: 219816

U   branches/1.4/apps/app_voicemail.c

------------------------------------------------------------------------
r219816 | tilghman | 2009-09-22 16:39:13 -0500 (Tue, 22 Sep 2009) | 10 lines

When IMAP variables were changed during a reload, Voicemail did not use the new values.
This change introduces a configuration version variable, which ensures that
connections with the old values are not reused but are allowed to expire
normally.
(closes issue ASTERISK-14863)
Reported by: viniciusfontes
Patches:
      20090922__issue15934.diff.txt uploaded by tilghman (license 14)
Tested by: viniciusfontes

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

http://svn.digium.com/view/asterisk?view=rev&revision=219816

By: Digium Subversion (svnbot) 2009-09-22 16:45:32

Repository: asterisk
Revision: 219818

_U  trunk/
U   trunk/apps/app_voicemail.c

------------------------------------------------------------------------
r219818 | tilghman | 2009-09-22 16:45:32 -0500 (Tue, 22 Sep 2009) | 17 lines

Merged revisions 219816 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
 r219816 | tilghman | 2009-09-22 16:37:03 -0500 (Tue, 22 Sep 2009) | 10 lines
 
 When IMAP variables were changed during a reload, Voicemail did not use the new values.
 This change introduces a configuration version variable, which ensures that
 connections with the old values are not reused but are allowed to expire
 normally.
 (closes issue ASTERISK-14863)
  Reported by: viniciusfontes
  Patches:
        20090922__issue15934.diff.txt uploaded by tilghman (license 14)
  Tested by: viniciusfontes
........

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

http://svn.digium.com/view/asterisk?view=rev&revision=219818

By: Digium Subversion (svnbot) 2009-09-22 16:49:36

Repository: asterisk
Revision: 219819

_U  branches/1.6.0/
U   branches/1.6.0/apps/app_voicemail.c

------------------------------------------------------------------------
r219819 | tilghman | 2009-09-22 16:49:36 -0500 (Tue, 22 Sep 2009) | 24 lines

Merged revisions 219818 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
 r219818 | tilghman | 2009-09-22 16:43:22 -0500 (Tue, 22 Sep 2009) | 17 lines
 
 Merged revisions 219816 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r219816 | tilghman | 2009-09-22 16:37:03 -0500 (Tue, 22 Sep 2009) | 10 lines
   
   When IMAP variables were changed during a reload, Voicemail did not use the new values.
   This change introduces a configuration version variable, which ensures that
   connections with the old values are not reused but are allowed to expire
   normally.
   (closes issue ASTERISK-14863)
    Reported by: viniciusfontes
    Patches:
          20090922__issue15934.diff.txt uploaded by tilghman (license 14)
    Tested by: viniciusfontes
 ........
................

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

http://svn.digium.com/view/asterisk?view=rev&revision=219819

By: Digium Subversion (svnbot) 2009-09-22 16:49:52

Repository: asterisk
Revision: 219820

_U  branches/1.6.1/
U   branches/1.6.1/apps/app_voicemail.c

------------------------------------------------------------------------
r219820 | tilghman | 2009-09-22 16:49:51 -0500 (Tue, 22 Sep 2009) | 24 lines

Merged revisions 219818 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
 r219818 | tilghman | 2009-09-22 16:43:22 -0500 (Tue, 22 Sep 2009) | 17 lines
 
 Merged revisions 219816 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r219816 | tilghman | 2009-09-22 16:37:03 -0500 (Tue, 22 Sep 2009) | 10 lines
   
   When IMAP variables were changed during a reload, Voicemail did not use the new values.
   This change introduces a configuration version variable, which ensures that
   connections with the old values are not reused but are allowed to expire
   normally.
   (closes issue ASTERISK-14863)
    Reported by: viniciusfontes
    Patches:
          20090922__issue15934.diff.txt uploaded by tilghman (license 14)
    Tested by: viniciusfontes
 ........
................

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

http://svn.digium.com/view/asterisk?view=rev&revision=219820

By: Digium Subversion (svnbot) 2009-09-22 16:50:17

Repository: asterisk
Revision: 219821

_U  branches/1.6.2/
U   branches/1.6.2/apps/app_voicemail.c

------------------------------------------------------------------------
r219821 | tilghman | 2009-09-22 16:50:17 -0500 (Tue, 22 Sep 2009) | 24 lines

Merged revisions 219818 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
 r219818 | tilghman | 2009-09-22 16:43:22 -0500 (Tue, 22 Sep 2009) | 17 lines
 
 Merged revisions 219816 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r219816 | tilghman | 2009-09-22 16:37:03 -0500 (Tue, 22 Sep 2009) | 10 lines
   
   When IMAP variables were changed during a reload, Voicemail did not use the new values.
   This change introduces a configuration version variable, which ensures that
   connections with the old values are not reused but are allowed to expire
   normally.
   (closes issue ASTERISK-14863)
    Reported by: viniciusfontes
    Patches:
          20090922__issue15934.diff.txt uploaded by tilghman (license 14)
    Tested by: viniciusfontes
 ........
................

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

http://svn.digium.com/view/asterisk?view=rev&revision=219821