[asterisk-bugs] [JIRA] (ASTERISK-20845) module reload app_playback.so don't load say.conf

Rusty Newton (JIRA) noreply at issues.asterisk.org
Fri Dec 28 14:03:45 CST 2012


Rusty Newton created ASTERISK-20845:
---------------------------------------

             Summary: module reload app_playback.so don't load say.conf
                 Key: ASTERISK-20845
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-20845
             Project: Asterisk
          Issue Type: Bug
      Security Level: None
          Components: Applications/app_playback
    Affects Versions: 1.8.11.1
         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 UTC
            Reporter: Paul


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}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the asterisk-bugs mailing list