Asterisk - The Open Source Telephony Project  21.4.1
Data Structures | Macros | Functions | Variables
cdr_tds.c File Reference

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_moduleAST_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 = "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 = "da6642af068ee5e6490c5b1d2cc1d238" , .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_infoast_module_info = &__mod_info
 
static const char config [] = "cdr_tds.conf"
 
static const char name [] = "FreeTDS (MSSQL)"
 
static struct cdr_tds_configsettings
 
static ast_mutex_t tds_lock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} }
 

Detailed Description

FreeTDS CDR logger http://www.freetds.org/.

Definition in file cdr_tds.c.

Macro Definition Documentation

#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]

Definition at line 72 of file cdr_tds.c.