[asterisk-commits] musiconhold: Only warn if music class is not found in memory... (asterisk[master])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Mar 25 05:52:05 CDT 2016
Joshua Colp has submitted this change and it was merged.
Change subject: musiconhold: Only warn if music class is not found in memory and database.
......................................................................
musiconhold: Only warn if music class is not found in memory and database.
The log message when a MusicOnHold music class was not found was changed
from debug level to WARNING level in Asterisk 11.19 and 13.5. For those
using realtime musiconhold, this message is wrong because it warns
before checking the database.
This changeset delays the warning until after the database has been
checked.
Reported-by: Conrad de Wet
ASTERISK-25444 #close
Change-Id: I6cfb2db2f9cfbd2bb3d30566ecae361c4abf6dbf
---
M res/res_musiconhold.c
1 file changed, 15 insertions(+), 2 deletions(-)
Approvals:
Kevin Harwell: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, approved; Verified
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index 4e50563..f124d58 100644
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -1379,6 +1379,18 @@
return class;
}
+static struct ast_variable *load_realtime_musiconhold(const char *name)
+{
+ struct ast_variable *var = ast_load_realtime("musiconhold", "name", name, SENTINEL);
+ if (!var) {
+ ast_log(LOG_WARNING,
+ "Music on Hold class '%s' not found in memory/database. "
+ "Verify your configuration.\n",
+ name);
+ }
+ return var;
+}
+
static int local_ast_moh_start(struct ast_channel *chan, const char *mclass, const char *interpclass)
{
struct mohclass *mohclass = NULL;
@@ -1387,6 +1399,7 @@
int res = 0;
int i;
int realtime_possible = ast_check_realtime("musiconhold");
+ int warn_if_not_in_memory = !realtime_possible;
const char *classes[] = {NULL, NULL, interpclass, "default"};
if (ast_test_flag(global_flags, MOH_PREFERCHANNELCLASS)) {
@@ -1414,9 +1427,9 @@
for (i = 0; i < ARRAY_LEN(classes); ++i) {
if (!ast_strlen_zero(classes[i])) {
- mohclass = get_mohbyname(classes[i], 1, 0);
+ mohclass = get_mohbyname(classes[i], warn_if_not_in_memory, 0);
if (!mohclass && realtime_possible) {
- var = ast_load_realtime("musiconhold", "name", classes[i], SENTINEL);
+ var = load_realtime_musiconhold(classes[i]);
}
if (mohclass || var) {
break;
--
To view, visit https://gerrit.asterisk.org/2457
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I6cfb2db2f9cfbd2bb3d30566ecae361c4abf6dbf
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Walter Doekes <walter+asterisk at wjd.nu>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
More information about the asterisk-commits
mailing list