| Asterisk - The Open Source Telephony Project GIT-master-27fb039
    | 
FreeTDS CDR logger http://www.freetds.org/. More...
#include "asterisk.h"#include "asterisk/config.h"#include "asterisk/channel.h"#include "asterisk/cdr.h"#include "asterisk/module.h"#include <sqlfront.h>#include <sybdb.h>
Go to the source code of this file.
| Data Structures | |
| struct | cdr_tds_config | 
| Macros | |
| #define | DATE_FORMAT "%Y/%m/%d %T" | 
| 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 int | tds_log (struct ast_cdr *cdr) | 
| 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 CDR Backend" , .key = ASTERISK_GPL_KEY , .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 = "cdr", } | 
| static const struct ast_module_info * | ast_module_info = &__mod_info | 
| static const char | config [] = "cdr_tds.conf" | 
| static const char | name [] = "FreeTDS (MSSQL)" | 
| static struct cdr_tds_config * | settings | 
| static ast_mutex_t | tds_lock = AST_MUTEX_INIT_VALUE | 
FreeTDS CDR logger http://www.freetds.org/.
Definition in file cdr_tds.c.
| #define DATE_FORMAT "%Y/%m/%d %T" | 
 *
 * Table Structure for `cdr`
 *
 * Created on: 05/20/2004 16:16
 * Last changed on: 07/27/2004 20:01
CREATE TABLE [dbo].[cdr] (
    [accountcode] [varchar] (20) NULL ,
    [src] [varchar] (80) NULL ,
    [dst] [varchar] (80) NULL ,
    [dcontext] [varchar] (80) NULL ,
    [clid] [varchar] (80) NULL ,
    [channel] [varchar] (80) NULL ,
    [dstchannel] [varchar] (80) NULL ,
    [lastapp] [varchar] (80) NULL ,
    [lastdata] [varchar] (80) NULL ,
    [start] [datetime] NULL ,
    [answer] [datetime] NULL ,
    [end] [datetime] NULL ,
    [duration] [int] NULL ,
    [billsec] [int] NULL ,
    [disposition] [varchar] (20) NULL ,
    [amaflags] [varchar] (16) NULL ,
    [uniqueid] [varchar] (32) NULL ,
    [userfield] [varchar] (256) NULL
) ON [PRIMARY] 
| 
 | static | 
Definition at line 299 of file cdr_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 345 of file cdr_tds.c.
References ast_free, and ast_vasprintf.
Referenced by mssql_connect().
| 
 | static | 
Definition at line 333 of file cdr_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 594 of file cdr_tds.c.
References ast_calloc_with_stringfields, ast_cdr_register(), ast_free, ast_log, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, ast_string_field_free_memory, ast_module_info::description, LOG_ERROR, name, NULL, settings, tds_error_handler(), tds_load_module(), tds_log(), and tds_message_handler().
| 
 | static | 
Definition at line 388 of file cdr_tds.c.
References ast_log, cdr_tds_config::charset, cdr_tds_config::connected, cdr_tds_config::database, cdr_tds_config::dbproc, execute_and_consume(), cdr_tds_config::has_userfield, cdr_tds_config::hostname, cdr_tds_config::language, LOG_ERROR, LOG_NOTICE, NULL, cdr_tds_config::password, settings, cdr_tds_config::table, and cdr_tds_config::username.
Referenced by tds_load_module(), and tds_log().
| 
 | static | 
Definition at line 376 of file cdr_tds.c.
References cdr_tds_config::connected, cdr_tds_config::dbproc, NULL, and settings.
Referenced by tds_load_module(), tds_log(), and tds_unload_module().
| 
 | static | 
Definition at line 589 of file cdr_tds.c.
References tds_load_module().
Referenced by tds_load_module().
| 
 | static | 
| 
 | static | 
Definition at line 478 of file cdr_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_true(), ast_variable_browse(), ast_variable_retrieve(), config, CONFIG_FLAG_FILEUNCHANGED, CONFIG_STATUS_FILEINVALID, CONFIG_STATUS_FILEUNCHANGED, hostname, language, LOG_ERROR, LOG_NOTICE, mssql_connect(), mssql_disconnect(), NULL, reload(), settings, and tds_lock.
Referenced by load_module(), and reload().
| 
 | static | 
Definition at line 106 of file cdr_tds.c.
References accountcode, answer(), anti_injection(), ast_cdr_disp2str(), ast_channel_amaflags2string(), ast_free, ast_log, AST_MAX_USER_FIELD, ast_mutex_lock, ast_mutex_unlock, ast_tvdiff_us(), ast_tvzero(), cdr_tds_config::connected, cdr_tds_config::dbproc, done, end, get_date(), cdr_tds_config::has_userfield, cdr_tds_config::hostname, cdr_tds_config::hrtime, LOG_ERROR, LOG_NOTICE, mssql_connect(), mssql_disconnect(), NULL, settings, cdr_tds_config::table, and tds_lock.
Referenced by load_module().
| 
 | static | 
Definition at line 470 of file cdr_tds.c.
References ast_debug, ast_log, LOG_NOTICE, and severity.
Referenced by load_module().
| 
 | static | 
Definition at line 439 of file cdr_tds.c.
References ast_cdr_unregister(), ast_free, ast_mutex_lock, ast_mutex_unlock, ast_string_field_free_memory, mssql_disconnect(), name, settings, and tds_lock.
Referenced by unload_module().
| 
 | static | 
| 
 | static | 
| 
 | static | 
| 
 | static | 
Definition at line 75 of file cdr_tds.c.
Referenced by tds_load_module().
| 
 | static | 
Definition at line 74 of file cdr_tds.c.
Referenced by load_module(), and tds_unload_module().
| 
 | static | 
Definition at line 95 of file cdr_tds.c.
Referenced by load_module(), mssql_connect(), mssql_disconnect(), process_config(), tds_load_module(), tds_log(), and tds_unload_module().
| 
 | static | 
Definition at line 93 of file cdr_tds.c.
Referenced by tds_load_module(), tds_log(), and tds_unload_module().