mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
Merged revisions 59275 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r59275 | russell | 2007-03-27 18:16:27 -0500 (Tue, 27 Mar 2007) | 3 lines Fix app_directory to actually compile with ODBC_STORAGE, and update the code to the latest res_odbc API. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@59276 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -45,7 +45,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
#include "asterisk/utils.h"
|
#include "asterisk/utils.h"
|
||||||
#include "asterisk/app.h"
|
#include "asterisk/app.h"
|
||||||
|
|
||||||
#ifdef USE_ODBC_STORAGE
|
#ifdef ODBC_STORAGE
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include "asterisk/res_odbc.h"
|
#include "asterisk/res_odbc.h"
|
||||||
@@ -88,7 +88,7 @@ static char *descrip =
|
|||||||
#define NUMDIGITS 3
|
#define NUMDIGITS 3
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_ODBC_STORAGE
|
#ifdef ODBC_STORAGE
|
||||||
static void retrieve_file(char *dir)
|
static void retrieve_file(char *dir)
|
||||||
{
|
{
|
||||||
int x = 0;
|
int x = 0;
|
||||||
@@ -102,9 +102,9 @@ static void retrieve_file(char *dir)
|
|||||||
char *c;
|
char *c;
|
||||||
SQLLEN colsize;
|
SQLLEN colsize;
|
||||||
char full_fn[256];
|
char full_fn[256];
|
||||||
|
struct odbc_obj *obj;
|
||||||
|
|
||||||
odbc_obj *obj;
|
obj = ast_odbc_request_obj(odbc_database, 1);
|
||||||
obj = fetch_odbc_obj(odbc_database, 0);
|
|
||||||
if (obj) {
|
if (obj) {
|
||||||
do {
|
do {
|
||||||
ast_copy_string(fmt, vmfmts, sizeof(fmt));
|
ast_copy_string(fmt, vmfmts, sizeof(fmt));
|
||||||
@@ -127,7 +127,7 @@ static void retrieve_file(char *dir)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
SQLBindParameter(stmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(dir), 0, (void *)dir, 0, NULL);
|
SQLBindParameter(stmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(dir), 0, (void *)dir, 0, NULL);
|
||||||
res = odbc_smart_execute(obj, stmt);
|
res = ast_odbc_smart_execute(obj, stmt);
|
||||||
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
|
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
|
||||||
ast_log(LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql);
|
ast_log(LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql);
|
||||||
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
|
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
|
||||||
@@ -173,6 +173,7 @@ static void retrieve_file(char *dir)
|
|||||||
}
|
}
|
||||||
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
|
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
|
||||||
} while (0);
|
} while (0);
|
||||||
|
ast_odbc_release_obj(obj);
|
||||||
} else
|
} else
|
||||||
ast_log(LOG_WARNING, "Failed to obtain database object for '%s'!\n", odbc_database);
|
ast_log(LOG_WARNING, "Failed to obtain database object for '%s'!\n", odbc_database);
|
||||||
if (fdm)
|
if (fdm)
|
||||||
@@ -264,11 +265,14 @@ static int play_mailbox_owner(struct ast_channel *chan, char *context,
|
|||||||
int res = 0;
|
int res = 0;
|
||||||
int loop;
|
int loop;
|
||||||
char fn[256];
|
char fn[256];
|
||||||
|
#ifdef ODBC_STORAGE
|
||||||
|
char fn2[256];
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Check for the VoiceMail2 greeting first */
|
/* Check for the VoiceMail2 greeting first */
|
||||||
snprintf(fn, sizeof(fn), "%s/voicemail/%s/%s/greet",
|
snprintf(fn, sizeof(fn), "%s/voicemail/%s/%s/greet",
|
||||||
ast_config_AST_SPOOL_DIR, context, ext);
|
ast_config_AST_SPOOL_DIR, context, ext);
|
||||||
#ifdef USE_ODBC_STORAGE
|
#ifdef ODBC_STORAGE
|
||||||
retrieve_file(fn);
|
retrieve_file(fn);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -277,7 +281,7 @@ static int play_mailbox_owner(struct ast_channel *chan, char *context,
|
|||||||
snprintf(fn, sizeof(fn), "%s/vm/%s/greet",
|
snprintf(fn, sizeof(fn), "%s/vm/%s/greet",
|
||||||
ast_config_AST_SPOOL_DIR, ext);
|
ast_config_AST_SPOOL_DIR, ext);
|
||||||
}
|
}
|
||||||
#ifdef USE_ODBC_STORAGE
|
#ifdef ODBC_STORAGE
|
||||||
retrieve_file(fn2);
|
retrieve_file(fn2);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -296,7 +300,7 @@ static int play_mailbox_owner(struct ast_channel *chan, char *context,
|
|||||||
res = ast_say_character_str(chan, ext, AST_DIGIT_ANY, chan->language);
|
res = ast_say_character_str(chan, ext, AST_DIGIT_ANY, chan->language);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef USE_ODBC_STORAGE
|
#ifdef ODBC_STORAGE
|
||||||
ast_filedelete(fn, NULL);
|
ast_filedelete(fn, NULL);
|
||||||
ast_filedelete(fn2, NULL);
|
ast_filedelete(fn2, NULL);
|
||||||
#endif
|
#endif
|
||||||
@@ -653,9 +657,9 @@ static int unload_module(void)
|
|||||||
|
|
||||||
static int load_module(void)
|
static int load_module(void)
|
||||||
{
|
{
|
||||||
#ifdef USE_ODBC_STORAGE
|
#ifdef ODBC_STORAGE
|
||||||
struct ast_config *cfg = ast_config_load(VOICEMAIL_CONFIG);
|
struct ast_config *cfg = ast_config_load(VOICEMAIL_CONFIG);
|
||||||
char *tmp;
|
const char *tmp;
|
||||||
|
|
||||||
if (cfg) {
|
if (cfg) {
|
||||||
if ((tmp = ast_variable_retrieve(cfg, "general", "odbcstorage"))) {
|
if ((tmp = ast_variable_retrieve(cfg, "general", "odbcstorage"))) {
|
||||||
|
Reference in New Issue
Block a user