aboutsummaryrefslogtreecommitdiffstats
path: root/testing/asterisk/ASTERISK-18977.patch
diff options
context:
space:
mode:
Diffstat (limited to 'testing/asterisk/ASTERISK-18977.patch')
-rw-r--r--testing/asterisk/ASTERISK-18977.patch63
1 files changed, 63 insertions, 0 deletions
diff --git a/testing/asterisk/ASTERISK-18977.patch b/testing/asterisk/ASTERISK-18977.patch
new file mode 100644
index 0000000000..fffce032cd
--- /dev/null
+++ b/testing/asterisk/ASTERISK-18977.patch
@@ -0,0 +1,63 @@
+--- a/res/res_musiconhold.c.orig
++++ b/res/res_musiconhold.c
+@@ -158,6 +158,7 @@
+ char name[MAX_MUSICCLASS];
+ struct ast_format origwfmt;
+ struct ast_format mohwfmt;
++ int announcement;
+ int samples;
+ int sample_queue;
+ int pos;
+@@ -173,6 +174,7 @@
+ #define MOH_SORTALPHA (1 << 4)
+
+ #define MOH_CACHERTCLASSES (1 << 5) /*!< Should we use a separate instance of MOH for each user or not */
++#define MOH_ANNOUNCEMENT (1 << 6)
+
+ /* Custom astobj2 flag */
+ #define MOH_NOTDELETED (1 << 30) /*!< Find only records that aren't deleted? */
+@@ -183,6 +185,7 @@
+ char name[MAX_MUSICCLASS];
+ char dir[256];
+ char args[256];
++ char announcement[80];
+ char mode[80];
+ char digit;
+ /*! A dynamically sized array to hold the list of filenames in "files" mode */
+@@ -278,6 +281,7 @@
+ }
+
+ state->save_pos = state->pos;
++ state->announcement = 0;
+
+ state->class = mohclass_unref(state->class, "Unreffing channel's music class upon deactivation of generator");
+ }
+@@ -293,6 +297,16 @@
+ chan->stream = NULL;
+ }
+
++ if (ast_test_flag(state->class, MOH_ANNOUNCEMENT) && state->announcement == 0) {
++ state->announcement = 1;
++ if (ast_openstream_full(chan, state->class->announcement, chan->language, 1)) {
++ ast_debug(1, "%s Opened announcement '%s'\n", chan->name, state->class->announcement);
++ return 0;
++ }
++ } else {
++ state->announcement = 0;
++ }
++
+ if (!state->class->total_files) {
+ ast_log(LOG_WARNING, "No files available for class '%s'\n", state->class->name);
+ return -1;
+@@ -1731,7 +1745,10 @@
+ ast_copy_string(class->dir, var->value, sizeof(class->dir));
+ else if (!strcasecmp(var->name, "application"))
+ ast_copy_string(class->args, var->value, sizeof(class->args));
+- else if (!strcasecmp(var->name, "digit") && (isdigit(*var->value) || strchr("*#", *var->value)))
++ else if (!strcasecmp(var->name, "announcement")) {
++ ast_copy_string(class->announcement, var->value, sizeof(class->announcement));
++ ast_set_flag(class, MOH_ANNOUNCEMENT);
++ } else if (!strcasecmp(var->name, "digit") && (isdigit(*var->value) || strchr("*#", *var->value)))
+ class->digit = *var->value;
+ else if (!strcasecmp(var->name, "random"))
+ ast_set2_flag(class, ast_true(var->value), MOH_RANDOMIZE);