mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-19 11:42:27 +00:00
issue #5766
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7116 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
2005-11-16 Kevin P. Fleming <kpfleming@limerick.digium.com>
|
2005-11-16 Kevin P. Fleming <kpfleming@limerick.digium.com>
|
||||||
|
|
||||||
|
* res/res_musiconhold.c: don't spit out incorrect log messages (and leak memory) during reload (issue #5766)
|
||||||
|
|
||||||
* channels/chan_sip.c (process_sdp): don't pass video codec number into ast_getformatname(), it is not valid input for that function (issue #5764)
|
* channels/chan_sip.c (process_sdp): don't pass video codec number into ast_getformatname(), it is not valid input for that function (issue #5764)
|
||||||
|
|
||||||
* pbx/pbx_ael.c (match_assignment): properly parse equal signs surrounded by whitespace (issue #5761)
|
* pbx/pbx_ael.c (match_assignment): properly parse equal signs surrounded by whitespace (issue #5761)
|
||||||
|
@@ -785,14 +785,18 @@ static int moh_scan_files(struct mohclass *class) {
|
|||||||
return class->total_files;
|
return class->total_files;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int moh_register(struct mohclass *moh)
|
static int moh_register(struct mohclass *moh, int reload)
|
||||||
{
|
{
|
||||||
#ifdef ZAPATA_MOH
|
#ifdef ZAPATA_MOH
|
||||||
int x;
|
int x;
|
||||||
#endif
|
#endif
|
||||||
ast_mutex_lock(&moh_lock);
|
ast_mutex_lock(&moh_lock);
|
||||||
if (get_mohbyname(moh->name)) {
|
if (get_mohbyname(moh->name)) {
|
||||||
ast_log(LOG_WARNING, "Music on Hold class '%s' already exists\n", moh->name);
|
if (reload) {
|
||||||
|
ast_log(LOG_DEBUG, "Music on Hold class '%s' left alone from initial load.\n", moh->name);
|
||||||
|
} else {
|
||||||
|
ast_log(LOG_WARNING, "Music on Hold class '%s' already exists\n", moh->name);
|
||||||
|
}
|
||||||
free(moh);
|
free(moh);
|
||||||
ast_mutex_unlock(&moh_lock);
|
ast_mutex_unlock(&moh_lock);
|
||||||
return -1;
|
return -1;
|
||||||
@@ -914,7 +918,7 @@ static struct mohclass *moh_class_malloc(void)
|
|||||||
return class;
|
return class;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int load_moh_classes(void)
|
static int load_moh_classes(int reload)
|
||||||
{
|
{
|
||||||
struct ast_config *cfg;
|
struct ast_config *cfg;
|
||||||
struct ast_variable *var;
|
struct ast_variable *var;
|
||||||
@@ -979,7 +983,9 @@ static int load_moh_classes(void)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
moh_register(class);
|
/* Don't leak a class when it's already registered */
|
||||||
|
moh_register(class, reload);
|
||||||
|
|
||||||
numclasses++;
|
numclasses++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1011,7 +1017,7 @@ static int load_moh_classes(void)
|
|||||||
if (args)
|
if (args)
|
||||||
ast_copy_string(class->args, args, sizeof(class->args));
|
ast_copy_string(class->args, args, sizeof(class->args));
|
||||||
|
|
||||||
moh_register(class);
|
moh_register(class, reload);
|
||||||
numclasses++;
|
numclasses++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1039,7 +1045,7 @@ static int load_moh_classes(void)
|
|||||||
if (args)
|
if (args)
|
||||||
ast_copy_string(class->args, args, sizeof(class->args));
|
ast_copy_string(class->args, args, sizeof(class->args));
|
||||||
|
|
||||||
moh_register(class);
|
moh_register(class, reload);
|
||||||
numclasses++;
|
numclasses++;
|
||||||
}
|
}
|
||||||
var = var->next;
|
var = var->next;
|
||||||
@@ -1103,7 +1109,7 @@ static int moh_cli(int fd, int argc, char *argv[])
|
|||||||
|
|
||||||
moh_on_off(0);
|
moh_on_off(0);
|
||||||
ast_moh_destroy();
|
ast_moh_destroy();
|
||||||
x = load_moh_classes();
|
x = load_moh_classes(1);
|
||||||
moh_on_off(1);
|
moh_on_off(1);
|
||||||
ast_cli(fd, "\n%d class%s reloaded.\n", x, x == 1 ? "" : "es");
|
ast_cli(fd, "\n%d class%s reloaded.\n", x, x == 1 ? "" : "es");
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1152,11 +1158,11 @@ static struct ast_cli_entry cli_moh_classes_show = { { "moh", "classes", "show"
|
|||||||
|
|
||||||
static struct ast_cli_entry cli_moh_files_show = { { "moh", "files", "show"}, cli_files_show, "List MOH file-based classes", "Lists all loaded file-based MOH classes and their files", NULL};
|
static struct ast_cli_entry cli_moh_files_show = { { "moh", "files", "show"}, cli_files_show, "List MOH file-based classes", "Lists all loaded file-based MOH classes and their files", NULL};
|
||||||
|
|
||||||
static int init_classes(void)
|
static int init_classes(int reload)
|
||||||
{
|
{
|
||||||
struct mohclass *moh;
|
struct mohclass *moh;
|
||||||
|
|
||||||
if (!load_moh_classes()) /* Load classes from config */
|
if (!load_moh_classes(reload)) /* Load classes from config */
|
||||||
return 0; /* Return if nothing is found */
|
return 0; /* Return if nothing is found */
|
||||||
moh = mohclasses;
|
moh = mohclasses;
|
||||||
while (moh) {
|
while (moh) {
|
||||||
@@ -1185,7 +1191,7 @@ int load_module(void)
|
|||||||
if (!res)
|
if (!res)
|
||||||
res = ast_register_application(app4, moh4_exec, synopsis4, descrip4);
|
res = ast_register_application(app4, moh4_exec, synopsis4, descrip4);
|
||||||
|
|
||||||
if (!init_classes()) { /* No music classes configured, so skip it */
|
if (!init_classes(0)) { /* No music classes configured, so skip it */
|
||||||
ast_log(LOG_WARNING, "No music on hold classes configured, disabling music on hold.");
|
ast_log(LOG_WARNING, "No music on hold classes configured, disabling music on hold.");
|
||||||
} else {
|
} else {
|
||||||
ast_install_music_functions(local_ast_moh_start, local_ast_moh_stop, local_ast_moh_cleanup);
|
ast_install_music_functions(local_ast_moh_start, local_ast_moh_stop, local_ast_moh_cleanup);
|
||||||
@@ -1196,7 +1202,7 @@ int load_module(void)
|
|||||||
|
|
||||||
int reload(void)
|
int reload(void)
|
||||||
{
|
{
|
||||||
if (init_classes())
|
if (init_classes(1))
|
||||||
ast_install_music_functions(local_ast_moh_start, local_ast_moh_stop, local_ast_moh_cleanup);
|
ast_install_music_functions(local_ast_moh_start, local_ast_moh_stop, local_ast_moh_cleanup);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user