app_confbridge: New option to prevent answer supervision

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
This commit is contained in:
Naveen Albert 2021-05-20 10:51:32 -04:00 committed by Friendly Automation
parent 6cd89c4f0a
commit 95f588496d
5 changed files with 24 additions and 7 deletions

View 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

View File

@ -247,6 +247,9 @@
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);

View 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 {

View 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]

View File

@ -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.