Eigene asterisk module schreiben: Unterschied zwischen den Versionen

Aus metasec wiki
Wechseln zu: Navigation, Suche
(Die Seite wurde neu angelegt: „=Grundgerüst= =Configdateien= <pre> struct ast_config *cfg; struct ast_variable *var; * load the configfile: cfg = ast_conf…“)
(kein Unterschied)

Version vom 12. Juni 2010, 14:41 Uhr

Grundgerüst

Configdateien


    struct ast_config   *cfg;
    struct ast_variable *var;

    /*
     *  load the configfile
     */
    cfg = ast_config_load("metasec.conf");
    if ( !cfg ) {
        ast_log(LOG_WARNING, "no metasec_stat.conf, exiting... \n");
        return RESULT_SUCCESS;
    }

    for ( var = ast_variable_browse(cfg, "general"); var; var = var->next ) {

        if (option_verbose > 8)
            ast_log(LOG_WARNING, "cfg file: %s => %s \n", var->name, var->value);

        if ( strstr(var->name, "dnd_db_family" ) )
            sprintf(dnd_db_family,"%s",var->value);

        else if ( strstr(var->name, "dnd_exec_cmd") && !ast_strlen_zero(var->value) )
            sprintf(dnd_exec_cmd,"%s",var->value);


    }
    ast_config_destroy(cfg);