[Asterisk-code-review] app_queue: Add music on hold option to Queue (asterisk[master])
N A
asteriskteam at digium.com
Sat Jan 22 09:55:01 CST 2022
N A has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/17940 )
Change subject: app_queue: Add music on hold option to Queue
......................................................................
app_queue: Add music on hold option to Queue
Adds the m option to the Queue application
which allows a music on hold class to be specified
at runtime which will override the class configured
in queues.conf.
This option functions like the m option to Dial.
ASTERISK-29876 #close
Change-Id: Ie25a48569cf8755c305c9438b1ed292c3adcf8d7
---
M apps/app_queue.c
M configs/samples/queues.conf.sample
A doc/CHANGES-staging/app_queue_music.txt
3 files changed, 25 insertions(+), 5 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/40/17940/1
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 9bd0537..4c90a64 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -185,10 +185,6 @@
<option name="H">
<para>Allow <emphasis>caller</emphasis> to hang up by pressing <literal>*</literal>.</para>
</option>
- <option name="n">
- <para>No retries on the timeout; will exit this application and
- go to the next step.</para>
- </option>
<option name="i">
<para>Ignore call forward requests from queue members and do nothing
when they are requested.</para>
@@ -197,6 +193,15 @@
<para>Asterisk will ignore any connected line update requests or any redirecting party
update requests it may receive on this dial attempt.</para>
</option>
+ <option name="m">
+ <para>Custom music on hold class to use, which will override the
+ music on hold class configured in <filename>queues.conf</filename>,
+ if specified.</para>
+ </option>
+ <option name="n">
+ <para>No retries on the timeout; will exit this application and
+ go to the next step.</para>
+ </option>
<option name="r">
<para>Ring instead of playing MOH. Periodic Announcements are still made, if applicable.</para>
</option>
@@ -1445,12 +1450,14 @@
OPT_CALLER_AUTOMON = (1 << 18),
OPT_PREDIAL_CALLEE = (1 << 19),
OPT_PREDIAL_CALLER = (1 << 20),
+ OPT_MUSICONHOLD_CLASS = (1 << 21),
};
enum {
OPT_ARG_CALLEE_GO_ON = 0,
OPT_ARG_PREDIAL_CALLEE,
OPT_ARG_PREDIAL_CALLER,
+ OPT_ARG_MUSICONHOLD_CLASS,
/* note: this entry _MUST_ be the last one in the enum */
OPT_ARG_ARRAY_SIZE
};
@@ -1468,6 +1475,7 @@
AST_APP_OPTION('I', OPT_IGNORE_CONNECTEDLINE),
AST_APP_OPTION('k', OPT_CALLEE_PARK),
AST_APP_OPTION('K', OPT_CALLER_PARK),
+ AST_APP_OPTION_ARG('m', OPT_MUSICONHOLD_CLASS, OPT_ARG_MUSICONHOLD_CLASS),
AST_APP_OPTION('n', OPT_NO_RETRY),
AST_APP_OPTION('r', OPT_RINGING),
AST_APP_OPTION('R', OPT_RING_WHEN_RINGING),
@@ -8506,6 +8514,12 @@
ast_app_exec_sub(NULL, chan, opt_args[OPT_ARG_PREDIAL_CALLER], 0);
}
+ /* Music on hold class override */
+ if (ast_test_flag(&opts, OPT_MUSICONHOLD_CLASS)
+ && !ast_strlen_zero(opt_args[OPT_ARG_MUSICONHOLD_CLASS])) {
+ ast_copy_string(qe.moh, opt_args[OPT_ARG_MUSICONHOLD_CLASS], sizeof(qe.moh));
+ }
+
copy_rules(&qe, args.rule);
qe.pr = AST_LIST_FIRST(&qe.qe_rules);
check_turns:
@@ -8522,7 +8536,7 @@
}
makeannouncement = qe.parent->announce_to_first_user;
-
+
for (;;) {
/* This is the wait loop for the head caller*/
/* To exit, they may get their call answered; */
diff --git a/configs/samples/queues.conf.sample b/configs/samples/queues.conf.sample
index aa7e03d..0a1a64e 100644
--- a/configs/samples/queues.conf.sample
+++ b/configs/samples/queues.conf.sample
@@ -64,6 +64,7 @@
;
; Musicclass sets which music applies for this particular call queue.
; The only class which can override this one is if the MOH class is set
+; using the m option when calling the Queue application or if set
; directly on the channel using Set(CHANNEL(musicclass)=whatever) in the
; dialplan.
;
diff --git a/doc/CHANGES-staging/app_queue_music.txt b/doc/CHANGES-staging/app_queue_music.txt
new file mode 100644
index 0000000..254a45d
--- /dev/null
+++ b/doc/CHANGES-staging/app_queue_music.txt
@@ -0,0 +1,5 @@
+Subject: app_queue
+
+The m option now allows an override music on hold
+class to be specified for the Queue application
+within the dialplan.
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/17940
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Ie25a48569cf8755c305c9438b1ed292c3adcf8d7
Gerrit-Change-Number: 17940
Gerrit-PatchSet: 1
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220122/0d1917c0/attachment-0001.html>
More information about the asterisk-code-review
mailing list