Summary:ASTERISK-01803: [post-1.0][patch] Improvements in app_voicemail.c
Reporter:constfilin (constfilin)Labels:
Date Opened:2004-06-11 21:50:52Date Closed:2004-09-25 02:04:40
Versions:Frequency of
Environment:Attachments:( 0) asterisk_app_voicemail.patch
( 1) asterisk_app_voicemail.patch
( 2) asterisk_app_voicemail.patch
( 3) asterisk-addons_mysql-vm-routines.patch
( 4) postgres-vm-routines.h
Description:When compiled with USEPOSTGRESVM flag, the CVS version of asterisk/apps/app_voicemail.c has a
limitation that the SQL queries in functions like "find_user","vm_change_password" and
"reset_user_pw" are hardcoded.

The patched version of app_voicemail.c takes these SQL queries from voicemail.config file as
it does for parameter "dboption".

The fixed version of app_voicemail.c is 100% backward compatible with the previous version
because if function "load_config" does not find these queries in voicemail.conf file, it
defaults to the original queries and coe code works as it used to.
Comments:By: Mark Spencer (markster) 2004-06-12 09:40:07

When using strncpy, you must subtract one from the length for the trailing '\0' character.   Also, you should increase the size of the buffer that we "sprintf" into to accomodate larger SQL queries since they're now configurable -- otherwise it might be possible to run out of buffer space.

By: constfilin (constfilin) 2004-06-14 12:47:19

Mark, I fixed the problems you mentioned and uploaded a new patch.

By: Mark Spencer (markster) 2004-06-14 15:46:50

What does dboption string do?  It doesn't seem to be used anywhere.

By: constfilin (constfilin) 2004-06-14 20:20:58

It is used to connect to Postgres, function "sql_init"

By: Mark Spencer (markster) 2004-06-23 23:39:27

Just to confirm, do you have a disclaimer on file already?

By: Mark Spencer (markster) 2004-06-28 10:03:05

In the old code, the query is setup differently for context="" vs. context="foo".  How does the revised verison handle that?

By: constfilin (constfilin) 2004-07-02 13:47:43

If you know that you are going to use the default context, then
use simply omit "context='%s'" part from the WHERE clause of SQL queries specified in "db_changepassword_query", "db_setpassword_query",
"db_getvmuser_query" values of [general] section of voicemail.conf.

It is exactly for this purpose, "context" argument in the patch is always
the last one in the "sprintf" argument list. If it is NULL and the is no
corresponding '%s' in the format argument, then nothing happens

edited on: 07-02-04 14:17

By: constfilin (constfilin) 2004-07-12 20:28:19

Mark, is it possible to put in CVS?

Thank you


By: constfilin (constfilin) 2004-07-13 15:49:10

I implemented the same changes to voicemail with mysql and improved the code for the cases when vm context is NULL.

Also, I moved postgres code into a separate include file asterisk-addons/postgres-vm-routines.h. This to make postgress vm support similar to mysql support in file asterisk-addons/mysql-vm-routines.h

By: Mark Spencer (markster) 2004-09-13 18:17:43