[Home]

Summary:ASTERISK-02602: Voicemail configuration still pulls zone info from voicemail.conf if using realtime config.
Reporter:zebble (zebble)Labels:
Date Opened:2004-10-14 00:59:03Date Closed:2011-06-07 14:10:22
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) voicemail.diff
Description:Related to bug 2646.
In order to get the Directory Application to work, voicemail.conf zones have to be kept intact.  If they are left intact, app_voicemail ignores the realtime config and pulls zone info from voicemail.conf.  Forcing find_user to check the realtime config first, fixes the problem.

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

I fixed this by changing find_user in app_voicemail:

static struct ast_vm_user *find_user(struct ast_vm_user *ivm, const char *context, const char *mailbox)
{
       /* This function could be made to generate one from a database, too */
       struct ast_vm_user *vmu=NULL, *cur;
       ast_mutex_lock(&vmlock);
       vmu = find_user_realtime(ivm,context,mailbox);
       if (vmu) {
               /* We're using a db! */
       } else {
               cur = users;
               while (cur) {
                       if ((!context || !strcasecmp(context, cur->context)) &&
                               (!strcasecmp(mailbox, cur->mailbox)))
                                       break;
                       cur=cur->next;
               }
               if (cur) {
                       if (ivm)
                               vmu = ivm;
                       else
                               /* Make a copy, so that on a reload, we have no race */
                               vmu = malloc(sizeof(struct ast_vm_user));
                       if (vmu) {
                               memcpy(vmu, cur, sizeof(struct ast_vm_user));
                               if (ivm)
                                       vmu->alloced = 0;
                               else
                                       vmu->alloced = 1;
                               vmu->next = NULL;
                       }
               } else {
                       vmu = find_user_realtime(ivm, context, mailbox);
               }
       }
       ast_mutex_unlock(&vmlock);
       return vmu;
}
Comments:By: Brian West (bkw918) 2004-10-14 01:03:37

please attach a diff -u

By: zebble (zebble) 2004-10-14 01:09:49

Disclaimer on file.  I'll submit a diff in a day or so.

By: Brian West (bkw918) 2004-10-17 18:54:52

Any diff yet?

By: zebble (zebble) 2004-10-20 12:34:41

Sorry for the delay.  Diff has been added.

By: Mark Spencer (markster) 2004-10-31 21:09:32.000-0600

I'm a bit confused here.  Why would this order matter unless you had entries both in realtime config *and* in the voicemail.conf?

By: zebble (zebble) 2004-10-31 21:31:41.000-0600

Hi Mark,
As per my original note, if the voicemail.conf entries are left intact, then app_voicemail ignores the realtime config.  The directory app, however, only reads it's info from voicemail.conf.  So, you can't use a realtime config for app_voicemail and still have the directory work properly.
This patch works around that.  The proper long term fix would be to have the Directory read it's info from the realtime config.

By: Mark Spencer (markster) 2004-11-07 01:27:24.000-0600

I'm going to close this one out as "not a bug" since the config file should take presidence over the realtime engine.  There is another bug in the tracker already about pulling the directory from realtime.