[Asterisk-code-review] confbridge: Add support for disabling text messaging. (asterisk[17])
Friendly Automation
asteriskteam at digium.com
Mon Apr 20 11:32:28 CDT 2020
Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/14254 )
Change subject: confbridge: Add support for disabling text messaging.
......................................................................
confbridge: Add support for disabling text messaging.
When in a conference bridge it may be necessary to have
text messages disabled for specific participants or for
all. This change adds a configuration option, "text_messaging",
which can be used to enable or disable this on the
user profile. By default existing behavior is preserved
as it defaults to "yes".
ASTERISK-28841
Change-Id: I30b5d9ae6f4803881d1ed9300590d405e392bc13
---
M apps/app_confbridge.c
M apps/confbridge/conf_config_parser.c
M apps/confbridge/include/confbridge.h
M configs/samples/confbridge.conf.sample
A doc/CHANGES-staging/confbridge_text_messaging.txt
M include/asterisk/bridge_features.h
M main/bridge.c
M main/bridge_channel.c
8 files changed, 41 insertions(+), 1 deletion(-)
Approvals:
Benjamin Keith Ford: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
diff --git a/apps/app_confbridge.c b/apps/app_confbridge.c
index 0beffe7..fca0ed6 100644
--- a/apps/app_confbridge.c
+++ b/apps/app_confbridge.c
@@ -2628,6 +2628,13 @@
user.features.dtmf_passthrough = 0;
}
+ /* Set if text messaging is enabled for this user or not */
+ if (ast_test_flag(&user.u_profile, USER_OPT_TEXT_MESSAGING)) {
+ user.features.text_messaging = 1;
+ } else {
+ user.features.text_messaging = 0;
+ }
+
/* Set dsp threshold values if present */
if (user.u_profile.talking_threshold) {
user.tech_args.talking_threshold = user.u_profile.talking_threshold;
diff --git a/apps/confbridge/conf_config_parser.c b/apps/confbridge/conf_config_parser.c
index b0c717a..3814d30 100644
--- a/apps/confbridge/conf_config_parser.c
+++ b/apps/confbridge/conf_config_parser.c
@@ -240,6 +240,13 @@
<configOption name="timeout">
<synopsis>Kick the user out of the conference after this many seconds. 0 means there is no timeout for the user.</synopsis>
</configOption>
+ <configOption name="text_messaging" default="yes">
+ <synopsis>Sets if text messages are sent to the user.</synopsis>
+ <description><para>If text messaging is enabled for this user then
+ text messages will be sent to it. These may be events or from other
+ participants in the conference bridge. If disabled then no text
+ messages are sent to the user.</para></description>
+ </configOption>
</configObject>
<configObject name="bridge_profile">
<synopsis>A named profile to apply to specific bridges.</synopsis>
@@ -1588,7 +1595,10 @@
ast_cli(a->fd,"Announce User Count all: %s\n",
u_profile.flags & USER_OPT_ANNOUNCEUSERCOUNTALL ?
"enabled" : "disabled");
- ast_cli(a->fd,"\n");
+ ast_cli(a->fd,"Text Messaging: %s\n",
+ u_profile.flags & USER_OPT_TEXT_MESSAGING ?
+ "enabled" : "disabled");
+ ast_cli(a->fd, "\n");
return CLI_SUCCESS;
}
@@ -2381,6 +2391,7 @@
aco_option_register(&cfg_info, "dsp_talking_threshold", ACO_EXACT, user_types, __stringify(DEFAULT_TALKING_THRESHOLD), OPT_UINT_T, 0, FLDSET(struct user_profile, talking_threshold));
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);
/* 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);
diff --git a/apps/confbridge/include/confbridge.h b/apps/confbridge/include/confbridge.h
index 82e709a..e48292a 100644
--- a/apps/confbridge/include/confbridge.h
+++ b/apps/confbridge/include/confbridge.h
@@ -68,6 +68,7 @@
USER_OPT_ANNOUNCE_JOIN_LEAVE_REVIEW = (1 << 16), /*!< modifies ANNOUNCE_JOIN_LEAVE - user reviews the recording before continuing */
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 */
};
enum bridge_profile_flags {
diff --git a/configs/samples/confbridge.conf.sample b/configs/samples/confbridge.conf.sample
index 520b357..02edaa5 100644
--- a/configs/samples/confbridge.conf.sample
+++ b/configs/samples/confbridge.conf.sample
@@ -162,6 +162,9 @@
; is ejected from the conference, the user's channel will have the CONFBRIDGE_RESULT
; variable set to "TIMEOUT". A value of 0 indicates that there is no timeout.
; Default: 0
+;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.
; --- ConfBridge Bridge Profile Options ---
[default_bridge]
diff --git a/doc/CHANGES-staging/confbridge_text_messaging.txt b/doc/CHANGES-staging/confbridge_text_messaging.txt
new file mode 100644
index 0000000..24315af
--- /dev/null
+++ b/doc/CHANGES-staging/confbridge_text_messaging.txt
@@ -0,0 +1,7 @@
+Subject: app_confbridge
+
+A new option, "text_messaging", has been added to the user profile
+which allows control over whether text messaging is enabled or
+disabled for a user. If enabled (the default) text messages
+will be sent to the user. If disabled no text messages will be
+sent to the user.
diff --git a/include/asterisk/bridge_features.h b/include/asterisk/bridge_features.h
index f9af8fb..c1ce5f2 100644
--- a/include/asterisk/bridge_features.h
+++ b/include/asterisk/bridge_features.h
@@ -277,6 +277,8 @@
unsigned int mute:1;
/*! TRUE if DTMF should be passed into the bridge tech. */
unsigned int dtmf_passthrough:1;
+ /*! TRUE if text messaging is permitted. */
+ unsigned int text_messaging:1;
};
/*!
diff --git a/main/bridge.c b/main/bridge.c
index ab9b1e6..c13cda2 100644
--- a/main/bridge.c
+++ b/main/bridge.c
@@ -3699,6 +3699,7 @@
}
features->dtmf_passthrough = 1;
+ features->text_messaging = 1;
return 0;
}
diff --git a/main/bridge_channel.c b/main/bridge_channel.c
index 7d7d26a..8566187 100644
--- a/main/bridge_channel.c
+++ b/main/bridge_channel.c
@@ -1056,6 +1056,14 @@
return 0;
}
+ if ((fr->frametype == AST_FRAME_TEXT || fr->frametype == AST_FRAME_TEXT_DATA) &&
+ !bridge_channel->features->text_messaging) {
+ /* This channel is not accepting text messages. */
+ ast_bridge_channel_unlock(bridge_channel);
+ bridge_frame_free(dup);
+ return 0;
+ }
+
if (DEBUG_ATLEAST(1)) {
if (fr->frametype == AST_FRAME_TEXT) {
ast_log(LOG_DEBUG, "Queuing TEXT frame to '%s': %*.s\n", ast_channel_name(bridge_channel->chan),
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/14254
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 17
Gerrit-Change-Id: I30b5d9ae6f4803881d1ed9300590d405e392bc13
Gerrit-Change-Number: 14254
Gerrit-PatchSet: 2
Gerrit-Owner: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200420/9eb39fb7/attachment-0001.html>
More information about the asterisk-code-review
mailing list