int load_module(void) { int res; res = cw_cdr_register(name, desc, csv_log); if (res) cw_log(LOG_ERROR, "Unable to register CSV CDR handling\n"); return res; }
int load_module(void) { int res = 0; if (!load_config(0)) { res = cw_cdr_register(name, desc, custom_log); if (res) cw_log(LOG_ERROR, "Unable to register custom CDR handling\n"); } return res; }
int load_module(void) { int res; /* Configuration file */ loadconfigurationfile(); res = cw_cdr_register(name, desc, manager_log); if (res) { cw_log(LOG_ERROR, "Unable to register CallWeaver.org Call Manager CDR handling\n"); } return res; }
int load_module(void) { char *zErr; char fn[PATH_MAX]; int res; /* is the database there? */ snprintf(fn, sizeof(fn), "%s/cdr.db", cw_config_CW_LOG_DIR); sqlite3_open(fn, &db); if (!db) { cw_log(LOG_ERROR, "cdr_sqlite: %s\n", zErr); free(zErr); return -1; } /* is the table there? */ res = sqlite3_exec(db, "SELECT COUNT(AcctId) FROM cdr;", NULL, NULL, NULL); if (res) { res = sqlite3_exec(db, sql_create_table, NULL, NULL, &zErr); if (res) { cw_log(LOG_ERROR, "cdr_sqlite: Unable to create table 'cdr': %s\n", zErr); free(zErr); goto err; } /* TODO: here we should probably create an index */ } res = cw_cdr_register(name, desc, sqlite_log); if (res) { cw_log(LOG_ERROR, "Unable to register SQLite CDR handling\n"); goto err; } if (db) sqlite3_close(db); return 0; err: if (db) sqlite3_close(db); return -1; }