Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
FreeTDS CEL logger http://www.freetds.org/. More...
#include "asterisk.h"
#include <time.h>
#include <math.h>
#include "asterisk/config.h"
#include "asterisk/channel.h"
#include "asterisk/cel.h"
#include "asterisk/module.h"
#include "asterisk/logger.h"
#include <sqlfront.h>
#include <sybdb.h>
Go to the source code of this file.
Data Structures | |
struct | cel_tds_config |
Macros | |
#define | DATE_FORMAT "%Y/%m/%d %T" |
#define | TDS_BACKEND_NAME "CEL TDS logging backend" |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static char * | anti_injection (const char *, int) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static int | execute_and_consume (DBPROCESS *dbproc, const char *fmt,...) |
static void | get_date (char *, size_t len, struct timeval) |
static int | load_module (void) |
static int | mssql_connect (void) |
static int | mssql_disconnect (void) |
static int | reload (void) |
static int | tds_error_handler (DBPROCESS *dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr) |
static int | tds_load_module (int reload) |
static void | tds_log (struct ast_event *event) |
static int | tds_message_handler (DBPROCESS *dbproc, DBINT msgno, int msgstate, int severity, char *msgtext, char *srvname, char *procname, int line) |
static int | tds_unload_module (void) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "FreeTDS CEL Backend" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_EXTENDED, .load = load_module, .unload = unload_module, .reload = reload, .load_pri = AST_MODPRI_CDR_DRIVER, .requires = "cel", } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static char * | config = "cel_tds.conf" |
static struct cel_tds_config * | settings |
static ast_mutex_t | tds_lock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } |
FreeTDS CEL logger http://www.freetds.org/.
Definition in file cel_tds.c.
#define DATE_FORMAT "%Y/%m/%d %T" |
* * Table Structure for `cel` * CREATE TABLE [dbo].[cel] ( [accountcode] [varchar] (20) NULL , [cidname] [varchar] (80) NULL , [cidnum] [varchar] (80) NULL , [cidani] [varchar] (80) NULL , [cidrdnis] [varchar] (80) NULL , [ciddnid] [varchar] (80) NULL , [exten] [varchar] (80) NULL , [context] [varchar] (80) NULL , [channame] [varchar] (80) NULL , [appname] [varchar] (80) NULL , [appdata] [varchar] (80) NULL , [eventtime] [datetime] NULL , [eventtype] [varchar] (32) NULL , [uniqueid] [varchar] (32) NULL , [linkedid] [varchar] (32) NULL , [amaflags] [varchar] (16) NULL , [userfield] [varchar] (32) NULL , [peer] [varchar] (32) NULL ) ON [PRIMARY]
|
static |
Definition at line 257 of file cel_tds.c.
References ast_calloc, ast_log, buf, len(), LOG_ERROR, NULL, str, and strcasestr().
Referenced by tds_log().
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
|
static |
Definition at line 302 of file cel_tds.c.
References ast_free, and ast_vasprintf.
Referenced by mssql_connect().
|
static |
Definition at line 290 of file cel_tds.c.
References ast_copy_string(), ast_localtime(), ast_strftime(), ast_tvzero(), DATE_FORMAT, len(), and NULL.
Referenced by tds_log().
|
static |
Definition at line 530 of file cel_tds.c.
References ast_calloc_with_stringfields, ast_cel_backend_register(), ast_free, ast_log, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, ast_string_field_free_memory, LOG_ERROR, LOG_WARNING, NULL, settings, TDS_BACKEND_NAME, tds_error_handler(), tds_load_module(), tds_log(), and tds_message_handler().
|
static |
Definition at line 344 of file cel_tds.c.
References ast_log, ast_strlen_zero(), cel_tds_config::charset, cel_tds_config::connected, cel_tds_config::connection, cel_tds_config::database, dbopen(), cel_tds_config::dbproc, execute_and_consume(), cel_tds_config::language, LOG_ERROR, NULL, cel_tds_config::password, settings, cel_tds_config::table, and cel_tds_config::username.
Referenced by tds_load_module(), and tds_log().
|
static |
Definition at line 333 of file cel_tds.c.
References cel_tds_config::connected, cel_tds_config::dbproc, NULL, and settings.
Referenced by tds_load_module(), tds_log(), and tds_unload_module().
|
static |
Definition at line 525 of file cel_tds.c.
References tds_load_module().
Referenced by tds_load_module().
|
static |
|
static |
Definition at line 430 of file cel_tds.c.
References ast_config_destroy(), ast_config_load, ast_log, ast_mutex_lock, ast_mutex_unlock, ast_string_field_init, ast_string_field_set, ast_variable_browse(), ast_variable_retrieve(), config, CONFIG_FLAG_FILEUNCHANGED, CONFIG_STATUS_FILEINVALID, CONFIG_STATUS_FILEUNCHANGED, language, LOG_ERROR, LOG_NOTICE, mssql_connect(), mssql_disconnect(), NULL, reload(), settings, table, and tds_lock.
Referenced by load_module(), and reload().
|
static |
Definition at line 110 of file cel_tds.c.
References ast_cel_event_record::account_code, ast_cel_event_record::amaflag, anti_injection(), ast_cel_event_record::application_data, ast_cel_event_record::application_name, AST_CEL_EVENT_RECORD_VERSION, ast_cel_fill_record(), AST_CEL_USER_DEFINED, ast_channel_amaflags2string(), ast_free, ast_log, ast_mutex_lock, ast_mutex_unlock, ast_cel_event_record::caller_id_ani, ast_cel_event_record::caller_id_dnid, ast_cel_event_record::caller_id_name, ast_cel_event_record::caller_id_num, ast_cel_event_record::caller_id_rdnis, ast_cel_event_record::channel_name, cel_tds_config::connected, cel_tds_config::connection, ast_cel_event_record::context, cel_tds_config::dbproc, done, ast_cel_event_record::event_name, ast_cel_event_record::event_time, ast_cel_event_record::event_type, ast_cel_event_record::extension, get_date(), ast_cel_event_record::linked_id, LOG_ERROR, LOG_NOTICE, mssql_connect(), mssql_disconnect(), ast_cel_event_record::peer, settings, cel_tds_config::table, tds_lock, ast_cel_event_record::unique_id, ast_cel_event_record::user_defined_name, ast_cel_event_record::user_field, and ast_cel_event_record::version.
Referenced by load_module().
|
static |
Definition at line 422 of file cel_tds.c.
References ast_debug, ast_log, LOG_NOTICE, and severity.
Referenced by load_module().
|
static |
Definition at line 393 of file cel_tds.c.
References ast_cel_backend_unregister(), ast_free, ast_mutex_lock, ast_mutex_unlock, ast_string_field_free_memory, mssql_disconnect(), settings, TDS_BACKEND_NAME, and tds_lock.
Referenced by unload_module().
|
static |
|
static |
|
static |
|
static |
Definition at line 81 of file cel_tds.c.
Referenced by tds_load_module().
|
static |
Definition at line 99 of file cel_tds.c.
Referenced by load_module(), mssql_connect(), mssql_disconnect(), tds_load_module(), tds_log(), and tds_unload_module().
|
static |
Definition at line 97 of file cel_tds.c.
Referenced by tds_load_module(), tds_log(), and tds_unload_module().