#include <asterisk.h>
#include <sys/types.h>
#include <asterisk/config.h>
#include <asterisk/options.h>
#include <asterisk/channel.h>
#include <asterisk/cdr.h>
#include <asterisk/module.h>
#include <asterisk/logger.h>
#include <asterisk/cli.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <mysql/mysql.h>
#include <mysql/errmsg.h>
#include <sys/stat.h>
#include <errno.h>
Include dependency graph for cdr_addon_mysql.c:
Go to the source code of this file.
Defines | |
#define | AST_MODULE "cdr_addon_mysql" |
#define | DATE_FORMAT "%Y-%m-%d %T" |
Functions | |
AST_MODULE_INFO_STANDARD (ASTERISK_GPL_KEY,"MySQL CDR Backend") | |
AST_MUTEX_DEFINE_STATIC (mysql_lock) | |
static int | handle_cdr_mysql_status (int fd, int argc, char *argv[]) |
static int | load_module (void) |
static int | my_load_module (void) |
static int | my_unload_module (void) |
static int | mysql_log (struct ast_cdr *cdr) |
static int | reload (void) |
static int | unload_module (void) |
Variables | |
static struct ast_cli_entry | cdr_mysql_status_cli |
static char | cdr_mysql_status_help [] |
static char * | config = "cdr_mysql.conf" |
static time_t | connect_time = 0 |
static int | connected = 0 |
static char * | dbname = NULL |
static int | dbname_alloc = 0 |
static int | dbport = 0 |
static char * | dbsock = NULL |
static int | dbsock_alloc = 0 |
static char * | dbtable = NULL |
static int | dbtable_alloc = 0 |
static char * | dbuser = NULL |
static int | dbuser_alloc = 0 |
static char * | desc = "MySQL CDR Backend" |
static char * | hostname = NULL |
static int | hostname_alloc = 0 |
static MYSQL | mysql |
static char * | name = "mysql" |
static char * | password = NULL |
static int | password_alloc = 0 |
static int | records = 0 |
static unsigned int | timeout = 0 |
static int | totalrecords = 0 |
static int | userfield = 0 |
#define AST_MODULE "cdr_addon_mysql" |
Definition at line 50 of file cdr_addon_mysql.c.
#define DATE_FORMAT "%Y-%m-%d %T" |
Definition at line 52 of file cdr_addon_mysql.c.
Referenced by append_date(), build_radius_record(), get_date(), manager_log(), mysql_log(), odbc_log(), pgsql_log(), and sqlite_log().
AST_MODULE_INFO_STANDARD | ( | ASTERISK_GPL_KEY | , | |
"MySQL CDR Backend" | ||||
) |
AST_MUTEX_DEFINE_STATIC | ( | mysql_lock | ) |
static int handle_cdr_mysql_status | ( | int | fd, | |
int | argc, | |||
char * | argv[] | |||
) | [static] |
Definition at line 75 of file cdr_addon_mysql.c.
References ast_cli(), connect_time, connected, dbname, dbport, dbsock, dbtable, dbuser, hostname, records, RESULT_FAILURE, RESULT_SUCCESS, and totalrecords.
00076 { 00077 if (connected) { 00078 char status[256], status2[100] = ""; 00079 int ctime = time(NULL) - connect_time; 00080 if (dbport) 00081 snprintf(status, 255, "Connected to %s@%s, port %d", dbname, hostname, dbport); 00082 else if (dbsock) 00083 snprintf(status, 255, "Connected to %s on socket file %s", dbname, dbsock); 00084 else 00085 snprintf(status, 255, "Connected to %s@%s", dbname, hostname); 00086 00087 if (dbuser && *dbuser) 00088 snprintf(status2, 99, " with username %s", dbuser); 00089 if (dbtable && *dbtable) 00090 snprintf(status2, 99, " using table %s", dbtable); 00091 if (ctime > 31536000) { 00092 ast_cli(fd, "%s%s for %d years, %d days, %d hours, %d minutes, %d seconds.\n", status, status2, ctime / 31536000, (ctime % 31536000) / 86400, (ctime % 86400) / 3600, (ctime % 3600) / 60, ctime % 60); 00093 } else if (ctime > 86400) { 00094 ast_cli(fd, "%s%s for %d days, %d hours, %d minutes, %d seconds.\n", status, status2, ctime / 86400, (ctime % 86400) / 3600, (ctime % 3600) / 60, ctime % 60); 00095 } else if (ctime > 3600) { 00096 ast_cli(fd, "%s%s for %d hours, %d minutes, %d seconds.\n", status, status2, ctime / 3600, (ctime % 3600) / 60, ctime % 60); 00097 } else if (ctime > 60) { 00098 ast_cli(fd, "%s%s for %d minutes, %d seconds.\n", status, status2, ctime / 60, ctime % 60); 00099 } else { 00100 ast_cli(fd, "%s%s for %d seconds.\n", status, status2, ctime); 00101 } 00102 if (records == totalrecords) 00103 ast_cli(fd, " Wrote %d records since last restart.\n", totalrecords); 00104 else 00105 ast_cli(fd, " Wrote %d records since last restart and %d records since last reconnect.\n", totalrecords, records); 00106 return RESULT_SUCCESS; 00107 } else { 00108 ast_cli(fd, "Not currently connected to a MySQL server.\n"); 00109 return RESULT_FAILURE; 00110 } 00111 }
static int load_module | ( | void | ) | [static] |
Definition at line 459 of file cdr_addon_mysql.c.
References my_load_module().
00460 { 00461 return my_load_module(); 00462 }
static int my_load_module | ( | void | ) | [static] |
Definition at line 288 of file cdr_addon_mysql.c.
References ast_cdr_register(), ast_cli_register(), ast_config_destroy(), ast_config_load(), ast_log(), ast_variable_browse(), ast_variable_retrieve(), cdr_mysql_status_cli, config, connect_time, connected, dbname, dbname_alloc, dbport, dbsock, dbsock_alloc, dbtable, dbtable_alloc, dbuser, dbuser_alloc, desc, hostname, hostname_alloc, LOG_DEBUG, LOG_ERROR, LOG_NOTICE, LOG_WARNING, malloc, mysql, mysql_log(), name, password, password_alloc, records, timeout, userfield, and var.
Referenced by load_module(), and reload().
00289 { 00290 int res; 00291 struct ast_config *cfg; 00292 struct ast_variable *var; 00293 const char *tmp; 00294 00295 cfg = ast_config_load(config); 00296 if (!cfg) { 00297 ast_log(LOG_WARNING, "Unable to load config for mysql CDR's: %s\n", config); 00298 return 0; 00299 } 00300 00301 var = ast_variable_browse(cfg, "global"); 00302 if (!var) { 00303 /* nothing configured */ 00304 return 0; 00305 } 00306 00307 tmp = ast_variable_retrieve(cfg, "global", "hostname"); 00308 if (tmp) { 00309 hostname = malloc(strlen(tmp) + 1); 00310 if (hostname != NULL) { 00311 hostname_alloc = 1; 00312 strcpy(hostname, tmp); 00313 } else { 00314 ast_log(LOG_ERROR, "Out of memory error.\n"); 00315 return -1; 00316 } 00317 } else { 00318 ast_log(LOG_WARNING, "MySQL server hostname not specified. Assuming localhost\n"); 00319 hostname = "localhost"; 00320 } 00321 00322 tmp = ast_variable_retrieve(cfg, "global", "dbname"); 00323 if (tmp) { 00324 dbname = malloc(strlen(tmp) + 1); 00325 if (dbname != NULL) { 00326 dbname_alloc = 1; 00327 strcpy(dbname, tmp); 00328 } else { 00329 ast_log(LOG_ERROR, "Out of memory error.\n"); 00330 return -1; 00331 } 00332 } else { 00333 ast_log(LOG_WARNING, "MySQL database not specified. Assuming asteriskcdrdb\n"); 00334 dbname = "asteriskcdrdb"; 00335 } 00336 00337 tmp = ast_variable_retrieve(cfg, "global", "user"); 00338 if (tmp) { 00339 dbuser = malloc(strlen(tmp) + 1); 00340 if (dbuser != NULL) { 00341 dbuser_alloc = 1; 00342 strcpy(dbuser, tmp); 00343 } else { 00344 ast_log(LOG_ERROR, "Out of memory error.\n"); 00345 return -1; 00346 } 00347 } else { 00348 ast_log(LOG_WARNING, "MySQL database user not specified. Assuming root\n"); 00349 dbuser = "root"; 00350 } 00351 00352 tmp = ast_variable_retrieve(cfg, "global", "sock"); 00353 if (tmp) { 00354 dbsock = malloc(strlen(tmp) + 1); 00355 if (dbsock != NULL) { 00356 dbsock_alloc = 1; 00357 strcpy(dbsock, tmp); 00358 } else { 00359 ast_log(LOG_ERROR, "Out of memory error.\n"); 00360 return -1; 00361 } 00362 } else { 00363 ast_log(LOG_WARNING, "MySQL database sock file not specified. Using default\n"); 00364 dbsock = NULL; 00365 } 00366 00367 tmp = ast_variable_retrieve(cfg, "global", "table"); 00368 if (tmp) { 00369 dbtable = malloc(strlen(tmp) + 1); 00370 if (dbtable != NULL) { 00371 dbtable_alloc = 1; 00372 strcpy(dbtable, tmp); 00373 } else { 00374 ast_log(LOG_ERROR, "Out of memory error.\n"); 00375 return -1; 00376 } 00377 } else { 00378 ast_log(LOG_NOTICE, "MySQL database table not specified. Assuming \"cdr\"\n"); 00379 dbtable = "cdr"; 00380 } 00381 00382 tmp = ast_variable_retrieve(cfg, "global", "password"); 00383 if (tmp) { 00384 password = malloc(strlen(tmp) + 1); 00385 if (password != NULL) { 00386 password_alloc = 1; 00387 strcpy(password, tmp); 00388 } else { 00389 ast_log(LOG_ERROR, "Out of memory error.\n"); 00390 return -1; 00391 } 00392 } else { 00393 ast_log(LOG_WARNING, "MySQL database password not specified. Assuming blank\n"); 00394 password = ""; 00395 } 00396 00397 tmp = ast_variable_retrieve(cfg, "global", "port"); 00398 if (tmp) { 00399 if (sscanf(tmp, "%d", &dbport) < 1) { 00400 ast_log(LOG_WARNING, "Invalid MySQL port number. Using default\n"); 00401 dbport = 0; 00402 } 00403 } 00404 00405 tmp = ast_variable_retrieve(cfg, "global", "timeout"); 00406 if (tmp) { 00407 if (sscanf(tmp,"%d", &timeout) < 1) { 00408 ast_log(LOG_WARNING, "Invalid MySQL timeout number. Using default\n"); 00409 timeout = 0; 00410 } 00411 } 00412 00413 tmp = ast_variable_retrieve(cfg, "global", "userfield"); 00414 if (tmp) { 00415 if (sscanf(tmp, "%d", &userfield) < 1) { 00416 ast_log(LOG_WARNING, "Invalid MySQL configuration file\n"); 00417 userfield = 0; 00418 } 00419 } 00420 00421 ast_config_destroy(cfg); 00422 00423 ast_log(LOG_DEBUG, "cdr_mysql: got hostname of %s\n", hostname); 00424 ast_log(LOG_DEBUG, "cdr_mysql: got port of %d\n", dbport); 00425 ast_log(LOG_DEBUG, "cdr_mysql: got a timeout of %d\n", timeout); 00426 if (dbsock) 00427 ast_log(LOG_DEBUG, "cdr_mysql: got sock file of %s\n", dbsock); 00428 ast_log(LOG_DEBUG, "cdr_mysql: got user of %s\n", dbuser); 00429 ast_log(LOG_DEBUG, "cdr_mysql: got dbname of %s\n", dbname); 00430 ast_log(LOG_DEBUG, "cdr_mysql: got password of %s\n", password); 00431 00432 mysql_init(&mysql); 00433 00434 if (timeout && mysql_options(&mysql, MYSQL_OPT_CONNECT_TIMEOUT, (char *)&timeout)!=0) { 00435 ast_log(LOG_ERROR, "cdr_mysql: mysql_options returned (%d) %s\n", mysql_errno(&mysql), mysql_error(&mysql)); 00436 } 00437 00438 if (!mysql_real_connect(&mysql, hostname, dbuser, password, dbname, dbport, dbsock, 0)) { 00439 ast_log(LOG_ERROR, "Failed to connect to mysql database %s on %s.\n", dbname, hostname); 00440 connected = 0; 00441 records = 0; 00442 } else { 00443 ast_log(LOG_DEBUG, "Successfully connected to MySQL database.\n"); 00444 connected = 1; 00445 records = 0; 00446 connect_time = time(NULL); 00447 } 00448 00449 res = ast_cdr_register(name, desc, mysql_log); 00450 if (res) { 00451 ast_log(LOG_ERROR, "Unable to register MySQL CDR handling\n"); 00452 } else { 00453 res = ast_cli_register(&cdr_mysql_status_cli); 00454 } 00455 00456 return res; 00457 }
static int my_unload_module | ( | void | ) | [static] |
Definition at line 245 of file cdr_addon_mysql.c.
References ast_cdr_unregister(), ast_cli_unregister(), cdr_mysql_status_cli, connected, dbname, dbname_alloc, dbport, dbsock, dbsock_alloc, dbtable, dbtable_alloc, dbuser, dbuser_alloc, free, hostname, hostname_alloc, mysql, name, password, password_alloc, and records.
Referenced by reload(), and unload_module().
00246 { 00247 ast_cli_unregister(&cdr_mysql_status_cli); 00248 if (connected) { 00249 mysql_close(&mysql); 00250 connected = 0; 00251 records = 0; 00252 } 00253 if (hostname && hostname_alloc) { 00254 free(hostname); 00255 hostname = NULL; 00256 hostname_alloc = 0; 00257 } 00258 if (dbname && dbname_alloc) { 00259 free(dbname); 00260 dbname = NULL; 00261 dbname_alloc = 0; 00262 } 00263 if (dbuser && dbuser_alloc) { 00264 free(dbuser); 00265 dbuser = NULL; 00266 dbuser_alloc = 0; 00267 } 00268 if (dbsock && dbsock_alloc) { 00269 free(dbsock); 00270 dbsock = NULL; 00271 dbsock_alloc = 0; 00272 } 00273 if (dbtable && dbtable_alloc) { 00274 free(dbtable); 00275 dbtable = NULL; 00276 dbtable_alloc = 0; 00277 } 00278 if (password && password_alloc) { 00279 free(password); 00280 password = NULL; 00281 password_alloc = 0; 00282 } 00283 dbport = 0; 00284 ast_cdr_unregister(name); 00285 return 0; 00286 }
static int mysql_log | ( | struct ast_cdr * | cdr | ) | [static] |
Definition at line 118 of file cdr_addon_mysql.c.
References ast_cdr::accountcode, ast_cdr::amaflags, ast_cdr_disp2str(), ast_localtime(), ast_log(), ast_mutex_lock(), ast_mutex_unlock(), ast_cdr::billsec, ast_cdr::channel, ast_cdr::clid, connect_time, connected, DATE_FORMAT, dbname, dbport, dbsock, dbtable, dbuser, ast_cdr::dcontext, ast_cdr::disposition, ast_cdr::dst, ast_cdr::dstchannel, ast_cdr::duration, error(), hostname, ast_cdr::lastapp, ast_cdr::lastdata, LOG_DEBUG, LOG_ERROR, mysql, password, records, ast_cdr::src, ast_cdr::start, timeout, totalrecords, ast_cdr::uniqueid, ast_cdr::userfield, and userfield.
Referenced by my_load_module().
00119 { 00120 struct tm tm; 00121 struct timeval tv; 00122 struct ast_module_user *u; 00123 char *userfielddata = NULL; 00124 char sqlcmd[2048], timestr[128]; 00125 char *clid=NULL, *dcontext=NULL, *channel=NULL, *dstchannel=NULL, *lastapp=NULL, *lastdata=NULL; 00126 int retries = 5; 00127 #ifdef MYSQL_LOGUNIQUEID 00128 char *uniqueid = NULL; 00129 #endif 00130 00131 ast_mutex_lock(&mysql_lock); 00132 00133 memset(sqlcmd, 0, 2048); 00134 00135 ast_localtime(&cdr->start.tv_sec, &tm, NULL); 00136 strftime(timestr, 128, DATE_FORMAT, &tm); 00137 00138 db_reconnect: 00139 if ((!connected) && (hostname || dbsock) && dbuser && password && dbname && dbtable ) { 00140 /* Attempt to connect */ 00141 mysql_init(&mysql); 00142 /* Add option to quickly timeout the connection */ 00143 if (timeout && mysql_options(&mysql, MYSQL_OPT_CONNECT_TIMEOUT, (char *)&timeout)!=0) { 00144 ast_log(LOG_ERROR, "cdr_mysql: mysql_options returned (%d) %s\n", mysql_errno(&mysql), mysql_error(&mysql)); 00145 } 00146 if (mysql_real_connect(&mysql, hostname, dbuser, password, dbname, dbport, dbsock, 0)) { 00147 connected = 1; 00148 connect_time = time(NULL); 00149 records = 0; 00150 } else { 00151 ast_log(LOG_ERROR, "cdr_mysql: cannot connect to database server %s.\n", hostname); 00152 connected = 0; 00153 } 00154 } else { 00155 /* Long connection - ping the server */ 00156 int error; 00157 if ((error = mysql_ping(&mysql))) { 00158 connected = 0; 00159 records = 0; 00160 switch (mysql_errno(&mysql)) { 00161 case CR_SERVER_GONE_ERROR: 00162 case CR_SERVER_LOST: 00163 ast_log(LOG_ERROR, "cdr_mysql: Server has gone away. Attempting to reconnect.\n"); 00164 break; 00165 default: 00166 ast_log(LOG_ERROR, "cdr_mysql: Unknown connection error: (%d) %s\n", mysql_errno(&mysql), mysql_error(&mysql)); 00167 } 00168 retries--; 00169 if (retries) 00170 goto db_reconnect; 00171 else 00172 ast_log(LOG_ERROR, "cdr_mysql: Retried to connect fives times, giving up.\n"); 00173 } 00174 } 00175 00176 /* Maximum space needed would be if all characters needed to be escaped, plus a trailing NULL */ 00177 /* WARNING: This code previously used mysql_real_escape_string, but the use of said function 00178 requires an active connection to a database. If we are not connected, then this function 00179 cannot be used. This is a problem since we need to store off the SQL statement into our 00180 spool file for later restoration. 00181 So the question is, what's the best way to handle this? This works for now. 00182 */ 00183 if ((clid = alloca(strlen(cdr->clid) * 2 + 1)) != NULL) 00184 mysql_escape_string(clid, cdr->clid, strlen(cdr->clid)); 00185 if ((dcontext = alloca(strlen(cdr->dcontext) * 2 + 1)) != NULL) 00186 mysql_escape_string(dcontext, cdr->dcontext, strlen(cdr->dcontext)); 00187 if ((channel = alloca(strlen(cdr->channel) * 2 + 1)) != NULL) 00188 mysql_escape_string(channel, cdr->channel, strlen(cdr->channel)); 00189 if ((dstchannel = alloca(strlen(cdr->dstchannel) * 2 + 1)) != NULL) 00190 mysql_escape_string(dstchannel, cdr->dstchannel, strlen(cdr->dstchannel)); 00191 if ((lastapp = alloca(strlen(cdr->lastapp) * 2 + 1)) != NULL) 00192 mysql_escape_string(lastapp, cdr->lastapp, strlen(cdr->lastapp)); 00193 if ((lastdata = alloca(strlen(cdr->lastdata) * 2 + 1)) != NULL) 00194 mysql_escape_string(lastdata, cdr->lastdata, strlen(cdr->lastdata)); 00195 #ifdef MYSQL_LOGUNIQUEID 00196 if ((uniqueid = alloca(strlen(cdr->uniqueid) * 2 + 1)) != NULL) 00197 mysql_escape_string(uniqueid, cdr->uniqueid, strlen(cdr->uniqueid)); 00198 #endif 00199 if (userfield && ((userfielddata = alloca(strlen(cdr->userfield) * 2 + 1)) != NULL)) 00200 mysql_escape_string(userfielddata, cdr->userfield, strlen(cdr->userfield)); 00201 00202 /* Check for all alloca failures above at once */ 00203 #ifdef MYSQL_LOGUNIQUEID 00204 if ((!clid) || (!dcontext) || (!channel) || (!dstchannel) || (!lastapp) || (!lastdata) || (!uniqueid)) { 00205 #else 00206 if ((!clid) || (!dcontext) || (!channel) || (!dstchannel) || (!lastapp) || (!lastdata)) { 00207 #endif 00208 ast_log(LOG_ERROR, "cdr_mysql: Out of memory error (insert fails)\n"); 00209 ast_mutex_unlock(&mysql_lock); 00210 return -1; 00211 } 00212 00213 ast_log(LOG_DEBUG, "cdr_mysql: inserting a CDR record.\n"); 00214 00215 if (userfield && userfielddata) { 00216 #ifdef MYSQL_LOGUNIQUEID 00217 sprintf(sqlcmd, "INSERT INTO %s (calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,userfield) VALUES ('%s','%s','%s','%s','%s', '%s','%s','%s','%s',%i,%i,'%s',%i,'%s','%s','%s')", dbtable, timestr, clid, cdr->src, cdr->dst, dcontext, channel, dstchannel, lastapp, lastdata, cdr->duration, cdr->billsec, ast_cdr_disp2str(cdr->disposition), cdr->amaflags, cdr->accountcode, uniqueid, userfielddata); 00218 #else 00219 sprintf(sqlcmd, "INSERT INTO %s (calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,userfield) VALUES ('%s','%s','%s','%s','%s', '%s','%s','%s','%s',%i,%i,'%s',%i,'%s','%s')", dbtable, timestr, clid, cdr->src, cdr->dst, dcontext,channel, dstchannel, lastapp, lastdata, cdr->duration, cdr->billsec, ast_cdr_disp2str(cdr->disposition), cdr->amaflags, cdr->accountcode, userfielddata); 00220 #endif 00221 } else { 00222 #ifdef MYSQL_LOGUNIQUEID 00223 sprintf(sqlcmd, "INSERT INTO %s (calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid) VALUES ('%s','%s','%s','%s','%s', '%s','%s','%s','%s',%i,%i,'%s',%i,'%s','%s')", dbtable, timestr, clid, cdr->src, cdr->dst, dcontext,channel, dstchannel, lastapp, lastdata, cdr->duration, cdr->billsec, ast_cdr_disp2str(cdr->disposition), cdr->amaflags, cdr->accountcode, uniqueid); 00224 #else 00225 sprintf(sqlcmd, "INSERT INTO %s (calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode) VALUES ('%s','%s','%s','%s','%s', '%s','%s','%s','%s',%i,%i,'%s',%i,'%s')", dbtable, timestr, clid, cdr->src, cdr->dst, dcontext, channel, dstchannel, lastapp, lastdata, cdr->duration, cdr->billsec, ast_cdr_disp2str(cdr->disposition), cdr->amaflags, cdr->accountcode); 00226 #endif 00227 } 00228 00229 ast_log(LOG_DEBUG, "cdr_mysql: SQL command as follows: %s\n", sqlcmd); 00230 00231 if (connected) { 00232 if (mysql_real_query(&mysql, sqlcmd, strlen(sqlcmd))) { 00233 ast_log(LOG_ERROR, "mysql_cdr: Failed to insert into database: (%d) %s", mysql_errno(&mysql), mysql_error(&mysql)); 00234 mysql_close(&mysql); 00235 connected = 0; 00236 } else { 00237 records++; 00238 totalrecords++; 00239 } 00240 } 00241 ast_mutex_unlock(&mysql_lock); 00242 return 0; 00243 }
static int reload | ( | void | ) | [static] |
Definition at line 469 of file cdr_addon_mysql.c.
References ast_mutex_lock(), ast_mutex_unlock(), my_load_module(), and my_unload_module().
00470 { 00471 int ret; 00472 00473 ast_mutex_lock(&mysql_lock); 00474 my_unload_module(); 00475 ret = my_load_module(); 00476 ast_mutex_unlock(&mysql_lock); 00477 00478 return ret; 00479 }
static int unload_module | ( | void | ) | [static] |
Definition at line 464 of file cdr_addon_mysql.c.
References my_unload_module().
00465 { 00466 return my_unload_module(); 00467 }
struct ast_cli_entry cdr_mysql_status_cli [static] |
Initial value:
{ { "cdr", "mysql", "status", NULL }, handle_cdr_mysql_status, "Show connection status of cdr_mysql", cdr_mysql_status_help, NULL }
Definition at line 113 of file cdr_addon_mysql.c.
Referenced by my_load_module(), and my_unload_module().
char cdr_mysql_status_help[] [static] |
Initial value:
"Usage: cdr mysql status\n" " Shows current connection status for cdr_mysql\n"
Definition at line 71 of file cdr_addon_mysql.c.
char* config = "cdr_mysql.conf" [static] |
Definition at line 56 of file cdr_addon_mysql.c.
time_t connect_time = 0 [static] |
Definition at line 61 of file cdr_addon_mysql.c.
Referenced by handle_cdr_mysql_status(), my_load_module(), mysql_log(), mysql_reconnect(), pgsql_reconnect(), realtime_mysql_status(), and realtime_pgsql_status().
int connected = 0 [static] |
Definition at line 60 of file cdr_addon_mysql.c.
Referenced by aji_client_initialize(), aji_component_initialize(), cdr_pgsql_connect(), handle_cdr_mysql_status(), my_load_module(), my_unload_module(), mysql_log(), mysql_reconnect(), pgsql_test_connection(), and reload().
char * dbname = NULL [static] |
Definition at line 57 of file cdr_addon_mysql.c.
Referenced by aMYSQL_connect(), handle_cdr_mysql_status(), lookupcidname_exec(), my_load_module(), my_unload_module(), mysql_log(), mysql_reconnect(), parse_config(), pgsql_reconnect(), realtime_mysql_status(), and realtime_pgsql_status().
int dbname_alloc = 0 [static] |
Definition at line 58 of file cdr_addon_mysql.c.
Referenced by my_load_module(), and my_unload_module().
int dbport = 0 [static] |
Definition at line 59 of file cdr_addon_mysql.c.
Referenced by handle_cdr_mysql_status(), my_load_module(), my_unload_module(), mysql_log(), mysql_reconnect(), parse_config(), pgsql_reconnect(), realtime_mysql_status(), and realtime_pgsql_status().
char * dbsock = NULL [static] |
Definition at line 57 of file cdr_addon_mysql.c.
Referenced by handle_cdr_mysql_status(), my_load_module(), my_unload_module(), mysql_log(), mysql_reconnect(), parse_config(), pgsql_reconnect(), realtime_mysql_status(), and realtime_pgsql_status().
int dbsock_alloc = 0 [static] |
Definition at line 58 of file cdr_addon_mysql.c.
Referenced by my_load_module(), and my_unload_module().
char * dbtable = NULL [static] |
Definition at line 57 of file cdr_addon_mysql.c.
Referenced by handle_cdr_mysql_status(), my_load_module(), my_unload_module(), and mysql_log().
int dbtable_alloc = 0 [static] |
Definition at line 58 of file cdr_addon_mysql.c.
Referenced by my_load_module(), and my_unload_module().
char * dbuser = NULL [static] |
Definition at line 57 of file cdr_addon_mysql.c.
Referenced by aMYSQL_connect(), handle_cdr_mysql_status(), my_load_module(), my_unload_module(), mysql_log(), mysql_reconnect(), parse_config(), pgsql_reconnect(), realtime_mysql_status(), and realtime_pgsql_status().
int dbuser_alloc = 0 [static] |
Definition at line 58 of file cdr_addon_mysql.c.
Referenced by my_load_module(), and my_unload_module().
char* desc = "MySQL CDR Backend" [static] |
Definition at line 54 of file cdr_addon_mysql.c.
char* hostname = NULL [static] |
Definition at line 57 of file cdr_addon_mysql.c.
int hostname_alloc = 0 [static] |
Definition at line 58 of file cdr_addon_mysql.c.
Referenced by my_load_module(), and my_unload_module().
MYSQL mysql [static] |
Definition at line 69 of file cdr_addon_mysql.c.
Referenced by aMYSQL_connect(), aMYSQL_disconnect(), aMYSQL_query(), config_mysql(), load_module(), my_load_module(), my_unload_module(), mysql_log(), mysql_reconnect(), realtime_multi_mysql(), realtime_mysql(), reload(), unload_module(), and update_mysql().
char* name = "mysql" [static] |
Definition at line 55 of file cdr_addon_mysql.c.
char * password = NULL [static] |
Definition at line 57 of file cdr_addon_mysql.c.
Referenced by auth_exec(), authenticate(), load_odbc_config(), my_load_module(), my_unload_module(), mysql_log(), and vm_authenticate().
int password_alloc = 0 [static] |
Definition at line 58 of file cdr_addon_mysql.c.
Referenced by my_load_module(), and my_unload_module().
int records = 0 [static] |
Definition at line 62 of file cdr_addon_mysql.c.
Referenced by handle_cdr_mysql_status(), my_load_module(), my_unload_module(), and mysql_log().
unsigned int timeout = 0 [static] |
Definition at line 65 of file cdr_addon_mysql.c.
Referenced by action_originate(), action_timeout(), action_waitevent(), async_wait(), cache_lookup_internal(), cache_save(), cache_save_hint(), conf_run(), find_cache(), handle_autohangup(), handle_getdata(), handle_getoption(), manager_park(), mgcp_ss(), misdn_check_l2l1(), monitor_dial(), monitor_main(), mp3_exec(), my_load_module(), mysql_log(), nv_detectfax_exec(), parkandannounce_exec(), pbx_builtin_waitexten(), read_exec(), senddtmf_exec(), skinny_ss(), sla_process_timers(), speech_background(), ss_thread(), and waitforsilence_exec().
int totalrecords = 0 [static] |
Definition at line 63 of file cdr_addon_mysql.c.
Referenced by handle_cdr_mysql_status(), and mysql_log().
int userfield = 0 [static] |
Definition at line 64 of file cdr_addon_mysql.c.
Referenced by action_setcdruserfield(), my_load_module(), mysql_log(), and pgsql_log().