--- channels/chan_alsa.c (svn) +++ channels/chan_alsa.c (working copy) @@ -223,7 +223,7 @@ if (cursound == -1) return 0; - + res = total; if (sampsent < sounds[cursound].samplen) { myoff = 0; @@ -259,7 +259,7 @@ return 0; } } - + if (res == 0 || !frame) return 0; @@ -782,7 +782,7 @@ static struct ast_channel *alsa_new(struct chan_alsa_pvt *p, int state) { struct ast_channel *tmp = NULL; - + if (!(tmp = ast_channel_alloc(1))) return NULL; @@ -1299,35 +1299,36 @@ memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf)); strcpy(mohinterpret, "default"); + if (!(cfg = ast_config_load(config))) + return AST_MODULE_LOAD_DECLINE; - if ((cfg = ast_config_load(config))) { - v = ast_variable_browse(cfg, "general"); - for (; v; v = v->next) { - /* handle jb conf */ - if (!ast_jb_read_conf(&global_jbconf, v->name, v->value)) - continue; + v = ast_variable_browse(cfg, "general"); + for (; v; v = v->next) { + /* handle jb conf */ + if (!ast_jb_read_conf(&global_jbconf, v->name, v->value)) + continue; - if (!strcasecmp(v->name, "autoanswer")) - autoanswer = ast_true(v->value); - else if (!strcasecmp(v->name, "silencesuppression")) - silencesuppression = ast_true(v->value); - else if (!strcasecmp(v->name, "silencethreshold")) - silencethreshold = atoi(v->value); - else if (!strcasecmp(v->name, "context")) - ast_copy_string(context, v->value, sizeof(context)); - else if (!strcasecmp(v->name, "language")) - ast_copy_string(language, v->value, sizeof(language)); - else if (!strcasecmp(v->name, "extension")) - ast_copy_string(exten, v->value, sizeof(exten)); - else if (!strcasecmp(v->name, "input_device")) - ast_copy_string(indevname, v->value, sizeof(indevname)); - else if (!strcasecmp(v->name, "output_device")) - ast_copy_string(outdevname, v->value, sizeof(outdevname)); - else if (!strcasecmp(v->name, "mohinterpret")) - ast_copy_string(mohinterpret, v->value, sizeof(mohinterpret)); - } - ast_config_destroy(cfg); + if (!strcasecmp(v->name, "autoanswer")) + autoanswer = ast_true(v->value); + else if (!strcasecmp(v->name, "silencesuppression")) + silencesuppression = ast_true(v->value); + else if (!strcasecmp(v->name, "silencethreshold")) + silencethreshold = atoi(v->value); + else if (!strcasecmp(v->name, "context")) + ast_copy_string(context, v->value, sizeof(context)); + else if (!strcasecmp(v->name, "language")) + ast_copy_string(language, v->value, sizeof(language)); + else if (!strcasecmp(v->name, "extension")) + ast_copy_string(exten, v->value, sizeof(exten)); + else if (!strcasecmp(v->name, "input_device")) + ast_copy_string(indevname, v->value, sizeof(indevname)); + else if (!strcasecmp(v->name, "output_device")) + ast_copy_string(outdevname, v->value, sizeof(outdevname)); + else if (!strcasecmp(v->name, "mohinterpret")) + ast_copy_string(mohinterpret, v->value, sizeof(mohinterpret)); } + + ast_config_destroy(cfg); res = pipe(sndcmd); if (res) { ast_log(LOG_ERROR, "Unable to create pipe\n"); @@ -1339,7 +1340,7 @@ ast_verbose(VERBOSE_PREFIX_2 "No sound card detected -- console channel will be unavailable\n"); ast_verbose(VERBOSE_PREFIX_2 "Turn off ALSA support by adding 'noload=chan_alsa.so' in /etc/asterisk/modules.conf\n"); } - return 0; + return AST_MODULE_LOAD_DECLINE; } res = ast_channel_register(&alsa_tech);