<p>Joshua Colp has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/14264">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">confbridge: Add support for disabling text messaging.<br><br>When in a conference bridge it may be necessary to have<br>text messages disabled for specific participants or for<br>all. This change adds a configuration option, "text_messaging",<br>which can be used to enable or disable this on the<br>user profile. By default existing behavior is preserved<br>as it defaults to "yes".<br><br>ASTERISK-28841<br><br>Change-Id: I30b5d9ae6f4803881d1ed9300590d405e392bc13<br>---<br>M apps/app_confbridge.c<br>M apps/confbridge/conf_config_parser.c<br>M apps/confbridge/include/confbridge.h<br>M configs/samples/confbridge.conf.sample<br>A doc/CHANGES-staging/confbridge_text_messaging.txt<br>M include/asterisk/bridge_features.h<br>M main/bridge.c<br>M main/bridge_channel.c<br>8 files changed, 41 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/64/14264/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/apps/app_confbridge.c b/apps/app_confbridge.c</span><br><span>index 0beffe7..fca0ed6 100644</span><br><span>--- a/apps/app_confbridge.c</span><br><span>+++ b/apps/app_confbridge.c</span><br><span>@@ -2628,6 +2628,13 @@</span><br><span>            user.features.dtmf_passthrough = 0;</span><br><span>  }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ /* Set if text messaging is enabled for this user or not */</span><br><span style="color: hsl(120, 100%, 40%);">+   if (ast_test_flag(&user.u_profile, USER_OPT_TEXT_MESSAGING)) {</span><br><span style="color: hsl(120, 100%, 40%);">+            user.features.text_messaging = 1;</span><br><span style="color: hsl(120, 100%, 40%);">+     } else {</span><br><span style="color: hsl(120, 100%, 40%);">+              user.features.text_messaging = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+     }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  /* Set dsp threshold values if present */</span><br><span>    if (user.u_profile.talking_threshold) {</span><br><span>              user.tech_args.talking_threshold = user.u_profile.talking_threshold;</span><br><span>diff --git a/apps/confbridge/conf_config_parser.c b/apps/confbridge/conf_config_parser.c</span><br><span>index b0c717a..3814d30 100644</span><br><span>--- a/apps/confbridge/conf_config_parser.c</span><br><span>+++ b/apps/confbridge/conf_config_parser.c</span><br><span>@@ -240,6 +240,13 @@</span><br><span>                             <configOption name="timeout"></span><br><span>                                        <synopsis>Kick the user out of the conference after this many seconds. 0 means there is no timeout for the user.</synopsis></span><br><span>                              </configOption></span><br><span style="color: hsl(120, 100%, 40%);">+                         <configOption name="text_messaging" default="yes"></span><br><span style="color: hsl(120, 100%, 40%);">+                                  <synopsis>Sets if text messages are sent to the user.</synopsis></span><br><span style="color: hsl(120, 100%, 40%);">+                                  <description><para>If text messaging is enabled for this user then</span><br><span style="color: hsl(120, 100%, 40%);">+                                        text messages will be sent to it. These may be events or from other</span><br><span style="color: hsl(120, 100%, 40%);">+                                   participants in the conference bridge. If disabled then no text</span><br><span style="color: hsl(120, 100%, 40%);">+                                       messages are sent to the user.</para></description></span><br><span style="color: hsl(120, 100%, 40%);">+                               </configOption></span><br><span>                        </configObject></span><br><span>                        <configObject name="bridge_profile"></span><br><span>                                 <synopsis>A named profile to apply to specific bridges.</synopsis></span><br><span>@@ -1588,7 +1595,10 @@</span><br><span>      ast_cli(a->fd,"Announce User Count all: %s\n",</span><br><span>          u_profile.flags & USER_OPT_ANNOUNCEUSERCOUNTALL ?</span><br><span>                "enabled" : "disabled");</span><br><span style="color: hsl(0, 100%, 40%);">-            ast_cli(a->fd,"\n");</span><br><span style="color: hsl(120, 100%, 40%);">+        ast_cli(a->fd,"Text Messaging:          %s\n",</span><br><span style="color: hsl(120, 100%, 40%);">+                u_profile.flags & USER_OPT_TEXT_MESSAGING ?</span><br><span style="color: hsl(120, 100%, 40%);">+                "enabled" : "disabled");</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_cli(a->fd, "\n");</span><br><span> </span><br><span>       return CLI_SUCCESS;</span><br><span> }</span><br><span>@@ -2381,6 +2391,7 @@</span><br><span>     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));</span><br><span>         aco_option_register(&cfg_info, "jitterbuffer", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_JITTERBUFFER);</span><br><span>   aco_option_register(&cfg_info, "timeout", ACO_EXACT, user_types, "0", OPT_UINT_T, 0, FLDSET(struct user_profile, timeout));</span><br><span style="color: hsl(120, 100%, 40%);">+   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);</span><br><span> </span><br><span>  /* This option should only be used with the CONFBRIDGE dialplan function */</span><br><span>  aco_option_register_custom(&cfg_info, "template", ACO_EXACT, user_types, NULL, user_template_handler, 0);</span><br><span>diff --git a/apps/confbridge/include/confbridge.h b/apps/confbridge/include/confbridge.h</span><br><span>index 82e709a..e48292a 100644</span><br><span>--- a/apps/confbridge/include/confbridge.h</span><br><span>+++ b/apps/confbridge/include/confbridge.h</span><br><span>@@ -68,6 +68,7 @@</span><br><span>     USER_OPT_ANNOUNCE_JOIN_LEAVE_REVIEW = (1 << 16), /*!< modifies ANNOUNCE_JOIN_LEAVE - user reviews the recording before continuing */</span><br><span>        USER_OPT_SEND_EVENTS = (1 << 17), /*!< Send text message events to users */</span><br><span>         USER_OPT_ECHO_EVENTS = (1 << 18), /*!< Send events only to the admin(s) */</span><br><span style="color: hsl(120, 100%, 40%);">+   USER_OPT_TEXT_MESSAGING = (1 << 19), /*!< Send text messages to the user */</span><br><span> };</span><br><span> </span><br><span> enum bridge_profile_flags {</span><br><span>diff --git a/configs/samples/confbridge.conf.sample b/configs/samples/confbridge.conf.sample</span><br><span>index 520b357..02edaa5 100644</span><br><span>--- a/configs/samples/confbridge.conf.sample</span><br><span>+++ b/configs/samples/confbridge.conf.sample</span><br><span>@@ -162,6 +162,9 @@</span><br><span>               ; is ejected from the conference, the user's channel will have the CONFBRIDGE_RESULT</span><br><span>               ; variable set to "TIMEOUT". A value of 0 indicates that there is no timeout.</span><br><span>               ; Default: 0</span><br><span style="color: hsl(120, 100%, 40%);">+;text_messaging=yes ; When set to yes text messages will be sent to this user. Text messages</span><br><span style="color: hsl(120, 100%, 40%);">+                    ; may occur as a result of events or can be received from other participants.</span><br><span style="color: hsl(120, 100%, 40%);">+                    ; When set to no text messages will not be sent to this user.</span><br><span> </span><br><span> ; --- ConfBridge Bridge Profile Options ---</span><br><span> [default_bridge]</span><br><span>diff --git a/doc/CHANGES-staging/confbridge_text_messaging.txt b/doc/CHANGES-staging/confbridge_text_messaging.txt</span><br><span>new file mode 100644</span><br><span>index 0000000..24315af</span><br><span>--- /dev/null</span><br><span>+++ b/doc/CHANGES-staging/confbridge_text_messaging.txt</span><br><span>@@ -0,0 +1,7 @@</span><br><span style="color: hsl(120, 100%, 40%);">+Subject: app_confbridge</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+A new option, "text_messaging", has been added to the user profile</span><br><span style="color: hsl(120, 100%, 40%);">+which allows control over whether text messaging is enabled or</span><br><span style="color: hsl(120, 100%, 40%);">+disabled for a user. If enabled (the default) text messages</span><br><span style="color: hsl(120, 100%, 40%);">+will be sent to the user. If disabled no text messages will be</span><br><span style="color: hsl(120, 100%, 40%);">+sent to the user.</span><br><span>diff --git a/include/asterisk/bridge_features.h b/include/asterisk/bridge_features.h</span><br><span>index 9b5f70f..a752997 100644</span><br><span>--- a/include/asterisk/bridge_features.h</span><br><span>+++ b/include/asterisk/bridge_features.h</span><br><span>@@ -279,6 +279,8 @@</span><br><span>    unsigned int dtmf_passthrough:1;</span><br><span>     /*! TRUE to avoid generating COLP frames when joining the bridge */</span><br><span>  unsigned int inhibit_colp:1;</span><br><span style="color: hsl(120, 100%, 40%);">+  /*! TRUE if text messaging is permitted. */</span><br><span style="color: hsl(120, 100%, 40%);">+   unsigned int text_messaging:1;</span><br><span> };</span><br><span> </span><br><span> /*!</span><br><span>diff --git a/main/bridge.c b/main/bridge.c</span><br><span>index ab9b1e6..c13cda2 100644</span><br><span>--- a/main/bridge.c</span><br><span>+++ b/main/bridge.c</span><br><span>@@ -3699,6 +3699,7 @@</span><br><span>     }</span><br><span> </span><br><span>        features->dtmf_passthrough = 1;</span><br><span style="color: hsl(120, 100%, 40%);">+    features->text_messaging = 1;</span><br><span> </span><br><span>         return 0;</span><br><span> }</span><br><span>diff --git a/main/bridge_channel.c b/main/bridge_channel.c</span><br><span>index 7d7d26a..8566187 100644</span><br><span>--- a/main/bridge_channel.c</span><br><span>+++ b/main/bridge_channel.c</span><br><span>@@ -1056,6 +1056,14 @@</span><br><span>             return 0;</span><br><span>    }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ if ((fr->frametype == AST_FRAME_TEXT || fr->frametype == AST_FRAME_TEXT_DATA) &&</span><br><span style="color: hsl(120, 100%, 40%);">+                !bridge_channel->features->text_messaging) {</span><br><span style="color: hsl(120, 100%, 40%);">+            /* This channel is not accepting text messages. */</span><br><span style="color: hsl(120, 100%, 40%);">+            ast_bridge_channel_unlock(bridge_channel);</span><br><span style="color: hsl(120, 100%, 40%);">+            bridge_frame_free(dup);</span><br><span style="color: hsl(120, 100%, 40%);">+               return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+     }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  if (DEBUG_ATLEAST(1)) {</span><br><span>              if (fr->frametype == AST_FRAME_TEXT) {</span><br><span>                    ast_log(LOG_DEBUG, "Queuing TEXT frame to '%s': %*.s\n", ast_channel_name(bridge_channel->chan),</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/14264">change 14264</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/14264"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I30b5d9ae6f4803881d1ed9300590d405e392bc13 </div>
<div style="display:none"> Gerrit-Change-Number: 14264 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>