]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
app_bridgewait: Add option to not answer channel.
authorNaveen Albert <asterisk@phreaknet.org>
Fri, 9 Sep 2022 00:12:05 +0000 (00:12 +0000)
committerFriendly Automation <jenkins2@gerrit.asterisk.org>
Mon, 26 Sep 2022 15:39:28 +0000 (10:39 -0500)
Adds the n option to not answer the channel when calling
BridgeWait, so the application can be used without
forcing answer supervision.

ASTERISK-30216 #close

Change-Id: I6b85ef300b1f7b5170f8537e2b10889cc2e6605a

apps/app_bridgewait.c
doc/CHANGES-staging/app_bridgewait.txt [new file with mode: 0644]

index 9326ed14fb50c28b8e50fd6a70d0d2d991ac2851..86a4f7b10c4ae80c6127f3943021da4d75b072a0 100644 (file)
                                                <para>Automatically exit the bridge and return to the PBX after
                                                <emphasis>duration</emphasis> seconds.</para>
                                        </option>
+                                       <option name="n">
+                                               <para>Do not automatically answer the channel.</para>
+                                       </option>
                                </optionlist>
                        </parameter>
                </syntax>
                        The channel will then wait in the holding bridge until some event occurs
                        which removes it from the holding bridge.</para>
                        <note><para>This application will answer calls which haven't already
-                       been answered.</para></note>
+                       been answered, unless the n option is provided.</para></note>
                </description>
        </application>
  ***/
@@ -186,6 +189,7 @@ enum bridgewait_flags {
        MUXFLAG_MOHCLASS = (1 << 0),
        MUXFLAG_ENTERTAINMENT = (1 << 1),
        MUXFLAG_TIMEOUT = (1 << 2),
+       MUXFLAG_NOANSWER = (1 << 3),
 };
 
 enum bridgewait_args {
@@ -199,6 +203,7 @@ AST_APP_OPTIONS(bridgewait_opts, {
        AST_APP_OPTION_ARG('e', MUXFLAG_ENTERTAINMENT, OPT_ARG_ENTERTAINMENT),
        AST_APP_OPTION_ARG('m', MUXFLAG_MOHCLASS, OPT_ARG_MOHCLASS),
        AST_APP_OPTION_ARG('S', MUXFLAG_TIMEOUT, OPT_ARG_TIMEOUT),
+       AST_APP_OPTION('n', MUXFLAG_NOANSWER),
 });
 
 static int bridgewait_timeout_callback(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
@@ -458,7 +463,7 @@ static int bridgewait_exec(struct ast_channel *chan, const char *data)
        }
 
        /* Answer the channel if needed */
-       if (ast_channel_state(chan) != AST_STATE_UP) {
+       if (ast_channel_state(chan) != AST_STATE_UP && !ast_test_flag(&flags, MUXFLAG_NOANSWER)) {
                ast_answer(chan);
        }
 
diff --git a/doc/CHANGES-staging/app_bridgewait.txt b/doc/CHANGES-staging/app_bridgewait.txt
new file mode 100644 (file)
index 0000000..aa2e00b
--- /dev/null
@@ -0,0 +1,4 @@
+Subject: app_bridgewait
+
+Adds the n option to not answer the channel when
+the BridgeWait application is called.