]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
app_confbridge: New option to prevent answer supervision
authorNaveen Albert <mail@interlinked.x10host.com>
Thu, 20 May 2021 14:51:32 +0000 (10:51 -0400)
committerGeorge Joseph <gjoseph@digium.com>
Tue, 8 Jun 2021 20:42:54 +0000 (15:42 -0500)
A new user option, answer_channel, adds the capability to
prevent answering the channel if it hasn't already been
answered yet.

ASTERISK-29440

Change-Id: I26642729d0345f178c7b8045506605c8402de54b

apps/app_confbridge.c
apps/confbridge/conf_config_parser.c
apps/confbridge/include/confbridge.h
configs/samples/confbridge.conf.sample
doc/CHANGES-staging/app_confbridge_answer.txt [new file with mode: 0644]

index 8ad188a5d8c4daab6b156fe04a1819f8df632198..8b88c5257cb7beb92be0cdba4d968398fdc744ce 100644 (file)
@@ -2535,10 +2535,6 @@ static int confbridge_exec(struct ast_channel *chan, const char *data)
                AST_APP_ARG(menu_profile_name);
        );
 
-       if (ast_channel_state(chan) != AST_STATE_UP) {
-               ast_answer(chan);
-       }
-
        if (ast_bridge_features_init(&user.features)) {
                pbx_builtin_setvar_helper(chan, "CONFBRIDGE_RESULT", "FAILED");
                res = -1;
@@ -2588,6 +2584,11 @@ static int confbridge_exec(struct ast_channel *chan, const char *data)
                goto confbridge_cleanup;
        }
 
+       /* If channel hasn't been answered already, answer it, unless we're explicitly not supposed to */
+       if ((ast_channel_state(chan) != AST_STATE_UP) && (ast_test_flag(&user.u_profile, USER_OPT_ANSWER_CHANNEL))) {
+               ast_answer(chan);
+       }
+
        quiet = ast_test_flag(&user.u_profile, USER_OPT_QUIET);
 
        /* ask for a PIN immediately after finding user profile.  This has to be
index 656acc650f4bcc02ea5b7f2e261bca7635970d46..e5e253bc94da8fe5223072819d39eaf0692a8994 100644 (file)
                                        participants in the conference bridge. If disabled then no text
                                        messages are sent to the user.</para></description>
                                </configOption>
+                               <configOption name="answer_channel" default="yes">
+                                       <synopsis>Sets if a user's channel should be answered if currently unanswered.</synopsis>
+                               </configOption>
                        </configObject>
                        <configObject name="bridge_profile">
                                <synopsis>A named profile to apply to specific bridges.</synopsis>
@@ -1609,9 +1612,12 @@ static char *handle_cli_confbridge_show_user_profile(struct ast_cli_entry *e, in
        ast_cli(a->fd,"Announce User Count all: %s\n",
                u_profile.flags & USER_OPT_ANNOUNCEUSERCOUNTALL ?
                "enabled" : "disabled");
-        ast_cli(a->fd,"Text Messaging:          %s\n",
-                u_profile.flags & USER_OPT_TEXT_MESSAGING ?
-                "enabled" : "disabled");
+       ast_cli(a->fd,"Text Messaging:          %s\n",
+                       u_profile.flags & USER_OPT_TEXT_MESSAGING ?
+                       "enabled" : "disabled");
+       ast_cli(a->fd,"Answer Channel:          %s\n",
+                       u_profile.flags & USER_OPT_ANSWER_CHANNEL ?
+                       "true" : "false");
        ast_cli(a->fd, "\n");
 
        return CLI_SUCCESS;
@@ -2410,6 +2416,7 @@ int conf_load_config(void)
        aco_option_register(&cfg_info, "jitterbuffer", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_JITTERBUFFER);
        aco_option_register(&cfg_info, "timeout", ACO_EXACT, user_types, "0", OPT_UINT_T, 0, FLDSET(struct user_profile, timeout));
        aco_option_register(&cfg_info, "text_messaging", ACO_EXACT, user_types, "yes", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_TEXT_MESSAGING);
+       aco_option_register(&cfg_info, "answer_channel", ACO_EXACT, user_types, "yes", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_ANSWER_CHANNEL);
 
        /* This option should only be used with the CONFBRIDGE dialplan function */
        aco_option_register_custom(&cfg_info, "template", ACO_EXACT, user_types, NULL, user_template_handler, 0);
index f4133593578cd446b9a7c25867122a987beb35ae..5ae49b7d6a68fd51aebd463a4d036278e0a121a5 100644 (file)
@@ -69,6 +69,7 @@ enum user_profile_flags {
        USER_OPT_SEND_EVENTS = (1 << 17), /*!< Send text message events to users */
        USER_OPT_ECHO_EVENTS = (1 << 18), /*!< Send events only to the admin(s) */
        USER_OPT_TEXT_MESSAGING = (1 << 19), /*!< Send text messages to the user */
+       USER_OPT_ANSWER_CHANNEL = (1 << 20), /*!< Sets if the channel should be answered if currently unanswered */
 };
 
 enum bridge_profile_flags {
index 7749c93ef7827cf2f3155e404ec8d133eca1213b..eecbb65d64eca09ba73601993daec60ee0563824 100644 (file)
@@ -165,6 +165,8 @@ type=user
 ;text_messaging=yes ; When set to yes text messages will be sent to this user. Text messages
                     ; may occur as a result of events or can be received from other participants.
                     ; When set to no text messages will not be sent to this user.
+;answer_channel=yes   ; Sets if the channel should be answered if it hasn't been already.
+                          ; On by default.
 
 ; --- ConfBridge Bridge Profile Options ---
 [default_bridge]
diff --git a/doc/CHANGES-staging/app_confbridge_answer.txt b/doc/CHANGES-staging/app_confbridge_answer.txt
new file mode 100644 (file)
index 0000000..b975f48
--- /dev/null
@@ -0,0 +1,6 @@
+Subject: app_confbridge answer supervision control
+
+app_confbridge now provides a user option to prevent
+answer supervision if the channel hasn't been
+answered yet. To use it, set a user profile's
+answer_channel option to no.