[Home]

Summary:ASTERISK-03828: realtime voicemail options from database not paid attention to
Reporter:mh720 (mh720)Labels:
Date Opened:2005-03-31 17:52:24.000-0600Date Closed:2011-06-07 14:10:50
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Applications/app_voicemail
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:Using asterisk realtime configuration with a MySQL db , options for voicemail users such as attach=yes|saycid=yes are not being paid attention to by app_voicemail.  Setting these same options in voicemail.conf works, e.g.:

187 => 2223,Bill,bill@email.com,,attach=yes|saycid=yes

However, when the voicemail user is instead defined in a database and using asterisk realtime (extconfig.conf), upon app execution asterisk shows the proper voicemail options for the user, but they don't seem to be getting applied.

A good test would be to set attach=no in the general section of voicemail.conf, then set attach=yes in the options column of a voicemail user from a database, this will replicate the problem.  VirTERM from #asterisk confirmed that he saw the same results.

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

   -- Executing Answer("SIP/125-6bcf", "") in new stack
   -- Executing Wait("SIP/125-6bcf", "1") in new stack
   -- Executing VoiceMail("SIP/125-6bcf", "u125@default") in new stack
uniqueid => 1
customer_id => 1
context => default
mailbox => 125
password => <removed>
fullname => Mike Holloway
email => mike@<removed>.com
pager => <removed>@cingularme.com
options => saycid=yes
stamp => 20050331155209
   -- Playing '/var/spool/asterisk/voicemail/default/125/unavail' (language 'en')
Comments:By: Kevin P. Fleming (kpfleming) 2005-03-31 18:05:15.000-0600

The code for applying options is identical in both cases (the same code, in fact). I'd start out by adding some ast_log() calls to apply_options in app_voicemail to see exactly what is being passed to it when find_realtime_user builds a user from the database.

By: mh720 (mh720) 2005-03-31 20:31:54.000-0600

I did as you suggested and added:

ast_log(LOG_WARNING, "apply_options: vmu var value is '%s' '%s' '%s' \n", vmu, var, value);

e.g.:

static void apply_options(struct ast_vm_user *vmu, const char *options)
{ /* Destructively Parse options and apply */
       char *stringp;
       char *s;
       char *var, *value;
       stringp = ast_strdupa(options);

       while ((s = strsep(&stringp, "|"))) {
               value = s;
               if ((var = strsep(&value, "=")) && value) {
                       apply_option(vmu, var, value);

                       ast_log(LOG_WARNING, "apply_options: vmu var value is '%s' '%s' '%s' \n", vmu, var, value);
               }
       }
}


And the logged output was:


Mar 31 20:24:46 WARNING[952]: app_voicemail.c:406 apply_options: apply_options: vmu var value is  'default' 'attach' 'yes'
Mar 31 20:24:46 WARNING[952]: app_voicemail.c:406 apply_options: apply_options: vmu var value is  'default' 'saycid' 'yes'


It shows the correct values that is in the 'options' field of the db - 'saycid=yes|attach=yes'


Interestingly, when I called a voicemail box that is instead in the file voicemail.conf, nothing is logged.  Perhaps a different function than apply_options is being called for non-realtime entries? I'm just guessing here.

Thanks for picking this up kp, please let me how I can help further.

By: Kevin P. Fleming (kpfleming) 2005-03-31 21:05:23.000-0600

No, non-realtime mailboxes are initialized when the module is loaded/reloaded, so you won't see those messages when you leave voicemail in them.

Please change your logging to display vmu->mailbox instead of vmu, since that shows the context the mailbox is in rather than its name. If you want some assistance debugging this, join us on IRC in #asterisk-dev and we'll get it figured out.

By: mh720 (mh720) 2005-04-01 12:07:19.000-0600

I made the change to the logging.  When I start asterisk, it displays the mailbox in the parsed voicemail.conf file:

Apr  1 12:03:47 WARNING[7162]: app_voicemail.c:406 apply_options: vmu->mailbox
var value is  '180' 'attach' 'yes'
Apr  1 12:03:47 WARNING[7162]: app_voicemail.c:406 apply_options: vmu->mailbox var value is  '180' 'saycid' 'yes'

But when I left a message in the realtime db-based voicemail box, no log entry.

By: mh720 (mh720) 2005-04-01 14:17:37.000-0600

The issue was that find_user_realtime does not use the "options" field from the database, rather, create a field for each "option" that you want to set i.e. 'saycid' or 'attach' and set the value to 'yes' or 'no'.

Please close this bug, I will update the wiki.

By: Kevin P. Fleming (kpfleming) 2005-04-01 14:18:29.000-0600

This was a configuration error, caused by incorrect documentation on the wiki. The voicemail options must be stored in individual db columns, not combined into a single column.