[asterisk-commits] dvossel: branch dvossel/hd_confbridge r311425 - in /team/dvossel/hd_confbridg...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Mar 18 13:32:01 CDT 2011


Author: dvossel
Date: Fri Mar 18 13:31:57 2011
New Revision: 311425

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=311425
Log:
Addition of the DTMF passthrough option

Modified:
    team/dvossel/hd_confbridge/apps/app_confbridge.c
    team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c
    team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h
    team/dvossel/hd_confbridge/bridges/bridge_softmix.c
    team/dvossel/hd_confbridge/configs/confbridge.conf.sample
    team/dvossel/hd_confbridge/include/asterisk/bridging_features.h
    team/dvossel/hd_confbridge/main/bridging.c

Modified: team/dvossel/hd_confbridge/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/apps/app_confbridge.c?view=diff&rev=311425&r1=311424&r2=311425
==============================================================================
--- team/dvossel/hd_confbridge/apps/app_confbridge.c (original)
+++ team/dvossel/hd_confbridge/apps/app_confbridge.c Fri Mar 18 13:31:57 2011
@@ -877,6 +877,11 @@
 			ast_bridge_features_cleanup(&conference_bridge_user.features);
 			return -1;
 		}
+	}
+
+	/* Set if DTMF should pass through for this user or not */
+	if (ast_test_flag(&conference_bridge_user.u_profile, USER_OPT_DTMF_PASS)) {
+		conference_bridge_user.features.dtmf_passthrough = 1;
 	}
 
 	/* Set a talker indicate call back if talking detection is requested */

Modified: team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c?view=diff&rev=311425&r1=311424&r2=311425
==============================================================================
--- team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c (original)
+++ team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c Fri Mar 18 13:31:57 2011
@@ -236,10 +236,14 @@
 			u_profile->flags = ast_true(var->value) ?
 				u_profile->flags | USER_OPT_ENDMARKED :
 				u_profile->flags & ~USER_OPT_ENDMARKED;
-		} else if (!strcasecmp(var->name, "talk_detection")) {
+		} else if (!strcasecmp(var->name, "talk_detection_events")) {
 			u_profile->flags = ast_true(var->value) ?
 				u_profile->flags | USER_OPT_TALKER_DETECT :
 				u_profile->flags & ~USER_OPT_TALKER_DETECT;
+		} else if (!strcasecmp(var->name, "dtmf_passthrough")) {
+			u_profile->flags = ast_true(var->value) ?
+				u_profile->flags | USER_OPT_DTMF_PASS:
+				u_profile->flags & ~USER_OPT_DTMF_PASS;
 		} else if (!strcasecmp(var->name, "announce_join_leave")) {
 			u_profile->flags = ast_true(var->value) ?
 				u_profile->flags | USER_OPT_ANNOUNCE_JOIN_LEAVE :
@@ -515,8 +519,11 @@
 	ast_cli(a->fd,"Announce join/leave: %s\n",
 		u_profile.flags & USER_OPT_ANNOUNCE_JOIN_LEAVE ?
 		"enabled" : "disabled");
-	ast_cli(a->fd,"Talker Detection:    %s\n",
+	ast_cli(a->fd,"Talk Detect Events:  %s\n",
 		u_profile.flags & USER_OPT_TALKER_DETECT ?
+		"enabled" : "disabled");
+	ast_cli(a->fd,"DTMF Pass Through:   %s\n",
+		u_profile.flags & USER_OPT_DTMF_PASS ?
 		"enabled" : "disabled");
 	ast_cli(a->fd,"PIN:                 %s\n",
 		ast_strlen_zero(u_profile.pin) ?

Modified: team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h?view=diff&rev=311425&r1=311424&r2=311425
==============================================================================
--- team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h (original)
+++ team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h Fri Mar 18 13:31:57 2011
@@ -45,6 +45,7 @@
 	USER_OPT_ANNOUNCE_JOIN_LEAVE = (1 << 10), /*!< Sets if the user's name should be recorded and announced on join and leave. */
 	USER_OPT_TALKER_DETECT = (1 << 11), /*!< Sets if start and stop talking events should generated for this user over AMI. */
 	USER_OPT_DROP_SILENCE =  (1 << 12), /*!< Sets if silence should be dropped from the mix or not. */
+	USER_OPT_DTMF_PASS    =  (1 << 13), /*!< Sets if dtmf should be passed into the conference or not */
 };
 
 enum bridge_profile_flags {

Modified: team/dvossel/hd_confbridge/bridges/bridge_softmix.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/bridges/bridge_softmix.c?view=diff&rev=311425&r1=311424&r2=311425
==============================================================================
--- team/dvossel/hd_confbridge/bridges/bridge_softmix.c (original)
+++ team/dvossel/hd_confbridge/bridges/bridge_softmix.c Fri Mar 18 13:31:57 2011
@@ -398,6 +398,21 @@
 	return 0;
 }
 
+/*!
+ * \internal
+ * \brief If the bridging core passes DTMF to us, then they want it to be distributed out to all memebers. Do that here.
+ */
+static void softmix_pass_dtmf(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)
+{
+	struct ast_bridge_channel *tmp;
+	AST_LIST_TRAVERSE(&bridge->channels, tmp, entry) {
+		if (tmp == bridge_channel) {
+			continue;
+		}
+		ast_write(tmp->chan, frame);
+	}
+}
+
 /*! \brief Function called when a channel writes a frame into the bridge */
 static enum ast_bridge_write_result softmix_bridge_write(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)
 {
@@ -410,7 +425,10 @@
 	char update_talking = -1;  /* if this is set to 0 or 1, tell the bridge that the channel has started or stopped talking. */
 
 	/* Only accept audio frames, all others are unsupported */
-	if (frame->frametype != AST_FRAME_VOICE) {
+	if (frame->frametype == AST_FRAME_DTMF_END || frame->frametype == AST_FRAME_DTMF_BEGIN) {
+		softmix_pass_dtmf(bridge, bridge_channel, frame);
+		return AST_BRIDGE_WRITE_SUCCESS;
+	} else if (frame->frametype != AST_FRAME_VOICE) {
 		return AST_BRIDGE_WRITE_UNSUPPORTED;
 	}
 

Modified: team/dvossel/hd_confbridge/configs/confbridge.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/configs/confbridge.conf.sample?view=diff&rev=311425&r1=311424&r2=311425
==============================================================================
--- team/dvossel/hd_confbridge/configs/confbridge.conf.sample (original)
+++ team/dvossel/hd_confbridge/configs/confbridge.conf.sample Fri Mar 18 13:31:57 2011
@@ -51,9 +51,11 @@
                          ; name when entering the conference.  After the name is
                          ; recorded, it will be played as the user enters and exists
                          ; the conference. This option is off by default.
-;talk_detection=yes ; This option sets whether or not notifications of when a user
-                    ; begins and ends talking should be sent out as events over AMI.
-                    ; By default this option is off.
+;talk_detection_events=yes ; This option sets whether or not notifications of when a user
+                           ; begins and ends talking should be sent out as events over AMI.
+                           ; By default this option is off.
+;dtmf_passthrough=yes  ; Sets whether or not DTMF should pass through the conference.
+                       ; This option is off by default.
 
 ; --- ConfBridge Bridge Profile Options ---
 [default_bridge]

Modified: team/dvossel/hd_confbridge/include/asterisk/bridging_features.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/include/asterisk/bridging_features.h?view=diff&rev=311425&r1=311424&r2=311425
==============================================================================
--- team/dvossel/hd_confbridge/include/asterisk/bridging_features.h (original)
+++ team/dvossel/hd_confbridge/include/asterisk/bridging_features.h Fri Mar 18 13:31:57 2011
@@ -127,6 +127,9 @@
 	unsigned int usable:1;
 	/*! Bit to indicate whether the channel/bridge is muted or not */
 	unsigned int mute:1;
+	/*! Bit to indicate whether DTMF should be passed into the bridge tech or not.  */
+	unsigned int dtmf_passthrough:1;
+
 };
 
 /*!

Modified: team/dvossel/hd_confbridge/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/main/bridging.c?view=diff&rev=311425&r1=311424&r2=311425
==============================================================================
--- team/dvossel/hd_confbridge/main/bridging.c (original)
+++ team/dvossel/hd_confbridge/main/bridging.c Fri Mar 18 13:31:57 2011
@@ -299,14 +299,21 @@
 			ast_bridge_change_state(bridge_channel, AST_BRIDGE_CHANNEL_STATE_END);
 		} else if (frame->frametype == AST_FRAME_CONTROL && bridge_drop_control_frame(frame->subclass.integer)) {
 			ast_debug(1, "Dropping control frame from bridge channel %p\n", bridge_channel);
-		} else {
+		} else if (frame->frametype == AST_FRAME_DTMF_BEGIN || frame->frametype == AST_FRAME_DTMF_END) {
+			int dtmf_passthrough = bridge_channel->features ?
+				bridge_channel->features->dtmf_passthrough :
+				bridge->features.dtmf_passthrough;
+
 			if (frame->frametype == AST_FRAME_DTMF_BEGIN) {
 				frame = bridge_handle_dtmf(bridge, bridge_channel, frame);
 			}
-			/* Simply write the frame out to the bridge technology if it still exists */
-			if (frame) {
+
+			if (frame && dtmf_passthrough) {
 				bridge->technology->write(bridge, bridge_channel, frame);
 			}
+		} else {
+			/* Simply write the frame out to the bridge technology if it still exists */
+			bridge->technology->write(bridge, bridge_channel, frame);
 		}
 
 		if (frame) {




More information about the asterisk-commits mailing list