diff options
-rw-r--r-- | UPGRADE.txt | 4 | ||||
-rw-r--r-- | apps/app_voicemail.c | 42 | ||||
-rw-r--r-- | doc/odbcstorage.txt | 7 |
3 files changed, 6 insertions, 47 deletions
diff --git a/UPGRADE.txt b/UPGRADE.txt index 7d5b6a981..1c572cbcb 100644 --- a/UPGRADE.txt +++ b/UPGRADE.txt @@ -197,6 +197,10 @@ Applications: exit code, the AGISTATUS variable will be set to "FAILURE" as opposed to "SUCCESS". +* app_voicemail: The ODBC_STORAGE capability now requires the extended table format + previously used only by EXTENDED_ODBC_STORAGE. This means that you will need to update + your table format using the schema provided in doc/odbcstorage.txt + Manager: * After executing the 'status' manager action, the "Status" manager events diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 34fd23e61..103021770 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -34,10 +34,6 @@ <depend>unixodbc</depend> <defaultenabled>no</defaultenabled> </member> - <member name="EXTENDED_ODBC_STORAGE" displayname="Storage of Voicemail using ODBC (extended)"> - <depend>unixodbc</depend> - <defaultenabled>no</defaultenabled> - </member> <member name="IMAP_STORAGE" displayname="Storage of Voicemail using IMAP4"> <depend>imap_tk</depend> <use>ssl</use> @@ -1330,11 +1326,7 @@ static void copy_file(char *sdir, int smsg, char *ddir, int dmsg, char *dmailbox odbc_release_obj(obj); goto yuck; } -#ifdef EXTENDED_ODBC_STORAGE snprintf(sql, sizeof(sql), "INSERT INTO %s (dir, msgnum, context, macrocontext, callerid, origtime, duration, recording, mailboxuser, mailboxcontext) SELECT ?,?,context,macrocontext,callerid,origtime,duration,recording,?,? FROM %s WHERE dir=? AND msgnum=?",odbc_table,odbc_table); -#else - snprintf(sql, sizeof(sql), "INSERT INTO %s (dir, msgnum, context, macrocontext, callerid, origtime, duration, recording) SELECT ?,?,context,macrocontext,callerid,origtime,duration,recording FROM %s WHERE dir=? AND msgnum=?",odbc_table,odbc_table); -#endif res = SQLPrepare(stmt, sql, SQL_NTS); if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) { ast_log(LOG_WARNING, "SQL Prepare failed![%s]\n", sql); @@ -1344,15 +1336,10 @@ static void copy_file(char *sdir, int smsg, char *ddir, int dmsg, char *dmailbox } SQLBindParameter(stmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(ddir), 0, (void *)ddir, 0, NULL); SQLBindParameter(stmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(msgnumd), 0, (void *)msgnumd, 0, NULL); -#ifdef EXTENDED_ODBC_STORAGE SQLBindParameter(stmt, 3, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(dmailboxuser), 0, (void *)dmailboxuser, 0, NULL); SQLBindParameter(stmt, 4, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(dmailboxcontext), 0, (void *)dmailboxcontext, 0, NULL); SQLBindParameter(stmt, 5, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(sdir), 0, (void *)sdir, 0, NULL); SQLBindParameter(stmt, 6, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(msgnums), 0, (void *)msgnums, 0, NULL); -#else - SQLBindParameter(stmt, 3, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(sdir), 0, (void *)sdir, 0, NULL); - SQLBindParameter(stmt, 4, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(msgnums), 0, (void *)msgnums, 0, NULL); -#endif res = odbc_smart_execute(obj, stmt); if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) { ast_log(LOG_WARNING, "SQL Execute error!\n[%s] (You probably don't have MySQL 4.1 or later installed)\n\n", sql); @@ -1441,17 +1428,9 @@ static int store_file(char *dir, char *mailboxuser, char *mailboxcontext, int ms goto yuck; } if (!ast_strlen_zero(category)) -#ifdef EXTENDED_ODBC_STORAGE snprintf(sql, sizeof(sql), "INSERT INTO %s (dir,msgnum,recording,context,macrocontext,callerid,origtime,duration,mailboxuser,mailboxcontext,category) VALUES (?,?,?,?,?,?,?,?,?,?,?)",odbc_table); -#else - snprintf(sql, sizeof(sql), "INSERT INTO %s (dir,msgnum,recording,context,macrocontext,callerid,origtime,duration,category) VALUES (?,?,?,?,?,?,?,?,?)",odbc_table); -#endif else -#ifdef EXTENDED_ODBC_STORAGE snprintf(sql, sizeof(sql), "INSERT INTO %s (dir,msgnum,recording,context,macrocontext,callerid,origtime,duration,mailboxuser,mailboxcontext) VALUES (?,?,?,?,?,?,?,?,?,?)",odbc_table); -#else - snprintf(sql, sizeof(sql), "INSERT INTO %s (dir,msgnum,recording,context,macrocontext,callerid,origtime,duration) VALUES (?,?,?,?,?,?,?,?)",odbc_table); -#endif res = SQLPrepare(stmt, sql, SQL_NTS); if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) { ast_log(LOG_WARNING, "SQL Prepare failed![%s]\n", sql); @@ -1468,15 +1447,10 @@ static int store_file(char *dir, char *mailboxuser, char *mailboxcontext, int ms SQLBindParameter(stmt, 6, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(callerid), 0, (void *)callerid, 0, NULL); SQLBindParameter(stmt, 7, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(origtime), 0, (void *)origtime, 0, NULL); SQLBindParameter(stmt, 8, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(duration), 0, (void *)duration, 0, NULL); -#ifdef EXTENDED_ODBC_STORAGE SQLBindParameter(stmt, 9, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(mailboxuser), 0, (void *)mailboxuser, 0, NULL); SQLBindParameter(stmt, 10, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(mailboxcontext), 0, (void *)mailboxcontext, 0, NULL); if (!ast_strlen_zero(category)) SQLBindParameter(stmt, 11, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(category), 0, (void *)category, 0, NULL); -#else - if (!ast_strlen_zero(category)) - SQLBindParameter(stmt, 9, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(category), 0, (void *)category, 0, NULL); -#endif res = odbc_smart_execute(obj, stmt); if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) { ast_log(LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql); @@ -1518,11 +1492,7 @@ static void rename_file(char *sdir, int smsg, char *mailboxuser, char *mailboxco odbc_release_obj(obj); goto yuck; } -#ifdef EXTENDED_ODBC_STORAGE snprintf(sql, sizeof(sql), "UPDATE %s SET dir=?, msgnum=?, mailboxuser=?, mailboxcontext=? WHERE dir=? AND msgnum=?",odbc_table); -#else - snprintf(sql, sizeof(sql), "UPDATE %s SET dir=?, msgnum=? WHERE dir=? AND msgnum=?",odbc_table); -#endif res = SQLPrepare(stmt, sql, SQL_NTS); if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) { ast_log(LOG_WARNING, "SQL Prepare failed![%s]\n", sql); @@ -1532,15 +1502,10 @@ static void rename_file(char *sdir, int smsg, char *mailboxuser, char *mailboxco } SQLBindParameter(stmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(ddir), 0, (void *)ddir, 0, NULL); SQLBindParameter(stmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(msgnumd), 0, (void *)msgnumd, 0, NULL); -#ifdef EXTENDED_ODBC_STORAGE SQLBindParameter(stmt, 3, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(mailboxuser), 0, (void *)mailboxuser, 0, NULL); SQLBindParameter(stmt, 4, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(mailboxcontext), 0, (void *)mailboxcontext, 0, NULL); SQLBindParameter(stmt, 5, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(sdir), 0, (void *)sdir, 0, NULL); SQLBindParameter(stmt, 6, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(msgnums), 0, (void *)msgnums, 0, NULL); -#else - SQLBindParameter(stmt, 3, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(sdir), 0, (void *)sdir, 0, NULL); - SQLBindParameter(stmt, 4, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(msgnums), 0, (void *)msgnums, 0, NULL); -#endif res = odbc_smart_execute(obj, stmt); if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) { ast_log(LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql); @@ -7407,13 +7372,6 @@ static int load_module(void *mod) ast_install_vm_functions(has_voicemail, inboxcount, messagecount); -#if defined(ODBC_STORAGE) && !defined(EXTENDED_ODBC_STORAGE) - ast_log(LOG_WARNING, "The current ODBC storage table format will be changed soon." - "Please update your tables as per the README and edit the apps/Makefile " - "and uncomment the line containing EXTENDED_ODBC_STORAGE to enable the " - "new table format.\n"); -#endif - return res; } diff --git a/doc/odbcstorage.txt b/doc/odbcstorage.txt index 2cba0b4b9..435574b0e 100644 --- a/doc/odbcstorage.txt +++ b/doc/odbcstorage.txt @@ -16,14 +16,11 @@ table is as follows: | callerid | varchar(40) | YES | | NULL | | | origtime | varchar(40) | YES | | NULL | | | duration | varchar(20) | YES | | NULL | | -| mailboxuser | varchar(80) | YES | | NULL | |* -| mailboxcontext | varchar(80) | YES | | NULL | |* +| mailboxuser | varchar(80) | YES | | NULL | | +| mailboxcontext | varchar(80) | YES | | NULL | | | recording | longblob | YES | | NULL | | +----------------+-------------+------+-----+---------+-------+ -*=Denotes new fieldnames, define EXTENDED_ODBC_STORAGE in -apps/Makefile to enable the functionality. - The database name (from /etc/asterisk/res_odbc.conf) is in the "odbcstorage" variable in the general section of voicemail.conf. |