[Home]

Summary:ASTERISK-20800: 'module reload app_playback.so' won't load say.conf if it didn't exist during module's first load
Reporter:Paul (pgoergler)Labels:
Date Opened:2012-12-14 02:24:13.000-0600Date Closed:2013-02-18 22:22:12.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Applications/app_playback
Versions:1.8.11.1 Frequency of
Occurrence
Constant
Related
Issues:
Environment:debian Asterisk 1.8.11.1-1digium1~squeeze built by pbuilder @ nighthawk on a x86_64 running Linux on 2012-04-25 17:23:34 UTCAttachments:
Description:At the first load of app_playback.so if there isn't /etc/asterisk/say.conf it never will be loaded:


in the source of app_playback i can see:
{noformat}
[...]

00486 static int reload(void)
00487 {
00488    struct ast_variable *v;
00489    struct ast_flags config_flags = { CONFIG_FLAG_FILEUNCHANGED };
00490    struct ast_config *newcfg;
00491
00492    if ((newcfg = ast_config_load("say.conf", config_flags)) == CONFIG_STATUS_FILEUNCHANGED) {
00493       return 0;
00494    } else if (newcfg == CONFIG_STATUS_FILEINVALID) {
00495       ast_log(LOG_ERROR, "Config file say.conf is in an invalid format.  Aborting.\n");
00496       return 0;
00497    }
00498
00499    if (say_cfg) {
00500       ast_config_destroy(say_cfg);
00501       ast_log(LOG_NOTICE, "Reloading say.conf\n");
00502       say_cfg = newcfg;
00503    }
00504
00505    if (say_cfg) {
00506       for (v = ast_variable_browse(say_cfg, "general"); v ; v = v->next) {
00507             if (ast_extension_match(v->name, "mode")) {
00508             say_init_mode(v->value);
00509             break;
00510          }
00511       }
00512    }
00513    
00514    /*
00515     * XXX here we should sort rules according to the same order
00516     * we have in pbx.c so we have the same matching behaviour.
00517     */
00518    return 0;
00519 }
{noformat}

In reload function new_cfg is loaded only if say_cfg is already != NULL
so if the file is missing before the first load, say_cfg = NULL


inverting line 502 & 503 should solve the issue.

{noformat}
00499    if (say_cfg) {
00500       ast_config_destroy(say_cfg);
00501       ast_log(LOG_NOTICE, "Reloading say.conf\n");
00503    }
00502       say_cfg = newcfg;
{noformat}
Comments:By: Matt Jordan (mjordan) 2012-12-31 10:53:20.591-0600

Do you want to provide the fix as a patch after signing a license contributor agreement? That would ensure that you get credit if the patch is accepted.