Exemple #1
0
static int unload_module(void)
{
	if (db)
		sqlite_close(db);
	ast_cdr_unregister(name);
	return 0;
}
static int unload_module(void *mod)
{
	if (mf)
		fclose(mf);
	ast_cdr_unregister(name);
	return 0;
}
Exemple #3
0
static int odbc_unload_module(void)
{
	ast_mutex_lock(&odbc_lock);
	if (connected) {
		if (option_verbose > 10)
			ast_verbose( VERBOSE_PREFIX_4 "cdr_odbc: Disconnecting from %s\n", dsn);
		SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt);
		odbc_disconnect();
	}
	if (dsn) {
		if (option_verbose > 10)
			ast_verbose( VERBOSE_PREFIX_4 "cdr_odbc: free dsn\n");
		free(dsn);
	}
	if (username) {
		if (option_verbose > 10)
			ast_verbose( VERBOSE_PREFIX_4 "cdr_odbc: free username\n");
		free(username);
	}
	if (password) {
		if (option_verbose > 10)
			ast_verbose( VERBOSE_PREFIX_4 "cdr_odbc: free password\n");
		free(password);
	}
	if (table) {
		if (option_verbose > 10)
			ast_verbose( VERBOSE_PREFIX_4 "cdr_odbc: free table\n");
		free(table);
	}

	ast_cdr_unregister(name);
	ast_mutex_unlock(&odbc_lock);
	return 0;
}
Exemple #4
0
static int unload_module(void)
{
	ast_cdr_unregister(name);
	if (customfields)
		ast_free(customfields);

	return 0;
}
Exemple #5
0
static int unload_module(void)
{
	ast_cdr_unregister(name);
	if (rh) {
		rc_destroy(rh);
		rh = NULL;
	}
	return 0;
}
Exemple #6
0
static int unload_module(void)
{
	if (ast_cdr_unregister(name)) {
		return -1;
	}

	loaded = 0;
	return 0;
}
Exemple #7
0
static int unload_module(void) {
	if (ast_cdr_unregister(name)) {
		return -1;
	}

	ast_free(bs_host);
	ast_free(bs_tube);

	return 0;
}
Exemple #8
0
static int unload_module(void)
{
	if (ast_cdr_unregister(name)) {
		return -1;
	}

	if (db) {
		sqlite_close(db);
	}
	return 0;
}
Exemple #9
0
static int reload(void)
{
	if (load_config(1)) {
		loaded = 1;
	} else {
		loaded = 0;
		ast_log(LOG_WARNING, "No [csv] section in cdr.conf.  Unregistering backend.\n");
		ast_cdr_unregister(name);
	}

	return 0;
}
Exemple #10
0
static int load_module(void) {
	if (ast_cdr_register(name, "Asterisk CDR Beanstalkd Backend", beanstalk_put)) {
		return AST_MODULE_LOAD_DECLINE;
	}

	if (load_config(0)) {
		ast_cdr_unregister(name);
		return AST_MODULE_LOAD_DECLINE;
	}

	return AST_MODULE_LOAD_SUCCESS;
}
Exemple #11
0
static int unload_module(void)
{
	if (ast_cdr_unregister(NAME))
		return -1;
	if (dbname)
		ast_free(dbname);
	if (dbcollection)
		ast_free(dbcollection);
	if (dbpool)
		mongoc_client_pool_destroy(dbpool);
	return 0;
}
Exemple #12
0
static int unload_module(void)
{
    ast_cdr_unregister(name);

    if (dsn) {
        ast_verb(11, "cdr_odbc: free dsn\n");
        ast_free(dsn);
    }
    if (table) {
        ast_verb(11, "cdr_odbc: free table\n");
        ast_free(table);
    }

    return 0;
}
Exemple #13
0
static int unload_module(void)
{
	if (ast_cdr_unregister(name)) {
		return -1;
	}

	if (dsn) {
		ast_free(dsn);
	}
	if (table) {
		ast_free(table);
	}

	return 0;
}
static int tds_unload_module(void)
{
	mssql_disconnect();

	ast_cdr_unregister(name);

	if (hostname) free(hostname);
	if (dbname) free(dbname);
	if (dbuser) free(dbuser);
	if (password) free(password);
	if (charset) free(charset);
	if (language) free(language);

	return 0;
}
Exemple #15
0
static int my_unload_module(void)
{ 
	PQfinish(conn);
	if (pghostname)
		free(pghostname);
	if (pgdbname)
		free(pgdbname);
	if (pgdbuser)
		free(pgdbuser);
	if (pgpassword)
		free(pgpassword);
	if (pgdbport)
		free(pgdbport);
	if (table)
		free(table);
	ast_cdr_unregister(name);
	return 0;
}
Exemple #16
0
static int odbc_unload_module(void)
{
	ast_mutex_lock(&odbc_lock);
	if (connected) {
		if (option_verbose > 10)
			ast_verbose( VERBOSE_PREFIX_4 "cdr_odbc: Disconnecting from %s\n", dsn);
		SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt);
		SQLDisconnect(ODBC_con);
		SQLFreeHandle(SQL_HANDLE_DBC, ODBC_con);
		SQLFreeHandle(SQL_HANDLE_ENV, ODBC_env);
		connected = 0;
	}
	if (dsn && dsn_alloc) {
		if (option_verbose > 10)
			ast_verbose( VERBOSE_PREFIX_4 "cdr_odbc: free dsn\n");
		free(dsn);
		dsn = NULL;
		dsn_alloc = 0;
	}
	if (username && username_alloc) {
		if (option_verbose > 10)
			ast_verbose( VERBOSE_PREFIX_4 "cdr_odbc: free username\n");
		free(username);
		username = NULL;
		username_alloc = 0;
	}
	if (password && password_alloc) {
		if (option_verbose > 10)
			ast_verbose( VERBOSE_PREFIX_4 "cdr_odbc: free password\n");
		free(password);
		password = NULL;
		password_alloc = 0;
	}
	loguniqueid = 0;

	ast_cdr_unregister(name);
	ast_mutex_unlock(&odbc_lock);
	return 0;
}
int unload_module(void)
{
	int res = 0;
	do_reload = 1;

	ast_config_engine_deregister(&sqlite_engine);
	if (has_cdr) {
		ast_cdr_unregister(cdr_name);
		ast_verbose(VERBOSE_PREFIX_2 "SQLite CDR Disabled\n");
	}

	if (has_cli) {
		ast_verbose(VERBOSE_PREFIX_2 "SQLite CLI Disabled\n");
		ast_cli_unregister(&cli_sqlite1);  
		ast_cli_unregister(&cli_sqlite2);
		ast_cli_unregister(&cli_sqlite3);  
		ast_cli_unregister(&cli_sqlite4);  
		ast_cli_unregister(&cli_sqlite5);  
		ast_cli_unregister(&cli_sqlite6);  
		ast_cli_unregister(&cli_sqlite7);  
		ast_cli_unregister(&cli_sqlite8);  
		ast_cli_unregister(&cli_sqlite9);  
	}
		
	ast_unregister_application(app);




	if (has_switch) {
		ast_verbose(VERBOSE_PREFIX_2 "SQLite Switch Disabled\n");
		ast_unregister_switch(&sqlite_switch);
		sqlite3HashClear(&extens);
	}
	
	return res;
}
Exemple #18
0
int unload_module(void)
{
	ast_cdr_unregister(name);
	return 0;
}
Exemple #19
0
static int _unload_module(int reload)
{
	ast_cdr_unregister(name);
	return 0;
}
Exemple #20
0
static int odbc_load_module(int reload)
{
    int res = 0;
    struct ast_config *cfg;
    struct ast_variable *var;
    const char *tmp;
    struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };

    do {
        cfg = ast_config_load(config_file, config_flags);
        if (!cfg || cfg == CONFIG_STATUS_FILEINVALID) {
            ast_log(LOG_WARNING, "cdr_odbc: Unable to load config for ODBC CDR's: %s\n", config_file);
            res = AST_MODULE_LOAD_DECLINE;
            break;
        } else if (cfg == CONFIG_STATUS_FILEUNCHANGED)
            break;

        var = ast_variable_browse(cfg, "global");
        if (!var) {
            /* nothing configured */
            break;
        }

        if ((tmp = ast_variable_retrieve(cfg, "global", "dsn")) == NULL) {
            ast_log(LOG_WARNING, "cdr_odbc: dsn not specified.  Assuming asteriskdb\n");
            tmp = "asteriskdb";
        }
        if (dsn)
            ast_free(dsn);
        dsn = ast_strdup(tmp);
        if (dsn == NULL) {
            res = -1;
            break;
        }

        if (((tmp = ast_variable_retrieve(cfg, "global", "dispositionstring"))) && ast_true(tmp))
            ast_set_flag(&config, CONFIG_DISPOSITIONSTRING);
        else
            ast_clear_flag(&config, CONFIG_DISPOSITIONSTRING);

        if (((tmp = ast_variable_retrieve(cfg, "global", "loguniqueid"))) && ast_true(tmp)) {
            ast_set_flag(&config, CONFIG_LOGUNIQUEID);
            ast_debug(1, "cdr_odbc: Logging uniqueid\n");
        } else {
            ast_clear_flag(&config, CONFIG_LOGUNIQUEID);
            ast_debug(1, "cdr_odbc: Not logging uniqueid\n");
        }

        if (((tmp = ast_variable_retrieve(cfg, "global", "usegmtime"))) && ast_true(tmp)) {
            ast_set_flag(&config, CONFIG_USEGMTIME);
            ast_debug(1, "cdr_odbc: Logging in GMT\n");
        } else {
            ast_clear_flag(&config, CONFIG_USEGMTIME);
            ast_debug(1, "cdr_odbc: Logging in local time\n");
        }

        if (((tmp = ast_variable_retrieve(cfg, "global", "hrtime"))) && ast_true(tmp)) {
            ast_set_flag(&config, CONFIG_HRTIME);
            ast_debug(1, "cdr_odbc: Logging billsec and duration fields as floats\n");
        } else {
            ast_clear_flag(&config, CONFIG_HRTIME);
            ast_debug(1, "cdr_odbc: Logging billsec and duration fields as integers\n");
        }

        if ((tmp = ast_variable_retrieve(cfg, "global", "table")) == NULL) {
            ast_log(LOG_WARNING, "cdr_odbc: table not specified.  Assuming cdr\n");
            tmp = "cdr";
        }
        if (table)
            ast_free(table);
        table = ast_strdup(tmp);
        if (table == NULL) {
            res = -1;
            break;
        }

        ast_verb(3, "cdr_odbc: dsn is %s\n", dsn);
        ast_verb(3, "cdr_odbc: table is %s\n", table);

        if (!ast_test_flag(&config, CONFIG_REGISTERED)) {
            res = ast_cdr_register(name, ast_module_info->description, odbc_log);
            if (res) {
                ast_log(LOG_ERROR, "cdr_odbc: Unable to register ODBC CDR handling\n");
            } else {
                ast_set_flag(&config, CONFIG_REGISTERED);
            }
        }
    } while (0);

    if (ast_test_flag(&config, CONFIG_REGISTERED) && (!cfg || dsn == NULL || table == NULL)) {
        ast_cdr_unregister(name);
        ast_clear_flag(&config, CONFIG_REGISTERED);
    }

    if (cfg && cfg != CONFIG_STATUS_FILEUNCHANGED && cfg != CONFIG_STATUS_FILEINVALID) {
        ast_config_destroy(cfg);
    }
    return res;
}
Exemple #21
0
static int load_config(int reload)
{
	char *cat = NULL;
	struct ast_config *cfg;
	struct ast_variable *v;
	struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
	int newenablecdr = 0;

	cfg = ast_config_load(CONF_FILE, config_flags);
	if (cfg == CONFIG_STATUS_FILEUNCHANGED) {
		return 0;
	}

	if (cfg == CONFIG_STATUS_FILEINVALID) {
		ast_log(LOG_ERROR, "Config file '%s' could not be parsed\n", CONF_FILE);
		return -1;
	}

	if (!cfg) {
		/* Standard configuration */
		ast_log(LOG_WARNING, "Failed to load configuration file. Module not activated.\n");
		if (enablecdr)
			ast_cdr_unregister(name);
		enablecdr = 0;
		return -1;
	}

	if (reload) {
		ast_rwlock_wrlock(&customfields_lock);
	}

	if (reload && customfields) {
		ast_free(customfields);
		customfields = NULL;
	}

	while ( (cat = ast_category_browse(cfg, cat)) ) {
		if (!strcasecmp(cat, "general")) {
			v = ast_variable_browse(cfg, cat);
			while (v) {
				if (!strcasecmp(v->name, "enabled"))
					newenablecdr = ast_true(v->value);

				v = v->next;
			}
		} else if (!strcasecmp(cat, "mappings")) {
			customfields = ast_str_create(CUSTOM_FIELDS_BUF_SIZE);
			v = ast_variable_browse(cfg, cat);
			while (v) {
				if (customfields && !ast_strlen_zero(v->name) && !ast_strlen_zero(v->value)) {
					if ((ast_str_strlen(customfields) + strlen(v->value) + strlen(v->name) + 14) < ast_str_size(customfields)) {
						ast_str_append(&customfields, -1, "%s: ${CDR(%s)}\r\n", v->value, v->name);
						ast_log(LOG_NOTICE, "Added mapping %s: ${CDR(%s)}\n", v->value, v->name);
					} else {
						ast_log(LOG_WARNING, "No more buffer space to add other custom fields\n");
						break;
					}

				}
				v = v->next;
			}
		}
	}

	if (reload) {
		ast_rwlock_unlock(&customfields_lock);
	}

	ast_config_destroy(cfg);

	if (enablecdr && !newenablecdr)
		ast_cdr_unregister(name);
	else if (!enablecdr && newenablecdr)
		ast_cdr_register(name, "Asterisk Manager Interface CDR Backend", manager_log);
	enablecdr = newenablecdr;

	return 0;
}
Exemple #22
0
static int unload_module(void)
{
	ast_cdr_unregister(name);
	loaded = 0;
	return 0;
}